aboutsummaryrefslogtreecommitdiff
path: root/inout.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-05-16 14:23:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-05-16 14:23:58 -0300
commitec79f25286a4ac843280ae7377ec1e5b39a70cea (patch)
tree03872cdc5d5f18266021c1cc5d07b214daf59ff3 /inout.c
parent18ea2eff80c720632cb6a89d560c5cce2377df06 (diff)
downloadlua-ec79f25286a4ac843280ae7377ec1e5b39a70cea.tar.gz
lua-ec79f25286a4ac843280ae7377ec1e5b39a70cea.tar.bz2
lua-ec79f25286a4ac843280ae7377ec1e5b39a70cea.zip
new lua function "getstack"; new interface to function luaI_reportbug.
Diffstat (limited to 'inout.c')
-rw-r--r--inout.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/inout.c b/inout.c
index 9ea0fd82..afb0ee52 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.18 1995/03/17 20:42:20 roberto Exp roberto $"; 8char *rcs_inout="$Id: inout.c,v 2.19 1995/05/02 18:43:03 roberto Exp roberto $";
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include <stdlib.h> 11#include <stdlib.h>
@@ -19,6 +19,14 @@ char *rcs_inout="$Id: inout.c,v 2.18 1995/03/17 20:42:20 roberto Exp roberto $";
19#include "tree.h" 19#include "tree.h"
20#include "lua.h" 20#include "lua.h"
21 21
22
23#ifndef MAXFUNCSTACK
24#define MAXFUNCSTACK 100
25#endif
26
27#define MAXMESSAGE MAXFUNCSTACK*80
28
29
22/* Exported variables */ 30/* Exported variables */
23Word lua_linenumber; 31Word lua_linenumber;
24Bool lua_debug; 32Bool lua_debug;
@@ -145,10 +153,12 @@ void lua_popfunction (void)
145} 153}
146 154
147/* 155/*
148** Report bug building a message. 156** Report bug building a message and pushing it on the stack.
149*/ 157*/
150void luaI_reportbug (char *msg, int size) 158void luaI_reportbug (char *s, int err)
151{ 159{
160 char msg[MAXMESSAGE];
161 strcpy (msg, s);
152 if (lua_debugline != 0) 162 if (lua_debugline != 0)
153 { 163 {
154 if (funcStack) 164 if (funcStack)
@@ -163,7 +173,7 @@ void luaI_reportbug (char *msg, int size)
163 lua_constant[func->function]->str, func->file, line); 173 lua_constant[func->function]->str, func->file, line);
164 line = func->line; 174 line = func->line;
165 func = func->next; 175 func = func->next;
166 lua_popfunction(); 176 if (err) lua_popfunction();
167 } while (func); 177 } while (func);
168 } 178 }
169 else 179 else
@@ -173,6 +183,7 @@ void luaI_reportbug (char *msg, int size)
173 lua_debugline, lua_filename()); 183 lua_debugline, lua_filename());
174 } 184 }
175 } 185 }
186 lua_pushstring(msg);
176} 187}
177 188
178 189
@@ -288,3 +299,10 @@ void luaI_error (void)
288 lua_error(s); 299 lua_error(s);
289} 300}
290 301
302void luaI_getstack (void)
303{
304 char *s = lua_getstring(lua_getparam(1));
305 if (s == NULL) s = "";
306 luaI_reportbug(s, 0);
307}
308