bigger limits

This commit is contained in:
Roberto Ierusalimschy 1999-05-14 09:24:04 -03:00
parent 3aa500b524
commit 924bbe020b
3 changed files with 19 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: liolib.c,v 1.38 1999/04/14 20:40:32 roberto Exp $ ** $Id: liolib.c,v 1.39 1999/05/05 19:22:26 roberto Exp roberto $
** Standard I/O (and system) library ** Standard I/O (and system) library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -477,7 +477,7 @@ static void io_debug (void) {
#define MAXMESSAGE (MESSAGESIZE*10) #define MAXMESSAGE (MESSAGESIZE*10)
#define MAXSRC 40 #define MAXSRC 60
static void errorfb (void) { static void errorfb (void) {
@ -494,7 +494,7 @@ static void errorfb (void) {
lua_funcinfo(func, &chunkname, &linedefined); lua_funcinfo(func, &chunkname, &linedefined);
luaL_chunkid(buffchunk, chunkname, sizeof(buffchunk)); luaL_chunkid(buffchunk, chunkname, sizeof(buffchunk));
if (level == 2) strcat(buff, "Active Stack:\n"); if (level == 2) strcat(buff, "Active Stack:\n");
strcat(buff, "\t"); strcat(buff, " ");
if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) { if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) {
strcat(buff, "...\n"); strcat(buff, "...\n");
break; /* buffer is full */ break; /* buffer is full */
@ -508,11 +508,11 @@ static void errorfb (void) {
break; break;
default: { default: {
if (linedefined == 0) if (linedefined == 0)
sprintf(buff+strlen(buff), "main of %.50s", buffchunk); sprintf(buff+strlen(buff), "main of %.70s", buffchunk);
else if (linedefined < 0) else if (linedefined < 0)
sprintf(buff+strlen(buff), "%.50s", buffchunk); sprintf(buff+strlen(buff), "%.70s", buffchunk);
else else
sprintf(buff+strlen(buff), "function <%d:%.50s>", sprintf(buff+strlen(buff), "function <%d:%.70s>",
linedefined, buffchunk); linedefined, buffchunk);
chunkname = NULL; chunkname = NULL;
} }
@ -520,7 +520,7 @@ static void errorfb (void) {
if ((currentline = lua_currentline(func)) > 0) if ((currentline = lua_currentline(func)) > 0)
sprintf(buff+strlen(buff), " at line %d", currentline); sprintf(buff+strlen(buff), " at line %d", currentline);
if (chunkname) if (chunkname)
sprintf(buff+strlen(buff), " [%.50s]", buffchunk); sprintf(buff+strlen(buff), " [%.70s]", buffchunk);
strcat(buff, "\n"); strcat(buff, "\n");
} }
func = lua_rawgetglobal("_ALERT"); func = lua_rawgetglobal("_ALERT");

25
llex.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: llex.c,v 1.33 1999/03/11 18:59:19 roberto Exp roberto $ ** $Id: llex.c,v 1.34 1999/03/25 21:05:05 roberto Exp roberto $
** Lexical Analyzer ** Lexical Analyzer
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -41,14 +41,14 @@ void luaX_init (void) {
} }
#define MAXSRC 40 #define MAXSRC 80
void luaX_syntaxerror (LexState *ls, char *s, char *token) { void luaX_syntaxerror (LexState *ls, char *s, char *token) {
char buff[MAXSRC]; char buff[MAXSRC];
luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff)); luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff));
if (token[0] == '\0') if (token[0] == '\0')
token = "<eof>"; token = "<eof>";
luaL_verror("%.100s;\n last token read: `%.50s' at line %d in %.50s", luaL_verror("%.100s;\n last token read: `%.50s' at line %d in %.80s",
s, token, ls->linenumber, buff); s, token, ls->linenumber, buff);
} }
@ -70,7 +70,7 @@ void luaX_token2str (int token, char *s) {
static void luaX_invalidchar (LexState *ls, int c) { static void luaX_invalidchar (LexState *ls, int c) {
char buff[10]; char buff[8];
sprintf(buff, "0x%02X", c); sprintf(buff, "0x%02X", c);
luaX_syntaxerror(ls, "invalid control char", buff); luaX_syntaxerror(ls, "invalid control char", buff);
} }
@ -106,17 +106,15 @@ void luaX_setinput (LexState *LS, ZIO *z)
** ======================================================= ** =======================================================
*/ */
#define PRAGMASIZE 20 #define PRAGMASIZE 80
static void skipspace (LexState *LS) static void skipspace (LexState *LS) {
{
while (LS->current == ' ' || LS->current == '\t' || LS->current == '\r') while (LS->current == ' ' || LS->current == '\t' || LS->current == '\r')
next(LS); next(LS);
} }
static int checkcond (LexState *LS, char *buff) static int checkcond (LexState *LS, char *buff) {
{
static char *opts[] = {"nil", "1", NULL}; static char *opts[] = {"nil", "1", NULL};
int i = luaL_findstring(buff, opts); int i = luaL_findstring(buff, opts);
if (i >= 0) return i; if (i >= 0) return i;
@ -129,8 +127,7 @@ static int checkcond (LexState *LS, char *buff)
} }
static void readname (LexState *LS, char *buff) static void readname (LexState *LS, char *buff) {
{
int i = 0; int i = 0;
skipspace(LS); skipspace(LS);
while (isalnum(LS->current) || LS->current == '_') { while (isalnum(LS->current) || LS->current == '_') {
@ -148,8 +145,7 @@ static void readname (LexState *LS, char *buff)
static void inclinenumber (LexState *LS); static void inclinenumber (LexState *LS);
static void ifskip (LexState *LS) static void ifskip (LexState *LS) {
{
while (LS->ifstate[LS->iflevel].skip) { while (LS->ifstate[LS->iflevel].skip) {
if (LS->current == '\n') if (LS->current == '\n')
inclinenumber(LS); inclinenumber(LS);
@ -160,8 +156,7 @@ static void ifskip (LexState *LS)
} }
static void inclinenumber (LexState *LS) static void inclinenumber (LexState *LS) {
{
static char *pragmas [] = static char *pragmas [] =
{"debug", "nodebug", "endinput", "end", "ifnot", "if", "else", NULL}; {"debug", "nodebug", "endinput", "end", "ifnot", "if", "else", NULL};
next(LS); /* skip '\n' */ next(LS); /* skip '\n' */

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lstrlib.c,v 1.29 1999/04/30 14:12:05 roberto Exp roberto $ ** $Id: lstrlib.c,v 1.30 1999/05/05 19:22:26 roberto Exp roberto $
** Standard library for strings and pattern-matching ** Standard library for strings and pattern-matching
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -117,7 +117,7 @@ static void str_char (void) {
** ======================================================= ** =======================================================
*/ */
#define MAX_CAPT 9 #define MAX_CAPT 32
struct Capture { struct Capture {
char *src_end; /* end ('\0') of source string */ char *src_end; /* end ('\0') of source string */