]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - liblua/luaconf.h
couple q5 fixes + continue with em4x05 em4x69..
[proxmark3-svn] / liblua / luaconf.h
... / ...
CommitLineData
1/*
2** $Id: luaconf.h,v 1.176 2013/03/16 21:10:18 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(LUA_ANSI) && defined(__STRICT_ANSI__)
28#define LUA_ANSI
29#endif
30
31
32#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE)
33#define LUA_WIN /* enable goodies for regular Windows platforms */
34#endif
35
36#if defined(LUA_WIN)
37#define LUA_DL_DLL
38#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
39#endif
40
41
42
43#if defined(LUA_USE_LINUX)
44#define LUA_USE_POSIX
45#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
46#define LUA_USE_READLINE /* needs some extra libraries */
47#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */
48#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
49#define LUA_USE_LONGLONG /* assume support for long long */
50#endif
51
52#if defined(LUA_USE_MACOSX)
53#define LUA_USE_POSIX
54#define LUA_USE_DLOPEN /* does not need -ldl */
55#define LUA_USE_READLINE /* needs an extra library: -lreadline */
56#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */
57#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
58#define LUA_USE_LONGLONG /* assume support for long long */
59#endif
60
61
62
63/*
64@@ LUA_USE_POSIX includes all functionality listed as X/Open System
65@* Interfaces Extension (XSI).
66** CHANGE it (define it) if your system is XSI compatible.
67*/
68#if defined(LUA_USE_POSIX)
69#define LUA_USE_MKSTEMP
70#define LUA_USE_ISATTY
71#define LUA_USE_POPEN
72#define LUA_USE_ULONGJMP
73#define LUA_USE_GMTIME_R
74#endif
75
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#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#define LUA_LDIR "!\\lua\\"
93#define LUA_CDIR "!\\"
94#define LUA_PATH_DEFAULT \
95 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
96 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" ".\\?.lua"
97#define LUA_CPATH_DEFAULT \
98 LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll"
99
100#else /* }{ */
101
102#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
103#define LUA_ROOT "/usr/local/"
104#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR
105#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR
106#define LUA_PATH_DEFAULT \
107 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
108 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" "./?.lua"
109#define LUA_CPATH_DEFAULT \
110 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
111#endif /* } */
112
113
114/*
115@@ LUA_DIRSEP is the directory separator (for submodules).
116** CHANGE it if your machine does not use "/" as the directory separator
117** and is not Windows. (On Windows Lua automatically uses "\".)
118*/
119#if defined(_WIN32)
120#define LUA_DIRSEP "\\"
121#else
122#define LUA_DIRSEP "/"
123#endif
124
125
126/*
127@@ LUA_ENV is the name of the variable that holds the current
128@@ environment, used to access global names.
129** CHANGE it if you do not like this name.
130*/
131#define LUA_ENV "_ENV"
132
133
134/*
135@@ LUA_API is a mark for all core API functions.
136@@ LUALIB_API is a mark for all auxiliary library functions.
137@@ LUAMOD_API is a mark for all standard library opening functions.
138** CHANGE them if you need to define those functions in some special way.
139** For instance, if you want to create one Windows DLL with the core and
140** the libraries, you may want to use the following definition (define
141** LUA_BUILD_AS_DLL to get it).
142*/
143#if defined(LUA_BUILD_AS_DLL) /* { */
144
145#if defined(LUA_CORE) || defined(LUA_LIB) /* { */
146#define LUA_API __declspec(dllexport)
147#else /* }{ */
148#define LUA_API __declspec(dllimport)
149#endif /* } */
150
151#else /* }{ */
152
153#define LUA_API extern
154
155#endif /* } */
156
157
158/* more often than not the libs go together with the core */
159#define LUALIB_API LUA_API
160#define LUAMOD_API LUALIB_API
161
162
163/*
164@@ LUAI_FUNC is a mark for all extern functions that are not to be
165@* exported to outside modules.
166@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
167@* that are not to be exported to outside modules (LUAI_DDEF for
168@* definitions and LUAI_DDEC for declarations).
169** CHANGE them if you need to mark them in some special way. Elf/gcc
170** (versions 3.2 and later) mark them as "hidden" to optimize access
171** when Lua is compiled as a shared library. Not all elf targets support
172** this attribute. Unfortunately, gcc does not offer a way to check
173** whether the target offers that support, and those without support
174** give a warning about it. To avoid these warnings, change to the
175** default definition.
176*/
177#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
178 defined(__ELF__) /* { */
179#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
180#define LUAI_DDEC LUAI_FUNC
181#define LUAI_DDEF /* empty */
182
183#else /* }{ */
184#define LUAI_FUNC extern
185#define LUAI_DDEC extern
186#define LUAI_DDEF /* empty */
187#endif /* } */
188
189
190
191/*
192@@ LUA_QL describes how error messages quote program elements.
193** CHANGE it if you want a different appearance.
194*/
195#define LUA_QL(x) "'" x "'"
196#define LUA_QS LUA_QL("%s")
197
198
199/*
200@@ LUA_IDSIZE gives the maximum size for the description of the source
201@* of a function in debug information.
202** CHANGE it if you want a different size.
203*/
204#define LUA_IDSIZE 60
205
206
207/*
208@@ luai_writestring/luai_writeline define how 'print' prints its results.
209** They are only used in libraries and the stand-alone program. (The #if
210** avoids including 'stdio.h' everywhere.)
211*/
212#if defined(LUA_LIB) || defined(lua_c)
213#include <stdio.h>
214#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
215#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout))
216#endif
217
218/*
219@@ luai_writestringerror defines how to print error messages.
220** (A format string with one argument is enough for Lua...)
221*/
222#define luai_writestringerror(s,p) \
223 (fprintf(stderr, (s), (p)), fflush(stderr))
224
225
226/*
227@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,
228** strings that are internalized. (Cannot be smaller than reserved words
229** or tags for metamethods, as these strings must be internalized;
230** #("function") = 8, #("__newindex") = 10.)
231*/
232#define LUAI_MAXSHORTLEN 40
233
234
235
236/*
237** {==================================================================
238** Compatibility with previous versions
239** ===================================================================
240*/
241
242/*
243@@ LUA_COMPAT_ALL controls all compatibility options.
244** You can define it to get all options, or change specific options
245** to fit your specific needs.
246*/
247#if defined(LUA_COMPAT_ALL) /* { */
248
249/*
250@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
251** You can replace it with 'table.unpack'.
252*/
253#define LUA_COMPAT_UNPACK
254
255/*
256@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
257** You can replace it with 'package.searchers'.
258*/
259#define LUA_COMPAT_LOADERS
260
261/*
262@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
263** You can call your C function directly (with light C functions).
264*/
265#define lua_cpcall(L,f,u) \
266 (lua_pushcfunction(L, (f)), \
267 lua_pushlightuserdata(L,(u)), \
268 lua_pcall(L,1,0,0))
269
270
271/*
272@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
273** You can rewrite 'log10(x)' as 'log(x, 10)'.
274*/
275#define LUA_COMPAT_LOG10
276
277/*
278@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
279** library. You can rewrite 'loadstring(s)' as 'load(s)'.
280*/
281#define LUA_COMPAT_LOADSTRING
282
283/*
284@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
285*/
286#define LUA_COMPAT_MAXN
287
288/*
289@@ The following macros supply trivial compatibility for some
290** changes in the API. The macros themselves document how to
291** change your code to avoid using them.
292*/
293#define lua_strlen(L,i) lua_rawlen(L, (i))
294
295#define lua_objlen(L,i) lua_rawlen(L, (i))
296
297#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
298#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
299
300/*
301@@ LUA_COMPAT_MODULE controls compatibility with previous
302** module functions 'module' (Lua) and 'luaL_register' (C).
303*/
304#define LUA_COMPAT_MODULE
305
306#endif /* } */
307
308/* }================================================================== */
309
310
311
312/*
313@@ LUAI_BITSINT defines the number of bits in an int.
314** CHANGE here if Lua cannot automatically detect the number of bits of
315** your machine. Probably you do not need to change this.
316*/
317/* avoid overflows in comparison */
318#if INT_MAX-20 < 32760 /* { */
319#define LUAI_BITSINT 16
320#elif INT_MAX > 2147483640L /* }{ */
321/* int has at least 32 bits */
322#define LUAI_BITSINT 32
323#else /* }{ */
324#error "you must define LUA_BITSINT with number of bits in an integer"
325#endif /* } */
326
327
328/*
329@@ LUA_INT32 is an signed integer with exactly 32 bits.
330@@ LUAI_UMEM is an unsigned integer big enough to count the total
331@* memory used by Lua.
332@@ LUAI_MEM is a signed integer big enough to count the total memory
333@* used by Lua.
334** CHANGE here if for some weird reason the default definitions are not
335** good enough for your machine. Probably you do not need to change
336** this.
337*/
338#if LUAI_BITSINT >= 32 /* { */
339#define LUA_INT32 int
340#define LUAI_UMEM size_t
341#define LUAI_MEM ptrdiff_t
342#else /* }{ */
343/* 16-bit ints */
344#define LUA_INT32 long
345#define LUAI_UMEM unsigned long
346#define LUAI_MEM long
347#endif /* } */
348
349
350/*
351@@ LUAI_MAXSTACK limits the size of the Lua stack.
352** CHANGE it if you need a different limit. This limit is arbitrary;
353** its only purpose is to stop Lua to consume unlimited stack
354** space (and to reserve some numbers for pseudo-indices).
355*/
356#if LUAI_BITSINT >= 32
357#define LUAI_MAXSTACK 1000000
358#else
359#define LUAI_MAXSTACK 15000
360#endif
361
362/* reserve some space for error handling */
363#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
364
365
366
367
368/*
369@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
370** CHANGE it if it uses too much C-stack space.
371*/
372#define LUAL_BUFFERSIZE BUFSIZ
373
374
375
376
377/*
378** {==================================================================
379@@ LUA_NUMBER is the type of numbers in Lua.
380** CHANGE the following definitions only if you want to build Lua
381** with a number type different from double. You may also need to
382** change lua_number2int & lua_number2integer.
383** ===================================================================
384*/
385
386#define LUA_NUMBER_DOUBLE
387#define LUA_NUMBER double
388
389/*
390@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
391@* over a number.
392*/
393#define LUAI_UACNUMBER double
394
395
396/*
397@@ LUA_NUMBER_SCAN is the format for reading numbers.
398@@ LUA_NUMBER_FMT is the format for writing numbers.
399@@ lua_number2str converts a number to a string.
400@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
401*/
402#define LUA_NUMBER_SCAN "%lf"
403#define LUA_NUMBER_FMT "%.14g"
404#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
405#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
406
407
408/*
409@@ l_mathop allows the addition of an 'l' or 'f' to all math operations
410*/
411#define l_mathop(x) (x)
412
413
414/*
415@@ lua_str2number converts a decimal numeric string to a number.
416@@ lua_strx2number converts an hexadecimal numeric string to a number.
417** In C99, 'strtod' does both conversions. C89, however, has no function
418** to convert floating hexadecimal strings to numbers. For these
419** systems, you can leave 'lua_strx2number' undefined and Lua will
420** provide its own implementation.
421*/
422#define lua_str2number(s,p) strtod((s), (p))
423
424#if defined(LUA_USE_STRTODHEX)
425#define lua_strx2number(s,p) strtod((s), (p))
426#endif
427
428
429/*
430@@ The luai_num* macros define the primitive operations over numbers.
431*/
432
433/* the following operations need the math library */
434#if defined(lobject_c) || defined(lvm_c)
435#include <math.h>
436#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b))
437#define luai_numpow(L,a,b) (l_mathop(pow)(a,b))
438#endif
439
440/* these are quite standard operations */
441#if defined(LUA_CORE)
442#define luai_numadd(L,a,b) ((a)+(b))
443#define luai_numsub(L,a,b) ((a)-(b))
444#define luai_nummul(L,a,b) ((a)*(b))
445#define luai_numdiv(L,a,b) ((a)/(b))
446#define luai_numunm(L,a) (-(a))
447#define luai_numeq(a,b) ((a)==(b))
448#define luai_numlt(L,a,b) ((a)<(b))
449#define luai_numle(L,a,b) ((a)<=(b))
450#define luai_numisnan(L,a) (!luai_numeq((a), (a)))
451#endif
452
453
454
455/*
456@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
457** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
458** machines, ptrdiff_t gives a good choice between int or long.)
459*/
460#define LUA_INTEGER ptrdiff_t
461
462/*
463@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.
464** It must have at least 32 bits.
465*/
466#define LUA_UNSIGNED unsigned LUA_INT32
467
468
469
470/*
471** Some tricks with doubles
472*/
473
474#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */
475/*
476** The next definitions activate some tricks to speed up the
477** conversion from doubles to integer types, mainly to LUA_UNSIGNED.
478**
479@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a
480** DirectX idiosyncrasy.
481**
482@@ LUA_IEEE754TRICK uses a trick that should work on any machine
483** using IEEE754 with a 32-bit integer type.
484**
485@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be
486** defined when LUA_INTEGER is a 32-bit integer.
487**
488@@ LUA_IEEEENDIAN is the endianness of doubles in your machine
489** (0 for little endian, 1 for big endian); if not defined, Lua will
490** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK).
491**
492@@ LUA_NANTRICK controls the use of a trick to pack all types into
493** a single double value, using NaN values to represent non-number
494** values. The trick only works on 32-bit machines (ints and pointers
495** are 32-bit values) with numbers represented as IEEE 754-2008 doubles
496** with conventional endianess (12345678 or 87654321), in CPUs that do
497** not produce signaling NaN values (all NaNs are quiet).
498*/
499
500/* Microsoft compiler on a Pentium (32 bit) ? */
501#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */
502
503#define LUA_MSASMTRICK
504#define LUA_IEEEENDIAN 0
505#define LUA_NANTRICK
506
507
508/* pentium 32 bits? */
509#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */
510
511#define LUA_IEEE754TRICK
512#define LUA_IEEELL
513#define LUA_IEEEENDIAN 0
514#define LUA_NANTRICK
515
516/* pentium 64 bits? */
517#elif defined(__x86_64) /* }{ */
518
519#define LUA_IEEE754TRICK
520#define LUA_IEEEENDIAN 0
521
522#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */
523
524#define LUA_IEEE754TRICK
525#define LUA_IEEEENDIAN 1
526
527#else /* }{ */
528
529/* assume IEEE754 and a 32-bit integer type */
530#define LUA_IEEE754TRICK
531
532#endif /* } */
533
534#endif /* } */
535
536/* }================================================================== */
537
538
539
540
541/* =================================================================== */
542
543/*
544** Local configuration. You can use this space to add your redefinitions
545** without modifying the main part of the file.
546*/
547
548
549
550#endif
551
Impressum, Datenschutz