This commit is contained in:
Roberto Ierusalimschy
1999-03-11 15:59:19 -03:00
parent 256d1bea08
commit 82ad0d5770
4 changed files with 10 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lauxlib.c,v 1.15 1999/03/04 21:17:26 roberto Exp roberto $ ** $Id: lauxlib.c,v 1.16 1999/03/10 14:19:41 roberto Exp roberto $
** Auxiliary functions for building Lua libraries ** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -128,8 +128,6 @@ void luaL_chunkid (char *out, char *source, int len) {
void luaL_filesource (char *out, char *filename, int len) { void luaL_filesource (char *out, char *filename, int len) {
if (filename == NULL) if (filename == NULL) filename = "(stdin)";
strcpy(out, "@(stdin)"); sprintf(out, "@%.*s", len-2, filename); /* -2 for '@' and '\0' */
else
sprintf(out, "@%.*s", len-2, filename); /* -2 for '@' and '\0' */
} }

6
ldo.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ldo.c,v 1.39 1999/03/10 14:19:41 roberto Exp roberto $ ** $Id: ldo.c,v 1.40 1999/03/10 14:23:07 roberto Exp roberto $
** Stack and Call structure of Lua ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -356,7 +356,7 @@ void luaD_gcIM (TObject *o)
} }
#define MAXFILENAME 200 /* maximum part of a file name kept */ #define MAXFILENAME 260 /* maximum part of a file name kept */
int lua_dofile (char *filename) { int lua_dofile (char *filename) {
ZIO z; ZIO z;
@@ -372,7 +372,7 @@ int lua_dofile (char *filename) {
bin = (c == ID_CHUNK); bin = (c == ID_CHUNK);
if (bin) if (bin)
f = freopen(filename, "rb", f); /* set binary mode */ f = freopen(filename, "rb", f); /* set binary mode */
luaL_filesource(source, filename, MAXFILENAME); luaL_filesource(source, filename, sizeof(source));
luaZ_Fopen(&z, f, source); luaZ_Fopen(&z, f, source);
status = do_main(&z, bin); status = do_main(&z, bin);
if (f != stdin) if (f != stdin)

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: liolib.c,v 1.32 1999/03/04 21:17:26 roberto Exp roberto $ ** $Id: liolib.c,v 1.33 1999/03/05 20:45:01 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
*/ */
@@ -471,7 +471,7 @@ static void errorfb (void) {
char buffchunk[MAXSRC]; char buffchunk[MAXSRC];
int linedefined; int linedefined;
lua_funcinfo(func, &chunkname, &linedefined); lua_funcinfo(func, &chunkname, &linedefined);
luaL_chunkid(buffchunk, chunkname, MAXSRC); 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, "\t");
if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) { if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) {

4
llex.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: llex.c,v 1.31 1999/03/04 21:17:26 roberto Exp roberto $ ** $Id: llex.c,v 1.32 1999/03/05 20:45:01 roberto Exp roberto $
** Lexical Analyzer ** Lexical Analyzer
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -45,7 +45,7 @@ void luaX_init (void) {
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), MAXSRC); 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 %.50s",