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