00001 /* 00002 ** $Id: luaconf.h,v 1.82a 2006/04/10 18:27:23 roberto Exp $ 00003 ** Configuration file for Lua 00004 ** See Copyright Notice in lua.h 00005 */ 00006 00007 00008 #ifndef lconfig_h 00009 #define lconfig_h 00010 00011 #include <limits.h> 00012 #include <stddef.h> 00013 #include <common/fixed.h> 00014 00015 #include "lfixed.h" 00016 00017 #pragma warning(disable:4996) 00018 00019 /* 00020 ** ================================================================== 00021 ** Search for "@@" to find all configurable definitions. 00022 ** =================================================================== 00023 */ 00024 00025 00026 /* 00027 @@ LUA_ANSI controls the use of non-ansi features. 00028 ** CHANGE it (define it) if you want Lua to avoid the use of any 00029 ** non-ansi feature or library. 00030 */ 00031 #if defined(__STRICT_ANSI__) 00032 #define LUA_ANSI 00033 #endif 00034 00035 00036 #if !defined(LUA_ANSI) && defined(_WIN32) 00037 #define LUA_WIN 00038 #endif 00039 00040 #if defined(LUA_USE_LINUX) 00041 #define LUA_USE_POSIX 00042 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 00043 #define LUA_USE_READLINE /* needs some extra libraries */ 00044 #endif 00045 00046 #if defined(LUA_USE_MACOSX) 00047 #define LUA_USE_POSIX 00048 #define LUA_DL_DYLD /* does not need extra library */ 00049 #endif 00050 00051 00052 00053 /* 00054 @@ LUA_USE_POSIX includes all functionallity listed as X/Open System 00055 @* Interfaces Extension (XSI). 00056 ** CHANGE it (define it) if your system is XSI compatible. 00057 */ 00058 #if defined(LUA_USE_POSIX) 00059 #define LUA_USE_MKSTEMP 00060 #define LUA_USE_ISATTY 00061 #define LUA_USE_POPEN 00062 #define LUA_USE_ULONGJMP 00063 #endif 00064 00065 00066 /* 00067 @@ LUA_PATH and LUA_CPATH are the names of the environment variables that 00068 @* Lua check to set its paths. 00069 @@ LUA_INIT is the name of the environment variable that Lua 00070 @* checks for initialization code. 00071 ** CHANGE them if you want different names. 00072 */ 00073 #define LUA_PATH "LUA_PATH" 00074 #define LUA_CPATH "LUA_CPATH" 00075 #define LUA_INIT "LUA_INIT" 00076 00077 00078 /* 00079 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 00080 @* Lua libraries. 00081 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 00082 @* C libraries. 00083 ** CHANGE them if your machine has a non-conventional directory 00084 ** hierarchy or if you want to install your libraries in 00085 ** non-conventional directories. 00086 */ 00087 #if defined(_WIN32) 00088 /* 00089 ** In Windows, any exclamation mark ('!') in the path is replaced by the 00090 ** path of the directory of the executable file of the current process. 00091 */ 00092 #define LUA_LDIR "!\\lua\\" 00093 #define LUA_CDIR "!\\" 00094 #define LUA_PATH_DEFAULT \ 00095 ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 00096 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" 00097 #define LUA_CPATH_DEFAULT \ 00098 ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" 00099 00100 #else 00101 #define LUA_ROOT "/usr/local/" 00102 #define LUA_LDIR LUA_ROOT "share/lua/5.1/" 00103 #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" 00104 #define LUA_PATH_DEFAULT \ 00105 "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 00106 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" 00107 #define LUA_CPATH_DEFAULT \ 00108 "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" 00109 #endif 00110 00111 00112 /* 00113 @@ LUA_DIRSEP is the directory separator (for submodules). 00114 ** CHANGE it if your machine does not use "/" as the directory separator 00115 ** and is not Windows. (On Windows Lua automatically uses "\".) 00116 */ 00117 #if defined(_WIN32) 00118 #define LUA_DIRSEP "\\" 00119 #else 00120 #define LUA_DIRSEP "/" 00121 #endif 00122 00123 00124 /* 00125 @@ LUA_PATHSEP is the character that separates templates in a path. 00126 @@ LUA_PATH_MARK is the string that marks the substitution points in a 00127 @* template. 00128 @@ LUA_EXECDIR in a Windows path is replaced by the executable's 00129 @* directory. 00130 @@ LUA_IGMARK is a mark to ignore all before it when bulding the 00131 @* luaopen_ function name. 00132 ** CHANGE them if for some reason your system cannot use those 00133 ** characters. (E.g., if one of those characters is a common character 00134 ** in file/directory names.) Probably you do not need to change them. 00135 */ 00136 #define LUA_PATHSEP ";" 00137 #define LUA_PATH_MARK "?" 00138 #define LUA_EXECDIR "!" 00139 #define LUA_IGMARK "-" 00140 00141 00142 /* 00143 @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. 00144 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most 00145 ** machines, ptrdiff_t gives a good choice between int or long.) 00146 */ 00147 #define LUA_INTEGER ptrdiff_t 00148 00149 00150 /* 00151 @@ LUA_API is a mark for all core API functions. 00152 @@ LUALIB_API is a mark for all standard library functions. 00153 ** CHANGE them if you need to define those functions in some special way. 00154 ** For instance, if you want to create one Windows DLL with the core and 00155 ** the libraries, you may want to use the following definition (define 00156 ** LUA_BUILD_AS_DLL to get it). 00157 */ 00158 #if defined(LUA_BUILD_AS_DLL) 00159 00160 #if defined(LUA_CORE) || defined(LUA_LIB) 00161 #define LUA_API __declspec(dllexport) 00162 #else 00163 #define LUA_API __declspec(dllimport) 00164 #endif 00165 00166 #else 00167 00168 #define LUA_API extern 00169 00170 #endif 00171 00172 /* more often than not the libs go together with the core */ 00173 #define LUALIB_API LUA_API 00174 00175 00176 /* 00177 @@ LUAI_FUNC is a mark for all extern functions that are not to be 00178 @* exported to outside modules. 00179 @@ LUAI_DATA is a mark for all extern (const) variables that are not to 00180 @* be exported to outside modules. 00181 ** CHANGE them if you need to mark them in some special way. Elf/gcc 00182 ** (versions 3.2 and later) mark them as "hidden" to optimize access 00183 ** when Lua is compiled as a shared library. 00184 */ 00185 #if defined(luaall_c) 00186 #define LUAI_FUNC static 00187 #define LUAI_DATA /* empty */ 00188 00189 #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 00190 defined(__ELF__) 00191 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern 00192 #define LUAI_DATA LUAI_FUNC 00193 00194 #else 00195 #define LUAI_FUNC extern 00196 #define LUAI_DATA extern 00197 #endif 00198 00199 00200 00201 /* 00202 @@ LUA_QL describes how error messages quote program elements. 00203 ** CHANGE it if you want a different appearance. 00204 */ 00205 #define LUA_QL(x) "'" x "'" 00206 #define LUA_QS LUA_QL("%s") 00207 00208 00209 /* 00210 @@ LUA_IDSIZE gives the maximum size for the description of the source 00211 @* of a function in debug information. 00212 ** CHANGE it if you want a different size. 00213 */ 00214 #define LUA_IDSIZE 60 00215 00216 00217 /* 00218 ** {================================================================== 00219 ** Stand-alone configuration 00220 ** =================================================================== 00221 */ 00222 00223 #if defined(lua_c) || defined(luaall_c) 00224 00225 /* 00226 @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that 00227 @* is, whether we're running lua interactively). 00228 ** CHANGE it if you have a better definition for non-POSIX/non-Windows 00229 ** systems. 00230 */ 00231 #if defined(LUA_USE_ISATTY) 00232 #include <unistd.h> 00233 #define lua_stdin_is_tty() isatty(0) 00234 #elif defined(LUA_WIN) 00235 #include <io.h> 00236 #include <stdio.h> 00237 #define lua_stdin_is_tty() _isatty(_fileno(stdin)) 00238 #else 00239 #define lua_stdin_is_tty() 1 /* assume stdin is a tty */ 00240 #endif 00241 00242 00243 /* 00244 @@ LUA_PROMPT is the default prompt used by stand-alone Lua. 00245 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. 00246 ** CHANGE them if you want different prompts. (You can also change the 00247 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) 00248 */ 00249 #define LUA_PROMPT "> " 00250 #define LUA_PROMPT2 ">> " 00251 00252 00253 /* 00254 @@ LUA_PROGNAME is the default name for the stand-alone Lua program. 00255 ** CHANGE it if your stand-alone interpreter has a different name and 00256 ** your system is not able to detect that name automatically. 00257 */ 00258 #define LUA_PROGNAME "lua" 00259 00260 00261 /* 00262 @@ LUA_MAXINPUT is the maximum length for an input line in the 00263 @* stand-alone interpreter. 00264 ** CHANGE it if you need longer lines. 00265 */ 00266 #define LUA_MAXINPUT 512 00267 00268 00269 /* 00270 @@ lua_readline defines how to show a prompt and then read a line from 00271 @* the standard input. 00272 @@ lua_saveline defines how to "save" a read line in a "history". 00273 @@ lua_freeline defines how to free a line read by lua_readline. 00274 ** CHANGE them if you want to improve this functionality (e.g., by using 00275 ** GNU readline and history facilities). 00276 */ 00277 #if defined(LUA_USE_READLINE) 00278 #include <stdio.h> 00279 #include <readline/readline.h> 00280 #include <readline/history.h> 00281 #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) 00282 #define lua_saveline(L,idx) \ 00283 if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ 00284 add_history(lua_tostring(L, idx)); /* add it to history */ 00285 #define lua_freeline(L,b) ((void)L, free(b)) 00286 #else 00287 #define lua_readline(L,b,p) \ 00288 ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ 00289 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ 00290 #define lua_saveline(L,idx) { (void)L; (void)idx; } 00291 #define lua_freeline(L,b) { (void)L; (void)b; } 00292 #endif 00293 00294 #endif 00295 00296 /* }================================================================== */ 00297 00298 00299 /* 00300 @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles 00301 @* as a percentage. 00302 ** CHANGE it if you want the GC to run faster or slower (higher values 00303 ** mean larger pauses which mean slower collection.) You can also change 00304 ** this value dynamically. 00305 */ 00306 #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ 00307 00308 00309 /* 00310 @@ LUAI_GCMUL defines the default speed of garbage collection relative to 00311 @* memory allocation as a percentage. 00312 ** CHANGE it if you want to change the granularity of the garbage 00313 ** collection. (Higher values mean coarser collections. 0 represents 00314 ** infinity, where each step performs a full collection.) You can also 00315 ** change this value dynamically. 00316 */ 00317 #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ 00318 00319 00320 00321 /* 00322 @@ LUA_COMPAT_GETN controls compatibility with old getn behavior. 00323 ** CHANGE it (define it) if you want exact compatibility with the 00324 ** behavior of setn/getn in Lua 5.0. 00325 */ 00326 #undef LUA_COMPAT_GETN 00327 00328 /* 00329 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. 00330 ** CHANGE it to undefined as soon as you do not need a global 'loadlib' 00331 ** function (the function is still available as 'package.loadlib'). 00332 */ 00333 #undef LUA_COMPAT_LOADLIB 00334 00335 /* 00336 @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. 00337 ** CHANGE it to undefined as soon as your programs use only '...' to 00338 ** access vararg parameters (instead of the old 'arg' table). 00339 */ 00340 #define LUA_COMPAT_VARARG 00341 00342 /* 00343 @@ LUA_COMPAT_MOD controls compatibility with old math.mod function. 00344 ** CHANGE it to undefined as soon as your programs use 'math.fmod' or 00345 ** the new '%' operator instead of 'math.mod'. 00346 */ 00347 #define LUA_COMPAT_MOD 00348 00349 /* 00350 @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting 00351 @* facility. 00352 ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn 00353 ** off the advisory error when nesting [[...]]. 00354 */ 00355 #define LUA_COMPAT_LSTR 1 00356 00357 /* 00358 @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. 00359 ** CHANGE it to undefined as soon as you rename 'string.gfind' to 00360 ** 'string.gmatch'. 00361 */ 00362 #define LUA_COMPAT_GFIND 00363 00364 /* 00365 @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' 00366 @* behavior. 00367 ** CHANGE it to undefined as soon as you replace to 'luaL_register' 00368 ** your uses of 'luaL_openlib' 00369 */ 00370 #define LUA_COMPAT_OPENLIB 00371 00372 00373 00374 /* 00375 @@ luai_apicheck is the assert macro used by the Lua-C API. 00376 ** CHANGE luai_apicheck if you want Lua to perform some checks in the 00377 ** parameters it gets from API calls. This may slow down the interpreter 00378 ** a bit, but may be quite useful when debugging C code that interfaces 00379 ** with Lua. A useful redefinition is to use assert.h. 00380 */ 00381 #if defined(LUA_USE_APICHECK) 00382 #include <assert.h> 00383 #define luai_apicheck(L,o) { (void)L; assert(o); } 00384 #else 00385 #define luai_apicheck(L,o) { (void)L; } 00386 #endif 00387 00388 00389 /* 00390 @@ LUAI_BITSINT defines the number of bits in an int. 00391 ** CHANGE here if Lua cannot automatically detect the number of bits of 00392 ** your machine. Probably you do not need to change this. 00393 */ 00394 /* avoid overflows in comparison */ 00395 #if INT_MAX-20 < 32760 00396 #define LUAI_BITSINT 16 00397 #elif INT_MAX > 2147483640L 00398 /* int has at least 32 bits */ 00399 #define LUAI_BITSINT 32 00400 #else 00401 #error "you must define LUA_BITSINT with number of bits in an integer" 00402 #endif 00403 00404 00405 /* 00406 @@ LUAI_UINT32 is an unsigned integer with at least 32 bits. 00407 @@ LUAI_INT32 is an signed integer with at least 32 bits. 00408 @@ LUAI_UMEM is an unsigned integer big enough to count the total 00409 @* memory used by Lua. 00410 @@ LUAI_MEM is a signed integer big enough to count the total memory 00411 @* used by Lua. 00412 ** CHANGE here if for some weird reason the default definitions are not 00413 ** good enough for your machine. (The definitions in the 'else' 00414 ** part always works, but may waste space on machines with 64-bit 00415 ** longs.) Probably you do not need to change this. 00416 */ 00417 #if LUAI_BITSINT >= 32 00418 #define LUAI_UINT32 unsigned int 00419 #define LUAI_INT32 int 00420 #define LUAI_MAXINT32 INT_MAX 00421 #define LUAI_UMEM size_t 00422 #define LUAI_MEM ptrdiff_t 00423 #else 00424 /* 16-bit ints */ 00425 #define LUAI_UINT32 unsigned long 00426 #define LUAI_INT32 long 00427 #define LUAI_MAXINT32 LONG_MAX 00428 #define LUAI_UMEM unsigned long 00429 #define LUAI_MEM long 00430 #endif 00431 00432 00433 /* 00434 @@ LUAI_MAXCALLS limits the number of nested calls. 00435 ** CHANGE it if you need really deep recursive calls. This limit is 00436 ** arbitrary; its only purpose is to stop infinite recursion before 00437 ** exhausting memory. 00438 */ 00439 #define LUAI_MAXCALLS 20000 00440 00441 00442 /* 00443 @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function 00444 @* can use. 00445 ** CHANGE it if you need lots of (Lua) stack space for your C 00446 ** functions. This limit is arbitrary; its only purpose is to stop C 00447 ** functions to consume unlimited stack space. 00448 */ 00449 #define LUAI_MAXCSTACK 2048 00450 00451 00452 00453 /* 00454 ** {================================================================== 00455 ** CHANGE (to smaller values) the following definitions if your system 00456 ** has a small C stack. (Or you may want to change them to larger 00457 ** values if your system has a large C stack and these limits are 00458 ** too rigid for you.) Some of these constants control the size of 00459 ** stack-allocated arrays used by the compiler or the interpreter, while 00460 ** others limit the maximum number of recursive calls that the compiler 00461 ** or the interpreter can perform. Values too large may cause a C stack 00462 ** overflow for some forms of deep constructs. 00463 ** =================================================================== 00464 */ 00465 00466 00467 /* 00468 @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and 00469 @* syntactical nested non-terminals in a program. 00470 */ 00471 #define LUAI_MAXCCALLS 200 00472 00473 00474 /* 00475 @@ LUAI_MAXVARS is the maximum number of local variables per function 00476 @* (must be smaller than 250). 00477 */ 00478 #define LUAI_MAXVARS 200 00479 00480 00481 /* 00482 @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function 00483 @* (must be smaller than 250). 00484 */ 00485 #define LUAI_MAXUPVALUES 60 00486 00487 00488 /* 00489 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 00490 */ 00491 #define LUAL_BUFFERSIZE BUFSIZ 00492 00493 /* }================================================================== */ 00494 00495 00496 00497 00498 /* 00499 ** {================================================================== 00500 @@ LUA_NUMBER is the type of numbers in Lua. 00501 ** CHANGE the following definitions only if you want to build Lua 00502 ** with a number type different from double. You may also need to 00503 ** change lua_number2int & lua_number2integer. 00504 ** =================================================================== 00505 */ 00506 00507 //#define LUA_NUMBER_DOUBLE 00508 #define LUA_NUMBER int 00509 00510 /* 00511 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' 00512 @* over a number. 00513 */ 00514 #define LUAI_UACNUMBER int 00515 00516 00517 /* 00518 @@ LUA_NUMBER_SCAN is the format for reading numbers. 00519 @@ LUA_NUMBER_FMT is the format for writing numbers. 00520 @@ lua_number2str converts a number to a string. 00521 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. 00522 @@ lua_str2number converts a string to a number. 00523 */ 00524 #define lua_number2str(s,n) fixed_lua_number2str((s), (n)) 00525 #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ 00526 #define lua_str2number(s,p) fixed_lua_str2number((s), (p)) 00527 00528 00529 /* 00530 @@ The luai_num* macros define the primitive operations over numbers. 00531 */ 00532 #if defined(LUA_CORE) 00533 #include <math.h> 00534 #define luai_numadd(a,b) ((a)+(b)) 00535 #define luai_numsub(a,b) ((a)-(b)) 00536 #define luai_nummul(a,b) (fixed_luai_nummul((a),(b))) 00537 #define luai_numdiv(a,b) (fixed_luai_numdiv((a),(b))) 00538 #define luai_nummod(a,b) (fixed_luai_nummod((a),(b))) 00539 #define luai_numpow(a,b) (fixed_luai_numpow((a),(b))) 00540 #define luai_numunm(a) (-(a)) 00541 #define luai_numeq(a,b) ((a)==(b)) 00542 #define luai_numlt(a,b) ((a)<(b)) 00543 #define luai_numle(a,b) ((a)<=(b)) 00544 #define luai_numisnan(a) (!luai_numeq((a), (a))) 00545 #endif 00546 00547 00548 /* 00549 @@ lua_number2int is a macro to convert lua_Number to int. 00550 @@ lua_number2integer is a macro to convert lua_Number to lua_Integer. 00551 ** CHANGE them if you know a faster way to convert a lua_Number to 00552 ** int (with any rounding method and without throwing errors) in your 00553 ** system. In Pentium machines, a naive typecast from double to int 00554 ** in C is extremely slow, so any alternative is worth trying. 00555 */ 00556 #define lua_number2int(i,d) (i=fixed_lua_number2int(d)) 00557 #define lua_number2integer(i,n) lua_number2int(i, n) 00558 00559 00560 /* }================================================================== */ 00561 00562 00563 /* 00564 @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. 00565 ** CHANGE it if your system requires alignments larger than double. (For 00566 ** instance, if your system supports long doubles and they must be 00567 ** aligned in 16-byte boundaries, then you should add long double in the 00568 ** union.) Probably you do not need to change this. 00569 */ 00570 #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } 00571 00572 00573 /* 00574 @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. 00575 ** CHANGE them if you prefer to use longjmp/setjmp even with C++ 00576 ** or if want/don't to use _longjmp/_setjmp instead of regular 00577 ** longjmp/setjmp. By default, Lua handles errors with exceptions when 00578 ** compiling as C++ code, with _longjmp/_setjmp when asked to use them, 00579 ** and with longjmp/setjmp otherwise. 00580 */ 00581 #if defined(__cplusplus) 00582 /* C++ exceptions */ 00583 #define LUAI_THROW(L,c) throw(c) 00584 #define LUAI_TRY(L,c,a) try { a } catch(...) \ 00585 { if ((c)->status == 0) (c)->status = -1; } 00586 #define luai_jmpbuf int /* dummy variable */ 00587 00588 #elif defined(LUA_USE_ULONGJMP) 00589 /* in Unix, try _longjmp/_setjmp (more efficient) */ 00590 #define LUAI_THROW(L,c) _longjmp((c)->b, 1) 00591 #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } 00592 #define luai_jmpbuf jmp_buf 00593 00594 #else 00595 /* default handling with long jumps */ 00596 #define LUAI_THROW(L,c) longjmp((c)->b, 1) 00597 #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } 00598 #define luai_jmpbuf jmp_buf 00599 00600 #endif 00601 00602 00603 /* 00604 @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern 00605 @* can do during pattern-matching. 00606 ** CHANGE it if you need more captures. This limit is arbitrary. 00607 */ 00608 #define LUA_MAXCAPTURES 32 00609 00610 00611 /* 00612 @@ lua_tmpnam is the function that the OS library uses to create a 00613 @* temporary name. 00614 @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. 00615 ** CHANGE them if you have an alternative to tmpnam (which is considered 00616 ** insecure) or if you want the original tmpnam anyway. By default, Lua 00617 ** uses tmpnam except when POSIX is available, where it uses mkstemp. 00618 */ 00619 #if defined(loslib_c) || defined(luaall_c) 00620 00621 #if defined(LUA_USE_MKSTEMP) 00622 #include <unistd.h> 00623 #define LUA_TMPNAMBUFSIZE 32 00624 #define lua_tmpnam(b,e) { \ 00625 strcpy(b, "/tmp/lua_XXXXXX"); \ 00626 e = mkstemp(b); \ 00627 if (e != -1) close(e); \ 00628 e = (e == -1); } 00629 00630 #else 00631 #define LUA_TMPNAMBUFSIZE L_tmpnam 00632 #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } 00633 #endif 00634 00635 #endif 00636 00637 00638 /* 00639 @@ lua_popen spawns a new process connected to the current one through 00640 @* the file streams. 00641 ** CHANGE it if you have a way to implement it in your system. 00642 */ 00643 #if defined(LUA_USE_POPEN) 00644 00645 #define lua_popen(L,c,m) ((void)L, popen(c,m)) 00646 #define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) 00647 00648 #elif defined(LUA_WIN) 00649 00650 #define lua_popen(L,c,m) ((void)L, _popen(c,m)) 00651 #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) 00652 00653 #else 00654 00655 #define lua_popen(L,c,m) ((void)((void)c, m), \ 00656 luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) 00657 #define lua_pclose(L,file) ((void)((void)L, file), 0) 00658 00659 #endif 00660 00661 /* 00662 @@ LUA_DL_* define which dynamic-library system Lua should use. 00663 ** CHANGE here if Lua has problems choosing the appropriate 00664 ** dynamic-library system for your platform (either Windows' DLL, Mac's 00665 ** dyld, or Unix's dlopen). If your system is some kind of Unix, there 00666 ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for 00667 ** it. To use dlopen you also need to adapt the src/Makefile (probably 00668 ** adding -ldl to the linker options), so Lua does not select it 00669 ** automatically. (When you change the makefile to add -ldl, you must 00670 ** also add -DLUA_USE_DLOPEN.) 00671 ** If you do not want any kind of dynamic library, undefine all these 00672 ** options. 00673 ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. 00674 */ 00675 #if defined(LUA_USE_DLOPEN) 00676 #define LUA_DL_DLOPEN 00677 #endif 00678 00679 #if defined(LUA_WIN) 00680 #define LUA_DL_DLL 00681 #endif 00682 00683 00684 /* 00685 @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State 00686 @* (the data goes just *before* the lua_State pointer). 00687 ** CHANGE (define) this if you really need that. This value must be 00688 ** a multiple of the maximum alignment required for your machine. 00689 */ 00690 #define LUAI_EXTRASPACE 0 00691 00692 00693 /* 00694 @@ luai_userstate* allow user-specific actions on threads. 00695 ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something 00696 ** extra when a thread is created/deleted/resumed/yielded. 00697 */ 00698 #define luai_userstateopen(L) ((void)L) 00699 #define luai_userstateclose(L) ((void)L) 00700 #define luai_userstatethread(L,L1) ((void)L) 00701 #define luai_userstatefree(L) ((void)L) 00702 #define luai_userstateresume(L,n) ((void)L) 00703 #define luai_userstateyield(L,n) ((void)L) 00704 00705 00706 /* 00707 @@ LUA_INTFRMLEN is the length modifier for integer conversions 00708 @* in 'string.format'. 00709 @@ LUA_INTFRM_T is the integer type correspoding to the previous length 00710 @* modifier. 00711 ** CHANGE them if your system supports long long or does not support long. 00712 */ 00713 00714 #if defined(LUA_USELONGLONG) 00715 00716 #define LUA_INTFRMLEN "ll" 00717 #define LUA_INTFRM_T long long 00718 00719 #else 00720 00721 #define LUA_INTFRMLEN "l" 00722 #define LUA_INTFRM_T long 00723 00724 #endif 00725 00726 00727 00728 /* =================================================================== */ 00729 00730 /* 00731 ** Local configuration. You can use this space to add your redefinitions 00732 ** without modifying the main part of the file. 00733 */ 00734 00735 00736 00737 #endif 00738
1.5.3