Add memtest support.
[syslinux-debian/hramrach.git] / com32 / lua / src / luaconf.h
blobd2852513b892496171e772fc27338cfc02fe2b49
1 /*
2 ** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $
3 ** Configuration file for Lua
4 ** See Copyright Notice in lua.h
5 */
8 #ifndef lconfig_h
9 #define lconfig_h
11 #include <limits.h>
12 #include <stddef.h>
16 ** ==================================================================
17 ** Search for "@@" to find all configurable definitions.
18 ** ===================================================================
23 @@ LUA_ANSI controls the use of non-ansi features.
24 ** CHANGE it (define it) if you want Lua to avoid the use of any
25 ** non-ansi feature or library.
27 #if defined(__STRICT_ANSI__)
28 #define LUA_ANSI
29 #endif
32 #if !defined(LUA_ANSI) && defined(_WIN32)
33 #define LUA_WIN
34 #endif
36 #if defined(LUA_USE_LINUX)
37 #define LUA_USE_POSIX
38 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
39 #define LUA_USE_READLINE /* needs some extra libraries */
40 #endif
42 #if defined(LUA_USE_MACOSX)
43 #define LUA_USE_POSIX
44 #define LUA_DL_DYLD /* does not need extra library */
45 #endif
50 @@ LUA_USE_POSIX includes all functionallity listed as X/Open System
51 @* Interfaces Extension (XSI).
52 ** CHANGE it (define it) if your system is XSI compatible.
54 #if defined(LUA_USE_POSIX)
55 #define LUA_USE_MKSTEMP
56 #define LUA_USE_ISATTY
57 #define LUA_USE_POPEN
58 #define LUA_USE_ULONGJMP
59 #endif
63 @@ LUA_PATH and LUA_CPATH are the names of the environment variables that
64 @* Lua check to set its paths.
65 @@ LUA_INIT is the name of the environment variable that Lua
66 @* checks for initialization code.
67 ** CHANGE them if you want different names.
69 #define LUA_PATH "LUA_PATH"
70 #define LUA_CPATH "LUA_CPATH"
71 #define LUA_INIT "LUA_INIT"
75 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
76 @* Lua libraries.
77 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
78 @* C libraries.
79 ** CHANGE them if your machine has a non-conventional directory
80 ** hierarchy or if you want to install your libraries in
81 ** non-conventional directories.
83 #if defined(_WIN32)
85 ** In Windows, any exclamation mark ('!') in the path is replaced by the
86 ** path of the directory of the executable file of the current process.
88 #define LUA_LDIR "!\\lua\\"
89 #define LUA_CDIR "!\\"
90 #define LUA_PATH_DEFAULT \
91 ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
92 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
93 #define LUA_CPATH_DEFAULT \
94 ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
96 #else
97 #define LUA_ROOT "/usr/local/"
98 #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
99 #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
100 #define LUA_PATH_DEFAULT \
101 "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
102 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
103 #define LUA_CPATH_DEFAULT \
104 "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
105 #endif
109 @@ LUA_DIRSEP is the directory separator (for submodules).
110 ** CHANGE it if your machine does not use "/" as the directory separator
111 ** and is not Windows. (On Windows Lua automatically uses "\".)
113 #if defined(_WIN32)
114 #define LUA_DIRSEP "\\"
115 #else
116 #define LUA_DIRSEP "/"
117 #endif
121 @@ LUA_PATHSEP is the character that separates templates in a path.
122 @@ LUA_PATH_MARK is the string that marks the substitution points in a
123 @* template.
124 @@ LUA_EXECDIR in a Windows path is replaced by the executable's
125 @* directory.
126 @@ LUA_IGMARK is a mark to ignore all before it when bulding the
127 @* luaopen_ function name.
128 ** CHANGE them if for some reason your system cannot use those
129 ** characters. (E.g., if one of those characters is a common character
130 ** in file/directory names.) Probably you do not need to change them.
132 #define LUA_PATHSEP ";"
133 #define LUA_PATH_MARK "?"
134 #define LUA_EXECDIR "!"
135 #define LUA_IGMARK "-"
139 @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
140 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
141 ** machines, ptrdiff_t gives a good choice between int or long.)
144 /* Changed to long for use with integral Lua numbers. */
145 #define LUA_INTEGER long
148 @@ LUA_API is a mark for all core API functions.
149 @@ LUALIB_API is a mark for all standard library functions.
150 ** CHANGE them if you need to define those functions in some special way.
151 ** For instance, if you want to create one Windows DLL with the core and
152 ** the libraries, you may want to use the following definition (define
153 ** LUA_BUILD_AS_DLL to get it).
155 #if defined(LUA_BUILD_AS_DLL)
157 #if defined(LUA_CORE) || defined(LUA_LIB)
158 #define LUA_API __declspec(dllexport)
159 #else
160 #define LUA_API __declspec(dllimport)
161 #endif
163 #else
165 #define LUA_API extern
167 #endif
169 /* more often than not the libs go together with the core */
170 #define LUALIB_API LUA_API
174 @@ LUAI_FUNC is a mark for all extern functions that are not to be
175 @* exported to outside modules.
176 @@ LUAI_DATA is a mark for all extern (const) variables that are not to
177 @* be exported to outside modules.
178 ** CHANGE them if you need to mark them in some special way. Elf/gcc
179 ** (versions 3.2 and later) mark them as "hidden" to optimize access
180 ** when Lua is compiled as a shared library.
182 #if defined(luaall_c)
183 #define LUAI_FUNC static
184 #define LUAI_DATA /* empty */
186 #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
187 defined(__ELF__)
188 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
189 #define LUAI_DATA LUAI_FUNC
191 #else
192 #define LUAI_FUNC extern
193 #define LUAI_DATA extern
194 #endif
199 @@ LUA_QL describes how error messages quote program elements.
200 ** CHANGE it if you want a different appearance.
202 #define LUA_QL(x) "'" x "'"
203 #define LUA_QS LUA_QL("%s")
207 @@ LUA_IDSIZE gives the maximum size for the description of the source
208 @* of a function in debug information.
209 ** CHANGE it if you want a different size.
211 #define LUA_IDSIZE 60
215 ** {==================================================================
216 ** Stand-alone configuration
217 ** ===================================================================
220 #if defined(lua_c) || defined(luaall_c)
223 @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
224 @* is, whether we're running lua interactively).
225 ** CHANGE it if you have a better definition for non-POSIX/non-Windows
226 ** systems.
228 #if defined(LUA_USE_ISATTY)
229 #include <unistd.h>
230 #define lua_stdin_is_tty() isatty(0)
231 #elif defined(LUA_WIN)
232 #include <io.h>
233 #include <stdio.h>
234 #define lua_stdin_is_tty() _isatty(_fileno(stdin))
235 #else
236 #define lua_stdin_is_tty() 1 /* assume stdin is a tty */
237 #endif
241 @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
242 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
243 ** CHANGE them if you want different prompts. (You can also change the
244 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
246 #define LUA_PROMPT "> "
247 #define LUA_PROMPT2 ">> "
251 @@ LUA_PROGNAME is the default name for the stand-alone Lua program.
252 ** CHANGE it if your stand-alone interpreter has a different name and
253 ** your system is not able to detect that name automatically.
255 #define LUA_PROGNAME "lua"
259 @@ LUA_MAXINPUT is the maximum length for an input line in the
260 @* stand-alone interpreter.
261 ** CHANGE it if you need longer lines.
263 #define LUA_MAXINPUT 512
267 @@ lua_readline defines how to show a prompt and then read a line from
268 @* the standard input.
269 @@ lua_saveline defines how to "save" a read line in a "history".
270 @@ lua_freeline defines how to free a line read by lua_readline.
271 ** CHANGE them if you want to improve this functionality (e.g., by using
272 ** GNU readline and history facilities).
274 #if defined(LUA_USE_READLINE)
275 #include <stdio.h>
276 #include <readline/readline.h>
277 #include <readline/history.h>
278 #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
279 #define lua_saveline(L,idx) \
280 if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
281 add_history(lua_tostring(L, idx)); /* add it to history */
282 #define lua_freeline(L,b) ((void)L, free(b))
283 #else
284 #define lua_readline(L,b,p) \
285 ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
286 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
287 #define lua_saveline(L,idx) { (void)L; (void)idx; }
288 #define lua_freeline(L,b) { (void)L; (void)b; }
289 #endif
291 #endif
293 /* }================================================================== */
297 @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
298 @* as a percentage.
299 ** CHANGE it if you want the GC to run faster or slower (higher values
300 ** mean larger pauses which mean slower collection.) You can also change
301 ** this value dynamically.
303 #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
307 @@ LUAI_GCMUL defines the default speed of garbage collection relative to
308 @* memory allocation as a percentage.
309 ** CHANGE it if you want to change the granularity of the garbage
310 ** collection. (Higher values mean coarser collections. 0 represents
311 ** infinity, where each step performs a full collection.) You can also
312 ** change this value dynamically.
314 #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
319 @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
320 ** CHANGE it (define it) if you want exact compatibility with the
321 ** behavior of setn/getn in Lua 5.0.
323 #undef LUA_COMPAT_GETN
326 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
327 ** CHANGE it to undefined as soon as you do not need a global 'loadlib'
328 ** function (the function is still available as 'package.loadlib').
330 #undef LUA_COMPAT_LOADLIB
333 @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
334 ** CHANGE it to undefined as soon as your programs use only '...' to
335 ** access vararg parameters (instead of the old 'arg' table).
337 #define LUA_COMPAT_VARARG
340 @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
341 ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
342 ** the new '%' operator instead of 'math.mod'.
344 #define LUA_COMPAT_MOD
347 @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
348 @* facility.
349 ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
350 ** off the advisory error when nesting [[...]].
352 #define LUA_COMPAT_LSTR 1
355 @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
356 ** CHANGE it to undefined as soon as you rename 'string.gfind' to
357 ** 'string.gmatch'.
359 #define LUA_COMPAT_GFIND
362 @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
363 @* behavior.
364 ** CHANGE it to undefined as soon as you replace to 'luaL_register'
365 ** your uses of 'luaL_openlib'
367 #define LUA_COMPAT_OPENLIB
372 @@ luai_apicheck is the assert macro used by the Lua-C API.
373 ** CHANGE luai_apicheck if you want Lua to perform some checks in the
374 ** parameters it gets from API calls. This may slow down the interpreter
375 ** a bit, but may be quite useful when debugging C code that interfaces
376 ** with Lua. A useful redefinition is to use assert.h.
378 #if defined(LUA_USE_APICHECK)
379 #include <assert.h>
380 #define luai_apicheck(L,o) { (void)L; assert(o); }
381 #else
382 #define luai_apicheck(L,o) { (void)L; }
383 #endif
387 @@ LUAI_BITSINT defines the number of bits in an int.
388 ** CHANGE here if Lua cannot automatically detect the number of bits of
389 ** your machine. Probably you do not need to change this.
391 /* avoid overflows in comparison */
392 #if INT_MAX-20 < 32760
393 #define LUAI_BITSINT 16
394 #elif INT_MAX > 2147483640L
395 /* int has at least 32 bits */
396 #define LUAI_BITSINT 32
397 #else
398 #error "you must define LUA_BITSINT with number of bits in an integer"
399 #endif
403 @@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
404 @@ LUAI_INT32 is an signed integer with at least 32 bits.
405 @@ LUAI_UMEM is an unsigned integer big enough to count the total
406 @* memory used by Lua.
407 @@ LUAI_MEM is a signed integer big enough to count the total memory
408 @* used by Lua.
409 ** CHANGE here if for some weird reason the default definitions are not
410 ** good enough for your machine. (The definitions in the 'else'
411 ** part always works, but may waste space on machines with 64-bit
412 ** longs.) Probably you do not need to change this.
414 #if LUAI_BITSINT >= 32
415 #define LUAI_UINT32 unsigned int
416 #define LUAI_INT32 int
417 #define LUAI_MAXINT32 INT_MAX
418 #define LUAI_UMEM size_t
419 #define LUAI_MEM ptrdiff_t
420 #else
421 /* 16-bit ints */
422 #define LUAI_UINT32 unsigned long
423 #define LUAI_INT32 long
424 #define LUAI_MAXINT32 LONG_MAX
425 #define LUAI_UMEM unsigned long
426 #define LUAI_MEM long
427 #endif
431 @@ LUAI_MAXCALLS limits the number of nested calls.
432 ** CHANGE it if you need really deep recursive calls. This limit is
433 ** arbitrary; its only purpose is to stop infinite recursion before
434 ** exhausting memory.
436 #define LUAI_MAXCALLS 20000
440 @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
441 @* can use.
442 ** CHANGE it if you need lots of (Lua) stack space for your C
443 ** functions. This limit is arbitrary; its only purpose is to stop C
444 ** functions to consume unlimited stack space.
446 #define LUAI_MCS_AUX ((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
447 #define LUAI_MAXCSTACK (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
452 ** {==================================================================
453 ** CHANGE (to smaller values) the following definitions if your system
454 ** has a small C stack. (Or you may want to change them to larger
455 ** values if your system has a large C stack and these limits are
456 ** too rigid for you.) Some of these constants control the size of
457 ** stack-allocated arrays used by the compiler or the interpreter, while
458 ** others limit the maximum number of recursive calls that the compiler
459 ** or the interpreter can perform. Values too large may cause a C stack
460 ** overflow for some forms of deep constructs.
461 ** ===================================================================
466 @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
467 @* syntactical nested non-terminals in a program.
469 #define LUAI_MAXCCALLS 200
473 @@ LUAI_MAXVARS is the maximum number of local variables per function
474 @* (must be smaller than 250).
476 #define LUAI_MAXVARS 200
480 @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
481 @* (must be smaller than 250).
483 #define LUAI_MAXUPVALUES 60
487 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
489 #define LUAL_BUFFERSIZE BUFSIZ
491 /* }================================================================== */
497 ** {==================================================================
498 @@ LUA_NUMBER is the type of numbers in Lua.
499 ** CHANGE the following definitions only if you want to build Lua
500 ** with a number type different from double. You may also need to
501 ** change lua_number2int & lua_number2integer.
502 ** ===================================================================
505 /* Define LUA_NUMBER_INTEGRAL to produce a system that uses no
506 floating point operations by changing the type of Lua numbers from
507 double to long. It implements division and modulus so that
509 x == (x / y) * y + x % y.
511 The exponentiation function returns zero for negative exponents.
512 Defining LUA_NUMBER_INTEGRAL also removes the difftime function,
513 and the math module should not be used. The string.format function
514 no longer handles the floating point directives %e, %E, %f, %g, and
515 %G. */
517 #define LUA_NUMBER_INTEGRAL
518 #if defined LUA_NUMBER_INTEGRAL
519 #define LUA_NUMBER long
520 #else
521 #define LUA_NUMBER_DOUBLE
522 #define LUA_NUMBER double
523 #endif
526 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
527 @* over a number.
529 #define LUAI_UACNUMBER LUA_NUMBER
533 @@ LUA_NUMBER_SCAN is the format for reading numbers.
534 @@ LUA_NUMBER_FMT is the format for writing numbers.
535 @@ lua_number2str converts a number to a string.
536 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
537 @@ lua_str2number converts a string to a number.
539 #if defined LUA_NUMBER_INTEGRAL
540 #define LUA_NUMBER_SCAN "%ld"
541 #define LUA_NUMBER_FMT "%ld"
542 #else
543 #define LUA_NUMBER_SCAN "%lf"
544 #define LUA_NUMBER_FMT "%.14g"
545 #endif
546 #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
547 #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
548 #if defined LUA_NUMBER_INTEGRAL
549 #define lua_str2number(s,p) strtol((s), (p), 10)
550 #else
551 #define lua_str2number(s,p) strtod((s), (p))
552 #endif
556 @@ The luai_num* macros define the primitive operations over numbers.
558 #if defined(LUA_CORE)
559 #include <math.h>
560 #define luai_numadd(a,b) ((a)+(b))
561 #define luai_numsub(a,b) ((a)-(b))
562 #define luai_nummul(a,b) ((a)*(b))
563 #if defined LUA_NUMBER_INTEGRAL
564 #define luai_numdiv(a,b) \
565 (-1/2? \
566 (a)/(b): \
567 (((a)<0)==((b)<0)||(a)%(b)==0? \
568 (a)/(b): \
569 (a)/(b)-1))
570 #define luai_nummod(a,b) \
571 (-1/2? \
572 (a)%(b): \
573 (((a)<0)==((b)<0)||(a)%(b)==0? \
574 (a)%(b): \
575 (a)%(b)+(b)))
576 #define luai_lnumdiv(a,b) \
577 ((b)==0? \
578 (luaG_runerror(L,"divide by zero"),0): \
579 luai_numdiv(a,b))
580 #define luai_lnummod(a,b) \
581 ((b)==0? \
582 (luaG_runerror(L,"modulo by zero"),0): \
583 luai_nummod(a,b))
584 LUA_NUMBER luai_ipow(LUA_NUMBER, LUA_NUMBER);
585 #define luai_numpow(a,b) (luai_ipow(a,b))
586 #else
587 #define luai_numdiv(a,b) ((a)/(b))
588 #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
589 #define luai_lnumdiv(a,b) (luai_numdiv(a,b))
590 #define luai_lnummod(a,b) (luai_nummod(a,b))
591 #define luai_numpow(a,b) (pow(a,b))
592 #endif
593 #define luai_numunm(a) (-(a))
594 #define luai_numeq(a,b) ((a)==(b))
595 #define luai_numlt(a,b) ((a)<(b))
596 #define luai_numle(a,b) ((a)<=(b))
597 #define luai_numisnan(a) (!luai_numeq((a), (a)))
598 #endif
602 @@ lua_number2int is a macro to convert lua_Number to int.
603 @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
604 ** CHANGE them if you know a faster way to convert a lua_Number to
605 ** int (with any rounding method and without throwing errors) in your
606 ** system. In Pentium machines, a naive typecast from double to int
607 ** in C is extremely slow, so any alternative is worth trying.
610 /* On a Pentium, resort to a trick */
611 #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
612 (defined(__i386) || defined (_M_IX86) || defined(__i386__))
614 /* On a Microsoft compiler, use assembler */
615 #if defined(_MSC_VER)
617 #define lua_number2int(i,d) __asm fld d __asm fistp i
618 #define lua_number2integer(i,n) lua_number2int(i, n)
620 /* the next trick should work on any Pentium, but sometimes clashes
621 with a DirectX idiosyncrasy */
622 #else
624 union luai_Cast { double l_d; long l_l; };
625 #define lua_number2int(i,d) \
626 { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
627 #define lua_number2integer(i,n) lua_number2int(i, n)
629 #endif
632 /* this option always works, but may be slow */
633 #else
634 #define lua_number2int(i,d) ((i)=(int)(d))
635 #define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
637 #endif
639 /* }================================================================== */
643 @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
644 ** CHANGE it if your system requires alignments larger than double. (For
645 ** instance, if your system supports long doubles and they must be
646 ** aligned in 16-byte boundaries, then you should add long double in the
647 ** union.) Probably you do not need to change this.
649 #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
653 @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
654 ** CHANGE them if you prefer to use longjmp/setjmp even with C++
655 ** or if want/don't to use _longjmp/_setjmp instead of regular
656 ** longjmp/setjmp. By default, Lua handles errors with exceptions when
657 ** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
658 ** and with longjmp/setjmp otherwise.
660 #if defined(__cplusplus)
661 /* C++ exceptions */
662 #define LUAI_THROW(L,c) throw(c)
663 #define LUAI_TRY(L,c,a) try { a } catch(...) \
664 { if ((c)->status == 0) (c)->status = -1; }
665 #define luai_jmpbuf int /* dummy variable */
667 #elif defined(LUA_USE_ULONGJMP)
668 /* in Unix, try _longjmp/_setjmp (more efficient) */
669 #define LUAI_THROW(L,c) _longjmp((c)->b, 1)
670 #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
671 #define luai_jmpbuf jmp_buf
673 #else
674 /* default handling with long jumps */
675 #define LUAI_THROW(L,c) longjmp((c)->b, 1)
676 #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
677 #define luai_jmpbuf jmp_buf
679 #endif
683 @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
684 @* can do during pattern-matching.
685 ** CHANGE it if you need more captures. This limit is arbitrary.
687 #define LUA_MAXCAPTURES 32
691 @@ lua_tmpnam is the function that the OS library uses to create a
692 @* temporary name.
693 @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
694 ** CHANGE them if you have an alternative to tmpnam (which is considered
695 ** insecure) or if you want the original tmpnam anyway. By default, Lua
696 ** uses tmpnam except when POSIX is available, where it uses mkstemp.
698 #if defined(loslib_c) || defined(luaall_c)
700 #if defined(LUA_USE_MKSTEMP)
701 #include <unistd.h>
702 #define LUA_TMPNAMBUFSIZE 32
703 #define lua_tmpnam(b,e) { \
704 strcpy(b, "/tmp/lua_XXXXXX"); \
705 e = mkstemp(b); \
706 if (e != -1) close(e); \
707 e = (e == -1); }
709 #else
710 #define LUA_TMPNAMBUFSIZE L_tmpnam
711 #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
712 #endif
714 #endif
718 @@ lua_popen spawns a new process connected to the current one through
719 @* the file streams.
720 ** CHANGE it if you have a way to implement it in your system.
722 #if defined(LUA_USE_POPEN)
724 #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
725 #define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
727 #elif defined(LUA_WIN)
729 #define lua_popen(L,c,m) ((void)L, _popen(c,m))
730 #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
732 #else
734 #define lua_popen(L,c,m) ((void)((void)c, m), \
735 luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
736 #define lua_pclose(L,file) ((void)((void)L, file), 0)
738 #endif
741 @@ LUA_DL_* define which dynamic-library system Lua should use.
742 ** CHANGE here if Lua has problems choosing the appropriate
743 ** dynamic-library system for your platform (either Windows' DLL, Mac's
744 ** dyld, or Unix's dlopen). If your system is some kind of Unix, there
745 ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
746 ** it. To use dlopen you also need to adapt the src/Makefile (probably
747 ** adding -ldl to the linker options), so Lua does not select it
748 ** automatically. (When you change the makefile to add -ldl, you must
749 ** also add -DLUA_USE_DLOPEN.)
750 ** If you do not want any kind of dynamic library, undefine all these
751 ** options.
752 ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
754 #if defined(LUA_USE_DLOPEN)
755 #define LUA_DL_DLOPEN
756 #endif
758 #if defined(LUA_WIN)
759 #define LUA_DL_DLL
760 #endif
764 @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
765 @* (the data goes just *before* the lua_State pointer).
766 ** CHANGE (define) this if you really need that. This value must be
767 ** a multiple of the maximum alignment required for your machine.
769 #define LUAI_EXTRASPACE 0
773 @@ luai_userstate* allow user-specific actions on threads.
774 ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
775 ** extra when a thread is created/deleted/resumed/yielded.
777 #define luai_userstateopen(L) ((void)L)
778 #define luai_userstateclose(L) ((void)L)
779 #define luai_userstatethread(L,L1) ((void)L)
780 #define luai_userstatefree(L) ((void)L)
781 #define luai_userstateresume(L,n) ((void)L)
782 #define luai_userstateyield(L,n) ((void)L)
786 @@ LUA_INTFRMLEN is the length modifier for integer conversions
787 @* in 'string.format'.
788 @@ LUA_INTFRM_T is the integer type correspoding to the previous length
789 @* modifier.
790 ** CHANGE them if your system supports long long or does not support long.
793 #if defined(LUA_USELONGLONG)
795 #define LUA_INTFRMLEN "ll"
796 #define LUA_INTFRM_T long long
798 #else
800 #define LUA_INTFRMLEN "l"
801 #define LUA_INTFRM_T long
803 #endif
807 /* =================================================================== */
810 ** Local configuration. You can use this space to add your redefinitions
811 ** without modifying the main part of the file.
816 #endif