diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-31 16:15:01 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-31 16:15:01 -0300 |
| commit | 0214dab989396de05567f293e6aa909ee2ffbac1 (patch) | |
| tree | aceb320f49cd9c71bfc3fa75f2766082898a8192 | |
| parent | 821bd7025ea7ecf399e0b50f920a460b11c649c7 (diff) | |
| download | lua-0214dab989396de05567f293e6aa909ee2ffbac1.tar.gz lua-0214dab989396de05567f293e6aa909ee2ffbac1.tar.bz2 lua-0214dab989396de05567f293e6aa909ee2ffbac1.zip | |
yet another macro ('num_')
| -rw-r--r-- | lobject.h | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.54 2011/05/26 17:12:31 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.55 2011/05/31 18:24:36 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -100,6 +100,7 @@ typedef struct lua_TValue { | |||
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | #define val_(o) ((o)->value_) | 102 | #define val_(o) ((o)->value_) |
| 103 | #define num_(o) (val_(o).n) | ||
| 103 | 104 | ||
| 104 | 105 | ||
| 105 | /* raw type tag of a TValue */ | 106 | /* raw type tag of a TValue */ |
| @@ -131,7 +132,7 @@ typedef struct lua_TValue { | |||
| 131 | #define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) | 132 | #define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) |
| 132 | 133 | ||
| 133 | /* Macros to access values */ | 134 | /* Macros to access values */ |
| 134 | #define nvalue(o) check_exp(ttisnumber(o), val_(o).n) | 135 | #define nvalue(o) check_exp(ttisnumber(o), num_(o)) |
| 135 | #define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) | 136 | #define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) |
| 136 | #define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) | 137 | #define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) |
| 137 | #define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts) | 138 | #define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts) |
| @@ -162,9 +163,9 @@ typedef struct lua_TValue { | |||
| 162 | #define settt_(o,t) ((o)->tt_=(t)) | 163 | #define settt_(o,t) ((o)->tt_=(t)) |
| 163 | 164 | ||
| 164 | #define setnvalue(obj,x) \ | 165 | #define setnvalue(obj,x) \ |
| 165 | { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMBER); } | 166 | { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); } |
| 166 | 167 | ||
| 167 | #define changenvalue(o,x) check_exp(ttisnumber(o), val_(o).n=(x)) | 168 | #define changenvalue(o,x) check_exp(ttisnumber(o), num_(o)=(x)) |
| 168 | 169 | ||
| 169 | #define setnilvalue(obj) settt_(obj, LUA_TNIL) | 170 | #define setnilvalue(obj) settt_(obj, LUA_TNIL) |
| 170 | 171 | ||
