summaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-06-08 15:27:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-06-08 15:27:13 -0300
commit8ca9534d048782af13141874e0d2fec0d0f806af (patch)
treed58ab47be12ff9d5910ffaf6222cf94bd0dff0f6 /lvm.c
parent8bcf6228765e56be19feb90c8805cc2fb2223188 (diff)
downloadlua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.gz
lua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.bz2
lua-8ca9534d048782af13141874e0d2fec0d0f806af.zip
access to `values' in TObject always through macros
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lvm.c b/lvm.c
index 76661bfb..9e57fb59 100644
--- a/lvm.c
+++ b/lvm.c
@@ -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) {
301void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) { 301void 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 {