rpm  4.5
ldo.h
Go to the documentation of this file.
1 /*
2 ** $Id: ldo.h,v 1.1 2004/03/16 21:58:30 niemeyer Exp $
3 ** Stack and Call structure of Lua
4 ** See Copyright Notice in lua.h
5 */
6 
7 #ifndef ldo_h
8 #define ldo_h
9 
10 
11 #include "lobject.h"
12 #include "lstate.h"
13 #include "lzio.h"
14 
15 
16 /*
17 ** macro to control inclusion of some hard tests on stack reallocation
18 */
19 #ifndef HARDSTACKTESTS
20 #define condhardstacktests(x) { /* empty */ }
21 #else
22 #define condhardstacktests(x) x
23 #endif
24 
25 
26 #define luaD_checkstack(L,n) \
27  if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TObject)) \
28  luaD_growstack(L, n); \
29  else condhardstacktests(luaD_reallocstack(L, L->stacksize));
30 
31 
32 #define incr_top(L) {luaD_checkstack(L,1); L->top++;}
33 
34 #define savestack(L,p) ((char *)(p) - (char *)L->stack)
35 #define restorestack(L,n) ((TObject *)((char *)L->stack + (n)))
36 
37 #define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
38 #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
39 
40 
41 /* type of protected functions, to be ran by `runprotected' */
42 typedef void (*Pfunc) (lua_State *L, void *ud);
43 
44 /*@unused@*/
46  /*@modifies L @*/;
47 int luaD_protectedparser (lua_State *L, ZIO *z, int bin)
48  /*@modifies L, z @*/;
49 void luaD_callhook (lua_State *L, int event, int line)
50  /*@modifies L @*/;
51 /*@null@*/
53  /*@modifies L @*/;
54 void luaD_call (lua_State *L, StkId func, int nResults)
55  /*@modifies L @*/;
56 int luaD_pcall (lua_State *L, Pfunc func, void *u,
57  ptrdiff_t oldtop, ptrdiff_t ef)
58  /*@modifies L @*/;
59 void luaD_poscall (lua_State *L, int wanted, StkId firstResult)
60  /*@modifies L @*/;
61 void luaD_reallocCI (lua_State *L, int newsize)
62  /*@modifies L @*/;
63 void luaD_reallocstack (lua_State *L, int newsize)
64  /*@modifies L @*/;
65 void luaD_growstack (lua_State *L, int n)
66  /*@modifies L @*/;
67 
68 void luaD_throw (lua_State *L, int errcode)
69  /*@modifies L @*/;
70 int luaD_rawrunprotected (lua_State *L, Pfunc f, /*@null@*/ void *ud)
71  /*@modifies L @*/;
72 
73 
74 #endif