From ceaaa0cca8e02b102963730e8df25ac4fbe5f2dd Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Tue, 11 Oct 1994 11:38:17 -0300 Subject: [PATCH] Correcao do tratamento de erro reportado dentro de uma funcao. --- inout.c | 13 +++++++------ inout.h | 4 ++-- lua.stx | 4 ++-- opcode.c | 9 +++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/inout.c b/inout.c index 233fe88e..f441f7aa 100644 --- a/inout.c +++ b/inout.c @@ -4,9 +4,10 @@ ** facilities. */ -char *rcs_inout="$Id: inout.c,v 2.2 1994/08/17 22:22:44 roberto Exp celes $"; +char *rcs_inout="$Id: inout.c,v 2.3 1994/09/05 21:22:43 celes Exp celes $"; #include +#include #include #include "opcode.h" @@ -25,7 +26,7 @@ int lua_debugline; #ifndef MAXFUNCSTACK #define MAXFUNCSTACK 64 #endif -static struct { int file; int function; } funcstack[MAXFUNCSTACK]; +static struct { char *file; int function; } funcstack[MAXFUNCSTACK]; static int nfuncstack=0; static FILE *fp; @@ -123,15 +124,15 @@ void lua_error (char *s) ** Called to execute SETFUNCTION opcode, this function pushs a function into ** function stack. Return 0 on success or 1 on error. */ -int lua_pushfunction (int file, int function) +int lua_pushfunction (char *file, int function) { if (nfuncstack >= MAXFUNCSTACK-1) { lua_error ("function stack overflow"); return 1; } - funcstack[nfuncstack].file = file; funcstack[nfuncstack].function = function; + funcstack[nfuncstack].file = file; nfuncstack++; return 0; } @@ -160,12 +161,12 @@ void lua_reportbug (char *s) sprintf (strchr(msg,0), "\n\tin statement begining at line %d in function \"%s\" of file \"%s\"", lua_debugline, lua_varname(funcstack[nfuncstack-1].function), - lua_file[funcstack[nfuncstack-1].file]); + funcstack[nfuncstack-1].file); sprintf (strchr(msg,0), "\n\tactive stack\n"); for (i=nfuncstack-1; i>=0; i--) sprintf (strchr(msg,0), "\t-> function \"%s\" of file \"%s\"\n", lua_varname(funcstack[i].function), - lua_file[funcstack[i].file]); + funcstack[i].file); } else { diff --git a/inout.h b/inout.h index 63f6771e..2b95a7bf 100644 --- a/inout.h +++ b/inout.h @@ -1,5 +1,5 @@ /* -** $Id: $ +** $Id: inout.h,v 1.1 1993/12/17 18:41:19 celes Exp $ */ @@ -14,7 +14,7 @@ int lua_openfile (char *fn); void lua_closefile (void); int lua_openstring (char *s); void lua_closestring (void); -int lua_pushfunction (int file, int function); +int lua_pushfunction (char *file, int function); void lua_popfunction (void); void lua_reportbug (char *s); diff --git a/lua.stx b/lua.stx index 79224d3d..e71a8bda 100644 --- a/lua.stx +++ b/lua.stx @@ -1,6 +1,6 @@ %{ -char *rcs_luastx = "$Id: lua.stx,v 2.7 1994/08/05 19:31:09 celes Exp celes $"; +char *rcs_luastx = "$Id: lua.stx,v 2.8 1994/10/11 13:02:39 celes Exp celes $"; #include #include @@ -283,7 +283,7 @@ function : FUNCTION NAME if (lua_debug) { code_byte(SETFUNCTION); - code_word(lua_nfile-1); + code_code((Byte *)lua_file[lua_nfile-1]); code_word($3); } lua_codeadjust (0); diff --git a/opcode.c b/opcode.c index 478ec136..53f5d7d4 100644 --- a/opcode.c +++ b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 2.7 1994/09/20 15:11:11 celes Exp celes $"; +char *rcs_opcode="$Id: opcode.c,v 2.8 1994/09/27 21:43:30 celes Exp celes $"; #include #include @@ -600,10 +600,11 @@ int lua_execute (Byte *pc) case SETFUNCTION: { - CodeWord file, func; - get_word(file,pc); + CodeCode file; + CodeWord func; + get_code(file,pc); get_word(func,pc); - if (lua_pushfunction (file.w, func.w)) + if (lua_pushfunction ((char *)file.b, func.w)) return 1; } break;