|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: lua.c,v 1.203 2011/12/12 16:34:03 roberto Exp roberto $
|
|
|
+** $Id: lua.c,v 1.204 2012/04/20 17:05:17 roberto Exp roberto $
|
|
|
** Lua stand-alone interpreter
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -45,13 +45,13 @@
|
|
|
*/
|
|
|
#if defined(LUA_USE_ISATTY)
|
|
|
#include <unistd.h>
|
|
|
-#define lua_stdin_is_tty() isatty(0)
|
|
|
+#define lua_stdin_is_tty() isatty(0)
|
|
|
#elif defined(LUA_WIN)
|
|
|
#include <io.h>
|
|
|
#include <stdio.h>
|
|
|
-#define lua_stdin_is_tty() _isatty(_fileno(stdin))
|
|
|
+#define lua_stdin_is_tty() _isatty(_fileno(stdin))
|
|
|
#else
|
|
|
-#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
|
|
|
+#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
|
|
|
#endif
|
|
|
|
|
|
|
|
@@ -66,19 +66,19 @@
|
|
|
#include <stdio.h>
|
|
|
#include <readline/readline.h>
|
|
|
#include <readline/history.h>
|
|
|
-#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
|
|
|
+#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
|
|
|
#define lua_saveline(L,idx) \
|
|
|
if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \
|
|
|
add_history(lua_tostring(L, idx)); /* add it to history */
|
|
|
-#define lua_freeline(L,b) ((void)L, free(b))
|
|
|
+#define lua_freeline(L,b) ((void)L, free(b))
|
|
|
|
|
|
#elif !defined(lua_readline)
|
|
|
|
|
|
-#define lua_readline(L,b,p) \
|
|
|
+#define lua_readline(L,b,p) \
|
|
|
((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
|
|
|
fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
|
|
|
-#define lua_saveline(L,idx) { (void)L; (void)idx; }
|
|
|
-#define lua_freeline(L,b) { (void)L; (void)b; }
|
|
|
+#define lua_saveline(L,idx) { (void)L; (void)idx; }
|
|
|
+#define lua_freeline(L,b) { (void)L; (void)b; }
|
|
|
|
|
|
#endif
|
|
|
|