yet more options moved from luaconf.h into internal files

This commit is contained in:
Roberto Ierusalimschy 2009-12-17 11:08:51 -02:00
parent adc6a4865b
commit b3b8dfaaea
3 changed files with 48 additions and 44 deletions

View File

@ -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

View File

@ -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
*/
@ -20,6 +20,23 @@
#include "lualib.h"
/*
** 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) {

View File

@ -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