diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-29 12:06:44 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-29 12:06:44 -0300 |
| commit | f96497397addca22f22a6ba6eeabc906be43f16b (patch) | |
| tree | af8d27b9af36dfe0b0b6e0f765ea90b95b110efc /lobject.h | |
| parent | 5a1c8d8ef343bf0157851a4832c2c937b812b64f (diff) | |
| download | lua-f96497397addca22f22a6ba6eeabc906be43f16b.tar.gz lua-f96497397addca22f22a6ba6eeabc906be43f16b.tar.bz2 lua-f96497397addca22f22a6ba6eeabc906be43f16b.zip | |
new type 'StackValue' for stack elements
(we may want to put extra info there in the future)
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 33 |
1 files changed, 22 insertions, 11 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.123 2017/06/12 14:21:44 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.124 2017/06/27 11:35:31 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 | */ |
| @@ -110,7 +110,7 @@ typedef union Value { | |||
| 110 | #define TValuefields Value value_; lu_byte tt_ | 110 | #define TValuefields Value value_; lu_byte tt_ |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | typedef struct lua_TValue { | 113 | typedef struct TValue { |
| 114 | TValuefields; | 114 | TValuefields; |
| 115 | } TValue; | 115 | } TValue; |
| 116 | 116 | ||
| @@ -282,13 +282,15 @@ typedef struct lua_TValue { | |||
| 282 | ** different types of assignments, according to destination | 282 | ** different types of assignments, according to destination |
| 283 | */ | 283 | */ |
| 284 | 284 | ||
| 285 | /* from stack to (same) stack */ | 285 | /* from stack to stack */ |
| 286 | #define setobjs2s setobj | 286 | #define setobjs2s(L,o1,o2) setobj(L,s2v(o1),s2v(o2)) |
| 287 | /* to stack (not from same stack) */ | 287 | /* to stack (not from same stack) */ |
| 288 | #define setobj2s setobj | 288 | #define setobj2s(L,o1,o2) setobj(L,s2v(o1),o2) |
| 289 | #define setsvalue2s setsvalue | 289 | #define setsvalue2s(L,o,s) setsvalue(L,s2v(o),s) |
| 290 | #define sethvalue2s sethvalue | 290 | #define sethvalue2s(L,o,h) sethvalue(L,s2v(o),h) |
| 291 | #define setptvalue2s setptvalue | 291 | #define setthvalue2s(L,o,t) setthvalue(L,s2v(o),t) |
| 292 | #define setptvalue2s(L,o,p) setptvalue(L,s2v(o),p) | ||
| 293 | #define setclLvalue2s(L,o,cl) setclLvalue(L,s2v(o),cl) | ||
| 292 | /* from table to same table */ | 294 | /* from table to same table */ |
| 293 | #define setobjt2t setobj | 295 | #define setobjt2t setobj |
| 294 | /* to new object */ | 296 | /* to new object */ |
| @@ -307,9 +309,16 @@ typedef struct lua_TValue { | |||
| 307 | */ | 309 | */ |
| 308 | 310 | ||
| 309 | 311 | ||
| 310 | typedef TValue *StkId; /* index to stack elements */ | 312 | typedef union StackValue { |
| 313 | TValue val; | ||
| 314 | } StackValue; | ||
| 311 | 315 | ||
| 312 | 316 | ||
| 317 | typedef StackValue *StkId; /* index to stack elements */ | ||
| 318 | |||
| 319 | /* convert a 'StackValue' to a 'TValue' */ | ||
| 320 | #define s2v(o) (&(o)->val) | ||
| 321 | |||
| 313 | 322 | ||
| 314 | 323 | ||
| 315 | /* | 324 | /* |
| @@ -620,11 +629,13 @@ LUAI_FUNC int luaO_int2fb (unsigned int x); | |||
| 620 | LUAI_FUNC int luaO_fb2int (int x); | 629 | LUAI_FUNC int luaO_fb2int (int x); |
| 621 | LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); | 630 | LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); |
| 622 | LUAI_FUNC int luaO_ceillog2 (unsigned int x); | 631 | LUAI_FUNC int luaO_ceillog2 (unsigned int x); |
| 632 | LUAI_FUNC int luaO_rawarith (lua_State *L, int op, const TValue *p1, | ||
| 633 | const TValue *p2, TValue *res); | ||
| 623 | LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, | 634 | LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, |
| 624 | const TValue *p2, TValue *res); | 635 | const TValue *p2, StkId res); |
| 625 | LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); | 636 | LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); |
| 626 | LUAI_FUNC int luaO_hexavalue (int c); | 637 | LUAI_FUNC int luaO_hexavalue (int c); |
| 627 | LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); | 638 | LUAI_FUNC void luaO_tostring (lua_State *L, TValue *obj); |
| 628 | LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, | 639 | LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, |
| 629 | va_list argp); | 640 | va_list argp); |
| 630 | LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); | 641 | LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); |
