diff options
Diffstat (limited to 'inout.c')
| -rw-r--r-- | inout.c | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -4,9 +4,10 @@ | |||
| 4 | ** facilities. | 4 | ** facilities. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | char *rcs_inout="$Id: inout.c,v 2.2 1994/08/17 22:22:44 roberto Exp celes $"; | 7 | char *rcs_inout="$Id: inout.c,v 2.3 1994/09/05 21:22:43 celes Exp celes $"; |
| 8 | 8 | ||
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| 10 | #include <stdlib.h> | ||
| 10 | #include <string.h> | 11 | #include <string.h> |
| 11 | 12 | ||
| 12 | #include "opcode.h" | 13 | #include "opcode.h" |
| @@ -25,7 +26,7 @@ int lua_debugline; | |||
| 25 | #ifndef MAXFUNCSTACK | 26 | #ifndef MAXFUNCSTACK |
| 26 | #define MAXFUNCSTACK 64 | 27 | #define MAXFUNCSTACK 64 |
| 27 | #endif | 28 | #endif |
| 28 | static struct { int file; int function; } funcstack[MAXFUNCSTACK]; | 29 | static struct { char *file; int function; } funcstack[MAXFUNCSTACK]; |
| 29 | static int nfuncstack=0; | 30 | static int nfuncstack=0; |
| 30 | 31 | ||
| 31 | static FILE *fp; | 32 | static FILE *fp; |
| @@ -123,15 +124,15 @@ void lua_error (char *s) | |||
| 123 | ** Called to execute SETFUNCTION opcode, this function pushs a function into | 124 | ** Called to execute SETFUNCTION opcode, this function pushs a function into |
| 124 | ** function stack. Return 0 on success or 1 on error. | 125 | ** function stack. Return 0 on success or 1 on error. |
| 125 | */ | 126 | */ |
| 126 | int lua_pushfunction (int file, int function) | 127 | int lua_pushfunction (char *file, int function) |
| 127 | { | 128 | { |
| 128 | if (nfuncstack >= MAXFUNCSTACK-1) | 129 | if (nfuncstack >= MAXFUNCSTACK-1) |
| 129 | { | 130 | { |
| 130 | lua_error ("function stack overflow"); | 131 | lua_error ("function stack overflow"); |
| 131 | return 1; | 132 | return 1; |
| 132 | } | 133 | } |
| 133 | funcstack[nfuncstack].file = file; | ||
| 134 | funcstack[nfuncstack].function = function; | 134 | funcstack[nfuncstack].function = function; |
| 135 | funcstack[nfuncstack].file = file; | ||
| 135 | nfuncstack++; | 136 | nfuncstack++; |
| 136 | return 0; | 137 | return 0; |
| 137 | } | 138 | } |
| @@ -160,12 +161,12 @@ void lua_reportbug (char *s) | |||
| 160 | sprintf (strchr(msg,0), | 161 | sprintf (strchr(msg,0), |
| 161 | "\n\tin statement begining at line %d in function \"%s\" of file \"%s\"", | 162 | "\n\tin statement begining at line %d in function \"%s\" of file \"%s\"", |
| 162 | lua_debugline, lua_varname(funcstack[nfuncstack-1].function), | 163 | lua_debugline, lua_varname(funcstack[nfuncstack-1].function), |
| 163 | lua_file[funcstack[nfuncstack-1].file]); | 164 | funcstack[nfuncstack-1].file); |
| 164 | sprintf (strchr(msg,0), "\n\tactive stack\n"); | 165 | sprintf (strchr(msg,0), "\n\tactive stack\n"); |
| 165 | for (i=nfuncstack-1; i>=0; i--) | 166 | for (i=nfuncstack-1; i>=0; i--) |
| 166 | sprintf (strchr(msg,0), "\t-> function \"%s\" of file \"%s\"\n", | 167 | sprintf (strchr(msg,0), "\t-> function \"%s\" of file \"%s\"\n", |
| 167 | lua_varname(funcstack[i].function), | 168 | lua_varname(funcstack[i].function), |
| 168 | lua_file[funcstack[i].file]); | 169 | funcstack[i].file); |
| 169 | } | 170 | } |
| 170 | else | 171 | else |
| 171 | { | 172 | { |
