xref: /freebsd/contrib/lua/src/luaconf.h (revision 95eb4b873b6a8b527c5bd78d7191975dfca38998)
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 
263 /*
264 ** {==================================================================
265 ** Marks for exported symbols in the C code
266 ** ===================================================================
267 */
268 
269 /*
270 @@ LUA_API is a mark for all core API functions.
271 @@ LUALIB_API is a mark for all auxiliary library functions.
272 @@ LUAMOD_API is a mark for all standard library opening functions.
273 ** CHANGE them if you need to define those functions in some special way.
274 ** For instance, if you want to create one Windows DLL with the core and
275 ** the libraries, you may want to use the following definition (define
276 ** LUA_BUILD_AS_DLL to get it).
277 */
278 #if defined(LUA_BUILD_AS_DLL)	/* { */
279 
280 #if defined(LUA_CORE) || defined(LUA_LIB)	/* { */
281 #define LUA_API __declspec(dllexport)
282 #else						/* }{ */
283 #define LUA_API __declspec(dllimport)
284 #endif						/* } */
285 
286 #else				/* }{ */
287 
288 #define LUA_API		extern
289 
290 #endif				/* } */
291 
292 
293 /*
294 ** More often than not the libs go together with the core.
295 */
296 #define LUALIB_API	LUA_API
297 #define LUAMOD_API	LUA_API
298 
299 
300 /*
301 @@ LUAI_FUNC is a mark for all extern functions that are not to be
302 ** exported to outside modules.
303 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
304 ** none of which to be exported to outside modules (LUAI_DDEF for
305 ** definitions and LUAI_DDEC for declarations).
306 ** CHANGE them if you need to mark them in some special way. Elf/gcc
307 ** (versions 3.2 and later) mark them as "hidden" to optimize access
308 ** when Lua is compiled as a shared library. Not all elf targets support
309 ** this attribute. Unfortunately, gcc does not offer a way to check
310 ** whether the target offers that support, and those without support
311 ** give a warning about it. To avoid these warnings, change to the
312 ** default definition.
313 */
314 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
315     defined(__ELF__)		/* { */
316 #define LUAI_FUNC	__attribute__((visibility("internal"))) extern
317 #else				/* }{ */
318 #define LUAI_FUNC	extern
319 #endif				/* } */
320 
321 #define LUAI_DDEC(dec)	LUAI_FUNC dec
322 #define LUAI_DDEF	/* empty */
323 
324 /* }================================================================== */
325 
326 
327 /*
328 ** {==================================================================
329 ** Compatibility with previous versions
330 ** ===================================================================
331 */
332 
333 /*
334 @@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3.
335 ** You can define it to get all options, or change specific options
336 ** to fit your specific needs.
337 */
338 #if defined(LUA_COMPAT_5_3)	/* { */
339 
340 /*
341 @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
342 ** functions in the mathematical library.
343 ** (These functions were already officially removed in 5.3;
344 ** nevertheless they are still available here.)
345 */
346 #define LUA_COMPAT_MATHLIB
347 
348 /*
349 @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
350 ** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
351 ** luaL_checkint, luaL_checklong, etc.)
352 ** (These macros were also officially removed in 5.3, but they are still
353 ** available here.)
354 */
355 #define LUA_COMPAT_APIINTCASTS
356 
357 
358 /*
359 @@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod
360 ** using '__lt'.
361 */
362 #define LUA_COMPAT_LT_LE
363 
364 
365 /*
366 @@ The following macros supply trivial compatibility for some
367 ** changes in the API. The macros themselves document how to
368 ** change your code to avoid using them.
369 ** (Once more, these macros were officially removed in 5.3, but they are
370 ** still available here.)
371 */
372 #define lua_strlen(L,i)		lua_rawlen(L, (i))
373 
374 #define lua_objlen(L,i)		lua_rawlen(L, (i))
375 
376 #define lua_equal(L,idx1,idx2)		lua_compare(L,(idx1),(idx2),LUA_OPEQ)
377 #define lua_lessthan(L,idx1,idx2)	lua_compare(L,(idx1),(idx2),LUA_OPLT)
378 
379 #endif				/* } */
380 
381 /* }================================================================== */
382 
383 
384 
385 /*
386 ** {==================================================================
387 ** Configuration for Numbers (low-level part).
388 ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
389 ** satisfy your needs.
390 ** ===================================================================
391 */
392 
393 /*
394 @@ LUAI_UACNUMBER is the result of a 'default argument promotion'
395 @@ over a floating number.
396 @@ l_floatatt(x) corrects float attribute 'x' to the proper float type
397 ** by prefixing it with one of FLT/DBL/LDBL.
398 @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
399 @@ LUA_NUMBER_FMT is the format for writing floats.
400 @@ lua_number2str converts a float to a string.
401 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
402 @@ l_floor takes the floor of a float.
403 @@ lua_str2number converts a decimal numeral to a number.
404 */
405 
406 
407 /* The following definitions are good for most cases here */
408 
409 #define l_floor(x)		(l_mathop(floor)(x))
410 
411 #define lua_number2str(s,sz,n)  \
412 	l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
413 
414 /*
415 @@ lua_numbertointeger converts a float number with an integral value
416 ** to an integer, or returns 0 if float is not within the range of
417 ** a lua_Integer.  (The range comparisons are tricky because of
418 ** rounding. The tests here assume a two-complement representation,
419 ** where MININTEGER always has an exact representation as a float;
420 ** MAXINTEGER may not have one, and therefore its conversion to float
421 ** may have an ill-defined value.)
422 */
423 #define lua_numbertointeger(n,p) \
424   ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
425    (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
426       (*(p) = (LUA_INTEGER)(n), 1))
427 
428 
429 /* now the variable definitions */
430 
431 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT		/* { single float */
432 
433 #define LUA_NUMBER	float
434 
435 #define l_floatatt(n)		(FLT_##n)
436 
437 #define LUAI_UACNUMBER	double
438 
439 #define LUA_NUMBER_FRMLEN	""
440 #define LUA_NUMBER_FMT		"%.7g"
441 
442 #define l_mathop(op)		op##f
443 
444 #define lua_str2number(s,p)	strtof((s), (p))
445 
446 
447 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE	/* }{ long double */
448 
449 #define LUA_NUMBER	long double
450 
451 #define l_floatatt(n)		(LDBL_##n)
452 
453 #define LUAI_UACNUMBER	long double
454 
455 #define LUA_NUMBER_FRMLEN	"L"
456 #define LUA_NUMBER_FMT		"%.19Lg"
457 
458 #define l_mathop(op)		op##l
459 
460 #define lua_str2number(s,p)	strtold((s), (p))
461 
462 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE	/* }{ double */
463 
464 #define LUA_NUMBER	double
465 
466 #define l_floatatt(n)		(DBL_##n)
467 
468 #define LUAI_UACNUMBER	double
469 
470 #define LUA_NUMBER_FRMLEN	""
471 #define LUA_NUMBER_FMT		"%.14g"
472 
473 #define l_mathop(op)		op
474 
475 #define lua_str2number(s,p)	strtod((s), (p))
476 
477 #else						/* }{ */
478 
479 #error "numeric float type not defined"
480 
481 #endif					/* } */
482 
483 
484 
485 /*
486 @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
487 @@ LUAI_UACINT is the result of a 'default argument promotion'
488 @@ over a LUA_INTEGER.
489 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
490 @@ LUA_INTEGER_FMT is the format for writing integers.
491 @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
492 @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
493 @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED.
494 @@ lua_integer2str converts an integer to a string.
495 */
496 
497 
498 /* The following definitions are good for most cases here */
499 
500 #define LUA_INTEGER_FMT		"%" LUA_INTEGER_FRMLEN "d"
501 
502 #define LUAI_UACINT		LUA_INTEGER
503 
504 #define lua_integer2str(s,sz,n)  \
505 	l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
506 
507 /*
508 ** use LUAI_UACINT here to avoid problems with promotions (which
509 ** can turn a comparison between unsigneds into a signed comparison)
510 */
511 #define LUA_UNSIGNED		unsigned LUAI_UACINT
512 
513 
514 /* now the variable definitions */
515 
516 #if LUA_INT_TYPE == LUA_INT_INT		/* { int */
517 
518 #define LUA_INTEGER		int
519 #define LUA_INTEGER_FRMLEN	""
520 
521 #define LUA_MAXINTEGER		INT_MAX
522 #define LUA_MININTEGER		INT_MIN
523 
524 #define LUA_MAXUNSIGNED		UINT_MAX
525 
526 #elif LUA_INT_TYPE == LUA_INT_LONG	/* }{ long */
527 
528 #define LUA_INTEGER		long
529 #define LUA_INTEGER_FRMLEN	"l"
530 
531 #define LUA_MAXINTEGER		LONG_MAX
532 #define LUA_MININTEGER		LONG_MIN
533 
534 #define LUA_MAXUNSIGNED		ULONG_MAX
535 
536 #elif LUA_INT_TYPE == LUA_INT_LONGLONG	/* }{ long long */
537 
538 /* use presence of macro LLONG_MAX as proxy for C99 compliance */
539 #if defined(LLONG_MAX)		/* { */
540 /* use ISO C99 stuff */
541 
542 #define LUA_INTEGER		long long
543 #define LUA_INTEGER_FRMLEN	"ll"
544 
545 #define LUA_MAXINTEGER		LLONG_MAX
546 #define LUA_MININTEGER		LLONG_MIN
547 
548 #define LUA_MAXUNSIGNED		ULLONG_MAX
549 
550 #elif defined(LUA_USE_WINDOWS) /* }{ */
551 /* in Windows, can use specific Windows types */
552 
553 #define LUA_INTEGER		__int64
554 #define LUA_INTEGER_FRMLEN	"I64"
555 
556 #define LUA_MAXINTEGER		_I64_MAX
557 #define LUA_MININTEGER		_I64_MIN
558 
559 #define LUA_MAXUNSIGNED		_UI64_MAX
560 
561 #else				/* }{ */
562 
563 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
564   or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
565 
566 #endif				/* } */
567 
568 #else				/* }{ */
569 
570 #error "numeric integer type not defined"
571 
572 #endif				/* } */
573 
574 /* }================================================================== */
575 
576 
577 /*
578 ** {==================================================================
579 ** Dependencies with C99 and other C details
580 ** ===================================================================
581 */
582 
583 /*
584 @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
585 ** (All uses in Lua have only one format item.)
586 */
587 #if !defined(LUA_USE_C89)
588 #define l_sprintf(s,sz,f,i)	snprintf(s,sz,f,i)
589 #else
590 #define l_sprintf(s,sz,f,i)	((void)(sz), sprintf(s,f,i))
591 #endif
592 
593 
594 /*
595 @@ lua_strx2number converts a hexadecimal numeral to a number.
596 ** In C99, 'strtod' does that conversion. Otherwise, you can
597 ** leave 'lua_strx2number' undefined and Lua will provide its own
598 ** implementation.
599 */
600 #if !defined(LUA_USE_C89)
601 #define lua_strx2number(s,p)		lua_str2number(s,p)
602 #endif
603 
604 
605 /*
606 @@ lua_pointer2str converts a pointer to a readable string in a
607 ** non-specified way.
608 */
609 #define lua_pointer2str(buff,sz,p)	l_sprintf(buff,sz,"%p",p)
610 
611 
612 /*
613 @@ lua_number2strx converts a float to a hexadecimal numeral.
614 ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
615 ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
616 ** provide its own implementation.
617 */
618 #if !defined(LUA_USE_C89)
619 #define lua_number2strx(L,b,sz,f,n)  \
620 	((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
621 #endif
622 
623 
624 /*
625 ** 'strtof' and 'opf' variants for math functions are not valid in
626 ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
627 ** availability of these variants. ('math.h' is already included in
628 ** all files that use these macros.)
629 */
630 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
631 #undef l_mathop  /* variants not available */
632 #undef lua_str2number
633 #define l_mathop(op)		(lua_Number)op  /* no variant */
634 #define lua_str2number(s,p)	((lua_Number)strtod((s), (p)))
635 #endif
636 
637 
638 /*
639 @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
640 ** functions.  It must be a numerical type; Lua will use 'intptr_t' if
641 ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
642 ** 'intptr_t' in C89)
643 */
644 #define LUA_KCONTEXT	ptrdiff_t
645 
646 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
647     __STDC_VERSION__ >= 199901L
648 #include <stdint.h>
649 #if defined(INTPTR_MAX)  /* even in C99 this type is optional */
650 #undef LUA_KCONTEXT
651 #define LUA_KCONTEXT	intptr_t
652 #endif
653 #endif
654 
655 
656 /*
657 @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
658 ** Change that if you do not want to use C locales. (Code using this
659 ** macro must include the header 'locale.h'.)
660 */
661 #if !defined(lua_getlocaledecpoint)
662 #define lua_getlocaledecpoint()		(localeconv()->decimal_point[0])
663 #endif
664 
665 
666 /*
667 ** macros to improve jump prediction, used mostly for error handling
668 ** and debug facilities. (Some macros in the Lua API use these macros.
669 ** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your
670 ** code.)
671 */
672 #if !defined(luai_likely)
673 
674 #if defined(__GNUC__) && !defined(LUA_NOBUILTIN)
675 #define luai_likely(x)		(__builtin_expect(((x) != 0), 1))
676 #define luai_unlikely(x)	(__builtin_expect(((x) != 0), 0))
677 #else
678 #define luai_likely(x)		(x)
679 #define luai_unlikely(x)	(x)
680 #endif
681 
682 #endif
683 
684 
685 #if defined(LUA_CORE) || defined(LUA_LIB)
686 /* shorter names for Lua's own use */
687 #define l_likely(x)	luai_likely(x)
688 #define l_unlikely(x)	luai_unlikely(x)
689 #endif
690 
691 
692 
693 /* }================================================================== */
694 
695 
696 /*
697 ** {==================================================================
698 ** Language Variations
699 ** =====================================================================
700 */
701 
702 /*
703 @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
704 ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
705 ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
706 ** coercion from strings to numbers.
707 */
708 /* #define LUA_NOCVTN2S */
709 /* #define LUA_NOCVTS2N */
710 
711 
712 /*
713 @@ LUA_USE_APICHECK turns on several consistency checks on the C API.
714 ** Define it as a help when debugging C code.
715 */
716 #if defined(LUA_USE_APICHECK)
717 #include <assert.h>
718 #define luai_apicheck(l,e)	assert(e)
719 #endif
720 
721 /* }================================================================== */
722 
723 
724 /*
725 ** {==================================================================
726 ** Macros that affect the API and must be stable (that is, must be the
727 ** same when you compile Lua and when you compile code that links to
728 ** Lua).
729 ** =====================================================================
730 */
731 
732 /*
733 @@ LUAI_MAXSTACK limits the size of the Lua stack.
734 ** CHANGE it if you need a different limit. This limit is arbitrary;
735 ** its only purpose is to stop Lua from consuming unlimited stack
736 ** space (and to reserve some numbers for pseudo-indices).
737 ** (It must fit into max(size_t)/32 and max(int)/2.)
738 */
739 #if LUAI_IS32INT
740 #define LUAI_MAXSTACK		1000000
741 #else
742 #define LUAI_MAXSTACK		15000
743 #endif
744 
745 
746 /*
747 @@ LUA_EXTRASPACE defines the size of a raw memory area associated with
748 ** a Lua state with very fast access.
749 ** CHANGE it if you need a different size.
750 */
751 #define LUA_EXTRASPACE		(sizeof(void *))
752 
753 
754 /*
755 @@ LUA_IDSIZE gives the maximum size for the description of the source
756 ** of a function in debug information.
757 ** CHANGE it if you want a different size.
758 */
759 #define LUA_IDSIZE	60
760 
761 
762 /*
763 @@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib
764 ** buffer system.
765 */
766 #define LUAL_BUFFERSIZE   ((int)(16 * sizeof(void*) * sizeof(lua_Number)))
767 
768 
769 /*
770 @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure
771 ** maximum alignment for the other items in that union.
772 */
773 #define LUAI_MAXALIGN  lua_Number n; double u; void *s; lua_Integer i; long l
774 
775 /* }================================================================== */
776 
777 
778 
779 
780 
781 /* =================================================================== */
782 
783 /*
784 ** Local configuration. You can use this space to add your redefinitions
785 ** without modifying the main part of the file.
786 */
787 
788 
789 
790 #include <luaconf.local.h>
791 
792 #endif
793 
794