Mercurial > vba-clojure
diff src/lua/luaconf.h @ 11:27763b933818
raise lua sources up one level
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 11:07:39 -0600 |
parents | src/lua/src/luaconf.h@f9f4f1b99eed |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/lua/luaconf.h Sat Mar 03 11:07:39 2012 -0600 1.3 @@ -0,0 +1,763 @@ 1.4 +/* 1.5 +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ 1.6 +** Configuration file for Lua 1.7 +** See Copyright Notice in lua.h 1.8 +*/ 1.9 + 1.10 + 1.11 +#ifndef lconfig_h 1.12 +#define lconfig_h 1.13 + 1.14 +#include <limits.h> 1.15 +#include <stddef.h> 1.16 + 1.17 + 1.18 +/* 1.19 +** ================================================================== 1.20 +** Search for "@@" to find all configurable definitions. 1.21 +** =================================================================== 1.22 +*/ 1.23 + 1.24 + 1.25 +/* 1.26 +@@ LUA_ANSI controls the use of non-ansi features. 1.27 +** CHANGE it (define it) if you want Lua to avoid the use of any 1.28 +** non-ansi feature or library. 1.29 +*/ 1.30 +#if defined(__STRICT_ANSI__) 1.31 +#define LUA_ANSI 1.32 +#endif 1.33 + 1.34 + 1.35 +#if !defined(LUA_ANSI) && defined(_WIN32) 1.36 +#define LUA_WIN 1.37 +#endif 1.38 + 1.39 +#if defined(LUA_USE_LINUX) 1.40 +#define LUA_USE_POSIX 1.41 +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 1.42 +#define LUA_USE_READLINE /* needs some extra libraries */ 1.43 +#endif 1.44 + 1.45 +#if defined(LUA_USE_MACOSX) 1.46 +#define LUA_USE_POSIX 1.47 +#define LUA_DL_DYLD /* does not need extra library */ 1.48 +#endif 1.49 + 1.50 + 1.51 + 1.52 +/* 1.53 +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System 1.54 +@* Interfaces Extension (XSI). 1.55 +** CHANGE it (define it) if your system is XSI compatible. 1.56 +*/ 1.57 +#if defined(LUA_USE_POSIX) 1.58 +#define LUA_USE_MKSTEMP 1.59 +#define LUA_USE_ISATTY 1.60 +#define LUA_USE_POPEN 1.61 +#define LUA_USE_ULONGJMP 1.62 +#endif 1.63 + 1.64 + 1.65 +/* 1.66 +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that 1.67 +@* Lua check to set its paths. 1.68 +@@ LUA_INIT is the name of the environment variable that Lua 1.69 +@* checks for initialization code. 1.70 +** CHANGE them if you want different names. 1.71 +*/ 1.72 +#define LUA_PATH "LUA_PATH" 1.73 +#define LUA_CPATH "LUA_CPATH" 1.74 +#define LUA_INIT "LUA_INIT" 1.75 + 1.76 + 1.77 +/* 1.78 +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 1.79 +@* Lua libraries. 1.80 +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 1.81 +@* C libraries. 1.82 +** CHANGE them if your machine has a non-conventional directory 1.83 +** hierarchy or if you want to install your libraries in 1.84 +** non-conventional directories. 1.85 +*/ 1.86 +#if defined(_WIN32) 1.87 +/* 1.88 +** In Windows, any exclamation mark ('!') in the path is replaced by the 1.89 +** path of the directory of the executable file of the current process. 1.90 +*/ 1.91 +#define LUA_LDIR "!\\lua\\" 1.92 +#define LUA_CDIR "!\\" 1.93 +#define LUA_PATH_DEFAULT \ 1.94 + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 1.95 + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" 1.96 +#define LUA_CPATH_DEFAULT \ 1.97 + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" 1.98 + 1.99 +#else 1.100 +#define LUA_ROOT "/usr/local/" 1.101 +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" 1.102 +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" 1.103 +#define LUA_PATH_DEFAULT \ 1.104 + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 1.105 + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" 1.106 +#define LUA_CPATH_DEFAULT \ 1.107 + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" 1.108 +#endif 1.109 + 1.110 + 1.111 +/* 1.112 +@@ LUA_DIRSEP is the directory separator (for submodules). 1.113 +** CHANGE it if your machine does not use "/" as the directory separator 1.114 +** and is not Windows. (On Windows Lua automatically uses "\".) 1.115 +*/ 1.116 +#if defined(_WIN32) 1.117 +#define LUA_DIRSEP "\\" 1.118 +#else 1.119 +#define LUA_DIRSEP "/" 1.120 +#endif 1.121 + 1.122 + 1.123 +/* 1.124 +@@ LUA_PATHSEP is the character that separates templates in a path. 1.125 +@@ LUA_PATH_MARK is the string that marks the substitution points in a 1.126 +@* template. 1.127 +@@ LUA_EXECDIR in a Windows path is replaced by the executable's 1.128 +@* directory. 1.129 +@@ LUA_IGMARK is a mark to ignore all before it when bulding the 1.130 +@* luaopen_ function name. 1.131 +** CHANGE them if for some reason your system cannot use those 1.132 +** characters. (E.g., if one of those characters is a common character 1.133 +** in file/directory names.) Probably you do not need to change them. 1.134 +*/ 1.135 +#define LUA_PATHSEP ";" 1.136 +#define LUA_PATH_MARK "?" 1.137 +#define LUA_EXECDIR "!" 1.138 +#define LUA_IGMARK "-" 1.139 + 1.140 + 1.141 +/* 1.142 +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. 1.143 +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most 1.144 +** machines, ptrdiff_t gives a good choice between int or long.) 1.145 +*/ 1.146 +#define LUA_INTEGER ptrdiff_t 1.147 + 1.148 + 1.149 +/* 1.150 +@@ LUA_API is a mark for all core API functions. 1.151 +@@ LUALIB_API is a mark for all standard library functions. 1.152 +** CHANGE them if you need to define those functions in some special way. 1.153 +** For instance, if you want to create one Windows DLL with the core and 1.154 +** the libraries, you may want to use the following definition (define 1.155 +** LUA_BUILD_AS_DLL to get it). 1.156 +*/ 1.157 +#if defined(LUA_BUILD_AS_DLL) 1.158 + 1.159 +#if defined(LUA_CORE) || defined(LUA_LIB) 1.160 +#define LUA_API __declspec(dllexport) 1.161 +#else 1.162 +#define LUA_API __declspec(dllimport) 1.163 +#endif 1.164 + 1.165 +#else 1.166 + 1.167 +#define LUA_API extern 1.168 + 1.169 +#endif 1.170 + 1.171 +/* more often than not the libs go together with the core */ 1.172 +#define LUALIB_API LUA_API 1.173 + 1.174 + 1.175 +/* 1.176 +@@ LUAI_FUNC is a mark for all extern functions that are not to be 1.177 +@* exported to outside modules. 1.178 +@@ LUAI_DATA is a mark for all extern (const) variables that are not to 1.179 +@* be exported to outside modules. 1.180 +** CHANGE them if you need to mark them in some special way. Elf/gcc 1.181 +** (versions 3.2 and later) mark them as "hidden" to optimize access 1.182 +** when Lua is compiled as a shared library. 1.183 +*/ 1.184 +#if defined(luaall_c) 1.185 +#define LUAI_FUNC static 1.186 +#define LUAI_DATA /* empty */ 1.187 + 1.188 +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 1.189 + defined(__ELF__) 1.190 +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern 1.191 +#define LUAI_DATA LUAI_FUNC 1.192 + 1.193 +#else 1.194 +#define LUAI_FUNC extern 1.195 +#define LUAI_DATA extern 1.196 +#endif 1.197 + 1.198 + 1.199 + 1.200 +/* 1.201 +@@ LUA_QL describes how error messages quote program elements. 1.202 +** CHANGE it if you want a different appearance. 1.203 +*/ 1.204 +#define LUA_QL(x) "'" x "'" 1.205 +#define LUA_QS LUA_QL("%s") 1.206 + 1.207 + 1.208 +/* 1.209 +@@ LUA_IDSIZE gives the maximum size for the description of the source 1.210 +@* of a function in debug information. 1.211 +** CHANGE it if you want a different size. 1.212 +*/ 1.213 +#define LUA_IDSIZE 60 1.214 + 1.215 + 1.216 +/* 1.217 +** {================================================================== 1.218 +** Stand-alone configuration 1.219 +** =================================================================== 1.220 +*/ 1.221 + 1.222 +#if defined(lua_c) || defined(luaall_c) 1.223 + 1.224 +/* 1.225 +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that 1.226 +@* is, whether we're running lua interactively). 1.227 +** CHANGE it if you have a better definition for non-POSIX/non-Windows 1.228 +** systems. 1.229 +*/ 1.230 +#if defined(LUA_USE_ISATTY) 1.231 +#include <unistd.h> 1.232 +#define lua_stdin_is_tty() isatty(0) 1.233 +#elif defined(LUA_WIN) 1.234 +#include <io.h> 1.235 +#include <stdio.h> 1.236 +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) 1.237 +#else 1.238 +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ 1.239 +#endif 1.240 + 1.241 + 1.242 +/* 1.243 +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. 1.244 +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. 1.245 +** CHANGE them if you want different prompts. (You can also change the 1.246 +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) 1.247 +*/ 1.248 +#define LUA_PROMPT "> " 1.249 +#define LUA_PROMPT2 ">> " 1.250 + 1.251 + 1.252 +/* 1.253 +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. 1.254 +** CHANGE it if your stand-alone interpreter has a different name and 1.255 +** your system is not able to detect that name automatically. 1.256 +*/ 1.257 +#define LUA_PROGNAME "lua" 1.258 + 1.259 + 1.260 +/* 1.261 +@@ LUA_MAXINPUT is the maximum length for an input line in the 1.262 +@* stand-alone interpreter. 1.263 +** CHANGE it if you need longer lines. 1.264 +*/ 1.265 +#define LUA_MAXINPUT 512 1.266 + 1.267 + 1.268 +/* 1.269 +@@ lua_readline defines how to show a prompt and then read a line from 1.270 +@* the standard input. 1.271 +@@ lua_saveline defines how to "save" a read line in a "history". 1.272 +@@ lua_freeline defines how to free a line read by lua_readline. 1.273 +** CHANGE them if you want to improve this functionality (e.g., by using 1.274 +** GNU readline and history facilities). 1.275 +*/ 1.276 +#if defined(LUA_USE_READLINE) 1.277 +#include <stdio.h> 1.278 +#include <readline/readline.h> 1.279 +#include <readline/history.h> 1.280 +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) 1.281 +#define lua_saveline(L,idx) \ 1.282 + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ 1.283 + add_history(lua_tostring(L, idx)); /* add it to history */ 1.284 +#define lua_freeline(L,b) ((void)L, free(b)) 1.285 +#else 1.286 +#define lua_readline(L,b,p) \ 1.287 + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ 1.288 + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ 1.289 +#define lua_saveline(L,idx) { (void)L; (void)idx; } 1.290 +#define lua_freeline(L,b) { (void)L; (void)b; } 1.291 +#endif 1.292 + 1.293 +#endif 1.294 + 1.295 +/* }================================================================== */ 1.296 + 1.297 + 1.298 +/* 1.299 +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles 1.300 +@* as a percentage. 1.301 +** CHANGE it if you want the GC to run faster or slower (higher values 1.302 +** mean larger pauses which mean slower collection.) You can also change 1.303 +** this value dynamically. 1.304 +*/ 1.305 +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ 1.306 + 1.307 + 1.308 +/* 1.309 +@@ LUAI_GCMUL defines the default speed of garbage collection relative to 1.310 +@* memory allocation as a percentage. 1.311 +** CHANGE it if you want to change the granularity of the garbage 1.312 +** collection. (Higher values mean coarser collections. 0 represents 1.313 +** infinity, where each step performs a full collection.) You can also 1.314 +** change this value dynamically. 1.315 +*/ 1.316 +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ 1.317 + 1.318 + 1.319 + 1.320 +/* 1.321 +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. 1.322 +** CHANGE it (define it) if you want exact compatibility with the 1.323 +** behavior of setn/getn in Lua 5.0. 1.324 +*/ 1.325 +#undef LUA_COMPAT_GETN 1.326 + 1.327 +/* 1.328 +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. 1.329 +** CHANGE it to undefined as soon as you do not need a global 'loadlib' 1.330 +** function (the function is still available as 'package.loadlib'). 1.331 +*/ 1.332 +#undef LUA_COMPAT_LOADLIB 1.333 + 1.334 +/* 1.335 +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. 1.336 +** CHANGE it to undefined as soon as your programs use only '...' to 1.337 +** access vararg parameters (instead of the old 'arg' table). 1.338 +*/ 1.339 +#define LUA_COMPAT_VARARG 1.340 + 1.341 +/* 1.342 +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. 1.343 +** CHANGE it to undefined as soon as your programs use 'math.fmod' or 1.344 +** the new '%' operator instead of 'math.mod'. 1.345 +*/ 1.346 +#define LUA_COMPAT_MOD 1.347 + 1.348 +/* 1.349 +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting 1.350 +@* facility. 1.351 +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn 1.352 +** off the advisory error when nesting [[...]]. 1.353 +*/ 1.354 +#define LUA_COMPAT_LSTR 1 1.355 + 1.356 +/* 1.357 +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. 1.358 +** CHANGE it to undefined as soon as you rename 'string.gfind' to 1.359 +** 'string.gmatch'. 1.360 +*/ 1.361 +#define LUA_COMPAT_GFIND 1.362 + 1.363 +/* 1.364 +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' 1.365 +@* behavior. 1.366 +** CHANGE it to undefined as soon as you replace to 'luaL_register' 1.367 +** your uses of 'luaL_openlib' 1.368 +*/ 1.369 +#define LUA_COMPAT_OPENLIB 1.370 + 1.371 + 1.372 + 1.373 +/* 1.374 +@@ luai_apicheck is the assert macro used by the Lua-C API. 1.375 +** CHANGE luai_apicheck if you want Lua to perform some checks in the 1.376 +** parameters it gets from API calls. This may slow down the interpreter 1.377 +** a bit, but may be quite useful when debugging C code that interfaces 1.378 +** with Lua. A useful redefinition is to use assert.h. 1.379 +*/ 1.380 +#if defined(LUA_USE_APICHECK) 1.381 +#include <assert.h> 1.382 +#define luai_apicheck(L,o) { (void)L; assert(o); } 1.383 +#else 1.384 +#define luai_apicheck(L,o) { (void)L; } 1.385 +#endif 1.386 + 1.387 + 1.388 +/* 1.389 +@@ LUAI_BITSINT defines the number of bits in an int. 1.390 +** CHANGE here if Lua cannot automatically detect the number of bits of 1.391 +** your machine. Probably you do not need to change this. 1.392 +*/ 1.393 +/* avoid overflows in comparison */ 1.394 +#if INT_MAX-20 < 32760 1.395 +#define LUAI_BITSINT 16 1.396 +#elif INT_MAX > 2147483640L 1.397 +/* int has at least 32 bits */ 1.398 +#define LUAI_BITSINT 32 1.399 +#else 1.400 +#error "you must define LUA_BITSINT with number of bits in an integer" 1.401 +#endif 1.402 + 1.403 + 1.404 +/* 1.405 +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. 1.406 +@@ LUAI_INT32 is an signed integer with at least 32 bits. 1.407 +@@ LUAI_UMEM is an unsigned integer big enough to count the total 1.408 +@* memory used by Lua. 1.409 +@@ LUAI_MEM is a signed integer big enough to count the total memory 1.410 +@* used by Lua. 1.411 +** CHANGE here if for some weird reason the default definitions are not 1.412 +** good enough for your machine. (The definitions in the 'else' 1.413 +** part always works, but may waste space on machines with 64-bit 1.414 +** longs.) Probably you do not need to change this. 1.415 +*/ 1.416 +#if LUAI_BITSINT >= 32 1.417 +#define LUAI_UINT32 unsigned int 1.418 +#define LUAI_INT32 int 1.419 +#define LUAI_MAXINT32 INT_MAX 1.420 +#define LUAI_UMEM size_t 1.421 +#define LUAI_MEM ptrdiff_t 1.422 +#else 1.423 +/* 16-bit ints */ 1.424 +#define LUAI_UINT32 unsigned long 1.425 +#define LUAI_INT32 long 1.426 +#define LUAI_MAXINT32 LONG_MAX 1.427 +#define LUAI_UMEM unsigned long 1.428 +#define LUAI_MEM long 1.429 +#endif 1.430 + 1.431 + 1.432 +/* 1.433 +@@ LUAI_MAXCALLS limits the number of nested calls. 1.434 +** CHANGE it if you need really deep recursive calls. This limit is 1.435 +** arbitrary; its only purpose is to stop infinite recursion before 1.436 +** exhausting memory. 1.437 +*/ 1.438 +#define LUAI_MAXCALLS 20000 1.439 + 1.440 + 1.441 +/* 1.442 +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function 1.443 +@* can use. 1.444 +** CHANGE it if you need lots of (Lua) stack space for your C 1.445 +** functions. This limit is arbitrary; its only purpose is to stop C 1.446 +** functions to consume unlimited stack space. (must be smaller than 1.447 +** -LUA_REGISTRYINDEX) 1.448 +*/ 1.449 +#define LUAI_MAXCSTACK 8000 1.450 + 1.451 + 1.452 + 1.453 +/* 1.454 +** {================================================================== 1.455 +** CHANGE (to smaller values) the following definitions if your system 1.456 +** has a small C stack. (Or you may want to change them to larger 1.457 +** values if your system has a large C stack and these limits are 1.458 +** too rigid for you.) Some of these constants control the size of 1.459 +** stack-allocated arrays used by the compiler or the interpreter, while 1.460 +** others limit the maximum number of recursive calls that the compiler 1.461 +** or the interpreter can perform. Values too large may cause a C stack 1.462 +** overflow for some forms of deep constructs. 1.463 +** =================================================================== 1.464 +*/ 1.465 + 1.466 + 1.467 +/* 1.468 +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and 1.469 +@* syntactical nested non-terminals in a program. 1.470 +*/ 1.471 +#define LUAI_MAXCCALLS 200 1.472 + 1.473 + 1.474 +/* 1.475 +@@ LUAI_MAXVARS is the maximum number of local variables per function 1.476 +@* (must be smaller than 250). 1.477 +*/ 1.478 +#define LUAI_MAXVARS 200 1.479 + 1.480 + 1.481 +/* 1.482 +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function 1.483 +@* (must be smaller than 250). 1.484 +*/ 1.485 +#define LUAI_MAXUPVALUES 60 1.486 + 1.487 + 1.488 +/* 1.489 +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 1.490 +*/ 1.491 +#define LUAL_BUFFERSIZE BUFSIZ 1.492 + 1.493 +/* }================================================================== */ 1.494 + 1.495 + 1.496 + 1.497 + 1.498 +/* 1.499 +** {================================================================== 1.500 +@@ LUA_NUMBER is the type of numbers in Lua. 1.501 +** CHANGE the following definitions only if you want to build Lua 1.502 +** with a number type different from double. You may also need to 1.503 +** change lua_number2int & lua_number2integer. 1.504 +** =================================================================== 1.505 +*/ 1.506 + 1.507 +#define LUA_NUMBER_DOUBLE 1.508 +#define LUA_NUMBER double 1.509 + 1.510 +/* 1.511 +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' 1.512 +@* over a number. 1.513 +*/ 1.514 +#define LUAI_UACNUMBER double 1.515 + 1.516 + 1.517 +/* 1.518 +@@ LUA_NUMBER_SCAN is the format for reading numbers. 1.519 +@@ LUA_NUMBER_FMT is the format for writing numbers. 1.520 +@@ lua_number2str converts a number to a string. 1.521 +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. 1.522 +@@ lua_str2number converts a string to a number. 1.523 +*/ 1.524 +#define LUA_NUMBER_SCAN "%lf" 1.525 +#define LUA_NUMBER_FMT "%.14g" 1.526 +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) 1.527 +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ 1.528 +#define lua_str2number(s,p) strtod((s), (p)) 1.529 + 1.530 + 1.531 +/* 1.532 +@@ The luai_num* macros define the primitive operations over numbers. 1.533 +*/ 1.534 +#if defined(LUA_CORE) 1.535 +#include <math.h> 1.536 +#define luai_numadd(a,b) ((a)+(b)) 1.537 +#define luai_numsub(a,b) ((a)-(b)) 1.538 +#define luai_nummul(a,b) ((a)*(b)) 1.539 +#define luai_numdiv(a,b) ((a)/(b)) 1.540 +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) 1.541 +#define luai_numpow(a,b) (pow(a,b)) 1.542 +#define luai_numunm(a) (-(a)) 1.543 +#define luai_numeq(a,b) ((a)==(b)) 1.544 +#define luai_numlt(a,b) ((a)<(b)) 1.545 +#define luai_numle(a,b) ((a)<=(b)) 1.546 +#define luai_numisnan(a) (!luai_numeq((a), (a))) 1.547 +#endif 1.548 + 1.549 + 1.550 +/* 1.551 +@@ lua_number2int is a macro to convert lua_Number to int. 1.552 +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. 1.553 +** CHANGE them if you know a faster way to convert a lua_Number to 1.554 +** int (with any rounding method and without throwing errors) in your 1.555 +** system. In Pentium machines, a naive typecast from double to int 1.556 +** in C is extremely slow, so any alternative is worth trying. 1.557 +*/ 1.558 + 1.559 +/* On a Pentium, resort to a trick */ 1.560 +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ 1.561 + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) 1.562 + 1.563 +/* On a Microsoft compiler, use assembler */ 1.564 +#if 0//defined(_MSC_VER) // nitsuja: the "using assembly" method doesn't correctly handle integers between 0xFF000000 and and 0xFFFFFFFF, while the other branch does handle it correctly and it's not slower. 1.565 + 1.566 +#define lua_number2int(i,d) __asm fld d __asm fistp i 1.567 +#define lua_number2integer(i,n) lua_number2int(i, n) 1.568 + 1.569 +/* the next trick should work on any Pentium, but sometimes clashes 1.570 + with a DirectX idiosyncrasy */ 1.571 +#else 1.572 + 1.573 +union luai_Cast { double l_d; long l_l; }; 1.574 +#define lua_number2int(i,d) \ 1.575 + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } 1.576 +#define lua_number2integer(i,n) lua_number2int(i, n) 1.577 + 1.578 +#endif 1.579 + 1.580 + 1.581 +/* this option always works, but may be slow */ 1.582 +#else 1.583 +#define lua_number2int(i,d) ((i)=(int)(d)) 1.584 +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) 1.585 + 1.586 +#endif 1.587 + 1.588 +/* }================================================================== */ 1.589 + 1.590 + 1.591 +/* 1.592 +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. 1.593 +** CHANGE it if your system requires alignments larger than double. (For 1.594 +** instance, if your system supports long doubles and they must be 1.595 +** aligned in 16-byte boundaries, then you should add long double in the 1.596 +** union.) Probably you do not need to change this. 1.597 +*/ 1.598 +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } 1.599 + 1.600 + 1.601 +/* 1.602 +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. 1.603 +** CHANGE them if you prefer to use longjmp/setjmp even with C++ 1.604 +** or if want/don't to use _longjmp/_setjmp instead of regular 1.605 +** longjmp/setjmp. By default, Lua handles errors with exceptions when 1.606 +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, 1.607 +** and with longjmp/setjmp otherwise. 1.608 +*/ 1.609 +#if defined(__cplusplus) 1.610 +/* C++ exceptions */ 1.611 +#define LUAI_THROW(L,c) throw(c) 1.612 +#define LUAI_TRY(L,c,a) try { a } catch(...) \ 1.613 + { if ((c)->status == 0) (c)->status = -1; } 1.614 +#define luai_jmpbuf int /* dummy variable */ 1.615 + 1.616 +#elif defined(LUA_USE_ULONGJMP) 1.617 +/* in Unix, try _longjmp/_setjmp (more efficient) */ 1.618 +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) 1.619 +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } 1.620 +#define luai_jmpbuf jmp_buf 1.621 + 1.622 +#else 1.623 +/* default handling with long jumps */ 1.624 +#define LUAI_THROW(L,c) longjmp((c)->b, 1) 1.625 +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } 1.626 +#define luai_jmpbuf jmp_buf 1.627 + 1.628 +#endif 1.629 + 1.630 + 1.631 +/* 1.632 +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern 1.633 +@* can do during pattern-matching. 1.634 +** CHANGE it if you need more captures. This limit is arbitrary. 1.635 +*/ 1.636 +#define LUA_MAXCAPTURES 32 1.637 + 1.638 + 1.639 +/* 1.640 +@@ lua_tmpnam is the function that the OS library uses to create a 1.641 +@* temporary name. 1.642 +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. 1.643 +** CHANGE them if you have an alternative to tmpnam (which is considered 1.644 +** insecure) or if you want the original tmpnam anyway. By default, Lua 1.645 +** uses tmpnam except when POSIX is available, where it uses mkstemp. 1.646 +*/ 1.647 +#if defined(loslib_c) || defined(luaall_c) 1.648 + 1.649 +#if defined(LUA_USE_MKSTEMP) 1.650 +#include <unistd.h> 1.651 +#define LUA_TMPNAMBUFSIZE 32 1.652 +#define lua_tmpnam(b,e) { \ 1.653 + strcpy(b, "/tmp/lua_XXXXXX"); \ 1.654 + e = mkstemp(b); \ 1.655 + if (e != -1) close(e); \ 1.656 + e = (e == -1); } 1.657 + 1.658 +#else 1.659 +#define LUA_TMPNAMBUFSIZE L_tmpnam 1.660 +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } 1.661 +#endif 1.662 + 1.663 +#endif 1.664 + 1.665 + 1.666 +/* 1.667 +@@ lua_popen spawns a new process connected to the current one through 1.668 +@* the file streams. 1.669 +** CHANGE it if you have a way to implement it in your system. 1.670 +*/ 1.671 +#if defined(LUA_USE_POPEN) 1.672 + 1.673 +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) 1.674 +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) 1.675 + 1.676 +#elif defined(LUA_WIN) 1.677 + 1.678 +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) 1.679 +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) 1.680 + 1.681 +#else 1.682 + 1.683 +#define lua_popen(L,c,m) ((void)((void)c, m), \ 1.684 + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) 1.685 +#define lua_pclose(L,file) ((void)((void)L, file), 0) 1.686 + 1.687 +#endif 1.688 + 1.689 +/* 1.690 +@@ LUA_DL_* define which dynamic-library system Lua should use. 1.691 +** CHANGE here if Lua has problems choosing the appropriate 1.692 +** dynamic-library system for your platform (either Windows' DLL, Mac's 1.693 +** dyld, or Unix's dlopen). If your system is some kind of Unix, there 1.694 +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for 1.695 +** it. To use dlopen you also need to adapt the src/Makefile (probably 1.696 +** adding -ldl to the linker options), so Lua does not select it 1.697 +** automatically. (When you change the makefile to add -ldl, you must 1.698 +** also add -DLUA_USE_DLOPEN.) 1.699 +** If you do not want any kind of dynamic library, undefine all these 1.700 +** options. 1.701 +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. 1.702 +*/ 1.703 +#if defined(LUA_USE_DLOPEN) 1.704 +#define LUA_DL_DLOPEN 1.705 +#endif 1.706 + 1.707 +#if defined(LUA_WIN) 1.708 +#define LUA_DL_DLL 1.709 +#endif 1.710 + 1.711 + 1.712 +/* 1.713 +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State 1.714 +@* (the data goes just *before* the lua_State pointer). 1.715 +** CHANGE (define) this if you really need that. This value must be 1.716 +** a multiple of the maximum alignment required for your machine. 1.717 +*/ 1.718 +#define LUAI_EXTRASPACE 0 1.719 + 1.720 + 1.721 +/* 1.722 +@@ luai_userstate* allow user-specific actions on threads. 1.723 +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something 1.724 +** extra when a thread is created/deleted/resumed/yielded. 1.725 +*/ 1.726 +#define luai_userstateopen(L) ((void)L) 1.727 +#define luai_userstateclose(L) ((void)L) 1.728 +#define luai_userstatethread(L,L1) ((void)L) 1.729 +#define luai_userstatefree(L) ((void)L) 1.730 +#define luai_userstateresume(L,n) ((void)L) 1.731 +#define luai_userstateyield(L,n) ((void)L) 1.732 + 1.733 + 1.734 +/* 1.735 +@@ LUA_INTFRMLEN is the length modifier for integer conversions 1.736 +@* in 'string.format'. 1.737 +@@ LUA_INTFRM_T is the integer type correspoding to the previous length 1.738 +@* modifier. 1.739 +** CHANGE them if your system supports long long or does not support long. 1.740 +*/ 1.741 + 1.742 +#if defined(LUA_USELONGLONG) 1.743 + 1.744 +#define LUA_INTFRMLEN "ll" 1.745 +#define LUA_INTFRM_T long long 1.746 + 1.747 +#else 1.748 + 1.749 +#define LUA_INTFRMLEN "l" 1.750 +#define LUA_INTFRM_T long 1.751 + 1.752 +#endif 1.753 + 1.754 + 1.755 + 1.756 +/* =================================================================== */ 1.757 + 1.758 +/* 1.759 +** Local configuration. You can use this space to add your redefinitions 1.760 +** without modifying the main part of the file. 1.761 +*/ 1.762 + 1.763 + 1.764 + 1.765 +#endif 1.766 +