diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-01 17:50:08 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-01 17:50:08 -0200 |
| commit | fe237ad8085f34e89fcd3610a9771215af63f03f (patch) | |
| tree | f7ee5d8f7d1ffb74e94f049aa6f31eb03606cdf6 /lstate.h | |
| parent | 3181dfefee40b9a424b80aa779c671f5f458904c (diff) | |
| download | lua-fe237ad8085f34e89fcd3610a9771215af63f03f.tar.gz lua-fe237ad8085f34e89fcd3610a9771215af63f03f.tar.bz2 lua-fe237ad8085f34e89fcd3610a9771215af63f03f.zip | |
fixed stack; first version.
Diffstat (limited to 'lstate.h')
| -rw-r--r-- | lstate.h | 27 |
1 files changed, 14 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 1.22 1999/11/10 15:39:35 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.23 1999/11/22 13:12: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 | */ |
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | typedef int StkId; /* index to stack elements */ | 18 | typedef TObject *StkId; /* index to stack elements */ |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| @@ -27,17 +27,16 @@ struct lua_longjmp { | |||
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | struct Stack { | 30 | /* |
| 31 | TObject *top; | 31 | ** stack layout for C point of view: |
| 32 | TObject *stack; | 32 | ** [lua2C, lua2C+num) - `array' lua2C |
| 33 | TObject *last; | 33 | ** [lua2C+num, base) - space for extra lua_Objects |
| 34 | }; | 34 | ** [base, L->top) - `stack' C2Lua |
| 35 | 35 | */ | |
| 36 | struct C_Lua_Stack { | 36 | struct C_Lua_Stack { |
| 37 | StkId base; /* when Lua calls C or C calls Lua, points to */ | 37 | StkId base; |
| 38 | /* the first slot after the last parameter. */ | 38 | StkId lua2C; |
| 39 | StkId lua2C; /* points to first element of "array" lua2C */ | 39 | int num; |
| 40 | int num; /* size of "array" lua2C */ | ||
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 43 | 42 | ||
| @@ -51,7 +50,9 @@ typedef struct stringtable { | |||
| 51 | 50 | ||
| 52 | struct lua_State { | 51 | struct lua_State { |
| 53 | /* thread-specific state */ | 52 | /* thread-specific state */ |
| 54 | struct Stack stack; /* Lua stack */ | 53 | StkId top; /* first free slot in the stack */ |
| 54 | StkId stack; /* stack base */ | ||
| 55 | StkId stack_last; /* last free slot in the stack */ | ||
| 55 | struct C_Lua_Stack Cstack; /* C2lua struct */ | 56 | struct C_Lua_Stack Cstack; /* C2lua struct */ |
| 56 | struct lua_longjmp *errorJmp; /* current error recover point */ | 57 | struct lua_longjmp *errorJmp; /* current error recover point */ |
| 57 | char *Mbuffer; /* global buffer */ | 58 | char *Mbuffer; /* global buffer */ |
