17cafeaa1SWarner Losh /* 2*ec965063SEd Maste ** $Id: luaconf.h $ 37cafeaa1SWarner Losh ** Configuration file for Lua 47cafeaa1SWarner Losh ** See Copyright Notice in lua.h 57cafeaa1SWarner Losh */ 67cafeaa1SWarner Losh 77cafeaa1SWarner Losh 87cafeaa1SWarner Losh #ifndef luaconf_h 97cafeaa1SWarner Losh #define luaconf_h 107cafeaa1SWarner Losh 117cafeaa1SWarner Losh #include <limits.h> 127cafeaa1SWarner Losh #include <stddef.h> 137cafeaa1SWarner Losh 147cafeaa1SWarner Losh 157cafeaa1SWarner Losh /* 167cafeaa1SWarner Losh ** =================================================================== 170495ed39SKyle Evans ** General Configuration File for Lua 180495ed39SKyle Evans ** 190495ed39SKyle Evans ** Some definitions here can be changed externally, through the 200495ed39SKyle Evans ** compiler (e.g., with '-D' options). Those are protected by 210495ed39SKyle Evans ** '#if !defined' guards. However, several other definitions should 220495ed39SKyle Evans ** be changed directly here, either because they affect the Lua 230495ed39SKyle Evans ** ABI (by making the changes here, you ensure that all software 240495ed39SKyle Evans ** connected to Lua, such as C libraries, will be compiled with the 250495ed39SKyle Evans ** same configuration); or because they are seldom changed. 260495ed39SKyle Evans ** 277cafeaa1SWarner Losh ** Search for "@@" to find all configurable definitions. 287cafeaa1SWarner Losh ** =================================================================== 297cafeaa1SWarner Losh */ 307cafeaa1SWarner Losh 317cafeaa1SWarner Losh 327cafeaa1SWarner Losh /* 337cafeaa1SWarner Losh ** {==================================================================== 347cafeaa1SWarner Losh ** System Configuration: macros to adapt (if needed) Lua to some 350495ed39SKyle Evans ** particular platform, for instance restricting it to C89. 367cafeaa1SWarner Losh ** ===================================================================== 377cafeaa1SWarner Losh */ 387cafeaa1SWarner Losh 397cafeaa1SWarner Losh /* 407cafeaa1SWarner Losh @@ LUA_USE_C89 controls the use of non-ISO-C89 features. 417cafeaa1SWarner Losh ** Define it if you want Lua to avoid the use of a few C99 features 427cafeaa1SWarner Losh ** or Windows-specific features on Windows. 437cafeaa1SWarner Losh */ 447cafeaa1SWarner Losh /* #define LUA_USE_C89 */ 457cafeaa1SWarner Losh 467cafeaa1SWarner Losh 477cafeaa1SWarner Losh /* 487cafeaa1SWarner Losh ** By default, Lua on Windows use (some) specific Windows features 497cafeaa1SWarner Losh */ 507cafeaa1SWarner Losh #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) 517cafeaa1SWarner Losh #define LUA_USE_WINDOWS /* enable goodies for regular Windows */ 527cafeaa1SWarner Losh #endif 537cafeaa1SWarner Losh 547cafeaa1SWarner Losh 557cafeaa1SWarner Losh #if defined(LUA_USE_WINDOWS) 567cafeaa1SWarner Losh #define LUA_DL_DLL /* enable support for DLL */ 577cafeaa1SWarner Losh #define LUA_USE_C89 /* broadly, Windows is C89 */ 587cafeaa1SWarner Losh #endif 597cafeaa1SWarner Losh 607cafeaa1SWarner Losh 617cafeaa1SWarner Losh #if defined(LUA_USE_LINUX) 627cafeaa1SWarner Losh #define LUA_USE_POSIX 637cafeaa1SWarner Losh #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 647cafeaa1SWarner Losh #endif 657cafeaa1SWarner Losh 667cafeaa1SWarner Losh 677cafeaa1SWarner Losh #if defined(LUA_USE_MACOSX) 687cafeaa1SWarner Losh #define LUA_USE_POSIX 697cafeaa1SWarner Losh #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ 707cafeaa1SWarner Losh #endif 717cafeaa1SWarner Losh 727cafeaa1SWarner Losh 737cafeaa1SWarner Losh /* 740495ed39SKyle Evans @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. 750495ed39SKyle Evans */ 760495ed39SKyle Evans #define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) 770495ed39SKyle Evans 780495ed39SKyle Evans /* }================================================================== */ 790495ed39SKyle Evans 800495ed39SKyle Evans 810495ed39SKyle Evans 820495ed39SKyle Evans /* 830495ed39SKyle Evans ** {================================================================== 840495ed39SKyle Evans ** Configuration for Number types. 850495ed39SKyle Evans ** =================================================================== 860495ed39SKyle Evans */ 870495ed39SKyle Evans 880495ed39SKyle Evans /* 890495ed39SKyle Evans @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. 900495ed39SKyle Evans */ 910495ed39SKyle Evans /* #define LUA_32BITS */ 920495ed39SKyle Evans 930495ed39SKyle Evans 940495ed39SKyle Evans /* 957cafeaa1SWarner Losh @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for 967cafeaa1SWarner Losh ** C89 ('long' and 'double'); Windows always has '__int64', so it does 977cafeaa1SWarner Losh ** not need to use this case. 987cafeaa1SWarner Losh */ 997cafeaa1SWarner Losh #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) 1007cafeaa1SWarner Losh #define LUA_C89_NUMBERS 1017cafeaa1SWarner Losh #endif 1027cafeaa1SWarner Losh 1037cafeaa1SWarner Losh 1047cafeaa1SWarner Losh /* 1057cafeaa1SWarner Losh @@ LUA_INT_TYPE defines the type for Lua integers. 1067cafeaa1SWarner Losh @@ LUA_FLOAT_TYPE defines the type for Lua floats. 1070495ed39SKyle Evans ** Lua should work fine with any mix of these options supported 1080495ed39SKyle Evans ** by your C compiler. The usual configurations are 64-bit integers 1097cafeaa1SWarner Losh ** and 'double' (the default), 32-bit integers and 'float' (for 1107cafeaa1SWarner Losh ** restricted platforms), and 'long'/'double' (for C compilers not 1117cafeaa1SWarner Losh ** compliant with C99, which may not have support for 'long long'). 1127cafeaa1SWarner Losh */ 1137cafeaa1SWarner Losh 1147cafeaa1SWarner Losh /* predefined options for LUA_INT_TYPE */ 1157cafeaa1SWarner Losh #define LUA_INT_INT 1 1167cafeaa1SWarner Losh #define LUA_INT_LONG 2 1177cafeaa1SWarner Losh #define LUA_INT_LONGLONG 3 1187cafeaa1SWarner Losh 1197cafeaa1SWarner Losh /* predefined options for LUA_FLOAT_TYPE */ 1207cafeaa1SWarner Losh #define LUA_FLOAT_FLOAT 1 1217cafeaa1SWarner Losh #define LUA_FLOAT_DOUBLE 2 1227cafeaa1SWarner Losh #define LUA_FLOAT_LONGDOUBLE 3 1237cafeaa1SWarner Losh #define LUA_FLOAT_INT64 4 1247cafeaa1SWarner Losh 1257cafeaa1SWarner Losh #if defined(LUA_32BITS) /* { */ 1267cafeaa1SWarner Losh /* 1277cafeaa1SWarner Losh ** 32-bit integers and 'float' 1287cafeaa1SWarner Losh */ 1290495ed39SKyle Evans #if LUAI_IS32INT /* use 'int' if big enough */ 1307cafeaa1SWarner Losh #define LUA_INT_TYPE LUA_INT_INT 1317cafeaa1SWarner Losh #else /* otherwise use 'long' */ 1327cafeaa1SWarner Losh #define LUA_INT_TYPE LUA_INT_LONG 1337cafeaa1SWarner Losh #endif 1347cafeaa1SWarner Losh #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT 1357cafeaa1SWarner Losh 1367cafeaa1SWarner Losh #elif defined(LUA_C89_NUMBERS) /* }{ */ 1377cafeaa1SWarner Losh /* 1387cafeaa1SWarner Losh ** largest types available for C89 ('long' and 'double') 1397cafeaa1SWarner Losh */ 1407cafeaa1SWarner Losh #define LUA_INT_TYPE LUA_INT_LONG 1417cafeaa1SWarner Losh #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE 1427cafeaa1SWarner Losh 1437cafeaa1SWarner Losh #endif /* } */ 1447cafeaa1SWarner Losh 1457cafeaa1SWarner Losh 1467cafeaa1SWarner Losh /* 1477cafeaa1SWarner Losh ** default configuration for 64-bit Lua ('long long' and 'double') 1487cafeaa1SWarner Losh */ 1497cafeaa1SWarner Losh #if !defined(LUA_INT_TYPE) 1507cafeaa1SWarner Losh #define LUA_INT_TYPE LUA_INT_LONGLONG 1517cafeaa1SWarner Losh #endif 1527cafeaa1SWarner Losh 1537cafeaa1SWarner Losh #if !defined(LUA_FLOAT_TYPE) 1547cafeaa1SWarner Losh #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE 1557cafeaa1SWarner Losh #endif 1567cafeaa1SWarner Losh 1577cafeaa1SWarner Losh /* }================================================================== */ 1587cafeaa1SWarner Losh 1597cafeaa1SWarner Losh 1607cafeaa1SWarner Losh 1617cafeaa1SWarner Losh /* 1627cafeaa1SWarner Losh ** {================================================================== 1637cafeaa1SWarner Losh ** Configuration for Paths. 1647cafeaa1SWarner Losh ** =================================================================== 1657cafeaa1SWarner Losh */ 1667cafeaa1SWarner Losh 1677cafeaa1SWarner Losh /* 1687cafeaa1SWarner Losh ** LUA_PATH_SEP is the character that separates templates in a path. 1697cafeaa1SWarner Losh ** LUA_PATH_MARK is the string that marks the substitution points in a 1707cafeaa1SWarner Losh ** template. 1717cafeaa1SWarner Losh ** LUA_EXEC_DIR in a Windows path is replaced by the executable's 1727cafeaa1SWarner Losh ** directory. 1737cafeaa1SWarner Losh */ 1747cafeaa1SWarner Losh #define LUA_PATH_SEP ";" 1757cafeaa1SWarner Losh #define LUA_PATH_MARK "?" 1767cafeaa1SWarner Losh #define LUA_EXEC_DIR "!" 1777cafeaa1SWarner Losh 1787cafeaa1SWarner Losh 1797cafeaa1SWarner Losh /* 1807cafeaa1SWarner Losh @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for 1817cafeaa1SWarner Losh ** Lua libraries. 1827cafeaa1SWarner Losh @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for 1837cafeaa1SWarner Losh ** C libraries. 1847cafeaa1SWarner Losh ** CHANGE them if your machine has a non-conventional directory 1857cafeaa1SWarner Losh ** hierarchy or if you want to install your libraries in 1867cafeaa1SWarner Losh ** non-conventional directories. 1877cafeaa1SWarner Losh */ 1880495ed39SKyle Evans 1897cafeaa1SWarner Losh #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR 1907cafeaa1SWarner Losh #if defined(_WIN32) /* { */ 1917cafeaa1SWarner Losh /* 1927cafeaa1SWarner Losh ** In Windows, any exclamation mark ('!') in the path is replaced by the 1937cafeaa1SWarner Losh ** path of the directory of the executable file of the current process. 1947cafeaa1SWarner Losh */ 1957cafeaa1SWarner Losh #define LUA_LDIR "!\\lua\\" 1967cafeaa1SWarner Losh #define LUA_CDIR "!\\" 1977cafeaa1SWarner Losh #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" 1980495ed39SKyle Evans 1990495ed39SKyle Evans #if !defined(LUA_PATH_DEFAULT) 2007cafeaa1SWarner Losh #define LUA_PATH_DEFAULT \ 2017cafeaa1SWarner Losh LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ 2027cafeaa1SWarner Losh LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ 2037cafeaa1SWarner Losh LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ 2047cafeaa1SWarner Losh ".\\?.lua;" ".\\?\\init.lua" 2050495ed39SKyle Evans #endif 2060495ed39SKyle Evans 2070495ed39SKyle Evans #if !defined(LUA_CPATH_DEFAULT) 2087cafeaa1SWarner Losh #define LUA_CPATH_DEFAULT \ 2097cafeaa1SWarner Losh LUA_CDIR"?.dll;" \ 2107cafeaa1SWarner Losh LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ 2117cafeaa1SWarner Losh LUA_CDIR"loadall.dll;" ".\\?.dll" 2120495ed39SKyle Evans #endif 2137cafeaa1SWarner Losh 2147cafeaa1SWarner Losh #else /* }{ */ 2157cafeaa1SWarner Losh 216ee74c236SKyle Evans #define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" 21716633f3aSWarner Losh #define LUA_LDIR LUA_ROOT "share/" 21816633f3aSWarner Losh #define LUA_CDIR LUA_ROOT "lib/" 2190495ed39SKyle Evans 220*ec965063SEd Maste #if !defined(LUA_PATH_DEFAULT) 2217cafeaa1SWarner Losh #define LUA_PATH_DEFAULT \ 2227cafeaa1SWarner Losh LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ 2237cafeaa1SWarner Losh LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ 2247cafeaa1SWarner Losh "./?.lua;" "./?/init.lua" 2257cafeaa1SWarner Losh #endif 2260495ed39SKyle Evans 2270495ed39SKyle Evans #if !defined(LUA_CPATH_DEFAULT) 2287cafeaa1SWarner Losh #define LUA_CPATH_DEFAULT \ 2297cafeaa1SWarner Losh LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" 2300495ed39SKyle Evans #endif 2310495ed39SKyle Evans 2327cafeaa1SWarner Losh #endif /* } */ 2337cafeaa1SWarner Losh 2347cafeaa1SWarner Losh 2357cafeaa1SWarner Losh /* 2367cafeaa1SWarner Losh @@ LUA_DIRSEP is the directory separator (for submodules). 2377cafeaa1SWarner Losh ** CHANGE it if your machine does not use "/" as the directory separator 2387cafeaa1SWarner Losh ** and is not Windows. (On Windows Lua automatically uses "\".) 2397cafeaa1SWarner Losh */ 2400495ed39SKyle Evans #if !defined(LUA_DIRSEP) 2410495ed39SKyle Evans 2427cafeaa1SWarner Losh #if defined(_WIN32) 2437cafeaa1SWarner Losh #define LUA_DIRSEP "\\" 2447cafeaa1SWarner Losh #else 2457cafeaa1SWarner Losh #define LUA_DIRSEP "/" 2467cafeaa1SWarner Losh #endif 2477cafeaa1SWarner Losh 2480495ed39SKyle Evans #endif 2490495ed39SKyle Evans 2507cafeaa1SWarner Losh /* }================================================================== */ 2517cafeaa1SWarner Losh 2527cafeaa1SWarner Losh 2537cafeaa1SWarner Losh /* 2547cafeaa1SWarner Losh ** {================================================================== 2557cafeaa1SWarner Losh ** Marks for exported symbols in the C code 2567cafeaa1SWarner Losh ** =================================================================== 2577cafeaa1SWarner Losh */ 2587cafeaa1SWarner Losh 2597cafeaa1SWarner Losh /* 2607cafeaa1SWarner Losh @@ LUA_API is a mark for all core API functions. 2617cafeaa1SWarner Losh @@ LUALIB_API is a mark for all auxiliary library functions. 2627cafeaa1SWarner Losh @@ LUAMOD_API is a mark for all standard library opening functions. 2637cafeaa1SWarner Losh ** CHANGE them if you need to define those functions in some special way. 2647cafeaa1SWarner Losh ** For instance, if you want to create one Windows DLL with the core and 2657cafeaa1SWarner Losh ** the libraries, you may want to use the following definition (define 2667cafeaa1SWarner Losh ** LUA_BUILD_AS_DLL to get it). 2677cafeaa1SWarner Losh */ 2687cafeaa1SWarner Losh #if defined(LUA_BUILD_AS_DLL) /* { */ 2697cafeaa1SWarner Losh 2707cafeaa1SWarner Losh #if defined(LUA_CORE) || defined(LUA_LIB) /* { */ 2717cafeaa1SWarner Losh #define LUA_API __declspec(dllexport) 2727cafeaa1SWarner Losh #else /* }{ */ 2737cafeaa1SWarner Losh #define LUA_API __declspec(dllimport) 2747cafeaa1SWarner Losh #endif /* } */ 2757cafeaa1SWarner Losh 2767cafeaa1SWarner Losh #else /* }{ */ 2777cafeaa1SWarner Losh 2787cafeaa1SWarner Losh #define LUA_API extern 2797cafeaa1SWarner Losh 2807cafeaa1SWarner Losh #endif /* } */ 2817cafeaa1SWarner Losh 2827cafeaa1SWarner Losh 2830495ed39SKyle Evans /* 2840495ed39SKyle Evans ** More often than not the libs go together with the core. 2850495ed39SKyle Evans */ 2867cafeaa1SWarner Losh #define LUALIB_API LUA_API 2870495ed39SKyle Evans #define LUAMOD_API LUA_API 2887cafeaa1SWarner Losh 2897cafeaa1SWarner Losh 2907cafeaa1SWarner Losh /* 2917cafeaa1SWarner Losh @@ LUAI_FUNC is a mark for all extern functions that are not to be 2927cafeaa1SWarner Losh ** exported to outside modules. 2930495ed39SKyle Evans @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, 2940495ed39SKyle Evans ** none of which to be exported to outside modules (LUAI_DDEF for 2957cafeaa1SWarner Losh ** definitions and LUAI_DDEC for declarations). 2967cafeaa1SWarner Losh ** CHANGE them if you need to mark them in some special way. Elf/gcc 2977cafeaa1SWarner Losh ** (versions 3.2 and later) mark them as "hidden" to optimize access 2987cafeaa1SWarner Losh ** when Lua is compiled as a shared library. Not all elf targets support 2997cafeaa1SWarner Losh ** this attribute. Unfortunately, gcc does not offer a way to check 3007cafeaa1SWarner Losh ** whether the target offers that support, and those without support 3017cafeaa1SWarner Losh ** give a warning about it. To avoid these warnings, change to the 3027cafeaa1SWarner Losh ** default definition. 3037cafeaa1SWarner Losh */ 3047cafeaa1SWarner Losh #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ 3057cafeaa1SWarner Losh defined(__ELF__) /* { */ 3060495ed39SKyle Evans #define LUAI_FUNC __attribute__((visibility("internal"))) extern 3077cafeaa1SWarner Losh #else /* }{ */ 3087cafeaa1SWarner Losh #define LUAI_FUNC extern 3097cafeaa1SWarner Losh #endif /* } */ 3107cafeaa1SWarner Losh 3110495ed39SKyle Evans #define LUAI_DDEC(dec) LUAI_FUNC dec 3127cafeaa1SWarner Losh #define LUAI_DDEF /* empty */ 3137cafeaa1SWarner Losh 3147cafeaa1SWarner Losh /* }================================================================== */ 3157cafeaa1SWarner Losh 3167cafeaa1SWarner Losh 3177cafeaa1SWarner Losh /* 3187cafeaa1SWarner Losh ** {================================================================== 3197cafeaa1SWarner Losh ** Compatibility with previous versions 3207cafeaa1SWarner Losh ** =================================================================== 3217cafeaa1SWarner Losh */ 3227cafeaa1SWarner Losh 3237cafeaa1SWarner Losh /* 3240495ed39SKyle Evans @@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. 3257cafeaa1SWarner Losh ** You can define it to get all options, or change specific options 3267cafeaa1SWarner Losh ** to fit your specific needs. 3277cafeaa1SWarner Losh */ 3280495ed39SKyle Evans #if defined(LUA_COMPAT_5_3) /* { */ 3297cafeaa1SWarner Losh 3307cafeaa1SWarner Losh /* 3317cafeaa1SWarner Losh @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated 3327cafeaa1SWarner Losh ** functions in the mathematical library. 3330495ed39SKyle Evans ** (These functions were already officially removed in 5.3; 3340495ed39SKyle Evans ** nevertheless they are still available here.) 3357cafeaa1SWarner Losh */ 3367cafeaa1SWarner Losh #define LUA_COMPAT_MATHLIB 3377cafeaa1SWarner Losh 3387cafeaa1SWarner Losh /* 3397cafeaa1SWarner Losh @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for 3407cafeaa1SWarner Losh ** manipulating other integer types (lua_pushunsigned, lua_tounsigned, 3417cafeaa1SWarner Losh ** luaL_checkint, luaL_checklong, etc.) 3420495ed39SKyle Evans ** (These macros were also officially removed in 5.3, but they are still 3430495ed39SKyle Evans ** available here.) 3447cafeaa1SWarner Losh */ 3457cafeaa1SWarner Losh #define LUA_COMPAT_APIINTCASTS 3467cafeaa1SWarner Losh 3477cafeaa1SWarner Losh 3487cafeaa1SWarner Losh /* 3490495ed39SKyle Evans @@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod 3500495ed39SKyle Evans ** using '__lt'. 3517cafeaa1SWarner Losh */ 3520495ed39SKyle Evans #define LUA_COMPAT_LT_LE 3537cafeaa1SWarner Losh 3547cafeaa1SWarner Losh 3557cafeaa1SWarner Losh /* 3567cafeaa1SWarner Losh @@ The following macros supply trivial compatibility for some 3577cafeaa1SWarner Losh ** changes in the API. The macros themselves document how to 3587cafeaa1SWarner Losh ** change your code to avoid using them. 3590495ed39SKyle Evans ** (Once more, these macros were officially removed in 5.3, but they are 3600495ed39SKyle Evans ** still available here.) 3617cafeaa1SWarner Losh */ 3627cafeaa1SWarner Losh #define lua_strlen(L,i) lua_rawlen(L, (i)) 3637cafeaa1SWarner Losh 3647cafeaa1SWarner Losh #define lua_objlen(L,i) lua_rawlen(L, (i)) 3657cafeaa1SWarner Losh 3667cafeaa1SWarner Losh #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) 3677cafeaa1SWarner Losh #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) 3687cafeaa1SWarner Losh 3697cafeaa1SWarner Losh #endif /* } */ 3707cafeaa1SWarner Losh 3717cafeaa1SWarner Losh /* }================================================================== */ 3727cafeaa1SWarner Losh 3737cafeaa1SWarner Losh 3747cafeaa1SWarner Losh 3757cafeaa1SWarner Losh /* 3767cafeaa1SWarner Losh ** {================================================================== 3777cafeaa1SWarner Losh ** Configuration for Numbers. 3787cafeaa1SWarner Losh ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* 3797cafeaa1SWarner Losh ** satisfy your needs. 3807cafeaa1SWarner Losh ** =================================================================== 3817cafeaa1SWarner Losh */ 3827cafeaa1SWarner Losh 3837cafeaa1SWarner Losh /* 3847cafeaa1SWarner Losh @@ LUA_NUMBER is the floating-point type used by Lua. 3857cafeaa1SWarner Losh @@ LUAI_UACNUMBER is the result of a 'default argument promotion' 3867cafeaa1SWarner Losh @@ over a floating number. 3870495ed39SKyle Evans @@ l_floatatt(x) corrects float attribute 'x' to the proper float type 3887cafeaa1SWarner Losh ** by prefixing it with one of FLT/DBL/LDBL. 3897cafeaa1SWarner Losh @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. 3907cafeaa1SWarner Losh @@ LUA_NUMBER_FMT is the format for writing floats. 3917cafeaa1SWarner Losh @@ lua_number2str converts a float to a string. 3927cafeaa1SWarner Losh @@ l_mathop allows the addition of an 'l' or 'f' to all math operations. 3937cafeaa1SWarner Losh @@ l_floor takes the floor of a float. 3940495ed39SKyle Evans @@ lua_str2number converts a decimal numeral to a number. 3957cafeaa1SWarner Losh */ 3967cafeaa1SWarner Losh 3977cafeaa1SWarner Losh 3987cafeaa1SWarner Losh /* The following definitions are good for most cases here */ 3997cafeaa1SWarner Losh 4007cafeaa1SWarner Losh #define l_floor(x) (l_mathop(floor)(x)) 4017cafeaa1SWarner Losh 4027cafeaa1SWarner Losh #define lua_number2str(s,sz,n) \ 4037cafeaa1SWarner Losh l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) 4047cafeaa1SWarner Losh 4057cafeaa1SWarner Losh /* 4060495ed39SKyle Evans @@ lua_numbertointeger converts a float number with an integral value 4070495ed39SKyle Evans ** to an integer, or returns 0 if float is not within the range of 4080495ed39SKyle Evans ** a lua_Integer. (The range comparisons are tricky because of 4090495ed39SKyle Evans ** rounding. The tests here assume a two-complement representation, 4100495ed39SKyle Evans ** where MININTEGER always has an exact representation as a float; 4110495ed39SKyle Evans ** MAXINTEGER may not have one, and therefore its conversion to float 4120495ed39SKyle Evans ** may have an ill-defined value.) 4137cafeaa1SWarner Losh */ 4147cafeaa1SWarner Losh #define lua_numbertointeger(n,p) \ 415eddbdee8SWarner Losh (*(p) = (LUA_INTEGER)(n), 1) 4167cafeaa1SWarner Losh 4177cafeaa1SWarner Losh 4187cafeaa1SWarner Losh /* now the variable definitions */ 4197cafeaa1SWarner Losh 4207cafeaa1SWarner Losh #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ 4217cafeaa1SWarner Losh 4227cafeaa1SWarner Losh #define LUA_NUMBER float 4237cafeaa1SWarner Losh 4240495ed39SKyle Evans #define l_floatatt(n) (FLT_##n) 4257cafeaa1SWarner Losh 4267cafeaa1SWarner Losh #define LUAI_UACNUMBER double 4277cafeaa1SWarner Losh 4287cafeaa1SWarner Losh #define LUA_NUMBER_FRMLEN "" 4297cafeaa1SWarner Losh #define LUA_NUMBER_FMT "%.7g" 4307cafeaa1SWarner Losh 4317cafeaa1SWarner Losh #define l_mathop(op) op##f 4327cafeaa1SWarner Losh 4337cafeaa1SWarner Losh #define lua_str2number(s,p) strtof((s), (p)) 4347cafeaa1SWarner Losh 435*ec965063SEd Maste 4367cafeaa1SWarner Losh #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ 4377cafeaa1SWarner Losh 4387cafeaa1SWarner Losh #define LUA_NUMBER long double 4397cafeaa1SWarner Losh 4400495ed39SKyle Evans #define l_floatatt(n) (LDBL_##n) 4417cafeaa1SWarner Losh 4427cafeaa1SWarner Losh #define LUAI_UACNUMBER long double 4437cafeaa1SWarner Losh 4447cafeaa1SWarner Losh #define LUA_NUMBER_FRMLEN "L" 4457cafeaa1SWarner Losh #define LUA_NUMBER_FMT "%.19Lg" 4467cafeaa1SWarner Losh 4477cafeaa1SWarner Losh #define l_mathop(op) op##l 4487cafeaa1SWarner Losh 4497cafeaa1SWarner Losh #define lua_str2number(s,p) strtold((s), (p)) 4507cafeaa1SWarner Losh 4517cafeaa1SWarner Losh #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ 4527cafeaa1SWarner Losh 4537cafeaa1SWarner Losh #define LUA_NUMBER double 4547cafeaa1SWarner Losh 4550495ed39SKyle Evans #define l_floatatt(n) (DBL_##n) 4567cafeaa1SWarner Losh 4577cafeaa1SWarner Losh #define LUAI_UACNUMBER double 4587cafeaa1SWarner Losh 4597cafeaa1SWarner Losh #define LUA_NUMBER_FRMLEN "" 4607cafeaa1SWarner Losh #define LUA_NUMBER_FMT "%.14g" 4617cafeaa1SWarner Losh 4627cafeaa1SWarner Losh #define l_mathop(op) op 4637cafeaa1SWarner Losh 4647cafeaa1SWarner Losh #define lua_str2number(s,p) strtod((s), (p)) 4657cafeaa1SWarner Losh 4667cafeaa1SWarner Losh #elif LUA_FLOAT_TYPE == LUA_FLOAT_INT64 /* }{ int64 */ 4677cafeaa1SWarner Losh 4687cafeaa1SWarner Losh #include "lstd.h" 4697cafeaa1SWarner Losh 4707cafeaa1SWarner Losh #include <machine/_inttypes.h> 4717cafeaa1SWarner Losh 4727cafeaa1SWarner Losh #define panic lua_panic 4737cafeaa1SWarner Losh /* Hack to use int64 as the LUA_NUMBER from ZFS code, kinda */ 4747cafeaa1SWarner Losh 4757cafeaa1SWarner Losh #define LUA_NUMBER int64_t 4767cafeaa1SWarner Losh 4777cafeaa1SWarner Losh #define l_mathlim(n) (LUA_FLOAT_INT_HACK_##n) 4787cafeaa1SWarner Losh #define LUA_FLOAT_INT_HACK_MANT_DIG 32 4797cafeaa1SWarner Losh #define LUA_FLOAT_INT_HACK_MAX_10_EXP 32 4807cafeaa1SWarner Losh 4817cafeaa1SWarner Losh #define LUAI_UACNUMBER int64_t 4827cafeaa1SWarner Losh 4837cafeaa1SWarner Losh #define LUA_NUMBER_FRMLEN "" 4847cafeaa1SWarner Losh #define LUA_NUMBER_FMT "%" PRId64 4857cafeaa1SWarner Losh 4867cafeaa1SWarner Losh #define l_mathop(x) (lstd_ ## x) 4877cafeaa1SWarner Losh 4887cafeaa1SWarner Losh #define lua_str2number(s,p) strtoll((s), (p), 0) 4897cafeaa1SWarner Losh 4907cafeaa1SWarner Losh #define lua_getlocaledecpoint() '.' 4917cafeaa1SWarner Losh 4927cafeaa1SWarner Losh #else /* }{ */ 4937cafeaa1SWarner Losh 4947cafeaa1SWarner Losh #error "numeric float type not defined" 4957cafeaa1SWarner Losh 4967cafeaa1SWarner Losh #endif /* } */ 4977cafeaa1SWarner Losh 4987cafeaa1SWarner Losh 4997cafeaa1SWarner Losh 5007cafeaa1SWarner Losh /* 5017cafeaa1SWarner Losh @@ LUA_INTEGER is the integer type used by Lua. 5027cafeaa1SWarner Losh ** 5037cafeaa1SWarner Losh @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. 5047cafeaa1SWarner Losh ** 5057cafeaa1SWarner Losh @@ LUAI_UACINT is the result of a 'default argument promotion' 5060495ed39SKyle Evans @@ over a LUA_INTEGER. 5077cafeaa1SWarner Losh @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. 5087cafeaa1SWarner Losh @@ LUA_INTEGER_FMT is the format for writing integers. 5097cafeaa1SWarner Losh @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. 5107cafeaa1SWarner Losh @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. 5110495ed39SKyle Evans @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. 5120495ed39SKyle Evans @@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED. 5137cafeaa1SWarner Losh @@ lua_integer2str converts an integer to a string. 5147cafeaa1SWarner Losh */ 5157cafeaa1SWarner Losh 5167cafeaa1SWarner Losh 5177cafeaa1SWarner Losh /* The following definitions are good for most cases here */ 5187cafeaa1SWarner Losh 5197cafeaa1SWarner Losh #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" 5207cafeaa1SWarner Losh 5217cafeaa1SWarner Losh #define LUAI_UACINT LUA_INTEGER 5227cafeaa1SWarner Losh 5237cafeaa1SWarner Losh #define lua_integer2str(s,sz,n) \ 5247cafeaa1SWarner Losh l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) 5257cafeaa1SWarner Losh 5267cafeaa1SWarner Losh /* 5277cafeaa1SWarner Losh ** use LUAI_UACINT here to avoid problems with promotions (which 5287cafeaa1SWarner Losh ** can turn a comparison between unsigneds into a signed comparison) 5297cafeaa1SWarner Losh */ 5307cafeaa1SWarner Losh #define LUA_UNSIGNED unsigned LUAI_UACINT 5317cafeaa1SWarner Losh 5327cafeaa1SWarner Losh 5330495ed39SKyle Evans #define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT) 5340495ed39SKyle Evans 5350495ed39SKyle Evans 5367cafeaa1SWarner Losh /* now the variable definitions */ 5377cafeaa1SWarner Losh 5387cafeaa1SWarner Losh #if LUA_INT_TYPE == LUA_INT_INT /* { int */ 5397cafeaa1SWarner Losh 5407cafeaa1SWarner Losh #define LUA_INTEGER int 5417cafeaa1SWarner Losh #define LUA_INTEGER_FRMLEN "" 5427cafeaa1SWarner Losh 5437cafeaa1SWarner Losh #define LUA_MAXINTEGER INT_MAX 5447cafeaa1SWarner Losh #define LUA_MININTEGER INT_MIN 5457cafeaa1SWarner Losh 5460495ed39SKyle Evans #define LUA_MAXUNSIGNED UINT_MAX 5470495ed39SKyle Evans 5487cafeaa1SWarner Losh #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ 5497cafeaa1SWarner Losh 5507cafeaa1SWarner Losh #define LUA_INTEGER long 5517cafeaa1SWarner Losh #define LUA_INTEGER_FRMLEN "l" 5527cafeaa1SWarner Losh 5537cafeaa1SWarner Losh #define LUA_MAXINTEGER LONG_MAX 5547cafeaa1SWarner Losh #define LUA_MININTEGER LONG_MIN 5557cafeaa1SWarner Losh 5560495ed39SKyle Evans #define LUA_MAXUNSIGNED ULONG_MAX 5570495ed39SKyle Evans 5587cafeaa1SWarner Losh #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ 5597cafeaa1SWarner Losh 5607cafeaa1SWarner Losh /* use presence of macro LLONG_MAX as proxy for C99 compliance */ 5617cafeaa1SWarner Losh #if defined(LLONG_MAX) /* { */ 5627cafeaa1SWarner Losh /* use ISO C99 stuff */ 5637cafeaa1SWarner Losh 5647cafeaa1SWarner Losh #define LUA_INTEGER long long 5657cafeaa1SWarner Losh #define LUA_INTEGER_FRMLEN "ll" 5667cafeaa1SWarner Losh 5677cafeaa1SWarner Losh #define LUA_MAXINTEGER LLONG_MAX 5687cafeaa1SWarner Losh #define LUA_MININTEGER LLONG_MIN 5697cafeaa1SWarner Losh 5700495ed39SKyle Evans #define LUA_MAXUNSIGNED ULLONG_MAX 5710495ed39SKyle Evans 5727cafeaa1SWarner Losh #elif defined(LUA_USE_WINDOWS) /* }{ */ 5737cafeaa1SWarner Losh /* in Windows, can use specific Windows types */ 5747cafeaa1SWarner Losh 5757cafeaa1SWarner Losh #define LUA_INTEGER __int64 5767cafeaa1SWarner Losh #define LUA_INTEGER_FRMLEN "I64" 5777cafeaa1SWarner Losh 5787cafeaa1SWarner Losh #define LUA_MAXINTEGER _I64_MAX 5797cafeaa1SWarner Losh #define LUA_MININTEGER _I64_MIN 5807cafeaa1SWarner Losh 5810495ed39SKyle Evans #define LUA_MAXUNSIGNED _UI64_MAX 5820495ed39SKyle Evans 5837cafeaa1SWarner Losh #else /* }{ */ 5847cafeaa1SWarner Losh 5857cafeaa1SWarner Losh #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ 5867cafeaa1SWarner Losh or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" 5877cafeaa1SWarner Losh 5887cafeaa1SWarner Losh #endif /* } */ 5897cafeaa1SWarner Losh 5907cafeaa1SWarner Losh #else /* }{ */ 5917cafeaa1SWarner Losh 5927cafeaa1SWarner Losh #error "numeric integer type not defined" 5937cafeaa1SWarner Losh 5947cafeaa1SWarner Losh #endif /* } */ 5957cafeaa1SWarner Losh 5967cafeaa1SWarner Losh /* }================================================================== */ 5977cafeaa1SWarner Losh 5987cafeaa1SWarner Losh 5997cafeaa1SWarner Losh /* 6007cafeaa1SWarner Losh ** {================================================================== 6017cafeaa1SWarner Losh ** Dependencies with C99 and other C details 6027cafeaa1SWarner Losh ** =================================================================== 6037cafeaa1SWarner Losh */ 6047cafeaa1SWarner Losh 6057cafeaa1SWarner Losh /* 6067cafeaa1SWarner Losh @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. 6077cafeaa1SWarner Losh ** (All uses in Lua have only one format item.) 6087cafeaa1SWarner Losh */ 6097cafeaa1SWarner Losh #if !defined(LUA_USE_C89) 6107cafeaa1SWarner Losh #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) 6117cafeaa1SWarner Losh #else 6127cafeaa1SWarner Losh #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) 6137cafeaa1SWarner Losh #endif 6147cafeaa1SWarner Losh 6157cafeaa1SWarner Losh 6167cafeaa1SWarner Losh /* 6170495ed39SKyle Evans @@ lua_strx2number converts a hexadecimal numeral to a number. 6187cafeaa1SWarner Losh ** In C99, 'strtod' does that conversion. Otherwise, you can 6197cafeaa1SWarner Losh ** leave 'lua_strx2number' undefined and Lua will provide its own 6207cafeaa1SWarner Losh ** implementation. 6217cafeaa1SWarner Losh */ 6227cafeaa1SWarner Losh #if !defined(LUA_USE_C89) 6237cafeaa1SWarner Losh #define lua_strx2number(s,p) lua_str2number(s,p) 6247cafeaa1SWarner Losh #endif 6257cafeaa1SWarner Losh 6267cafeaa1SWarner Losh 6277cafeaa1SWarner Losh /* 628e112e9d2SKyle Evans @@ lua_pointer2str converts a pointer to a readable string in a 629e112e9d2SKyle Evans ** non-specified way. 630e112e9d2SKyle Evans */ 631e112e9d2SKyle Evans #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) 632e112e9d2SKyle Evans 633e112e9d2SKyle Evans 634e112e9d2SKyle Evans /* 6350495ed39SKyle Evans @@ lua_number2strx converts a float to a hexadecimal numeral. 6367cafeaa1SWarner Losh ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. 6377cafeaa1SWarner Losh ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will 6387cafeaa1SWarner Losh ** provide its own implementation. 6397cafeaa1SWarner Losh */ 6407cafeaa1SWarner Losh #if !defined(LUA_USE_C89) 6417cafeaa1SWarner Losh #define lua_number2strx(L,b,sz,f,n) \ 6427cafeaa1SWarner Losh ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) 6437cafeaa1SWarner Losh #endif 6447cafeaa1SWarner Losh 6457cafeaa1SWarner Losh 6467cafeaa1SWarner Losh /* 6477cafeaa1SWarner Losh ** 'strtof' and 'opf' variants for math functions are not valid in 6487cafeaa1SWarner Losh ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the 6497cafeaa1SWarner Losh ** availability of these variants. ('math.h' is already included in 6507cafeaa1SWarner Losh ** all files that use these macros.) 6517cafeaa1SWarner Losh */ 6527cafeaa1SWarner Losh #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) 6537cafeaa1SWarner Losh #undef l_mathop /* variants not available */ 6547cafeaa1SWarner Losh #undef lua_str2number 6557cafeaa1SWarner Losh #define l_mathop(op) (lua_Number)op /* no variant */ 6567cafeaa1SWarner Losh #define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) 6577cafeaa1SWarner Losh #endif 6587cafeaa1SWarner Losh 6597cafeaa1SWarner Losh 6607cafeaa1SWarner Losh /* 6617cafeaa1SWarner Losh @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation 6627cafeaa1SWarner Losh ** functions. It must be a numerical type; Lua will use 'intptr_t' if 6637cafeaa1SWarner Losh ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to 6647cafeaa1SWarner Losh ** 'intptr_t' in C89) 6657cafeaa1SWarner Losh */ 6667cafeaa1SWarner Losh #define LUA_KCONTEXT ptrdiff_t 6677cafeaa1SWarner Losh 6687cafeaa1SWarner Losh #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ 6697cafeaa1SWarner Losh __STDC_VERSION__ >= 199901L 6707cafeaa1SWarner Losh #include <stdint.h> 6717cafeaa1SWarner Losh #if defined(INTPTR_MAX) /* even in C99 this type is optional */ 6727cafeaa1SWarner Losh #undef LUA_KCONTEXT 6737cafeaa1SWarner Losh #define LUA_KCONTEXT intptr_t 6747cafeaa1SWarner Losh #endif 6757cafeaa1SWarner Losh #endif 6767cafeaa1SWarner Losh 6777cafeaa1SWarner Losh 6787cafeaa1SWarner Losh /* 6797cafeaa1SWarner Losh @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). 6807cafeaa1SWarner Losh ** Change that if you do not want to use C locales. (Code using this 6810495ed39SKyle Evans ** macro must include the header 'locale.h'.) 6827cafeaa1SWarner Losh */ 6837cafeaa1SWarner Losh #if !defined(lua_getlocaledecpoint) 6847cafeaa1SWarner Losh #define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) 6857cafeaa1SWarner Losh #endif 6867cafeaa1SWarner Losh 6877cafeaa1SWarner Losh /* }================================================================== */ 6887cafeaa1SWarner Losh 6897cafeaa1SWarner Losh 6907cafeaa1SWarner Losh /* 6917cafeaa1SWarner Losh ** {================================================================== 6927cafeaa1SWarner Losh ** Language Variations 6937cafeaa1SWarner Losh ** ===================================================================== 6947cafeaa1SWarner Losh */ 6957cafeaa1SWarner Losh 6967cafeaa1SWarner Losh /* 6977cafeaa1SWarner Losh @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some 6987cafeaa1SWarner Losh ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from 6997cafeaa1SWarner Losh ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic 7007cafeaa1SWarner Losh ** coercion from strings to numbers. 7017cafeaa1SWarner Losh */ 7027cafeaa1SWarner Losh /* #define LUA_NOCVTN2S */ 7037cafeaa1SWarner Losh /* #define LUA_NOCVTS2N */ 7047cafeaa1SWarner Losh 7057cafeaa1SWarner Losh 7067cafeaa1SWarner Losh /* 7077cafeaa1SWarner Losh @@ LUA_USE_APICHECK turns on several consistency checks on the C API. 7087cafeaa1SWarner Losh ** Define it as a help when debugging C code. 7097cafeaa1SWarner Losh */ 7107cafeaa1SWarner Losh #if defined(LUA_USE_APICHECK) 7117cafeaa1SWarner Losh #include <assert.h> 7127cafeaa1SWarner Losh #define luai_apicheck(l,e) assert(e) 7137cafeaa1SWarner Losh #endif 7147cafeaa1SWarner Losh 7157cafeaa1SWarner Losh /* }================================================================== */ 7167cafeaa1SWarner Losh 7177cafeaa1SWarner Losh 7187cafeaa1SWarner Losh /* 7197cafeaa1SWarner Losh ** {================================================================== 7207cafeaa1SWarner Losh ** Macros that affect the API and must be stable (that is, must be the 7217cafeaa1SWarner Losh ** same when you compile Lua and when you compile code that links to 7220495ed39SKyle Evans ** Lua). 7237cafeaa1SWarner Losh ** ===================================================================== 7247cafeaa1SWarner Losh */ 7257cafeaa1SWarner Losh 7267cafeaa1SWarner Losh /* 7277cafeaa1SWarner Losh @@ LUAI_MAXSTACK limits the size of the Lua stack. 7287cafeaa1SWarner Losh ** CHANGE it if you need a different limit. This limit is arbitrary; 7297cafeaa1SWarner Losh ** its only purpose is to stop Lua from consuming unlimited stack 7307cafeaa1SWarner Losh ** space (and to reserve some numbers for pseudo-indices). 7310495ed39SKyle Evans ** (It must fit into max(size_t)/32.) 7327cafeaa1SWarner Losh */ 7330495ed39SKyle Evans #if LUAI_IS32INT 7347cafeaa1SWarner Losh #define LUAI_MAXSTACK 1000000 7357cafeaa1SWarner Losh #else 7367cafeaa1SWarner Losh #define LUAI_MAXSTACK 15000 7377cafeaa1SWarner Losh #endif 7387cafeaa1SWarner Losh 7397cafeaa1SWarner Losh 7407cafeaa1SWarner Losh /* 7417cafeaa1SWarner Losh @@ LUA_EXTRASPACE defines the size of a raw memory area associated with 7427cafeaa1SWarner Losh ** a Lua state with very fast access. 7437cafeaa1SWarner Losh ** CHANGE it if you need a different size. 7447cafeaa1SWarner Losh */ 7457cafeaa1SWarner Losh #define LUA_EXTRASPACE (sizeof(void *)) 7467cafeaa1SWarner Losh 7477cafeaa1SWarner Losh 7487cafeaa1SWarner Losh /* 7497cafeaa1SWarner Losh @@ LUA_IDSIZE gives the maximum size for the description of the source 7507cafeaa1SWarner Losh @@ of a function in debug information. 7517cafeaa1SWarner Losh ** CHANGE it if you want a different size. 7527cafeaa1SWarner Losh */ 7537cafeaa1SWarner Losh #define LUA_IDSIZE 60 7547cafeaa1SWarner Losh 7557cafeaa1SWarner Losh 7567cafeaa1SWarner Losh /* 7577cafeaa1SWarner Losh @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 7587cafeaa1SWarner Losh */ 759bf471326SKyle Evans #define LUAL_BUFFERSIZE 128 7607cafeaa1SWarner Losh 7617cafeaa1SWarner Losh 7627cafeaa1SWarner Losh /* 7630495ed39SKyle Evans @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure 7640495ed39SKyle Evans ** maximum alignment for the other items in that union. 7657cafeaa1SWarner Losh */ 7660495ed39SKyle Evans #define LUAI_MAXALIGN lua_Number n; void *s; lua_Integer i; long l 7670495ed39SKyle Evans 7680495ed39SKyle Evans /* }================================================================== */ 7690495ed39SKyle Evans 7707cafeaa1SWarner Losh 7717cafeaa1SWarner Losh 7727cafeaa1SWarner Losh 7737cafeaa1SWarner Losh 7747cafeaa1SWarner Losh /* =================================================================== */ 7757cafeaa1SWarner Losh 7767cafeaa1SWarner Losh /* 7777cafeaa1SWarner Losh ** Local configuration. You can use this space to add your redefinitions 7787cafeaa1SWarner Losh ** without modifying the main part of the file. 7797cafeaa1SWarner Losh */ 7807cafeaa1SWarner Losh 7817cafeaa1SWarner Losh 7827cafeaa1SWarner Losh 7837cafeaa1SWarner Losh 7847cafeaa1SWarner Losh 7857cafeaa1SWarner Losh #endif 786*ec965063SEd Maste 787