diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
commit | 8060193702b21a06af3541555db4cd317c733ce9 (patch) | |
tree | d1cfa3a4ac41dc6766188680659c1bd1311e22a8 /liolib.c | |
parent | 2779e81fbbdebf8b7cac97c167ff109bad537c4b (diff) | |
download | lua-8060193702b21a06af3541555db4cd317c733ce9.tar.gz lua-8060193702b21a06af3541555db4cd317c733ce9.tar.bz2 lua-8060193702b21a06af3541555db4cd317c733ce9.zip |
`lauxlib' is now part of the libraries (not used by core Lua)
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.77 2000/09/05 19:33:32 roberto Exp $ | 2 | ** $Id: liolib.c,v 1.78 2000/09/11 17:38:42 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -393,8 +393,8 @@ static int io_read (lua_State *L) { | |||
393 | firstarg = lastarg = 1; /* correct indices */ | 393 | firstarg = lastarg = 1; /* correct indices */ |
394 | lua_pushstring(L, "*l"); /* push default argument */ | 394 | lua_pushstring(L, "*l"); /* push default argument */ |
395 | } | 395 | } |
396 | else | 396 | else /* ensure stack space for all results and for auxlib's buffer */ |
397 | luaL_checkstack(L, lastarg-firstarg+1, "too many arguments"); | 397 | luaL_checkstack(L, lastarg-firstarg+1+LUA_MINSTACK, "too many arguments"); |
398 | for (n = firstarg; n<=lastarg; n++) { | 398 | for (n = firstarg; n<=lastarg; n++) { |
399 | int success; | 399 | int success; |
400 | if (lua_isnumber(L, n)) | 400 | if (lua_isnumber(L, n)) |
@@ -598,7 +598,6 @@ static int errorfb (lua_State *L) { | |||
598 | lua_concat(L, 3); | 598 | lua_concat(L, 3); |
599 | while (lua_getstack(L, level++, &ar)) { | 599 | while (lua_getstack(L, level++, &ar)) { |
600 | char buff[120]; /* enough to fit following `sprintf's */ | 600 | char buff[120]; /* enough to fit following `sprintf's */ |
601 | char buffchunk[60]; | ||
602 | int toconcat = 1; /* number of strings in the stack to concat */ | 601 | int toconcat = 1; /* number of strings in the stack to concat */ |
603 | if (level > LEVELS1 && firstpart) { | 602 | if (level > LEVELS1 && firstpart) { |
604 | /* no more than `LEVELS2' more levels? */ | 603 | /* no more than `LEVELS2' more levels? */ |
@@ -607,7 +606,7 @@ static int errorfb (lua_State *L) { | |||
607 | else { | 606 | else { |
608 | lua_pushstring(L, " ...\n"); /* too many levels */ | 607 | lua_pushstring(L, " ...\n"); /* too many levels */ |
609 | lua_concat(L, 2); | 608 | lua_concat(L, 2); |
610 | while (lua_getstack(L, level+LEVELS2, &ar)) /* get last levels */ | 609 | while (lua_getstack(L, level+LEVELS2, &ar)) /* find last levels */ |
611 | level++; | 610 | level++; |
612 | } | 611 | } |
613 | firstpart = 0; | 612 | firstpart = 0; |
@@ -616,7 +615,6 @@ static int errorfb (lua_State *L) { | |||
616 | sprintf(buff, "%4d: ", level-1); | 615 | sprintf(buff, "%4d: ", level-1); |
617 | lua_pushstring(L, buff); toconcat++; | 616 | lua_pushstring(L, buff); toconcat++; |
618 | lua_getinfo(L, "Snl", &ar); | 617 | lua_getinfo(L, "Snl", &ar); |
619 | luaL_chunkid(buffchunk, ar.source, sizeof(buffchunk)); | ||
620 | switch (*ar.namewhat) { | 618 | switch (*ar.namewhat) { |
621 | case 'g': case 'l': /* global, local */ | 619 | case 'g': case 'l': /* global, local */ |
622 | sprintf(buff, "function `%.50s'", ar.name); | 620 | sprintf(buff, "function `%.50s'", ar.name); |
@@ -629,11 +627,11 @@ static int errorfb (lua_State *L) { | |||
629 | break; | 627 | break; |
630 | default: { | 628 | default: { |
631 | if (*ar.what == 'm') /* main? */ | 629 | if (*ar.what == 'm') /* main? */ |
632 | sprintf(buff, "main of %.70s", buffchunk); | 630 | sprintf(buff, "main of %.70s", ar.source_id); |
633 | else if (*ar.what == 'C') /* C function? */ | 631 | else if (*ar.what == 'C') /* C function? */ |
634 | sprintf(buff, "%.70s", buffchunk); | 632 | sprintf(buff, "%.70s", ar.source_id); |
635 | else | 633 | else |
636 | sprintf(buff, "function <%d:%.70s>", ar.linedefined, buffchunk); | 634 | sprintf(buff, "function <%d:%.70s>", ar.linedefined, ar.source_id); |
637 | ar.source = NULL; | 635 | ar.source = NULL; |
638 | } | 636 | } |
639 | } | 637 | } |
@@ -643,7 +641,7 @@ static int errorfb (lua_State *L) { | |||
643 | lua_pushstring(L, buff); toconcat++; | 641 | lua_pushstring(L, buff); toconcat++; |
644 | } | 642 | } |
645 | if (ar.source) { | 643 | if (ar.source) { |
646 | sprintf(buff, " [%.70s]", buffchunk); | 644 | sprintf(buff, " [%.70s]", ar.source_id); |
647 | lua_pushstring(L, buff); toconcat++; | 645 | lua_pushstring(L, buff); toconcat++; |
648 | } | 646 | } |
649 | lua_pushstring(L, "\n"); toconcat++; | 647 | lua_pushstring(L, "\n"); toconcat++; |