diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-22 15:43:27 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-22 15:43:27 -0200 |
commit | 96727c61b87d199b51a3ebb707255e79d5ed1b84 (patch) | |
tree | c99da1452411280bb649910908ac58a32df93197 /luaconf.h | |
parent | d5ebc3ff6de4b5f7019bb887e917e00cb3a0a899 (diff) | |
download | lua-96727c61b87d199b51a3ebb707255e79d5ed1b84.tar.gz lua-96727c61b87d199b51a3ebb707255e79d5ed1b84.tar.bz2 lua-96727c61b87d199b51a3ebb707255e79d5ed1b84.zip |
several improvements/corrections
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 67 |
1 files changed, 52 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.19 2004/12/01 15:52:54 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.21 2004/12/13 12:08:34 roberto Exp $ |
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 | */ |
@@ -31,10 +31,22 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* default path */ | 33 | /* default path */ |
34 | #define LUA_PATH_DEFAULT \ | 34 | #if defined(_WIN32) |
35 | "./?.lua;/usr/local/share/lua/5.0/?.lua;/usr/local/share/lua/5.0/?/init.lua" | 35 | #define LUA_ROOT "C:\\Program Files\\Lua51" |
36 | #define LUA_CPATH_DEFAULT \ | 36 | #define LUA_LDIR LUA_ROOT "\\lua" |
37 | "./?.so;/usr/local/lib/lua/5.0/?.so;/usr/local/lib/lua/5.0/lib?.so" | 37 | #define LUA_CDIR LUA_ROOT "\\dll" |
38 | #define LUA_PATH_DEFAULT \ | ||
39 | "?.lua;" LUA_LDIR "\\?.lua;" LUA_LDIR "\\?\\init.lua" | ||
40 | #define LUA_CPATH_DEFAULT "?.dll;" LUA_CDIR "\\?.dll" | ||
41 | |||
42 | #else | ||
43 | #define LUA_ROOT "/usr/local" | ||
44 | #define LUA_LDIR LUA_ROOT "/share/lua/5.1" | ||
45 | #define LUA_CDIR LUA_ROOT "/lib/lua/5.1" | ||
46 | #define LUA_PATH_DEFAULT \ | ||
47 | "./?.lua;" LUA_LDIR "/?.lua;" LUA_LDIR "/?/init.lua" | ||
48 | #define LUA_CPATH_DEFAULT "./?.so;" LUA_CDIR "/?.so" | ||
49 | #endif | ||
38 | 50 | ||
39 | 51 | ||
40 | 52 | ||
@@ -57,10 +69,10 @@ | |||
57 | #define LUA_API extern | 69 | #define LUA_API extern |
58 | 70 | ||
59 | /* mark for auxlib functions */ | 71 | /* mark for auxlib functions */ |
60 | #define LUALIB_API extern | 72 | #define LUALIB_API extern |
61 | 73 | ||
62 | /* buffer size used by lauxlib buffer system */ | 74 | /* buffer size used by lauxlib buffer system */ |
63 | #define LUAL_BUFFERSIZE BUFSIZ | 75 | #define LUAL_BUFFERSIZE BUFSIZ |
64 | 76 | ||
65 | 77 | ||
66 | /* assertions in Lua (mainly for internal debugging) */ | 78 | /* assertions in Lua (mainly for internal debugging) */ |
@@ -82,6 +94,10 @@ | |||
82 | #ifdef _POSIX_C_SOURCE | 94 | #ifdef _POSIX_C_SOURCE |
83 | #include <unistd.h> | 95 | #include <unistd.h> |
84 | #define stdin_is_tty() isatty(0) | 96 | #define stdin_is_tty() isatty(0) |
97 | #elif defined(_WIN32) | ||
98 | #include <io.h> | ||
99 | #include <fcntl.h> | ||
100 | #define stdin_is_tty() _isatty(_fileno(stdin)) | ||
85 | #else | 101 | #else |
86 | #define stdin_is_tty() 1 /* assume stdin is a tty */ | 102 | #define stdin_is_tty() 1 /* assume stdin is a tty */ |
87 | #endif | 103 | #endif |
@@ -200,14 +216,31 @@ | |||
200 | /* function to convert a lua_Number to int (with any rounding method) */ | 216 | /* function to convert a lua_Number to int (with any rounding method) */ |
201 | #if defined(__GNUC__) && defined(__i386) | 217 | #if defined(__GNUC__) && defined(__i386) |
202 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") | 218 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") |
219 | |||
220 | #elif defined(_WIN32) && defined(_M_IX86) | ||
221 | #include <math.h> | ||
222 | #pragma warning(disable: 4514) | ||
223 | __inline int l_lrint (double flt) | ||
224 | { int i; | ||
225 | _asm { | ||
226 | fld flt | ||
227 | fistp i | ||
228 | }; | ||
229 | return i; | ||
230 | } | ||
231 | #define lua_number2int(i,d) ((i)=l_lrint((d))) | ||
232 | |||
203 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199900L) | 233 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199900L) |
204 | /* on machines compliant with C99, you can try `lrint' */ | 234 | /* on machines compliant with C99, you can try `lrint' */ |
205 | #include <math.h> | 235 | #include <math.h> |
206 | #define lua_number2int(i,d) ((i)=lrint(d)) | 236 | #define lua_number2int(i,d) ((i)=lrint(d)) |
237 | |||
207 | #else | 238 | #else |
208 | #define lua_number2int(i,d) ((i)=(int)(d)) | 239 | #define lua_number2int(i,d) ((i)=(int)(d)) |
240 | |||
209 | #endif | 241 | #endif |
210 | 242 | ||
243 | |||
211 | /* function to convert a lua_Number to lua_Integer (with any rounding method) */ | 244 | /* function to convert a lua_Number to lua_Integer (with any rounding method) */ |
212 | #define lua_number2integer(i,n) lua_number2int((i), (n)) | 245 | #define lua_number2integer(i,n) lua_number2int((i), (n)) |
213 | 246 | ||
@@ -258,8 +291,8 @@ | |||
258 | ** or when reading immutable fields from global objects | 291 | ** or when reading immutable fields from global objects |
259 | ** (such as string values and udata values). | 292 | ** (such as string values and udata values). |
260 | */ | 293 | */ |
261 | #define lua_lock(L) ((void) 0) | 294 | #define lua_lock(L) ((void) 0) |
262 | #define lua_unlock(L) ((void) 0) | 295 | #define lua_unlock(L) ((void) 0) |
263 | 296 | ||
264 | /* | 297 | /* |
265 | ** this macro allows a thread switch in appropriate places in the Lua | 298 | ** this macro allows a thread switch in appropriate places in the Lua |
@@ -273,9 +306,6 @@ | |||
273 | #define lua_userstateopen(L) /* empty */ | 306 | #define lua_userstateopen(L) /* empty */ |
274 | 307 | ||
275 | 308 | ||
276 | /* initial GC parameters */ | ||
277 | #define STEPMUL 4 | ||
278 | |||
279 | #endif | 309 | #endif |
280 | 310 | ||
281 | /* }====================================================== */ | 311 | /* }====================================================== */ |
@@ -305,8 +335,15 @@ | |||
305 | #define LUA_POF "luaopen_" | 335 | #define LUA_POF "luaopen_" |
306 | #endif | 336 | #endif |
307 | 337 | ||
338 | /* separator for open functions in C libraries */ | ||
339 | #define LUA_OFSEP "" | ||
340 | |||
308 | /* directory separator (for submodules) */ | 341 | /* directory separator (for submodules) */ |
342 | #if defined(_WIN32) | ||
343 | #define LUA_DIRSEP "\\" | ||
344 | #else | ||
309 | #define LUA_DIRSEP "/" | 345 | #define LUA_DIRSEP "/" |
346 | #endif | ||
310 | 347 | ||
311 | /* separator of templates in a path */ | 348 | /* separator of templates in a path */ |
312 | #define LUA_PATH_SEP ';' | 349 | #define LUA_PATH_SEP ';' |
@@ -332,12 +369,12 @@ | |||
332 | /* | 369 | /* |
333 | ** Configuration for loadlib | 370 | ** Configuration for loadlib |
334 | */ | 371 | */ |
335 | #if defined(__linux) || defined(sun) || defined(sgi) || defined(BSD) | 372 | #if defined(_WIN32) |
336 | #define USE_DLOPEN | ||
337 | #elif defined(_WIN32) | ||
338 | #define USE_DLL | 373 | #define USE_DLL |
339 | #elif defined(__APPLE__) && defined(__MACH__) | 374 | #elif defined(__APPLE__) && defined(__MACH__) |
340 | #define USE_DYLD | 375 | #define USE_DYLD |
376 | #elif defined(__linux) || defined(sun) || defined(sgi) || defined(BSD) | ||
377 | #define USE_DLOPEN | ||
341 | #endif | 378 | #endif |
342 | 379 | ||
343 | 380 | ||