'ttypenv' -> 'ttnov'

This commit is contained in:
Roberto Ierusalimschy 2013-04-12 16:07:09 -03:00
parent 49c1607157
commit 8f8665fffa
6 changed files with 21 additions and 21 deletions

16
lapi.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lapi.c,v 2.170 2012/12/05 19:49:55 roberto Exp roberto $ ** $Id: lapi.c,v 2.171 2013/03/16 21:10:18 roberto Exp roberto $
** Lua API ** Lua API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -248,7 +248,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) {
LUA_API int lua_type (lua_State *L, int idx) { LUA_API int lua_type (lua_State *L, int idx) {
StkId o = index2addr(L, idx); StkId o = index2addr(L, idx);
return (isvalid(o) ? ttypenv(o) : LUA_TNONE); return (isvalid(o) ? ttnov(o) : LUA_TNONE);
} }
@ -406,7 +406,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
LUA_API size_t lua_rawlen (lua_State *L, int idx) { LUA_API size_t lua_rawlen (lua_State *L, int idx) {
StkId o = index2addr(L, idx); StkId o = index2addr(L, idx);
switch (ttypenv(o)) { switch (ttnov(o)) {
case LUA_TSTRING: return tsvalue(o)->len; case LUA_TSTRING: return tsvalue(o)->len;
case LUA_TUSERDATA: return uvalue(o)->len; case LUA_TUSERDATA: return uvalue(o)->len;
case LUA_TTABLE: return luaH_getn(hvalue(o)); case LUA_TTABLE: return luaH_getn(hvalue(o));
@ -426,7 +426,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
LUA_API void *lua_touserdata (lua_State *L, int idx) { LUA_API void *lua_touserdata (lua_State *L, int idx) {
StkId o = index2addr(L, idx); StkId o = index2addr(L, idx);
switch (ttypenv(o)) { switch (ttnov(o)) {
case LUA_TUSERDATA: return (rawuvalue(o) + 1); case LUA_TUSERDATA: return (rawuvalue(o) + 1);
case LUA_TLIGHTUSERDATA: return pvalue(o); case LUA_TLIGHTUSERDATA: return pvalue(o);
default: return NULL; default: return NULL;
@ -689,7 +689,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
int res; int res;
lua_lock(L); lua_lock(L);
obj = index2addr(L, objindex); obj = index2addr(L, objindex);
switch (ttypenv(obj)) { switch (ttnov(obj)) {
case LUA_TTABLE: case LUA_TTABLE:
mt = hvalue(obj)->metatable; mt = hvalue(obj)->metatable;
break; break;
@ -697,7 +697,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
mt = uvalue(obj)->metatable; mt = uvalue(obj)->metatable;
break; break;
default: default:
mt = G(L)->mt[ttypenv(obj)]; mt = G(L)->mt[ttnov(obj)];
break; break;
} }
if (mt == NULL) if (mt == NULL)
@ -821,7 +821,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
api_check(L, ttistable(L->top - 1), "table expected"); api_check(L, ttistable(L->top - 1), "table expected");
mt = hvalue(L->top - 1); mt = hvalue(L->top - 1);
} }
switch (ttypenv(obj)) { switch (ttnov(obj)) {
case LUA_TTABLE: { case LUA_TTABLE: {
hvalue(obj)->metatable = mt; hvalue(obj)->metatable = mt;
if (mt) { if (mt) {
@ -839,7 +839,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
break; break;
} }
default: { default: {
G(L)->mt[ttypenv(obj)] = mt; G(L)->mt[ttnov(obj)] = mt;
break; break;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldump.c,v 2.16 2011/11/24 13:25:41 roberto Exp roberto $ ** $Id: ldump.c,v 2.17 2012/01/23 23:02:10 roberto Exp roberto $
** save precompiled Lua chunks ** save precompiled Lua chunks
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -84,8 +84,8 @@ static void DumpConstants(const Proto* f, DumpState* D)
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
const TValue* o=&f->k[i]; const TValue* o=&f->k[i];
DumpChar(ttypenv(o),D); DumpChar(ttnov(o),D);
switch (ttypenv(o)) switch (ttnov(o))
{ {
case LUA_TNIL: case LUA_TNIL:
break; break;

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lobject.h,v 2.70 2012/05/11 14:10:50 roberto Exp roberto $ ** $Id: lobject.h,v 2.71 2012/09/11 18:21:44 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
*/ */
@ -124,12 +124,12 @@ typedef struct lua_TValue TValue;
#define ttype(o) (rttype(o) & 0x3F) #define ttype(o) (rttype(o) & 0x3F)
/* type tag of a TValue with no variants (bits 0-3) */ /* type tag of a TValue with no variants (bits 0-3) */
#define ttypenv(o) (novariant(rttype(o))) #define ttnov(o) (novariant(rttype(o)))
/* Macros to test type */ /* Macros to test type */
#define checktag(o,t) (rttype(o) == (t)) #define checktag(o,t) (rttype(o) == (t))
#define checktype(o,t) (ttypenv(o) == (t)) #define checktype(o,t) (ttnov(o) == (t))
#define ttisnumber(o) checktag((o), LUA_TNUMBER) #define ttisnumber(o) checktag((o), LUA_TNUMBER)
#define ttisnil(o) checktag((o), LUA_TNIL) #define ttisnil(o) checktag((o), LUA_TNIL)
#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) #define ttisboolean(o) checktag((o), LUA_TBOOLEAN)

6
ltm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltm.c,v 2.13 2011/02/28 17:32:10 roberto Exp roberto $ ** $Id: ltm.c,v 2.14 2011/06/02 19:31:40 roberto Exp roberto $
** Tag methods ** Tag methods
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -62,7 +62,7 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
Table *mt; Table *mt;
switch (ttypenv(o)) { switch (ttnov(o)) {
case LUA_TTABLE: case LUA_TTABLE:
mt = hvalue(o)->metatable; mt = hvalue(o)->metatable;
break; break;
@ -70,7 +70,7 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
mt = uvalue(o)->metatable; mt = uvalue(o)->metatable;
break; break;
default: default:
mt = G(L)->mt[ttypenv(o)]; mt = G(L)->mt[ttnov(o)];
} }
return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
} }

4
ltm.h
View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltm.h,v 2.10 2010/04/13 20:48:12 roberto Exp roberto $ ** $Id: ltm.h,v 2.11 2011/02/28 17:32:10 roberto Exp roberto $
** Tag methods ** Tag methods
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -44,7 +44,7 @@ typedef enum {
#define fasttm(l,et,e) gfasttm(G(l), et, e) #define fasttm(l,et,e) gfasttm(G(l), et, e)
#define ttypename(x) luaT_typenames_[(x) + 1] #define ttypename(x) luaT_typenames_[(x) + 1]
#define objtypename(x) ttypename(ttypenv(x)) #define objtypename(x) ttypename(ttnov(x))
LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];

4
lvm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 2.154 2012/08/16 17:34:28 roberto Exp roberto $ ** $Id: lvm.c,v 2.155 2013/03/16 21:10:18 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -334,7 +334,7 @@ void luaV_concat (lua_State *L, int total) {
void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
const TValue *tm; const TValue *tm;
switch (ttypenv(rb)) { switch (ttnov(rb)) {
case LUA_TTABLE: { case LUA_TTABLE: {
Table *h = hvalue(rb); Table *h = hvalue(rb);
tm = fasttm(L, h->metatable, TM_LEN); tm = fasttm(L, h->metatable, TM_LEN);