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