mirror of https://github.com/lua/lua
calls to "lua_reportbug" changed to "lua_error", since
"lua_reportbug" is only an internal function to build debug information
This commit is contained in:
parent
8156604823
commit
18ea2eff80
13
fallback.c
13
fallback.c
|
@ -3,7 +3,7 @@
|
|||
** TecCGraf - PUC-Rio
|
||||
*/
|
||||
|
||||
char *rcs_fallback="$Id: fallback.c,v 1.10 1994/12/20 21:20:36 roberto Exp $";
|
||||
char *rcs_fallback="$Id: fallback.c,v 1.11 1995/02/06 19:34:03 roberto Exp roberto $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -11,7 +11,6 @@ char *rcs_fallback="$Id: fallback.c,v 1.10 1994/12/20 21:20:36 roberto Exp $";
|
|||
#include "mem.h"
|
||||
#include "fallback.h"
|
||||
#include "opcode.h"
|
||||
#include "inout.h"
|
||||
#include "lua.h"
|
||||
|
||||
|
||||
|
@ -84,31 +83,31 @@ static void indexFB (void)
|
|||
|
||||
static void gettableFB (void)
|
||||
{
|
||||
lua_reportbug("indexed expression not a table");
|
||||
lua_error("indexed expression not a table");
|
||||
}
|
||||
|
||||
|
||||
static void arithFB (void)
|
||||
{
|
||||
lua_reportbug("unexpected type at conversion to number");
|
||||
lua_error("unexpected type at conversion to number");
|
||||
}
|
||||
|
||||
static void concatFB (void)
|
||||
{
|
||||
lua_reportbug("unexpected type at conversion to string");
|
||||
lua_error("unexpected type at conversion to string");
|
||||
}
|
||||
|
||||
|
||||
static void orderFB (void)
|
||||
{
|
||||
lua_reportbug("unexpected type at comparison");
|
||||
lua_error("unexpected type at comparison");
|
||||
}
|
||||
|
||||
static void GDFB (void) { }
|
||||
|
||||
static void funcFB (void)
|
||||
{
|
||||
lua_reportbug("call expression not a function");
|
||||
lua_error("call expression not a function");
|
||||
}
|
||||
|
||||
|
||||
|
|
5
hash.c
5
hash.c
|
@ -3,14 +3,13 @@
|
|||
** hash manager for lua
|
||||
*/
|
||||
|
||||
char *rcs_hash="$Id: hash.c,v 2.23 1995/01/12 14:19:04 roberto Exp $";
|
||||
char *rcs_hash="$Id: hash.c,v 2.24 1995/02/06 19:34:03 roberto Exp roberto $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mem.h"
|
||||
#include "opcode.h"
|
||||
#include "hash.h"
|
||||
#include "inout.h"
|
||||
#include "table.h"
|
||||
#include "lua.h"
|
||||
|
||||
|
@ -54,7 +53,7 @@ static Word hashindex (Hash *t, Object *ref) /* hash function */
|
|||
switch (tag(ref))
|
||||
{
|
||||
case LUA_T_NIL:
|
||||
lua_reportbug ("unexpected type to index table");
|
||||
lua_error ("unexpected type to index table");
|
||||
return -1; /* UNREACHEABLE */
|
||||
case LUA_T_NUMBER:
|
||||
return (((Word)nvalue(ref))%nhash(t));
|
||||
|
|
19
inout.c
19
inout.c
|
@ -5,7 +5,7 @@
|
|||
** Also provides some predefined lua functions.
|
||||
*/
|
||||
|
||||
char *rcs_inout="$Id: inout.c,v 2.17 1995/03/17 20:27:11 celes Exp roberto $";
|
||||
char *rcs_inout="$Id: inout.c,v 2.18 1995/03/17 20:42:20 roberto Exp roberto $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -26,11 +26,7 @@ Word lua_debugline = 0;
|
|||
|
||||
|
||||
/* Internal variables */
|
||||
|
||||
#ifndef MAXFUNCSTACK
|
||||
#define MAXFUNCSTACK 100
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct FuncStackNode {
|
||||
struct FuncStackNode *next;
|
||||
char *file;
|
||||
|
@ -124,7 +120,7 @@ void lua_pushfunction (char *file, Word function)
|
|||
FuncStackNode *newNode;
|
||||
if (nfuncstack++ >= MAXFUNCSTACK)
|
||||
{
|
||||
lua_reportbug("function stack overflow");
|
||||
lua_error("function stack overflow");
|
||||
}
|
||||
newNode = new(FuncStackNode);
|
||||
newNode->function = function;
|
||||
|
@ -149,12 +145,10 @@ void lua_popfunction (void)
|
|||
}
|
||||
|
||||
/*
|
||||
** Report bug building a message and sending it to lua_error function.
|
||||
** Report bug building a message.
|
||||
*/
|
||||
void lua_reportbug (char *s)
|
||||
void luaI_reportbug (char *msg, int size)
|
||||
{
|
||||
char msg[MAXFUNCSTACK*80];
|
||||
strcpy (msg, s);
|
||||
if (lua_debugline != 0)
|
||||
{
|
||||
if (funcStack)
|
||||
|
@ -179,7 +173,6 @@ void lua_reportbug (char *s)
|
|||
lua_debugline, lua_filename());
|
||||
}
|
||||
}
|
||||
lua_error (msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -292,6 +285,6 @@ void luaI_error (void)
|
|||
{
|
||||
char *s = lua_getstring(lua_getparam(1));
|
||||
if (s == NULL) s = "(no message)";
|
||||
lua_reportbug(s);
|
||||
lua_error(s);
|
||||
}
|
||||
|
||||
|
|
8
inout.h
8
inout.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: inout.h,v 1.6 1994/11/21 21:41:09 roberto Stab roberto $
|
||||
** $Id: inout.h,v 1.7 1994/12/20 21:20:36 roberto Exp roberto $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -8,6 +8,10 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#ifndef MAXFUNCSTACK
|
||||
#define MAXFUNCSTACK 100
|
||||
#endif
|
||||
|
||||
extern Word lua_linenumber;
|
||||
extern Bool lua_debug;
|
||||
extern Word lua_debugline;
|
||||
|
@ -18,7 +22,7 @@ char *lua_openstring (char *s);
|
|||
void lua_closestring (void);
|
||||
void lua_pushfunction (char *file, Word function);
|
||||
void lua_popfunction (void);
|
||||
void lua_reportbug (char *s);
|
||||
void luaI_reportbug (char *s, int size);
|
||||
|
||||
void lua_internaldofile (void);
|
||||
void lua_internaldostring (void);
|
||||
|
|
9
opcode.c
9
opcode.c
|
@ -3,7 +3,7 @@
|
|||
** TecCGraf - PUC-Rio
|
||||
*/
|
||||
|
||||
char *rcs_opcode="$Id: opcode.c,v 3.35 1995/02/10 12:51:29 roberto Exp celes $";
|
||||
char *rcs_opcode="$Id: opcode.c,v 3.36 1995/04/11 17:56:30 celes Exp roberto $";
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -68,9 +68,14 @@ Object *luaI_Address (lua_Object o)
|
|||
** Error messages
|
||||
*/
|
||||
|
||||
#define MAXMESSAGE MAXFUNCSTACK*80
|
||||
|
||||
static void lua_message (char *s)
|
||||
{
|
||||
lua_pushstring(s);
|
||||
char msg[MAXMESSAGE];
|
||||
strcpy (msg, s);
|
||||
luaI_reportbug(msg, MAXMESSAGE-strlen(s));
|
||||
lua_pushstring(msg);
|
||||
do_call(&luaI_fallBacks[FB_ERROR].function, (top-stack)-1, 0, (top-stack)-1);
|
||||
}
|
||||
|
||||
|
|
14
table.c
14
table.c
|
@ -3,7 +3,7 @@
|
|||
** Module to control static tables
|
||||
*/
|
||||
|
||||
char *rcs_table="$Id: table.c,v 2.27 1995/01/13 22:11:12 roberto Exp celes $";
|
||||
char *rcs_table="$Id: table.c,v 2.28 1995/01/18 20:15:54 celes Exp roberto $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -11,8 +11,8 @@ char *rcs_table="$Id: table.c,v 2.27 1995/01/13 22:11:12 roberto Exp celes $";
|
|||
#include "opcode.h"
|
||||
#include "tree.h"
|
||||
#include "hash.h"
|
||||
#include "inout.h"
|
||||
#include "table.h"
|
||||
#include "inout.h"
|
||||
#include "lua.h"
|
||||
#include "fallback.h"
|
||||
|
||||
|
@ -228,14 +228,14 @@ static void lua_nextvar (void)
|
|||
TreeNode *next;
|
||||
lua_Object o = lua_getparam(1);
|
||||
if (o == LUA_NOOBJECT)
|
||||
lua_reportbug("too few arguments to function `nextvar'");
|
||||
lua_error("too few arguments to function `nextvar'");
|
||||
if (lua_getparam(2) != LUA_NOOBJECT)
|
||||
lua_reportbug("too many arguments to function `nextvar'");
|
||||
lua_error("too many arguments to function `nextvar'");
|
||||
if (lua_isnil(o))
|
||||
varname = NULL;
|
||||
else if (!lua_isstring(o))
|
||||
{
|
||||
lua_reportbug("incorrect argument to function `nextvar'");
|
||||
lua_error("incorrect argument to function `nextvar'");
|
||||
return; /* to avoid warnings */
|
||||
}
|
||||
else
|
||||
|
@ -262,7 +262,7 @@ static void setglobal (void)
|
|||
lua_Object name = lua_getparam(1);
|
||||
lua_Object value = lua_getparam(2);
|
||||
if (!lua_isstring(name))
|
||||
lua_reportbug("incorrect argument to function `setglobal'");
|
||||
lua_error("incorrect argument to function `setglobal'");
|
||||
lua_pushobject(value);
|
||||
lua_storeglobal(lua_getstring(name));
|
||||
}
|
||||
|
@ -272,6 +272,6 @@ static void getglobal (void)
|
|||
{
|
||||
lua_Object name = lua_getparam(1);
|
||||
if (!lua_isstring(name))
|
||||
lua_reportbug("incorrect argument to function `getglobal'");
|
||||
lua_error("incorrect argument to function `getglobal'");
|
||||
lua_pushobject(lua_getglobal(lua_getstring(name)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue