diff options
Diffstat (limited to 'lfunc.h')
-rw-r--r-- | lfunc.h | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.h,v 2.8 2012/05/08 13:53:33 roberto Exp roberto $ | 2 | ** $Id: lfunc.h,v 2.9 2013/08/07 12:18:11 roberto Exp roberto $ |
3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -18,10 +18,28 @@ | |||
18 | cast(int, sizeof(TValue *)*((n)-1))) | 18 | cast(int, sizeof(TValue *)*((n)-1))) |
19 | 19 | ||
20 | 20 | ||
21 | /* | ||
22 | ** Upvalues for Lua closures | ||
23 | */ | ||
24 | struct UpVal { | ||
25 | TValue *v; /* points to stack or to its own value */ | ||
26 | unsigned int refcount; /* reference counter */ | ||
27 | union { | ||
28 | struct { /* (when open) */ | ||
29 | UpVal *next; /* linked list */ | ||
30 | int touched; /* mark to avoid cycles with dead threads */ | ||
31 | } op; | ||
32 | TValue value; /* the value (when closed) */ | ||
33 | } u; | ||
34 | }; | ||
35 | |||
36 | #define upisopen(up) ((up)->v != &(up)->u.value) | ||
37 | |||
38 | |||
21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); | 39 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); |
22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems); | 40 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems); |
23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems); | 41 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems); |
24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); | 42 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); |
25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | 43 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); |
26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); | 44 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); |
27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); | 45 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); |