diff options
-rw-r--r-- | lapi.c | 4 | ||||
-rw-r--r-- | ldebug.c | 10 | ||||
-rw-r--r-- | ltests.c | 13 | ||||
-rw-r--r-- | ltm.c | 10 | ||||
-rw-r--r-- | ltm.h | 6 |
5 files changed, 20 insertions, 23 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.109 2010/01/08 15:16:56 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.110 2010/01/11 17:38:30 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 | */ |
@@ -255,7 +255,7 @@ LUA_API int lua_type (lua_State *L, int idx) { | |||
255 | 255 | ||
256 | LUA_API const char *lua_typename (lua_State *L, int t) { | 256 | LUA_API const char *lua_typename (lua_State *L, int t) { |
257 | UNUSED(L); | 257 | UNUSED(L); |
258 | return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; | 258 | return typename(t); |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.61 2010/01/06 14:42:35 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.62 2010/01/11 17:37:59 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -416,7 +416,7 @@ static int isinstack (CallInfo *ci, const TValue *o) { | |||
416 | void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { | 416 | void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { |
417 | CallInfo *ci = L->ci; | 417 | CallInfo *ci = L->ci; |
418 | const char *name = NULL; | 418 | const char *name = NULL; |
419 | const char *t = luaT_typenames[ttype(o)]; | 419 | const char *t = typename(ttype(o)); |
420 | const char *kind = (isLua(ci) && isinstack(ci, o)) ? | 420 | const char *kind = (isLua(ci) && isinstack(ci, o)) ? |
421 | getobjname(L, ci, cast_int(o - ci->u.l.base), &name) : | 421 | getobjname(L, ci, cast_int(o - ci->u.l.base), &name) : |
422 | NULL; | 422 | NULL; |
@@ -444,9 +444,9 @@ void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { | |||
444 | 444 | ||
445 | 445 | ||
446 | int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { | 446 | int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { |
447 | const char *t1 = luaT_typenames[ttype(p1)]; | 447 | const char *t1 = typename(ttype(p1)); |
448 | const char *t2 = luaT_typenames[ttype(p2)]; | 448 | const char *t2 = typename(ttype(p2)); |
449 | if (t1[2] == t2[2]) | 449 | if (t1 == t2) |
450 | luaG_runerror(L, "attempt to compare two %s values", t1); | 450 | luaG_runerror(L, "attempt to compare two %s values", t1); |
451 | else | 451 | else |
452 | luaG_runerror(L, "attempt to compare %s with %s", t1, t2); | 452 | luaG_runerror(L, "attempt to compare %s with %s", t1, t2); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.85 2009/12/17 16:20:01 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.86 2009/12/22 15:32:50 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -190,7 +190,7 @@ static void printobj (global_State *g, GCObject *o) { | |||
190 | GCObject *p; | 190 | GCObject *p; |
191 | for (p = g->rootgc; p != o && p != NULL; p = gch(p)->next) i++; | 191 | for (p = g->rootgc; p != o && p != NULL; p = gch(p)->next) i++; |
192 | if (p == NULL) i = -1; | 192 | if (p == NULL) i = -1; |
193 | printf("%d:%s(%p)-%c(%02X)", i, luaT_typenames[gch(o)->tt], (void *)o, | 193 | printf("%d:%s(%p)-%c(%02X)", i, typename(gch(o)->tt), (void *)o, |
194 | isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked); | 194 | isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked); |
195 | } | 195 | } |
196 | 196 | ||
@@ -329,10 +329,7 @@ static void checkstack (global_State *g, lua_State *L1) { | |||
329 | 329 | ||
330 | static void checkobject (global_State *g, GCObject *o) { | 330 | static void checkobject (global_State *g, GCObject *o) { |
331 | if (isdead(g, o)) | 331 | if (isdead(g, o)) |
332 | /* lua_assert(issweep(g));*/ | 332 | lua_assert(issweep(g)); |
333 | { if (!issweep(g)) | ||
334 | printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[gch(o)->tt], gch(o)->marked); | ||
335 | } | ||
336 | else { | 333 | else { |
337 | if (g->gcstate == GCSfinalize) | 334 | if (g->gcstate == GCSfinalize) |
338 | lua_assert(iswhite(o)); | 335 | lua_assert(iswhite(o)); |
@@ -1141,10 +1138,6 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
1141 | else if EQ("type") { | 1138 | else if EQ("type") { |
1142 | lua_pushstring(L1, luaL_typename(L1, getnum)); | 1139 | lua_pushstring(L1, luaL_typename(L1, getnum)); |
1143 | } | 1140 | } |
1144 | /* else if EQ("getn") { | ||
1145 | int i = getindex; | ||
1146 | lua_pushinteger(L1, lua_objlen(L1, i)); | ||
1147 | } */ | ||
1148 | else if EQ("append") { | 1141 | else if EQ("append") { |
1149 | int t = getindex; | 1142 | int t = getindex; |
1150 | int i = lua_rawlen(L1, t); | 1143 | int i = lua_rawlen(L1, t); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.9 2007/09/10 17:59:32 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.10 2009/11/19 19:06:52 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 | */ |
@@ -19,10 +19,12 @@ | |||
19 | #include "ltm.h" | 19 | #include "ltm.h" |
20 | 20 | ||
21 | 21 | ||
22 | static const char udatatypename[] = "userdata"; | ||
22 | 23 | ||
23 | LUAI_DDEF const char *const luaT_typenames[] = { | 24 | LUAI_DDEF const char *const luaT_typenames_[] = { |
24 | "nil", "boolean", "userdata", "number", | 25 | "no value", |
25 | "string", "table", "function", "userdata", "thread", | 26 | "nil", "boolean", udatatypename, "number", |
27 | "string", "table", "function", udatatypename, "thread", | ||
26 | "proto", "upval" | 28 | "proto", "upval" |
27 | }; | 29 | }; |
28 | 30 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.h,v 2.7 2007/09/10 17:59:32 roberto Exp roberto $ | 2 | ** $Id: ltm.h,v 2.8 2009/11/19 19:06:52 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 | */ |
@@ -43,7 +43,9 @@ typedef enum { | |||
43 | 43 | ||
44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) |
45 | 45 | ||
46 | LUAI_DDEC const char *const luaT_typenames[]; | 46 | #define typename(x) luaT_typenames_[(x) + 1] |
47 | |||
48 | LUAI_DDEC const char *const luaT_typenames_[]; | ||
47 | 49 | ||
48 | 50 | ||
49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); | 51 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); |