aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaconf.h335
1 files changed, 165 insertions, 170 deletions
diff --git a/luaconf.h b/luaconf.h
index 12ae62e5..25863974 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.223 2014/10/27 18:06:03 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.224 2014/10/27 19:21:56 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -19,13 +19,13 @@
19/* 19/*
20** {================================================================== 20** {==================================================================
21@@ LUA_INT_INT / LUA_INT_LONG / LUA_INT_LONGLONG defines type for 21@@ LUA_INT_INT / LUA_INT_LONG / LUA_INT_LONGLONG defines type for
22@@ Lua integers; you must define one of them. 22** Lua integers; you must define one of them.
23@@ LUA_REAL_FLOAT / LUA_REAL_DOUBLE / LUA_REAL_LONGDOUBLE defines 23@@ LUA_REAL_FLOAT / LUA_REAL_DOUBLE / LUA_REAL_LONGDOUBLE defines
24@@ type for Lua floats. You must define one of them. 24** type for Lua floats. You must define one of them.
25** 25**
26** These definitions set the numeric types for Lua. Lua should work 26** These definitions set the numeric types for Lua. Lua should work
27** fine with any mix of these previous options (if supported by your 27** fine with any mix of these previous options (if supported by your
28** C compiler). The usual configurations are 64-bit integers and 28** C compiler). The usual configurations are 64-bit integers and
29** 'double' (the default) and 32-bit integers and 'float' (Small Lua, 29** 'double' (the default) and 32-bit integers and 'float' (Small Lua,
30** for restricted platforms). 30** for restricted platforms).
31** 31**
@@ -56,6 +56,13 @@
56/* }================================================================== */ 56/* }================================================================== */
57 57
58 58
59
60/*
61** {==================================================================
62** System Configuration
63** ===================================================================
64*/
65
59/* 66/*
60@@ LUA_ANSI controls the use of non-ansi features. 67@@ LUA_ANSI controls the use of non-ansi features.
61** CHANGE it (define it) if you want Lua to avoid the use of any 68** CHANGE it (define it) if you want Lua to avoid the use of any
@@ -71,15 +78,11 @@
71#endif 78#endif
72 79
73#if defined(LUA_WIN) 80#if defined(LUA_WIN)
74#if !defined(_CRT_SECURE_NO_WARNINGS)
75#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ANSI C functions */
76#endif
77#define LUA_DL_DLL 81#define LUA_DL_DLL
78#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ 82#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
79#endif 83#endif
80 84
81 85
82
83#if defined(LUA_USE_LINUX) 86#if defined(LUA_USE_LINUX)
84#define LUA_USE_C99 87#define LUA_USE_C99
85#define LUA_USE_POSIX 88#define LUA_USE_POSIX
@@ -87,6 +90,7 @@
87#define LUA_USE_READLINE /* needs some extra libraries */ 90#define LUA_USE_READLINE /* needs some extra libraries */
88#endif 91#endif
89 92
93
90#if defined(LUA_USE_MACOSX) 94#if defined(LUA_USE_MACOSX)
91#define LUA_USE_C99 95#define LUA_USE_C99
92#define LUA_USE_POSIX 96#define LUA_USE_POSIX
@@ -94,16 +98,26 @@
94#define LUA_USE_READLINE /* needs an extra library: -lreadline */ 98#define LUA_USE_READLINE /* needs an extra library: -lreadline */
95#endif 99#endif
96 100
101/* }================================================================== */
102
103
97 104
98 105
99#include <limits.h> 106#include <limits.h>
100#include <stddef.h> 107#include <stddef.h>
101 108
109
110/*
111** {==================================================================
112** Configuration for Paths.
113** ===================================================================
114*/
115
102/* 116/*
103@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 117@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
104@@ Lua libraries. 118** Lua libraries.
105@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 119@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
106@@ C libraries. 120** C libraries.
107** CHANGE them if your machine has a non-conventional directory 121** CHANGE them if your machine has a non-conventional directory
108** hierarchy or if you want to install your libraries in 122** hierarchy or if you want to install your libraries in
109** non-conventional directories. 123** non-conventional directories.
@@ -120,7 +134,7 @@
120#define LUA_PATH_DEFAULT \ 134#define LUA_PATH_DEFAULT \
121 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 135 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
122 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ 136 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
123 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ 137 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
124 ".\\?.lua;" ".\\?\\init.lua" 138 ".\\?.lua;" ".\\?\\init.lua"
125#define LUA_CPATH_DEFAULT \ 139#define LUA_CPATH_DEFAULT \
126 LUA_CDIR"?.dll;" \ 140 LUA_CDIR"?.dll;" \
@@ -152,14 +166,14 @@
152#define LUA_DIRSEP "/" 166#define LUA_DIRSEP "/"
153#endif 167#endif
154 168
169/* }================================================================== */
170
155 171
156/* 172/*
157@@ LUA_ENV is the name of the variable that holds the current 173** {==================================================================
158@@ environment, used to access global names. 174** Marks for exported symbols in the C code
159** CHANGE it if you do not like this name. 175** ===================================================================
160*/ 176*/
161#define LUA_ENV "_ENV"
162
163 177
164/* 178/*
165@@ LUA_API is a mark for all core API functions. 179@@ LUA_API is a mark for all core API functions.
@@ -192,10 +206,10 @@
192 206
193/* 207/*
194@@ LUAI_FUNC is a mark for all extern functions that are not to be 208@@ LUAI_FUNC is a mark for all extern functions that are not to be
195@@ exported to outside modules. 209** exported to outside modules.
196@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables 210@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
197@@ that are not to be exported to outside modules (LUAI_DDEF for 211** that are not to be exported to outside modules (LUAI_DDEF for
198@@ definitions and LUAI_DDEC for declarations). 212** definitions and LUAI_DDEC for declarations).
199** CHANGE them if you need to mark them in some special way. Elf/gcc 213** CHANGE them if you need to mark them in some special way. Elf/gcc
200** (versions 3.2 and later) mark them as "hidden" to optimize access 214** (versions 3.2 and later) mark them as "hidden" to optimize access
201** when Lua is compiled as a shared library. Not all elf targets support 215** when Lua is compiled as a shared library. Not all elf targets support
@@ -207,103 +221,14 @@
207#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 221#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
208 defined(__ELF__) /* { */ 222 defined(__ELF__) /* { */
209#define LUAI_FUNC __attribute__((visibility("hidden"))) extern 223#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
210#define LUAI_DDEC LUAI_FUNC
211#define LUAI_DDEF /* empty */
212
213#else /* }{ */ 224#else /* }{ */
214#define LUAI_FUNC extern 225#define LUAI_FUNC extern
215#define LUAI_DDEC extern
216#define LUAI_DDEF /* empty */
217#endif /* } */ 226#endif /* } */
218 227
228#define LUAI_DDEC LUAI_FUNC
229#define LUAI_DDEF /* empty */
219 230
220 231/* }================================================================== */
221/*
222@@ LUA_EXTRASPACE defines the size of a raw memory area associated with
223** a Lua state with very fast access.
224** CHANGE it if you need a different size.
225*/
226#define LUA_EXTRASPACE (sizeof(void *))
227
228
229/*
230@@ LUA_QL describes how error messages quote program elements.
231** Lua does not use these macros anymore; they are here for
232** compatibility only.
233*/
234#define LUA_QL(x) "'" x "'"
235#define LUA_QS LUA_QL("%s")
236
237
238/*
239@@ LUA_IDSIZE gives the maximum size for the description of the source
240@@ of a function in debug information.
241** CHANGE it if you want a different size.
242*/
243#define LUA_IDSIZE 60
244
245
246/*
247@@ luai_writestring/luai_writeline define how 'print' prints its results.
248** They are only used in libraries and the stand-alone program.
249*/
250#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
251#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout))
252
253/*
254@@ luai_writestringerror defines how to print error messages.
255** (A format string with one argument is enough for Lua...)
256*/
257#define luai_writestringerror(s,p) \
258 (fprintf(stderr, (s), (p)), fflush(stderr))
259
260
261/*
262@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,
263** strings that are internalized. (Cannot be smaller than reserved words
264** or tags for metamethods, as these strings must be internalized;
265** #("function") = 8, #("__newindex") = 10.)
266*/
267#define LUAI_MAXSHORTLEN 40
268
269
270/*
271@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
272** functions. It must be a numerical type; Lua will use 'intptr_t' if
273** available.
274*/
275#if defined (LUA_USE_C99)
276#include <stdint.h>
277#if defined (INTPTR_MAX) /* even in C99 this type is optional */
278#define LUA_KCONTEXT intptr_t
279#endif
280#endif
281
282#if !defined(LUA_KCONTEXT)
283/* default definition (the nearest thing to 'intptr_t' in C89) */
284#define LUA_KCONTEXT ptrdiff_t
285#endif
286
287
288/*
289@@ lua_strx2number converts an hexadecimal numeric string to a number.
290** In C99, 'strtod' does both conversions. Otherwise, you can
291** leave 'lua_strx2number' undefined and Lua will provide its own
292** implementation.
293*/
294#if defined(LUA_USE_C99)
295#define lua_strx2number(s,p) lua_str2number(s,p)
296#endif
297
298
299/*
300@@ LUA_USE_AFORMAT allows '%a'/'%A' specifiers in 'string.format'
301** Enable it if the C function 'printf' supports these specifiers.
302** (C99 demands it.)
303*/
304#if !defined(LUA_USE_AFORMAT) && defined(LUA_USE_C99)
305#define LUA_USE_AFORMAT
306#endif
307 232
308 233
309/* 234/*
@@ -434,52 +359,6 @@
434#endif 359#endif
435 360
436 361
437/*
438@@ LUA_INT32 is a signed integer with at least 32 bits.
439@@ LUAI_UMEM is an unsigned integer big enough to count the total
440@@ memory used by Lua.
441@@ LUAI_MEM is a signed integer big enough to count the total memory
442@@ used by Lua.
443** CHANGE here if for some weird reason the default definitions are not
444** good enough for your machine. Probably you do not need to change
445** this.
446*/
447#if LUAI_BITSINT >= 32 /* { */
448#define LUA_INT32 int
449#define LUAI_UMEM size_t
450#define LUAI_MEM ptrdiff_t
451#else /* }{ */
452/* 16-bit ints */
453#define LUA_INT32 long
454#define LUAI_UMEM unsigned long
455#define LUAI_MEM long
456#endif /* } */
457
458
459/*
460@@ LUAI_MAXSTACK limits the size of the Lua stack.
461** CHANGE it if you need a different limit. This limit is arbitrary;
462** its only purpose is to stop Lua from consuming unlimited stack
463** space (and to reserve some numbers for pseudo-indices).
464*/
465#if LUAI_BITSINT >= 32
466#define LUAI_MAXSTACK 1000000
467#else
468#define LUAI_MAXSTACK 15000
469#endif
470
471/* reserve some space for error handling */
472#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
473
474
475
476
477/*
478@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
479** CHANGE it if it uses too much C-stack space.
480*/
481#define LUAL_BUFFERSIZE BUFSIZ
482
483 362
484/* 363/*
485** {================================================================== 364** {==================================================================
@@ -551,15 +430,6 @@
551#endif /* } */ 430#endif /* } */
552 431
553 432
554#if !defined(LUA_USE_C99)
555/* 'strtof' and 'opf' variants for math functions are C99 */
556#undef l_mathop
557#undef lua_str2number
558#define l_mathop(op) (lua_Number)op
559#define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
560#endif
561
562
563#define l_floor(x) (l_mathop(floor)(x)) 433#define l_floor(x) (l_mathop(floor)(x))
564 434
565#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) 435#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
@@ -687,8 +557,8 @@
687 557
688#elif defined(LUA_INT_SHORT) /* }{ short int */ 558#elif defined(LUA_INT_SHORT) /* }{ short int */
689/* 559/*
690** this option is for tests only; it is not particularly useful and 560** this option is for internal tests only; it is not particularly useful
691** it does not pass the test suit. 561** and it does not pass the test suit.
692*/ 562*/
693 563
694#define LUA_INTEGER short int 564#define LUA_INTEGER short int
@@ -700,8 +570,8 @@
700#undef LUAI_UACINT 570#undef LUAI_UACINT
701#define LUAI_UACINT int 571#define LUAI_UACINT int
702 572
703#undef LUAI_MAXSTACK 573#undef LUAI_BITSINT
704#define LUAI_MAXSTACK 15000 574#define LUAI_BITSINT 16
705 575
706#define l_castS2U(x) ((LUA_UNSIGNED)(unsigned short)(x)) 576#define l_castS2U(x) ((LUA_UNSIGNED)(unsigned short)(x))
707 577
@@ -714,6 +584,131 @@
714/* }================================================================== */ 584/* }================================================================== */
715 585
716 586
587/*
588** {==================================================================
589** Dependencies with C99
590** ===================================================================
591*/
592
593/*
594@@ lua_strx2number converts an hexadecimal numeric string to a number.
595** In C99, 'strtod' does both conversions. Otherwise, you can
596** leave 'lua_strx2number' undefined and Lua will provide its own
597** implementation.
598*/
599#if defined(LUA_USE_C99)
600#define lua_strx2number(s,p) lua_str2number(s,p)
601#endif
602
603
604/*
605@@ LUA_USE_AFORMAT allows '%a'/'%A' specifiers in 'string.format'
606** Enable it if the C function 'printf' supports these specifiers.
607** (C99 demands it.)
608*/
609#if !defined(LUA_USE_AFORMAT) && defined(LUA_USE_C99)
610#define LUA_USE_AFORMAT
611#endif
612
613
614/*
615** 'strtof' and 'opf' variants for math functions are valid only
616** in C99
617*/
618#if !defined(LUA_USE_C99)
619#undef l_mathop
620#undef lua_str2number
621#define l_mathop(op) (lua_Number)op
622#define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
623#endif
624
625
626/*
627@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
628** functions. It must be a numerical type; Lua will use 'intptr_t' if
629** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
630** 'intptr_t' in C89)
631*/
632#define LUA_KCONTEXT ptrdiff_t
633
634#if defined (LUA_USE_C99)
635#include <stdint.h>
636#if defined (INTPTR_MAX) /* even in C99 this type is optional */
637#undef LUA_KCONTEXT
638#define LUA_KCONTEXT intptr_t
639#endif
640#endif
641
642/* }================================================================== */
643
644
645/*
646** {==================================================================
647** Macros that affect the API and must be stable (that is, must be the
648** same when you compile Lua and when you compile code that links to
649** Lua). You probably do not want/need to change them.
650** =====================================================================
651*/
652
653/*
654@@ LUAI_MAXSTACK limits the size of the Lua stack.
655** CHANGE it if you need a different limit. This limit is arbitrary;
656** its only purpose is to stop Lua from consuming unlimited stack
657** space (and to reserve some numbers for pseudo-indices).
658*/
659#if LUAI_BITSINT >= 32
660#define LUAI_MAXSTACK 1000000
661#else
662#define LUAI_MAXSTACK 15000
663#endif
664
665/* reserve some space for error handling */
666#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
667
668
669/*
670@@ LUA_EXTRASPACE defines the size of a raw memory area associated with
671** a Lua state with very fast access.
672** CHANGE it if you need a different size.
673*/
674#define LUA_EXTRASPACE (sizeof(void *))
675
676
677/*
678@@ LUA_IDSIZE gives the maximum size for the description of the source
679@@ of a function in debug information.
680** CHANGE it if you want a different size.
681*/
682#define LUA_IDSIZE 60
683
684
685/*
686@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,
687** strings that are internalized. (Cannot be smaller than reserved words
688** or tags for metamethods, as these strings must be internalized;
689** #("function") = 8, #("__newindex") = 10.)
690*/
691#define LUAI_MAXSHORTLEN 40
692
693
694/*
695@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
696** CHANGE it if it uses too much C-stack space.
697*/
698#define LUAL_BUFFERSIZE (0x400 * sizeof(void*))
699
700/* }================================================================== */
701
702
703/*
704@@ LUA_QL describes how error messages quote program elements.
705** Lua does not use these macros anymore; they are here for
706** compatibility only.
707*/
708#define LUA_QL(x) "'" x "'"
709#define LUA_QS LUA_QL("%s")
710
711
717 712
718 713
719/* =================================================================== */ 714/* =================================================================== */