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