Expand file tree
/
Copy pathlfunc.h
More file actions
Latest commit
64 lines (41 loc) · 1.67 KB
/
Copy pathlfunc.h
File metadata and controls
64 lines (41 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
** $Id: lfunc.h $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
#ifndeflfunc_h
#definelfunc_h
#include"lobject.h"
#definesizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \
cast_int(sizeof(TValue)) * (n))
#definesizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \
cast_int(sizeof(TValue *)) * (n))
/* test whether thread is in 'twups' list */
#defineisintwups(L) (L->twups != L)
/*
** maximum number of upvalues in a closure (both C and Lua). (Value
** must fit in a VM register.)
*/
#defineMAXUPVAL 255
#defineupisopen(up) ((up)->v.p != &(up)->u.value)
#defineuplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p))
/*
** maximum number of misses before giving up the cache of closures
** in prototypes
*/
#defineMAXMISS 10
/* special status to close upvalues preserving the top of the stack */
#defineCLOSEKTOP (-1)
LUAI_FUNCProto*luaF_newproto (lua_State*L);
LUAI_FUNCCClosure*luaF_newCclosure (lua_State*L, intnupvals);
LUAI_FUNCLClosure*luaF_newLclosure (lua_State*L, intnupvals);
LUAI_FUNCvoidluaF_initupvals (lua_State*L, LClosure*cl);
LUAI_FUNCUpVal*luaF_findupval (lua_State*L, StkIdlevel);
LUAI_FUNCvoidluaF_newtbcupval (lua_State*L, StkIdlevel);
LUAI_FUNCvoidluaF_closeupval (lua_State*L, StkIdlevel);
LUAI_FUNCStkIdluaF_close (lua_State*L, StkIdlevel, intstatus, intyy);
LUAI_FUNCvoidluaF_unlinkupval (UpVal*uv);
LUAI_FUNCvoidluaF_freeproto (lua_State*L, Proto*f);
LUAI_FUNCconstchar*luaF_getlocalname (constProto*func, intlocal_number,
intpc);
#endif