diff options
| author | Lua Team <team@lua.org> | 2014-03-21 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2014-03-21 12:00:00 +0000 |
| commit | 05a6ab2dd30e7707c7d5424b905eb93a1dd5c5b2 (patch) | |
| tree | f24db6e4692bebf7031418ff9c3b51b345016023 /src/lfunc.h | |
| parent | 87cc247b6b22184fba47184c218a642ea7a49e96 (diff) | |
| download | lua-github-5.3.0-work2.tar.gz | |
Lua 5.3.0-work25.3.0-work2
Diffstat (limited to 'src/lfunc.h')
| -rw-r--r-- | src/lfunc.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/lfunc.h b/src/lfunc.h index e236a717..dce699bc 100644 --- a/src/lfunc.h +++ b/src/lfunc.h @@ -1,5 +1,5 @@ /* -** $Id: lfunc.h,v 2.8 2012/05/08 13:53:33 roberto Exp $ +** $Id: lfunc.h,v 2.13 2014/02/18 13:39:37 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -18,14 +18,35 @@ cast(int, sizeof(TValue *)*((n)-1))) +/* test whether thread is in 'twups' list */ +#define isintwups(L) (L->twups != L) + + +/* +** Upvalues for Lua closures +*/ +struct UpVal { + TValue *v; /* points to stack or to its own value */ + lu_mem refcount; /* reference counter */ + union { + struct { /* (when open) */ + UpVal *next; /* linked list */ + int touched; /* mark to avoid cycles with dead threads */ + } open; + TValue value; /* the value (when closed) */ + } u; +}; + +#define upisopen(up) ((up)->v != &(up)->u.value) + + LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems); LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems); -LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); LUAI_FUNC void luaF_close (lua_State *L, StkId level); LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, int pc); |
