first version for new API

This commit is contained in:
Roberto Ierusalimschy
2000-08-28 14:57:04 -03:00
parent f1fd9b5c2c
commit 9fdf73bc9a
24 changed files with 1251 additions and 1405 deletions

View File

@@ -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
*/
@@ -18,6 +18,21 @@
typedef TObject *StkId; /* index to stack elements */
/*
** marks for Reference array
*/
#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) */
};
/*
** chain list of long jumps
*/
@@ -26,20 +41,6 @@ struct lua_longjmp {
struct lua_longjmp *previous;
volatile int status; /* error code */
StkId base;
int numCblocks;
};
/*
** 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
*/
struct C_Lua_Stack {
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 */