mirror of
https://github.com/lua/lua
synced 2024-12-24 03:16:50 +03:00
Correcao do tratamento de erro reportado dentro de uma funcao.
This commit is contained in:
parent
82ceb12b7a
commit
ceaaa0cca8
13
inout.c
13
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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
|
||||
{
|
||||
|
4
inout.h
4
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);
|
||||
|
||||
|
4
lua.stx
4
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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($<vWord>3);
|
||||
}
|
||||
lua_codeadjust (0);
|
||||
|
9
opcode.c
9
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user