diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-26 11:16:05 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-26 11:16:05 -0300 |
commit | ef8263f81fdde2310ebb15c9a3fe5e954d57cab5 (patch) | |
tree | 8532d24bcfc4c59212616bdae1b25f087f1eb179 | |
parent | 2952bc5fc9cdc05ed061539cb7be26899513f004 (diff) | |
download | lua-ef8263f81fdde2310ebb15c9a3fe5e954d57cab5.tar.gz lua-ef8263f81fdde2310ebb15c9a3fe5e954d57cab5.tar.bz2 lua-ef8263f81fdde2310ebb15c9a3fe5e954d57cab5.zip |
better names for macros for tags and types.
rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag;
tnov -> ttype
-rw-r--r-- | lapi.c | 32 | ||||
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | ldo.c | 4 | ||||
-rw-r--r-- | ldump.c | 6 | ||||
-rw-r--r-- | lobject.h | 22 | ||||
-rw-r--r-- | ltable.c | 12 | ||||
-rw-r--r-- | ltm.c | 8 | ||||
-rw-r--r-- | lvm.c | 10 |
8 files changed, 49 insertions, 49 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.286 2018/02/23 13:13:31 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.287 2018/02/25 12:48:16 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 | */ |
@@ -257,7 +257,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) { | |||
257 | 257 | ||
258 | LUA_API int lua_type (lua_State *L, int idx) { | 258 | LUA_API int lua_type (lua_State *L, int idx) { |
259 | const TValue *o = index2value(L, idx); | 259 | const TValue *o = index2value(L, idx); |
260 | return (isvalid(o) ? ttnov(o) : LUA_TNONE); | 260 | return (isvalid(o) ? ttype(o) : LUA_TNONE); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
@@ -399,7 +399,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { | |||
399 | 399 | ||
400 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { | 400 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { |
401 | const TValue *o = index2value(L, idx); | 401 | const TValue *o = index2value(L, idx); |
402 | switch (ttype(o)) { | 402 | switch (ttypetag(o)) { |
403 | case LUA_TSHRSTR: return tsvalue(o)->shrlen; | 403 | case LUA_TSHRSTR: return tsvalue(o)->shrlen; |
404 | case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; | 404 | case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; |
405 | case LUA_TUSERDATA: return uvalue(o)->len; | 405 | case LUA_TUSERDATA: return uvalue(o)->len; |
@@ -420,7 +420,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { | |||
420 | 420 | ||
421 | LUA_API void *lua_touserdata (lua_State *L, int idx) { | 421 | LUA_API void *lua_touserdata (lua_State *L, int idx) { |
422 | const TValue *o = index2value(L, idx); | 422 | const TValue *o = index2value(L, idx); |
423 | switch (ttnov(o)) { | 423 | switch (ttype(o)) { |
424 | case LUA_TUSERDATA: return getudatamem(uvalue(o)); | 424 | case LUA_TUSERDATA: return getudatamem(uvalue(o)); |
425 | case LUA_TLIGHTUSERDATA: return pvalue(o); | 425 | case LUA_TLIGHTUSERDATA: return pvalue(o); |
426 | default: return NULL; | 426 | default: return NULL; |
@@ -436,7 +436,7 @@ LUA_API lua_State *lua_tothread (lua_State *L, int idx) { | |||
436 | 436 | ||
437 | LUA_API const void *lua_topointer (lua_State *L, int idx) { | 437 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
438 | const TValue *o = index2value(L, idx); | 438 | const TValue *o = index2value(L, idx); |
439 | switch (ttype(o)) { | 439 | switch (ttypetag(o)) { |
440 | case LUA_TTABLE: return hvalue(o); | 440 | case LUA_TTABLE: return hvalue(o); |
441 | case LUA_TLCL: return clLvalue(o); | 441 | case LUA_TLCL: return clLvalue(o); |
442 | case LUA_TCCL: return clCvalue(o); | 442 | case LUA_TCCL: return clCvalue(o); |
@@ -606,7 +606,7 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) { | |||
606 | luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); | 606 | luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); |
607 | } | 607 | } |
608 | lua_unlock(L); | 608 | lua_unlock(L); |
609 | return ttnov(s2v(L->top - 1)); | 609 | return ttype(s2v(L->top - 1)); |
610 | } | 610 | } |
611 | 611 | ||
612 | 612 | ||
@@ -628,7 +628,7 @@ LUA_API int lua_gettable (lua_State *L, int idx) { | |||
628 | else | 628 | else |
629 | luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); | 629 | luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); |
630 | lua_unlock(L); | 630 | lua_unlock(L); |
631 | return ttnov(s2v(L->top - 1)); | 631 | return ttype(s2v(L->top - 1)); |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||
@@ -653,7 +653,7 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { | |||
653 | } | 653 | } |
654 | api_incr_top(L); | 654 | api_incr_top(L); |
655 | lua_unlock(L); | 655 | lua_unlock(L); |
656 | return ttnov(s2v(L->top - 1)); | 656 | return ttype(s2v(L->top - 1)); |
657 | } | 657 | } |
658 | 658 | ||
659 | 659 | ||
@@ -664,7 +664,7 @@ static int finishrawget (lua_State *L, const TValue *val) { | |||
664 | setobj2s(L, L->top, val); | 664 | setobj2s(L, L->top, val); |
665 | api_incr_top(L); | 665 | api_incr_top(L); |
666 | lua_unlock(L); | 666 | lua_unlock(L); |
667 | return ttnov(s2v(L->top - 1)); | 667 | return ttype(s2v(L->top - 1)); |
668 | } | 668 | } |
669 | 669 | ||
670 | 670 | ||
@@ -749,7 +749,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
749 | int res = 0; | 749 | int res = 0; |
750 | lua_lock(L); | 750 | lua_lock(L); |
751 | obj = index2value(L, objindex); | 751 | obj = index2value(L, objindex); |
752 | switch (ttnov(obj)) { | 752 | switch (ttype(obj)) { |
753 | case LUA_TTABLE: | 753 | case LUA_TTABLE: |
754 | mt = hvalue(obj)->metatable; | 754 | mt = hvalue(obj)->metatable; |
755 | break; | 755 | break; |
@@ -757,7 +757,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
757 | mt = uvalue(obj)->metatable; | 757 | mt = uvalue(obj)->metatable; |
758 | break; | 758 | break; |
759 | default: | 759 | default: |
760 | mt = G(L)->mt[ttnov(obj)]; | 760 | mt = G(L)->mt[ttype(obj)]; |
761 | break; | 761 | break; |
762 | } | 762 | } |
763 | if (mt != NULL) { | 763 | if (mt != NULL) { |
@@ -782,7 +782,7 @@ LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) { | |||
782 | } | 782 | } |
783 | else { | 783 | else { |
784 | setobj2s(L, L->top, &uvalue(o)->uv[n - 1].uv); | 784 | setobj2s(L, L->top, &uvalue(o)->uv[n - 1].uv); |
785 | t = ttnov(s2v(L->top)); | 785 | t = ttype(s2v(L->top)); |
786 | } | 786 | } |
787 | api_incr_top(L); | 787 | api_incr_top(L); |
788 | lua_unlock(L); | 788 | lua_unlock(L); |
@@ -917,7 +917,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
917 | api_check(L, ttistable(s2v(L->top - 1)), "table expected"); | 917 | api_check(L, ttistable(s2v(L->top - 1)), "table expected"); |
918 | mt = hvalue(s2v(L->top - 1)); | 918 | mt = hvalue(s2v(L->top - 1)); |
919 | } | 919 | } |
920 | switch (ttnov(obj)) { | 920 | switch (ttype(obj)) { |
921 | case LUA_TTABLE: { | 921 | case LUA_TTABLE: { |
922 | hvalue(obj)->metatable = mt; | 922 | hvalue(obj)->metatable = mt; |
923 | if (mt) { | 923 | if (mt) { |
@@ -935,7 +935,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
935 | break; | 935 | break; |
936 | } | 936 | } |
937 | default: { | 937 | default: { |
938 | G(L)->mt[ttnov(obj)] = mt; | 938 | G(L)->mt[ttype(obj)] = mt; |
939 | break; | 939 | break; |
940 | } | 940 | } |
941 | } | 941 | } |
@@ -1295,7 +1295,7 @@ LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { | |||
1295 | 1295 | ||
1296 | static const char *aux_upvalue (TValue *fi, int n, TValue **val, | 1296 | static const char *aux_upvalue (TValue *fi, int n, TValue **val, |
1297 | GCObject **owner) { | 1297 | GCObject **owner) { |
1298 | switch (ttype(fi)) { | 1298 | switch (ttypetag(fi)) { |
1299 | case LUA_TCCL: { /* C closure */ | 1299 | case LUA_TCCL: { /* C closure */ |
1300 | CClosure *f = clCvalue(fi); | 1300 | CClosure *f = clCvalue(fi); |
1301 | if (!(1 <= n && n <= f->nupvalues)) return NULL; | 1301 | if (!(1 <= n && n <= f->nupvalues)) return NULL; |
@@ -1364,7 +1364,7 @@ static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { | |||
1364 | 1364 | ||
1365 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { | 1365 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
1366 | TValue *fi = index2value(L, fidx); | 1366 | TValue *fi = index2value(L, fidx); |
1367 | switch (ttype(fi)) { | 1367 | switch (ttypetag(fi)) { |
1368 | case LUA_TLCL: { /* lua closure */ | 1368 | case LUA_TLCL: { /* lua closure */ |
1369 | return *getupvalref(L, fidx, n, NULL); | 1369 | return *getupvalref(L, fidx, n, NULL); |
1370 | } | 1370 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.156 2018/02/21 12:54:26 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.157 2018/02/21 15:49:32 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -504,7 +504,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { | |||
504 | if (ttisinteger(idx)) { /* is there an index there? */ | 504 | if (ttisinteger(idx)) { /* is there an index there? */ |
505 | k = cast_int(ivalue(idx)); | 505 | k = cast_int(ivalue(idx)); |
506 | /* correct value? (warning: must distinguish floats from integers!) */ | 506 | /* correct value? (warning: must distinguish floats from integers!) */ |
507 | if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && | 507 | if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && |
508 | luaV_rawequalobj(&f->k[k], v)) | 508 | luaV_rawequalobj(&f->k[k], v)) |
509 | return k; /* reuse index */ | 509 | return k; /* reuse index */ |
510 | } | 510 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.194 2018/02/15 15:34:29 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.196 2018/02/17 19:29:29 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -453,7 +453,7 @@ void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1) { | |||
453 | void luaD_call (lua_State *L, StkId func, int nresults) { | 453 | void luaD_call (lua_State *L, StkId func, int nresults) { |
454 | lua_CFunction f; | 454 | lua_CFunction f; |
455 | TValue *funcv = s2v(func); | 455 | TValue *funcv = s2v(func); |
456 | switch (ttype(funcv)) { | 456 | switch (ttypetag(funcv)) { |
457 | case LUA_TCCL: /* C closure */ | 457 | case LUA_TCCL: /* C closure */ |
458 | f = clCvalue(funcv)->f; | 458 | f = clCvalue(funcv)->f; |
459 | goto Cfunc; | 459 | goto Cfunc; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldump.c,v 2.39 2017/06/27 14:21:12 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.40 2017/11/28 11:19:07 roberto Exp roberto $ |
3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -111,8 +111,8 @@ static void DumpConstants (const Proto *f, DumpState *D) { | |||
111 | DumpInt(n, D); | 111 | DumpInt(n, D); |
112 | for (i = 0; i < n; i++) { | 112 | for (i = 0; i < n; i++) { |
113 | const TValue *o = &f->k[i]; | 113 | const TValue *o = &f->k[i]; |
114 | DumpByte(ttype(o), D); | 114 | DumpByte(ttypetag(o), D); |
115 | switch (ttype(o)) { | 115 | switch (ttypetag(o)) { |
116 | case LUA_TNIL: | 116 | case LUA_TNIL: |
117 | break; | 117 | break; |
118 | case LUA_TBOOLEAN: | 118 | case LUA_TBOOLEAN: |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.139 2018/02/25 12:52:32 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.140 2018/02/26 13:35:03 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 | */ |
@@ -67,26 +67,26 @@ typedef struct TValue { | |||
67 | 67 | ||
68 | 68 | ||
69 | /* raw type tag of a TValue */ | 69 | /* raw type tag of a TValue */ |
70 | #define rttype(o) ((o)->tt_) | 70 | #define rawtt(o) ((o)->tt_) |
71 | 71 | ||
72 | /* tag with no variants (bits 0-3) */ | 72 | /* tag with no variants (bits 0-3) */ |
73 | #define novariant(t) ((t) & 0x0F) | 73 | #define novariant(t) ((t) & 0x0F) |
74 | 74 | ||
75 | /* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ | 75 | /* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ |
76 | #define ttyperaw(t) ((t) & 0x3F) | 76 | #define withvariant(t) ((t) & 0x3F) |
77 | #define ttype(o) ttyperaw(rttype(o)) | 77 | #define ttypetag(o) withvariant(rawtt(o)) |
78 | 78 | ||
79 | /* type tag of a TValue with no variants (bits 0-3) */ | 79 | /* type of a TValue */ |
80 | #define ttnov(o) (novariant(rttype(o))) | 80 | #define ttype(o) (novariant(rawtt(o))) |
81 | 81 | ||
82 | 82 | ||
83 | /* Macros to test type */ | 83 | /* Macros to test type */ |
84 | #define checktag(o,t) (rttype(o) == (t)) | 84 | #define checktag(o,t) (rawtt(o) == (t)) |
85 | #define checktype(o,t) (ttnov(o) == (t)) | 85 | #define checktype(o,t) (ttype(o) == (t)) |
86 | 86 | ||
87 | 87 | ||
88 | /* Macros for internal tests */ | 88 | /* Macros for internal tests */ |
89 | #define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) | 89 | #define righttt(obj) (ttypetag(obj) == gcvalue(obj)->tt) |
90 | 90 | ||
91 | #define checkliveness(L,obj) \ | 91 | #define checkliveness(L,obj) \ |
92 | lua_longassert(!iscollectable(obj) || \ | 92 | lua_longassert(!iscollectable(obj) || \ |
@@ -244,7 +244,7 @@ typedef struct GCObject { | |||
244 | /* Bit mark for collectable types */ | 244 | /* Bit mark for collectable types */ |
245 | #define BIT_ISCOLLECTABLE (1 << 6) | 245 | #define BIT_ISCOLLECTABLE (1 << 6) |
246 | 246 | ||
247 | #define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) | 247 | #define iscollectable(o) (rawtt(o) & BIT_ISCOLLECTABLE) |
248 | 248 | ||
249 | /* mark a tag as collectable */ | 249 | /* mark a tag as collectable */ |
250 | #define ctb(t) ((t) | BIT_ISCOLLECTABLE) | 250 | #define ctb(t) ((t) | BIT_ISCOLLECTABLE) |
@@ -535,7 +535,7 @@ typedef struct Proto { | |||
535 | #define LUA_TCCL (LUA_TFUNCTION | (3 << 4)) /* C closure */ | 535 | #define LUA_TCCL (LUA_TFUNCTION | (3 << 4)) /* C closure */ |
536 | 536 | ||
537 | #define ttisfunction(o) checktype(o, LUA_TFUNCTION) | 537 | #define ttisfunction(o) checktype(o, LUA_TFUNCTION) |
538 | #define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TLCL) | 538 | #define ttisclosure(o) ((rawtt(o) & 0x1F) == LUA_TLCL) |
539 | #define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) | 539 | #define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) |
540 | #define ttislcf(o) checktag((o), LUA_TLCF) | 540 | #define ttislcf(o) checktag((o), LUA_TLCF) |
541 | #define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) | 541 | #define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.133 2018/02/21 12:54:26 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.134 2018/02/23 13:13:31 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 | */ |
@@ -133,7 +133,7 @@ static int l_hashfloat (lua_Number n) { | |||
133 | ** nodes. | 133 | ** nodes. |
134 | */ | 134 | */ |
135 | static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | 135 | static Node *mainposition (const Table *t, int ktt, const Value *kvl) { |
136 | switch (ttyperaw(ktt)) { | 136 | switch (withvariant(ktt)) { |
137 | case LUA_TNUMINT: | 137 | case LUA_TNUMINT: |
138 | return hashint(t, ivalueraw(*kvl)); | 138 | return hashint(t, ivalueraw(*kvl)); |
139 | case LUA_TNUMFLT: | 139 | case LUA_TNUMFLT: |
@@ -155,7 +155,7 @@ static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | |||
155 | 155 | ||
156 | 156 | ||
157 | static Node *mainpositionTV (const Table *t, const TValue *key) { | 157 | static Node *mainpositionTV (const Table *t, const TValue *key) { |
158 | return mainposition(t, rttype(key), valraw(key)); | 158 | return mainposition(t, rawtt(key), valraw(key)); |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
@@ -168,9 +168,9 @@ static Node *mainpositionTV (const Table *t, const TValue *key) { | |||
168 | ** default case. | 168 | ** default case. |
169 | */ | 169 | */ |
170 | static int equalkey (const TValue *k1, const Node *n2) { | 170 | static int equalkey (const TValue *k1, const Node *n2) { |
171 | if (rttype(k1) != keytt(n2)) /* not the same variants? */ | 171 | if (rawtt(k1) != keytt(n2)) /* not the same variants? */ |
172 | return 0; /* cannot be same key */ | 172 | return 0; /* cannot be same key */ |
173 | switch (ttype(k1)) { | 173 | switch (ttypetag(k1)) { |
174 | case LUA_TNIL: | 174 | case LUA_TNIL: |
175 | return 1; | 175 | return 1; |
176 | case LUA_TNUMINT: | 176 | case LUA_TNUMINT: |
@@ -667,7 +667,7 @@ const TValue *luaH_getstr (Table *t, TString *key) { | |||
667 | ** main search function | 667 | ** main search function |
668 | */ | 668 | */ |
669 | const TValue *luaH_get (Table *t, const TValue *key) { | 669 | const TValue *luaH_get (Table *t, const TValue *key) { |
670 | switch (ttype(key)) { | 670 | switch (ttypetag(key)) { |
671 | case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); | 671 | case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); |
672 | case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); | 672 | case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); |
673 | case LUA_TNIL: return luaH_emptyobject; | 673 | case LUA_TNIL: return luaH_emptyobject; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.63 2018/02/21 15:49:32 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.64 2018/02/23 13:13:31 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 | */ |
@@ -70,7 +70,7 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { | |||
70 | 70 | ||
71 | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { | 71 | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { |
72 | Table *mt; | 72 | Table *mt; |
73 | switch (ttnov(o)) { | 73 | switch (ttype(o)) { |
74 | case LUA_TTABLE: | 74 | case LUA_TTABLE: |
75 | mt = hvalue(o)->metatable; | 75 | mt = hvalue(o)->metatable; |
76 | break; | 76 | break; |
@@ -78,7 +78,7 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { | |||
78 | mt = uvalue(o)->metatable; | 78 | mt = uvalue(o)->metatable; |
79 | break; | 79 | break; |
80 | default: | 80 | default: |
81 | mt = G(L)->mt[ttnov(o)]; | 81 | mt = G(L)->mt[ttype(o)]; |
82 | } | 82 | } |
83 | return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); | 83 | return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); |
84 | } | 84 | } |
@@ -96,7 +96,7 @@ const char *luaT_objtypename (lua_State *L, const TValue *o) { | |||
96 | if (ttisstring(name)) /* is '__name' a string? */ | 96 | if (ttisstring(name)) /* is '__name' a string? */ |
97 | return getstr(tsvalue(name)); /* use it as type name */ | 97 | return getstr(tsvalue(name)); /* use it as type name */ |
98 | } | 98 | } |
99 | return ttypename(ttnov(o)); /* else use standard type name */ | 99 | return ttypename(ttype(o)); /* else use standard type name */ |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.346 2018/02/21 19:43:44 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.347 2018/02/23 13:13:31 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 | */ |
@@ -458,8 +458,8 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | |||
458 | */ | 458 | */ |
459 | int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | 459 | int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { |
460 | const TValue *tm; | 460 | const TValue *tm; |
461 | if (ttype(t1) != ttype(t2)) { /* not the same variant? */ | 461 | if (ttypetag(t1) != ttypetag(t2)) { /* not the same variant? */ |
462 | if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) | 462 | if (ttype(t1) != ttype(t2) || ttype(t1) != LUA_TNUMBER) |
463 | return 0; /* only numbers can be equal with different variants */ | 463 | return 0; /* only numbers can be equal with different variants */ |
464 | else { /* two numbers with different variants */ | 464 | else { /* two numbers with different variants */ |
465 | lua_Integer i1, i2; /* compare them as integers */ | 465 | lua_Integer i1, i2; /* compare them as integers */ |
@@ -467,7 +467,7 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
467 | } | 467 | } |
468 | } | 468 | } |
469 | /* values have same type and same variant */ | 469 | /* values have same type and same variant */ |
470 | switch (ttype(t1)) { | 470 | switch (ttypetag(t1)) { |
471 | case LUA_TNIL: return 1; | 471 | case LUA_TNIL: return 1; |
472 | case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); | 472 | case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); |
473 | case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); | 473 | case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); |
@@ -569,7 +569,7 @@ void luaV_concat (lua_State *L, int total) { | |||
569 | */ | 569 | */ |
570 | void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { | 570 | void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { |
571 | const TValue *tm; | 571 | const TValue *tm; |
572 | switch (ttype(rb)) { | 572 | switch (ttypetag(rb)) { |
573 | case LUA_TTABLE: { | 573 | case LUA_TTABLE: { |
574 | Table *h = hvalue(rb); | 574 | Table *h = hvalue(rb); |
575 | tm = fasttm(L, h->metatable, TM_LEN); | 575 | tm = fasttm(L, h->metatable, TM_LEN); |