different organization for platform dependencies

This commit is contained in:
Roberto Ierusalimschy 2005-10-13 09:22:53 -03:00
parent 4385e2ada4
commit a24eb3ef17

View File

@ -1,5 +1,5 @@
/*
** $Id: luaconf.h,v 1.67 2005/09/14 17:44:48 roberto Exp roberto $
** $Id: luaconf.h,v 1.68 2005/09/19 13:49:12 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@ -19,8 +19,6 @@
*/
/*
@@ LUA_ANSI controls the use of non-ansi features.
** CHANGE it (define it) if you want Lua to avoid the use of any
@ -31,6 +29,33 @@
#endif
#if !defined(LUA_ANSI)
#if defined(__linux__)
#define LUA_USE_MKSTEMP
#define LUA_USE_ISATTY
#define LUA_USE_ULONGJMP
#define LUA_USE_POPEN
#endif
#if defined(__APPLE__) && defined(__MACH__)
#define LUA_USE_MKSTEMP
#define LUA_USE_ISATTY
#define LUA_USE_ULONGJMP
#define LUA_USE_POPEN
#define LUA_DL_DYLD
#endif
#if defined(_WIN32)
#define LUA_DL_DLL
#endif
#endif
/*
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
@* Lua libraries.
@ -141,10 +166,12 @@
#if defined(luaall_c)
#define LUAI_FUNC static
#define LUAI_DATA /* empty */
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__)
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
#define LUAI_DATA LUAI_FUNC
#else
#define LUAI_FUNC extern
#define LUAI_DATA extern
@ -189,7 +216,7 @@
** CHANGE it if you have a better definition for non-POSIX/non-Windows
** systems.
*/
#if !defined(LUA_ANSI) && defined(_POSIX_C_SOURCE)
#if defined(LUA_USE_ISATTY)
#include <unistd.h>
#define lua_stdin_is_tty() isatty(0)
#elif !defined(LUA_ANSI) && defined(_WIN32)
@ -517,6 +544,8 @@ union luai_Cast { double l_d; long l_l; };
/*
@@ The luai_num* macros define the primitive operations over numbers.
*/
#if defined(LUA_CORE)
#include <math.h>
#define luai_numadd(L,a,b) ((a)+(b))
#define luai_numsub(L,a,b) ((a)-(b))
#define luai_nummul(L,a,b) ((a)*(b))
@ -527,6 +556,7 @@ union luai_Cast { double l_d; long l_l; };
#define luai_numeq(L,a,b) ((a)==(b))
#define luai_numlt(L,a,b) ((a)<(b))
#define luai_numle(L,a,b) ((a)<=(b))
#endif
/* }================================================================== */
@ -589,7 +619,7 @@ union luai_Cast { double l_d; long l_l; };
*/
#if defined(loslib_c) || defined(luaall_c)
#if !defined(LUA_ANSI) && defined(_POSIX_C_SOURCE)
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
#define LUA_TMPNAMBUFSIZE 32
#define lua_tmpnam(b,e) { \
@ -597,6 +627,7 @@ union luai_Cast { double l_d; long l_l; };
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
#else
#define LUA_TMPNAMBUFSIZE L_tmpnam
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
@ -610,7 +641,7 @@ union luai_Cast { double l_d; long l_l; };
@* the file streams.
** CHANGE it if you have a way to implement it in your system.
*/
#if !defined(LUA_ANSI) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
#if defined(LUA_USE_POPEN)
#define lua_popen(L,c,m) popen(c,m)
#define lua_pclose(L,file) (pclose(file) != -1)
@ -639,17 +670,12 @@ union luai_Cast { double l_d; long l_l; };
** automatically. (When you change the makefile to add -ldl, you must
** also add -DLUA_USE_DLOPEN.)
** If you do not want any kind of dynamic library, undefine all these
** options (or just remove these definitions).
** options.
** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
*/
#if !defined(LUA_ANSI)
#if defined(_WIN32)
#define LUA_DL_DLL
#elif defined(__APPLE__) && defined(__MACH__)
#define LUA_DL_DYLD
#elif defined(LUA_USE_DLOPEN)
#if defined(LUA_USE_DLOPEN)
#define LUA_DL_DLOPEN
#endif
#endif
/*
@ -667,6 +693,7 @@ union luai_Cast { double l_d; long l_l; };
** extra when a thread is created/deleted/resumed/yielded.
*/
#define luai_userstateopen(L) ((void)0)
#define luai_userstateclose(L) ((void)0)
#define luai_userstatethread(L,L1) ((void)0)
#define luai_userstatefree(L) ((void)0)
#define luai_userstateresume(L,n) ((void)0)