diff options
Diffstat (limited to 'inout.c')
| -rw-r--r-- | inout.c | 26 |
1 files changed, 22 insertions, 4 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.18 1995/03/17 20:42:20 roberto Exp roberto $"; | 8 | char *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 */ |
| 23 | Word lua_linenumber; | 31 | Word lua_linenumber; |
| 24 | Bool lua_debug; | 32 | Bool 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 | */ |
| 150 | void luaI_reportbug (char *msg, int size) | 158 | void 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 | ||
| 302 | void luaI_getstack (void) | ||
| 303 | { | ||
| 304 | char *s = lua_getstring(lua_getparam(1)); | ||
| 305 | if (s == NULL) s = ""; | ||
| 306 | luaI_reportbug(s, 0); | ||
| 307 | } | ||
| 308 | |||
