aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-12-10 10:13:36 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-12-10 10:13:36 -0200
commit47fc57a2529c83376883f36954082cfe80ae588f (patch)
treec2e57e2f9f7d78279144bfd9cbd04a3b1b131f12 /lstate.h
parent4d5fe1f54bc00850f77a7c42f9e95d0ff3f1ab5b (diff)
downloadlua-47fc57a2529c83376883f36954082cfe80ae588f.tar.gz
lua-47fc57a2529c83376883f36954082cfe80ae588f.tar.bz2
lua-47fc57a2529c83376883f36954082cfe80ae588f.zip
`TObject' renamed to `TValue' + other name changes and better assertions
for incremental garbage collection
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/lstate.h b/lstate.h
index 4a3ea577..66db36ae 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.118 2003/12/04 17:22:42 roberto Exp roberto $ 2** $Id: lstate.h,v 1.119 2003/12/04 18:52:23 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*/
@@ -111,7 +111,7 @@ typedef struct global_State {
111 lu_mem GCthreshold; 111 lu_mem GCthreshold;
112 lu_mem nblocks; /* number of `bytes' currently allocated */ 112 lu_mem nblocks; /* number of `bytes' currently allocated */
113 lua_CFunction panic; /* to be called in unprotected errors */ 113 lua_CFunction panic; /* to be called in unprotected errors */
114 TObject _registry; 114 TValue _registry;
115 struct lua_State *mainthread; 115 struct lua_State *mainthread;
116 Node dummynode[1]; /* common node array for all empty tables */ 116 Node dummynode[1]; /* common node array for all empty tables */
117 TString *tmname[TM_N]; /* array with tag-method names */ 117 TString *tmname[TM_N]; /* array with tag-method names */
@@ -140,7 +140,7 @@ struct lua_State {
140 int basehookcount; 140 int basehookcount;
141 int hookcount; 141 int hookcount;
142 lua_Hook hook; 142 lua_Hook hook;
143 TObject _gt; /* table of globals */ 143 TValue _gt; /* table of globals */
144 GCObject *openupval; /* list of open upvalues in this stack */ 144 GCObject *openupval; /* list of open upvalues in this stack */
145 GCObject *gclist; 145 GCObject *gclist;
146 struct lua_longjmp *errorJmp; /* current error recover point */ 146 struct lua_longjmp *errorJmp; /* current error recover point */
@@ -167,18 +167,20 @@ union GCObject {
167 167
168 168
169/* macros to convert a GCObject into a specific value */ 169/* macros to convert a GCObject into a specific value */
170#define gcotots(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) 170#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
171#define gcotou(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) 171#define gco2ts(o) (&rawgco2ts(o)->tsv)
172#define gcotocl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) 172#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
173#define gcotoh(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) 173#define gco2u(o) (&rawgco2u(o)->uv)
174#define gcotop(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) 174#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
175#define gcotouv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) 175#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
176#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
177#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
176#define ngcotouv(o) \ 178#define ngcotouv(o) \
177 check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) 179 check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
178#define gcototh(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) 180#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
179 181
180/* macro to convert any value into a GCObject */ 182/* macro to convert any Lua object into a GCObject */
181#define valtogco(v) (cast(GCObject *, (v))) 183#define obj2gco(v) (cast(GCObject *, (v)))
182 184
183 185
184lua_State *luaE_newthread (lua_State *L); 186lua_State *luaE_newthread (lua_State *L);