etc/protocols - sync with NetBSD-8
[minix.git] / external / mit / lua / dist / src / luaconf.h
blob3336584236db9478248edae98fa79391bd75d6e9
1 /* $NetBSD: luaconf.h,v 1.14 2015/10/08 13:21:00 mbalmer Exp $ */
3 /*
4 ** Id: luaconf.h,v 1.251 2015/05/20 17:39:23 roberto Exp
5 ** Configuration file for Lua
6 ** See Copyright Notice in lua.h
7 */
10 #ifndef luaconf_h
11 #define luaconf_h
13 #ifndef _KERNEL
14 #include <limits.h>
15 #include <stddef.h>
16 #else
17 #include <machine/limits.h>
18 #include <sys/systm.h>
19 #endif
23 ** ===================================================================
24 ** Search for "@@" to find all configurable definitions.
25 ** ===================================================================
30 ** {====================================================================
31 ** System Configuration: macros to adapt (if needed) Lua to some
32 ** particular platform, for instance compiling it with 32-bit numbers or
33 ** restricting it to C89.
34 ** =====================================================================
38 @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
39 ** can also define LUA_32BITS in the make file, but changing here you
40 ** ensure that all software connected to Lua will be compiled with the
41 ** same configuration.
43 /* #define LUA_32BITS */
47 @@ LUA_USE_C89 controls the use of non-ISO-C89 features.
48 ** Define it if you want Lua to avoid the use of a few C99 features
49 ** or Windows-specific features on Windows.
51 /* #define LUA_USE_C89 */
55 ** By default, Lua on Windows use (some) specific Windows features
57 #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
58 #define LUA_USE_WINDOWS /* enable goodies for regular Windows */
59 #endif
62 #if defined(LUA_USE_WINDOWS)
63 #define LUA_DL_DLL /* enable support for DLL */
64 #define LUA_USE_C89 /* broadly, Windows is C89 */
65 #endif
68 #if defined(LUA_USE_LINUX)
69 #define LUA_USE_POSIX
70 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
71 #define LUA_USE_READLINE /* needs some extra libraries */
72 #endif
75 #if defined(LUA_USE_MACOSX)
76 #define LUA_USE_POSIX
77 #define LUA_USE_DLOPEN /* MacOS does not need -ldl */
78 #define LUA_USE_READLINE /* needs an extra library: -lreadline */
79 #endif
83 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
84 ** C89 ('long' and 'double'); Windows always has '__int64', so it does
85 ** not need to use this case.
87 #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
88 #define LUA_C89_NUMBERS
89 #endif
94 @@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'.
96 /* avoid undefined shifts */
97 #if ((INT_MAX >> 15) >> 15) >= 1
98 #define LUAI_BITSINT 32
99 #else
100 /* 'int' always must have at least 16 bits */
101 #define LUAI_BITSINT 16
102 #endif
106 @@ LUA_INT_TYPE defines the type for Lua integers.
107 @@ LUA_FLOAT_TYPE defines the type for Lua floats.
108 ** Lua should work fine with any mix of these options (if supported
109 ** by your C compiler). The usual configurations are 64-bit integers
110 ** and 'double' (the default), 32-bit integers and 'float' (for
111 ** restricted platforms), and 'long'/'double' (for C compilers not
112 ** compliant with C99, which may not have support for 'long long').
115 /* predefined options for LUA_INT_TYPE */
116 #define LUA_INT_INT 1
117 #define LUA_INT_LONG 2
118 #define LUA_INT_LONGLONG 3
120 /* predefined options for LUA_FLOAT_TYPE */
121 #define LUA_FLOAT_FLOAT 1
122 #define LUA_FLOAT_DOUBLE 2
123 #define LUA_FLOAT_LONGDOUBLE 3
125 #if defined(LUA_32BITS) /* { */
127 ** 32-bit integers and 'float'
129 #if LUAI_BITSINT >= 32 /* use 'int' if big enough */
130 #define LUA_INT_TYPE LUA_INT_INT
131 #else /* otherwise use 'long' */
132 #define LUA_INT_TYPE LUA_INT_LONG
133 #endif
134 #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
136 #elif defined(LUA_C89_NUMBERS) /* }{ */
138 ** largest types available for C89 ('long' and 'double')
140 #define LUA_INT_TYPE LUA_INT_LONG
141 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
143 #endif /* } */
147 ** default configuration for 64-bit Lua ('long long' and 'double')
149 #if !defined(LUA_INT_TYPE)
150 #define LUA_INT_TYPE LUA_INT_LONGLONG
151 #endif
153 #if !defined(LUA_FLOAT_TYPE)
154 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
155 #endif /* } */
157 /* }================================================================== */
163 ** {==================================================================
164 ** Configuration for Paths.
165 ** ===================================================================
169 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
170 ** Lua libraries.
171 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
172 ** C libraries.
173 ** CHANGE them if your machine has a non-conventional directory
174 ** hierarchy or if you want to install your libraries in
175 ** non-conventional directories.
177 #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
178 #if defined(_WIN32) /* { */
180 ** In Windows, any exclamation mark ('!') in the path is replaced by the
181 ** path of the directory of the executable file of the current process.
183 #define LUA_LDIR "!\\lua\\"
184 #define LUA_CDIR "!\\"
185 #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
186 #define LUA_PATH_DEFAULT \
187 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
188 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
189 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
190 ".\\?.lua;" ".\\?\\init.lua"
191 #define LUA_CPATH_DEFAULT \
192 LUA_CDIR"?.dll;" \
193 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
194 LUA_CDIR"loadall.dll;" ".\\?.dll"
196 #else /* }{ */
198 #define LUA_ROOT "/usr/local/"
199 #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
200 #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
201 #define LUA_PATH_DEFAULT \
202 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
203 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
204 "./?.lua;" "./?/init.lua"
205 #define LUA_CPATH_DEFAULT \
206 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
207 #endif /* } */
211 @@ LUA_DIRSEP is the directory separator (for submodules).
212 ** CHANGE it if your machine does not use "/" as the directory separator
213 ** and is not Windows. (On Windows Lua automatically uses "\".)
215 #if defined(_WIN32)
216 #define LUA_DIRSEP "\\"
217 #else
218 #define LUA_DIRSEP "/"
219 #endif
221 /* }================================================================== */
225 ** {==================================================================
226 ** Marks for exported symbols in the C code
227 ** ===================================================================
231 @@ LUA_API is a mark for all core API functions.
232 @@ LUALIB_API is a mark for all auxiliary library functions.
233 @@ LUAMOD_API is a mark for all standard library opening functions.
234 ** CHANGE them if you need to define those functions in some special way.
235 ** For instance, if you want to create one Windows DLL with the core and
236 ** the libraries, you may want to use the following definition (define
237 ** LUA_BUILD_AS_DLL to get it).
239 #if defined(LUA_BUILD_AS_DLL) /* { */
241 #if defined(LUA_CORE) || defined(LUA_LIB) /* { */
242 #define LUA_API __declspec(dllexport)
243 #else /* }{ */
244 #define LUA_API __declspec(dllimport)
245 #endif /* } */
247 #else /* }{ */
249 #define LUA_API extern
251 #endif /* } */
254 /* more often than not the libs go together with the core */
255 #define LUALIB_API LUA_API
256 #define LUAMOD_API LUALIB_API
260 @@ LUAI_FUNC is a mark for all extern functions that are not to be
261 ** exported to outside modules.
262 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
263 ** that are not to be exported to outside modules (LUAI_DDEF for
264 ** definitions and LUAI_DDEC for declarations).
265 ** CHANGE them if you need to mark them in some special way. Elf/gcc
266 ** (versions 3.2 and later) mark them as "hidden" to optimize access
267 ** when Lua is compiled as a shared library. Not all elf targets support
268 ** this attribute. Unfortunately, gcc does not offer a way to check
269 ** whether the target offers that support, and those without support
270 ** give a warning about it. To avoid these warnings, change to the
271 ** default definition.
273 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
274 defined(__ELF__) /* { */
275 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
276 #else /* }{ */
277 #define LUAI_FUNC extern
278 #endif /* } */
280 #define LUAI_DDEC LUAI_FUNC
281 #define LUAI_DDEF /* empty */
283 /* }================================================================== */
287 ** {==================================================================
288 ** Compatibility with previous versions
289 ** ===================================================================
293 @@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2.
294 @@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1.
295 ** You can define it to get all options, or change specific options
296 ** to fit your specific needs.
298 #if defined(LUA_COMPAT_5_2) /* { */
301 @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
302 ** functions in the mathematical library.
304 #define LUA_COMPAT_MATHLIB
307 @@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'.
309 #define LUA_COMPAT_BITLIB
312 @@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod.
314 #define LUA_COMPAT_IPAIRS
317 @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
318 ** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
319 ** luaL_checkint, luaL_checklong, etc.)
321 #define LUA_COMPAT_APIINTCASTS
323 #endif /* } */
326 #if defined(LUA_COMPAT_5_1) /* { */
328 /* Incompatibilities from 5.2 -> 5.3 */
329 #define LUA_COMPAT_MATHLIB
330 #define LUA_COMPAT_APIINTCASTS
333 @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
334 ** You can replace it with 'table.unpack'.
336 #define LUA_COMPAT_UNPACK
339 @@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
340 ** You can replace it with 'package.searchers'.
342 #define LUA_COMPAT_LOADERS
345 @@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
346 ** You can call your C function directly (with light C functions).
348 #define lua_cpcall(L,f,u) \
349 (lua_pushcfunction(L, (f)), \
350 lua_pushlightuserdata(L,(u)), \
351 lua_pcall(L,1,0,0))
355 @@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
356 ** You can rewrite 'log10(x)' as 'log(x, 10)'.
358 #define LUA_COMPAT_LOG10
361 @@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
362 ** library. You can rewrite 'loadstring(s)' as 'load(s)'.
364 #define LUA_COMPAT_LOADSTRING
367 @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
369 #define LUA_COMPAT_MAXN
372 @@ The following macros supply trivial compatibility for some
373 ** changes in the API. The macros themselves document how to
374 ** change your code to avoid using them.
376 #define lua_strlen(L,i) lua_rawlen(L, (i))
378 #define lua_objlen(L,i) lua_rawlen(L, (i))
380 #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
381 #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
384 @@ LUA_COMPAT_MODULE controls compatibility with previous
385 ** module functions 'module' (Lua) and 'luaL_register' (C).
387 #define LUA_COMPAT_MODULE
389 #endif /* } */
393 @@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
394 @@ a float mark ('.0').
395 ** This macro is not on by default even in compatibility mode,
396 ** because this is not really an incompatibility.
398 /* #define LUA_COMPAT_FLOATSTRING */
400 /* }================================================================== */
405 ** {==================================================================
406 ** Configuration for Numbers.
407 ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
408 ** satisfy your needs.
409 ** ===================================================================
412 #ifndef _KERNEL
414 @@ LUA_NUMBER is the floating-point type used by Lua.
415 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
416 @@ over a floating number.
417 @@ l_mathlim(x) corrects limit name 'x' to the proper float type
418 ** by prefixing it with one of FLT/DBL/LDBL.
419 @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
420 @@ LUA_NUMBER_FMT is the format for writing floats.
421 @@ lua_number2str converts a float to a string.
422 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
423 @@ lua_str2number converts a decimal numeric string to a number.
426 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */
428 #define LUA_NUMBER float
430 #define l_mathlim(n) (FLT_##n)
432 #define LUAI_UACNUMBER double
434 #define LUA_NUMBER_FRMLEN ""
435 #define LUA_NUMBER_FMT "%.7g"
437 #define l_mathop(op) op##f
439 #define lua_str2number(s,p) strtof((s), (p))
442 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */
444 #define LUA_NUMBER long double
446 #define l_mathlim(n) (LDBL_##n)
448 #define LUAI_UACNUMBER long double
450 #define LUA_NUMBER_FRMLEN "L"
451 #define LUA_NUMBER_FMT "%.19Lg"
453 #define l_mathop(op) op##l
455 #define lua_str2number(s,p) strtold((s), (p))
457 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */
459 #define LUA_NUMBER double
461 #define l_mathlim(n) (DBL_##n)
463 #define LUAI_UACNUMBER double
465 #define LUA_NUMBER_FRMLEN ""
466 #define LUA_NUMBER_FMT "%.14g"
468 #define l_mathop(op) op
470 #define lua_str2number(s,p) strtod((s), (p))
472 #else /* }{ */
474 #error "numeric float type not defined"
476 #endif /* } */
479 #define l_floor(x) (l_mathop(floor)(x))
481 #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
485 @@ lua_numbertointeger converts a float number to an integer, or
486 ** returns 0 if float is not within the range of a lua_Integer.
487 ** (The range comparisons are tricky because of rounding. The tests
488 ** here assume a two-complement representation, where MININTEGER always
489 ** has an exact representation as a float; MAXINTEGER may not have one,
490 ** and therefore its conversion to float may have an ill-defined value.)
492 #define lua_numbertointeger(n,p) \
493 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
494 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
495 (*(p) = (LUA_INTEGER)(n), 1))
497 #endif /*_KERNEL */
501 @@ LUA_INTEGER is the integer type used by Lua.
503 @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
505 @@ LUAI_UACINT is the result of an 'usual argument conversion'
506 @@ over a lUA_INTEGER.
507 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
508 @@ LUA_INTEGER_FMT is the format for writing integers.
509 @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
510 @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
511 @@ lua_integer2str converts an integer to a string.
515 /* The following definitions are good for most cases here */
517 #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d"
518 #define lua_integer2str(s,n) sprintf((s), LUA_INTEGER_FMT, (n))
520 #define LUAI_UACINT LUA_INTEGER
523 ** use LUAI_UACINT here to avoid problems with promotions (which
524 ** can turn a comparison between unsigneds into a signed comparison)
526 #define LUA_UNSIGNED unsigned LUAI_UACINT
529 /* now the variable definitions */
531 #if LUA_INT_TYPE == LUA_INT_INT /* { int */
533 #define LUA_INTEGER int
534 #define LUA_INTEGER_FRMLEN ""
536 #define LUA_MAXINTEGER INT_MAX
537 #define LUA_MININTEGER INT_MIN
539 #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
541 #define LUA_INTEGER long
542 #define LUA_INTEGER_FRMLEN "l"
544 #define LUA_MAXINTEGER LONG_MAX
545 #define LUA_MININTEGER LONG_MIN
547 #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
549 #if defined(LLONG_MAX) /* { */
550 /* use ISO C99 stuff */
552 #define LUA_INTEGER long long
553 #define LUA_INTEGER_FRMLEN "ll"
555 #define LUA_MAXINTEGER LLONG_MAX
556 #define LUA_MININTEGER LLONG_MIN
558 #elif defined(LUA_USE_WINDOWS) /* }{ */
559 /* in Windows, can use specific Windows types */
561 #define LUA_INTEGER __int64
562 #define LUA_INTEGER_FRMLEN "I64"
564 #define LUA_MAXINTEGER _I64_MAX
565 #define LUA_MININTEGER _I64_MIN
567 #else /* }{ */
569 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
570 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
572 #endif /* } */
574 #else /* }{ */
576 #error "numeric integer type not defined"
578 #endif /* } */
580 /* }================================================================== */
584 ** {==================================================================
585 ** Dependencies with C99 and other C details
586 ** ===================================================================
590 @@ lua_strx2number converts an hexadecimal numeric string to a number.
591 ** In C99, 'strtod' does that conversion. Otherwise, you can
592 ** leave 'lua_strx2number' undefined and Lua will provide its own
593 ** implementation.
595 #if !defined(LUA_USE_C89)
596 #define lua_strx2number(s,p) lua_str2number(s,p)
597 #endif
601 @@ lua_number2strx converts a float to an hexadecimal numeric string.
602 ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
603 ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
604 ** provide its own implementation.
606 #if !defined(LUA_USE_C89)
607 #define lua_number2strx(L,b,f,n) sprintf(b,f,n)
608 #endif
612 ** 'strtof' and 'opf' variants for math functions are not valid in
613 ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
614 ** availability of these variants. ('math.h' is already included in
615 ** all files that use these macros.)
617 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
618 #undef l_mathop /* variants not available */
619 #undef lua_str2number
620 #define l_mathop(op) (lua_Number)op /* no variant */
621 #define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
622 #endif
626 @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
627 ** functions. It must be a numerical type; Lua will use 'intptr_t' if
628 ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
629 ** 'intptr_t' in C89)
631 #define LUA_KCONTEXT ptrdiff_t
633 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
634 __STDC_VERSION__ >= 199901L
635 #include <stdint.h>
636 #if defined(INTPTR_MAX) /* even in C99 this type is optional */
637 #undef LUA_KCONTEXT
638 #define LUA_KCONTEXT intptr_t
639 #endif
640 #endif
644 @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
645 ** Change that if you do not want to use C locales. (Code using this
646 ** macro must include header 'locale.h'.)
648 #if !defined(lua_getlocaledecpoint)
649 #define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
650 #endif
652 /* }================================================================== */
656 ** {==================================================================
657 ** Language Variations
658 ** =====================================================================
662 @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
663 ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
664 ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
665 ** coercion from strings to numbers.
667 /* #define LUA_NOCVTN2S */
668 /* #define LUA_NOCVTS2N */
672 @@ LUA_USE_APICHECK turns on several consistency checks on the C API.
673 ** Define it as a help when debugging C code.
675 #if defined(LUA_USE_APICHECK)
676 #include <assert.h>
677 #define luai_apicheck(l,e) assert(e)
678 #endif
680 /* }================================================================== */
684 ** {==================================================================
685 ** Macros that affect the API and must be stable (that is, must be the
686 ** same when you compile Lua and when you compile code that links to
687 ** Lua). You probably do not want/need to change them.
688 ** =====================================================================
692 @@ LUAI_MAXSTACK limits the size of the Lua stack.
693 ** CHANGE it if you need a different limit. This limit is arbitrary;
694 ** its only purpose is to stop Lua from consuming unlimited stack
695 ** space (and to reserve some numbers for pseudo-indices).
697 #if LUAI_BITSINT >= 32
698 #define LUAI_MAXSTACK 1000000
699 #else
700 #define LUAI_MAXSTACK 15000
701 #endif
705 @@ LUA_EXTRASPACE defines the size of a raw memory area associated with
706 ** a Lua state with very fast access.
707 ** CHANGE it if you need a different size.
709 #define LUA_EXTRASPACE (sizeof(void *))
713 @@ LUA_IDSIZE gives the maximum size for the description of the source
714 @@ of a function in debug information.
715 ** CHANGE it if you want a different size.
717 #define LUA_IDSIZE 60
721 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
722 ** CHANGE it if it uses too much C-stack space. (For long double,
723 ** 'string.format("%.99f", 1e4932)' needs ~5030 bytes, so a
724 ** smaller buffer would force a memory allocation for each call to
725 ** 'string.format'.)
727 #if defined(LUA_FLOAT_LONGDOUBLE)
728 #define LUAL_BUFFERSIZE 8192
729 #else
730 #define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
731 #endif
733 /* }================================================================== */
737 @@ LUA_QL describes how error messages quote program elements.
738 ** Lua does not use these macros anymore; they are here for
739 ** compatibility only.
741 #define LUA_QL(x) "'" x "'"
742 #define LUA_QS LUA_QL("%s")
747 /* =================================================================== */
750 ** Local configuration. You can use this space to add your redefinitions
751 ** without modifying the main part of the file.
754 #if defined(__NetBSD__) || defined(__minix)
756 /* Integer types */
757 #undef LUA_INTEGER
758 #undef LUA_INTEGER_FRMLEN
759 #undef LUA_UNSIGNED
760 #undef LUA_MAXUNSIGNED
761 #undef LUA_MAXINTEGER
762 #undef LUA_MININTEGER
764 #define LUA_INTEGER intmax_t
765 #define LUA_INTEGER_FRMLEN "j"
766 #define LUA_UNSIGNED uintmax_t
767 #define LUA_MAXUNSIGNED UINTMAX_MAX
768 #define LUA_MAXINTEGER INTMAX_MAX
769 #define LUA_MININTEGER INTMAX_MIN
771 /* Path */
772 #undef LUA_ROOT
773 #undef LUA_PATH_DEFAULT
774 #undef LUA_CPATH_DEFAULT
776 #define LUA_ROOT "/usr/"
777 #define LUA_PATH_DEFAULT \
778 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
779 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
780 #define LUA_CPATH_DEFAULT \
781 LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
783 #ifndef _KERNEL
785 #include <stdint.h>
787 #else /* _KERNEL */
789 #define LUA_NUMBER LUA_INTEGER
790 #define LUA_NUMBER_FMT LUA_INTEGER_FMT
792 /* setjmp.h */
793 #define LUAI_THROW(L,c) longjmp(&((c)->b))
794 #define LUAI_TRY(L,c,a) if (setjmp(&((c)->b)) == 0) { a }
795 #define luai_jmpbuf label_t
797 /* time.h */
798 #include <sys/time.h>
799 #define time(p) (time_uptime)
801 /* stdio.h */
802 #define lua_writestring(s,l) printf("%s", (s))
803 #define lua_writeline() printf("\n")
805 #define sprintf(s,fmt,...) snprintf(s, sizeof(s), fmt, __VA_ARGS__)
807 /* string.h */
808 #define strcoll strcmp
810 /* stdlib.h */
811 #define abort() panic("Lua has aborted!")
813 #endif /* _KERNEL */
815 #endif /* __NetBSD__ || __minix */
817 #endif