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