1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00

some changes in compatibility macros: added LUA_COMPAT_ALL + compatibility

macros from lua.h and lauxlib.h moved to luaconf.h
This commit is contained in:
Roberto Ierusalimschy 2010-01-06 13:15:04 -02:00
parent f3a6815000
commit 16d2ad88fe

View File

@ -1,5 +1,5 @@
/*
** $Id: luaconf.h,v 1.125 2009/12/22 16:47:00 roberto Exp roberto $
** $Id: luaconf.h,v 1.126 2009/12/28 16:30:31 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@ -35,6 +35,7 @@
#if defined(LUA_WIN)
#include <windows.h>
#define LUA_DL_DLL
#endif
@ -47,7 +48,8 @@
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_DL_DYLD /* does not need extra library */
#define LUA_USE_DLOPEN
#define LUA_USE_READLINE /* needs some extra libraries */
#endif
@ -206,55 +208,68 @@
*/
/*
@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
** CHANGE it (define it) if you have not replaced its uses with
** 'table.unpack'.
@@ LUA_COMPAT_ALL controls all compatibility options.
** You can define it to get all options, or change specific options
** to fit your specific needs.
*/
/* #define LUA_COMPAT_UNPACK */
#if defined(LUA_COMPAT_ALL)
/*
@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
** You can replace it with 'table.unpack'.
*/
#define LUA_COMPAT_UNPACK
/*
@@ LUA_COMPAT_CPCALL controls the presence of function 'lua_cpcall'.
** CHANGE it (define it) if you need this function. (You can replace
** it with the preregistered function cpcall.)
** You can replace it with the preregistered function 'cpcall'.
*/
/* #define LUA_COMPAT_CPCALL */
/* LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); */
#define LUA_COMPAT_CPCALL
LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
/*
@@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'.
** CHANGE it (define it) if you need these functions. (You can replace
** them with lexical environments, 'loadin', or the debug library.)
** You can replace them with lexical environments, 'loadin', or the
** debug library.
*/
/* #define LUA_COMPAT_FENV */
#define LUA_COMPAT_FENV
/*
@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
** CHANGE it (undefine it) if as soon as you rewrite all calls 'log10(x)'
** as 'log(x, 10)'
** You can rewrite 'log10(x)' as 'log(x, 10)'.
*/
#define LUA_COMPAT_LOG10
/*
@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
** CHANGE it (define it) if you need that function.
*/
/* #define LUA_COMPAT_MAXN */
/*
@@ LUA_COMPAT_API includes some macros and functions that supply some
@* compatibility with previous versions.
** CHANGE it (undefine it) if you do not need these compatibility facilities.
*/
#define LUA_COMPAT_API
#define LUA_COMPAT_MAXN
/*
@@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading
@* the debug library.
** CHANGE it to undefined as soon as you add 'require"debug"' everywhere
** you need the debug library.
** the debug library.
** You should add 'require"debug"' everywhere you need the debug
** library.
*/
#define LUA_COMPAT_DEBUGLIB
/*
@@ The following macros supply trivial compatibility for some
** changes in the API. The macros themselves document how to
** change your code to avoid using them.
*/
#define lua_strlen(L,i) lua_rawlen(L, (i))
#define lua_objlen(L,i) lua_rawlen(L, (i))
#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
/* compatibility with previous wrong spelling */
#define luaL_typerror luaL_typeerror
#endif
/* }================================================================== */
@ -476,28 +491,6 @@ union luai_Cast { double l_d; long l_l; };
/* }================================================================== */
/*
@@ LUA_DL_* define which dynamic-library system Lua should use.
** CHANGE here if Lua has problems choosing the appropriate
** dynamic-library system for your platform (either Windows' DLL, Mac's
** dyld, or Unix's dlopen). If your system is some kind of Unix, there
** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
** it. To use dlopen you also need to adapt the src/Makefile (probably
** adding -ldl to the linker options), so Lua does not select it
** 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.
** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
*/
#if defined(LUA_USE_DLOPEN)
#define LUA_DL_DLOPEN
#endif
#if defined(LUA_WIN)
#define LUA_DL_DLL
#endif