ldo.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. ** $Id: ldo.h,v 1.44 2002/05/01 20:40:42 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. /* type of protected functions, to be ran by `runprotected' */
  23. typedef void (*Pfunc) (lua_State *L, void *v);
  24. int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
  25. void luaD_lineHook (lua_State *L, int line);
  26. StkId luaD_precall (lua_State *L, StkId func);
  27. void luaD_call (lua_State *L, StkId func, int nResults);
  28. int luaD_pcall (lua_State *L, int nargs, int nresults, const TObject *err);
  29. void luaD_poscall (lua_State *L, int wanted, StkId firstResult);
  30. void luaD_reallocCI (lua_State *L, int newsize);
  31. void luaD_reallocstack (lua_State *L, int newsize);
  32. void luaD_growstack (lua_State *L, int n);
  33. void luaD_error (lua_State *L, const char *s, int errcode);
  34. void luaD_errorobj (lua_State *L, const TObject *s, int errcode);
  35. int luaD_runprotected (lua_State *L, Pfunc f, TObject *ud);
  36. #endif