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