diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-11-19 15:29:23 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-11-19 15:29:23 -0200 |
commit | 592a3f289b428e3ee5cc595a266607ad7f5d94ff (patch) | |
tree | 19a371157be240f7e0f579117d04d466e911afcd /ldo.h | |
parent | 9cdeb275e7c93007b2ece6f81aaeafe530076805 (diff) | |
download | lua-592a3f289b428e3ee5cc595a266607ad7f5d94ff.tar.gz lua-592a3f289b428e3ee5cc595a266607ad7f5d94ff.tar.bz2 lua-592a3f289b428e3ee5cc595a266607ad7f5d94ff.zip |
first implementation of centralized global state.
Diffstat (limited to 'ldo.h')
-rw-r--r-- | ldo.h | 32 |
1 files changed, 7 insertions, 25 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.h,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ | 2 | ** $Id: ldo.h,v 1.2 1997/11/04 15:27:53 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -9,43 +9,25 @@ | |||
9 | 9 | ||
10 | 10 | ||
11 | #include "lobject.h" | 11 | #include "lobject.h" |
12 | #include "lstate.h" | ||
12 | 13 | ||
13 | 14 | ||
14 | typedef int StkId; /* index to luaD_stack.stack elements */ | ||
15 | |||
16 | #define MULT_RET 255 | 15 | #define MULT_RET 255 |
17 | 16 | ||
18 | 17 | ||
19 | extern struct Stack { | ||
20 | TObject *last; | ||
21 | TObject *stack; | ||
22 | TObject *top; | ||
23 | } luaD_stack; | ||
24 | |||
25 | |||
26 | extern struct C_Lua_Stack { | ||
27 | StkId base; /* when Lua calls C or C calls Lua, points to */ | ||
28 | /* the first slot after the last parameter. */ | ||
29 | StkId lua2C; /* points to first element of "array" lua2C */ | ||
30 | int num; /* size of "array" lua2C */ | ||
31 | } luaD_Cstack; | ||
32 | |||
33 | |||
34 | extern TObject luaD_errorim; | ||
35 | |||
36 | 18 | ||
37 | /* | 19 | /* |
38 | ** macro to increment stack top. | 20 | ** macro to increment stack top. |
39 | ** There must be always an empty slot at the luaD_stack.top | 21 | ** There must be always an empty slot at the L->stack.top |
40 | */ | 22 | */ |
41 | #define incr_top { if (luaD_stack.top >= luaD_stack.last) luaD_checkstack(1); \ | 23 | #define incr_top { if (L->stack.top >= L->stack.last) luaD_checkstack(1); \ |
42 | luaD_stack.top++; } | 24 | L->stack.top++; } |
43 | 25 | ||
44 | 26 | ||
45 | /* macros to convert from lua_Object to (TObject *) and back */ | 27 | /* macros to convert from lua_Object to (TObject *) and back */ |
46 | 28 | ||
47 | #define Address(lo) ((lo)+luaD_stack.stack-1) | 29 | #define Address(lo) ((lo)+L->stack.stack-1) |
48 | #define Ref(st) ((st)-luaD_stack.stack+1) | 30 | #define Ref(st) ((st)-L->stack.stack+1) |
49 | 31 | ||
50 | 32 | ||
51 | void luaD_init (void); | 33 | void luaD_init (void); |