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