From 9fdf73bc9a6b4c6afbfff1d8181fface6b1c6761 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 28 Aug 2000 14:57:04 -0300 Subject: first version for new API --- lstate.h | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index d177c3a6..65e4c6ef 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 1.35 2000/08/07 18:39:16 roberto Exp roberto $ +** $Id: lstate.h,v 1.36 2000/08/08 20:42:07 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -19,27 +19,28 @@ typedef TObject *StkId; /* index to stack elements */ /* -** chain list of long jumps +** marks for Reference array */ -struct lua_longjmp { - jmp_buf b; - struct lua_longjmp *previous; - volatile int status; /* error code */ - StkId base; - int numCblocks; +#define NONEXT -1 /* to end the free list */ +#define HOLD -2 +#define COLLECTED -3 +#define LOCK -4 + + +struct Ref { + TObject o; + int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */ }; /* -** stack layout for C point of view: -** [lua2C, lua2C+num) - `array' lua2C -** [lua2C+num, base) - space for extra lua_Objects (limbo) -** [base, L->top) - `stack' C2Lua +** chain list of long jumps */ -struct C_Lua_Stack { +struct lua_longjmp { + jmp_buf b; + struct lua_longjmp *previous; + volatile int status; /* error code */ StkId base; - StkId lua2C; - int num; }; @@ -57,14 +58,12 @@ struct lua_State { StkId stack; /* stack base */ StkId stack_last; /* last free slot in the stack */ int stacksize; - struct C_Lua_Stack Cstack; /* C2lua struct */ + StkId Cbase; /* base for current C function */ struct lua_longjmp *errorJmp; /* current error recover point */ char *Mbuffer; /* global buffer */ size_t Mbuffbase; /* current first position of Mbuffer */ size_t Mbuffsize; /* size of Mbuffer */ size_t Mbuffnext; /* next position to fill in Mbuffer */ - struct C_Lua_Stack *Cblocks; - int numCblocks; /* number of nested Cblocks */ /* global state */ Proto *rootproto; /* list of all prototypes */ Closure *rootcl; /* list of all closures */ -- cgit v1.2.3-55-g6feb