lfunc.h
Go to the documentation of this file.
1 /*
2 ** $Id: lfunc.h $
3 ** Auxiliary functions to manipulate prototypes and closures
4 ** See Copyright Notice in lua.h
5 */
6 
7 #ifndef lfunc_h
8 #define lfunc_h
9 
10 
11 #include "lobject.h"
12 
13 
14 #define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \
15  cast_int(sizeof(TValue)) * (n))
16 
17 #define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \
18  cast_int(sizeof(TValue *)) * (n))
19 
20 
21 /* test whether thread is in 'twups' list */
22 #define isintwups(L) (L->twups != L)
23 
24 
25 /*
26 ** maximum number of upvalues in a closure (both C and Lua). (Value
27 ** must fit in a VM register.)
28 */
29 #define MAXUPVAL 255
30 
31 
32 #define upisopen(up) ((up)->v != &(up)->u.value)
33 
34 
35 #define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v))
36 
37 
38 /*
39 ** maximum number of misses before giving up the cache of closures
40 ** in prototypes
41 */
42 #define MAXMISS 10
43 
44 
45 /*
46 ** Special "status" for 'luaF_close'
47 */
48 
49 /* close upvalues without running their closing methods */
50 #define NOCLOSINGMETH (-1)
51 
52 /* close upvalues running all closing methods in protected mode */
53 #define CLOSEPROTECT (-2)
54 
55 
57 LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals);
58 LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals);
61 LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level);
62 LUAI_FUNC int luaF_close (lua_State *L, StkId level, int status);
65 LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
66  int pc);
67 
68 
69 #endif
LUAI_FUNC Proto * luaF_newproto(lua_State *L)
Definition: lfunc.c:246
Definition: lobject.h:528
#define LUAI_FUNC
Definition: luaconf.h:322
LUAI_FUNC void luaF_initupvals(lua_State *L, LClosure *cl)
Definition: lfunc.c:48
LUAI_FUNC LClosure * luaF_newLclosure(lua_State *L, int nupvals)
Definition: lfunc.c:35
LUAI_FUNC CClosure * luaF_newCclosure(lua_State *L, int nupvals)
Definition: lfunc.c:27
Definition: lobject.h:604
LUAI_FUNC const char * luaF_getlocalname(const Proto *func, int local_number, int pc)
Definition: lfunc.c:289
LUAI_FUNC UpVal * luaF_findupval(lua_State *L, StkId level)
Definition: lfunc.c:88
LUAI_FUNC void luaF_unlinkupval(UpVal *uv)
Definition: lfunc.c:215
LUAI_FUNC int luaF_close(lua_State *L, StkId level, int status)
Definition: lfunc.c:223
LUAI_FUNC void luaF_freeproto(lua_State *L, Proto *f)
Definition: lfunc.c:273
LUAI_FUNC void luaF_newtbcupval(lua_State *L, StkId level)
Definition: lfunc.c:194


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:09