diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-26 12:21:56 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-26 12:21:56 -0200 |
commit | 15d48576ea737d51e579f101a870e37f62b81f22 (patch) | |
tree | ed2390188cfb5304d366696262ccda593f3e8589 /iolib.c | |
parent | 39b071f7b13e6ed6eff4a0f0471d2450a9c48084 (diff) | |
download | lua-15d48576ea737d51e579f101a870e37f62b81f22.tar.gz lua-15d48576ea737d51e579f101a870e37f62b81f22.tar.bz2 lua-15d48576ea737d51e579f101a870e37f62b81f22.zip |
functions now may be declared with any "var" as a name;
therefore they do not have a "baptism" name.
Changes in debug API to acomodate that.
Diffstat (limited to 'iolib.c')
-rw-r--r-- | iolib.c | 39 |
1 files changed, 26 insertions, 13 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Input/output library to LUA | 3 | ** Input/output library to LUA |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_iolib="$Id: iolib.c,v 1.24 1995/10/17 14:12:45 roberto Exp roberto $"; | 6 | char *rcs_iolib="$Id: iolib.c,v 1.25 1995/10/23 13:53:48 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
@@ -612,20 +612,33 @@ static void print_message (void) | |||
612 | fprintf(stderr, "Active Stack:\n"); | 612 | fprintf(stderr, "Active Stack:\n"); |
613 | while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) | 613 | while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) |
614 | { | 614 | { |
615 | char *filename; char *funcname; | 615 | char *name; |
616 | char *objname; int linedefined; | 616 | int currentline; |
617 | lua_funcinfo(func, &filename, &funcname, &objname, &linedefined); | 617 | fprintf(stderr, "\t"); |
618 | if (objname == NULL) | 618 | switch (*getobjname(func, &name)) |
619 | if (funcname) | 619 | { |
620 | fprintf(stderr, "\t%s", funcname); | 620 | case 'g': |
621 | else | 621 | fprintf(stderr, "function %s", name); |
622 | break; | ||
623 | case 'f': | ||
624 | fprintf(stderr, "fallback %s", name); | ||
625 | break; | ||
626 | default: | ||
622 | { | 627 | { |
623 | fprintf(stderr, "\tmain of %s\n", filename); | 628 | char *filename; |
624 | continue; | 629 | int linedefined; |
630 | lua_funcinfo(func, &filename, &linedefined); | ||
631 | if (linedefined == 0) | ||
632 | fprintf(stderr, "main of %s", filename); | ||
633 | else if (linedefined < 0) | ||
634 | fprintf(stderr, "%s", filename); | ||
635 | else | ||
636 | fprintf(stderr, "function (%s:%d)", filename, linedefined); | ||
625 | } | 637 | } |
626 | else | 638 | } |
627 | fprintf(stderr, "\t%s:%s", objname, funcname); | 639 | if ((currentline = lua_currentline(func)) > 0) |
628 | fprintf(stderr, "\t(defined in %s)\n", filename); | 640 | fprintf(stderr, " at line %d", currentline); |
641 | fprintf(stderr, "\n"); | ||
629 | } | 642 | } |
630 | } | 643 | } |
631 | 644 | ||