1 /*
2 ** $Id: luaconf.h,v 1.81 2006/02/10 17:44:06 roberto Exp $
3 ** Configuration file for Lua
4 ** See Copyright Notice in lua.h
5 */
6 
7 
8 #ifndef lconfig_h
9 #define lconfig_h
10 
11 #include <limits.h>
12 #include <stddef.h>
13 
14 
15 /*
16 ** ==================================================================
17 ** Search for "@@" to find all configurable definitions.
18 ** ===================================================================
19 */
20 
21 
22 /*
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.
26 */
27 #if defined(__STRICT_ANSI__)
28 #define LUA_ANSI
29 #endif
30 
31 
32 #if !defined(LUA_ANSI) && defined(_WIN32)
33 #define LUA_WIN
34 #endif
35 
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
41 
42 #if defined(LUA_USE_MACOSX)
43 #define LUA_USE_POSIX
44 #define LUA_DL_DYLD		/* does not need extra library */
45 #endif
46 
47 
48 
49 /*
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.
53 */
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
60 
61 
62 /*
63 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
64 @* Lua libraries.
65 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
66 @* C libraries.
67 ** CHANGE them if your machine has a non-conventional directory
68 ** hierarchy or if you want to install your libraries in
69 ** non-conventional directories.
70 */
71 #if defined(_WIN32)
72 /*
73 ** In Windows, any exclamation mark ('!') in the path is replaced by the
74 ** path of the directory of the executable file of the current process.
75 */
76 #define LUA_LDIR	"!\\lua\\"
77 #define LUA_CDIR	"!\\"
78 #define LUA_PATH_DEFAULT  \
79 		".\\?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
80 		             LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua"
81 #define LUA_CPATH_DEFAULT \
82 	".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
83 
84 #else
85 #define LUA_ROOT	"/usr/local/"
86 #define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
87 #define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
88 #define LUA_PATH_DEFAULT  \
89 		"./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
90 		            LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
91 #define LUA_CPATH_DEFAULT \
92 	"./?.so;"  LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
93 #endif
94 
95 
96 /*
97 @@ LUA_DIRSEP is the directory separator (for submodules).
98 ** CHANGE it if your machine does not use "/" as the directory separator
99 ** and is not Windows. (On Windows Lua automatically uses "\".)
100 */
101 #if defined(_WIN32)
102 #define LUA_DIRSEP	"\\"
103 #else
104 #define LUA_DIRSEP	"/"
105 #endif
106 
107 
108 /*
109 @@ LUA_PATHSEP is the character that separates templates in a path.
110 @@ LUA_PATH_MARK is the string that marks the substitution points in a
111 @* template.
112 @@ LUA_EXECDIR in a Windows path is replaced by the executable's
113 @* directory.
114 @@ LUA_IGMARK is a mark to ignore all before it when bulding the
115 @* luaopen_ function name.
116 ** CHANGE them if for some reason your system cannot use those
117 ** characters. (E.g., if one of those characters is a common character
118 ** in file/directory names.) Probably you do not need to change them.
119 */
120 #define LUA_PATHSEP	";"
121 #define LUA_PATH_MARK	"?"
122 #define LUA_EXECDIR	"!"
123 #define LUA_IGMARK	"-"
124 
125 
126 /*
127 @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
128 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
129 ** machines, ptrdiff_t gives a good choice between int or long.)
130 */
131 #define LUA_INTEGER	ptrdiff_t
132 
133 
134 /*
135 @@ LUA_API is a mark for all core API functions.
136 @@ LUALIB_API is a mark for all standard library functions.
137 ** CHANGE them if you need to define those functions in some special way.
138 ** For instance, if you want to create one Windows DLL with the core and
139 ** the libraries, you may want to use the following definition (define
140 ** LUA_BUILD_AS_DLL to get it).
141 */
142 #if defined(LUA_BUILD_AS_DLL)
143 
144 #if defined(LUA_CORE) || defined(LUA_LIB)
145 #define LUA_API __declspec(dllexport)
146 #else
147 #define LUA_API __declspec(dllimport)
148 #endif
149 
150 #else
151 
152 #define LUA_API		extern
153 
154 #endif
155 
156 /* more often than not the libs go together with the core */
157 #define LUALIB_API	LUA_API
158 
159 
160 /*
161 @@ LUAI_FUNC is a mark for all extern functions that are not to be
162 @* exported to outside modules.
163 @@ LUAI_DATA is a mark for all extern (const) variables that are not to
164 @* be exported to outside modules.
165 ** CHANGE them if you need to mark them in some special way. Elf/gcc
166 ** (versions 3.2 and later) mark them as "hidden" to optimize access
167 ** when Lua is compiled as a shared library.
168 */
169 #if defined(luaall_c)
170 #define LUAI_FUNC	static
171 #define LUAI_DATA	/* empty */
172 
173 #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
174       defined(__ELF__)
175 #define LUAI_FUNC	__attribute__((visibility("hidden"))) extern
176 #define LUAI_DATA	LUAI_FUNC
177 
178 #else
179 #define LUAI_FUNC	extern
180 #define LUAI_DATA	extern
181 #endif
182 
183 
184 
185 /*
186 @@ LUA_QL describes how error messages quote program elements.
187 ** CHANGE it if you want a different appearance.
188 */
189 #define LUA_QL(x)	"'" x "'"
190 #define LUA_QS		LUA_QL("%s")
191 
192 
193 /*
194 @@ LUA_IDSIZE gives the maximum size for the description of the source
195 @* of a function in debug information.
196 ** CHANGE it if you want a different size.
197 */
198 #define LUA_IDSIZE	60
199 
200 
201 /*
202 ** {==================================================================
203 ** Stand-alone configuration
204 ** ===================================================================
205 */
206 
207 #if defined(lua_c) || defined(luaall_c)
208 
209 /*
210 @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
211 @* is, whether we're running lua interactively).
212 ** CHANGE it if you have a better definition for non-POSIX/non-Windows
213 ** systems.
214 */
215 #if defined(LUA_USE_ISATTY)
216 #include <unistd.h>
217 #define lua_stdin_is_tty()	isatty(0)
218 #elif defined(LUA_WIN)
219 #include <io.h>
220 #include <stdio.h>
221 #define lua_stdin_is_tty()	_isatty(_fileno(stdin))
222 #else
223 #define lua_stdin_is_tty()	1  /* assume stdin is a tty */
224 #endif
225 
226 
227 /*
228 @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
229 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
230 ** CHANGE them if you want different prompts. (You can also change the
231 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
232 */
233 #define LUA_PROMPT		"> "
234 #define LUA_PROMPT2		">> "
235 
236 
237 /*
238 @@ LUA_PROGNAME is the default name for the stand-alone Lua program.
239 ** CHANGE it if your stand-alone interpreter has a different name and
240 ** your system is not able to detect that name automatically.
241 */
242 #define LUA_PROGNAME		"lua"
243 
244 
245 /*
246 @@ LUA_MAXINPUT is the maximum length for an input line in the
247 @* stand-alone interpreter.
248 ** CHANGE it if you need longer lines.
249 */
250 #define LUA_MAXINPUT	512
251 
252 
253 /*
254 @@ lua_readline defines how to show a prompt and then read a line from
255 @* the standard input.
256 @@ lua_saveline defines how to "save" a read line in a "history".
257 @@ lua_freeline defines how to free a line read by lua_readline.
258 ** CHANGE them if you want to improve this functionality (e.g., by using
259 ** GNU readline and history facilities).
260 */
261 #if defined(LUA_USE_READLINE)
262 #include <stdio.h>
263 #include <readline/readline.h>
264 #include <readline/history.h>
265 #define lua_readline(L,b,p)	((void)L, ((b)=readline(p)) != NULL)
266 #define lua_saveline(L,idx) \
267 	if (lua_strlen(L,idx) > 0)  /* non-empty line? */ \
268 	  add_history(lua_tostring(L, idx));  /* add it to history */
269 #define lua_freeline(L,b)	((void)L, free(b))
270 #else
271 #define lua_readline(L,b,p)	\
272 	((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
273 	fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
274 #define lua_saveline(L,idx)	{ (void)L; (void)idx; }
275 #define lua_freeline(L,b)	{ (void)L; (void)b; }
276 #endif
277 
278 #endif
279 
280 /* }================================================================== */
281 
282 
283 /*
284 @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
285 @* as a percentage.
286 ** CHANGE it if you want the GC to run faster or slower (higher values
287 ** mean larger pauses which mean slower collection.) You can also change
288 ** this value dynamically.
289 */
290 #define LUAI_GCPAUSE	200  /* 200% (wait memory to double before next GC) */
291 
292 
293 /*
294 @@ LUAI_GCMUL defines the default speed of garbage collection relative to
295 @* memory allocation as a percentage.
296 ** CHANGE it if you want to change the granularity of the garbage
297 ** collection. (Higher values mean coarser collections. 0 represents
298 ** infinity, where each step performs a full collection.) You can also
299 ** change this value dynamically.
300 */
301 #define LUAI_GCMUL	200 /* GC runs 'twice the speed' of memory allocation */
302 
303 
304 
305 /*
306 @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
307 ** CHANGE it (define it) if you want exact compatibility with the
308 ** behavior of setn/getn in Lua 5.0.
309 */
310 #undef LUA_COMPAT_GETN
311 
312 /*
313 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
314 ** CHANGE it to undefined as soon as you do not need a global 'loadlib'
315 ** function (the function is still available as 'package.loadlib').
316 */
317 #undef LUA_COMPAT_LOADLIB
318 
319 /*
320 @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
321 ** CHANGE it to undefined as soon as your programs use only '...' to
322 ** access vararg parameters (instead of the old 'arg' table).
323 */
324 #define LUA_COMPAT_VARARG
325 
326 /*
327 @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
328 ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
329 ** the new '%' operator instead of 'math.mod'.
330 */
331 #define LUA_COMPAT_MOD
332 
333 /*
334 @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
335 @* facility.
336 ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
337 ** off the advisory error when nesting [[...]].
338 */
339 #define LUA_COMPAT_LSTR		1
340 
341 /*
342 @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
343 ** CHANGE it to undefined as soon as you rename 'string.gfind' to
344 ** 'string.gmatch'.
345 */
346 #define LUA_COMPAT_GFIND
347 
348 /*
349 @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
350 @* behavior.
351 ** CHANGE it to undefined as soon as you replace to 'luaL_registry'
352 ** your uses of 'luaL_openlib'
353 */
354 #define LUA_COMPAT_OPENLIB
355 
356 
357 
358 /*
359 @@ luai_apicheck is the assert macro used by the Lua-C API.
360 ** CHANGE luai_apicheck if you want Lua to perform some checks in the
361 ** parameters it gets from API calls. This may slow down the interpreter
362 ** a bit, but may be quite useful when debugging C code that interfaces
363 ** with Lua. A useful redefinition is to use assert.h.
364 */
365 #if defined(LUA_USE_APICHECK)
366 #include <assert.h>
367 #define luai_apicheck(L,o)	{ (void)L; assert(o); }
368 #else
369 #define luai_apicheck(L,o)	{ (void)L; }
370 #endif
371 
372 
373 /*
374 @@ LUAI_BITSINT defines the number of bits in an int.
375 ** CHANGE here if Lua cannot automatically detect the number of bits of
376 ** your machine. Probably you do not need to change this.
377 */
378 /* avoid overflows in comparison */
379 #if INT_MAX-20 < 32760
380 #define LUAI_BITSINT	16
381 #elif INT_MAX > 2147483640L
382 /* int has at least 32 bits */
383 #define LUAI_BITSINT	32
384 #else
385 #error "you must define LUA_BITSINT with number of bits in an integer"
386 #endif
387 
388 
389 /*
390 @@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
391 @@ LUAI_INT32 is an signed integer with at least 32 bits.
392 @@ LUAI_UMEM is an unsigned integer big enough to count the total
393 @* memory used by Lua.
394 @@ LUAI_MEM is a signed integer big enough to count the total memory
395 @* used by Lua.
396 ** CHANGE here if for some weird reason the default definitions are not
397 ** good enough for your machine. (The definitions in the 'else'
398 ** part always works, but may waste space on machines with 64-bit
399 ** longs.) Probably you do not need to change this.
400 */
401 #if LUAI_BITSINT >= 32
402 #define LUAI_UINT32	unsigned int
403 #define LUAI_INT32	int
404 #define LUAI_MAXINT32	INT_MAX
405 #define LUAI_UMEM	size_t
406 #define LUAI_MEM	ptrdiff_t
407 #else
408 /* 16-bit ints */
409 #define LUAI_UINT32	unsigned long
410 #define LUAI_INT32	long
411 #define LUAI_MAXINT32	LONG_MAX
412 #define LUAI_UMEM	unsigned long
413 #define LUAI_MEM	long
414 #endif
415 
416 
417 /*
418 @@ LUAI_MAXCALLS limits the number of nested calls.
419 ** CHANGE it if you need really deep recursive calls. This limit is
420 ** arbitrary; its only purpose is to stop infinite recursion before
421 ** exhausting memory.
422 */
423 #define LUAI_MAXCALLS	20000
424 
425 
426 /*
427 @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
428 @* can use.
429 ** CHANGE it if you need lots of (Lua) stack space for your C
430 ** functions. This limit is arbitrary; its only purpose is to stop C
431 ** functions to consume unlimited stack space.
432 */
433 #define LUAI_MAXCSTACK	2048
434 
435 
436 
437 /*
438 ** {==================================================================
439 ** CHANGE (to smaller values) the following definitions if your system
440 ** has a small C stack. (Or you may want to change them to larger
441 ** values if your system has a large C stack and these limits are
442 ** too rigid for you.) Some of these constants control the size of
443 ** stack-allocated arrays used by the compiler or the interpreter, while
444 ** others limit the maximum number of recursive calls that the compiler
445 ** or the interpreter can perform. Values too large may cause a C stack
446 ** overflow for some forms of deep constructs.
447 ** ===================================================================
448 */
449 
450 
451 /*
452 @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
453 @* syntactical nested non-terminals in a program.
454 */
455 #define LUAI_MAXCCALLS		200
456 
457 
458 /*
459 @@ LUAI_MAXVARS is the maximum number of local variables per function
460 @* (must be smaller than 250).
461 */
462 #define LUAI_MAXVARS		200
463 
464 
465 /*
466 @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
467 @* (must be smaller than 250).
468 */
469 #define LUAI_MAXUPVALUES	60
470 
471 
472 /*
473 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
474 */
475 #define LUAL_BUFFERSIZE		BUFSIZ
476 
477 /* }================================================================== */
478 
479 
480 
481 
482 /*
483 ** {==================================================================
484 @@ LUA_NUMBER is the type of numbers in Lua.
485 ** CHANGE the following definitions only if you want to build Lua
486 ** with a number type different from double. You may also need to
487 ** change lua_number2int & lua_number2integer.
488 ** ===================================================================
489 */
490 
491 #define LUA_NUMBER_DOUBLE
492 #define LUA_NUMBER	double
493 
494 /*
495 @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
496 @* over a number.
497 */
498 #define LUAI_UACNUMBER	double
499 
500 
501 /*
502 @@ LUA_NUMBER_SCAN is the format for reading numbers.
503 @@ LUA_NUMBER_FMT is the format for writing numbers.
504 @@ lua_number2str converts a number to a string.
505 @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
506 @@ lua_str2number converts a string to a number.
507 */
508 #define LUA_NUMBER_SCAN		"%lf"
509 #define LUA_NUMBER_FMT		"%.14g"
510 #define lua_number2str(s,n)	sprintf((s), LUA_NUMBER_FMT, (n))
511 #define LUAI_MAXNUMBER2STR	32 /* 16 digits, sign, point, and \0 */
512 #define lua_str2number(s,p)	strtod((s), (p))
513 
514 
515 /*
516 @@ The luai_num* macros define the primitive operations over numbers.
517 */
518 #if defined(LUA_CORE)
519 #include <math.h>
520 #define luai_numadd(a,b)	((a)+(b))
521 #define luai_numsub(a,b)	((a)-(b))
522 #define luai_nummul(a,b)	((a)*(b))
523 #define luai_numdiv(a,b)	((a)/(b))
524 #define luai_nummod(a,b)	((a) - floor((a)/(b))*(b))
525 #define luai_numpow(a,b)	(pow(a,b))
526 #define luai_numunm(a)		(-(a))
527 #define luai_numeq(a,b)		((a)==(b))
528 #define luai_numlt(a,b)		((a)<(b))
529 #define luai_numle(a,b)		((a)<=(b))
530 #define luai_numisnan(a)	(!luai_numeq((a), (a)))
531 #endif
532 
533 
534 /*
535 @@ lua_number2int is a macro to convert lua_Number to int.
536 @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
537 ** CHANGE them if you know a faster way to convert a lua_Number to
538 ** int (with any rounding method and without throwing errors) in your
539 ** system. In Pentium machines, a naive typecast from double to int
540 ** in C is extremely slow, so any alternative is worth trying.
541 */
542 
543 /* On a Pentium, resort to a trick */
544 #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
545     (defined(__i386) || defined (_M_IX86) || defined(__i386__))
546 union luai_Cast { double l_d; long l_l; };
547 #define lua_number2int(i,d) \
548   { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
549 #define lua_number2integer(i,n)		lua_number2int(i, n)
550 
551 /* this option always works, but may be slow */
552 #else
553 #define lua_number2int(i,d)	((i)=(int)(d))
554 #define lua_number2integer(i,d)	((i)=(lua_Integer)(d))
555 
556 #endif
557 
558 /* }================================================================== */
559 
560 
561 /*
562 @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
563 ** CHANGE it if your system requires alignments larger than double. (For
564 ** instance, if your system supports long doubles and they must be
565 ** aligned in 16-byte boundaries, then you should add long double in the
566 ** union.) Probably you do not need to change this.
567 */
568 #define LUAI_USER_ALIGNMENT_T	union { double u; void *s; long l; }
569 
570 
571 /*
572 @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
573 ** CHANGE them if you prefer to use longjmp/setjmp even with C++
574 ** or if want/don't to use _longjmp/_setjmp instead of regular
575 ** longjmp/setjmp. By default, Lua handles errors with exceptions when
576 ** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
577 ** and with longjmp/setjmp otherwise.
578 */
579 #if defined(__cplusplus)
580 /* C++ exceptions */
581 #define LUAI_THROW(L,c)	throw(c)
582 #define LUAI_TRY(L,c,a)	try { a } catch(...) \
583 	{ if ((c)->status == 0) (c)->status = -1; }
584 #define luai_jmpbuf	int  /* dummy variable */
585 
586 #elif defined(LUA_USE_ULONGJMP)
587 /* in Unix, try _longjmp/_setjmp (more efficient) */
588 #define LUAI_THROW(L,c)	_longjmp((c)->b, 1)
589 #define LUAI_TRY(L,c,a)	if (_setjmp((c)->b) == 0) { a }
590 #define luai_jmpbuf	jmp_buf
591 
592 #else
593 /* default handling with long jumps */
594 #define LUAI_THROW(L,c)	longjmp((c)->b, 1)
595 #define LUAI_TRY(L,c,a)	if (setjmp((c)->b) == 0) { a }
596 #define luai_jmpbuf	jmp_buf
597 
598 #endif
599 
600 
601 /*
602 @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
603 @* can do during pattern-matching.
604 ** CHANGE it if you need more captures. This limit is arbitrary.
605 */
606 #define LUA_MAXCAPTURES		32
607 
608 
609 /*
610 @@ lua_tmpnam is the function that the OS library uses to create a
611 @* temporary name.
612 @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
613 ** CHANGE them if you have an alternative to tmpnam (which is considered
614 ** insecure) or if you want the original tmpnam anyway.  By default, Lua
615 ** uses tmpnam except when POSIX is available, where it uses mkstemp.
616 */
617 #if defined(loslib_c) || defined(luaall_c)
618 
619 #if defined(LUA_USE_MKSTEMP)
620 #include <unistd.h>
621 #define LUA_TMPNAMBUFSIZE	32
622 #define lua_tmpnam(b,e)	{ \
623 	strcpy(b, "/tmp/lua_XXXXXX"); \
624 	e = mkstemp(b); \
625 	if (e != -1) close(e); \
626 	e = (e == -1); }
627 
628 #else
629 #define LUA_TMPNAMBUFSIZE	L_tmpnam
630 #define lua_tmpnam(b,e)		{ e = (tmpnam(b) == NULL); }
631 #endif
632 
633 #endif
634 
635 
636 /*
637 @@ lua_popen spawns a new process connected to the current one through
638 @* the file streams.
639 ** CHANGE it if you have a way to implement it in your system.
640 */
641 #if defined(LUA_USE_POPEN)
642 
643 #define lua_popen(L,c,m)	((void)L, popen(c,m))
644 #define lua_pclose(L,file)	((void)L, (pclose(file) != -1))
645 
646 #elif defined(LUA_WIN)
647 
648 #define lua_popen(L,c,m)	((void)L, _popen(c,m))
649 #define lua_pclose(L,file)	((void)L, (_pclose(file) != -1))
650 
651 #else
652 
653 #define lua_popen(L,c,m)	((void)((void)c, m),  \
654 		luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
655 #define lua_pclose(L,file)		((void)((void)L, file), 0)
656 
657 #endif
658 
659 /*
660 @@ LUA_DL_* define which dynamic-library system Lua should use.
661 ** CHANGE here if Lua has problems choosing the appropriate
662 ** dynamic-library system for your platform (either Windows' DLL, Mac's
663 ** dyld, or Unix's dlopen). If your system is some kind of Unix, there
664 ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
665 ** it.  To use dlopen you also need to adapt the src/Makefile (probably
666 ** adding -ldl to the linker options), so Lua does not select it
667 ** automatically.  (When you change the makefile to add -ldl, you must
668 ** also add -DLUA_USE_DLOPEN.)
669 ** If you do not want any kind of dynamic library, undefine all these
670 ** options.
671 ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
672 */
673 #if defined(LUA_USE_DLOPEN)
674 #define LUA_DL_DLOPEN
675 #endif
676 
677 #if defined(LUA_WIN)
678 #define LUA_DL_DLL
679 #endif
680 
681 
682 /*
683 @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
684 @* (the data goes just *before* the lua_State pointer).
685 ** CHANGE (define) this if you really need that. This value must be
686 ** a multiple of the maximum alignment required for your machine.
687 */
688 #define LUAI_EXTRASPACE		0
689 
690 
691 /*
692 @@ luai_userstate* allow user-specific actions on threads.
693 ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
694 ** extra when a thread is created/deleted/resumed/yielded.
695 */
696 #define luai_userstateopen(L)		((void)L)
697 #define luai_userstateclose(L)		((void)L)
698 #define luai_userstatethread(L,L1)	((void)L)
699 #define luai_userstatefree(L)		((void)L)
700 #define luai_userstateresume(L,n)	((void)L)
701 #define luai_userstateyield(L,n)	((void)L)
702 
703 
704 /*
705 @@ LUA_INTFRMLEN is the length modifier for integer conversions
706 @* in 'string.format'.
707 @@ LUA_INTFRM_T is the integer type correspoding to the previous length
708 @* modifier.
709 ** CHANGE them if your system supports long long or does not support long.
710 */
711 
712 #if defined(LUA_USELONGLONG)
713 
714 #define LUA_INTFRMLEN		"ll"
715 #define LUA_INTFRM_T		long long
716 
717 #else
718 
719 #define LUA_INTFRMLEN		"l"
720 #define LUA_INTFRM_T		long
721 
722 #endif
723 
724 
725 
726 /* =================================================================== */
727 
728 /*
729 ** Local configuration. You can use this space to add your redefinitions
730 ** without modifying the main part of the file.
731 */
732 
733 
734 
735 #endif
736 
737