diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-05-03 09:28:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-05-03 09:28:43 -0300 |
commit | 9629508a9859048c43a143e1b8fbb494df7c22a9 (patch) | |
tree | b0299247be7ed622fcb4cdb3157193c98ca5c041 | |
parent | 763b8fba1b2e4fb942df85ab5a7f177d3efda72e (diff) | |
download | lua-9629508a9859048c43a143e1b8fbb494df7c22a9.tar.gz lua-9629508a9859048c43a143e1b8fbb494df7c22a9.tar.bz2 lua-9629508a9859048c43a143e1b8fbb494df7c22a9.zip |
configuration file for Lua project
-rw-r--r-- | luaconf.h | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/luaconf.h b/luaconf.h new file mode 100644 index 00000000..6413441a --- /dev/null +++ b/luaconf.h | |||
@@ -0,0 +1,280 @@ | |||
1 | /* | ||
2 | ** $Id: $ | ||
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 | ** Index (search for keyword to find corresponding entry) | ||
18 | ** ======================================================= | ||
19 | */ | ||
20 | |||
21 | |||
22 | /* }====================================================== */ | ||
23 | |||
24 | |||
25 | |||
26 | |||
27 | /* | ||
28 | ** {====================================================== | ||
29 | ** Generic configuration | ||
30 | ** ======================================================= | ||
31 | */ | ||
32 | |||
33 | /* type of numbers in Lua */ | ||
34 | #define LUA_NUMBER double | ||
35 | |||
36 | /* formats for Lua numbers */ | ||
37 | #define LUA_NUMBER_SCAN "%lf" | ||
38 | #define LUA_NUMBER_FMT "%.14g" | ||
39 | |||
40 | |||
41 | /* type for integer functions */ | ||
42 | #define LUA_INTEGER long | ||
43 | |||
44 | |||
45 | /* mark for all API functions */ | ||
46 | #define LUA_API extern | ||
47 | |||
48 | /* mark for auxlib functions */ | ||
49 | #define LUALIB_API extern | ||
50 | |||
51 | /* }====================================================== */ | ||
52 | |||
53 | |||
54 | |||
55 | /* | ||
56 | ** {====================================================== | ||
57 | ** Stand-alone configuration | ||
58 | ** ======================================================= | ||
59 | */ | ||
60 | |||
61 | #ifdef lua_c | ||
62 | |||
63 | /* definition of `isatty' */ | ||
64 | #ifdef _POSIX_C_SOURCE | ||
65 | #include <unistd.h> | ||
66 | #define stdin_is_tty() isatty(0) | ||
67 | #else | ||
68 | #define stdin_is_tty() 1 /* assume stdin is a tty */ | ||
69 | #endif | ||
70 | |||
71 | |||
72 | #define PROMPT "> " | ||
73 | #define PROMPT2 ">> " | ||
74 | #define PROGNAME "lua" | ||
75 | |||
76 | |||
77 | #define LUA_EXTRALIBS /* empty */ | ||
78 | |||
79 | #define lua_userinit(L) openstdlibs(L) | ||
80 | |||
81 | |||
82 | |||
83 | /* | ||
84 | ** this macro can be used by some `history' system to save lines | ||
85 | ** read in manual input | ||
86 | */ | ||
87 | #define lua_saveline(L,line) /* empty */ | ||
88 | |||
89 | |||
90 | |||
91 | #endif | ||
92 | |||
93 | /* }====================================================== */ | ||
94 | |||
95 | |||
96 | |||
97 | /* | ||
98 | ** {====================================================== | ||
99 | ** Core configuration | ||
100 | ** ======================================================= | ||
101 | */ | ||
102 | |||
103 | #ifdef LUA_CORE | ||
104 | |||
105 | /* LUA-C API assertions */ | ||
106 | #define api_check(L, o) /* empty */ | ||
107 | |||
108 | |||
109 | /* an unsigned integer with at least 32 bits */ | ||
110 | #define LUA_UINT32 unsigned long | ||
111 | |||
112 | /* a signed integer with at least 32 bits */ | ||
113 | #define LUA_INT32 long | ||
114 | #define LUA_MAXINT32 LONG_MAX | ||
115 | |||
116 | |||
117 | /* maximum depth for calls (unsigned short) */ | ||
118 | #define LUA_MAXCALLS 4096 | ||
119 | |||
120 | /* | ||
121 | ** maximum depth for C calls (unsigned short): Not too big, or may | ||
122 | ** overflow the C stack... | ||
123 | */ | ||
124 | #define LUA_MAXCCALLS 200 | ||
125 | |||
126 | |||
127 | /* maximum size for the virtual stack of a C function */ | ||
128 | #define MAXCSTACK 2048 | ||
129 | |||
130 | |||
131 | /* | ||
132 | ** maximum number of syntactical nested non-terminals: Not too big, | ||
133 | ** or may overflow the C stack... | ||
134 | */ | ||
135 | #define LUA_MAXPARSERLEVEL 200 | ||
136 | |||
137 | |||
138 | /* maximum number of variables declared in a function */ | ||
139 | #define MAXVARS 200 /* <MAXSTACK */ | ||
140 | |||
141 | |||
142 | /* maximum number of upvalues per function */ | ||
143 | #define MAXUPVALUES 32 /* <MAXSTACK */ | ||
144 | |||
145 | |||
146 | /* maximum size of expressions for optimizing `while' code */ | ||
147 | #define MAXEXPWHILE 100 | ||
148 | |||
149 | |||
150 | /* function to convert a lua_Number to int (with any rounding method) */ | ||
151 | #if defined(__GNUC__) && defined(__i386) | ||
152 | #define lua_number2int(i,d) __asm__("fldl %1\nfistpl %0":"=m"(i):"m"(d)) | ||
153 | #else | ||
154 | #define lua_number2int(i,n) ((i)=(int)(n)) | ||
155 | #endif | ||
156 | |||
157 | /* function to convert a lua_Number to lua_Integer (with any rounding method) */ | ||
158 | #define lua_number2integer(i,n) lua_number2int(i,n) | ||
159 | |||
160 | |||
161 | /* function to convert a lua_Number to a string */ | ||
162 | #include <stdio.h> | ||
163 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | ||
164 | |||
165 | /* function to convert a string to a lua_Number */ | ||
166 | #define lua_str2number(s,p) strtod((s), (p)) | ||
167 | |||
168 | |||
169 | |||
170 | /* result of a `usual argument conversion' over lua_Number */ | ||
171 | #define LUA_UACNUMBER double | ||
172 | |||
173 | |||
174 | /* number of bits in an `int' */ | ||
175 | /* avoid overflows in comparison */ | ||
176 | #if INT_MAX-20 < 32760 | ||
177 | #define LUA_BITSINT 16 | ||
178 | #elif INT_MAX > 2147483640L | ||
179 | /* machine has at least 32 bits */ | ||
180 | #define LUA_BITSINT 32 | ||
181 | #else | ||
182 | #error "you must define LUA_BITSINT with number of bits in an integer" | ||
183 | #endif | ||
184 | |||
185 | |||
186 | /* type to ensure maximum alignment */ | ||
187 | #define LUSER_ALIGNMENT_T union { double u; void *s; long l; } | ||
188 | |||
189 | |||
190 | /* exception handling */ | ||
191 | #ifndef __cplusplus | ||
192 | /* default handling with long jumps */ | ||
193 | #include <setjmp.h> | ||
194 | #define L_THROW(c) longjmp((c)->b, 1) | ||
195 | #define L_TRY(c,a) if (setjmp((c)->b) == 0) { a } | ||
196 | #define l_jmpbuf jmp_buf | ||
197 | |||
198 | #else | ||
199 | /* C++ exceptions */ | ||
200 | #define L_THROW(c) throw(c) | ||
201 | #define L_TRY(c,a) try { a } catch(...) \ | ||
202 | { if ((c)->status == 0) (c)->status = -1; } | ||
203 | #define l_jmpbuf int /* dummy variable */ | ||
204 | #endif | ||
205 | |||
206 | |||
207 | #endif | ||
208 | |||
209 | /* }====================================================== */ | ||
210 | |||
211 | |||
212 | |||
213 | /* | ||
214 | ** {====================================================== | ||
215 | ** Library configuration | ||
216 | ** ======================================================= | ||
217 | */ | ||
218 | |||
219 | #ifdef LUA_LIB | ||
220 | |||
221 | /* buffer size used by lauxlib buffer system */ | ||
222 | #define LUAL_BUFFERSIZE BUFSIZ | ||
223 | |||
224 | |||
225 | |||
226 | /* `assert' options */ | ||
227 | /* name of global that holds table with loaded packages */ | ||
228 | #define REQTAB "_LOADED" | ||
229 | |||
230 | /* name of global that holds the search path for packages */ | ||
231 | #define LUA_PATH "LUA_PATH" | ||
232 | |||
233 | /* separator of templates in a path */ | ||
234 | #define LUA_PATH_SEP ';' | ||
235 | |||
236 | /* wild char in each template */ | ||
237 | #define LUA_PATH_MARK '?' | ||
238 | |||
239 | /* default path */ | ||
240 | #define LUA_PATH_DEFAULT "?;?.lua" | ||
241 | |||
242 | |||
243 | /* maximum number of captures in pattern-matching */ | ||
244 | #define MAX_CAPTURES 32 /* arbitrary limit */ | ||
245 | |||
246 | |||
247 | /* | ||
248 | ** by default, gcc does not get `tmpname' | ||
249 | */ | ||
250 | #ifdef __GNUC__ | ||
251 | #define USE_TMPNAME 0 | ||
252 | #else | ||
253 | #define USE_TMPNAME 1 | ||
254 | #endif | ||
255 | |||
256 | |||
257 | /* | ||
258 | ** by default, posix systems get `popen' | ||
259 | */ | ||
260 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2 | ||
261 | #define USE_POPEN 1 | ||
262 | #else | ||
263 | #define USE_POPEN 0 | ||
264 | #endif | ||
265 | |||
266 | |||
267 | |||
268 | #endif | ||
269 | |||
270 | /* }====================================================== */ | ||
271 | |||
272 | |||
273 | |||
274 | |||
275 | /* Local configuration */ | ||
276 | |||
277 | #undef USE_TMPNAME | ||
278 | #define USE_TMPNAME 1 | ||
279 | |||
280 | #endif | ||