aboutsummaryrefslogtreecommitdiff
path: root/src/lua/luaconf.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lua/luaconf.h (renamed from src/lua-5.3/luaconf.h)260
1 files changed, 123 insertions, 137 deletions
diff --git a/src/lua-5.3/luaconf.h b/src/lua/luaconf.h
index 9eeeea6..bdf927e 100644
--- a/src/lua-5.3/luaconf.h
+++ b/src/lua/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ 2** $Id: luaconf.h $
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*/
@@ -14,6 +14,16 @@
14 14
15/* 15/*
16** =================================================================== 16** ===================================================================
17** General Configuration File for Lua
18**
19** Some definitions here can be changed externally, through the
20** compiler (e.g., with '-D' options). Those are protected by
21** '#if !defined' guards. However, several other definitions should
22** be changed directly here, either because they affect the Lua
23** ABI (by making the changes here, you ensure that all software
24** connected to Lua, such as C libraries, will be compiled with the
25** same configuration); or because they are seldom changed.
26**
17** Search for "@@" to find all configurable definitions. 27** Search for "@@" to find all configurable definitions.
18** =================================================================== 28** ===================================================================
19*/ 29*/
@@ -22,18 +32,23 @@
22/* 32/*
23** {==================================================================== 33** {====================================================================
24** System Configuration: macros to adapt (if needed) Lua to some 34** System Configuration: macros to adapt (if needed) Lua to some
25** particular platform, for instance compiling it with 32-bit numbers or 35** particular platform, for instance restricting it to C89.
26** restricting it to C89.
27** ===================================================================== 36** =====================================================================
28*/ 37*/
29 38
30/* 39/*
31@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You 40@@ LUAI_MAXCSTACK defines the maximum depth for nested calls and
32** can also define LUA_32BITS in the make file, but changing here you 41** also limits the maximum depth of other recursive algorithms in
33** ensure that all software connected to Lua will be compiled with the 42** the implementation, such as syntactic analysis. A value too
34** same configuration. 43** large may allow the interpreter to crash (C-stack overflow).
44** The default value seems ok for regular machines, but may be
45** too high for restricted hardware.
46** The test file 'cstack.lua' may help finding a good limit.
47** (It will crash with a limit too high.)
35*/ 48*/
36/* #define LUA_32BITS */ 49#if !defined(LUAI_MAXCSTACK)
50#define LUAI_MAXCSTACK 2000
51#endif
37 52
38 53
39/* 54/*
@@ -61,45 +76,51 @@
61#if defined(LUA_USE_LINUX) 76#if defined(LUA_USE_LINUX)
62#define LUA_USE_POSIX 77#define LUA_USE_POSIX
63#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 78#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
64#define LUA_USE_READLINE /* needs some extra libraries */
65#endif 79#endif
66 80
67 81
68#if defined(LUA_USE_MACOSX) 82#if defined(LUA_USE_MACOSX)
69#define LUA_USE_POSIX 83#define LUA_USE_POSIX
70#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ 84#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
71#define LUA_USE_READLINE /* needs an extra library: -lreadline */
72#endif 85#endif
73 86
74 87
75/* 88/*
76@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for 89@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
77** C89 ('long' and 'double'); Windows always has '__int64', so it does
78** not need to use this case.
79*/ 90*/
80#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) 91#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3)
81#define LUA_C89_NUMBERS 92
82#endif 93/* }================================================================== */
83 94
84 95
85 96
86/* 97/*
87@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. 98** {==================================================================
99** Configuration for Number types.
100** ===================================================================
88*/ 101*/
89/* avoid undefined shifts */ 102
90#if ((INT_MAX >> 15) >> 15) >= 1 103/*
91#define LUAI_BITSINT 32 104@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
92#else 105*/
93/* 'int' always must have at least 16 bits */ 106/* #define LUA_32BITS */
94#define LUAI_BITSINT 16 107
108
109/*
110@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
111** C89 ('long' and 'double'); Windows always has '__int64', so it does
112** not need to use this case.
113*/
114#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
115#define LUA_C89_NUMBERS
95#endif 116#endif
96 117
97 118
98/* 119/*
99@@ LUA_INT_TYPE defines the type for Lua integers. 120@@ LUA_INT_TYPE defines the type for Lua integers.
100@@ LUA_FLOAT_TYPE defines the type for Lua floats. 121@@ LUA_FLOAT_TYPE defines the type for Lua floats.
101** Lua should work fine with any mix of these options (if supported 122** Lua should work fine with any mix of these options supported
102** by your C compiler). The usual configurations are 64-bit integers 123** by your C compiler. The usual configurations are 64-bit integers
103** and 'double' (the default), 32-bit integers and 'float' (for 124** and 'double' (the default), 32-bit integers and 'float' (for
104** restricted platforms), and 'long'/'double' (for C compilers not 125** restricted platforms), and 'long'/'double' (for C compilers not
105** compliant with C99, which may not have support for 'long long'). 126** compliant with C99, which may not have support for 'long long').
@@ -119,7 +140,7 @@
119/* 140/*
120** 32-bit integers and 'float' 141** 32-bit integers and 'float'
121*/ 142*/
122#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ 143#if LUAI_IS32INT /* use 'int' if big enough */
123#define LUA_INT_TYPE LUA_INT_INT 144#define LUA_INT_TYPE LUA_INT_INT
124#else /* otherwise use 'long' */ 145#else /* otherwise use 'long' */
125#define LUA_INT_TYPE LUA_INT_LONG 146#define LUA_INT_TYPE LUA_INT_LONG
@@ -151,7 +172,6 @@
151 172
152 173
153 174
154
155/* 175/*
156** {================================================================== 176** {==================================================================
157** Configuration for Paths. 177** Configuration for Paths.
@@ -179,6 +199,7 @@
179** hierarchy or if you want to install your libraries in 199** hierarchy or if you want to install your libraries in
180** non-conventional directories. 200** non-conventional directories.
181*/ 201*/
202
182#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR 203#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
183#if defined(_WIN32) /* { */ 204#if defined(_WIN32) /* { */
184/* 205/*
@@ -188,27 +209,40 @@
188#define LUA_LDIR "!\\lua\\" 209#define LUA_LDIR "!\\lua\\"
189#define LUA_CDIR "!\\" 210#define LUA_CDIR "!\\"
190#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" 211#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
212
213#if !defined(LUA_PATH_DEFAULT)
191#define LUA_PATH_DEFAULT \ 214#define LUA_PATH_DEFAULT \
192 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 215 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
193 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ 216 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
194 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ 217 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
195 ".\\?.lua;" ".\\?\\init.lua" 218 ".\\?.lua;" ".\\?\\init.lua"
219#endif
220
221#if !defined(LUA_CPATH_DEFAULT)
196#define LUA_CPATH_DEFAULT \ 222#define LUA_CPATH_DEFAULT \
197 LUA_CDIR"?.dll;" \ 223 LUA_CDIR"?.dll;" \
198 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ 224 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
199 LUA_CDIR"loadall.dll;" ".\\?.dll" 225 LUA_CDIR"loadall.dll;" ".\\?.dll"
226#endif
200 227
201#else /* }{ */ 228#else /* }{ */
202 229
203#define LUA_ROOT "/usr/local/" 230#define LUA_ROOT "/usr/local/"
204#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" 231#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
205#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" 232#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
233
234#if !defined(LUA_PATH_DEFAULT)
206#define LUA_PATH_DEFAULT \ 235#define LUA_PATH_DEFAULT \
207 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 236 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
208 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ 237 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
209 "./?.lua;" "./?/init.lua" 238 "./?.lua;" "./?/init.lua"
239#endif
240
241#if !defined(LUA_CPATH_DEFAULT)
210#define LUA_CPATH_DEFAULT \ 242#define LUA_CPATH_DEFAULT \
211 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" 243 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
244#endif
245
212#endif /* } */ 246#endif /* } */
213 247
214 248
@@ -217,12 +251,16 @@
217** CHANGE it if your machine does not use "/" as the directory separator 251** CHANGE it if your machine does not use "/" as the directory separator
218** and is not Windows. (On Windows Lua automatically uses "\".) 252** and is not Windows. (On Windows Lua automatically uses "\".)
219*/ 253*/
254#if !defined(LUA_DIRSEP)
255
220#if defined(_WIN32) 256#if defined(_WIN32)
221#define LUA_DIRSEP "\\" 257#define LUA_DIRSEP "\\"
222#else 258#else
223#define LUA_DIRSEP "/" 259#define LUA_DIRSEP "/"
224#endif 260#endif
225 261
262#endif
263
226/* }================================================================== */ 264/* }================================================================== */
227 265
228 266
@@ -256,16 +294,18 @@
256#endif /* } */ 294#endif /* } */
257 295
258 296
259/* more often than not the libs go together with the core */ 297/*
298** More often than not the libs go together with the core.
299*/
260#define LUALIB_API LUA_API 300#define LUALIB_API LUA_API
261#define LUAMOD_API LUALIB_API 301#define LUAMOD_API LUA_API
262 302
263 303
264/* 304/*
265@@ LUAI_FUNC is a mark for all extern functions that are not to be 305@@ LUAI_FUNC is a mark for all extern functions that are not to be
266** exported to outside modules. 306** exported to outside modules.
267@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables 307@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
268** that are not to be exported to outside modules (LUAI_DDEF for 308** none of which to be exported to outside modules (LUAI_DDEF for
269** definitions and LUAI_DDEC for declarations). 309** definitions and LUAI_DDEC for declarations).
270** CHANGE them if you need to mark them in some special way. Elf/gcc 310** CHANGE them if you need to mark them in some special way. Elf/gcc
271** (versions 3.2 and later) mark them as "hidden" to optimize access 311** (versions 3.2 and later) mark them as "hidden" to optimize access
@@ -277,12 +317,12 @@
277*/ 317*/
278#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 318#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
279 defined(__ELF__) /* { */ 319 defined(__ELF__) /* { */
280#define LUAI_FUNC __attribute__((visibility("hidden"))) extern 320#define LUAI_FUNC __attribute__((visibility("internal"))) extern
281#else /* }{ */ 321#else /* }{ */
282#define LUAI_FUNC extern 322#define LUAI_FUNC extern
283#endif /* } */ 323#endif /* } */
284 324
285#define LUAI_DDEC LUAI_FUNC 325#define LUAI_DDEC(dec) LUAI_FUNC dec
286#define LUAI_DDEF /* empty */ 326#define LUAI_DDEF /* empty */
287 327
288/* }================================================================== */ 328/* }================================================================== */
@@ -295,88 +335,43 @@
295*/ 335*/
296 336
297/* 337/*
298@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. 338@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3.
299@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1.
300** You can define it to get all options, or change specific options 339** You can define it to get all options, or change specific options
301** to fit your specific needs. 340** to fit your specific needs.
302*/ 341*/
303#if defined(LUA_COMPAT_5_2) /* { */ 342#if defined(LUA_COMPAT_5_3) /* { */
304 343
305/* 344/*
306@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated 345@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
307** functions in the mathematical library. 346** functions in the mathematical library.
347** (These functions were already officially removed in 5.3;
348** nevertheless they are still available here.)
308*/ 349*/
309#define LUA_COMPAT_MATHLIB 350#define LUA_COMPAT_MATHLIB
310 351
311/* 352/*
312@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'.
313*/
314#define LUA_COMPAT_BITLIB
315
316/*
317@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod.
318*/
319#define LUA_COMPAT_IPAIRS
320
321/*
322@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for 353@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
323** manipulating other integer types (lua_pushunsigned, lua_tounsigned, 354** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
324** luaL_checkint, luaL_checklong, etc.) 355** luaL_checkint, luaL_checklong, etc.)
356** (These macros were also officially removed in 5.3, but they are still
357** available here.)
325*/ 358*/
326#define LUA_COMPAT_APIINTCASTS 359#define LUA_COMPAT_APIINTCASTS
327 360
328#endif /* } */
329
330
331#if defined(LUA_COMPAT_5_1) /* { */
332
333/* Incompatibilities from 5.2 -> 5.3 */
334#define LUA_COMPAT_MATHLIB
335#define LUA_COMPAT_APIINTCASTS
336 361
337/* 362/*
338@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. 363@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod
339** You can replace it with 'table.unpack'. 364** using '__lt'.
340*/ 365*/
341#define LUA_COMPAT_UNPACK 366#define LUA_COMPAT_LT_LE
342 367
343/*
344@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
345** You can replace it with 'package.searchers'.
346*/
347#define LUA_COMPAT_LOADERS
348
349/*
350@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
351** You can call your C function directly (with light C functions).
352*/
353#define lua_cpcall(L,f,u) \
354 (lua_pushcfunction(L, (f)), \
355 lua_pushlightuserdata(L,(u)), \
356 lua_pcall(L,1,0,0))
357
358
359/*
360@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
361** You can rewrite 'log10(x)' as 'log(x, 10)'.
362*/
363#define LUA_COMPAT_LOG10
364
365/*
366@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
367** library. You can rewrite 'loadstring(s)' as 'load(s)'.
368*/
369#define LUA_COMPAT_LOADSTRING
370
371/*
372@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
373*/
374#define LUA_COMPAT_MAXN
375 368
376/* 369/*
377@@ The following macros supply trivial compatibility for some 370@@ The following macros supply trivial compatibility for some
378** changes in the API. The macros themselves document how to 371** changes in the API. The macros themselves document how to
379** change your code to avoid using them. 372** change your code to avoid using them.
373** (Once more, these macros were officially removed in 5.3, but they are
374** still available here.)
380*/ 375*/
381#define lua_strlen(L,i) lua_rawlen(L, (i)) 376#define lua_strlen(L,i) lua_rawlen(L, (i))
382 377
@@ -385,23 +380,8 @@
385#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) 380#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
386#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) 381#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
387 382
388/*
389@@ LUA_COMPAT_MODULE controls compatibility with previous
390** module functions 'module' (Lua) and 'luaL_register' (C).
391*/
392#define LUA_COMPAT_MODULE
393
394#endif /* } */ 383#endif /* } */
395 384
396
397/*
398@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
399@@ a float mark ('.0').
400** This macro is not on by default even in compatibility mode,
401** because this is not really an incompatibility.
402*/
403/* #define LUA_COMPAT_FLOATSTRING */
404
405/* }================================================================== */ 385/* }================================================================== */
406 386
407 387
@@ -418,14 +398,14 @@
418@@ LUA_NUMBER is the floating-point type used by Lua. 398@@ LUA_NUMBER is the floating-point type used by Lua.
419@@ LUAI_UACNUMBER is the result of a 'default argument promotion' 399@@ LUAI_UACNUMBER is the result of a 'default argument promotion'
420@@ over a floating number. 400@@ over a floating number.
421@@ l_mathlim(x) corrects limit name 'x' to the proper float type 401@@ l_floatatt(x) corrects float attribute 'x' to the proper float type
422** by prefixing it with one of FLT/DBL/LDBL. 402** by prefixing it with one of FLT/DBL/LDBL.
423@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. 403@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
424@@ LUA_NUMBER_FMT is the format for writing floats. 404@@ LUA_NUMBER_FMT is the format for writing floats.
425@@ lua_number2str converts a float to a string. 405@@ lua_number2str converts a float to a string.
426@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. 406@@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
427@@ l_floor takes the floor of a float. 407@@ l_floor takes the floor of a float.
428@@ lua_str2number converts a decimal numeric string to a number. 408@@ lua_str2number converts a decimal numeral to a number.
429*/ 409*/
430 410
431 411
@@ -437,12 +417,13 @@
437 l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) 417 l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
438 418
439/* 419/*
440@@ lua_numbertointeger converts a float number to an integer, or 420@@ lua_numbertointeger converts a float number with an integral value
441** returns 0 if float is not within the range of a lua_Integer. 421** to an integer, or returns 0 if float is not within the range of
442** (The range comparisons are tricky because of rounding. The tests 422** a lua_Integer. (The range comparisons are tricky because of
443** here assume a two-complement representation, where MININTEGER always 423** rounding. The tests here assume a two-complement representation,
444** has an exact representation as a float; MAXINTEGER may not have one, 424** where MININTEGER always has an exact representation as a float;
445** and therefore its conversion to float may have an ill-defined value.) 425** MAXINTEGER may not have one, and therefore its conversion to float
426** may have an ill-defined value.)
446*/ 427*/
447#define lua_numbertointeger(n,p) \ 428#define lua_numbertointeger(n,p) \
448 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ 429 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
@@ -456,7 +437,7 @@
456 437
457#define LUA_NUMBER float 438#define LUA_NUMBER float
458 439
459#define l_mathlim(n) (FLT_##n) 440#define l_floatatt(n) (FLT_##n)
460 441
461#define LUAI_UACNUMBER double 442#define LUAI_UACNUMBER double
462 443
@@ -472,7 +453,7 @@
472 453
473#define LUA_NUMBER long double 454#define LUA_NUMBER long double
474 455
475#define l_mathlim(n) (LDBL_##n) 456#define l_floatatt(n) (LDBL_##n)
476 457
477#define LUAI_UACNUMBER long double 458#define LUAI_UACNUMBER long double
478 459
@@ -487,7 +468,7 @@
487 468
488#define LUA_NUMBER double 469#define LUA_NUMBER double
489 470
490#define l_mathlim(n) (DBL_##n) 471#define l_floatatt(n) (DBL_##n)
491 472
492#define LUAI_UACNUMBER double 473#define LUAI_UACNUMBER double
493 474
@@ -512,11 +493,13 @@
512@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. 493@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
513** 494**
514@@ LUAI_UACINT is the result of a 'default argument promotion' 495@@ LUAI_UACINT is the result of a 'default argument promotion'
515@@ over a lUA_INTEGER. 496@@ over a LUA_INTEGER.
516@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. 497@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
517@@ LUA_INTEGER_FMT is the format for writing integers. 498@@ LUA_INTEGER_FMT is the format for writing integers.
518@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. 499@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
519@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. 500@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
501@@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED.
502@@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED.
520@@ lua_integer2str converts an integer to a string. 503@@ lua_integer2str converts an integer to a string.
521*/ 504*/
522 505
@@ -537,6 +520,9 @@
537#define LUA_UNSIGNED unsigned LUAI_UACINT 520#define LUA_UNSIGNED unsigned LUAI_UACINT
538 521
539 522
523#define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT)
524
525
540/* now the variable definitions */ 526/* now the variable definitions */
541 527
542#if LUA_INT_TYPE == LUA_INT_INT /* { int */ 528#if LUA_INT_TYPE == LUA_INT_INT /* { int */
@@ -547,6 +533,8 @@
547#define LUA_MAXINTEGER INT_MAX 533#define LUA_MAXINTEGER INT_MAX
548#define LUA_MININTEGER INT_MIN 534#define LUA_MININTEGER INT_MIN
549 535
536#define LUA_MAXUNSIGNED UINT_MAX
537
550#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ 538#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
551 539
552#define LUA_INTEGER long 540#define LUA_INTEGER long
@@ -555,6 +543,8 @@
555#define LUA_MAXINTEGER LONG_MAX 543#define LUA_MAXINTEGER LONG_MAX
556#define LUA_MININTEGER LONG_MIN 544#define LUA_MININTEGER LONG_MIN
557 545
546#define LUA_MAXUNSIGNED ULONG_MAX
547
558#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ 548#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
559 549
560/* use presence of macro LLONG_MAX as proxy for C99 compliance */ 550/* use presence of macro LLONG_MAX as proxy for C99 compliance */
@@ -567,6 +557,8 @@
567#define LUA_MAXINTEGER LLONG_MAX 557#define LUA_MAXINTEGER LLONG_MAX
568#define LUA_MININTEGER LLONG_MIN 558#define LUA_MININTEGER LLONG_MIN
569 559
560#define LUA_MAXUNSIGNED ULLONG_MAX
561
570#elif defined(LUA_USE_WINDOWS) /* }{ */ 562#elif defined(LUA_USE_WINDOWS) /* }{ */
571/* in Windows, can use specific Windows types */ 563/* in Windows, can use specific Windows types */
572 564
@@ -576,6 +568,8 @@
576#define LUA_MAXINTEGER _I64_MAX 568#define LUA_MAXINTEGER _I64_MAX
577#define LUA_MININTEGER _I64_MIN 569#define LUA_MININTEGER _I64_MIN
578 570
571#define LUA_MAXUNSIGNED _UI64_MAX
572
579#else /* }{ */ 573#else /* }{ */
580 574
581#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ 575#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
@@ -610,7 +604,7 @@
610 604
611 605
612/* 606/*
613@@ lua_strx2number converts an hexadecimal numeric string to a number. 607@@ lua_strx2number converts a hexadecimal numeral to a number.
614** In C99, 'strtod' does that conversion. Otherwise, you can 608** In C99, 'strtod' does that conversion. Otherwise, you can
615** leave 'lua_strx2number' undefined and Lua will provide its own 609** leave 'lua_strx2number' undefined and Lua will provide its own
616** implementation. 610** implementation.
@@ -628,7 +622,7 @@
628 622
629 623
630/* 624/*
631@@ lua_number2strx converts a float to an hexadecimal numeric string. 625@@ lua_number2strx converts a float to a hexadecimal numeral.
632** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. 626** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
633** Otherwise, you can leave 'lua_number2strx' undefined and Lua will 627** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
634** provide its own implementation. 628** provide its own implementation.
@@ -674,7 +668,7 @@
674/* 668/*
675@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). 669@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
676** Change that if you do not want to use C locales. (Code using this 670** Change that if you do not want to use C locales. (Code using this
677** macro must include header 'locale.h'.) 671** macro must include the header 'locale.h'.)
678*/ 672*/
679#if !defined(lua_getlocaledecpoint) 673#if !defined(lua_getlocaledecpoint)
680#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) 674#define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
@@ -715,7 +709,7 @@
715** {================================================================== 709** {==================================================================
716** Macros that affect the API and must be stable (that is, must be the 710** Macros that affect the API and must be stable (that is, must be the
717** same when you compile Lua and when you compile code that links to 711** same when you compile Lua and when you compile code that links to
718** Lua). You probably do not want/need to change them. 712** Lua).
719** ===================================================================== 713** =====================================================================
720*/ 714*/
721 715
@@ -724,8 +718,9 @@
724** CHANGE it if you need a different limit. This limit is arbitrary; 718** CHANGE it if you need a different limit. This limit is arbitrary;
725** its only purpose is to stop Lua from consuming unlimited stack 719** its only purpose is to stop Lua from consuming unlimited stack
726** space (and to reserve some numbers for pseudo-indices). 720** space (and to reserve some numbers for pseudo-indices).
721** (It must fit into max(size_t)/32.)
727*/ 722*/
728#if LUAI_BITSINT >= 32 723#if LUAI_IS32INT
729#define LUAI_MAXSTACK 1000000 724#define LUAI_MAXSTACK 1000000
730#else 725#else
731#define LUAI_MAXSTACK 15000 726#define LUAI_MAXSTACK 15000
@@ -750,27 +745,18 @@
750 745
751/* 746/*
752@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 747@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
753** CHANGE it if it uses too much C-stack space. (For long double,
754** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a
755** smaller buffer would force a memory allocation for each call to
756** 'string.format'.)
757*/ 748*/
758#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE 749#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number)))
759#define LUAL_BUFFERSIZE 8192
760#else
761#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
762#endif
763
764/* }================================================================== */
765 750
766 751
767/* 752/*
768@@ LUA_QL describes how error messages quote program elements. 753@@ LUAI_MAXALIGN defines fields that, when used in a union, ensure
769** Lua does not use these macros anymore; they are here for 754** maximum alignment for the other items in that union.
770** compatibility only.
771*/ 755*/
772#define LUA_QL(x) "'" x "'" 756#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l
773#define LUA_QS LUA_QL("%s") 757
758/* }================================================================== */
759
774 760
775 761
776 762