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