access to `values' in TObject always through macros
This commit is contained in:
20
lapi.c
20
lapi.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 1.82 2000/05/26 19:17:57 roberto Exp roberto $
|
** $Id: lapi.c,v 1.83 2000/06/06 16:31:41 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -63,7 +63,7 @@ lua_Object lua_pop (lua_State *L) {
|
|||||||
|
|
||||||
|
|
||||||
void lua_pushglobaltable (lua_State *L) {
|
void lua_pushglobaltable (lua_State *L) {
|
||||||
avalue(L->top) = L->gt;
|
hvalue(L->top) = L->gt;
|
||||||
ttype(L->top) = TAG_TABLE;
|
ttype(L->top) = TAG_TABLE;
|
||||||
incr_top;
|
incr_top;
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ void lua_pushglobaltable (lua_State *L) {
|
|||||||
void lua_setglobaltable (lua_State *L, lua_Object newtable) {
|
void lua_setglobaltable (lua_State *L, lua_Object newtable) {
|
||||||
if (lua_type(L, newtable)[0] != 't') /* type == "table"? */
|
if (lua_type(L, newtable)[0] != 't') /* type == "table"? */
|
||||||
lua_error(L, "Lua API error - invalid value for global table");
|
lua_error(L, "Lua API error - invalid value for global table");
|
||||||
L->gt = avalue(newtable);
|
L->gt = hvalue(newtable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ lua_Object lua_rawget (lua_State *L) {
|
|||||||
luaA_checkCargs(L, 2);
|
luaA_checkCargs(L, 2);
|
||||||
if (ttype(L->top-2) != TAG_TABLE)
|
if (ttype(L->top-2) != TAG_TABLE)
|
||||||
lua_error(L, "indexed expression not a table");
|
lua_error(L, "indexed expression not a table");
|
||||||
res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1));
|
res = luaA_putluaObject(L, luaH_get(L, hvalue(L->top-2), L->top-1));
|
||||||
L->top -= 2;
|
L->top -= 2;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ void lua_rawset (lua_State *L) {
|
|||||||
luaA_checkCargs(L, 3);
|
luaA_checkCargs(L, 3);
|
||||||
if (ttype(L->top-3) != TAG_TABLE)
|
if (ttype(L->top-3) != TAG_TABLE)
|
||||||
lua_error(L, "indexed expression not a table");
|
lua_error(L, "indexed expression not a table");
|
||||||
*luaH_set(L, avalue(L->top-3), L->top-2) = *(L->top-1);
|
*luaH_set(L, hvalue(L->top-3), L->top-2) = *(L->top-1);
|
||||||
L->top -= 3;
|
L->top -= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void lua_rawset (lua_State *L) {
|
|||||||
lua_Object lua_createtable (lua_State *L) {
|
lua_Object lua_createtable (lua_State *L) {
|
||||||
TObject o;
|
TObject o;
|
||||||
luaC_checkGC(L);
|
luaC_checkGC(L);
|
||||||
avalue(&o) = luaH_new(L, 0);
|
hvalue(&o) = luaH_new(L, 0);
|
||||||
ttype(&o) = TAG_TABLE;
|
ttype(&o) = TAG_TABLE;
|
||||||
return luaA_putluaObject(L, &o);
|
return luaA_putluaObject(L, &o);
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ int lua_tag (lua_State *L, lua_Object o) {
|
|||||||
if (o == LUA_NOOBJECT)
|
if (o == LUA_NOOBJECT)
|
||||||
return TAG_NIL;
|
return TAG_NIL;
|
||||||
else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */
|
else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */
|
||||||
return o->value.ts->u.d.tag;
|
return tsvalue(o)->u.d.tag;
|
||||||
else
|
else
|
||||||
return luaT_effectivetag(L, o);
|
return luaT_effectivetag(L, o);
|
||||||
}
|
}
|
||||||
@@ -322,10 +322,10 @@ void lua_settag (lua_State *L, int tag) {
|
|||||||
luaT_realtag(L, tag);
|
luaT_realtag(L, tag);
|
||||||
switch (ttype(L->top-1)) {
|
switch (ttype(L->top-1)) {
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
(L->top-1)->value.a->htag = tag;
|
hvalue(L->top-1)->htag = tag;
|
||||||
break;
|
break;
|
||||||
case TAG_USERDATA:
|
case TAG_USERDATA:
|
||||||
(L->top-1)->value.ts->u.d.tag = tag;
|
tsvalue(L->top-1)->u.d.tag = tag;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
luaL_verror(L, "cannot change the tag of a %.20s",
|
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) {
|
|||||||
int lua_next (lua_State *L, lua_Object t, int i) {
|
int lua_next (lua_State *L, lua_Object t, int i) {
|
||||||
if (ttype(t) != TAG_TABLE)
|
if (ttype(t) != TAG_TABLE)
|
||||||
lua_error(L, "Lua API error - object is not a table in `lua_next'");
|
lua_error(L, "Lua API error - object is not a table in `lua_next'");
|
||||||
i = luaA_next(L, avalue(t), i);
|
i = luaA_next(L, hvalue(t), i);
|
||||||
top2LC(L, (i==0) ? 0 : 2);
|
top2LC(L, (i==0) ? 0 : 2);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
14
lbuiltin.c
14
lbuiltin.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lbuiltin.c,v 1.113 2000/06/05 20:15:33 roberto Exp roberto $
|
** $Id: lbuiltin.c,v 1.114 2000/06/06 16:31:41 roberto Exp roberto $
|
||||||
** Built-in functions
|
** Built-in functions
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +74,7 @@ static Number getnarg (lua_State *L, const Hash *a) {
|
|||||||
|
|
||||||
|
|
||||||
static Hash *gettable (lua_State *L, int arg) {
|
static Hash *gettable (lua_State *L, int arg) {
|
||||||
return avalue(luaL_tablearg(L, arg));
|
return hvalue(luaL_tablearg(L, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }====================================================== */
|
/* }====================================================== */
|
||||||
@@ -358,14 +358,14 @@ void luaB_tostring (lua_State *L) {
|
|||||||
lua_pushobject(L, o);
|
lua_pushobject(L, o);
|
||||||
return;
|
return;
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
sprintf(buff, "table: %p", o->value.a);
|
sprintf(buff, "table: %p", hvalue(o));
|
||||||
break;
|
break;
|
||||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||||
sprintf(buff, "function: %p", o->value.cl);
|
sprintf(buff, "function: %p", clvalue(o));
|
||||||
break;
|
break;
|
||||||
case TAG_USERDATA:
|
case TAG_USERDATA:
|
||||||
sprintf(buff, "userdata: %p(%d)", o->value.ts->u.d.value,
|
sprintf(buff, "userdata: %p(%d)", tsvalue(o)->u.d.value,
|
||||||
o->value.ts->u.d.tag);
|
tsvalue(o)->u.d.tag);
|
||||||
break;
|
break;
|
||||||
case TAG_NIL:
|
case TAG_NIL:
|
||||||
lua_pushstring(L, "nil");
|
lua_pushstring(L, "nil");
|
||||||
@@ -602,7 +602,7 @@ static void deprecated_funcs (lua_State *L) {
|
|||||||
TObject gt;
|
TObject gt;
|
||||||
int i;
|
int i;
|
||||||
ttype(>) = TAG_TABLE;
|
ttype(>) = TAG_TABLE;
|
||||||
avalue(>) = L->gt;
|
hvalue(>) = L->gt;
|
||||||
for (i=0; i<num_deprecated; i++) {
|
for (i=0; i<num_deprecated; i++) {
|
||||||
lua_pushobject(L, >);
|
lua_pushobject(L, >);
|
||||||
lua_pushcclosure(L, deprecated_global_funcs[i].func, 1);
|
lua_pushcclosure(L, deprecated_global_funcs[i].func, 1);
|
||||||
|
|||||||
4
ldebug.c
4
ldebug.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ldebug.c,v 1.20 2000/05/15 19:30:41 roberto Exp roberto $
|
** $Id: ldebug.c,v 1.21 2000/05/30 19:00:31 roberto Exp roberto $
|
||||||
** Debug Interface
|
** Debug Interface
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -89,7 +89,7 @@ static int lua_nups (StkId f) {
|
|||||||
switch (ttype(f)) {
|
switch (ttype(f)) {
|
||||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||||
case TAG_LMARK: case TAG_CMARK:
|
case TAG_LMARK: case TAG_CMARK:
|
||||||
return f->value.cl->nupvalues;
|
return clvalue(f)->nupvalues;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
4
lgc.c
4
lgc.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lgc.c,v 1.54 2000/06/05 14:56:18 roberto Exp roberto $
|
** $Id: lgc.c,v 1.55 2000/06/05 20:07:53 roberto Exp roberto $
|
||||||
** Garbage Collector
|
** Garbage Collector
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -96,7 +96,7 @@ static int markobject (lua_State *L, TObject *o) {
|
|||||||
strmark(L, tsvalue(o));
|
strmark(L, tsvalue(o));
|
||||||
break;
|
break;
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
tablemark(L, avalue(o));
|
tablemark(L, hvalue(o));
|
||||||
break;
|
break;
|
||||||
case TAG_LCLOSURE: case TAG_LMARK:
|
case TAG_LCLOSURE: case TAG_LMARK:
|
||||||
protomark(L, clvalue(o)->f.l);
|
protomark(L, clvalue(o)->f.l);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lobject.c,v 1.38 2000/04/26 13:43:10 roberto Exp roberto $
|
** $Id: lobject.c,v 1.39 2000/05/24 13:54:49 roberto Exp roberto $
|
||||||
** Some generic functions over Lua objects
|
** Some generic functions over Lua objects
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +40,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
|
|||||||
case TAG_STRING: case TAG_USERDATA:
|
case TAG_STRING: case TAG_USERDATA:
|
||||||
return tsvalue(t1) == tsvalue(t2);
|
return tsvalue(t1) == tsvalue(t2);
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
return avalue(t1) == avalue(t2);
|
return hvalue(t1) == hvalue(t2);
|
||||||
case TAG_CCLOSURE: case TAG_LCLOSURE:
|
case TAG_CCLOSURE: case TAG_LCLOSURE:
|
||||||
return clvalue(t1) == clvalue(t2);
|
return clvalue(t1) == clvalue(t2);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lobject.h,v 1.65 2000/05/24 13:54:49 roberto Exp roberto $
|
** $Id: lobject.h,v 1.66 2000/05/30 19:00:31 roberto Exp roberto $
|
||||||
** Type definitions for Lua objects
|
** Type definitions for Lua objects
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -73,10 +73,10 @@ typedef union {
|
|||||||
/* Macros to access values */
|
/* Macros to access values */
|
||||||
#define ttype(o) ((o)->ttype)
|
#define ttype(o) ((o)->ttype)
|
||||||
#define nvalue(o) ((o)->value.n)
|
#define nvalue(o) ((o)->value.n)
|
||||||
#define svalue(o) ((o)->value.ts->str)
|
|
||||||
#define tsvalue(o) ((o)->value.ts)
|
#define tsvalue(o) ((o)->value.ts)
|
||||||
#define clvalue(o) ((o)->value.cl)
|
#define clvalue(o) ((o)->value.cl)
|
||||||
#define avalue(o) ((o)->value.a)
|
#define hvalue(o) ((o)->value.a)
|
||||||
|
#define svalue(o) (tsvalue(o)->str)
|
||||||
|
|
||||||
|
|
||||||
typedef struct lua_TObject {
|
typedef struct lua_TObject {
|
||||||
|
|||||||
8
lref.c
8
lref.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lref.c,v 1.11 2000/03/29 20:19:20 roberto Exp roberto $
|
** $Id: lref.c,v 1.12 2000/05/24 13:54:49 roberto Exp roberto $
|
||||||
** reference mechanism
|
** reference mechanism
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -84,11 +84,11 @@ static int ismarked (const TObject *o) {
|
|||||||
/* valid only for locked objects */
|
/* valid only for locked objects */
|
||||||
switch (o->ttype) {
|
switch (o->ttype) {
|
||||||
case TAG_STRING: case TAG_USERDATA:
|
case TAG_STRING: case TAG_USERDATA:
|
||||||
return o->value.ts->marked;
|
return tsvalue(o)->marked;
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
return o->value.a->marked;
|
return hvalue(o)->marked;
|
||||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||||
return o->value.cl->marked;
|
return clvalue(o)->marked;
|
||||||
default: /* number */
|
default: /* number */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
4
ltable.c
4
ltable.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltable.c,v 1.45 2000/06/05 20:15:33 roberto Exp roberto $
|
** $Id: ltable.c,v 1.46 2000/06/06 16:31:41 roberto Exp roberto $
|
||||||
** Lua tables (hash)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -54,7 +54,7 @@ Node *luaH_mainposition (const Hash *t, const TObject *key) {
|
|||||||
h = IntPoint(tsvalue(key));
|
h = IntPoint(tsvalue(key));
|
||||||
break;
|
break;
|
||||||
case TAG_TABLE:
|
case TAG_TABLE:
|
||||||
h = IntPoint(avalue(key));
|
h = IntPoint(hvalue(key));
|
||||||
break;
|
break;
|
||||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||||
h = IntPoint(clvalue(key));
|
h = IntPoint(clvalue(key));
|
||||||
|
|||||||
6
ltests.c
6
ltests.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltests.c,v 1.22 2000/06/02 17:06:42 roberto Exp roberto $
|
** $Id: ltests.c,v 1.23 2000/06/02 19:10:01 roberto Exp roberto $
|
||||||
** Internal Module for Debugging of the Lua Implementation
|
** Internal Module for Debugging of the Lua Implementation
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -161,14 +161,14 @@ static void hash_query (void) {
|
|||||||
lua_pushnumber(tsvalue(o)->u.s.hash);
|
lua_pushnumber(tsvalue(o)->u.s.hash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const Hash *t = avalue(luaL_tablearg(2));
|
const Hash *t = hvalue(luaL_tablearg(2));
|
||||||
lua_pushnumber(luaH_mainposition(t, o) - t->node);
|
lua_pushnumber(luaH_mainposition(t, o) - t->node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void table_query (void) {
|
static void table_query (void) {
|
||||||
const Hash *t = avalue(luaL_tablearg(1));
|
const Hash *t = hvalue(luaL_tablearg(1));
|
||||||
int i = luaL_opt_int(2, -1);
|
int i = luaL_opt_int(2, -1);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
lua_pushnumber(t->size);
|
lua_pushnumber(t->size);
|
||||||
|
|||||||
6
ltm.c
6
ltm.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltm.c,v 1.40 2000/05/24 13:54:49 roberto Exp roberto $
|
** $Id: ltm.c,v 1.41 2000/05/30 18:54:49 roberto Exp roberto $
|
||||||
** Tag methods
|
** Tag methods
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -110,10 +110,10 @@ int luaT_effectivetag (lua_State *L, const TObject *o) {
|
|||||||
lua_Type t = ttype(o);
|
lua_Type t = ttype(o);
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case TAG_USERDATA: {
|
case TAG_USERDATA: {
|
||||||
int tag = o->value.ts->u.d.tag;
|
int tag = tsvalue(o)->u.d.tag;
|
||||||
return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */
|
return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */
|
||||||
}
|
}
|
||||||
case TAG_TABLE: return o->value.a->htag;
|
case TAG_TABLE: return hvalue(o)->htag;
|
||||||
default: return t;
|
default: return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
lvm.c
20
lvm.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lvm.c,v 1.112 2000/06/05 20:15:33 roberto Exp roberto $
|
** $Id: lvm.c,v 1.113 2000/06/06 16:31:41 roberto Exp roberto $
|
||||||
** Lua virtual machine
|
** Lua virtual machine
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -104,10 +104,10 @@ void luaV_gettable (lua_State *L, StkId top) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* object is a table... */
|
else { /* object is a table... */
|
||||||
int tg = table->value.a->htag;
|
int tg = hvalue(table)->htag;
|
||||||
im = luaT_getim(L, tg, IM_GETTABLE);
|
im = luaT_getim(L, tg, IM_GETTABLE);
|
||||||
if (ttype(im) == TAG_NIL) { /* and does not have a `gettable' TM */
|
if (ttype(im) == TAG_NIL) { /* and does not have a `gettable' TM */
|
||||||
const TObject *h = luaH_get(L, avalue(table), table+1);
|
const TObject *h = luaH_get(L, hvalue(table), table+1);
|
||||||
if (ttype(h) == TAG_NIL &&
|
if (ttype(h) == TAG_NIL &&
|
||||||
(ttype(im=luaT_getim(L, tg, IM_INDEX)) != TAG_NIL)) {
|
(ttype(im=luaT_getim(L, tg, IM_INDEX)) != TAG_NIL)) {
|
||||||
/* result is nil and there is an `index' tag method */
|
/* result is nil and there is an `index' tag method */
|
||||||
@@ -138,9 +138,9 @@ void luaV_settable (lua_State *L, StkId t, StkId top) {
|
|||||||
luaG_indexerror(L, t);
|
luaG_indexerror(L, t);
|
||||||
}
|
}
|
||||||
else { /* object is a table... */
|
else { /* object is a table... */
|
||||||
im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE);
|
im = luaT_getim(L, hvalue(t)->htag, IM_SETTABLE);
|
||||||
if (ttype(im) == TAG_NIL) { /* and does not have a `settable' method */
|
if (ttype(im) == TAG_NIL) { /* and does not have a `settable' method */
|
||||||
*luaH_set(L, avalue(t), t+1) = *(top-1);
|
*luaH_set(L, hvalue(t), t+1) = *(top-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* else it has a `settable' method, go through to next command */
|
/* 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) {
|
|||||||
void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) {
|
void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) {
|
||||||
int i;
|
int i;
|
||||||
Hash *htab;
|
Hash *htab;
|
||||||
htab = avalue(tab) = luaH_new(L, nvararg+1); /* +1 for field `n' */
|
htab = hvalue(tab) = luaH_new(L, nvararg+1); /* +1 for field `n' */
|
||||||
ttype(tab) = TAG_TABLE;
|
ttype(tab) = TAG_TABLE;
|
||||||
for (i=0; i<nvararg; i++)
|
for (i=0; i<nvararg; i++)
|
||||||
*luaH_setint(L, htab, i+1) = *(firstelem+i);
|
*luaH_setint(L, htab, i+1) = *(firstelem+i);
|
||||||
@@ -445,7 +445,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
|
|||||||
case OP_CREATETABLE:
|
case OP_CREATETABLE:
|
||||||
L->top = top;
|
L->top = top;
|
||||||
luaC_checkGC(L);
|
luaC_checkGC(L);
|
||||||
avalue(top) = luaH_new(L, GETARG_U(i));
|
hvalue(top) = luaH_new(L, GETARG_U(i));
|
||||||
ttype(top) = TAG_TABLE;
|
ttype(top) = TAG_TABLE;
|
||||||
top++;
|
top++;
|
||||||
break;
|
break;
|
||||||
@@ -467,7 +467,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
|
|||||||
case OP_SETLIST: {
|
case OP_SETLIST: {
|
||||||
int aux = GETARG_A(i) * LFIELDS_PER_FLUSH;
|
int aux = GETARG_A(i) * LFIELDS_PER_FLUSH;
|
||||||
int n = GETARG_B(i);
|
int n = GETARG_B(i);
|
||||||
Hash *arr = avalue(top-n-1);
|
Hash *arr = hvalue(top-n-1);
|
||||||
L->top = top-n; /* final value of `top' (in case of errors) */
|
L->top = top-n; /* final value of `top' (in case of errors) */
|
||||||
for (; n; n--)
|
for (; n; n--)
|
||||||
*luaH_setint(L, arr, n+aux) = *(--top);
|
*luaH_setint(L, arr, n+aux) = *(--top);
|
||||||
@@ -477,7 +477,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
|
|||||||
case OP_SETMAP: {
|
case OP_SETMAP: {
|
||||||
int n = GETARG_U(i);
|
int n = GETARG_U(i);
|
||||||
StkId finaltop = top-2*n;
|
StkId finaltop = top-2*n;
|
||||||
Hash *arr = avalue(finaltop-1);
|
Hash *arr = hvalue(finaltop-1);
|
||||||
L->top = finaltop; /* final value of `top' (in case of errors) */
|
L->top = finaltop; /* final value of `top' (in case of errors) */
|
||||||
for (; n; n--) {
|
for (; n; n--) {
|
||||||
top-=2;
|
top-=2;
|
||||||
@@ -656,7 +656,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
|
|||||||
LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table");
|
LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table");
|
||||||
LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter");
|
LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter");
|
||||||
L->top = top;
|
L->top = top;
|
||||||
n = luaA_next(L, avalue(top-2), (int)nvalue(top-1));
|
n = luaA_next(L, hvalue(top-2), (int)nvalue(top-1));
|
||||||
if (n == 0) /* end loop? */
|
if (n == 0) /* end loop? */
|
||||||
top -= 2; /* remove table and counter */
|
top -= 2; /* remove table and counter */
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user