luaconf.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /*
  2. ** $Id: luaconf.h $
  3. ** Configuration file for Lua
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef luaconf_h
  7. #define luaconf_h
  8. #include <limits.h>
  9. #include <stddef.h>
  10. /*
  11. ** ===================================================================
  12. ** General Configuration File for Lua
  13. **
  14. ** Some definitions here can be changed externally, through the compiler
  15. ** (e.g., with '-D' options): They are commented out or protected
  16. ** by '#if !defined' guards. However, several other definitions
  17. ** should be changed directly here, either because they affect the
  18. ** Lua ABI (by making the changes here, you ensure that all software
  19. ** connected to Lua, such as C libraries, will be compiled with the same
  20. ** configuration); or because they are seldom changed.
  21. **
  22. ** Search for "@@" to find all configurable definitions.
  23. ** ===================================================================
  24. */
  25. /*
  26. ** {====================================================================
  27. ** System Configuration: macros to adapt (if needed) Lua to some
  28. ** particular platform, for instance restricting it to C89.
  29. ** =====================================================================
  30. */
  31. /*
  32. @@ LUA_USE_C89 controls the use of non-ISO-C89 features.
  33. ** Define it if you want Lua to avoid the use of a few C99 features
  34. ** or Windows-specific features on Windows.
  35. */
  36. /* #define LUA_USE_C89 */
  37. /*
  38. ** By default, Lua on Windows use (some) specific Windows features
  39. */
  40. #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
  41. #define LUA_USE_WINDOWS /* enable goodies for regular Windows */
  42. #endif
  43. #if defined(LUA_USE_WINDOWS)
  44. #define LUA_DL_DLL /* enable support for DLL */
  45. #define LUA_USE_C89 /* broadly, Windows is C89 */
  46. #endif
  47. /*
  48. ** When POSIX DLL ('LUA_USE_DLOPEN') is enabled, the Lua stand-alone
  49. ** application will try to dynamically link a 'readline' facility
  50. ** for its REPL. In that case, LUA_READLINELIB is the name of the
  51. ** library it will look for those facilities. If lua.c cannot open
  52. ** the specified library, it will generate a warning and then run
  53. ** without 'readline'. If that macro is not defined, lua.c will not
  54. ** use 'readline'.
  55. */
  56. #if defined(LUA_USE_LINUX)
  57. #define LUA_USE_POSIX
  58. #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
  59. #define LUA_READLINELIB "libreadline.so"
  60. #endif
  61. #if defined(LUA_USE_MACOSX)
  62. #define LUA_USE_POSIX
  63. #define LUA_USE_DLOPEN /* macOS does not need -ldl */
  64. #define LUA_READLINELIB "libedit.dylib"
  65. #endif
  66. #if defined(LUA_USE_IOS)
  67. #define LUA_USE_POSIX
  68. #define LUA_USE_DLOPEN
  69. #endif
  70. #if defined(LUA_USE_C89) && defined(LUA_USE_POSIX)
  71. #error "POSIX is not compatible with C89"
  72. #endif
  73. /*
  74. @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
  75. */
  76. #define LUAI_IS32INT ((UINT_MAX >> 30) >= 3)
  77. /* }================================================================== */
  78. /*
  79. ** {==================================================================
  80. ** Configuration for Number types. These options should not be
  81. ** set externally, because any other code connected to Lua must
  82. ** use the same configuration.
  83. ** ===================================================================
  84. */
  85. /*
  86. @@ LUA_INT_TYPE defines the type for Lua integers.
  87. @@ LUA_FLOAT_TYPE defines the type for Lua floats.
  88. ** Lua should work fine with any mix of these options supported
  89. ** by your C compiler. The usual configurations are 64-bit integers
  90. ** and 'double' (the default), 32-bit integers and 'float' (for
  91. ** restricted platforms), and 'long'/'double' (for C compilers not
  92. ** compliant with C99, which may not have support for 'long long').
  93. */
  94. /* predefined options for LUA_INT_TYPE */
  95. #define LUA_INT_INT 1
  96. #define LUA_INT_LONG 2
  97. #define LUA_INT_LONGLONG 3
  98. /* predefined options for LUA_FLOAT_TYPE */
  99. #define LUA_FLOAT_FLOAT 1
  100. #define LUA_FLOAT_DOUBLE 2
  101. #define LUA_FLOAT_LONGDOUBLE 3
  102. /* Default configuration ('long long' and 'double', for 64-bit Lua) */
  103. #define LUA_INT_DEFAULT LUA_INT_LONGLONG
  104. #define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE
  105. /*
  106. @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
  107. */
  108. /* #define LUA_32BITS */
  109. /*
  110. @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
  111. ** C89 ('long' and 'double'); Windows always has '__int64', so it does
  112. ** not need to use this case.
  113. */
  114. #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
  115. #define LUA_C89_NUMBERS 1
  116. #else
  117. #define LUA_C89_NUMBERS 0
  118. #endif
  119. #if defined(LUA_32BITS) /* { */
  120. /*
  121. ** 32-bit integers and 'float'
  122. */
  123. #if LUAI_IS32INT /* use 'int' if big enough */
  124. #define LUA_INT_TYPE LUA_INT_INT
  125. #else /* otherwise use 'long' */
  126. #define LUA_INT_TYPE LUA_INT_LONG
  127. #endif
  128. #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
  129. #elif LUA_C89_NUMBERS /* }{ */
  130. /*
  131. ** largest types available for C89 ('long' and 'double')
  132. */
  133. #define LUA_INT_TYPE LUA_INT_LONG
  134. #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
  135. #else /* }{ */
  136. /* use defaults */
  137. #define LUA_INT_TYPE LUA_INT_DEFAULT
  138. #define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT
  139. #endif /* } */
  140. /* }================================================================== */
  141. /*
  142. ** {==================================================================
  143. ** Configuration for Paths.
  144. ** ===================================================================
  145. */
  146. /*
  147. ** LUA_PATH_SEP is the character that separates templates in a path.
  148. ** LUA_PATH_MARK is the string that marks the substitution points in a
  149. ** template.
  150. ** LUA_EXEC_DIR in a Windows path is replaced by the executable's
  151. ** directory.
  152. */
  153. #define LUA_PATH_SEP ";"
  154. #define LUA_PATH_MARK "?"
  155. #define LUA_EXEC_DIR "!"
  156. /*
  157. @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
  158. ** Lua libraries.
  159. @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
  160. ** C libraries.
  161. ** CHANGE them if your machine has a non-conventional directory
  162. ** hierarchy or if you want to install your libraries in
  163. ** non-conventional directories.
  164. */
  165. #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
  166. #if defined(_WIN32) /* { */
  167. /*
  168. ** In Windows, any exclamation mark ('!') in the path is replaced by the
  169. ** path of the directory of the executable file of the current process.
  170. */
  171. #define LUA_LDIR "!\\lua\\"
  172. #define LUA_CDIR "!\\"
  173. #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
  174. #if !defined(LUA_PATH_DEFAULT)
  175. #define LUA_PATH_DEFAULT \
  176. LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
  177. LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
  178. LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
  179. ".\\?.lua;" ".\\?\\init.lua"
  180. #endif
  181. #if !defined(LUA_CPATH_DEFAULT)
  182. #define LUA_CPATH_DEFAULT \
  183. LUA_CDIR"?.dll;" \
  184. LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
  185. LUA_CDIR"loadall.dll;" ".\\?.dll"
  186. #endif
  187. #else /* }{ */
  188. #define LUA_ROOT "/usr/local/"
  189. #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
  190. #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
  191. #if !defined(LUA_PATH_DEFAULT)
  192. #define LUA_PATH_DEFAULT \
  193. LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
  194. LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
  195. "./?.lua;" "./?/init.lua"
  196. #endif
  197. #if !defined(LUA_CPATH_DEFAULT)
  198. #define LUA_CPATH_DEFAULT \
  199. LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
  200. #endif
  201. #endif /* } */
  202. /*
  203. @@ LUA_DIRSEP is the directory separator (for submodules).
  204. ** CHANGE it if your machine does not use "/" as the directory separator
  205. ** and is not Windows. (On Windows Lua automatically uses "\".)
  206. */
  207. #if !defined(LUA_DIRSEP)
  208. #if defined(_WIN32)
  209. #define LUA_DIRSEP "\\"
  210. #else
  211. #define LUA_DIRSEP "/"
  212. #endif
  213. #endif
  214. /*
  215. ** LUA_IGMARK is a mark to ignore all after it when building the
  216. ** module name (e.g., used to build the luaopen_ function name).
  217. ** Typically, the suffix after the mark is the module version,
  218. ** as in "mod-v1.2.so".
  219. */
  220. #define LUA_IGMARK "-"
  221. /* }================================================================== */
  222. /*
  223. ** {==================================================================
  224. ** Marks for exported symbols in the C code
  225. ** ===================================================================
  226. */
  227. /*
  228. @@ LUA_API is a mark for all core API functions.
  229. @@ LUALIB_API is a mark for all auxiliary library functions.
  230. @@ LUAMOD_API is a mark for all standard library opening functions.
  231. ** CHANGE them if you need to define those functions in some special way.
  232. ** For instance, if you want to create one Windows DLL with the core and
  233. ** the libraries, you may want to use the following definition (define
  234. ** LUA_BUILD_AS_DLL to get it).
  235. */
  236. #if defined(LUA_BUILD_AS_DLL) /* { */
  237. #if defined(LUA_CORE) || defined(LUA_LIB) /* { */
  238. #define LUA_API __declspec(dllexport)
  239. #else /* }{ */
  240. #define LUA_API __declspec(dllimport)
  241. #endif /* } */
  242. #else /* }{ */
  243. #define LUA_API extern
  244. #endif /* } */
  245. /*
  246. ** More often than not the libs go together with the core.
  247. */
  248. #define LUALIB_API LUA_API
  249. #if defined(__cplusplus)
  250. /* Lua uses the "C name" when calling open functions */
  251. #define LUAMOD_API extern "C"
  252. #else
  253. #define LUAMOD_API LUA_API
  254. #endif
  255. /* }================================================================== */
  256. /*
  257. ** {==================================================================
  258. ** Compatibility with previous versions
  259. ** ===================================================================
  260. */
  261. /*
  262. @@ LUA_COMPAT_GLOBAL avoids 'global' being a reserved word
  263. */
  264. #define LUA_COMPAT_GLOBAL
  265. /*
  266. @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
  267. ** functions in the mathematical library.
  268. ** (These functions were already officially removed in 5.3;
  269. ** nevertheless they are still available here.)
  270. */
  271. /* #define LUA_COMPAT_MATHLIB */
  272. /*
  273. @@ The following macros supply trivial compatibility for some
  274. ** changes in the API. The macros themselves document how to
  275. ** change your code to avoid using them.
  276. ** (Once more, these macros were officially removed in 5.3, but they are
  277. ** still available here.)
  278. */
  279. #define lua_strlen(L,i) lua_rawlen(L, (i))
  280. #define lua_objlen(L,i) lua_rawlen(L, (i))
  281. #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
  282. #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
  283. /* }================================================================== */
  284. /*
  285. ** {==================================================================
  286. ** Configuration for Numbers (low-level part).
  287. ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
  288. ** satisfy your needs.
  289. ** ===================================================================
  290. */
  291. /*
  292. @@ LUAI_UACNUMBER is the result of a 'default argument promotion'
  293. @@ over a floating number.
  294. @@ l_floatatt(x) corrects float attribute 'x' to the proper float type
  295. ** by prefixing it with one of FLT/DBL/LDBL.
  296. @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
  297. @@ LUA_NUMBER_FMT is the format for writing floats with the maximum
  298. ** number of digits that respects tostring(tonumber(numeral)) == numeral.
  299. ** (That would be floor(log10(2^n)), where n is the number of bits in
  300. ** the float mantissa.)
  301. @@ LUA_NUMBER_FMT_N is the format for writing floats with the minimum
  302. ** number of digits that ensures tonumber(tostring(number)) == number.
  303. ** (That would be LUA_NUMBER_FMT+2.)
  304. @@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
  305. @@ l_floor takes the floor of a float.
  306. @@ lua_str2number converts a decimal numeral to a number.
  307. */
  308. /* The following definition is good for most cases here */
  309. #define l_floor(x) (l_mathop(floor)(x))
  310. /* now the variable definitions */
  311. #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */
  312. #define LUA_NUMBER float
  313. #define l_floatatt(n) (FLT_##n)
  314. #define LUAI_UACNUMBER double
  315. #define LUA_NUMBER_FRMLEN ""
  316. #define LUA_NUMBER_FMT "%.7g"
  317. #define LUA_NUMBER_FMT_N "%.9g"
  318. #define l_mathop(op) op##f
  319. #define lua_str2number(s,p) strtof((s), (p))
  320. #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */
  321. #define LUA_NUMBER long double
  322. #define l_floatatt(n) (LDBL_##n)
  323. #define LUAI_UACNUMBER long double
  324. #define LUA_NUMBER_FRMLEN "L"
  325. #define LUA_NUMBER_FMT "%.19Lg"
  326. #define LUA_NUMBER_FMT_N "%.21Lg"
  327. #define l_mathop(op) op##l
  328. #define lua_str2number(s,p) strtold((s), (p))
  329. #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */
  330. #define LUA_NUMBER double
  331. #define l_floatatt(n) (DBL_##n)
  332. #define LUAI_UACNUMBER double
  333. #define LUA_NUMBER_FRMLEN ""
  334. #define LUA_NUMBER_FMT "%.15g"
  335. #define LUA_NUMBER_FMT_N "%.17g"
  336. #define l_mathop(op) op
  337. #define lua_str2number(s,p) strtod((s), (p))
  338. #else /* }{ */
  339. #error "numeric float type not defined"
  340. #endif /* } */
  341. /*
  342. @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
  343. @@ LUAI_UACINT is the result of a 'default argument promotion'
  344. @@ over a LUA_INTEGER.
  345. @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
  346. @@ LUA_INTEGER_FMT is the format for writing integers.
  347. @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
  348. @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
  349. @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED.
  350. @@ lua_integer2str converts an integer to a string.
  351. */
  352. /* The following definitions are good for most cases here */
  353. #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d"
  354. #define LUAI_UACINT LUA_INTEGER
  355. #define lua_integer2str(s,sz,n) \
  356. l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
  357. /*
  358. ** use LUAI_UACINT here to avoid problems with promotions (which
  359. ** can turn a comparison between unsigneds into a signed comparison)
  360. */
  361. #define LUA_UNSIGNED unsigned LUAI_UACINT
  362. /* now the variable definitions */
  363. #if LUA_INT_TYPE == LUA_INT_INT /* { int */
  364. #define LUA_INTEGER int
  365. #define LUA_INTEGER_FRMLEN ""
  366. #define LUA_MAXINTEGER INT_MAX
  367. #define LUA_MININTEGER INT_MIN
  368. #define LUA_MAXUNSIGNED UINT_MAX
  369. #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
  370. #define LUA_INTEGER long
  371. #define LUA_INTEGER_FRMLEN "l"
  372. #define LUA_MAXINTEGER LONG_MAX
  373. #define LUA_MININTEGER LONG_MIN
  374. #define LUA_MAXUNSIGNED ULONG_MAX
  375. #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
  376. /* use presence of macro LLONG_MAX as proxy for C99 compliance */
  377. #if defined(LLONG_MAX) /* { */
  378. /* use ISO C99 stuff */
  379. #define LUA_INTEGER long long
  380. #define LUA_INTEGER_FRMLEN "ll"
  381. #define LUA_MAXINTEGER LLONG_MAX
  382. #define LUA_MININTEGER LLONG_MIN
  383. #define LUA_MAXUNSIGNED ULLONG_MAX
  384. #elif defined(LUA_USE_WINDOWS) /* }{ */
  385. /* in Windows, can use specific Windows types */
  386. #define LUA_INTEGER __int64
  387. #define LUA_INTEGER_FRMLEN "I64"
  388. #define LUA_MAXINTEGER _I64_MAX
  389. #define LUA_MININTEGER _I64_MIN
  390. #define LUA_MAXUNSIGNED _UI64_MAX
  391. #else /* }{ */
  392. #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
  393. or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
  394. #endif /* } */
  395. #else /* }{ */
  396. #error "numeric integer type not defined"
  397. #endif /* } */
  398. /* }================================================================== */
  399. /*
  400. ** {==================================================================
  401. ** Dependencies with C99 and other C details
  402. ** ===================================================================
  403. */
  404. /*
  405. @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
  406. ** (All uses in Lua have only one format item.)
  407. */
  408. #if !defined(LUA_USE_C89)
  409. #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
  410. #else
  411. #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
  412. #endif
  413. /*
  414. @@ lua_strx2number converts a hexadecimal numeral to a number.
  415. ** In C99, 'strtod' does that conversion. Otherwise, you can
  416. ** leave 'lua_strx2number' undefined and Lua will provide its own
  417. ** implementation.
  418. */
  419. #if !defined(LUA_USE_C89)
  420. #define lua_strx2number(s,p) lua_str2number(s,p)
  421. #endif
  422. /*
  423. @@ lua_pointer2str converts a pointer to a readable string in a
  424. ** non-specified way.
  425. */
  426. #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p)
  427. /*
  428. @@ lua_number2strx converts a float to a hexadecimal numeral.
  429. ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
  430. ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
  431. ** provide its own implementation.
  432. */
  433. #if !defined(LUA_USE_C89)
  434. #define lua_number2strx(L,b,sz,f,n) \
  435. ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
  436. #endif
  437. /*
  438. ** 'strtof' and 'opf' variants for math functions are not valid in
  439. ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
  440. ** availability of these variants. ('math.h' is already included in
  441. ** all files that use these macros.)
  442. */
  443. #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
  444. #undef l_mathop /* variants not available */
  445. #undef lua_str2number
  446. #define l_mathop(op) (lua_Number)op /* no variant */
  447. #define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
  448. #endif
  449. /*
  450. @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
  451. ** functions. It must be a numerical type; Lua will use 'intptr_t' if
  452. ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
  453. ** 'intptr_t' in C89)
  454. */
  455. #define LUA_KCONTEXT ptrdiff_t
  456. #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
  457. __STDC_VERSION__ >= 199901L
  458. #include <stdint.h>
  459. #if defined(INTPTR_MAX) /* even in C99 this type is optional */
  460. #undef LUA_KCONTEXT
  461. #define LUA_KCONTEXT intptr_t
  462. #endif
  463. #endif
  464. /*
  465. @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
  466. ** Change that if you do not want to use C locales. (Code using this
  467. ** macro must include the header 'locale.h'.)
  468. */
  469. #if !defined(lua_getlocaledecpoint)
  470. #define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
  471. #endif
  472. /*
  473. ** macros to improve jump prediction, used mostly for error handling
  474. ** and debug facilities. (Some macros in the Lua API use these macros.
  475. ** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your
  476. ** code.)
  477. */
  478. #if !defined(luai_likely)
  479. #if defined(__GNUC__) && !defined(LUA_NOBUILTIN)
  480. #define luai_likely(x) (__builtin_expect(((x) != 0), 1))
  481. #define luai_unlikely(x) (__builtin_expect(((x) != 0), 0))
  482. #else
  483. #define luai_likely(x) (x)
  484. #define luai_unlikely(x) (x)
  485. #endif
  486. #endif
  487. /* }================================================================== */
  488. /*
  489. ** {==================================================================
  490. ** Language Variations
  491. ** =====================================================================
  492. */
  493. /*
  494. @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
  495. ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
  496. ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
  497. ** coercion from strings to numbers.
  498. */
  499. /* #define LUA_NOCVTN2S */
  500. /* #define LUA_NOCVTS2N */
  501. /*
  502. @@ LUA_USE_APICHECK turns on several consistency checks on the C API.
  503. ** Define it as a help when debugging C code.
  504. */
  505. /* #define LUA_USE_APICHECK */
  506. /* }================================================================== */
  507. /*
  508. ** {==================================================================
  509. ** Macros that affect the API and must be stable (that is, must be the
  510. ** same when you compile Lua and when you compile code that links to
  511. ** Lua).
  512. ** =====================================================================
  513. */
  514. /*
  515. @@ LUA_EXTRASPACE defines the size of a raw memory area associated with
  516. ** a Lua state with very fast access.
  517. ** CHANGE it if you need a different size.
  518. */
  519. #define LUA_EXTRASPACE (sizeof(void *))
  520. /*
  521. @@ LUA_IDSIZE gives the maximum size for the description of the source
  522. ** of a function in debug information.
  523. ** CHANGE it if you want a different size.
  524. */
  525. #define LUA_IDSIZE 60
  526. /*
  527. @@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib
  528. ** buffer system.
  529. */
  530. #define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number)))
  531. /*
  532. @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure
  533. ** maximum alignment for the other items in that union.
  534. */
  535. #define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l
  536. /* }================================================================== */
  537. /* =================================================================== */
  538. /*
  539. ** Local configuration. You can use this space to add your redefinitions
  540. ** without modifying the main part of the file.
  541. */
  542. #endif