diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 11:58:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 11:58:26 -0300 |
commit | 3c9d999424520c809e05bee11d81788b488434f6 (patch) | |
tree | 7556d9ea10bda42b226aec4dd956753467cc0864 /liolib.c | |
parent | f7840a3e0bc07813246b2bad6bf4579848187908 (diff) | |
download | lua-3c9d999424520c809e05bee11d81788b488434f6.tar.gz lua-3c9d999424520c809e05bee11d81788b488434f6.tar.bz2 lua-3c9d999424520c809e05bee11d81788b488434f6.zip |
many details (most by lhf).
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.56 2000/01/19 12:00:45 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.57 2000/02/08 16:34:31 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 | */ |
@@ -97,7 +97,7 @@ static FILE *gethandle (lua_State *L, lua_Object f) { | |||
97 | static FILE *getfilebyname (lua_State *L, const char *name) { | 97 | static FILE *getfilebyname (lua_State *L, const char *name) { |
98 | FILE *handle = gethandle(L, lua_rawgetglobal(L, name)); | 98 | FILE *handle = gethandle(L, lua_rawgetglobal(L, name)); |
99 | if (!handle) | 99 | if (!handle) |
100 | luaL_verror(L, "global variable `%.50s' is not a file handle", name); | 100 | luaL_verror(L, "`%.50s' is not a file handle", name); |
101 | return handle; | 101 | return handle; |
102 | } | 102 | } |
103 | 103 | ||
@@ -286,7 +286,7 @@ static int read_pattern (lua_State *L, FILE *f, const char *p) { | |||
286 | 286 | ||
287 | #else | 287 | #else |
288 | 288 | ||
289 | #define read_pattern(L, f,p) (lua_error(L, "read patterns are deprecated"), 0) | 289 | #define read_pattern(L, f, p) (lua_error(L, "read patterns are deprecated"), 0) |
290 | 290 | ||
291 | #endif | 291 | #endif |
292 | 292 | ||
@@ -525,9 +525,6 @@ static void io_debug (lua_State *L) { | |||
525 | #define MAXMESSAGE (MESSAGESIZE*10) | 525 | #define MAXMESSAGE (MESSAGESIZE*10) |
526 | 526 | ||
527 | 527 | ||
528 | #define MAXSRC 60 | ||
529 | |||
530 | |||
531 | static void errorfb (lua_State *L) { | 528 | static void errorfb (lua_State *L) { |
532 | char buff[MAXMESSAGE]; | 529 | char buff[MAXMESSAGE]; |
533 | int level = 1; /* skip level 0 (it's this function) */ | 530 | int level = 1; /* skip level 0 (it's this function) */ |
@@ -535,10 +532,10 @@ static void errorfb (lua_State *L) { | |||
535 | lua_Object alertfunc = lua_rawgetglobal(L, "_ALERT"); | 532 | lua_Object alertfunc = lua_rawgetglobal(L, "_ALERT"); |
536 | sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1))); | 533 | sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1))); |
537 | while (lua_getstack(L, level++, &ar)) { | 534 | while (lua_getstack(L, level++, &ar)) { |
538 | char buffchunk[MAXSRC]; | 535 | char buffchunk[60]; |
539 | lua_getinfo(L, "Snl", &ar); | 536 | lua_getinfo(L, "Snl", &ar); |
540 | luaL_chunkid(buffchunk, ar.source, sizeof(buffchunk)); | 537 | luaL_chunkid(buffchunk, ar.source, sizeof(buffchunk)); |
541 | if (level == 2) strcat(buff, "Active Stack:\n"); | 538 | if (level == 2) strcat(buff, "Stack traceback:\n"); |
542 | strcat(buff, " "); | 539 | strcat(buff, " "); |
543 | if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) { | 540 | if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) { |
544 | strcat(buff, "...\n"); | 541 | strcat(buff, "...\n"); |