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