L0001 /* L0002 ** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ L0003 ** Configuration file for Lua L0004 ** See Copyright Notice in lua.h L0005 */ L0006 L0007 L0008 #ifndef lconfig_h L0009 #define lconfig_h L0010 L0011 #include <limits.h> L0012 #include <stddef.h> L0013 L0014 L0015 /* L0016 ** ================================================================== L0017 ** Search for "@@" to find all configurable definitions. L0018 ** =================================================================== L0019 */ L0020 L0021 L0022 /* L0023 @@ LUA_ANSI controls the use of non-ansi features. L0024 ** CHANGE it (define it) if you want Lua to avoid the use of any L0025 ** non-ansi feature or library. L0026 */ L0027 #if defined(__STRICT_ANSI__) L0028 #define LUA_ANSI L0029 #endif L0030 L0031 L0032 #if !defined(LUA_ANSI) && defined(_WIN32) L0033 #define LUA_WIN L0034 #endif L0035 L0036 #if defined(LUA_USE_LINUX) L0037 #define LUA_USE_POSIX L0038 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ L0039 #define LUA_USE_READLINE /* needs some extra libraries */ L0040 #endif L0041 L0042 #if defined(LUA_USE_MACOSX) L0043 #define LUA_USE_POSIX L0044 #define LUA_DL_DYLD /* does not need extra library */ L0045 #endif L0046 L0047 L0048 L0049 /* L0050 @@ LUA_USE_POSIX includes all functionallity listed as X/Open System L0051 @* Interfaces Extension (XSI). L0052 ** CHANGE it (define it) if your system is XSI compatible. L0053 */ L0054 #if defined(LUA_USE_POSIX) L0055 #define LUA_USE_MKSTEMP L0056 #define LUA_USE_ISATTY L0057 #define LUA_USE_POPEN L0058 #define LUA_USE_ULONGJMP L0059 #endif L0060 L0061 L0062 /* L0063 @@ LUA_PATH and LUA_CPATH are the names of the environment variables that L0064 @* Lua check to set its paths. L0065 @@ LUA_INIT is the name of the environment variable that Lua L0066 @* checks for initialization code. L0067 ** CHANGE them if you want different names. L0068 */ L0069 #define LUA_PATH "LUA_PATH" L0070 #define LUA_CPATH "LUA_CPATH" L0071 #define LUA_INIT "LUA_INIT" L0072 L0073 L0074 /* L0075 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for L0076 @* Lua libraries. L0077 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for L0078 @* C libraries. L0079 ** CHANGE them if your machine has a non-conventional directory L0080 ** hierarchy or if you want to install your libraries in L0081 ** non-conventional directories. L0082 */ L0083 #if defined(_WIN32) L0084 /* L0085 ** In Windows, any exclamation mark ('!') in the path is replaced by the L0086 ** path of the directory of the executable file of the current process. L0087 */ L0088 #define LUA_LDIR "!\\lua\\" L0089 #define LUA_CDIR "!\\" L0090 #define LUA_PATH_DEFAULT \ L0091 ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ L0092 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" L0093 #define LUA_CPATH_DEFAULT \ L0094 ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" L0095 L0096 #else L0097 #define LUA_ROOT "/usr/local/" L0098 #define LUA_LDIR LUA_ROOT "share/lua/5.1/" L0099 #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" L0100 #define LUA_PATH_DEFAULT \ L0101 "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ L0102 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" L0103 #define LUA_CPATH_DEFAULT \ L0104 "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" L0105 #endif L0106 L0107 L0108 /* L0109 @@ LUA_DIRSEP is the directory separator (for submodules). L0110 ** CHANGE it if your machine does not use "/" as the directory separator L0111 ** and is not Windows. (On Windows Lua automatically uses "\".) L0112 */ L0113 #if defined(_WIN32) L0114 #define LUA_DIRSEP "\\" L0115 #else L0116 #define LUA_DIRSEP "/" L0117 #endif L0118 L0119 L0120 /* L0121 @@ LUA_PATHSEP is the character that separates templates in a path. L0122 @@ LUA_PATH_MARK is the string that marks the substitution points in a L0123 @* template. L0124 @@ LUA_EXECDIR in a Windows path is replaced by the executable's L0125 @* directory. L0126 @@ LUA_IGMARK is a mark to ignore all before it when bulding the L0127 @* luaopen_ function name. L0128 ** CHANGE them if for some reason your system cannot use those L0129 ** characters. (E.g., if one of those characters is a common character L0130 ** in file/directory names.) Probably you do not need to change them. L0131 */ L0132 #define LUA_PATHSEP ";" L0133 #define LUA_PATH_MARK "?" L0134 #define LUA_EXECDIR "!" L0135 #define LUA_IGMARK "-" L0136 L0137 L0138 /* L0139 @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. L0140 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most L0141 ** machines, ptrdiff_t gives a good choice between int or long.) L0142 */ L0143 #define LUA_INTEGER ptrdiff_t L0144 L0145 L0146 /* L0147 @@ LUA_API is a mark for all core API functions. L0148 @@ LUALIB_API is a mark for all standard library functions. L0149 ** CHANGE them if you need to define those functions in some special way. L0150 ** For instance, if you want to create one Windows DLL with the core and L0151 ** the libraries, you may want to use the following definition (define L0152 ** LUA_BUILD_AS_DLL to get it). L0153 */ L0154 #if defined(LUA_BUILD_AS_DLL) L0155 L0156 #if defined(LUA_CORE) || defined(LUA_LIB) L0157 #define LUA_API __declspec(dllexport) L0158 #else L0159 #define LUA_API __declspec(dllimport) L0160 #endif L0161 L0162 #else L0163 L0164 #define LUA_API extern L0165 L0166 #endif L0167 L0168 /* more often than not the libs go together with the core */ L0169 #define LUALIB_API LUA_API L0170 L0171 L0172 /* L0173 @@ LUAI_FUNC is a mark for all extern functions that are not to be L0174 @* exported to outside modules. L0175 @@ LUAI_DATA is a mark for all extern (const) variables that are not to L0176 @* be exported to outside modules. L0177 ** CHANGE them if you need to mark them in some special way. Elf/gcc L0178 ** (versions 3.2 and later) mark them as "hidden" to optimize access L0179 ** when Lua is compiled as a shared library. L0180 */ L0181 #if defined(luaall_c) L0182 #define LUAI_FUNC static L0183 #define LUAI_DATA /* empty */ L0184 L0185 #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ L0186 defined(__ELF__) L0187 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern L0188 #define LUAI_DATA LUAI_FUNC L0189 L0190 #else L0191 #define LUAI_FUNC extern L0192 #define LUAI_DATA extern L0193 #endif L0194 L0195 L0196 L0197 /* L0198 @@ LUA_QL describes how error messages quote program elements. L0199 ** CHANGE it if you want a different appearance. L0200 */ L0201 #define LUA_QL(x) "'" x "'" L0202 #define LUA_QS LUA_QL("%s") L0203 L0204 L0205 /* L0206 @@ LUA_IDSIZE gives the maximum size for the description of the source L0207 @* of a function in debug information. L0208 ** CHANGE it if you want a different size. L0209 */ L0210 #define LUA_IDSIZE 60 L0211 L0212 L0213 /* L0214 ** {================================================================== L0215 ** Stand-alone configuration L0216 ** =================================================================== L0217 */ L0218 L0219 #if defined(lua_c) || defined(luaall_c) L0220 L0221 /* L0222 @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that L0223 @* is, whether we're running lua interactively). L0224 ** CHANGE it if you have a better definition for non-POSIX/non-Windows L0225 ** systems. L0226 */ L0227 #if defined(LUA_USE_ISATTY) L0228 #include <unistd.h> L0229 #define lua_stdin_is_tty() isatty(0) L0230 #elif defined(LUA_WIN) L0231 #include <io.h> L0232 #include <stdio.h> L0233 #define lua_stdin_is_tty() _isatty(_fileno(stdin)) L0234 #else L0235 #define lua_stdin_is_tty() 1 /* assume stdin is a tty */ L0236 #endif L0237 L0238 L0239 /* L0240 @@ LUA_PROMPT is the default prompt used by stand-alone Lua. L0241 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. L0242 ** CHANGE them if you want different prompts. (You can also change the L0243 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) L0244 */ L0245 #define LUA_PROMPT "> " L0246 #define LUA_PROMPT2 ">> " L0247 L0248 L0249 /* L0250 @@ LUA_PROGNAME is the default name for the stand-alone Lua program. L0251 ** CHANGE it if your stand-alone interpreter has a different name and L0252 ** your system is not able to detect that name automatically. L0253 */ L0254 #define LUA_PROGNAME "lua" L0255 L0256 L0257 /* L0258 @@ LUA_MAXINPUT is the maximum length for an input line in the L0259 @* stand-alone interpreter. L0260 ** CHANGE it if you need longer lines. L0261 */ L0262 #define LUA_MAXINPUT 512 L0263 L0264 L0265 /* L0266 @@ lua_readline defines how to show a prompt and then read a line from L0267 @* the standard input. L0268 @@ lua_saveline defines how to "save" a read line in a "history". L0269 @@ lua_freeline defines how to free a line read by lua_readline. L0270 ** CHANGE them if you want to improve this functionality (e.g., by using L0271 ** GNU readline and history facilities). L0272 */ L0273 #if defined(LUA_USE_READLINE) L0274 #include <stdio.h> L0275 #include <readline/readline.h> L0276 #include <readline/history.h> L0277 #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) L0278 #define lua_saveline(L,idx) \ L0279 if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ L0280 add_history(lua_tostring(L, idx)); /* add it to history */ L0281 #define lua_freeline(L,b) ((void)L, free(b)) L0282 #else L0283 #define lua_readline(L,b,p) \ L0284 ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ L0285 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ L0286 #define lua_saveline(L,idx) { (void)L; (void)idx; } L0287 #define lua_freeline(L,b) { (void)L; (void)b; } L0288 #endif L0289 L0290 #endif L0291 L0292 /* }================================================================== */ L0293 L0294 L0295 /* L0296 @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles L0297 @* as a percentage. L0298 ** CHANGE it if you want the GC to run faster or slower (higher values L0299 ** mean larger pauses which mean slower collection.) You can also change L0300 ** this value dynamically. L0301 */ L0302 #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ L0303 L0304 L0305 /* L0306 @@ LUAI_GCMUL defines the default speed of garbage collection relative to L0307 @* memory allocation as a percentage. L0308 ** CHANGE it if you want to change the granularity of the garbage L0309 ** collection. (Higher values mean coarser collections. 0 represents L0310 ** infinity, where each step performs a full collection.) You can also L0311 ** change this value dynamically. L0312 */ L0313 #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ L0314 L0315 L0316 L0317 /* L0318 @@ LUA_COMPAT_GETN controls compatibility with old getn behavior. L0319 ** CHANGE it (define it) if you want exact compatibility with the L0320 ** behavior of setn/getn in Lua 5.0. L0321 */ L0322 #undef LUA_COMPAT_GETN L0323 L0324 /* L0325 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. L0326 ** CHANGE it to undefined as soon as you do not need a global 'loadlib' L0327 ** function (the function is still available as 'package.loadlib'). L0328 */ L0329 #undef LUA_COMPAT_LOADLIB L0330 L0331 /* L0332 @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. L0333 ** CHANGE it to undefined as soon as your programs use only '...' to L0334 ** access vararg parameters (instead of the old 'arg' table). L0335 */ L0336 #define LUA_COMPAT_VARARG L0337 L0338 /* L0339 @@ LUA_COMPAT_MOD controls compatibility with old math.mod function. L0340 ** CHANGE it to undefined as soon as your programs use 'math.fmod' or L0341 ** the new '%' operator instead of 'math.mod'. L0342 */ L0343 #define LUA_COMPAT_MOD L0344 L0345 /* L0346 @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting L0347 @* facility. L0348 ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn L0349 ** off the advisory error when nesting [[...]]. L0350 */ L0351 #define LUA_COMPAT_LSTR 1 L0352 L0353 /* L0354 @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. L0355 ** CHANGE it to undefined as soon as you rename 'string.gfind' to L0356 ** 'string.gmatch'. L0357 */ L0358 #define LUA_COMPAT_GFIND L0359 L0360 /* L0361 @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' L0362 @* behavior. L0363 ** CHANGE it to undefined as soon as you replace to 'luaL_register' L0364 ** your uses of 'luaL_openlib' L0365 */ L0366 #define LUA_COMPAT_OPENLIB L0367 L0368 L0369 L0370 /* L0371 @@ luai_apicheck is the assert macro used by the Lua-C API. L0372 ** CHANGE luai_apicheck if you want Lua to perform some checks in the L0373 ** parameters it gets from API calls. This may slow down the interpreter L0374 ** a bit, but may be quite useful when debugging C code that interfaces L0375 ** with Lua. A useful redefinition is to use assert.h. L0376 */ L0377 #if defined(LUA_USE_APICHECK) L0378 #include <assert.h> L0379 #define luai_apicheck(L,o) { (void)L; assert(o); } L0380 #else L0381 #define luai_apicheck(L,o) { (void)L; } L0382 #endif L0383 L0384 L0385 /* L0386 @@ LUAI_BITSINT defines the number of bits in an int. L0387 ** CHANGE here if Lua cannot automatically detect the number of bits of L0388 ** your machine. Probably you do not need to change this. L0389 */ L0390 /* avoid overflows in comparison */ L0391 #if INT_MAX-20 < 32760 L0392 #define LUAI_BITSINT 16 L0393 #elif INT_MAX > 2147483640L L0394 /* int has at least 32 bits */ L0395 #define LUAI_BITSINT 32 L0396 #else L0397 #error "you must define LUA_BITSINT with number of bits in an integer" L0398 #endif L0399 L0400 L0401 /* L0402 @@ LUAI_UINT32 is an unsigned integer with at least 32 bits. L0403 @@ LUAI_INT32 is an signed integer with at least 32 bits. L0404 @@ LUAI_UMEM is an unsigned integer big enough to count the total L0405 @* memory used by Lua. L0406 @@ LUAI_MEM is a signed integer big enough to count the total memory L0407 @* used by Lua. L0408 ** CHANGE here if for some weird reason the default definitions are not L0409 ** good enough for your machine. (The definitions in the 'else' L0410 ** part always works, but may waste space on machines with 64-bit L0411 ** longs.) Probably you do not need to change this. L0412 */ L0413 #if LUAI_BITSINT >= 32 L0414 #define LUAI_UINT32 unsigned int L0415 #define LUAI_INT32 int L0416 #define LUAI_MAXINT32 INT_MAX L0417 #define LUAI_UMEM size_t L0418 #define LUAI_MEM ptrdiff_t L0419 #else L0420 /* 16-bit ints */ L0421 #define LUAI_UINT32 unsigned long L0422 #define LUAI_INT32 long L0423 #define LUAI_MAXINT32 LONG_MAX L0424 #define LUAI_UMEM unsigned long L0425 #define LUAI_MEM long L0426 #endif L0427 L0428 L0429 /* L0430 @@ LUAI_MAXCALLS limits the number of nested calls. L0431 ** CHANGE it if you need really deep recursive calls. This limit is L0432 ** arbitrary; its only purpose is to stop infinite recursion before L0433 ** exhausting memory. L0434 */ L0435 #define LUAI_MAXCALLS 20000 L0436 L0437 L0438 /* L0439 @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function L0440 @* can use. L0441 ** CHANGE it if you need lots of (Lua) stack space for your C L0442 ** functions. This limit is arbitrary; its only purpose is to stop C L0443 ** functions to consume unlimited stack space. (must be smaller than L0444 ** -LUA_REGISTRYINDEX) L0445 */ L0446 #define LUAI_MAXCSTACK 8000 L0447 L0448 L0449 L0450 /* L0451 ** {================================================================== L0452 ** CHANGE (to smaller values) the following definitions if your system L0453 ** has a small C stack. (Or you may want to change them to larger L0454 ** values if your system has a large C stack and these limits are L0455 ** too rigid for you.) Some of these constants control the size of L0456 ** stack-allocated arrays used by the compiler or the interpreter, while L0457 ** others limit the maximum number of recursive calls that the compiler L0458 ** or the interpreter can perform. Values too large may cause a C stack L0459 ** overflow for some forms of deep constructs. L0460 ** =================================================================== L0461 */ L0462 L0463 L0464 /* L0465 @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and L0466 @* syntactical nested non-terminals in a program. L0467 */ L0468 #define LUAI_MAXCCALLS 200 L0469 L0470 L0471 /* L0472 @@ LUAI_MAXVARS is the maximum number of local variables per function L0473 @* (must be smaller than 250). L0474 */ L0475 #define LUAI_MAXVARS 200 L0476 L0477 L0478 /* L0479 @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function L0480 @* (must be smaller than 250). L0481 */ L0482 #define LUAI_MAXUPVALUES 60 L0483 L0484 L0485 /* L0486 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. L0487 */ L0488 #define LUAL_BUFFERSIZE BUFSIZ L0489 L0490 /* }================================================================== */ L0491 L0492 L0493 L0494 L0495 /* L0496 ** {================================================================== L0497 @@ LUA_NUMBER is the type of numbers in Lua. L0498 ** CHANGE the following definitions only if you want to build Lua L0499 ** with a number type different from double. You may also need to L0500 ** change lua_number2int & lua_number2integer. L0501 ** =================================================================== L0502 */ L0503 L0504 #define LUA_NUMBER_DOUBLE L0505 #define LUA_NUMBER double L0506 L0507 /* L0508 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' L0509 @* over a number. L0510 */ L0511 #define LUAI_UACNUMBER double L0512 L0513 L0514 /* L0515 @@ LUA_NUMBER_SCAN is the format for reading numbers. L0516 @@ LUA_NUMBER_FMT is the format for writing numbers. L0517 @@ lua_number2str converts a number to a string. L0518 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. L0519 @@ lua_str2number converts a string to a number. L0520 */ L0521 #define LUA_NUMBER_SCAN "%lf" L0522 #define LUA_NUMBER_FMT "%.14g" L0523 #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) L0524 #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ L0525 #define lua_str2number(s,p) strtod((s), (p)) L0526 L0527 L0528 /* L0529 @@ The luai_num* macros define the primitive operations over numbers. L0530 */ L0531 #if defined(LUA_CORE) L0532 #include <math.h> L0533 #define luai_numadd(a,b) ((a)+(b)) L0534 #define luai_numsub(a,b) ((a)-(b)) L0535 #define luai_nummul(a,b) ((a)*(b)) L0536 #define luai_numdiv(a,b) ((a)/(b)) L0537 #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) L0538 #define luai_numpow(a,b) (pow(a,b)) L0539 #define luai_numunm(a) (-(a)) L0540 #define luai_numeq(a,b) ((a)==(b)) L0541 #define luai_numlt(a,b) ((a)<(b)) L0542 #define luai_numle(a,b) ((a)<=(b)) L0543 #define luai_numisnan(a) (!luai_numeq((a), (a))) L0544 #endif L0545 L0546 L0547 /* L0548 @@ lua_number2int is a macro to convert lua_Number to int. L0549 @@ lua_number2integer is a macro to convert lua_Number to lua_Integer. L0550 ** CHANGE them if you know a faster way to convert a lua_Number to L0551 ** int (with any rounding method and without throwing errors) in your L0552 ** system. In Pentium machines, a naive typecast from double to int L0553 ** in C is extremely slow, so any alternative is worth trying. L0554 */ L0555 L0556 /* On a Pentium, resort to a trick */ L0557 #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ L0558 (defined(__i386) || defined (_M_IX86) || defined(__i386__)) L0559 L0560 /* On a Microsoft compiler, use assembler */ L0561 #if defined(_MSC_VER) L0562 L0563 #define lua_number2int(i,d) __asm fld d __asm fistp i L0564 #define lua_number2integer(i,n) lua_number2int(i, n) L0565 L0566 /* the next trick should work on any Pentium, but sometimes clashes L0567 with a DirectX idiosyncrasy */ L0568 #else L0569 L0570 union luai_Cast { double l_d; long l_l; }; L0571 #define lua_number2int(i,d) \ L0572 { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } L0573 #define lua_number2integer(i,n) lua_number2int(i, n) L0574 L0575 #endif L0576 L0577 L0578 /* this option always works, but may be slow */ L0579 #else L0580 #define lua_number2int(i,d) ((i)=(int)(d)) L0581 #define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) L0582 L0583 #endif L0584 L0585 /* }================================================================== */ L0586 L0587 L0588 /* L0589 @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. L0590 ** CHANGE it if your system requires alignments larger than double. (For L0591 ** instance, if your system supports long doubles and they must be L0592 ** aligned in 16-byte boundaries, then you should add long double in the L0593 ** union.) Probably you do not need to change this. L0594 */ L0595 #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } L0596 L0597 L0598 /* L0599 @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. L0600 ** CHANGE them if you prefer to use longjmp/setjmp even with C++ L0601 ** or if want/don't to use _longjmp/_setjmp instead of regular L0602 ** longjmp/setjmp. By default, Lua handles errors with exceptions when L0603 ** compiling as C++ code, with _longjmp/_setjmp when asked to use them, L0604 ** and with longjmp/setjmp otherwise. L0605 */ L0606 #if defined(__cplusplus) L0607 /* C++ exceptions */ L0608 #define LUAI_THROW(L,c) throw(c) L0609 #define LUAI_TRY(L,c,a) try { a } catch(...) \ L0610 { if ((c)->status == 0) (c)->status = -1; } L0611 #define luai_jmpbuf int /* dummy variable */ L0612 L0613 #elif defined(LUA_USE_ULONGJMP) L0614 /* in Unix, try _longjmp/_setjmp (more efficient) */ L0615 #define LUAI_THROW(L,c) _longjmp((c)->b, 1) L0616 #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } L0617 #define luai_jmpbuf jmp_buf L0618 L0619 #else L0620 /* default handling with long jumps */ L0621 #define LUAI_THROW(L,c) longjmp((c)->b, 1) L0622 #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } L0623 #define luai_jmpbuf jmp_buf L0624 L0625 #endif L0626 L0627 L0628 /* L0629 @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern L0630 @* can do during pattern-matching. L0631 ** CHANGE it if you need more captures. This limit is arbitrary. L0632 */ L0633 #define LUA_MAXCAPTURES 32 L0634 L0635 L0636 /* L0637 @@ lua_tmpnam is the function that the OS library uses to create a L0638 @* temporary name. L0639 @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. L0640 ** CHANGE them if you have an alternative to tmpnam (which is considered L0641 ** insecure) or if you want the original tmpnam anyway. By default, Lua L0642 ** uses tmpnam except when POSIX is available, where it uses mkstemp. L0643 */ L0644 #if defined(loslib_c) || defined(luaall_c) L0645 L0646 #if defined(LUA_USE_MKSTEMP) L0647 #include <unistd.h> L0648 #define LUA_TMPNAMBUFSIZE 32 L0649 #define lua_tmpnam(b,e) { \ L0650 strcpy(b, "/tmp/lua_XXXXXX"); \ L0651 e = mkstemp(b); \ L0652 if (e != -1) close(e); \ L0653 e = (e == -1); } L0654 L0655 #else L0656 #define LUA_TMPNAMBUFSIZE L_tmpnam L0657 #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } L0658 #endif L0659 L0660 #endif L0661 L0662 L0663 /* L0664 @@ lua_popen spawns a new process connected to the current one through L0665 @* the file streams. L0666 ** CHANGE it if you have a way to implement it in your system. L0667 */ L0668 #if defined(LUA_USE_POPEN) L0669 L0670 #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) L0671 #define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) L0672 L0673 #elif defined(LUA_WIN) L0674 L0675 #define lua_popen(L,c,m) ((void)L, _popen(c,m)) L0676 #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) L0677 L0678 #else L0679 L0680 #define lua_popen(L,c,m) ((void)((void)c, m), \ L0681 luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) L0682 #define lua_pclose(L,file) ((void)((void)L, file), 0) L0683 L0684 #endif L0685 L0686 /* L0687 @@ LUA_DL_* define which dynamic-library system Lua should use. L0688 ** CHANGE here if Lua has problems choosing the appropriate L0689 ** dynamic-library system for your platform (either Windows' DLL, Mac's L0690 ** dyld, or Unix's dlopen). If your system is some kind of Unix, there L0691 ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for L0692 ** it. To use dlopen you also need to adapt the src/Makefile (probably L0693 ** adding -ldl to the linker options), so Lua does not select it L0694 ** automatically. (When you change the makefile to add -ldl, you must L0695 ** also add -DLUA_USE_DLOPEN.) L0696 ** If you do not want any kind of dynamic library, undefine all these L0697 ** options. L0698 ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. L0699 */ L0700 #if defined(LUA_USE_DLOPEN) L0701 #define LUA_DL_DLOPEN L0702 #endif L0703 L0704 #if defined(LUA_WIN) L0705 #define LUA_DL_DLL L0706 #endif L0707 L0708 L0709 /* L0710 @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State L0711 @* (the data goes just *before* the lua_State pointer). L0712 ** CHANGE (define) this if you really need that. This value must be L0713 ** a multiple of the maximum alignment required for your machine. L0714 */ L0715 #define LUAI_EXTRASPACE 0 L0716 L0717 L0718 /* L0719 @@ luai_userstate* allow user-specific actions on threads. L0720 ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something L0721 ** extra when a thread is created/deleted/resumed/yielded. L0722 */ L0723 #define luai_userstateopen(L) ((void)L) L0724 #define luai_userstateclose(L) ((void)L) L0725 #define luai_userstatethread(L,L1) ((void)L) L0726 #define luai_userstatefree(L) ((void)L) L0727 #define luai_userstateresume(L,n) ((void)L) L0728 #define luai_userstateyield(L,n) ((void)L) L0729 L0730 L0731 /* L0732 @@ LUA_INTFRMLEN is the length modifier for integer conversions L0733 @* in 'string.format'. L0734 @@ LUA_INTFRM_T is the integer type correspoding to the previous length L0735 @* modifier. L0736 ** CHANGE them if your system supports long long or does not support long. L0737 */ L0738 L0739 #if defined(LUA_USELONGLONG) L0740 L0741 #define LUA_INTFRMLEN "ll" L0742 #define LUA_INTFRM_T long long L0743 L0744 #else L0745 L0746 #define LUA_INTFRMLEN "l" L0747 #define LUA_INTFRM_T long L0748 L0749 #endif L0750 L0751 L0752 L0753 /* =================================================================== */ L0754 L0755 /* L0756 ** Local configuration. You can use this space to add your redefinitions L0757 ** without modifying the main part of the file. L0758 */ L0759 L0760 L0761 L0762 #endif L0763