diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.152 2003/02/10 17:31:13 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.153 2003/02/18 16:02:56 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 | */ |
@@ -41,7 +41,7 @@ static lua_State *lua_state = NULL; | |||
41 | int islocked = 0; | 41 | int islocked = 0; |
42 | 42 | ||
43 | 43 | ||
44 | #define index(L,k) (L->ci->base+(k) - 1) | 44 | #define func_at(L,k) (L->ci->base+(k) - 1) |
45 | 45 | ||
46 | 46 | ||
47 | static void setnameval (lua_State *L, const char *name, int val) { | 47 | static void setnameval (lua_State *L, const char *name, int val) { |
@@ -190,7 +190,7 @@ static int listcode (lua_State *L) { | |||
190 | Proto *p; | 190 | Proto *p; |
191 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 191 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
192 | 1, "Lua function expected"); | 192 | 1, "Lua function expected"); |
193 | p = clvalue(index(L, 1))->l.p; | 193 | p = clvalue(func_at(L, 1))->l.p; |
194 | lua_newtable(L); | 194 | lua_newtable(L); |
195 | setnameval(L, "maxstack", p->maxstacksize); | 195 | setnameval(L, "maxstack", p->maxstacksize); |
196 | setnameval(L, "numparams", p->numparams); | 196 | setnameval(L, "numparams", p->numparams); |
@@ -209,7 +209,7 @@ static int listk (lua_State *L) { | |||
209 | int i; | 209 | int i; |
210 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 210 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
211 | 1, "Lua function expected"); | 211 | 1, "Lua function expected"); |
212 | p = clvalue(index(L, 1))->l.p; | 212 | p = clvalue(func_at(L, 1))->l.p; |
213 | lua_newtable(L); | 213 | lua_newtable(L); |
214 | for (i=0; i<p->sizek; i++) { | 214 | for (i=0; i<p->sizek; i++) { |
215 | lua_pushnumber(L, i+1); | 215 | lua_pushnumber(L, i+1); |
@@ -227,7 +227,7 @@ static int listlocals (lua_State *L) { | |||
227 | const char *name; | 227 | const char *name; |
228 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 228 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
229 | 1, "Lua function expected"); | 229 | 1, "Lua function expected"); |
230 | p = clvalue(index(L, 1))->l.p; | 230 | p = clvalue(func_at(L, 1))->l.p; |
231 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) | 231 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) |
232 | lua_pushstring(L, name); | 232 | lua_pushstring(L, name); |
233 | return i-1; | 233 | return i-1; |
@@ -267,13 +267,13 @@ static int mem_query (lua_State *L) { | |||
267 | static int hash_query (lua_State *L) { | 267 | static int hash_query (lua_State *L) { |
268 | if (lua_isnone(L, 2)) { | 268 | if (lua_isnone(L, 2)) { |
269 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); | 269 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); |
270 | lua_pushnumber(L, tsvalue(index(L, 1))->tsv.hash); | 270 | lua_pushnumber(L, tsvalue(func_at(L, 1))->tsv.hash); |
271 | } | 271 | } |
272 | else { | 272 | else { |
273 | TObject *o = index(L, 1); | 273 | TObject *o = func_at(L, 1); |
274 | Table *t; | 274 | Table *t; |
275 | luaL_checktype(L, 2, LUA_TTABLE); | 275 | luaL_checktype(L, 2, LUA_TTABLE); |
276 | t = hvalue(index(L, 2)); | 276 | t = hvalue(func_at(L, 2)); |
277 | lua_pushnumber(L, luaH_mainposition(t, o) - t->node); | 277 | lua_pushnumber(L, luaH_mainposition(t, o) - t->node); |
278 | } | 278 | } |
279 | return 1; | 279 | return 1; |
@@ -295,7 +295,7 @@ static int table_query (lua_State *L) { | |||
295 | const Table *t; | 295 | const Table *t; |
296 | int i = luaL_optint(L, 2, -1); | 296 | int i = luaL_optint(L, 2, -1); |
297 | luaL_checktype(L, 1, LUA_TTABLE); | 297 | luaL_checktype(L, 1, LUA_TTABLE); |
298 | t = hvalue(index(L, 1)); | 298 | t = hvalue(func_at(L, 1)); |
299 | if (i == -1) { | 299 | if (i == -1) { |
300 | lua_pushnumber(L, t->sizearray); | 300 | lua_pushnumber(L, t->sizearray); |
301 | lua_pushnumber(L, sizenode(t)); | 301 | lua_pushnumber(L, sizenode(t)); |