rpm
4.5
|
00001 /* 00002 ** $Id: ldo.h,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ 00003 ** Stack and Call structure of Lua 00004 ** See Copyright Notice in lua.h 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 ** macro to control inclusion of some hard tests on stack reallocation 00018 */ 00019 #ifndef HARDSTACKTESTS 00020 #define condhardstacktests(x) { /* empty */ } 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 /* type of protected functions, to be ran by `runprotected' */ 00042 typedef void (*Pfunc) (lua_State *L, void *ud); 00043 00044 /*@unused@*/ 00045 void luaD_resetprotection (lua_State *L) 00046 /*@modifies L @*/; 00047 int luaD_protectedparser (lua_State *L, ZIO *z, int bin) 00048 /*@modifies L, z @*/; 00049 void luaD_callhook (lua_State *L, int event, int line) 00050 /*@modifies L @*/; 00051 /*@null@*/ 00052 StkId luaD_precall (lua_State *L, StkId func) 00053 /*@modifies L @*/; 00054 void luaD_call (lua_State *L, StkId func, int nResults) 00055 /*@modifies L @*/; 00056 int luaD_pcall (lua_State *L, Pfunc func, void *u, 00057 ptrdiff_t oldtop, ptrdiff_t ef) 00058 /*@modifies L @*/; 00059 void luaD_poscall (lua_State *L, int wanted, StkId firstResult) 00060 /*@modifies L @*/; 00061 void luaD_reallocCI (lua_State *L, int newsize) 00062 /*@modifies L @*/; 00063 void luaD_reallocstack (lua_State *L, int newsize) 00064 /*@modifies L @*/; 00065 void luaD_growstack (lua_State *L, int n) 00066 /*@modifies L @*/; 00067 00068 void luaD_throw (lua_State *L, int errcode) 00069 /*@modifies L @*/; 00070 int luaD_rawrunprotected (lua_State *L, Pfunc f, /*@null@*/ void *ud) 00071 /*@modifies L @*/; 00072 00073 00074 #endif