diff options
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.108 2014/07/17 13:53:37 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.109 2014/07/17 17:09:50 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 | */ |
@@ -183,29 +183,21 @@ union GCUnion { | |||
183 | }; | 183 | }; |
184 | 184 | ||
185 | 185 | ||
186 | #define gch(o) (&(o)->gch) | ||
187 | |||
188 | #define cast_u(o) cast(union GCUnion *, (o)) | 186 | #define cast_u(o) cast(union GCUnion *, (o)) |
189 | 187 | ||
190 | /* macros to convert a GCObject into a specific value */ | 188 | /* macros to convert a GCObject into a specific value */ |
191 | #define rawgco2ts(o) \ | 189 | #define rawgco2ts(o) \ |
192 | check_exp(novariant((o)->gch.tt) == LUA_TSTRING, &((cast_u(o))->ts)) | 190 | check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) |
193 | #define gco2ts(o) (&rawgco2ts(o)->tsv) | 191 | #define gco2ts(o) (&rawgco2ts(o)->tsv) |
194 | #define rawgco2u(o) \ | 192 | #define rawgco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) |
195 | check_exp((o)->gch.tt == LUA_TUSERDATA, &((cast_u(o))->u)) | ||
196 | #define gco2u(o) (&rawgco2u(o)->uv) | 193 | #define gco2u(o) (&rawgco2u(o)->uv) |
197 | #define gco2lcl(o) \ | 194 | #define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) |
198 | check_exp((o)->gch.tt == LUA_TLCL, &((cast_u(o))->cl.l)) | 195 | #define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) |
199 | #define gco2ccl(o) \ | ||
200 | check_exp((o)->gch.tt == LUA_TCCL, &((cast_u(o))->cl.c)) | ||
201 | #define gco2cl(o) \ | 196 | #define gco2cl(o) \ |
202 | check_exp(novariant((o)->gch.tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) | 197 | check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) |
203 | #define gco2t(o) \ | 198 | #define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) |
204 | check_exp((o)->gch.tt == LUA_TTABLE, &((cast_u(o))->h)) | 199 | #define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) |
205 | #define gco2p(o) \ | 200 | #define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) |
206 | check_exp((o)->gch.tt == LUA_TPROTO, &((cast_u(o))->p)) | ||
207 | #define gco2th(o) \ | ||
208 | check_exp((o)->gch.tt == LUA_TTHREAD, &((cast_u(o))->th)) | ||
209 | 201 | ||
210 | 202 | ||
211 | /* macro to convert any Lua object into a GCObject */ | 203 | /* macro to convert any Lua object into a GCObject */ |