diff options
Diffstat (limited to 'lstate.h')
| -rw-r--r-- | lstate.h | 26 |
1 files changed, 14 insertions, 12 deletions
| @@ -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 | ||
| 184 | lua_State *luaE_newthread (lua_State *L); | 186 | lua_State *luaE_newthread (lua_State *L); |
