diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-09 16:09:22 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-09 16:09:22 -0200 |
commit | fc0de64c2c3b79c68decc786c1de974fa2a6686e (patch) | |
tree | f7dc81244ea9c4563c988d5864664c0c87cdc1c1 /inout.c | |
parent | b8bfa9628d565da245f73172a7c4d1f6247fa3b9 (diff) | |
download | lua-fc0de64c2c3b79c68decc786c1de974fa2a6686e.tar.gz lua-fc0de64c2c3b79c68decc786c1de974fa2a6686e.tar.bz2 lua-fc0de64c2c3b79c68decc786c1de974fa2a6686e.zip |
lua_debugline is kept in the stack 'funcstack' when debugging.
Diffstat (limited to 'inout.c')
-rw-r--r-- | inout.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -5,7 +5,7 @@ | |||
5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.9 1994/11/08 20:06:15 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
@@ -21,13 +21,17 @@ char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $"; | |||
21 | /* Exported variables */ | 21 | /* Exported variables */ |
22 | int lua_linenumber; | 22 | int lua_linenumber; |
23 | int lua_debug; | 23 | int lua_debug; |
24 | int lua_debugline; | 24 | int lua_debugline = 0; |
25 | 25 | ||
26 | /* Internal variables */ | 26 | /* Internal variables */ |
27 | #ifndef MAXFUNCSTACK | 27 | #ifndef MAXFUNCSTACK |
28 | #define MAXFUNCSTACK 64 | 28 | #define MAXFUNCSTACK 64 |
29 | #endif | 29 | #endif |
30 | static struct { char *file; int function; } funcstack[MAXFUNCSTACK]; | 30 | static struct { |
31 | char *file; | ||
32 | int function; | ||
33 | int line; | ||
34 | } funcstack[MAXFUNCSTACK]; | ||
31 | static int nfuncstack=0; | 35 | static int nfuncstack=0; |
32 | 36 | ||
33 | static FILE *fp; | 37 | static FILE *fp; |
@@ -117,6 +121,7 @@ int lua_pushfunction (char *file, int function) | |||
117 | } | 121 | } |
118 | funcstack[nfuncstack].function = function; | 122 | funcstack[nfuncstack].function = function; |
119 | funcstack[nfuncstack].file = file; | 123 | funcstack[nfuncstack].file = file; |
124 | funcstack[nfuncstack].line= lua_debugline; | ||
120 | nfuncstack++; | 125 | nfuncstack++; |
121 | return 0; | 126 | return 0; |
122 | } | 127 | } |
@@ -127,7 +132,8 @@ int lua_pushfunction (char *file, int function) | |||
127 | */ | 132 | */ |
128 | void lua_popfunction (void) | 133 | void lua_popfunction (void) |
129 | { | 134 | { |
130 | nfuncstack--; | 135 | --nfuncstack; |
136 | lua_debugline = funcstack[nfuncstack].line; | ||
131 | } | 137 | } |
132 | 138 | ||
133 | /* | 139 | /* |
@@ -269,6 +275,6 @@ void luaI_error (void) | |||
269 | { | 275 | { |
270 | char *s = lua_getstring(lua_getparam(1)); | 276 | char *s = lua_getstring(lua_getparam(1)); |
271 | if (s == NULL) s = "(no message)"; | 277 | if (s == NULL) s = "(no message)"; |
272 | lua_error(s); | 278 | lua_reportbug(s); |
273 | } | 279 | } |
274 | 280 | ||