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