setparsedfile is extern; luaz_... changed to luaZ_...

This commit is contained in:
Roberto Ierusalimschy 1997-06-19 15:04:34 -03:00
parent 88f020b626
commit 6bb2cac3db
2 changed files with 12 additions and 16 deletions

21
inout.c
View File

@ -5,7 +5,7 @@
** Also provides some predefined lua functions. ** Also provides some predefined lua functions.
*/ */
char *rcs_inout="$Id: inout.c,v 2.62 1997/06/17 18:44:31 roberto Exp roberto $"; char *rcs_inout="$Id: inout.c,v 2.63 1997/06/18 20:35:49 roberto Exp roberto $";
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -38,7 +38,7 @@ char *luaI_typenames[] = { /* ORDER LUA_T */
static void setparsedfile (char *name) void luaI_setparsedfile (char *name)
{ {
lua_parsedfile = luaI_createfixedstring(name)->str; lua_parsedfile = luaI_createfixedstring(name)->str;
} }
@ -47,7 +47,7 @@ static void setparsedfile (char *name)
int lua_doFILE (FILE *f, int bin) int lua_doFILE (FILE *f, int bin)
{ {
ZIO z; ZIO z;
luaz_Fopen(&z, f); luaZ_Fopen(&z, f);
if (bin) if (bin)
return luaI_undump(&z); return luaI_undump(&z);
else { else {
@ -64,7 +64,7 @@ int lua_dofile (char *filename)
FILE *f = (filename == NULL) ? stdin : fopen(filename, "r"); FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
if (f == NULL) if (f == NULL)
return 2; return 2;
setparsedfile(filename?filename:"(stdin)"); luaI_setparsedfile(filename?filename:"(stdin)");
c = fgetc(f); c = fgetc(f);
ungetc(c, f); ungetc(c, f);
if (c == ID_CHUNK) { if (c == ID_CHUNK) {
@ -76,7 +76,8 @@ int lua_dofile (char *filename)
while ((c=fgetc(f)) != '\n') /* skip first line */; while ((c=fgetc(f)) != '\n') /* skip first line */;
status = lua_doFILE(f, 0); status = lua_doFILE(f, 0);
} }
fclose(f); if (f != stdin)
fclose(f);
return status; return status;
} }
@ -89,10 +90,9 @@ int lua_dobuffer (char *buff, int size)
{ {
int status; int status;
ZIO z; ZIO z;
setparsedfile("(buffer)"); luaI_setparsedfile("(buffer)");
luaz_mopen(&z, buff, size); luaZ_mopen(&z, buff, size);
status = luaI_undump(&z); status = luaI_undump(&z);
zclose(&z);
return status; return status;
} }
@ -107,11 +107,10 @@ int lua_dostring (char *str)
sprintf(buff, "(dostring) >> %.20s", str); sprintf(buff, "(dostring) >> %.20s", str);
temp = strchr(buff, '\n'); temp = strchr(buff, '\n');
if (temp) *temp = 0; /* end string after first line */ if (temp) *temp = 0; /* end string after first line */
setparsedfile(buff); luaI_setparsedfile(buff);
luaz_sopen(&z, str); luaZ_sopen(&z, str);
lua_setinput(&z); lua_setinput(&z);
status = lua_domain(); status = lua_domain();
zclose(&z);
return status; return status;
} }

View File

@ -1,5 +1,5 @@
/* /*
** $Id: inout.h,v 1.18 1997/06/16 16:50:22 roberto Exp roberto $ ** $Id: inout.h,v 1.19 1997/06/18 20:35:49 roberto Exp roberto $
*/ */
@ -14,10 +14,7 @@ extern Word lua_linenumber;
extern Word lua_debugline; extern Word lua_debugline;
extern char *lua_parsedfile; extern char *lua_parsedfile;
FILE *lua_openfile (char *fn); void luaI_setparsedfile (char *name);
void lua_closefile (void);
void lua_openstring (char *s);
void lua_closestring (void);
void luaI_predefine (void); void luaI_predefine (void);