3 ** Auxiliary functions to manipulate prototypes and closures
4 ** See Copyright Notice in lua.h
14 #define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \
15 cast_int(sizeof(TValue)) * (n))
17 #define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \
18 cast_int(sizeof(TValue *)) * (n))
21 /* test whether thread is in 'twups' list */
22 #define isintwups(L) (L->twups != L)
26 ** maximum number of upvalues in a closure (both C and Lua). (Value
27 ** must fit in a VM register.)
32 #define upisopen(up) ((up)->v.p != &(up)->u.value)
35 #define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p))
39 ** maximum number of misses before giving up the cache of closures
46 /* special status to close upvalues preserving the top of the stack */
47 #define CLOSEKTOP (-1)
50 LUAI_FUNC Proto
*luaF_newproto(lua_State
*L
);
51 LUAI_FUNC CClosure
*luaF_newCclosure(lua_State
*L
, int nupvals
);
52 LUAI_FUNC LClosure
*luaF_newLclosure(lua_State
*L
, int nupvals
);
53 LUAI_FUNC
void luaF_initupvals(lua_State
*L
, LClosure
*cl
);
54 LUAI_FUNC UpVal
*luaF_findupval(lua_State
*L
, StkId level
);
55 LUAI_FUNC
void luaF_newtbcupval(lua_State
*L
, StkId level
);
56 LUAI_FUNC
void luaF_closeupval(lua_State
*L
, StkId level
);
57 LUAI_FUNC StkId
luaF_close(lua_State
*L
, StkId level
, int status
, int yy
);
58 LUAI_FUNC
void luaF_unlinkupval(UpVal
*uv
);
59 LUAI_FUNC
void luaF_freeproto(lua_State
*L
, Proto
*f
);
60 LUAI_FUNC
const char *luaF_getlocalname(const Proto
*func
, int local_number
,