lfunc.h 1.1 KB

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