aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-01-06 13:15:04 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-01-06 13:15:04 -0200
commit16d2ad88fe9a89fad4645f85e28d66e999b542b9 (patch)
treef61fffd9149993cededab32f69980f838d543de8
parentf3a68150001458ca6313d1c7fc0bf3a99af786ab (diff)
downloadlua-16d2ad88fe9a89fad4645f85e28d66e999b542b9.tar.gz
lua-16d2ad88fe9a89fad4645f85e28d66e999b542b9.tar.bz2
lua-16d2ad88fe9a89fad4645f85e28d66e999b542b9.zip
some changes in compatibility macros: added LUA_COMPAT_ALL + compatibility
macros from lua.h and lauxlib.h moved to luaconf.h
-rw-r--r--luaconf.h93
1 files changed, 43 insertions, 50 deletions
diff --git a/luaconf.h b/luaconf.h
index 4a9703ab..91204a3a 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.125 2009/12/22 16:47:00 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.126 2009/12/28 16:30:31 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*/
@@ -35,6 +35,7 @@
35 35
36#if defined(LUA_WIN) 36#if defined(LUA_WIN)
37#include <windows.h> 37#include <windows.h>
38#define LUA_DL_DLL
38#endif 39#endif
39 40
40 41
@@ -47,7 +48,8 @@
47 48
48#if defined(LUA_USE_MACOSX) 49#if defined(LUA_USE_MACOSX)
49#define LUA_USE_POSIX 50#define LUA_USE_POSIX
50#define LUA_DL_DYLD /* does not need extra library */ 51#define LUA_USE_DLOPEN
52#define LUA_USE_READLINE /* needs some extra libraries */
51#endif 53#endif
52 54
53 55
@@ -206,54 +208,67 @@
206*/ 208*/
207 209
208/* 210/*
211@@ LUA_COMPAT_ALL controls all compatibility options.
212** You can define it to get all options, or change specific options
213** to fit your specific needs.
214*/
215#if defined(LUA_COMPAT_ALL)
216
217/*
209@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. 218@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
210** CHANGE it (define it) if you have not replaced its uses with 219** You can replace it with 'table.unpack'.
211** 'table.unpack'.
212*/ 220*/
213/* #define LUA_COMPAT_UNPACK */ 221#define LUA_COMPAT_UNPACK
214 222
215/* 223/*
216@@ LUA_COMPAT_CPCALL controls the presence of function 'lua_cpcall'. 224@@ LUA_COMPAT_CPCALL controls the presence of function 'lua_cpcall'.
217** CHANGE it (define it) if you need this function. (You can replace 225** You can replace it with the preregistered function 'cpcall'.
218** it with the preregistered function cpcall.)
219*/ 226*/
220/* #define LUA_COMPAT_CPCALL */ 227#define LUA_COMPAT_CPCALL
221/* LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); */ 228LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
222 229
223/* 230/*
224@@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'. 231@@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'.
225** CHANGE it (define it) if you need these functions. (You can replace 232** You can replace them with lexical environments, 'loadin', or the
226** them with lexical environments, 'loadin', or the debug library.) 233** debug library.
227*/ 234*/
228/* #define LUA_COMPAT_FENV */ 235#define LUA_COMPAT_FENV
229 236
230/* 237/*
231@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. 238@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
232** CHANGE it (undefine it) if as soon as you rewrite all calls 'log10(x)' 239** You can rewrite 'log10(x)' as 'log(x, 10)'.
233** as 'log(x, 10)'
234*/ 240*/
235#define LUA_COMPAT_LOG10 241#define LUA_COMPAT_LOG10
236 242
237/* 243/*
238@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. 244@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
239** CHANGE it (define it) if you need that function.
240*/ 245*/
241/* #define LUA_COMPAT_MAXN */ 246#define LUA_COMPAT_MAXN
242 247
243/* 248/*
244@@ LUA_COMPAT_API includes some macros and functions that supply some 249@@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading
245@* compatibility with previous versions. 250** the debug library.
246** CHANGE it (undefine it) if you do not need these compatibility facilities. 251** You should add 'require"debug"' everywhere you need the debug
252** library.
247*/ 253*/
248#define LUA_COMPAT_API 254#define LUA_COMPAT_DEBUGLIB
249 255
250/* 256/*
251@@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading 257@@ The following macros supply trivial compatibility for some
252@* the debug library. 258** changes in the API. The macros themselves document how to
253** CHANGE it to undefined as soon as you add 'require"debug"' everywhere 259** change your code to avoid using them.
254** you need the debug library.
255*/ 260*/
256#define LUA_COMPAT_DEBUGLIB 261#define lua_strlen(L,i) lua_rawlen(L, (i))
262
263#define lua_objlen(L,i) lua_rawlen(L, (i))
264
265#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
266#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
267
268/* compatibility with previous wrong spelling */
269#define luaL_typerror luaL_typeerror
270
271#endif
257 272
258/* }================================================================== */ 273/* }================================================================== */
259 274
@@ -282,7 +297,7 @@
282@@ LUAI_MEM is a signed integer big enough to count the total memory 297@@ LUAI_MEM is a signed integer big enough to count the total memory
283@* used by Lua. 298@* used by Lua.
284** CHANGE here if for some weird reason the default definitions are not 299** CHANGE here if for some weird reason the default definitions are not
285** good enough for your machine. Probably you do not need to change 300** good enough for your machine. Probably you do not need to change
286** this. 301** this.
287*/ 302*/
288#if LUAI_BITSINT >= 32 303#if LUAI_BITSINT >= 32
@@ -310,7 +325,7 @@
310#endif 325#endif
311 326
312/* reserve some space for error handling */ 327/* reserve some space for error handling */
313#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) 328#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
314 329
315 330
316 331
@@ -420,7 +435,7 @@
420 435
421/* On a Pentium, resort to a trick */ 436/* On a Pentium, resort to a trick */
422#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ 437#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
423 (defined(__i386) || defined (_M_IX86) || defined(__i386__)) 438 (defined(__i386) || defined (_M_IX86) || defined(__i386__))
424 439
425/* On a Microsoft compiler, use assembler */ 440/* On a Microsoft compiler, use assembler */
426#if defined(_MSC_VER) 441#if defined(_MSC_VER)
@@ -476,28 +491,6 @@ union luai_Cast { double l_d; long l_l; };
476 491
477/* }================================================================== */ 492/* }================================================================== */
478 493
479/*
480@@ LUA_DL_* define which dynamic-library system Lua should use.
481** CHANGE here if Lua has problems choosing the appropriate
482** dynamic-library system for your platform (either Windows' DLL, Mac's
483** dyld, or Unix's dlopen). If your system is some kind of Unix, there
484** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
485** it. To use dlopen you also need to adapt the src/Makefile (probably
486** adding -ldl to the linker options), so Lua does not select it
487** automatically. (When you change the makefile to add -ldl, you must
488** also add -DLUA_USE_DLOPEN.)
489** If you do not want any kind of dynamic library, undefine all these
490** options.
491** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
492*/
493#if defined(LUA_USE_DLOPEN)
494#define LUA_DL_DLOPEN
495#endif
496
497#if defined(LUA_WIN)
498#define LUA_DL_DLL
499#endif
500
501 494
502 495
503 496