ldo.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. ** $Id: ldo.h,v 2.17 2009/11/25 15:27:51 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. #define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \
  12. luaD_growstack(L, n); else condmovestack(L);
  13. #define incr_top(L) {L->top++; luaD_checkstack(L,0);}
  14. #define savestack(L,p) ((char *)(p) - (char *)L->stack)
  15. #define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
  16. /* type of protected functions, to be ran by `runprotected' */
  17. typedef void (*Pfunc) (lua_State *L, void *ud);
  18. LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
  19. LUAI_FUNC void luaD_hook (lua_State *L, int event, int line);
  20. LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
  21. LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults,
  22. int allowyield);
  23. LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
  24. ptrdiff_t oldtop, ptrdiff_t ef);
  25. LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
  26. LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
  27. LUAI_FUNC void luaD_growstack (lua_State *L, int n);
  28. LUAI_FUNC void luaD_shrinkstack (lua_State *L);
  29. LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
  30. LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
  31. #endif