aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/lstate.h b/lstate.h
index a54ffa62..9d88de6c 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.97 2002/10/08 18:46:08 roberto Exp roberto $ 2** $Id: lstate.h,v 1.98 2002/10/22 17:58:14 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*/
@@ -32,12 +32,6 @@
32#define lua_unlock(L) ((void) 0) 32#define lua_unlock(L) ((void) 0)
33#endif 33#endif
34 34
35/*
36** macro to allow the inclusion of user information in Lua state
37*/
38#ifndef LUA_USERSTATE
39#define LUA_USERSTATE
40#endif
41 35
42#ifndef lua_userstateopen 36#ifndef lua_userstateopen
43#define lua_userstateopen(l) 37#define lua_userstateopen(l)
@@ -124,6 +118,7 @@ typedef struct global_State {
124 lua_CFunction panic; /* to be called in unprotected errors */ 118 lua_CFunction panic; /* to be called in unprotected errors */
125 TObject _registry; 119 TObject _registry;
126 TObject _defaultmeta; 120 TObject _defaultmeta;
121 struct lua_State *mainthread;
127 Node dummynode[1]; /* common node array for all empty tables */ 122 Node dummynode[1]; /* common node array for all empty tables */
128 TString *tmname[TM_N]; /* array with tag-method names */ 123 TString *tmname[TM_N]; /* array with tag-method names */
129} global_State; 124} global_State;
@@ -133,7 +128,7 @@ typedef struct global_State {
133** `per thread' state 128** `per thread' state
134*/ 129*/
135struct lua_State { 130struct lua_State {
136 LUA_USERSTATE 131 CommonHeader;
137 StkId top; /* first free slot in the stack */ 132 StkId top; /* first free slot in the stack */
138 global_State *l_G; 133 global_State *l_G;
139 CallInfo *ci; /* call info for current function */ 134 CallInfo *ci; /* call info for current function */
@@ -150,15 +145,29 @@ struct lua_State {
150 GCObject *openupval; /* list of open upvalues in this stack */ 145 GCObject *openupval; /* list of open upvalues in this stack */
151 struct lua_longjmp *errorJmp; /* current error recover point */ 146 struct lua_longjmp *errorJmp; /* current error recover point */
152 ptrdiff_t errfunc; /* current error handling function (stack index) */ 147 ptrdiff_t errfunc; /* current error handling function (stack index) */
153 lua_State *next; /* circular double linked list of states */
154 lua_State *previous;
155}; 148};
156 149
157 150
158#define G(L) (L->l_G) 151#define G(L) (L->l_G)
159 152
160 153
161void luaE_closethread (lua_State *OL, lua_State *L); 154/*
155** Union of all collectable objects
156*/
157union GCObject {
158 GCheader gch;
159 union TString ts;
160 union Udata u;
161 union Closure cl;
162 struct Table h;
163 struct Proto p;
164 struct UpVal uv;
165 struct lua_State th; /* thread */
166};
167
168
169lua_State *luaE_newthread (lua_State *L);
170void luaE_freethread (lua_State *L, lua_State *L1);
162 171
163#endif 172#endif
164 173