diff options
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.30 2007/10/31 15:41:19 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.31 2008/02/11 15:45:30 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 | */ |
@@ -83,10 +83,11 @@ typedef struct global_State { | |||
83 | GCObject **sweepgc; /* position of sweep in `rootgc' */ | 83 | GCObject **sweepgc; /* position of sweep in `rootgc' */ |
84 | GCObject *gray; /* list of gray objects */ | 84 | GCObject *gray; /* list of gray objects */ |
85 | GCObject *grayagain; /* list of objects to be traversed atomically */ | 85 | GCObject *grayagain; /* list of objects to be traversed atomically */ |
86 | GCObject *weak; /* list of (something) weak tables */ | 86 | GCObject *weak; /* list of tables with weak values */ |
87 | GCObject *ephemeron; /* list of ephemeron tables */ | 87 | GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ |
88 | GCObject *allweak; /* list of all-weak tables */ | 88 | GCObject *allweak; /* list of all-weak tables */ |
89 | GCObject *tmudata; /* last element of list of userdata to be GC */ | 89 | GCObject *tmudata; /* list of userdata with finalizers */ |
90 | GCObject *tobefnz; /* last element of list of userdata to be GC */ | ||
90 | Mbuffer buff; /* temporary buffer for string concatentation */ | 91 | Mbuffer buff; /* temporary buffer for string concatentation */ |
91 | lu_mem GCthreshold; | 92 | lu_mem GCthreshold; |
92 | lu_mem totalbytes; /* number of bytes currently allocated */ | 93 | lu_mem totalbytes; /* number of bytes currently allocated */ |
@@ -143,7 +144,7 @@ struct lua_State { | |||
143 | ** Union of all collectable objects | 144 | ** Union of all collectable objects |
144 | */ | 145 | */ |
145 | union GCObject { | 146 | union GCObject { |
146 | GCheader gch; | 147 | GCheader gch; /* common header */ |
147 | union TString ts; | 148 | union TString ts; |
148 | union Udata u; | 149 | union Udata u; |
149 | union Closure cl; | 150 | union Closure cl; |
@@ -154,13 +155,15 @@ union GCObject { | |||
154 | }; | 155 | }; |
155 | 156 | ||
156 | 157 | ||
158 | #define gch(o) (&(o)->gch) | ||
159 | |||
157 | /* macros to convert a GCObject into a specific value */ | 160 | /* macros to convert a GCObject into a specific value */ |
158 | #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) | 161 | #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) |
159 | #define gco2ts(o) (&rawgco2ts(o)->tsv) | 162 | #define gco2ts(o) (&rawgco2ts(o)->tsv) |
160 | #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) | 163 | #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) |
161 | #define gco2u(o) (&rawgco2u(o)->uv) | 164 | #define gco2u(o) (&rawgco2u(o)->uv) |
162 | #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) | 165 | #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) |
163 | #define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) | 166 | #define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) |
164 | #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) | 167 | #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) |
165 | #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | 168 | #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) |
166 | #define ngcotouv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | 169 | #define ngcotouv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) |