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