50 #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
51 #define LUA_USE_WINDOWS
55 #if defined(LUA_USE_WINDOWS)
61 #if defined(LUA_USE_LINUX)
63 #define LUA_USE_DLOPEN
64 #define LUA_USE_READLINE
68 #if defined(LUA_USE_MACOSX)
70 #define LUA_USE_DLOPEN
71 #define LUA_USE_READLINE
80 #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
81 #define LUA_C89_NUMBERS
90 #if ((INT_MAX >> 15) >> 15) >= 1
91 #define LUAI_BITSINT 32
94 #define LUAI_BITSINT 16
109 #define LUA_INT_INT 1
110 #define LUA_INT_LONG 2
111 #define LUA_INT_LONGLONG 3
114 #define LUA_FLOAT_FLOAT 1
115 #define LUA_FLOAT_DOUBLE 2
116 #define LUA_FLOAT_LONGDOUBLE 3
118 #if defined(LUA_32BITS)
122 #if LUAI_BITSINT >= 32
123 #define LUA_INT_TYPE LUA_INT_INT
125 #define LUA_INT_TYPE LUA_INT_LONG
127 #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
129 #elif defined(LUA_C89_NUMBERS)
133 #define LUA_INT_TYPE LUA_INT_LONG
134 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
142 #if !defined(LUA_INT_TYPE)
143 #define LUA_INT_TYPE LUA_INT_LONGLONG
146 #if !defined(LUA_FLOAT_TYPE)
147 #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
168 #define LUA_PATH_SEP ";"
169 #define LUA_PATH_MARK "?"
170 #define LUA_EXEC_DIR "!"
182 #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
188 #define LUA_LDIR "!\\lua\\"
189 #define LUA_CDIR "!\\"
190 #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
191 #define LUA_PATH_DEFAULT \
192 LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
193 LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
194 LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
195 ".\\?.lua;" ".\\?\\init.lua"
196 #define LUA_CPATH_DEFAULT \
198 LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
199 LUA_CDIR"loadall.dll;" ".\\?.dll"
203 #define LUA_ROOT "/usr/local/"
204 #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
205 #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
206 #define LUA_PATH_DEFAULT \
207 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
208 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
209 "./?.lua;" "./?/init.lua"
210 #define LUA_CPATH_DEFAULT \
211 LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
221 #define LUA_DIRSEP "\\"
223 #define LUA_DIRSEP "/"
244 #if defined(LUA_BUILD_AS_DLL)
246 #if defined(LUA_CORE) || defined(LUA_LIB)
247 #define LUA_API __declspec(dllexport)
249 #define LUA_API __declspec(dllimport)
254 #define LUA_API extern
260 #define LUALIB_API LUA_API
261 #define LUAMOD_API LUALIB_API
278 #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
280 #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
282 #define LUAI_FUNC extern
285 #define LUAI_DDEC LUAI_FUNC
303 #if defined(LUA_COMPAT_5_2)
309 #define LUA_COMPAT_MATHLIB
314 #define LUA_COMPAT_BITLIB
319 #define LUA_COMPAT_IPAIRS
326 #define LUA_COMPAT_APIINTCASTS
331 #if defined(LUA_COMPAT_5_1)
334 #define LUA_COMPAT_MATHLIB
335 #define LUA_COMPAT_APIINTCASTS
341 #define LUA_COMPAT_UNPACK
347 #define LUA_COMPAT_LOADERS
353 #define lua_cpcall(L,f,u) \
354 (lua_pushcfunction(L, (f)), \
355 lua_pushlightuserdata(L,(u)), \
363 #define LUA_COMPAT_LOG10
369 #define LUA_COMPAT_LOADSTRING
374 #define LUA_COMPAT_MAXN
381 #define lua_strlen(L,i) lua_rawlen(L, (i))
383 #define lua_objlen(L,i) lua_rawlen(L, (i))
385 #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
386 #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
392 #define LUA_COMPAT_MODULE
434 #define l_floor(x) (l_mathop(floor)(x))
436 #define lua_number2str(s,sz,n) \
437 l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
447 #define lua_numbertointeger(n,p) \
448 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
449 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
450 (*(p) = (LUA_INTEGER)(n), 1))
455 #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT
457 #define LUA_NUMBER float
459 #define l_mathlim(n) (FLT_##n)
461 #define LUAI_UACNUMBER double
463 #define LUA_NUMBER_FRMLEN ""
464 #define LUA_NUMBER_FMT "%.7g"
466 #define l_mathop(op) op##f
468 #define lua_str2number(s,p) strtof((s), (p))
471 #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
473 #define LUA_NUMBER long double
475 #define l_mathlim(n) (LDBL_##n)
477 #define LUAI_UACNUMBER long double
479 #define LUA_NUMBER_FRMLEN "L"
480 #define LUA_NUMBER_FMT "%.19Lg"
482 #define l_mathop(op) op##l
484 #define lua_str2number(s,p) strtold((s), (p))
486 #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE
488 #define LUA_NUMBER double
490 #define l_mathlim(n) (DBL_##n)
492 #define LUAI_UACNUMBER double
494 #define LUA_NUMBER_FRMLEN ""
495 #define LUA_NUMBER_FMT "%.14g"
497 #define l_mathop(op) op
499 #define lua_str2number(s,p) strtod((s), (p))
503 #error "numeric float type not defined"
526 #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d"
528 #define LUAI_UACINT LUA_INTEGER
530 #define lua_integer2str(s,sz,n) \
531 l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
537 #define LUA_UNSIGNED unsigned LUAI_UACINT
542 #if LUA_INT_TYPE == LUA_INT_INT
544 #define LUA_INTEGER int
545 #define LUA_INTEGER_FRMLEN ""
547 #define LUA_MAXINTEGER INT_MAX
548 #define LUA_MININTEGER INT_MIN
550 #elif LUA_INT_TYPE == LUA_INT_LONG
552 #define LUA_INTEGER long
553 #define LUA_INTEGER_FRMLEN "l"
555 #define LUA_MAXINTEGER LONG_MAX
556 #define LUA_MININTEGER LONG_MIN
558 #elif LUA_INT_TYPE == LUA_INT_LONGLONG
561 #if defined(LLONG_MAX)
564 #define LUA_INTEGER long long
565 #define LUA_INTEGER_FRMLEN "ll"
567 #define LUA_MAXINTEGER LLONG_MAX
568 #define LUA_MININTEGER LLONG_MIN
570 #elif defined(LUA_USE_WINDOWS)
573 #define LUA_INTEGER __int64
574 #define LUA_INTEGER_FRMLEN "I64"
576 #define LUA_MAXINTEGER _I64_MAX
577 #define LUA_MININTEGER _I64_MIN
581 #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
582 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
588 #error "numeric integer type not defined"
605 #if !defined(LUA_USE_C89)
606 #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
608 #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
618 #if !defined(LUA_USE_C89)
619 #define lua_strx2number(s,p) lua_str2number(s,p)
627 #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p)
636 #if !defined(LUA_USE_C89)
637 #define lua_number2strx(L,b,sz,f,n) \
638 ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
648 #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
650 #undef lua_str2number
651 #define l_mathop(op) (lua_Number)op
652 #define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
662 #define LUA_KCONTEXT ptrdiff_t
664 #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
665 __STDC_VERSION__ >= 199901L
667 #if defined(INTPTR_MAX)
669 #define LUA_KCONTEXT intptr_t
679 #if !defined(lua_getlocaledecpoint)
680 #define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
706 #if defined(LUA_USE_APICHECK)
708 #define luai_apicheck(l,e) assert(e)
728 #if LUAI_BITSINT >= 32
729 #define LUAI_MAXSTACK 1000000
731 #define LUAI_MAXSTACK 15000
740 #define LUA_EXTRASPACE (sizeof(void *))
748 #define LUA_IDSIZE 60
758 #if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
759 #define LUAL_BUFFERSIZE 8192
761 #define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
772 #define LUA_QL(x) "'" x "'"
773 #define LUA_QS LUA_QL("%s")