ldo.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. ** $Id: ldo.h,v 1.50 2002/08/06 15:32:22 roberto Exp roberto $
  3. ** Stack and Call structure of Lua
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef ldo_h
  7. #define ldo_h
  8. #include "lobject.h"
  9. #include "lstate.h"
  10. #include "lzio.h"
  11. /*
  12. ** macro to increment stack top.
  13. ** There must be always an empty slot at the L->stack.top
  14. */
  15. #define incr_top(L) \
  16. {if (L->top >= L->stack_last) luaD_growstack(L, 1); L->top++;}
  17. #define luaD_checkstack(L,n) \
  18. if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TObject)) \
  19. luaD_growstack(L, n)
  20. #define savestack(L,p) ((char *)(p) - (char *)L->stack)
  21. #define restorestack(L,n) ((TObject *)((char *)L->stack + (n)))
  22. #define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
  23. #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
  24. /* type of protected functions, to be ran by `runprotected' */
  25. typedef void (*Pfunc) (lua_State *L, void *ud);
  26. void luaD_resetprotection (lua_State *L);
  27. int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
  28. void luaD_callhook (lua_State *L, lua_Hookevent event, int line);
  29. StkId luaD_precall (lua_State *L, StkId func);
  30. void luaD_call (lua_State *L, StkId func, int nResults);
  31. int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc);
  32. void luaD_poscall (lua_State *L, int wanted, StkId firstResult);
  33. void luaD_reallocCI (lua_State *L, int newsize);
  34. void luaD_reallocstack (lua_State *L, int newsize);
  35. void luaD_growstack (lua_State *L, int n);
  36. void luaD_throw (lua_State *L, int errcode);
  37. int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
  38. #endif