00001 
00002 
00003 
00004 
00005 
00006 
00007 #ifndef ldo_h
00008 #define ldo_h
00009 
00010 
00011 #include "lobject.h"
00012 #include "lstate.h"
00013 #include "lzio.h"
00014 
00015 
00016 
00017 
00018  
00019 #ifndef HARDSTACKTESTS
00020 #define condhardstacktests(x)   {  }
00021 #else
00022 #define condhardstacktests(x)   x
00023 #endif
00024 
00025 
00026 #define luaD_checkstack(L,n)    \
00027   if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TObject)) \
00028     luaD_growstack(L, n); \
00029   else condhardstacktests(luaD_reallocstack(L, L->stacksize));
00030 
00031 
00032 #define incr_top(L) {luaD_checkstack(L,1); L->top++;}
00033 
00034 #define savestack(L,p)          ((char *)(p) - (char *)L->stack)
00035 #define restorestack(L,n)       ((TObject *)((char *)L->stack + (n)))
00036 
00037 #define saveci(L,p)             ((char *)(p) - (char *)L->base_ci)
00038 #define restoreci(L,n)          ((CallInfo *)((char *)L->base_ci + (n)))
00039 
00040 
00041 
00042 typedef void (*Pfunc) (lua_State *L, void *ud);
00043 
00044 
00045 void luaD_resetprotection (lua_State *L)
00046         ;
00047 int luaD_protectedparser (lua_State *L, ZIO *z, int bin)
00048         ;
00049 void luaD_callhook (lua_State *L, int event, int line)
00050         ;
00051 
00052 StkId luaD_precall (lua_State *L, StkId func)
00053         ;
00054 void luaD_call (lua_State *L, StkId func, int nResults)
00055         ;
00056 int luaD_pcall (lua_State *L, Pfunc func, void *u,
00057                 ptrdiff_t oldtop, ptrdiff_t ef)
00058         ;
00059 void luaD_poscall (lua_State *L, int wanted, StkId firstResult)
00060         ;
00061 void luaD_reallocCI (lua_State *L, int newsize)
00062         ;
00063 void luaD_reallocstack (lua_State *L, int newsize)
00064         ;
00065 void luaD_growstack (lua_State *L, int n)
00066         ;
00067 
00068 void luaD_throw (lua_State *L, int errcode)
00069         ;
00070 int luaD_rawrunprotected (lua_State *L, Pfunc f,  void *ud)
00071         ;
00072 
00073 
00074 #endif