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