diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-08-17 19:34:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-08-17 19:34:20 -0300 |
commit | 9294a2787f99174473afefcc0fcaf4f865959c63 (patch) | |
tree | ad9b455a929cb4cbbad61874c13447c4d1f5a2c9 /iolib.c | |
parent | 0ec3a214512987e998ce580247afb7cab1f111aa (diff) | |
download | lua-9294a2787f99174473afefcc0fcaf4f865959c63.tar.gz lua-9294a2787f99174473afefcc0fcaf4f865959c63.tar.bz2 lua-9294a2787f99174473afefcc0fcaf4f865959c63.zip |
nova funcao 'debug', para auxiliar debugacao de programas lua.
Diffstat (limited to 'iolib.c')
-rw-r--r-- | iolib.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Input/output library to LUA | 3 | ** Input/output library to LUA |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_iolib="$Id: iolib.c,v 1.6 1994/08/11 23:11:57 celes Exp celes $"; | 6 | char *rcs_iolib="$Id: iolib.c,v 1.7 1994/08/17 15:10:04 celes Exp roberto $"; |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -510,6 +510,21 @@ static void io_abort (void) | |||
510 | exit(1); | 510 | exit(1); |
511 | } | 511 | } |
512 | 512 | ||
513 | /* | ||
514 | ** To debug a lua program. Start a dialog with the user, interpreting | ||
515 | lua commands until an 'cont'. | ||
516 | */ | ||
517 | static void io_debug (void) | ||
518 | { | ||
519 | while (1) | ||
520 | { | ||
521 | char buffer[250]; | ||
522 | printf("lua_debug> "); | ||
523 | if (gets(buffer) == 0) return; | ||
524 | if (strcmp(buffer, "cont") == 0) return; | ||
525 | lua_dostring(buffer); | ||
526 | } | ||
527 | } | ||
513 | 528 | ||
514 | /* | 529 | /* |
515 | ** Open io library | 530 | ** Open io library |
@@ -525,4 +540,5 @@ void iolib_open (void) | |||
525 | lua_register ("remove", io_remove); | 540 | lua_register ("remove", io_remove); |
526 | lua_register ("getenv", io_getenv); | 541 | lua_register ("getenv", io_getenv); |
527 | lua_register ("abort", io_abort); | 542 | lua_register ("abort", io_abort); |
543 | lua_register ("debug", io_debug); | ||
528 | } | 544 | } |