]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/liblua/luaconf.h
MFV 364468:
[FreeBSD/FreeBSD.git] / lib / liblua / luaconf.h
1 /* $FreeBSD$ */
2 /*
3 ** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $
4 ** Configuration file for Lua
5 ** See Copyright Notice in lua.h
6 */
7
8
9 #ifndef luaconf_h
10 #define luaconf_h
11
12 #include <limits.h>
13 #include <stddef.h>
14
15
16 /*
17 ** ===================================================================
18 ** Search for "@@" to find all configurable definitions.
19 ** ===================================================================
20 */
21
22
23 /*
24 ** {====================================================================
25 ** System Configuration: macros to adapt (if needed) Lua to some
26 ** particular platform, for instance compiling it with 32-bit numbers or
27 ** restricting it to C89.
28 ** =====================================================================
29 */
30
31 /*
32 @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
33 ** can also define LUA_32BITS in the make file, but changing here you
34 ** ensure that all software connected to Lua will be compiled with the
35 ** same configuration.
36 */
37 /* #define LUA_32BITS */
38
39
40 /*
41 @@ LUA_USE_C89 controls the use of non-ISO-C89 features.
42 ** Define it if you want Lua to avoid the use of a few C99 features
43 ** or Windows-specific features on Windows.
44 */
45 /* #define LUA_USE_C89 */
46
47
48 /*
49 ** By default, Lua on Windows use (some) specific Windows features
50 */
51 #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
52 #define LUA_USE_WINDOWS  /* enable goodies for regular Windows */
53 #endif
54
55
56 #if defined(LUA_USE_WINDOWS)
57 #define LUA_DL_DLL      /* enable support for DLL */
58 #define LUA_USE_C89     /* broadly, Windows is C89 */
59 #endif
60
61
62 #if defined(LUA_USE_LINUX)
63 #define LUA_USE_POSIX
64 #define LUA_USE_DLOPEN          /* needs an extra library: -ldl */
65 #define LUA_USE_READLINE        /* needs some extra libraries */
66 #endif
67
68
69 #if defined(LUA_USE_MACOSX)
70 #define LUA_USE_POSIX
71 #define LUA_USE_DLOPEN          /* MacOS does not need -ldl */
72 #define LUA_USE_READLINE        /* needs an extra library: -lreadline */
73 #endif
74
75 /* Local modifications: need io.popen */
76 #ifdef __FreeBSD__
77 #define LUA_USE_POSIX
78 #ifndef BOOTSTRAPPING
79 #define LUA_USE_DLOPEN
80 #endif
81 #endif
82
83 /*
84 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
85 ** C89 ('long' and 'double'); Windows always has '__int64', so it does
86 ** not need to use this case.
87 */
88 #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
89 #define LUA_C89_NUMBERS
90 #endif
91
92
93
94 /*
95 @@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'.
96 */
97 /* avoid undefined shifts */
98 #if ((INT_MAX >> 15) >> 15) >= 1
99 #define LUAI_BITSINT    32
100 #else
101 /* 'int' always must have at least 16 bits */
102 #define LUAI_BITSINT    16
103 #endif
104
105
106 /*
107 @@ LUA_INT_TYPE defines the type for Lua integers.
108 @@ LUA_FLOAT_TYPE defines the type for Lua floats.
109 ** Lua should work fine with any mix of these options (if supported
110 ** by your C compiler). The usual configurations are 64-bit integers
111 ** and 'double' (the default), 32-bit integers and 'float' (for
112 ** restricted platforms), and 'long'/'double' (for C compilers not
113 ** compliant with C99, which may not have support for 'long long').
114 */
115
116 /* predefined options for LUA_INT_TYPE */
117 #define LUA_INT_INT             1
118 #define LUA_INT_LONG            2
119 #define LUA_INT_LONGLONG        3
120
121 /* predefined options for LUA_FLOAT_TYPE */
122 #define LUA_FLOAT_FLOAT         1
123 #define LUA_FLOAT_DOUBLE        2
124 #define LUA_FLOAT_LONGDOUBLE    3
125
126 #if defined(LUA_32BITS)         /* { */
127 /*
128 ** 32-bit integers and 'float'
129 */
130 #if LUAI_BITSINT >= 32  /* use 'int' if big enough */
131 #define LUA_INT_TYPE    LUA_INT_INT
132 #else  /* otherwise use 'long' */
133 #define LUA_INT_TYPE    LUA_INT_LONG
134 #endif
135 #define LUA_FLOAT_TYPE  LUA_FLOAT_FLOAT
136
137 #elif defined(LUA_C89_NUMBERS)  /* }{ */
138 /*
139 ** largest types available for C89 ('long' and 'double')
140 */
141 #define LUA_INT_TYPE    LUA_INT_LONG
142 #define LUA_FLOAT_TYPE  LUA_FLOAT_DOUBLE
143
144 #endif                          /* } */
145
146
147 /*
148 ** default configuration for 64-bit Lua ('long long' and 'double')
149 */
150 #if !defined(LUA_INT_TYPE)
151 #define LUA_INT_TYPE    LUA_INT_LONGLONG
152 #endif
153
154 #if !defined(LUA_FLOAT_TYPE)
155 #define LUA_FLOAT_TYPE  LUA_FLOAT_DOUBLE
156 #endif
157
158 /* }================================================================== */
159
160
161
162
163 /*
164 ** {==================================================================
165 ** Configuration for Paths.
166 ** ===================================================================
167 */
168
169 /*
170 ** LUA_PATH_SEP is the character that separates templates in a path.
171 ** LUA_PATH_MARK is the string that marks the substitution points in a
172 ** template.
173 ** LUA_EXEC_DIR in a Windows path is replaced by the executable's
174 ** directory.
175 */
176 #define LUA_PATH_SEP            ";"
177 #define LUA_PATH_MARK           "?"
178 #define LUA_EXEC_DIR            "!"
179
180
181 /*
182 @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
183 ** Lua libraries.
184 @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
185 ** C libraries.
186 ** CHANGE them if your machine has a non-conventional directory
187 ** hierarchy or if you want to install your libraries in
188 ** non-conventional directories.
189 */
190 #define LUA_VDIR        LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
191 #if defined(_WIN32)     /* { */
192 /*
193 ** In Windows, any exclamation mark ('!') in the path is replaced by the
194 ** path of the directory of the executable file of the current process.
195 */
196 #define LUA_LDIR        "!\\lua\\"
197 #define LUA_CDIR        "!\\"
198 #define LUA_SHRDIR      "!\\..\\share\\lua\\" LUA_VDIR "\\"
199 #define LUA_PATH_DEFAULT  \
200                 LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
201                 LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua;" \
202                 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
203                 ".\\?.lua;" ".\\?\\init.lua"
204 #define LUA_CPATH_DEFAULT \
205                 LUA_CDIR"?.dll;" \
206                 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
207                 LUA_CDIR"loadall.dll;" ".\\?.dll"
208
209 #else                   /* }{ */
210
211 #define LUA_ROOT        "/usr/"
212 #define LUA_LDIR        LUA_ROOT "share/flua/"
213 #define LUA_CDIR        LUA_ROOT "lib/flua/"
214 #if !defined(LUA_PATH_DEFAULT)
215 #define LUA_PATH_DEFAULT  \
216                 LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
217                 LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
218                 "./?.lua;" "./?/init.lua"
219 #endif
220 #if !defined(LUA_CPATH_DEFAULT)
221 #define LUA_CPATH_DEFAULT \
222                 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
223 #endif
224 #endif                  /* } */
225
226
227 /*
228 @@ LUA_DIRSEP is the directory separator (for submodules).
229 ** CHANGE it if your machine does not use "/" as the directory separator
230 ** and is not Windows. (On Windows Lua automatically uses "\".)
231 */
232 #if defined(_WIN32)
233 #define LUA_DIRSEP      "\\"
234 #else
235 #define LUA_DIRSEP      "/"
236 #endif
237
238 /* }================================================================== */
239
240
241 /*
242 ** {==================================================================
243 ** Marks for exported symbols in the C code
244 ** ===================================================================
245 */
246
247 /*
248 @@ LUA_API is a mark for all core API functions.
249 @@ LUALIB_API is a mark for all auxiliary library functions.
250 @@ LUAMOD_API is a mark for all standard library opening functions.
251 ** CHANGE them if you need to define those functions in some special way.
252 ** For instance, if you want to create one Windows DLL with the core and
253 ** the libraries, you may want to use the following definition (define
254 ** LUA_BUILD_AS_DLL to get it).
255 */
256 #if defined(LUA_BUILD_AS_DLL)   /* { */
257
258 #if defined(LUA_CORE) || defined(LUA_LIB)       /* { */
259 #define LUA_API __declspec(dllexport)
260 #else                                           /* }{ */
261 #define LUA_API __declspec(dllimport)
262 #endif                                          /* } */
263
264 #else                           /* }{ */
265
266 #define LUA_API         extern
267
268 #endif                          /* } */
269
270
271 /* more often than not the libs go together with the core */
272 #define LUALIB_API      LUA_API
273 #define LUAMOD_API      LUALIB_API
274
275
276 /*
277 @@ LUAI_FUNC is a mark for all extern functions that are not to be
278 ** exported to outside modules.
279 @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
280 ** that are not to be exported to outside modules (LUAI_DDEF for
281 ** definitions and LUAI_DDEC for declarations).
282 ** CHANGE them if you need to mark them in some special way. Elf/gcc
283 ** (versions 3.2 and later) mark them as "hidden" to optimize access
284 ** when Lua is compiled as a shared library. Not all elf targets support
285 ** this attribute. Unfortunately, gcc does not offer a way to check
286 ** whether the target offers that support, and those without support
287 ** give a warning about it. To avoid these warnings, change to the
288 ** default definition.
289 */
290 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
291     defined(__ELF__)            /* { */
292 #define LUAI_FUNC       __attribute__((visibility("hidden"))) extern
293 #else                           /* }{ */
294 #define LUAI_FUNC       extern
295 #endif                          /* } */
296
297 #define LUAI_DDEC       LUAI_FUNC
298 #define LUAI_DDEF       /* empty */
299
300 /* }================================================================== */
301
302
303 /*
304 ** {==================================================================
305 ** Compatibility with previous versions
306 ** ===================================================================
307 */
308
309 /*
310 @@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2.
311 @@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1.
312 ** You can define it to get all options, or change specific options
313 ** to fit your specific needs.
314 */
315 #if defined(LUA_COMPAT_5_2)     /* { */
316
317 /*
318 @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
319 ** functions in the mathematical library.
320 */
321 #define LUA_COMPAT_MATHLIB
322
323 /*
324 @@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'.
325 */
326 #define LUA_COMPAT_BITLIB
327
328 /*
329 @@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod.
330 */
331 #define LUA_COMPAT_IPAIRS
332
333 /*
334 @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
335 ** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
336 ** luaL_checkint, luaL_checklong, etc.)
337 */
338 #define LUA_COMPAT_APIINTCASTS
339
340 #endif                          /* } */
341
342
343 #if defined(LUA_COMPAT_5_1)     /* { */
344
345 /* Incompatibilities from 5.2 -> 5.3 */
346 #define LUA_COMPAT_MATHLIB
347 #define LUA_COMPAT_APIINTCASTS
348
349 /*
350 @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
351 ** You can replace it with 'table.unpack'.
352 */
353 #define LUA_COMPAT_UNPACK
354
355 /*
356 @@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
357 ** You can replace it with 'package.searchers'.
358 */
359 #define LUA_COMPAT_LOADERS
360
361 /*
362 @@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
363 ** You can call your C function directly (with light C functions).
364 */
365 #define lua_cpcall(L,f,u)  \
366         (lua_pushcfunction(L, (f)), \
367          lua_pushlightuserdata(L,(u)), \
368          lua_pcall(L,1,0,0))
369
370
371 /*
372 @@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
373 ** You can rewrite 'log10(x)' as 'log(x, 10)'.
374 */
375 #define LUA_COMPAT_LOG10
376
377 /*
378 @@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
379 ** library. You can rewrite 'loadstring(s)' as 'load(s)'.
380 */
381 #define LUA_COMPAT_LOADSTRING
382
383 /*
384 @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
385 */
386 #define LUA_COMPAT_MAXN
387
388 /*
389 @@ The following macros supply trivial compatibility for some
390 ** changes in the API. The macros themselves document how to
391 ** change your code to avoid using them.
392 */
393 #define lua_strlen(L,i)         lua_rawlen(L, (i))
394
395 #define lua_objlen(L,i)         lua_rawlen(L, (i))
396
397 #define lua_equal(L,idx1,idx2)          lua_compare(L,(idx1),(idx2),LUA_OPEQ)
398 #define lua_lessthan(L,idx1,idx2)       lua_compare(L,(idx1),(idx2),LUA_OPLT)
399
400 /*
401 @@ LUA_COMPAT_MODULE controls compatibility with previous
402 ** module functions 'module' (Lua) and 'luaL_register' (C).
403 */
404 #define LUA_COMPAT_MODULE
405
406 #endif                          /* } */
407
408
409 /*
410 @@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
411 @@ a float mark ('.0').
412 ** This macro is not on by default even in compatibility mode,
413 ** because this is not really an incompatibility.
414 */
415 /* #define LUA_COMPAT_FLOATSTRING */
416
417 /* }================================================================== */
418
419
420
421 /*
422 ** {==================================================================
423 ** Configuration for Numbers.
424 ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
425 ** satisfy your needs.
426 ** ===================================================================
427 */
428
429 /*
430 @@ LUA_NUMBER is the floating-point type used by Lua.
431 @@ LUAI_UACNUMBER is the result of a 'default argument promotion'
432 @@ over a floating number.
433 @@ l_mathlim(x) corrects limit name 'x' to the proper float type
434 ** by prefixing it with one of FLT/DBL/LDBL.
435 @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
436 @@ LUA_NUMBER_FMT is the format for writing floats.
437 @@ lua_number2str converts a float to a string.
438 @@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
439 @@ l_floor takes the floor of a float.
440 @@ lua_str2number converts a decimal numeric string to a number.
441 */
442
443
444 /* The following definitions are good for most cases here */
445
446 #define l_floor(x)              (l_mathop(floor)(x))
447
448 #define lua_number2str(s,sz,n)  \
449         l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
450
451 /*
452 @@ lua_numbertointeger converts a float number to an integer, or
453 ** returns 0 if float is not within the range of a lua_Integer.
454 ** (The range comparisons are tricky because of rounding. The tests
455 ** here assume a two-complement representation, where MININTEGER always
456 ** has an exact representation as a float; MAXINTEGER may not have one,
457 ** and therefore its conversion to float may have an ill-defined value.)
458 */
459 #define lua_numbertointeger(n,p) \
460   ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
461    (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
462       (*(p) = (LUA_INTEGER)(n), 1))
463
464
465 /* now the variable definitions */
466
467 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT           /* { single float */
468
469 #define LUA_NUMBER      float
470
471 #define l_mathlim(n)            (FLT_##n)
472
473 #define LUAI_UACNUMBER  double
474
475 #define LUA_NUMBER_FRMLEN       ""
476 #define LUA_NUMBER_FMT          "%.7g"
477
478 #define l_mathop(op)            op##f
479
480 #define lua_str2number(s,p)     strtof((s), (p))
481
482
483 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE    /* }{ long double */
484
485 #define LUA_NUMBER      long double
486
487 #define l_mathlim(n)            (LDBL_##n)
488
489 #define LUAI_UACNUMBER  long double
490
491 #define LUA_NUMBER_FRMLEN       "L"
492 #define LUA_NUMBER_FMT          "%.19Lg"
493
494 #define l_mathop(op)            op##l
495
496 #define lua_str2number(s,p)     strtold((s), (p))
497
498 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE        /* }{ double */
499
500 #define LUA_NUMBER      double
501
502 #define l_mathlim(n)            (DBL_##n)
503
504 #define LUAI_UACNUMBER  double
505
506 #define LUA_NUMBER_FRMLEN       ""
507 #define LUA_NUMBER_FMT          "%.14g"
508
509 #define l_mathop(op)            op
510
511 #define lua_str2number(s,p)     strtod((s), (p))
512
513 #else                                           /* }{ */
514
515 #error "numeric float type not defined"
516
517 #endif                                  /* } */
518
519
520
521 /*
522 @@ LUA_INTEGER is the integer type used by Lua.
523 **
524 @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
525 **
526 @@ LUAI_UACINT is the result of a 'default argument promotion'
527 @@ over a lUA_INTEGER.
528 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
529 @@ LUA_INTEGER_FMT is the format for writing integers.
530 @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
531 @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
532 @@ lua_integer2str converts an integer to a string.
533 */
534
535
536 /* The following definitions are good for most cases here */
537
538 #define LUA_INTEGER_FMT         "%" LUA_INTEGER_FRMLEN "d"
539
540 #define LUAI_UACINT             LUA_INTEGER
541
542 #define lua_integer2str(s,sz,n)  \
543         l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
544
545 /*
546 ** use LUAI_UACINT here to avoid problems with promotions (which
547 ** can turn a comparison between unsigneds into a signed comparison)
548 */
549 #define LUA_UNSIGNED            unsigned LUAI_UACINT
550
551
552 /* now the variable definitions */
553
554 #if LUA_INT_TYPE == LUA_INT_INT         /* { int */
555
556 #define LUA_INTEGER             int
557 #define LUA_INTEGER_FRMLEN      ""
558
559 #define LUA_MAXINTEGER          INT_MAX
560 #define LUA_MININTEGER          INT_MIN
561
562 #elif LUA_INT_TYPE == LUA_INT_LONG      /* }{ long */
563
564 #define LUA_INTEGER             long
565 #define LUA_INTEGER_FRMLEN      "l"
566
567 #define LUA_MAXINTEGER          LONG_MAX
568 #define LUA_MININTEGER          LONG_MIN
569
570 #elif LUA_INT_TYPE == LUA_INT_LONGLONG  /* }{ long long */
571
572 /* use presence of macro LLONG_MAX as proxy for C99 compliance */
573 #if defined(LLONG_MAX)          /* { */
574 /* use ISO C99 stuff */
575
576 #define LUA_INTEGER             long long
577 #define LUA_INTEGER_FRMLEN      "ll"
578
579 #define LUA_MAXINTEGER          LLONG_MAX
580 #define LUA_MININTEGER          LLONG_MIN
581
582 #elif defined(LUA_USE_WINDOWS) /* }{ */
583 /* in Windows, can use specific Windows types */
584
585 #define LUA_INTEGER             __int64
586 #define LUA_INTEGER_FRMLEN      "I64"
587
588 #define LUA_MAXINTEGER          _I64_MAX
589 #define LUA_MININTEGER          _I64_MIN
590
591 #else                           /* }{ */
592
593 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
594   or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
595
596 #endif                          /* } */
597
598 #else                           /* }{ */
599
600 #error "numeric integer type not defined"
601
602 #endif                          /* } */
603
604 /* }================================================================== */
605
606
607 /*
608 ** {==================================================================
609 ** Dependencies with C99 and other C details
610 ** ===================================================================
611 */
612
613 /*
614 @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
615 ** (All uses in Lua have only one format item.)
616 */
617 #if !defined(LUA_USE_C89)
618 #define l_sprintf(s,sz,f,i)     snprintf(s,sz,f,i)
619 #else
620 #define l_sprintf(s,sz,f,i)     ((void)(sz), sprintf(s,f,i))
621 #endif
622
623
624 /*
625 @@ lua_strx2number converts an hexadecimal numeric string to a number.
626 ** In C99, 'strtod' does that conversion. Otherwise, you can
627 ** leave 'lua_strx2number' undefined and Lua will provide its own
628 ** implementation.
629 */
630 #if !defined(LUA_USE_C89)
631 #define lua_strx2number(s,p)            lua_str2number(s,p)
632 #endif
633
634
635 /*
636 @@ lua_pointer2str converts a pointer to a readable string in a
637 ** non-specified way.
638 */
639 #define lua_pointer2str(buff,sz,p)      l_sprintf(buff,sz,"%p",p)
640
641
642 /*
643 @@ lua_number2strx converts a float to an hexadecimal numeric string.
644 ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
645 ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
646 ** provide its own implementation.
647 */
648 #if !defined(LUA_USE_C89)
649 #define lua_number2strx(L,b,sz,f,n)  \
650         ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
651 #endif
652
653
654 /*
655 ** 'strtof' and 'opf' variants for math functions are not valid in
656 ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
657 ** availability of these variants. ('math.h' is already included in
658 ** all files that use these macros.)
659 */
660 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
661 #undef l_mathop  /* variants not available */
662 #undef lua_str2number
663 #define l_mathop(op)            (lua_Number)op  /* no variant */
664 #define lua_str2number(s,p)     ((lua_Number)strtod((s), (p)))
665 #endif
666
667
668 /*
669 @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
670 ** functions.  It must be a numerical type; Lua will use 'intptr_t' if
671 ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
672 ** 'intptr_t' in C89)
673 */
674 #define LUA_KCONTEXT    ptrdiff_t
675
676 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
677     __STDC_VERSION__ >= 199901L
678 #include <stdint.h>
679 #if defined(INTPTR_MAX)  /* even in C99 this type is optional */
680 #undef LUA_KCONTEXT
681 #define LUA_KCONTEXT    intptr_t
682 #endif
683 #endif
684
685
686 /*
687 @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
688 ** Change that if you do not want to use C locales. (Code using this
689 ** macro must include header 'locale.h'.)
690 */
691 #if !defined(lua_getlocaledecpoint)
692 #define lua_getlocaledecpoint()         (localeconv()->decimal_point[0])
693 #endif
694
695 /* }================================================================== */
696
697
698 /*
699 ** {==================================================================
700 ** Language Variations
701 ** =====================================================================
702 */
703
704 /*
705 @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
706 ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
707 ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
708 ** coercion from strings to numbers.
709 */
710 /* #define LUA_NOCVTN2S */
711 /* #define LUA_NOCVTS2N */
712
713
714 /*
715 @@ LUA_USE_APICHECK turns on several consistency checks on the C API.
716 ** Define it as a help when debugging C code.
717 */
718 #if defined(LUA_USE_APICHECK)
719 #include <assert.h>
720 #define luai_apicheck(l,e)      assert(e)
721 #endif
722
723 /* }================================================================== */
724
725
726 /*
727 ** {==================================================================
728 ** Macros that affect the API and must be stable (that is, must be the
729 ** same when you compile Lua and when you compile code that links to
730 ** Lua). You probably do not want/need to change them.
731 ** =====================================================================
732 */
733
734 /*
735 @@ LUAI_MAXSTACK limits the size of the Lua stack.
736 ** CHANGE it if you need a different limit. This limit is arbitrary;
737 ** its only purpose is to stop Lua from consuming unlimited stack
738 ** space (and to reserve some numbers for pseudo-indices).
739 */
740 #if LUAI_BITSINT >= 32
741 #define LUAI_MAXSTACK           1000000
742 #else
743 #define LUAI_MAXSTACK           15000
744 #endif
745
746
747 /*
748 @@ LUA_EXTRASPACE defines the size of a raw memory area associated with
749 ** a Lua state with very fast access.
750 ** CHANGE it if you need a different size.
751 */
752 #define LUA_EXTRASPACE          (sizeof(void *))
753
754
755 /*
756 @@ LUA_IDSIZE gives the maximum size for the description of the source
757 @@ of a function in debug information.
758 ** CHANGE it if you want a different size.
759 */
760 #define LUA_IDSIZE      60
761
762
763 /*
764 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
765 ** CHANGE it if it uses too much C-stack space. (For long double,
766 ** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a
767 ** smaller buffer would force a memory allocation for each call to
768 ** 'string.format'.)
769 */
770 #if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
771 #define LUAL_BUFFERSIZE         8192
772 #else
773 #define LUAL_BUFFERSIZE   ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
774 #endif
775
776 /* }================================================================== */
777
778
779 /*
780 @@ LUA_QL describes how error messages quote program elements.
781 ** Lua does not use these macros anymore; they are here for
782 ** compatibility only.
783 */
784 #define LUA_QL(x)       "'" x "'"
785 #define LUA_QS          LUA_QL("%s")
786
787
788
789
790 /* =================================================================== */
791
792 /*
793 ** Local configuration. You can use this space to add your redefinitions
794 ** without modifying the main part of the file.
795 */
796
797
798
799
800
801 #endif
802