diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-08 15:27:13 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-08 15:27:13 -0300 |
| commit | 8ca9534d048782af13141874e0d2fec0d0f806af (patch) | |
| tree | d58ab47be12ff9d5910ffaf6222cf94bd0dff0f6 | |
| parent | 8bcf6228765e56be19feb90c8805cc2fb2223188 (diff) | |
| download | lua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.gz lua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.bz2 lua-8ca9534d048782af13141874e0d2fec0d0f806af.zip | |
access to `values' in TObject always through macros
| -rw-r--r-- | lapi.c | 20 | ||||
| -rw-r--r-- | lbuiltin.c | 14 | ||||
| -rw-r--r-- | ldebug.c | 4 | ||||
| -rw-r--r-- | lgc.c | 4 | ||||
| -rw-r--r-- | lobject.c | 4 | ||||
| -rw-r--r-- | lobject.h | 6 | ||||
| -rw-r--r-- | lref.c | 8 | ||||
| -rw-r--r-- | ltable.c | 4 | ||||
| -rw-r--r-- | ltests.c | 6 | ||||
| -rw-r--r-- | ltm.c | 6 | ||||
| -rw-r--r-- | lvm.c | 20 |
11 files changed, 48 insertions, 48 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.82 2000/05/26 19:17:57 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.83 2000/06/06 16:31:41 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -63,7 +63,7 @@ lua_Object lua_pop (lua_State *L) { | |||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | void lua_pushglobaltable (lua_State *L) { | 65 | void lua_pushglobaltable (lua_State *L) { |
| 66 | avalue(L->top) = L->gt; | 66 | hvalue(L->top) = L->gt; |
| 67 | ttype(L->top) = TAG_TABLE; | 67 | ttype(L->top) = TAG_TABLE; |
| 68 | incr_top; | 68 | incr_top; |
| 69 | } | 69 | } |
| @@ -72,7 +72,7 @@ void lua_pushglobaltable (lua_State *L) { | |||
| 72 | void lua_setglobaltable (lua_State *L, lua_Object newtable) { | 72 | void lua_setglobaltable (lua_State *L, lua_Object newtable) { |
| 73 | if (lua_type(L, newtable)[0] != 't') /* type == "table"? */ | 73 | if (lua_type(L, newtable)[0] != 't') /* type == "table"? */ |
| 74 | lua_error(L, "Lua API error - invalid value for global table"); | 74 | lua_error(L, "Lua API error - invalid value for global table"); |
| 75 | L->gt = avalue(newtable); | 75 | L->gt = hvalue(newtable); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | 78 | ||
| @@ -125,7 +125,7 @@ lua_Object lua_rawget (lua_State *L) { | |||
| 125 | luaA_checkCargs(L, 2); | 125 | luaA_checkCargs(L, 2); |
| 126 | if (ttype(L->top-2) != TAG_TABLE) | 126 | if (ttype(L->top-2) != TAG_TABLE) |
| 127 | lua_error(L, "indexed expression not a table"); | 127 | lua_error(L, "indexed expression not a table"); |
| 128 | res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1)); | 128 | res = luaA_putluaObject(L, luaH_get(L, hvalue(L->top-2), L->top-1)); |
| 129 | L->top -= 2; | 129 | L->top -= 2; |
| 130 | return res; | 130 | return res; |
| 131 | } | 131 | } |
| @@ -144,7 +144,7 @@ void lua_rawset (lua_State *L) { | |||
| 144 | luaA_checkCargs(L, 3); | 144 | luaA_checkCargs(L, 3); |
| 145 | if (ttype(L->top-3) != TAG_TABLE) | 145 | if (ttype(L->top-3) != TAG_TABLE) |
| 146 | lua_error(L, "indexed expression not a table"); | 146 | lua_error(L, "indexed expression not a table"); |
| 147 | *luaH_set(L, avalue(L->top-3), L->top-2) = *(L->top-1); | 147 | *luaH_set(L, hvalue(L->top-3), L->top-2) = *(L->top-1); |
| 148 | L->top -= 3; | 148 | L->top -= 3; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -152,7 +152,7 @@ void lua_rawset (lua_State *L) { | |||
| 152 | lua_Object lua_createtable (lua_State *L) { | 152 | lua_Object lua_createtable (lua_State *L) { |
| 153 | TObject o; | 153 | TObject o; |
| 154 | luaC_checkGC(L); | 154 | luaC_checkGC(L); |
| 155 | avalue(&o) = luaH_new(L, 0); | 155 | hvalue(&o) = luaH_new(L, 0); |
| 156 | ttype(&o) = TAG_TABLE; | 156 | ttype(&o) = TAG_TABLE; |
| 157 | return luaA_putluaObject(L, &o); | 157 | return luaA_putluaObject(L, &o); |
| 158 | } | 158 | } |
| @@ -311,7 +311,7 @@ int lua_tag (lua_State *L, lua_Object o) { | |||
| 311 | if (o == LUA_NOOBJECT) | 311 | if (o == LUA_NOOBJECT) |
| 312 | return TAG_NIL; | 312 | return TAG_NIL; |
| 313 | else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */ | 313 | else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */ |
| 314 | return o->value.ts->u.d.tag; | 314 | return tsvalue(o)->u.d.tag; |
| 315 | else | 315 | else |
| 316 | return luaT_effectivetag(L, o); | 316 | return luaT_effectivetag(L, o); |
| 317 | } | 317 | } |
| @@ -322,10 +322,10 @@ void lua_settag (lua_State *L, int tag) { | |||
| 322 | luaT_realtag(L, tag); | 322 | luaT_realtag(L, tag); |
| 323 | switch (ttype(L->top-1)) { | 323 | switch (ttype(L->top-1)) { |
| 324 | case TAG_TABLE: | 324 | case TAG_TABLE: |
| 325 | (L->top-1)->value.a->htag = tag; | 325 | hvalue(L->top-1)->htag = tag; |
| 326 | break; | 326 | break; |
| 327 | case TAG_USERDATA: | 327 | case TAG_USERDATA: |
| 328 | (L->top-1)->value.ts->u.d.tag = tag; | 328 | tsvalue(L->top-1)->u.d.tag = tag; |
| 329 | break; | 329 | break; |
| 330 | default: | 330 | default: |
| 331 | luaL_verror(L, "cannot change the tag of a %.20s", | 331 | luaL_verror(L, "cannot change the tag of a %.20s", |
| @@ -352,7 +352,7 @@ int luaA_next (lua_State *L, const Hash *t, int i) { | |||
| 352 | int lua_next (lua_State *L, lua_Object t, int i) { | 352 | int lua_next (lua_State *L, lua_Object t, int i) { |
| 353 | if (ttype(t) != TAG_TABLE) | 353 | if (ttype(t) != TAG_TABLE) |
| 354 | lua_error(L, "Lua API error - object is not a table in `lua_next'"); | 354 | lua_error(L, "Lua API error - object is not a table in `lua_next'"); |
| 355 | i = luaA_next(L, avalue(t), i); | 355 | i = luaA_next(L, hvalue(t), i); |
| 356 | top2LC(L, (i==0) ? 0 : 2); | 356 | top2LC(L, (i==0) ? 0 : 2); |
| 357 | return i; | 357 | return i; |
| 358 | } | 358 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.113 2000/06/05 20:15:33 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.114 2000/06/06 16:31:41 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -74,7 +74,7 @@ static Number getnarg (lua_State *L, const Hash *a) { | |||
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | static Hash *gettable (lua_State *L, int arg) { | 76 | static Hash *gettable (lua_State *L, int arg) { |
| 77 | return avalue(luaL_tablearg(L, arg)); | 77 | return hvalue(luaL_tablearg(L, arg)); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /* }====================================================== */ | 80 | /* }====================================================== */ |
| @@ -358,14 +358,14 @@ void luaB_tostring (lua_State *L) { | |||
| 358 | lua_pushobject(L, o); | 358 | lua_pushobject(L, o); |
| 359 | return; | 359 | return; |
| 360 | case TAG_TABLE: | 360 | case TAG_TABLE: |
| 361 | sprintf(buff, "table: %p", o->value.a); | 361 | sprintf(buff, "table: %p", hvalue(o)); |
| 362 | break; | 362 | break; |
| 363 | case TAG_LCLOSURE: case TAG_CCLOSURE: | 363 | case TAG_LCLOSURE: case TAG_CCLOSURE: |
| 364 | sprintf(buff, "function: %p", o->value.cl); | 364 | sprintf(buff, "function: %p", clvalue(o)); |
| 365 | break; | 365 | break; |
| 366 | case TAG_USERDATA: | 366 | case TAG_USERDATA: |
| 367 | sprintf(buff, "userdata: %p(%d)", o->value.ts->u.d.value, | 367 | sprintf(buff, "userdata: %p(%d)", tsvalue(o)->u.d.value, |
| 368 | o->value.ts->u.d.tag); | 368 | tsvalue(o)->u.d.tag); |
| 369 | break; | 369 | break; |
| 370 | case TAG_NIL: | 370 | case TAG_NIL: |
| 371 | lua_pushstring(L, "nil"); | 371 | lua_pushstring(L, "nil"); |
| @@ -602,7 +602,7 @@ static void deprecated_funcs (lua_State *L) { | |||
| 602 | TObject gt; | 602 | TObject gt; |
| 603 | int i; | 603 | int i; |
| 604 | ttype(>) = TAG_TABLE; | 604 | ttype(>) = TAG_TABLE; |
| 605 | avalue(>) = L->gt; | 605 | hvalue(>) = L->gt; |
| 606 | for (i=0; i<num_deprecated; i++) { | 606 | for (i=0; i<num_deprecated; i++) { |
| 607 | lua_pushobject(L, >); | 607 | lua_pushobject(L, >); |
| 608 | lua_pushcclosure(L, deprecated_global_funcs[i].func, 1); | 608 | lua_pushcclosure(L, deprecated_global_funcs[i].func, 1); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.20 2000/05/15 19:30:41 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.21 2000/05/30 19:00:31 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -89,7 +89,7 @@ static int lua_nups (StkId f) { | |||
| 89 | switch (ttype(f)) { | 89 | switch (ttype(f)) { |
| 90 | case TAG_LCLOSURE: case TAG_CCLOSURE: | 90 | case TAG_LCLOSURE: case TAG_CCLOSURE: |
| 91 | case TAG_LMARK: case TAG_CMARK: | 91 | case TAG_LMARK: case TAG_CMARK: |
| 92 | return f->value.cl->nupvalues; | 92 | return clvalue(f)->nupvalues; |
| 93 | default: | 93 | default: |
| 94 | return 0; | 94 | return 0; |
| 95 | } | 95 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 1.54 2000/06/05 14:56:18 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.55 2000/06/05 20:07:53 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -96,7 +96,7 @@ static int markobject (lua_State *L, TObject *o) { | |||
| 96 | strmark(L, tsvalue(o)); | 96 | strmark(L, tsvalue(o)); |
| 97 | break; | 97 | break; |
| 98 | case TAG_TABLE: | 98 | case TAG_TABLE: |
| 99 | tablemark(L, avalue(o)); | 99 | tablemark(L, hvalue(o)); |
| 100 | break; | 100 | break; |
| 101 | case TAG_LCLOSURE: case TAG_LMARK: | 101 | case TAG_LCLOSURE: case TAG_LMARK: |
| 102 | protomark(L, clvalue(o)->f.l); | 102 | protomark(L, clvalue(o)->f.l); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 1.38 2000/04/26 13:43:10 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.39 2000/05/24 13:54:49 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -40,7 +40,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) { | |||
| 40 | case TAG_STRING: case TAG_USERDATA: | 40 | case TAG_STRING: case TAG_USERDATA: |
| 41 | return tsvalue(t1) == tsvalue(t2); | 41 | return tsvalue(t1) == tsvalue(t2); |
| 42 | case TAG_TABLE: | 42 | case TAG_TABLE: |
| 43 | return avalue(t1) == avalue(t2); | 43 | return hvalue(t1) == hvalue(t2); |
| 44 | case TAG_CCLOSURE: case TAG_LCLOSURE: | 44 | case TAG_CCLOSURE: case TAG_LCLOSURE: |
| 45 | return clvalue(t1) == clvalue(t2); | 45 | return clvalue(t1) == clvalue(t2); |
| 46 | default: | 46 | default: |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.65 2000/05/24 13:54:49 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.66 2000/05/30 19:00: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 | */ |
| @@ -73,10 +73,10 @@ typedef union { | |||
| 73 | /* Macros to access values */ | 73 | /* Macros to access values */ |
| 74 | #define ttype(o) ((o)->ttype) | 74 | #define ttype(o) ((o)->ttype) |
| 75 | #define nvalue(o) ((o)->value.n) | 75 | #define nvalue(o) ((o)->value.n) |
| 76 | #define svalue(o) ((o)->value.ts->str) | ||
| 77 | #define tsvalue(o) ((o)->value.ts) | 76 | #define tsvalue(o) ((o)->value.ts) |
| 78 | #define clvalue(o) ((o)->value.cl) | 77 | #define clvalue(o) ((o)->value.cl) |
| 79 | #define avalue(o) ((o)->value.a) | 78 | #define hvalue(o) ((o)->value.a) |
| 79 | #define svalue(o) (tsvalue(o)->str) | ||
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | typedef struct lua_TObject { | 82 | typedef struct lua_TObject { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lref.c,v 1.11 2000/03/29 20:19:20 roberto Exp roberto $ | 2 | ** $Id: lref.c,v 1.12 2000/05/24 13:54:49 roberto Exp roberto $ |
| 3 | ** reference mechanism | 3 | ** reference mechanism |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -84,11 +84,11 @@ static int ismarked (const TObject *o) { | |||
| 84 | /* valid only for locked objects */ | 84 | /* valid only for locked objects */ |
| 85 | switch (o->ttype) { | 85 | switch (o->ttype) { |
| 86 | case TAG_STRING: case TAG_USERDATA: | 86 | case TAG_STRING: case TAG_USERDATA: |
| 87 | return o->value.ts->marked; | 87 | return tsvalue(o)->marked; |
| 88 | case TAG_TABLE: | 88 | case TAG_TABLE: |
| 89 | return o->value.a->marked; | 89 | return hvalue(o)->marked; |
| 90 | case TAG_LCLOSURE: case TAG_CCLOSURE: | 90 | case TAG_LCLOSURE: case TAG_CCLOSURE: |
| 91 | return o->value.cl->marked; | 91 | return clvalue(o)->marked; |
| 92 | default: /* number */ | 92 | default: /* number */ |
| 93 | return 1; | 93 | return 1; |
| 94 | } | 94 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 1.45 2000/06/05 20:15:33 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.46 2000/06/06 16:31:41 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -54,7 +54,7 @@ Node *luaH_mainposition (const Hash *t, const TObject *key) { | |||
| 54 | h = IntPoint(tsvalue(key)); | 54 | h = IntPoint(tsvalue(key)); |
| 55 | break; | 55 | break; |
| 56 | case TAG_TABLE: | 56 | case TAG_TABLE: |
| 57 | h = IntPoint(avalue(key)); | 57 | h = IntPoint(hvalue(key)); |
| 58 | break; | 58 | break; |
| 59 | case TAG_LCLOSURE: case TAG_CCLOSURE: | 59 | case TAG_LCLOSURE: case TAG_CCLOSURE: |
| 60 | h = IntPoint(clvalue(key)); | 60 | h = IntPoint(clvalue(key)); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.22 2000/06/02 17:06:42 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.23 2000/06/02 19:10:01 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -161,14 +161,14 @@ static void hash_query (void) { | |||
| 161 | lua_pushnumber(tsvalue(o)->u.s.hash); | 161 | lua_pushnumber(tsvalue(o)->u.s.hash); |
| 162 | } | 162 | } |
| 163 | else { | 163 | else { |
| 164 | const Hash *t = avalue(luaL_tablearg(2)); | 164 | const Hash *t = hvalue(luaL_tablearg(2)); |
| 165 | lua_pushnumber(luaH_mainposition(t, o) - t->node); | 165 | lua_pushnumber(luaH_mainposition(t, o) - t->node); |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | 169 | ||
| 170 | static void table_query (void) { | 170 | static void table_query (void) { |
| 171 | const Hash *t = avalue(luaL_tablearg(1)); | 171 | const Hash *t = hvalue(luaL_tablearg(1)); |
| 172 | int i = luaL_opt_int(2, -1); | 172 | int i = luaL_opt_int(2, -1); |
| 173 | if (i == -1) { | 173 | if (i == -1) { |
| 174 | lua_pushnumber(t->size); | 174 | lua_pushnumber(t->size); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 1.40 2000/05/24 13:54:49 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.41 2000/05/30 18:54:49 roberto Exp roberto $ |
| 3 | ** Tag methods | 3 | ** Tag methods |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -110,10 +110,10 @@ int luaT_effectivetag (lua_State *L, const TObject *o) { | |||
| 110 | lua_Type t = ttype(o); | 110 | lua_Type t = ttype(o); |
| 111 | switch (t) { | 111 | switch (t) { |
| 112 | case TAG_USERDATA: { | 112 | case TAG_USERDATA: { |
| 113 | int tag = o->value.ts->u.d.tag; | 113 | int tag = tsvalue(o)->u.d.tag; |
| 114 | return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */ | 114 | return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */ |
| 115 | } | 115 | } |
| 116 | case TAG_TABLE: return o->value.a->htag; | 116 | case TAG_TABLE: return hvalue(o)->htag; |
| 117 | default: return t; | 117 | default: return t; |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.112 2000/06/05 20:15:33 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.113 2000/06/06 16:31:41 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -104,10 +104,10 @@ void luaV_gettable (lua_State *L, StkId top) { | |||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | else { /* object is a table... */ | 106 | else { /* object is a table... */ |
| 107 | int tg = table->value.a->htag; | 107 | int tg = hvalue(table)->htag; |
| 108 | im = luaT_getim(L, tg, IM_GETTABLE); | 108 | im = luaT_getim(L, tg, IM_GETTABLE); |
| 109 | if (ttype(im) == TAG_NIL) { /* and does not have a `gettable' TM */ | 109 | if (ttype(im) == TAG_NIL) { /* and does not have a `gettable' TM */ |
| 110 | const TObject *h = luaH_get(L, avalue(table), table+1); | 110 | const TObject *h = luaH_get(L, hvalue(table), table+1); |
| 111 | if (ttype(h) == TAG_NIL && | 111 | if (ttype(h) == TAG_NIL && |
| 112 | (ttype(im=luaT_getim(L, tg, IM_INDEX)) != TAG_NIL)) { | 112 | (ttype(im=luaT_getim(L, tg, IM_INDEX)) != TAG_NIL)) { |
| 113 | /* result is nil and there is an `index' tag method */ | 113 | /* result is nil and there is an `index' tag method */ |
| @@ -138,9 +138,9 @@ void luaV_settable (lua_State *L, StkId t, StkId top) { | |||
| 138 | luaG_indexerror(L, t); | 138 | luaG_indexerror(L, t); |
| 139 | } | 139 | } |
| 140 | else { /* object is a table... */ | 140 | else { /* object is a table... */ |
| 141 | im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE); | 141 | im = luaT_getim(L, hvalue(t)->htag, IM_SETTABLE); |
| 142 | if (ttype(im) == TAG_NIL) { /* and does not have a `settable' method */ | 142 | if (ttype(im) == TAG_NIL) { /* and does not have a `settable' method */ |
| 143 | *luaH_set(L, avalue(t), t+1) = *(top-1); | 143 | *luaH_set(L, hvalue(t), t+1) = *(top-1); |
| 144 | return; | 144 | return; |
| 145 | } | 145 | } |
| 146 | /* else it has a `settable' method, go through to next command */ | 146 | /* else it has a `settable' method, go through to next command */ |
| @@ -301,7 +301,7 @@ static void strconc (lua_State *L, int total, StkId top) { | |||
| 301 | void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) { | 301 | void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) { |
| 302 | int i; | 302 | int i; |
| 303 | Hash *htab; | 303 | Hash *htab; |
| 304 | htab = avalue(tab) = luaH_new(L, nvararg+1); /* +1 for field `n' */ | 304 | htab = hvalue(tab) = luaH_new(L, nvararg+1); /* +1 for field `n' */ |
| 305 | ttype(tab) = TAG_TABLE; | 305 | ttype(tab) = TAG_TABLE; |
| 306 | for (i=0; i<nvararg; i++) | 306 | for (i=0; i<nvararg; i++) |
| 307 | *luaH_setint(L, htab, i+1) = *(firstelem+i); | 307 | *luaH_setint(L, htab, i+1) = *(firstelem+i); |
| @@ -445,7 +445,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 445 | case OP_CREATETABLE: | 445 | case OP_CREATETABLE: |
| 446 | L->top = top; | 446 | L->top = top; |
| 447 | luaC_checkGC(L); | 447 | luaC_checkGC(L); |
| 448 | avalue(top) = luaH_new(L, GETARG_U(i)); | 448 | hvalue(top) = luaH_new(L, GETARG_U(i)); |
| 449 | ttype(top) = TAG_TABLE; | 449 | ttype(top) = TAG_TABLE; |
| 450 | top++; | 450 | top++; |
| 451 | break; | 451 | break; |
| @@ -467,7 +467,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 467 | case OP_SETLIST: { | 467 | case OP_SETLIST: { |
| 468 | int aux = GETARG_A(i) * LFIELDS_PER_FLUSH; | 468 | int aux = GETARG_A(i) * LFIELDS_PER_FLUSH; |
| 469 | int n = GETARG_B(i); | 469 | int n = GETARG_B(i); |
| 470 | Hash *arr = avalue(top-n-1); | 470 | Hash *arr = hvalue(top-n-1); |
| 471 | L->top = top-n; /* final value of `top' (in case of errors) */ | 471 | L->top = top-n; /* final value of `top' (in case of errors) */ |
| 472 | for (; n; n--) | 472 | for (; n; n--) |
| 473 | *luaH_setint(L, arr, n+aux) = *(--top); | 473 | *luaH_setint(L, arr, n+aux) = *(--top); |
| @@ -477,7 +477,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 477 | case OP_SETMAP: { | 477 | case OP_SETMAP: { |
| 478 | int n = GETARG_U(i); | 478 | int n = GETARG_U(i); |
| 479 | StkId finaltop = top-2*n; | 479 | StkId finaltop = top-2*n; |
| 480 | Hash *arr = avalue(finaltop-1); | 480 | Hash *arr = hvalue(finaltop-1); |
| 481 | L->top = finaltop; /* final value of `top' (in case of errors) */ | 481 | L->top = finaltop; /* final value of `top' (in case of errors) */ |
| 482 | for (; n; n--) { | 482 | for (; n; n--) { |
| 483 | top-=2; | 483 | top-=2; |
| @@ -656,7 +656,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 656 | LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table"); | 656 | LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table"); |
| 657 | LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter"); | 657 | LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter"); |
| 658 | L->top = top; | 658 | L->top = top; |
| 659 | n = luaA_next(L, avalue(top-2), (int)nvalue(top-1)); | 659 | n = luaA_next(L, hvalue(top-2), (int)nvalue(top-1)); |
| 660 | if (n == 0) /* end loop? */ | 660 | if (n == 0) /* end loop? */ |
| 661 | top -= 2; /* remove table and counter */ | 661 | top -= 2; /* remove table and counter */ |
| 662 | else { | 662 | else { |
