diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
commit | 8060193702b21a06af3541555db4cd317c733ce9 (patch) | |
tree | d1cfa3a4ac41dc6766188680659c1bd1311e22a8 /ldebug.c | |
parent | 2779e81fbbdebf8b7cac97c167ff109bad537c4b (diff) | |
download | lua-8060193702b21a06af3541555db4cd317c733ce9.tar.gz lua-8060193702b21a06af3541555db4cd317c733ce9.tar.bz2 lua-8060193702b21a06af3541555db4cd317c733ce9.zip |
`lauxlib' is now part of the libraries (not used by core Lua)
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.38 2000/08/28 20:22:21 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.39 2000/08/31 13:29:12 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 | */ |
@@ -10,7 +10,6 @@ | |||
10 | #include "lua.h" | 10 | #include "lua.h" |
11 | 11 | ||
12 | #include "lapi.h" | 12 | #include "lapi.h" |
13 | #include "lauxlib.h" | ||
14 | #include "lcode.h" | 13 | #include "lcode.h" |
15 | #include "ldebug.h" | 14 | #include "ldebug.h" |
16 | #include "ldo.h" | 15 | #include "ldo.h" |
@@ -18,6 +17,7 @@ | |||
18 | #include "lobject.h" | 17 | #include "lobject.h" |
19 | #include "lopcodes.h" | 18 | #include "lopcodes.h" |
20 | #include "lstate.h" | 19 | #include "lstate.h" |
20 | #include "lstring.h" | ||
21 | #include "ltable.h" | 21 | #include "ltable.h" |
22 | #include "ltm.h" | 22 | #include "ltm.h" |
23 | #include "luadebug.h" | 23 | #include "luadebug.h" |
@@ -172,17 +172,20 @@ const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int localnum) { | |||
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | static void infoLproto (lua_Debug *ar, Proto *f) { | ||
176 | ar->source = f->source->str; | ||
177 | ar->linedefined = f->lineDefined; | ||
178 | ar->what = "Lua"; | ||
179 | } | ||
180 | |||
181 | |||
175 | static void lua_funcinfo (lua_Debug *ar, StkId func) { | 182 | static void lua_funcinfo (lua_Debug *ar, StkId func) { |
176 | switch (ttype(func)) { | 183 | switch (ttype(func)) { |
177 | case TAG_LCLOSURE: | 184 | case TAG_LCLOSURE: |
178 | ar->source = clvalue(func)->f.l->source->str; | 185 | infoLproto(ar, clvalue(func)->f.l); |
179 | ar->linedefined = clvalue(func)->f.l->lineDefined; | ||
180 | ar->what = "Lua"; | ||
181 | break; | 186 | break; |
182 | case TAG_LMARK: | 187 | case TAG_LMARK: |
183 | ar->source = infovalue(func)->func->f.l->source->str; | 188 | infoLproto(ar, infovalue(func)->func->f.l); |
184 | ar->linedefined = infovalue(func)->func->f.l->lineDefined; | ||
185 | ar->what = "Lua"; | ||
186 | break; | 189 | break; |
187 | case TAG_CCLOSURE: case TAG_CMARK: | 190 | case TAG_CCLOSURE: case TAG_CMARK: |
188 | ar->source = "(C)"; | 191 | ar->source = "(C)"; |
@@ -192,6 +195,7 @@ static void lua_funcinfo (lua_Debug *ar, StkId func) { | |||
192 | default: | 195 | default: |
193 | LUA_INTERNALERROR("invalid `func' value"); | 196 | LUA_INTERNALERROR("invalid `func' value"); |
194 | } | 197 | } |
198 | luaO_chunkid(ar->source_id, ar->source, sizeof(ar->source_id)); | ||
195 | if (ar->linedefined == 0) | 199 | if (ar->linedefined == 0) |
196 | ar->what = "main"; | 200 | ar->what = "main"; |
197 | } | 201 | } |
@@ -431,10 +435,10 @@ void luaG_typeerror (lua_State *L, StkId o, const char *op) { | |||
431 | const char *kind = getobjname(L, o, &name); | 435 | const char *kind = getobjname(L, o, &name); |
432 | const char *t = luaO_typename(o); | 436 | const char *t = luaO_typename(o); |
433 | if (kind) | 437 | if (kind) |
434 | luaL_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)", | 438 | luaO_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)", |
435 | op, kind, name, t); | 439 | op, kind, name, t); |
436 | else | 440 | else |
437 | luaL_verror(L, "attempt to %.30s a %.10s value", op, t); | 441 | luaO_verror(L, "attempt to %.30s a %.10s value", op, t); |
438 | } | 442 | } |
439 | 443 | ||
440 | 444 | ||
@@ -449,8 +453,8 @@ void luaG_ordererror (lua_State *L, StkId top) { | |||
449 | const char *t1 = luaO_typename(top-2); | 453 | const char *t1 = luaO_typename(top-2); |
450 | const char *t2 = luaO_typename(top-1); | 454 | const char *t2 = luaO_typename(top-1); |
451 | if (t1[2] == t2[2]) | 455 | if (t1[2] == t2[2]) |
452 | luaL_verror(L, "attempt to compare two %.10s values", t1); | 456 | luaO_verror(L, "attempt to compare two %.10s values", t1); |
453 | else | 457 | else |
454 | luaL_verror(L, "attempt to compare %.10s with %.10s", t1, t2); | 458 | luaO_verror(L, "attempt to compare %.10s with %.10s", t1, t2); |
455 | } | 459 | } |
456 | 460 | ||