mirror of
https://github.com/lua/lua.git
synced 2025-01-14 05:43:00 +08:00
TAG_ARRAY -> TAG_TABLE
This commit is contained in:
parent
63e230a16b
commit
b53dc0c485
12
lapi.c
12
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 1.74 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 1.75 2000/03/20 19:14:54 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -132,7 +132,7 @@ lua_Object lua_gettable (lua_State *L) {
|
||||
lua_Object lua_rawgettable (lua_State *L) {
|
||||
lua_Object res;
|
||||
luaA_checkCargs(L, 2);
|
||||
if (ttype(L->top-2) != TAG_ARRAY)
|
||||
if (ttype(L->top-2) != TAG_TABLE)
|
||||
lua_error(L, "indexed expression not a table in rawgettable");
|
||||
res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1));
|
||||
L->top -= 2;
|
||||
@ -159,7 +159,7 @@ lua_Object lua_createtable (lua_State *L) {
|
||||
TObject o;
|
||||
luaC_checkGC(L);
|
||||
avalue(&o) = luaH_new(L, 0);
|
||||
ttype(&o) = TAG_ARRAY;
|
||||
ttype(&o) = TAG_TABLE;
|
||||
return luaA_putluaObject(L, &o);
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ int lua_isnil (lua_State *L, lua_Object o) {
|
||||
|
||||
int lua_istable (lua_State *L, lua_Object o) {
|
||||
UNUSED(L);
|
||||
return (o != LUA_NOOBJECT) && (ttype(o) == TAG_ARRAY);
|
||||
return (o != LUA_NOOBJECT) && (ttype(o) == TAG_TABLE);
|
||||
}
|
||||
|
||||
int lua_isuserdata (lua_State *L, lua_Object o) {
|
||||
@ -342,7 +342,7 @@ void lua_settag (lua_State *L, int tag) {
|
||||
luaA_checkCargs(L, 1);
|
||||
luaT_realtag(L, tag);
|
||||
switch (ttype(L->top-1)) {
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
(L->top-1)->value.a->htag = tag;
|
||||
break;
|
||||
case TAG_USERDATA:
|
||||
@ -405,7 +405,7 @@ int luaA_next (lua_State *L, const Hash *t, int i) {
|
||||
|
||||
|
||||
int lua_next (lua_State *L, lua_Object t, int i) {
|
||||
if (ttype(t) != TAG_ARRAY)
|
||||
if (ttype(t) != TAG_TABLE)
|
||||
lua_error(L, "Lua API error - object is not a table in `lua_next'");
|
||||
i = luaA_next(L, avalue(t), i);
|
||||
top2LC(L, (i==0) ? 0 : 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lbuiltin.c,v 1.97 2000/03/24 17:26:08 roberto Exp roberto $
|
||||
** $Id: lbuiltin.c,v 1.98 2000/03/27 20:08:02 roberto Exp roberto $
|
||||
** Built-in functions
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -380,7 +380,7 @@ void luaB_tostring (lua_State *L) {
|
||||
case TAG_STRING:
|
||||
lua_pushobject(L, o);
|
||||
return;
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
sprintf(buff, "table: %p", o->value.a);
|
||||
break;
|
||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||
|
4
ldebug.c
4
ldebug.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldebug.c,v 1.11 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** $Id: ldebug.c,v 1.12 2000/03/20 19:14:54 roberto Exp roberto $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
static const lua_Type normtype[] = { /* ORDER LUA_T */
|
||||
TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY,
|
||||
TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_TABLE,
|
||||
TAG_LPROTO, TAG_CPROTO, TAG_NIL,
|
||||
TAG_LCLOSURE, TAG_CCLOSURE,
|
||||
TAG_LCLOSURE, TAG_CCLOSURE, /* TAG_LCLMARK, TAG_CCLMARK */
|
||||
|
4
lgc.c
4
lgc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 1.42 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 1.43 2000/03/27 20:08:02 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -99,7 +99,7 @@ static int markobject (lua_State *L, TObject *o) {
|
||||
case TAG_USERDATA: case TAG_STRING:
|
||||
strmark(L, tsvalue(o));
|
||||
break;
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
hashmark(L, avalue(o));
|
||||
break;
|
||||
case TAG_LCLOSURE: case TAG_LCLMARK:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 1.32 2000/03/03 14:58:26 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 1.33 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -41,7 +41,7 @@ int luaO_equalval (const TObject *t1, const TObject *t2) {
|
||||
return nvalue(t1) == nvalue(t2);
|
||||
case TAG_STRING: case TAG_USERDATA:
|
||||
return svalue(t1) == svalue(t2);
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
return avalue(t1) == avalue(t2);
|
||||
case TAG_LPROTO:
|
||||
return tfvalue(t1) == tfvalue(t2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.h,v 1.54 2000/03/24 17:26:08 roberto Exp roberto $
|
||||
** $Id: lobject.h,v 1.55 2000/03/24 19:49:23 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -35,7 +35,7 @@ typedef enum {
|
||||
TAG_USERDATA = 0, /* default tag for userdata */
|
||||
TAG_NUMBER, /* fixed tag for numbers */
|
||||
TAG_STRING, /* fixed tag for strings */
|
||||
TAG_ARRAY, /* default tag for tables (or arrays) */
|
||||
TAG_TABLE, /* default tag for tables */
|
||||
TAG_LPROTO, /* fixed tag for Lua functions */
|
||||
TAG_CPROTO, /* fixed tag for C functions */
|
||||
TAG_NIL, /* last "pre-defined" tag */
|
||||
@ -67,7 +67,7 @@ typedef union {
|
||||
struct TString *ts; /* TAG_STRING, TAG_USERDATA */
|
||||
struct Proto *tf; /* TAG_LPROTO, TAG_LMARK */
|
||||
struct Closure *cl; /* TAG_[CL]CLOSURE, TAG_[CL]CLMARK */
|
||||
struct Hash *a; /* TAG_ARRAY */
|
||||
struct Hash *a; /* TAG_TABLE */
|
||||
int i; /* TAG_LINE */
|
||||
} Value;
|
||||
|
||||
|
4
lref.c
4
lref.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lref.c,v 1.8 2000/03/03 14:58:26 roberto Exp roberto $
|
||||
** $Id: lref.c,v 1.9 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** reference mechanism
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -84,7 +84,7 @@ static int ismarked (const TObject *o) {
|
||||
switch (o->ttype) {
|
||||
case TAG_STRING: case TAG_USERDATA:
|
||||
return o->value.ts->marked;
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
return o->value.a->marked;
|
||||
case TAG_LCLOSURE: case TAG_CCLOSURE:
|
||||
return o->value.cl->marked;
|
||||
|
6
ltable.c
6
ltable.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltable.c,v 1.35 2000/03/03 14:58:26 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 1.36 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
|
||||
#define TagDefault TAG_ARRAY
|
||||
#define TagDefault TAG_TABLE
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ Node *luaH_mainposition (const Hash *t, const TObject *key) {
|
||||
case TAG_STRING: case TAG_USERDATA:
|
||||
h = tsvalue(key)->hash;
|
||||
break;
|
||||
case TAG_ARRAY:
|
||||
case TAG_TABLE:
|
||||
h = IntPoint(L, avalue(key));
|
||||
break;
|
||||
case TAG_LPROTO:
|
||||
|
12
ltm.c
12
ltm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltm.c,v 1.35 2000/03/20 19:14:54 roberto Exp roberto $
|
||||
** $Id: ltm.c,v 1.36 2000/03/27 20:08:02 roberto Exp roberto $
|
||||
** Tag methods
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -29,7 +29,7 @@ static int luaI_checkevent (lua_State *L, const char *name, int t) {
|
||||
int e = luaL_findstring(name, luaT_eventname);
|
||||
if (e >= IM_N)
|
||||
luaL_verror(L, "event `%.50s' is deprecated", name);
|
||||
if (e == IM_GC && t == TAG_ARRAY)
|
||||
if (e == IM_GC && t == TAG_TABLE)
|
||||
luaL_verror(L, "event `gc' for tables is deprecated");
|
||||
if (e < 0)
|
||||
luaL_verror(L, "`%.50s' is not a valid event name", name);
|
||||
@ -46,7 +46,7 @@ static const char luaT_validevents[NUM_TAGS][IM_N] = {
|
||||
{1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_USERDATA */
|
||||
{1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* TAG_NUMBER */
|
||||
{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* TAG_STRING */
|
||||
{0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_ARRAY */
|
||||
{0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_TABLE */
|
||||
{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_LPROTO */
|
||||
{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_CPROTO */
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} /* TAG_NIL */
|
||||
@ -106,7 +106,7 @@ int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) {
|
||||
|
||||
int luaT_effectivetag (lua_State *L, const TObject *o) {
|
||||
static const int realtag[] = { /* ORDER LUA_T */
|
||||
TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY,
|
||||
TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_TABLE,
|
||||
TAG_LPROTO, TAG_CPROTO, TAG_NIL,
|
||||
TAG_LPROTO, TAG_CPROTO, /* TAG_LCLOSURE, TAG_CCLOSURE */
|
||||
};
|
||||
@ -116,7 +116,7 @@ int luaT_effectivetag (lua_State *L, const TObject *o) {
|
||||
int tag = o->value.ts->u.d.tag;
|
||||
return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */
|
||||
}
|
||||
case TAG_ARRAY: return o->value.a->htag;
|
||||
case TAG_TABLE: return o->value.a->htag;
|
||||
default: return realtag[t];
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ void luaT_settagmethod (lua_State *L, int t, const char *event, TObject *func) {
|
||||
if (!luaT_validevent(t, e))
|
||||
luaL_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s",
|
||||
luaT_eventname[e], luaO_typenames[t],
|
||||
(t == TAG_ARRAY || t == TAG_USERDATA) ? " with default tag"
|
||||
(t == TAG_TABLE || t == TAG_USERDATA) ? " with default tag"
|
||||
: "");
|
||||
temp = *func;
|
||||
*func = *luaT_getim(L, t,e);
|
||||
|
12
lvm.c
12
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 1.95 2000/03/10 18:37:44 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 1.96 2000/03/17 13:09:12 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -93,7 +93,7 @@ void luaV_closure (lua_State *L, int nelems) {
|
||||
void luaV_gettable (lua_State *L, StkId top) {
|
||||
TObject *table = top-2;
|
||||
const TObject *im;
|
||||
if (ttype(table) != TAG_ARRAY) { /* not a table, get gettable TM */
|
||||
if (ttype(table) != TAG_TABLE) { /* not a table, get gettable TM */
|
||||
im = luaT_getimbyObj(L, table, IM_GETTABLE);
|
||||
if (ttype(im) == TAG_NIL) {
|
||||
L->top = top;
|
||||
@ -128,7 +128,7 @@ void luaV_gettable (lua_State *L, StkId top) {
|
||||
*/
|
||||
void luaV_settable (lua_State *L, StkId t, StkId top) {
|
||||
const TObject *im;
|
||||
if (ttype(t) != TAG_ARRAY) { /* not a table, get `settable' method */
|
||||
if (ttype(t) != TAG_TABLE) { /* not a table, get `settable' method */
|
||||
L->top = top;
|
||||
im = luaT_getimbyObj(L, t, IM_SETTABLE);
|
||||
if (ttype(im) == TAG_NIL)
|
||||
@ -155,7 +155,7 @@ void luaV_settable (lua_State *L, StkId t, StkId top) {
|
||||
|
||||
|
||||
void luaV_rawsettable (lua_State *L, StkId t) {
|
||||
if (ttype(t) != TAG_ARRAY)
|
||||
if (ttype(t) != TAG_TABLE)
|
||||
lua_error(L, "indexed expression not a table");
|
||||
else {
|
||||
luaH_set(L, avalue(t), t+1, L->top-1);
|
||||
@ -291,7 +291,7 @@ void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) {
|
||||
int i;
|
||||
Hash *htab;
|
||||
htab = avalue(tab) = luaH_new(L, nvararg+1); /* +1 for field `n' */
|
||||
ttype(tab) = TAG_ARRAY;
|
||||
ttype(tab) = TAG_TABLE;
|
||||
for (i=0; i<nvararg; i++)
|
||||
luaH_setint(L, htab, i+1, firstelem+i);
|
||||
luaV_setn(L, htab, nvararg); /* store counter in field `n' */
|
||||
@ -430,7 +430,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const Proto *tf,
|
||||
L->top = top;
|
||||
luaC_checkGC(L);
|
||||
avalue(top) = luaH_new(L, GETARG_U(i));
|
||||
ttype(top) = TAG_ARRAY;
|
||||
ttype(top) = TAG_TABLE;
|
||||
top++;
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user