luaconf.h (21644B)
1 /* 2 ** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ 3 ** Configuration file for Lua 4 ** See Copyright Notice in lua.h 5 */ 6 7 8 #ifndef luaconf_h 9 #define luaconf_h 10 11 #include <limits.h> 12 #include <stddef.h> 13 14 15 /* 16 ** =================================================================== 17 ** Search for "@@" to find all configurable definitions. 18 ** =================================================================== 19 */ 20 21 22 /* 23 ** {==================================================================== 24 ** System Configuration: macros to adapt (if needed) Lua to some 25 ** particular platform, for instance compiling it with 32-bit numbers or 26 ** restricting it to C89. 27 ** ===================================================================== 28 */ 29 30 /* 31 @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You 32 ** can also define LUA_32BITS in the make file, but changing here you 33 ** ensure that all software connected to Lua will be compiled with the 34 ** same configuration. 35 */ 36 /* #define LUA_32BITS */ 37 38 39 /* 40 @@ LUA_USE_C89 controls the use of non-ISO-C89 features. 41 ** Define it if you want Lua to avoid the use of a few C99 features 42 ** or Windows-specific features on Windows. 43 */ 44 /* #define LUA_USE_C89 */ 45 46 47 /* 48 ** By default, Lua on Windows use (some) specific Windows features 49 */ 50 #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) 51 #define LUA_USE_WINDOWS /* enable goodies for regular Windows */ 52 #endif 53 54 55 #if defined(LUA_USE_WINDOWS) 56 #define LUA_DL_DLL /* enable support for DLL */ 57 #define LUA_USE_C89 /* broadly, Windows is C89 */ 58 #endif 59 60 61 #if defined(LUA_USE_LINUX) 62 #define LUA_USE_POSIX 63 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 64 #define LUA_USE_READLINE /* needs some extra libraries */ 65 #endif 66 67 68 #if defined(LUA_USE_MACOSX) 69 #define LUA_USE_POSIX 70 #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ 71 #define LUA_USE_READLINE /* needs an extra library: -lreadline */ 72 #endif 73 74 75 /* 76 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for 77 ** C89 ('long' and 'double'); Windows always has '__int64', so it does 78 ** not need to use this case. 79 */ 80 #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) 81 #define LUA_C89_NUMBERS 82 #endif 83 84 85 86 /* 87 @@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. 88 */ 89 /* avoid undefined shifts */ 90 #if ((INT_MAX >> 15) >> 15) >= 1 91 #define LUAI_BITSINT 32 92 #else 93 /* 'int' always must have at least 16 bits */ 94 #define LUAI_BITSINT 16 95 #endif 96 97 98 /* 99 @@ LUA_INT_TYPE defines the type for Lua integers. 100 @@ LUA_FLOAT_TYPE defines the type for Lua floats. 101 ** Lua should work fine with any mix of these options (if supported 102 ** by your C compiler). The usual configurations are 64-bit integers 103 ** and 'double' (the default), 32-bit integers and 'float' (for 104 ** restricted platforms), and 'long'/'double' (for C compilers not 105 ** compliant with C99, which may not have support for 'long long'). 106 */ 107 108 /* predefined options for LUA_INT_TYPE */ 109 #define LUA_INT_INT 1 110 #define LUA_INT_LONG 2 111 #define LUA_INT_LONGLONG 3 112 113 /* predefined options for LUA_FLOAT_TYPE */ 114 #define LUA_FLOAT_FLOAT 1 115 #define LUA_FLOAT_DOUBLE 2 116 #define LUA_FLOAT_LONGDOUBLE 3 117 118 #if defined(LUA_32BITS) /* { */ 119 /* 120 ** 32-bit integers and 'float' 121 */ 122 #if LUAI_BITSINT >= 32 /* use 'int' if big enough */ 123 #define LUA_INT_TYPE LUA_INT_INT 124 #else /* otherwise use 'long' */ 125 #define LUA_INT_TYPE LUA_INT_LONG 126 #endif 127 #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT 128 129 #elif defined(LUA_C89_NUMBERS) /* }{ */ 130 /* 131 ** largest types available for C89 ('long' and 'double') 132 */ 133 #define LUA_INT_TYPE LUA_INT_LONG 134 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE 135 136 #endif /* } */ 137 138 139 /* 140 ** default configuration for 64-bit Lua ('long long' and 'double') 141 */ 142 #if !defined(LUA_INT_TYPE) 143 #define LUA_INT_TYPE LUA_INT_LONGLONG 144 #endif 145 146 #if !defined(LUA_FLOAT_TYPE) 147 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE 148 #endif 149 150 /* }================================================================== */ 151 152 153 154 155 /* 156 ** {================================================================== 157 ** Configuration for Paths. 158 ** =================================================================== 159 */ 160 161 /* 162 ** LUA_PATH_SEP is the character that separates templates in a path. 163 ** LUA_PATH_MARK is the string that marks the substitution points in a 164 ** template. 165 ** LUA_EXEC_DIR in a Windows path is replaced by the executable's 166 ** directory. 167 */ 168 #define LUA_PATH_SEP ";" 169 #define LUA_PATH_MARK "?" 170 #define LUA_EXEC_DIR "!" 171 172 173 /* 174 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 175 ** Lua libraries. 176 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 177 ** C libraries. 178 ** CHANGE them if your machine has a non-conventional directory 179 ** hierarchy or if you want to install your libraries in 180 ** non-conventional directories. 181 */ 182 #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR 183 #if defined(_WIN32) /* { */ 184 /* 185 ** In Windows, any exclamation mark ('!') in the path is replaced by the 186 ** path of the directory of the executable file of the current process. 187 */ 188 #define LUA_LDIR "!\\lua\\" 189 #define LUA_CDIR "!\\" 190 #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" 191 #define LUA_PATH_DEFAULT \ 192 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 193 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ 194 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ 195 ".\\?.lua;" ".\\?\\init.lua" 196 #define LUA_CPATH_DEFAULT \ 197 LUA_CDIR"?.dll;" \ 198 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ 199 LUA_CDIR"loadall.dll;" ".\\?.dll" 200 201 #else /* }{ */ 202 203 #define LUA_ROOT "/usr/local/" 204 #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" 205 #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" 206 #define LUA_PATH_DEFAULT \ 207 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 208 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ 209 "./?.lua;" "./?/init.lua" 210 #define LUA_CPATH_DEFAULT \ 211 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" 212 #endif /* } */ 213 214 215 /* 216 @@ LUA_DIRSEP is the directory separator (for submodules). 217 ** CHANGE it if your machine does not use "/" as the directory separator 218 ** and is not Windows. (On Windows Lua automatically uses "\".) 219 */ 220 #if defined(_WIN32) 221 #define LUA_DIRSEP "\\" 222 #else 223 #define LUA_DIRSEP "/" 224 #endif 225 226 /* }================================================================== */ 227 228 229 /* 230 ** {================================================================== 231 ** Marks for exported symbols in the C code 232 ** =================================================================== 233 */ 234 235 /* 236 @@ LUA_API is a mark for all core API functions. 237 @@ LUALIB_API is a mark for all auxiliary library functions. 238 @@ LUAMOD_API is a mark for all standard library opening functions. 239 ** CHANGE them if you need to define those functions in some special way. 240 ** For instance, if you want to create one Windows DLL with the core and 241 ** the libraries, you may want to use the following definition (define 242 ** LUA_BUILD_AS_DLL to get it). 243 */ 244 #if defined(LUA_BUILD_AS_DLL) /* { */ 245 246 #if defined(LUA_CORE) || defined(LUA_LIB) /* { */ 247 #define LUA_API __declspec(dllexport) 248 #else /* }{ */ 249 #define LUA_API __declspec(dllimport) 250 #endif /* } */ 251 252 #else /* }{ */ 253 254 #define LUA_API extern 255 256 #endif /* } */ 257 258 259 /* more often than not the libs go together with the core */ 260 #define LUALIB_API LUA_API 261 #define LUAMOD_API LUALIB_API 262 263 264 /* 265 @@ LUAI_FUNC is a mark for all extern functions that are not to be 266 ** exported to outside modules. 267 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables 268 ** that are not to be exported to outside modules (LUAI_DDEF for 269 ** definitions and LUAI_DDEC for declarations). 270 ** CHANGE them if you need to mark them in some special way. Elf/gcc 271 ** (versions 3.2 and later) mark them as "hidden" to optimize access 272 ** when Lua is compiled as a shared library. Not all elf targets support 273 ** this attribute. Unfortunately, gcc does not offer a way to check 274 ** whether the target offers that support, and those without support 275 ** give a warning about it. To avoid these warnings, change to the 276 ** default definition. 277 */ 278 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 279 defined(__ELF__) /* { */ 280 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern 281 #else /* }{ */ 282 #define LUAI_FUNC extern 283 #endif /* } */ 284 285 #define LUAI_DDEC LUAI_FUNC 286 #define LUAI_DDEF /* empty */ 287 288 /* }================================================================== */ 289 290 291 /* 292 ** {================================================================== 293 ** Compatibility with previous versions 294 ** =================================================================== 295 */ 296 297 /* 298 @@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. 299 @@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. 300 ** You can define it to get all options, or change specific options 301 ** to fit your specific needs. 302 */ 303 #if defined(LUA_COMPAT_5_2) /* { */ 304 305 /* 306 @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated 307 ** functions in the mathematical library. 308 */ 309 #define LUA_COMPAT_MATHLIB 310 311 /* 312 @@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. 313 */ 314 #define LUA_COMPAT_BITLIB 315 316 /* 317 @@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. 318 */ 319 #define LUA_COMPAT_IPAIRS 320 321 /* 322 @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for 323 ** manipulating other integer types (lua_pushunsigned, lua_tounsigned, 324 ** luaL_checkint, luaL_checklong, etc.) 325 */ 326 #define LUA_COMPAT_APIINTCASTS 327 328 #endif /* } */ 329 330 331 #if defined(LUA_COMPAT_5_1) /* { */ 332 333 /* Incompatibilities from 5.2 -> 5.3 */ 334 #define LUA_COMPAT_MATHLIB 335 #define LUA_COMPAT_APIINTCASTS 336 337 /* 338 @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. 339 ** You can replace it with 'table.unpack'. 340 */ 341 #define LUA_COMPAT_UNPACK 342 343 /* 344 @@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. 345 ** You can replace it with 'package.searchers'. 346 */ 347 #define LUA_COMPAT_LOADERS 348 349 /* 350 @@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. 351 ** You can call your C function directly (with light C functions). 352 */ 353 #define lua_cpcall(L,f,u) \ 354 (lua_pushcfunction(L, (f)), \ 355 lua_pushlightuserdata(L,(u)), \ 356 lua_pcall(L,1,0,0)) 357 358 359 /* 360 @@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. 361 ** You can rewrite 'log10(x)' as 'log(x, 10)'. 362 */ 363 #define LUA_COMPAT_LOG10 364 365 /* 366 @@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base 367 ** library. You can rewrite 'loadstring(s)' as 'load(s)'. 368 */ 369 #define LUA_COMPAT_LOADSTRING 370 371 /* 372 @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. 373 */ 374 #define LUA_COMPAT_MAXN 375 376 /* 377 @@ The following macros supply trivial compatibility for some 378 ** changes in the API. The macros themselves document how to 379 ** change your code to avoid using them. 380 */ 381 #define lua_strlen(L,i) lua_rawlen(L, (i)) 382 383 #define lua_objlen(L,i) lua_rawlen(L, (i)) 384 385 #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) 386 #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) 387 388 /* 389 @@ LUA_COMPAT_MODULE controls compatibility with previous 390 ** module functions 'module' (Lua) and 'luaL_register' (C). 391 */ 392 #define LUA_COMPAT_MODULE 393 394 #endif /* } */ 395 396 397 /* 398 @@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a 399 @@ a float mark ('.0'). 400 ** This macro is not on by default even in compatibility mode, 401 ** because this is not really an incompatibility. 402 */ 403 /* #define LUA_COMPAT_FLOATSTRING */ 404 405 /* }================================================================== */ 406 407 408 409 /* 410 ** {================================================================== 411 ** Configuration for Numbers. 412 ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* 413 ** satisfy your needs. 414 ** =================================================================== 415 */ 416 417 /* 418 @@ LUA_NUMBER is the floating-point type used by Lua. 419 @@ LUAI_UACNUMBER is the result of a 'default argument promotion' 420 @@ over a floating number. 421 @@ l_mathlim(x) corrects limit name 'x' to the proper float type 422 ** by prefixing it with one of FLT/DBL/LDBL. 423 @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. 424 @@ LUA_NUMBER_FMT is the format for writing floats. 425 @@ lua_number2str converts a float to a string. 426 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations. 427 @@ l_floor takes the floor of a float. 428 @@ lua_str2number converts a decimal numeric string to a number. 429 */ 430 431 432 /* The following definitions are good for most cases here */ 433 434 #define l_floor(x) (l_mathop(floor)(x)) 435 436 #define lua_number2str(s,sz,n) \ 437 l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) 438 439 /* 440 @@ lua_numbertointeger converts a float number to an integer, or 441 ** returns 0 if float is not within the range of a lua_Integer. 442 ** (The range comparisons are tricky because of rounding. The tests 443 ** here assume a two-complement representation, where MININTEGER always 444 ** has an exact representation as a float; MAXINTEGER may not have one, 445 ** and therefore its conversion to float may have an ill-defined value.) 446 */ 447 #define lua_numbertointeger(n,p) \ 448 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ 449 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ 450 (*(p) = (LUA_INTEGER)(n), 1)) 451 452 453 /* now the variable definitions */ 454 455 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ 456 457 #define LUA_NUMBER float 458 459 #define l_mathlim(n) (FLT_##n) 460 461 #define LUAI_UACNUMBER double 462 463 #define LUA_NUMBER_FRMLEN "" 464 #define LUA_NUMBER_FMT "%.7g" 465 466 #define l_mathop(op) op##f 467 468 #define lua_str2number(s,p) strtof((s), (p)) 469 470 471 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ 472 473 #define LUA_NUMBER long double 474 475 #define l_mathlim(n) (LDBL_##n) 476 477 #define LUAI_UACNUMBER long double 478 479 #define LUA_NUMBER_FRMLEN "L" 480 #define LUA_NUMBER_FMT "%.19Lg" 481 482 #define l_mathop(op) op##l 483 484 #define lua_str2number(s,p) strtold((s), (p)) 485 486 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ 487 488 #define LUA_NUMBER double 489 490 #define l_mathlim(n) (DBL_##n) 491 492 #define LUAI_UACNUMBER double 493 494 #define LUA_NUMBER_FRMLEN "" 495 #define LUA_NUMBER_FMT "%.14g" 496 497 #define l_mathop(op) op 498 499 #define lua_str2number(s,p) strtod((s), (p)) 500 501 #else /* }{ */ 502 503 #error "numeric float type not defined" 504 505 #endif /* } */ 506 507 508 509 /* 510 @@ LUA_INTEGER is the integer type used by Lua. 511 ** 512 @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. 513 ** 514 @@ LUAI_UACINT is the result of a 'default argument promotion' 515 @@ over a lUA_INTEGER. 516 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. 517 @@ LUA_INTEGER_FMT is the format for writing integers. 518 @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. 519 @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. 520 @@ lua_integer2str converts an integer to a string. 521 */ 522 523 524 /* The following definitions are good for most cases here */ 525 526 #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" 527 528 #define LUAI_UACINT LUA_INTEGER 529 530 #define lua_integer2str(s,sz,n) \ 531 l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) 532 533 /* 534 ** use LUAI_UACINT here to avoid problems with promotions (which 535 ** can turn a comparison between unsigneds into a signed comparison) 536 */ 537 #define LUA_UNSIGNED unsigned LUAI_UACINT 538 539 540 /* now the variable definitions */ 541 542 #if LUA_INT_TYPE == LUA_INT_INT /* { int */ 543 544 #define LUA_INTEGER int 545 #define LUA_INTEGER_FRMLEN "" 546 547 #define LUA_MAXINTEGER INT_MAX 548 #define LUA_MININTEGER INT_MIN 549 550 #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ 551 552 #define LUA_INTEGER long 553 #define LUA_INTEGER_FRMLEN "l" 554 555 #define LUA_MAXINTEGER LONG_MAX 556 #define LUA_MININTEGER LONG_MIN 557 558 #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ 559 560 /* use presence of macro LLONG_MAX as proxy for C99 compliance */ 561 #if defined(LLONG_MAX) /* { */ 562 /* use ISO C99 stuff */ 563 564 #define LUA_INTEGER long long 565 #define LUA_INTEGER_FRMLEN "ll" 566 567 #define LUA_MAXINTEGER LLONG_MAX 568 #define LUA_MININTEGER LLONG_MIN 569 570 #elif defined(LUA_USE_WINDOWS) /* }{ */ 571 /* in Windows, can use specific Windows types */ 572 573 #define LUA_INTEGER __int64 574 #define LUA_INTEGER_FRMLEN "I64" 575 576 #define LUA_MAXINTEGER _I64_MAX 577 #define LUA_MININTEGER _I64_MIN 578 579 #else /* }{ */ 580 581 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ 582 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" 583 584 #endif /* } */ 585 586 #else /* }{ */ 587 588 #error "numeric integer type not defined" 589 590 #endif /* } */ 591 592 /* }================================================================== */ 593 594 595 /* 596 ** {================================================================== 597 ** Dependencies with C99 and other C details 598 ** =================================================================== 599 */ 600 601 /* 602 @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. 603 ** (All uses in Lua have only one format item.) 604 */ 605 #if !defined(LUA_USE_C89) 606 #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) 607 #else 608 #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) 609 #endif 610 611 612 /* 613 @@ lua_strx2number converts an hexadecimal numeric string to a number. 614 ** In C99, 'strtod' does that conversion. Otherwise, you can 615 ** leave 'lua_strx2number' undefined and Lua will provide its own 616 ** implementation. 617 */ 618 #if !defined(LUA_USE_C89) 619 #define lua_strx2number(s,p) lua_str2number(s,p) 620 #endif 621 622 623 /* 624 @@ lua_pointer2str converts a pointer to a readable string in a 625 ** non-specified way. 626 */ 627 #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) 628 629 630 /* 631 @@ lua_number2strx converts a float to an hexadecimal numeric string. 632 ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. 633 ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will 634 ** provide its own implementation. 635 */ 636 #if !defined(LUA_USE_C89) 637 #define lua_number2strx(L,b,sz,f,n) \ 638 ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) 639 #endif 640 641 642 /* 643 ** 'strtof' and 'opf' variants for math functions are not valid in 644 ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the 645 ** availability of these variants. ('math.h' is already included in 646 ** all files that use these macros.) 647 */ 648 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) 649 #undef l_mathop /* variants not available */ 650 #undef lua_str2number 651 #define l_mathop(op) (lua_Number)op /* no variant */ 652 #define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) 653 #endif 654 655 656 /* 657 @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation 658 ** functions. It must be a numerical type; Lua will use 'intptr_t' if 659 ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to 660 ** 'intptr_t' in C89) 661 */ 662 #define LUA_KCONTEXT ptrdiff_t 663 664 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ 665 __STDC_VERSION__ >= 199901L 666 #include <stdint.h> 667 #if defined(INTPTR_MAX) /* even in C99 this type is optional */ 668 #undef LUA_KCONTEXT 669 #define LUA_KCONTEXT intptr_t 670 #endif 671 #endif 672 673 674 /* 675 @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). 676 ** Change that if you do not want to use C locales. (Code using this 677 ** macro must include header 'locale.h'.) 678 */ 679 #if !defined(lua_getlocaledecpoint) 680 #define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) 681 #endif 682 683 /* }================================================================== */ 684 685 686 /* 687 ** {================================================================== 688 ** Language Variations 689 ** ===================================================================== 690 */ 691 692 /* 693 @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some 694 ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from 695 ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic 696 ** coercion from strings to numbers. 697 */ 698 /* #define LUA_NOCVTN2S */ 699 /* #define LUA_NOCVTS2N */ 700 701 702 /* 703 @@ LUA_USE_APICHECK turns on several consistency checks on the C API. 704 ** Define it as a help when debugging C code. 705 */ 706 #if defined(LUA_USE_APICHECK) 707 #include <assert.h> 708 #define luai_apicheck(l,e) assert(e) 709 #endif 710 711 /* }================================================================== */ 712 713 714 /* 715 ** {================================================================== 716 ** Macros that affect the API and must be stable (that is, must be the 717 ** same when you compile Lua and when you compile code that links to 718 ** Lua). You probably do not want/need to change them. 719 ** ===================================================================== 720 */ 721 722 /* 723 @@ LUAI_MAXSTACK limits the size of the Lua stack. 724 ** CHANGE it if you need a different limit. This limit is arbitrary; 725 ** its only purpose is to stop Lua from consuming unlimited stack 726 ** space (and to reserve some numbers for pseudo-indices). 727 */ 728 #if LUAI_BITSINT >= 32 729 #define LUAI_MAXSTACK 1000000 730 #else 731 #define LUAI_MAXSTACK 15000 732 #endif 733 734 735 /* 736 @@ LUA_EXTRASPACE defines the size of a raw memory area associated with 737 ** a Lua state with very fast access. 738 ** CHANGE it if you need a different size. 739 */ 740 #define LUA_EXTRASPACE (sizeof(void *)) 741 742 743 /* 744 @@ LUA_IDSIZE gives the maximum size for the description of the source 745 @@ of a function in debug information. 746 ** CHANGE it if you want a different size. 747 */ 748 #define LUA_IDSIZE 60 749 750 751 /* 752 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 753 ** CHANGE it if it uses too much C-stack space. (For long double, 754 ** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a 755 ** smaller buffer would force a memory allocation for each call to 756 ** 'string.format'.) 757 */ 758 #if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE 759 #define LUAL_BUFFERSIZE 8192 760 #else 761 #define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) 762 #endif 763 764 /* }================================================================== */ 765 766 767 /* 768 @@ LUA_QL describes how error messages quote program elements. 769 ** Lua does not use these macros anymore; they are here for 770 ** compatibility only. 771 */ 772 #define LUA_QL(x) "'" x "'" 773 #define LUA_QS LUA_QL("%s") 774 775 776 777 778 /* =================================================================== */ 779 780 /* 781 ** Local configuration. You can use this space to add your redefinitions 782 ** without modifying the main part of the file. 783 */ 784 785 786 787 788 789 #endif 790