summaryrefslogtreecommitdiff
path: root/inout.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-09 16:09:22 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-09 16:09:22 -0200
commitfc0de64c2c3b79c68decc786c1de974fa2a6686e (patch)
treef7dc81244ea9c4563c988d5864664c0c87cdc1c1 /inout.c
parentb8bfa9628d565da245f73172a7c4d1f6247fa3b9 (diff)
downloadlua-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.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/inout.c b/inout.c
index 3e6b472b..9a54f4fc 100644
--- a/inout.c
+++ b/inout.c
@@ -5,7 +5,7 @@
5** Also provides some predefined lua functions. 5** Also provides some predefined lua functions.
6*/ 6*/
7 7
8char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $"; 8char *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 */
22int lua_linenumber; 22int lua_linenumber;
23int lua_debug; 23int lua_debug;
24int lua_debugline; 24int 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
30static struct { char *file; int function; } funcstack[MAXFUNCSTACK]; 30static struct {
31 char *file;
32 int function;
33 int line;
34} funcstack[MAXFUNCSTACK];
31static int nfuncstack=0; 35static int nfuncstack=0;
32 36
33static FILE *fp; 37static 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*/
128void lua_popfunction (void) 133void 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