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