|
|
|||
Warning, file /include/luaconf.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 ** $Id: luaconf.h $ 0003 ** Configuration file for Lua 0004 ** See Copyright Notice in lua.h 0005 */ 0006 0007 0008 #ifndef luaconf_h 0009 #define luaconf_h 0010 0011 #include <limits.h> 0012 #include <stddef.h> 0013 0014 0015 /* 0016 ** =================================================================== 0017 ** General Configuration File for Lua 0018 ** 0019 ** Some definitions here can be changed externally, through the compiler 0020 ** (e.g., with '-D' options): They are commented out or protected 0021 ** by '#if !defined' guards. However, several other definitions 0022 ** should be changed directly here, either because they affect the 0023 ** Lua ABI (by making the changes here, you ensure that all software 0024 ** connected to Lua, such as C libraries, will be compiled with the same 0025 ** configuration); or because they are seldom changed. 0026 ** 0027 ** Search for "@@" to find all configurable definitions. 0028 ** =================================================================== 0029 */ 0030 0031 0032 /* 0033 ** {==================================================================== 0034 ** System Configuration: macros to adapt (if needed) Lua to some 0035 ** particular platform, for instance restricting it to C89. 0036 ** ===================================================================== 0037 */ 0038 0039 /* 0040 @@ LUA_USE_C89 controls the use of non-ISO-C89 features. 0041 ** Define it if you want Lua to avoid the use of a few C99 features 0042 ** or Windows-specific features on Windows. 0043 */ 0044 /* #define LUA_USE_C89 */ 0045 0046 0047 /* 0048 ** By default, Lua on Windows use (some) specific Windows features 0049 */ 0050 #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) 0051 #define LUA_USE_WINDOWS /* enable goodies for regular Windows */ 0052 #endif 0053 0054 0055 #if defined(LUA_USE_WINDOWS) 0056 #define LUA_DL_DLL /* enable support for DLL */ 0057 #define LUA_USE_C89 /* broadly, Windows is C89 */ 0058 #endif 0059 0060 0061 #if defined(LUA_USE_LINUX) 0062 #define LUA_USE_POSIX 0063 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 0064 #endif 0065 0066 0067 #if defined(LUA_USE_MACOSX) 0068 #define LUA_USE_POSIX 0069 #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ 0070 #endif 0071 0072 0073 #if defined(LUA_USE_IOS) 0074 #define LUA_USE_POSIX 0075 #define LUA_USE_DLOPEN 0076 #endif 0077 0078 0079 /* 0080 @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. 0081 */ 0082 #define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) 0083 0084 /* }================================================================== */ 0085 0086 0087 0088 /* 0089 ** {================================================================== 0090 ** Configuration for Number types. These options should not be 0091 ** set externally, because any other code connected to Lua must 0092 ** use the same configuration. 0093 ** =================================================================== 0094 */ 0095 0096 /* 0097 @@ LUA_INT_TYPE defines the type for Lua integers. 0098 @@ LUA_FLOAT_TYPE defines the type for Lua floats. 0099 ** Lua should work fine with any mix of these options supported 0100 ** by your C compiler. The usual configurations are 64-bit integers 0101 ** and 'double' (the default), 32-bit integers and 'float' (for 0102 ** restricted platforms), and 'long'/'double' (for C compilers not 0103 ** compliant with C99, which may not have support for 'long long'). 0104 */ 0105 0106 /* predefined options for LUA_INT_TYPE */ 0107 #define LUA_INT_INT 1 0108 #define LUA_INT_LONG 2 0109 #define LUA_INT_LONGLONG 3 0110 0111 /* predefined options for LUA_FLOAT_TYPE */ 0112 #define LUA_FLOAT_FLOAT 1 0113 #define LUA_FLOAT_DOUBLE 2 0114 #define LUA_FLOAT_LONGDOUBLE 3 0115 0116 0117 /* Default configuration ('long long' and 'double', for 64-bit Lua) */ 0118 #define LUA_INT_DEFAULT LUA_INT_LONGLONG 0119 #define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE 0120 0121 0122 /* 0123 @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. 0124 */ 0125 #define LUA_32BITS 0 0126 0127 0128 /* 0129 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for 0130 ** C89 ('long' and 'double'); Windows always has '__int64', so it does 0131 ** not need to use this case. 0132 */ 0133 #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) 0134 #define LUA_C89_NUMBERS 1 0135 #else 0136 #define LUA_C89_NUMBERS 0 0137 #endif 0138 0139 0140 #if LUA_32BITS /* { */ 0141 /* 0142 ** 32-bit integers and 'float' 0143 */ 0144 #if LUAI_IS32INT /* use 'int' if big enough */ 0145 #define LUA_INT_TYPE LUA_INT_INT 0146 #else /* otherwise use 'long' */ 0147 #define LUA_INT_TYPE LUA_INT_LONG 0148 #endif 0149 #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT 0150 0151 #elif LUA_C89_NUMBERS /* }{ */ 0152 /* 0153 ** largest types available for C89 ('long' and 'double') 0154 */ 0155 #define LUA_INT_TYPE LUA_INT_LONG 0156 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE 0157 0158 #else /* }{ */ 0159 /* use defaults */ 0160 0161 #define LUA_INT_TYPE LUA_INT_DEFAULT 0162 #define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT 0163 0164 #endif /* } */ 0165 0166 0167 /* }================================================================== */ 0168 0169 0170 0171 /* 0172 ** {================================================================== 0173 ** Configuration for Paths. 0174 ** =================================================================== 0175 */ 0176 0177 /* 0178 ** LUA_PATH_SEP is the character that separates templates in a path. 0179 ** LUA_PATH_MARK is the string that marks the substitution points in a 0180 ** template. 0181 ** LUA_EXEC_DIR in a Windows path is replaced by the executable's 0182 ** directory. 0183 */ 0184 #define LUA_PATH_SEP ";" 0185 #define LUA_PATH_MARK "?" 0186 #define LUA_EXEC_DIR "!" 0187 0188 0189 /* 0190 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 0191 ** Lua libraries. 0192 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 0193 ** C libraries. 0194 ** CHANGE them if your machine has a non-conventional directory 0195 ** hierarchy or if you want to install your libraries in 0196 ** non-conventional directories. 0197 */ 0198 0199 #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR 0200 #if defined(_WIN32) /* { */ 0201 /* 0202 ** In Windows, any exclamation mark ('!') in the path is replaced by the 0203 ** path of the directory of the executable file of the current process. 0204 */ 0205 #define LUA_LDIR "!\\lua\\" 0206 #define LUA_CDIR "!\\" 0207 #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" 0208 0209 #if !defined(LUA_PATH_DEFAULT) 0210 #define LUA_PATH_DEFAULT \ 0211 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 0212 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ 0213 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ 0214 ".\\?.lua;" ".\\?\\init.lua" 0215 #endif 0216 0217 #if !defined(LUA_CPATH_DEFAULT) 0218 #define LUA_CPATH_DEFAULT \ 0219 LUA_CDIR"?.dll;" \ 0220 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ 0221 LUA_CDIR"loadall.dll;" ".\\?.dll" 0222 #endif 0223 0224 #else /* }{ */ 0225 0226 #define LUA_ROOT "/usr/local/" 0227 #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" 0228 #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" 0229 0230 #if !defined(LUA_PATH_DEFAULT) 0231 #define LUA_PATH_DEFAULT \ 0232 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 0233 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ 0234 "./?.lua;" "./?/init.lua" 0235 #endif 0236 0237 #if !defined(LUA_CPATH_DEFAULT) 0238 #define LUA_CPATH_DEFAULT \ 0239 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" 0240 #endif 0241 0242 #endif /* } */ 0243 0244 0245 /* 0246 @@ LUA_DIRSEP is the directory separator (for submodules). 0247 ** CHANGE it if your machine does not use "/" as the directory separator 0248 ** and is not Windows. (On Windows Lua automatically uses "\".) 0249 */ 0250 #if !defined(LUA_DIRSEP) 0251 0252 #if defined(_WIN32) 0253 #define LUA_DIRSEP "\\" 0254 #else 0255 #define LUA_DIRSEP "/" 0256 #endif 0257 0258 #endif 0259 0260 /* }================================================================== */ 0261 0262 0263 /* 0264 ** {================================================================== 0265 ** Marks for exported symbols in the C code 0266 ** =================================================================== 0267 */ 0268 0269 /* 0270 @@ LUA_API is a mark for all core API functions. 0271 @@ LUALIB_API is a mark for all auxiliary library functions. 0272 @@ LUAMOD_API is a mark for all standard library opening functions. 0273 ** CHANGE them if you need to define those functions in some special way. 0274 ** For instance, if you want to create one Windows DLL with the core and 0275 ** the libraries, you may want to use the following definition (define 0276 ** LUA_BUILD_AS_DLL to get it). 0277 */ 0278 #if defined(LUA_BUILD_AS_DLL) /* { */ 0279 0280 #if defined(LUA_CORE) || defined(LUA_LIB) /* { */ 0281 #define LUA_API __declspec(dllexport) 0282 #else /* }{ */ 0283 #define LUA_API __declspec(dllimport) 0284 #endif /* } */ 0285 0286 #else /* }{ */ 0287 0288 #define LUA_API extern 0289 0290 #endif /* } */ 0291 0292 0293 /* 0294 ** More often than not the libs go together with the core. 0295 */ 0296 #define LUALIB_API LUA_API 0297 #define LUAMOD_API LUA_API 0298 0299 0300 /* 0301 @@ LUAI_FUNC is a mark for all extern functions that are not to be 0302 ** exported to outside modules. 0303 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, 0304 ** none of which to be exported to outside modules (LUAI_DDEF for 0305 ** definitions and LUAI_DDEC for declarations). 0306 ** CHANGE them if you need to mark them in some special way. Elf/gcc 0307 ** (versions 3.2 and later) mark them as "hidden" to optimize access 0308 ** when Lua is compiled as a shared library. Not all elf targets support 0309 ** this attribute. Unfortunately, gcc does not offer a way to check 0310 ** whether the target offers that support, and those without support 0311 ** give a warning about it. To avoid these warnings, change to the 0312 ** default definition. 0313 */ 0314 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 0315 defined(__ELF__) /* { */ 0316 #define LUAI_FUNC __attribute__((visibility("internal"))) extern 0317 #else /* }{ */ 0318 #define LUAI_FUNC extern 0319 #endif /* } */ 0320 0321 #define LUAI_DDEC(dec) LUAI_FUNC dec 0322 #define LUAI_DDEF /* empty */ 0323 0324 /* }================================================================== */ 0325 0326 0327 /* 0328 ** {================================================================== 0329 ** Compatibility with previous versions 0330 ** =================================================================== 0331 */ 0332 0333 /* 0334 @@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. 0335 ** You can define it to get all options, or change specific options 0336 ** to fit your specific needs. 0337 */ 0338 #if defined(LUA_COMPAT_5_3) /* { */ 0339 0340 /* 0341 @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated 0342 ** functions in the mathematical library. 0343 ** (These functions were already officially removed in 5.3; 0344 ** nevertheless they are still available here.) 0345 */ 0346 #define LUA_COMPAT_MATHLIB 0347 0348 /* 0349 @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for 0350 ** manipulating other integer types (lua_pushunsigned, lua_tounsigned, 0351 ** luaL_checkint, luaL_checklong, etc.) 0352 ** (These macros were also officially removed in 5.3, but they are still 0353 ** available here.) 0354 */ 0355 #define LUA_COMPAT_APIINTCASTS 0356 0357 0358 /* 0359 @@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod 0360 ** using '__lt'. 0361 */ 0362 #define LUA_COMPAT_LT_LE 0363 0364 0365 /* 0366 @@ The following macros supply trivial compatibility for some 0367 ** changes in the API. The macros themselves document how to 0368 ** change your code to avoid using them. 0369 ** (Once more, these macros were officially removed in 5.3, but they are 0370 ** still available here.) 0371 */ 0372 #define lua_strlen(L,i) lua_rawlen(L, (i)) 0373 0374 #define lua_objlen(L,i) lua_rawlen(L, (i)) 0375 0376 #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) 0377 #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) 0378 0379 #endif /* } */ 0380 0381 /* }================================================================== */ 0382 0383 0384 0385 /* 0386 ** {================================================================== 0387 ** Configuration for Numbers (low-level part). 0388 ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* 0389 ** satisfy your needs. 0390 ** =================================================================== 0391 */ 0392 0393 /* 0394 @@ LUAI_UACNUMBER is the result of a 'default argument promotion' 0395 @@ over a floating number. 0396 @@ l_floatatt(x) corrects float attribute 'x' to the proper float type 0397 ** by prefixing it with one of FLT/DBL/LDBL. 0398 @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. 0399 @@ LUA_NUMBER_FMT is the format for writing floats. 0400 @@ lua_number2str converts a float to a string. 0401 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations. 0402 @@ l_floor takes the floor of a float. 0403 @@ lua_str2number converts a decimal numeral to a number. 0404 */ 0405 0406 0407 /* The following definitions are good for most cases here */ 0408 0409 #define l_floor(x) (l_mathop(floor)(x)) 0410 0411 #define lua_number2str(s,sz,n) \ 0412 l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) 0413 0414 /* 0415 @@ lua_numbertointeger converts a float number with an integral value 0416 ** to an integer, or returns 0 if float is not within the range of 0417 ** a lua_Integer. (The range comparisons are tricky because of 0418 ** rounding. The tests here assume a two-complement representation, 0419 ** where MININTEGER always has an exact representation as a float; 0420 ** MAXINTEGER may not have one, and therefore its conversion to float 0421 ** may have an ill-defined value.) 0422 */ 0423 #define lua_numbertointeger(n,p) \ 0424 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ 0425 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ 0426 (*(p) = (LUA_INTEGER)(n), 1)) 0427 0428 0429 /* now the variable definitions */ 0430 0431 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ 0432 0433 #define LUA_NUMBER float 0434 0435 #define l_floatatt(n) (FLT_##n) 0436 0437 #define LUAI_UACNUMBER double 0438 0439 #define LUA_NUMBER_FRMLEN "" 0440 #define LUA_NUMBER_FMT "%.7g" 0441 0442 #define l_mathop(op) op##f 0443 0444 #define lua_str2number(s,p) strtof((s), (p)) 0445 0446 0447 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ 0448 0449 #define LUA_NUMBER long double 0450 0451 #define l_floatatt(n) (LDBL_##n) 0452 0453 #define LUAI_UACNUMBER long double 0454 0455 #define LUA_NUMBER_FRMLEN "L" 0456 #define LUA_NUMBER_FMT "%.19Lg" 0457 0458 #define l_mathop(op) op##l 0459 0460 #define lua_str2number(s,p) strtold((s), (p)) 0461 0462 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ 0463 0464 #define LUA_NUMBER double 0465 0466 #define l_floatatt(n) (DBL_##n) 0467 0468 #define LUAI_UACNUMBER double 0469 0470 #define LUA_NUMBER_FRMLEN "" 0471 #define LUA_NUMBER_FMT "%.14g" 0472 0473 #define l_mathop(op) op 0474 0475 #define lua_str2number(s,p) strtod((s), (p)) 0476 0477 #else /* }{ */ 0478 0479 #error "numeric float type not defined" 0480 0481 #endif /* } */ 0482 0483 0484 0485 /* 0486 @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. 0487 @@ LUAI_UACINT is the result of a 'default argument promotion' 0488 @@ over a LUA_INTEGER. 0489 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. 0490 @@ LUA_INTEGER_FMT is the format for writing integers. 0491 @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. 0492 @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. 0493 @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. 0494 @@ lua_integer2str converts an integer to a string. 0495 */ 0496 0497 0498 /* The following definitions are good for most cases here */ 0499 0500 #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" 0501 0502 #define LUAI_UACINT LUA_INTEGER 0503 0504 #define lua_integer2str(s,sz,n) \ 0505 l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) 0506 0507 /* 0508 ** use LUAI_UACINT here to avoid problems with promotions (which 0509 ** can turn a comparison between unsigneds into a signed comparison) 0510 */ 0511 #define LUA_UNSIGNED unsigned LUAI_UACINT 0512 0513 0514 /* now the variable definitions */ 0515 0516 #if LUA_INT_TYPE == LUA_INT_INT /* { int */ 0517 0518 #define LUA_INTEGER int 0519 #define LUA_INTEGER_FRMLEN "" 0520 0521 #define LUA_MAXINTEGER INT_MAX 0522 #define LUA_MININTEGER INT_MIN 0523 0524 #define LUA_MAXUNSIGNED UINT_MAX 0525 0526 #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ 0527 0528 #define LUA_INTEGER long 0529 #define LUA_INTEGER_FRMLEN "l" 0530 0531 #define LUA_MAXINTEGER LONG_MAX 0532 #define LUA_MININTEGER LONG_MIN 0533 0534 #define LUA_MAXUNSIGNED ULONG_MAX 0535 0536 #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ 0537 0538 /* use presence of macro LLONG_MAX as proxy for C99 compliance */ 0539 #if defined(LLONG_MAX) /* { */ 0540 /* use ISO C99 stuff */ 0541 0542 #define LUA_INTEGER long long 0543 #define LUA_INTEGER_FRMLEN "ll" 0544 0545 #define LUA_MAXINTEGER LLONG_MAX 0546 #define LUA_MININTEGER LLONG_MIN 0547 0548 #define LUA_MAXUNSIGNED ULLONG_MAX 0549 0550 #elif defined(LUA_USE_WINDOWS) /* }{ */ 0551 /* in Windows, can use specific Windows types */ 0552 0553 #define LUA_INTEGER __int64 0554 #define LUA_INTEGER_FRMLEN "I64" 0555 0556 #define LUA_MAXINTEGER _I64_MAX 0557 #define LUA_MININTEGER _I64_MIN 0558 0559 #define LUA_MAXUNSIGNED _UI64_MAX 0560 0561 #else /* }{ */ 0562 0563 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ 0564 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" 0565 0566 #endif /* } */ 0567 0568 #else /* }{ */ 0569 0570 #error "numeric integer type not defined" 0571 0572 #endif /* } */ 0573 0574 /* }================================================================== */ 0575 0576 0577 /* 0578 ** {================================================================== 0579 ** Dependencies with C99 and other C details 0580 ** =================================================================== 0581 */ 0582 0583 /* 0584 @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. 0585 ** (All uses in Lua have only one format item.) 0586 */ 0587 #if !defined(LUA_USE_C89) 0588 #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) 0589 #else 0590 #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) 0591 #endif 0592 0593 0594 /* 0595 @@ lua_strx2number converts a hexadecimal numeral to a number. 0596 ** In C99, 'strtod' does that conversion. Otherwise, you can 0597 ** leave 'lua_strx2number' undefined and Lua will provide its own 0598 ** implementation. 0599 */ 0600 #if !defined(LUA_USE_C89) 0601 #define lua_strx2number(s,p) lua_str2number(s,p) 0602 #endif 0603 0604 0605 /* 0606 @@ lua_pointer2str converts a pointer to a readable string in a 0607 ** non-specified way. 0608 */ 0609 #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) 0610 0611 0612 /* 0613 @@ lua_number2strx converts a float to a hexadecimal numeral. 0614 ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. 0615 ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will 0616 ** provide its own implementation. 0617 */ 0618 #if !defined(LUA_USE_C89) 0619 #define lua_number2strx(L,b,sz,f,n) \ 0620 ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) 0621 #endif 0622 0623 0624 /* 0625 ** 'strtof' and 'opf' variants for math functions are not valid in 0626 ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the 0627 ** availability of these variants. ('math.h' is already included in 0628 ** all files that use these macros.) 0629 */ 0630 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) 0631 #undef l_mathop /* variants not available */ 0632 #undef lua_str2number 0633 #define l_mathop(op) (lua_Number)op /* no variant */ 0634 #define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) 0635 #endif 0636 0637 0638 /* 0639 @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation 0640 ** functions. It must be a numerical type; Lua will use 'intptr_t' if 0641 ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to 0642 ** 'intptr_t' in C89) 0643 */ 0644 #define LUA_KCONTEXT ptrdiff_t 0645 0646 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ 0647 __STDC_VERSION__ >= 199901L 0648 #include <stdint.h> 0649 #if defined(INTPTR_MAX) /* even in C99 this type is optional */ 0650 #undef LUA_KCONTEXT 0651 #define LUA_KCONTEXT intptr_t 0652 #endif 0653 #endif 0654 0655 0656 /* 0657 @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). 0658 ** Change that if you do not want to use C locales. (Code using this 0659 ** macro must include the header 'locale.h'.) 0660 */ 0661 #if !defined(lua_getlocaledecpoint) 0662 #define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) 0663 #endif 0664 0665 0666 /* 0667 ** macros to improve jump prediction, used mostly for error handling 0668 ** and debug facilities. (Some macros in the Lua API use these macros. 0669 ** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your 0670 ** code.) 0671 */ 0672 #if !defined(luai_likely) 0673 0674 #if defined(__GNUC__) && !defined(LUA_NOBUILTIN) 0675 #define luai_likely(x) (__builtin_expect(((x) != 0), 1)) 0676 #define luai_unlikely(x) (__builtin_expect(((x) != 0), 0)) 0677 #else 0678 #define luai_likely(x) (x) 0679 #define luai_unlikely(x) (x) 0680 #endif 0681 0682 #endif 0683 0684 0685 #if defined(LUA_CORE) || defined(LUA_LIB) 0686 /* shorter names for Lua's own use */ 0687 #define l_likely(x) luai_likely(x) 0688 #define l_unlikely(x) luai_unlikely(x) 0689 #endif 0690 0691 0692 0693 /* }================================================================== */ 0694 0695 0696 /* 0697 ** {================================================================== 0698 ** Language Variations 0699 ** ===================================================================== 0700 */ 0701 0702 /* 0703 @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some 0704 ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from 0705 ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic 0706 ** coercion from strings to numbers. 0707 */ 0708 /* #define LUA_NOCVTN2S */ 0709 /* #define LUA_NOCVTS2N */ 0710 0711 0712 /* 0713 @@ LUA_USE_APICHECK turns on several consistency checks on the C API. 0714 ** Define it as a help when debugging C code. 0715 */ 0716 #if defined(LUA_USE_APICHECK) 0717 #include <assert.h> 0718 #define luai_apicheck(l,e) assert(e) 0719 #endif 0720 0721 /* }================================================================== */ 0722 0723 0724 /* 0725 ** {================================================================== 0726 ** Macros that affect the API and must be stable (that is, must be the 0727 ** same when you compile Lua and when you compile code that links to 0728 ** Lua). 0729 ** ===================================================================== 0730 */ 0731 0732 /* 0733 @@ LUAI_MAXSTACK limits the size of the Lua stack. 0734 ** CHANGE it if you need a different limit. This limit is arbitrary; 0735 ** its only purpose is to stop Lua from consuming unlimited stack 0736 ** space (and to reserve some numbers for pseudo-indices). 0737 ** (It must fit into max(size_t)/32 and max(int)/2.) 0738 */ 0739 #if LUAI_IS32INT 0740 #define LUAI_MAXSTACK 1000000 0741 #else 0742 #define LUAI_MAXSTACK 15000 0743 #endif 0744 0745 0746 /* 0747 @@ LUA_EXTRASPACE defines the size of a raw memory area associated with 0748 ** a Lua state with very fast access. 0749 ** CHANGE it if you need a different size. 0750 */ 0751 #define LUA_EXTRASPACE (sizeof(void *)) 0752 0753 0754 /* 0755 @@ LUA_IDSIZE gives the maximum size for the description of the source 0756 ** of a function in debug information. 0757 ** CHANGE it if you want a different size. 0758 */ 0759 #define LUA_IDSIZE 60 0760 0761 0762 /* 0763 @@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib 0764 ** buffer system. 0765 */ 0766 #define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) 0767 0768 0769 /* 0770 @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure 0771 ** maximum alignment for the other items in that union. 0772 */ 0773 #define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l 0774 0775 /* }================================================================== */ 0776 0777 0778 0779 0780 0781 /* =================================================================== */ 0782 0783 /* 0784 ** Local configuration. You can use this space to add your redefinitions 0785 ** without modifying the main part of the file. 0786 */ 0787 0788 0789 0790 0791 0792 #endif 0793
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|