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