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