aboutsummaryrefslogtreecommitdiff
path: root/luaconf.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-21 15:12:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-21 15:12:07 -0300
commit6d475731cae37e8e46abf217697198bcce316b42 (patch)
tree12ac3d08eac911d83a4b09761ac9f578fb279616 /luaconf.h
parentf41fc0eb0e7e92d04c9df206b8f185792804bf6a (diff)
downloadlua-6d475731cae37e8e46abf217697198bcce316b42.tar.gz
lua-6d475731cae37e8e46abf217697198bcce316b42.tar.bz2
lua-6d475731cae37e8e46abf217697198bcce316b42.zip
cleaner configuration for lua.c
Diffstat (limited to 'luaconf.h')
-rw-r--r--luaconf.h42
1 files changed, 31 insertions, 11 deletions
diff --git a/luaconf.h b/luaconf.h
index 7eaf50ed..fe26dc2b 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.36 2005/03/18 18:02:04 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.37 2005/03/18 18:55:45 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -133,28 +133,48 @@
133/* CONFIG: definition of isatty */ 133/* CONFIG: definition of isatty */
134#ifdef _POSIX_C_SOURCE 134#ifdef _POSIX_C_SOURCE
135#include <unistd.h> 135#include <unistd.h>
136#define stdin_is_tty() isatty(0) 136#define lua_stdin_is_tty() isatty(0)
137#elif defined(_WIN32) 137#elif defined(_WIN32)
138#include <io.h> 138#include <io.h>
139#include <stdio.h> 139#include <stdio.h>
140#define stdin_is_tty() _isatty(_fileno(stdin)) 140#define lua_stdin_is_tty() _isatty(_fileno(stdin))
141#else 141#else
142#define stdin_is_tty() 1 /* assume stdin is a tty */ 142#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
143#endif 143#endif
144 144
145 145
146#define PROMPT "> " 146#define LUA_PROMPT "> "
147#define PROMPT2 ">> " 147#define LUA_PROMPT2 ">> "
148#define PROGNAME "lua" 148#define LUA_PROGNAME "lua"
149
150 149
150/*
151*@ LUA_MAXINPUT is the maximum length for an input line
152** CHANGE it if you need longer lines.
153*/
154#define LUA_MAXINPUT 512
151 155
152 156
153/* 157/*
154** CONFIG: this macro can be used by some history system to save lines 158*@ lua_readline defines how to show a prompt and then read a line from
155** read in manual input 159** the standard input.
160*@ lua_saveline defines how to "save" a read line.
161** CHANGE them if you want to improve this functionality (e.g., using GNU
162** readline and history facilities). (Lua already tries to use those
163** facilities when it detects a GNU compiler.)
156*/ 164*/
157#define lua_saveline(L,line) /* empty */ 165#ifdef __GNUC__
166#include <readline/readline.h>
167#include <readline/history.h>
168#define lua_readline(L,b,p) (((b)=readline(p)) != NULL)
169#define lua_saveline(L,idx) \
170 if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
171 add_history(lua_tostring(L, idx)); /* add it to history */
172#else
173#define lua_readline(L,b,p) \
174 (fputs(p, stdout), fflush(stdout), /* show prompt */ \
175 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
176#define lua_saveline(L,idx) ((void)0)
177#endif
158 178
159 179
160 180