diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-28 14:57:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-28 14:57:04 -0300 |
commit | 9fdf73bc9a6b4c6afbfff1d8181fface6b1c6761 (patch) | |
tree | da8d97d954e5ffabf9ff275df725f1e0a3a5b3e6 /lstate.h | |
parent | f1fd9b5c2c21f24d25d7813f431a3495702ebea6 (diff) | |
download | lua-9fdf73bc9a6b4c6afbfff1d8181fface6b1c6761.tar.gz lua-9fdf73bc9a6b4c6afbfff1d8181fface6b1c6761.tar.bz2 lua-9fdf73bc9a6b4c6afbfff1d8181fface6b1c6761.zip |
first version for new API
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.35 2000/08/07 18:39:16 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.36 2000/08/08 20:42:07 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -19,27 +19,28 @@ typedef TObject *StkId; /* index to stack elements */ | |||
19 | 19 | ||
20 | 20 | ||
21 | /* | 21 | /* |
22 | ** chain list of long jumps | 22 | ** marks for Reference array |
23 | */ | 23 | */ |
24 | struct lua_longjmp { | 24 | #define NONEXT -1 /* to end the free list */ |
25 | jmp_buf b; | 25 | #define HOLD -2 |
26 | struct lua_longjmp *previous; | 26 | #define COLLECTED -3 |
27 | volatile int status; /* error code */ | 27 | #define LOCK -4 |
28 | StkId base; | 28 | |
29 | int numCblocks; | 29 | |
30 | struct Ref { | ||
31 | TObject o; | ||
32 | int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */ | ||
30 | }; | 33 | }; |
31 | 34 | ||
32 | 35 | ||
33 | /* | 36 | /* |
34 | ** stack layout for C point of view: | 37 | ** chain list of long jumps |
35 | ** [lua2C, lua2C+num) - `array' lua2C | ||
36 | ** [lua2C+num, base) - space for extra lua_Objects (limbo) | ||
37 | ** [base, L->top) - `stack' C2Lua | ||
38 | */ | 38 | */ |
39 | struct C_Lua_Stack { | 39 | struct lua_longjmp { |
40 | jmp_buf b; | ||
41 | struct lua_longjmp *previous; | ||
42 | volatile int status; /* error code */ | ||
40 | StkId base; | 43 | StkId base; |
41 | StkId lua2C; | ||
42 | int num; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | 46 | ||
@@ -57,14 +58,12 @@ struct lua_State { | |||
57 | StkId stack; /* stack base */ | 58 | StkId stack; /* stack base */ |
58 | StkId stack_last; /* last free slot in the stack */ | 59 | StkId stack_last; /* last free slot in the stack */ |
59 | int stacksize; | 60 | int stacksize; |
60 | struct C_Lua_Stack Cstack; /* C2lua struct */ | 61 | StkId Cbase; /* base for current C function */ |
61 | struct lua_longjmp *errorJmp; /* current error recover point */ | 62 | struct lua_longjmp *errorJmp; /* current error recover point */ |
62 | char *Mbuffer; /* global buffer */ | 63 | char *Mbuffer; /* global buffer */ |
63 | size_t Mbuffbase; /* current first position of Mbuffer */ | 64 | size_t Mbuffbase; /* current first position of Mbuffer */ |
64 | size_t Mbuffsize; /* size of Mbuffer */ | 65 | size_t Mbuffsize; /* size of Mbuffer */ |
65 | size_t Mbuffnext; /* next position to fill in Mbuffer */ | 66 | size_t Mbuffnext; /* next position to fill in Mbuffer */ |
66 | struct C_Lua_Stack *Cblocks; | ||
67 | int numCblocks; /* number of nested Cblocks */ | ||
68 | /* global state */ | 67 | /* global state */ |
69 | Proto *rootproto; /* list of all prototypes */ | 68 | Proto *rootproto; /* list of all prototypes */ |
70 | Closure *rootcl; /* list of all closures */ | 69 | Closure *rootcl; /* list of all closures */ |