commit b3b8dfaaea2dba7e7b4b898a5f767a80f36319f1
parent adc6a4865bfd12339ad7c31b43ba26206d385517
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 17 Dec 2009 11:08:27 -0200
yet more options moved from luaconf.h into internal files
Diffstat:
M | liolib.c | | | 29 | ++++++++++++++++++++++++++++- |
M | loslib.c | | | 21 | +++++++++++++++++++-- |
M | luaconf.h | | | 42 | +----------------------------------------- |
3 files changed, 48 insertions(+), 44 deletions(-)
diff --git a/liolib.c b/liolib.c
@@ -1,5 +1,5 @@
/*
-** $Id: liolib.c,v 2.82 2009/09/01 19:10:48 roberto Exp roberto $
+** $Id: liolib.c,v 2.83 2009/11/24 12:05:44 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@@ -19,6 +19,33 @@
#include "lualib.h"
+/*
+** lua_popen spawns a new process connected to the current one through
+** the file streams.
+*/
+#if !defined(lua_popen)
+
+#if defined(LUA_USE_POPEN)
+
+#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
+#define lua_pclose(L,file) ((void)L, pclose(file))
+
+#elif defined(LUA_WIN)
+
+#define lua_popen(L,c,m) ((void)L, _popen(c,m))
+#define lua_pclose(L,file) ((void)L, _pclose(file))
+
+#else
+
+#define lua_popen(L,c,m) ((void)((void)c, m), \
+ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
+#define lua_pclose(L,file) ((void)((void)L, file), -1)
+
+#endif
+
+#endif
+
+
#define IO_INPUT 1
#define IO_OUTPUT 2
diff --git a/loslib.c b/loslib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loslib.c,v 1.27 2009/11/24 12:05:44 roberto Exp roberto $
+** $Id: loslib.c,v 1.28 2009/12/17 12:26:09 roberto Exp roberto $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@@ -21,6 +21,23 @@
/*
+** list of valid conversion specifiers @* for the 'strftime' function
+*/
+#if !defined(LUA_STRFTIMEOPTIONS)
+
+#if !defined(LUA_USE_POSIX)
+#define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" }
+#else
+#define LUA_STRFTIMEOPTIONS { "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \
+ "E", "cCxXyY", \
+ "O", "deHImMSuUVwWy" }
+#endif
+
+#endif
+
+
+
+/*
** By default, Lua uses tmpnam except when POSIX is available, where it
** uses mkstemp.
*/
@@ -144,7 +161,7 @@ static int getfield (lua_State *L, const char *key, int d) {
static const char *checkoption (lua_State *L, const char *conv, char *buff) {
- static const char *const options[] = { LUA_STRFTIMEOPTIONS };
+ static const char *const options[] = LUA_STRFTIMEOPTIONS;
unsigned int i;
for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) {
if (*conv != '\0' && strchr(options[i], *conv) != NULL) {
diff --git a/luaconf.h b/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id: luaconf.h,v 1.122 2009/12/17 12:26:09 roberto Exp roberto $
+** $Id: luaconf.h,v 1.123 2009/12/17 12:50:20 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -461,46 +461,6 @@ union luai_Cast { double l_d; long l_l; };
/* }================================================================== */
-
-/*
-@@ LUA_STRFTIMEOPTIONS is the list of valid conversion specifiers
-@* for the 'strftime' function;
-** CHANGE it if you want to use non-ansi options specific to your system.
-*/
-#if !defined(LUA_USE_POSIX)
-#define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYz%", ""
-
-#else
-#define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \
- "E", "cCxXyY", \
- "O", "deHImMSuUVwWy"
-#endif
-
-
-
-/*
-@@ lua_popen spawns a new process connected to the current one through
-@* the file streams.
-** CHANGE it if you have a way to implement it in your system.
-*/
-#if defined(LUA_USE_POPEN)
-
-#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
-#define lua_pclose(L,file) ((void)L, pclose(file))
-
-#elif defined(LUA_WIN)
-
-#define lua_popen(L,c,m) ((void)L, _popen(c,m))
-#define lua_pclose(L,file) ((void)L, _pclose(file))
-
-#else
-
-#define lua_popen(L,c,m) ((void)((void)c, m), \
- luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
-#define lua_pclose(L,file) ((void)((void)L, file), -1)
-
-#endif
-
/*
@@ LUA_DL_* define which dynamic-library system Lua should use.
** CHANGE here if Lua has problems choosing the appropriate