aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaconf.h86
1 files changed, 33 insertions, 53 deletions
diff --git a/luaconf.h b/luaconf.h
index 551c0401..87d369c7 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.53 2005/06/13 21:20:28 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.54 2005/07/05 14:31:45 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*/
@@ -41,22 +41,27 @@
41** non-conventional directories. 41** non-conventional directories.
42*/ 42*/
43#if defined(_WIN32) 43#if defined(_WIN32)
44#define LUA_ROOT "C:\\Program Files\\Lua51" 44/*
45#define LUA_LDIR LUA_ROOT "\\lua" 45** In Windows, any exclamation mark ('!') in the path is replaced by the
46#define LUA_CDIR LUA_ROOT "\\dll" 46** path of the directory of the executable file of the current process.
47*/
48#define LUA_LDIR "!\\lua"
49#define LUA_CDIR "!\\dll"
47#define LUA_PATH_DEFAULT \ 50#define LUA_PATH_DEFAULT \
48 "?.lua;" LUA_LDIR"\\?.lua;" LUA_LDIR"\\?\\init.lua" 51 "?.lua;" LUA_LDIR"\\?.lua;" LUA_LDIR"\\?\\init.lua;" \
49#define LUA_CPATH_DEFAULT \ 52 LUA_CDIR"\\?.lua;" LUA_CDIR"\\?\\init.lua"
50 "?.dll;" "l?.dll;" LUA_CDIR"\\?.dll;" LUA_CDIR"\\l?.dll" 53#define LUA_CPATH_DEFAULT \
54 "?.dll;" LUA_CDIR"\\?.dll;" LUA_CDIR"\\loadall.dll"
51 55
52#else 56#else
53#define LUA_ROOT "/usr/local" 57#define LUA_ROOT "/usr/local"
54#define LUA_LDIR LUA_ROOT "/share/lua/5.1" 58#define LUA_LDIR LUA_ROOT "/share/lua/5.1"
55#define LUA_CDIR LUA_ROOT "/lib/lua/5.1" 59#define LUA_CDIR LUA_ROOT "/lib/lua/5.1"
56#define LUA_PATH_DEFAULT \ 60#define LUA_PATH_DEFAULT \
57 "./?.lua;" LUA_LDIR"/?.lua;" LUA_LDIR"/?/init.lua" 61 "./?.lua;" LUA_LDIR"/?.lua;" LUA_LDIR"/?/init.lua;" \
58#define LUA_CPATH_DEFAULT \ 62 LUA_CDIR"/?.lua;" LUA_CDIR"/?/init.lua"
59 "./?.so;" "./l?.so;" LUA_CDIR"/?.so;" LUA_CDIR"/l?.so" 63#define LUA_CPATH_DEFAULT \
64 "./?.so;" LUA_CDIR"/?.so;" LUA_CDIR"/loadall.so"
60#endif 65#endif
61 66
62 67
@@ -74,21 +79,17 @@
74 79
75/* 80/*
76@@ LUA_PATHSEP is the character that separates templates in a path. 81@@ LUA_PATHSEP is the character that separates templates in a path.
77** CHANGE it if for some reason your system cannot use a
78** semicolon. (E.g., if a semicolon is a common character in
79** file/directory names.) Probably you do not need to change this.
80*/
81#define LUA_PATHSEP ';'
82
83
84/*
85@@ LUA_PATH_MARK is the string that marks the substitution points in a 82@@ LUA_PATH_MARK is the string that marks the substitution points in a
86@* template. 83@* template.
87** CHANGE it if for some reason your system cannot use an interrogation 84@@ LUA_EXECDIR in a Windows path is replaced by the executable's
88** mark. (E.g., if an interogation mark is a common character in 85@* directory.
89** file/directory names.) Probably you do not need to change this. 86** CHANGE them if for some reason your system cannot use those
87** characters. (E.g., if one of those characters is a common character
88** in file/directory names.) Probably you do not need to change them.
90*/ 89*/
90#define LUA_PATHSEP ";"
91#define LUA_PATH_MARK "?" 91#define LUA_PATH_MARK "?"
92#define LUA_EXECDIR "!"
92 93
93 94
94/* 95/*
@@ -464,45 +465,24 @@
464 465
465/* 466/*
466@@ lua_number2int is a macro to convert lua_Number to int. 467@@ lua_number2int is a macro to convert lua_Number to int.
467** CHANGE that if you know a faster way to convert a lua_Number to 468@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
469** CHANGE them if you know a faster way to convert a lua_Number to
468** int (with any rounding method and without throwing errors) in your 470** int (with any rounding method and without throwing errors) in your
469** system. In Pentium machines, a naive typecast from double to int 471** system. In Pentium machines, a naive typecast from double to int
470** in C is extremely slow, so any alternative is worth trying. 472** in C is extremely slow, so any alternative is worth trying.
471*/ 473*/
472 474
473/* On a gcc/Pentium, resort to assembler */ 475/* On a Pentium, resort to a trick */
474#if !defined(LUA_ANSI) && defined(__GNUC__) && defined(__i386) 476#if !defined(LUA_ANSI) && (defined(__i386) || defined (_M_IX86))
475#define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") 477union luai_Cast { double l_d; long l_l; };
476 478#define lua_number2int(i,d) \
477/* On Windows/Pentium, resort to assembler */ 479 { union luai_Cast u; u.l_d = d + 6755399441055744.0; (i) = u.l_l; }
478#elif !defined(LUA_ANSI) && defined(_MSC_VER) && defined(_M_IX86)
479#define lua_number2int(i,d) __asm fld d __asm fistp i
480
481
482/* on Pentium machines compliant with C99, you can try lrint */
483#elif defined (__i386) && defined(__STDC_VERSION__) && \
484 (__STDC_VERSION__ >= 199900L)
485#define lua_number2int(i,d) ((i)=lrint(d))
486
487/* this option always works, but may be slow */
488#else
489#define lua_number2int(i,d) ((i)=(int)(d))
490
491#endif
492
493
494/*
495@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
496** CHANGE (see lua_number2int).
497*/
498/* On a gcc or Windows/Pentium, resort to assembler */
499#if (defined(__GNUC__) && defined(__i386)) || \
500 (defined(_MSC_VER) && defined(_M_IX86))
501#define lua_number2integer(i,n) lua_number2int(i, n) 480#define lua_number2integer(i,n) lua_number2int(i, n)
502 481
503/* this option always works, but may be slow */ 482/* this option always works, but may be slow */
504#else 483#else
505#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) 484#define lua_number2int(i,d) ((i)=(int)(d))
485#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
506 486
507#endif 487#endif
508 488
@@ -517,12 +497,12 @@
517** =================================================================== 497** ===================================================================
518*/ 498*/
519 499
500#define LUA_NUMBER double
520 501
521/* 502/*
522@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' 503@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
523@* over a number. 504@* over a number.
524*/ 505*/
525#define LUA_NUMBER double
526#define LUAI_UACNUMBER double 506#define LUAI_UACNUMBER double
527 507
528 508
@@ -572,7 +552,7 @@
572** CHANGE them if you prefer to use longjmp/setjmp even with C++ or 552** CHANGE them if you prefer to use longjmp/setjmp even with C++ or
573** if want/don't want to use _longjmp/_setjmp instead of regular 553** if want/don't want to use _longjmp/_setjmp instead of regular
574** longjmp/setjmp. By default, Lua handles errors with exceptions when 554** longjmp/setjmp. By default, Lua handles errors with exceptions when
575** compiling as C++ code, with _longjmp/_setjmp when compiling as C code 555* compiling as C++ code, with _longjmp/_setjmp when compiling as C code
576** in a Unix system, and with longjmp/setjmp otherwise. 556** in a Unix system, and with longjmp/setjmp otherwise.
577*/ 557*/
578#if defined(__cplusplus) 558#if defined(__cplusplus)