11 #include "lobject.h" |
11 #include "lobject.h" |
12 #include "lstate.h" |
12 #include "lstate.h" |
13 #include "lzio.h" |
13 #include "lzio.h" |
14 |
14 |
15 |
15 |
16 #define luaD_checkstack(L,n) \ |
16 #define luaD_checkstack(L,n) \ |
17 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ |
17 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ |
18 luaD_growstack(L, n); \ |
18 luaD_growstack(L, n); \ |
19 else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); |
19 else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); |
20 |
20 |
21 |
21 |
22 #define incr_top(L) {luaD_checkstack(L,1); L->top++;} |
22 #define incr_top(L) {luaD_checkstack(L,1); L->top++;} |
23 |
23 |
24 #define savestack(L,p) ((char *)(p) - (char *)L->stack) |
24 #define savestack(L,p) ((char *)(p) - (char *)L->stack) |
25 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) |
25 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) |
26 |
26 |
27 #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) |
27 #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) |
28 #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) |
28 #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) |
29 |
29 |
30 |
30 |
31 /* results from luaD_precall */ |
31 /* results from luaD_precall */ |
32 #define PCRLUA 0 /* initiated a call to a Lua function */ |
32 #define PCRLUA 0 /* initiated a call to a Lua function */ |
33 #define PCRC 1 /* did a call to a C function */ |
33 #define PCRC 1 /* did a call to a C function */ |
34 #define PCRYIELD 2 /* C funtion yielded */ |
34 #define PCRYIELD 2 /* C funtion yielded */ |
35 |
35 |
36 |
36 |
37 /* type of protected functions, to be ran by `runprotected' */ |
37 /* type of protected functions, to be ran by `runprotected' */ |
38 typedef void (*Pfunc) (lua_State *L, void *ud); |
38 typedef void (*Pfunc) (lua_State *L, void *ud); |
39 |
39 |