aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-22 18:57:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-22 18:57:18 -0200
commit03f3f9e707ceaf46efb4917f8d32ea62283b9358 (patch)
treecdf8e8d255fc95e09b94521dff35cd4f0f57d1e6 /ldo.c
parenta78eecee48c725549316629b9a8d936c990b65de (diff)
downloadlua-03f3f9e707ceaf46efb4917f8d32ea62283b9358.tar.gz
lua-03f3f9e707ceaf46efb4917f8d32ea62283b9358.tar.bz2
lua-03f3f9e707ceaf46efb4917f8d32ea62283b9358.zip
"zio" now keeps its "name".
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ldo.c b/ldo.c
index 8ab4854f..88261e50 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.16 1997/12/17 20:57:20 roberto Exp roberto $ 2** $Id: ldo.c,v 1.17 1997/12/18 18:32:39 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -296,7 +296,7 @@ int luaD_protectedrun (int nResults)
296/* 296/*
297** returns 0 = chunk loaded; 1 = error; 2 = no more chunks to load 297** returns 0 = chunk loaded; 1 = error; 2 = no more chunks to load
298*/ 298*/
299static int protectedparser (ZIO *z, char *chunkname, int bin) 299static int protectedparser (ZIO *z, int bin)
300{ 300{
301 int status; 301 int status;
302 TProtoFunc *tf; 302 TProtoFunc *tf;
@@ -304,7 +304,7 @@ static int protectedparser (ZIO *z, char *chunkname, int bin)
304 jmp_buf *oldErr = L->errorJmp; 304 jmp_buf *oldErr = L->errorJmp;
305 L->errorJmp = &myErrorJmp; 305 L->errorJmp = &myErrorJmp;
306 if (setjmp(myErrorJmp) == 0) { 306 if (setjmp(myErrorJmp) == 0) {
307 tf = bin ? luaU_undump1(z, chunkname) : luaY_parser(z, chunkname); 307 tf = bin ? luaU_undump1(z) : luaY_parser(z);
308 status = 0; 308 status = 0;
309 } 309 }
310 else { 310 else {
@@ -322,12 +322,12 @@ static int protectedparser (ZIO *z, char *chunkname, int bin)
322} 322}
323 323
324 324
325static int do_main (ZIO *z, char *chunkname, int bin) 325static int do_main (ZIO *z, int bin)
326{ 326{
327 int status; 327 int status;
328 do { 328 do {
329 long old_blocks = (luaC_checkGC(), L->nblocks); 329 long old_blocks = (luaC_checkGC(), L->nblocks);
330 status = protectedparser(z, chunkname, bin); 330 status = protectedparser(z, bin);
331 if (status == 1) return 1; /* error */ 331 if (status == 1) return 1; /* error */
332 else if (status == 2) return 0; /* 'natural' end */ 332 else if (status == 2) return 0; /* 'natural' end */
333 else { 333 else {
@@ -368,8 +368,8 @@ int lua_dofile (char *filename)
368 bin = (c == ID_CHUNK); 368 bin = (c == ID_CHUNK);
369 if (bin) 369 if (bin)
370 f = freopen(filename, "rb", f); /* set binary mode */ 370 f = freopen(filename, "rb", f); /* set binary mode */
371 luaZ_Fopen(&z, f); 371 luaZ_Fopen(&z, f, filename);
372 status = do_main(&z, filename, bin); 372 status = do_main(&z, bin);
373 if (f != stdin) 373 if (f != stdin)
374 fclose(f); 374 fclose(f);
375 return status; 375 return status;
@@ -383,15 +383,15 @@ int lua_dofile (char *filename)
383int lua_dostring (char *str) 383int lua_dostring (char *str)
384{ 384{
385 int status; 385 int status;
386 char buff[SIZE_PREF+25]; 386 char name[SIZE_PREF+25];
387 char *temp; 387 char *temp;
388 ZIO z; 388 ZIO z;
389 if (str == NULL) return 1; 389 if (str == NULL) return 1;
390 sprintf(buff, "(dostring) >> %." SSIZE_PREF "s", str); 390 sprintf(name, "(dostring) >> %." SSIZE_PREF "s", str);
391 temp = strchr(buff, '\n'); 391 temp = strchr(name, '\n');
392 if (temp) *temp = 0; /* end string after first line */ 392 if (temp) *temp = 0; /* end string after first line */
393 luaZ_sopen(&z, str); 393 luaZ_sopen(&z, str, name);
394 status = do_main(&z, buff, 0); 394 status = do_main(&z, 0);
395 return status; 395 return status;
396} 396}
397 397
@@ -401,8 +401,8 @@ int lua_dobuffer (char *buff, int size)
401{ 401{
402 int status; 402 int status;
403 ZIO z; 403 ZIO z;
404 luaZ_mopen(&z, buff, size); 404 luaZ_mopen(&z, buff, size, "(buffer)");
405 status = do_main(&z, "(buffer)", 1); 405 status = do_main(&z, 1);
406 return status; 406 return status;
407} 407}
408#endif 408#endif