From fe237ad8085f34e89fcd3610a9771215af63f03f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 1 Dec 1999 17:50:08 -0200 Subject: fixed stack; first version. --- lstate.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index 2ee31840..1b946312 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 1.22 1999/11/10 15:39:35 roberto Exp roberto $ +** $Id: lstate.h,v 1.23 1999/11/22 13:12:07 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -15,7 +15,7 @@ -typedef int StkId; /* index to stack elements */ +typedef TObject *StkId; /* index to stack elements */ /* @@ -27,17 +27,16 @@ struct lua_longjmp { }; -struct Stack { - TObject *top; - TObject *stack; - TObject *last; -}; - +/* +** stack layout for C point of view: +** [lua2C, lua2C+num) - `array' lua2C +** [lua2C+num, base) - space for extra lua_Objects +** [base, L->top) - `stack' C2Lua +*/ struct C_Lua_Stack { - StkId base; /* when Lua calls C or C calls Lua, points to */ - /* the first slot after the last parameter. */ - StkId lua2C; /* points to first element of "array" lua2C */ - int num; /* size of "array" lua2C */ + StkId base; + StkId lua2C; + int num; }; @@ -51,7 +50,9 @@ typedef struct stringtable { struct lua_State { /* thread-specific state */ - struct Stack stack; /* Lua stack */ + StkId top; /* first free slot in the stack */ + StkId stack; /* stack base */ + StkId stack_last; /* last free slot in the stack */ struct C_Lua_Stack Cstack; /* C2lua struct */ struct lua_longjmp *errorJmp; /* current error recover point */ char *Mbuffer; /* global buffer */ -- cgit v1.2.3-55-g6feb