|
16 | 16 | ** ===================================================================
|
17 | 17 | ** General Configuration File for Lua
|
18 | 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. |
| 19 | +** Some definitions here can be changed externally, through the compiler |
| 20 | +** (e.g., with '-D' options): They are commented out or protected |
| 21 | +** by '#if !defined' guards. However, several other definitions |
| 22 | +** should be changed directly here, either because they affect the |
| 23 | +** Lua ABI (by making the changes here, you ensure that all software |
| 24 | +** connected to Lua, such as C libraries, will be compiled with the same |
| 25 | +** configuration); or because they are seldom changed. |
26 | 26 | **
|
27 | 27 | ** Search for "@@" to find all configurable definitions.
|
28 | 28 | ** ===================================================================
|
|
81 | 81 |
|
82 | 82 | /*
|
83 | 83 | ** {==================================================================
|
84 |
| -** Configuration for Number types. |
| 84 | +** Configuration for Number types. These options should not be |
| 85 | +** set externally, because any other code connected to Lua must |
| 86 | +** use the same configuration. |
85 | 87 | ** ===================================================================
|
86 | 88 | */
|
87 | 89 |
|
88 |
| -/* |
89 |
| -@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. |
90 |
| -*/ |
91 |
| -/* #define LUA_32BITS */ |
92 |
| - |
93 |
| - |
94 |
| -/* |
95 |
| -@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for |
96 |
| -** C89 ('long' and 'double'); Windows always has '__int64', so it does |
97 |
| -** not need to use this case. |
98 |
| -*/ |
99 |
| -#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) |
100 |
| -#define LUA_C89_NUMBERS |
101 |
| -#endif |
102 |
| - |
103 |
| - |
104 | 90 | /*
|
105 | 91 | @@ LUA_INT_TYPE defines the type for Lua integers.
|
106 | 92 | @@ LUA_FLOAT_TYPE defines the type for Lua floats.
|
|
121 | 107 | #define LUA_FLOAT_DOUBLE 2
|
122 | 108 | #define LUA_FLOAT_LONGDOUBLE 3
|
123 | 109 |
|
124 |
| -#if defined(LUA_32BITS) /* { */ |
| 110 | + |
| 111 | +/* Default configuration ('long long' and 'double', for 64-bit Lua) */ |
| 112 | +#define LUA_INT_DEFAULT LUA_INT_LONGLONG |
| 113 | +#define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE |
| 114 | + |
| 115 | + |
| 116 | +/* |
| 117 | +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. |
| 118 | +*/ |
| 119 | +#define LUA_32BITS 0 |
| 120 | + |
| 121 | + |
| 122 | +/* |
| 123 | +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for |
| 124 | +** C89 ('long' and 'double'); Windows always has '__int64', so it does |
| 125 | +** not need to use this case. |
| 126 | +*/ |
| 127 | +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) |
| 128 | +#define LUA_C89_NUMBERS 1 |
| 129 | +#else |
| 130 | +#define LUA_C89_NUMBERS 0 |
| 131 | +#endif |
| 132 | + |
| 133 | + |
| 134 | +#if LUA_32BITS /* { */ |
125 | 135 | /*
|
126 | 136 | ** 32-bit integers and 'float'
|
127 | 137 | */
|
|
132 | 142 | #endif
|
133 | 143 | #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
|
134 | 144 |
|
135 |
| -#elif defined(LUA_C89_NUMBERS) /* }{ */ |
| 145 | +#elif LUA_C89_NUMBERS /* }{ */ |
136 | 146 | /*
|
137 | 147 | ** largest types available for C89 ('long' and 'double')
|
138 | 148 | */
|
139 | 149 | #define LUA_INT_TYPE LUA_INT_LONG
|
140 | 150 | #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
|
141 | 151 |
|
142 |
| -#endif /* } */ |
| 152 | +#else /* }{ */ |
| 153 | +/* use defaults */ |
143 | 154 |
|
| 155 | +#define LUA_INT_TYPE LUA_INT_DEFAULT |
| 156 | +#define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT |
144 | 157 |
|
145 |
| -/* |
146 |
| -** default configuration for 64-bit Lua ('long long' and 'double') |
147 |
| -*/ |
148 |
| -#if !defined(LUA_INT_TYPE) |
149 |
| -#define LUA_INT_TYPE LUA_INT_LONGLONG |
150 |
| -#endif |
| 158 | +#endif /* } */ |
151 | 159 |
|
152 |
| -#if !defined(LUA_FLOAT_TYPE) |
153 |
| -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE |
154 |
| -#endif |
155 | 160 |
|
156 | 161 | /* }================================================================== */
|
157 | 162 |
|
|
373 | 378 |
|
374 | 379 | /*
|
375 | 380 | ** {==================================================================
|
376 |
| -** Configuration for Numbers. |
| 381 | +** Configuration for Numbers (low-level part). |
377 | 382 | ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
|
378 | 383 | ** satisfy your needs.
|
379 | 384 | ** ===================================================================
|
380 | 385 | */
|
381 | 386 |
|
382 | 387 | /*
|
383 |
| -@@ LUA_NUMBER is the floating-point type used by Lua. |
384 | 388 | @@ LUAI_UACNUMBER is the result of a 'default argument promotion'
|
385 | 389 | @@ over a floating number.
|
386 | 390 | @@ l_floatatt(x) corrects float attribute 'x' to the proper float type
|
|
473 | 477 |
|
474 | 478 |
|
475 | 479 | /*
|
476 |
| -@@ LUA_INTEGER is the integer type used by Lua. |
477 |
| -** |
478 | 480 | @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
|
479 |
| -** |
480 | 481 | @@ LUAI_UACINT is the result of a 'default argument promotion'
|
481 | 482 | @@ over a LUA_INTEGER.
|
482 | 483 | @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
|
|
0 commit comments