diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-27 18:01:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-27 18:01:44 -0300 |
commit | 8332d5c8a5059b85da1adaa3f0197d0f57afae81 (patch) | |
tree | 8a2f59ff0803da3afbc7e8a409911c920d624e94 /lobject.h | |
parent | 885961be1d8e3f703b54d1d19e6c63617cd2ed24 (diff) | |
download | lua-github-8332d5c8a5059b85da1adaa3f0197d0f57afae81.tar.gz |
parser fully reentrant(!)
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 1.159 2003/03/18 12:50:04 roberto Exp roberto $ +** $Id: lobject.h,v 1.160 2003/04/28 19:26:16 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -92,44 +92,49 @@ typedef struct lua_TObject { #define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) /* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + #define setnvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); } + { TObject *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } #define chgnvalue(obj,x) \ check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x)) #define setpvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); } + { TObject *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } #define setbvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); } + { TObject *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } #define setsvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TSTRING; \ - i_o->value.gc=cast(GCObject *, (x)); \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); } #define setuvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; \ - i_o->value.gc=cast(GCObject *, (x)); \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); } #define setthvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TTHREAD; \ - i_o->value.gc=cast(GCObject *, (x)); \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); } #define setclvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; \ - i_o->value.gc=cast(GCObject *, (x)); \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); } #define sethvalue(obj,x) \ - { TObject *i_o=(obj); i_o->tt=LUA_TTABLE; \ - i_o->value.gc=cast(GCObject *, (x)); \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); } -#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) +#define setptvalue(obj,x) \ + { TObject *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + lua_assert(i_o->value.gc->gch.tt == LUA_TPROTO); } @@ -155,6 +160,8 @@ typedef struct lua_TObject { /* to stack (not from same stack) */ #define setobj2s setobj #define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue /* from table to same table */ #define setobjt2t setobj /* to table */ |