1 /* $NetBSD: lfunc.h,v 1.1.1.1 2010/10/31 11:16:56 mbalmer Exp $ */ 2 3 /* 4 ** Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp 5 ** Auxiliary functions to manipulate prototypes and closures 6 ** See Copyright Notice in lua.h 7 */ 8 9 #ifndef lfunc_h 10 #define lfunc_h 11 12 13 #include "lobject.h" 14 15 16 #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 17 cast(int, sizeof(TValue)*((n)-1))) 18 19 #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 20 cast(int, sizeof(TValue *)*((n)-1))) 21 22 23 LUAI_FUNC Proto *luaF_newproto (lua_State *L); 24 LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 25 LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 26 LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 27 LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 28 LUAI_FUNC void luaF_close (lua_State *L, StkId level); 29 LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 30 LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 31 LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 32 LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 33 int pc); 34 35 36 #endif 37