diff options
| -rw-r--r-- | inout.c | 16 |
1 files changed, 11 insertions, 5 deletions
| @@ -5,9 +5,10 @@ | |||
| 5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | char *rcs_inout="$Id: inout.c,v 2.38 1996/07/12 20:00:26 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.39 1996/09/09 14:11:11 roberto Exp roberto $"; |
| 9 | 9 | ||
| 10 | #include <stdio.h> | 10 | #include <stdio.h> |
| 11 | #include <string.h> | ||
| 11 | 12 | ||
| 12 | #include "lex.h" | 13 | #include "lex.h" |
| 13 | #include "opcode.h" | 14 | #include "opcode.h" |
| @@ -79,12 +80,17 @@ void lua_closefile (void) | |||
| 79 | /* | 80 | /* |
| 80 | ** Function to open a string to be input unit | 81 | ** Function to open a string to be input unit |
| 81 | */ | 82 | */ |
| 83 | #define SIZE_PREF 20 /* size of string prefix to appear in error messages */ | ||
| 82 | void lua_openstring (char *s) | 84 | void lua_openstring (char *s) |
| 83 | { | 85 | { |
| 84 | lua_setinput (stringinput); | 86 | char buff[SIZE_PREF+25]; |
| 85 | st = s; | 87 | lua_setinput(stringinput); |
| 86 | lua_linenumber = 1; | 88 | st = s; |
| 87 | lua_parsedfile = luaI_createfixedstring("(string)")->str; | 89 | lua_linenumber = 1; |
| 90 | strcpy(buff, "(dostring) >> "); | ||
| 91 | strncat(buff, s, SIZE_PREF); | ||
| 92 | if (strlen(s) > SIZE_PREF) strcat(buff, "..."); | ||
| 93 | lua_parsedfile = luaI_createfixedstring(buff)->str; | ||
| 88 | } | 94 | } |
| 89 | 95 | ||
| 90 | /* | 96 | /* |
