version.hpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. // sol2
  2. // The MIT License (MIT)
  3. // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. // this software and associated documentation files (the "Software"), to deal in
  6. // the Software without restriction, including without limitation the rights to
  7. // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. // the Software, and to permit persons to whom the Software is furnished to do so,
  9. // subject to the following conditions:
  10. // The above copyright notice and this permission notice shall be included in all
  11. // copies or substantial portions of the Software.
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. #ifndef SOL_VERSION_HPP
  19. #define SOL_VERSION_HPP
  20. #include <sol/config.hpp>
  21. // clang-format off
  22. #define SOL_VERSION_MAJOR 3
  23. #define SOL_VERSION_MINOR 2
  24. #define SOL_VERSION_PATCH 3
  25. #define SOL_VERSION_STRING "3.2.3"
  26. #define SOL_VERSION ((SOL_VERSION_MAJOR * 100000) + (SOL_VERSION_MINOR * 100) + (SOL_VERSION_PATCH))
  27. #define SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN) #_TOKEN
  28. #define SOL_TOKEN_TO_STRING_I_(_TOKEN) SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN)
  29. #define SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) _LEFT##_RIGHT
  30. #define SOL_CONCAT_TOKENS_I_(_LEFT, _RIGHT) SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT)
  31. #define SOL_RAW_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0)
  32. #define SOL_RAW_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0)
  33. #define SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3)
  34. #define SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0)
  35. #define SOL_IS_ON(OP_SYMBOL) SOL_RAW_IS_ON(OP_SYMBOL ## _I_)
  36. #define SOL_IS_OFF(OP_SYMBOL) SOL_RAW_IS_OFF(OP_SYMBOL ## _I_)
  37. #define SOL_IS_DEFAULT_ON(OP_SYMBOL) SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL ## _I_)
  38. #define SOL_IS_DEFAULT_OFF(OP_SYMBOL) SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL ## _I_)
  39. #define SOL_ON |
  40. #define SOL_OFF ^
  41. #define SOL_DEFAULT_ON +
  42. #define SOL_DEFAULT_OFF -
  43. #if defined(SOL_BUILD_CXX_MODE)
  44. #if (SOL_BUILD_CXX_MODE != 0)
  45. #define SOL_BUILD_CXX_MODE_I_ SOL_ON
  46. #else
  47. #define SOL_BUILD_CXX_MODE_I_ SOL_OFF
  48. #endif
  49. #elif defined(__cplusplus)
  50. #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_ON
  51. #else
  52. #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_OFF
  53. #endif
  54. #if defined(SOL_BUILD_C_MODE)
  55. #if (SOL_BUILD_C_MODE != 0)
  56. #define SOL_BUILD_C_MODE_I_ SOL_ON
  57. #else
  58. #define SOL_BUILD_C_MODE_I_ SOL_OFF
  59. #endif
  60. #elif defined(__STDC__)
  61. #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_ON
  62. #else
  63. #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_OFF
  64. #endif
  65. #if SOL_IS_ON(SOL_BUILD_C_MODE)
  66. #include <stddef.h>
  67. #include <stdint.h>
  68. #include <limits.h>
  69. #else
  70. #include <cstddef>
  71. #include <cstdint>
  72. #include <climits>
  73. #endif
  74. #if defined(SOL_HAS_BUILTIN)
  75. #define SOL_HAS_BUILTIN_I_(...) SOL_HAS_BUILTIN(__VA_ARGS__)
  76. #elif defined(__has_builtin)
  77. #define SOL_HAS_BUILTIN_I_(...) __has_builtin(__VA_ARGS__)
  78. #else
  79. #define SOL_HAS_BUILTIN_I_(...) 0
  80. #endif
  81. #if defined(SOL_COMPILER_VCXX)
  82. #if defined(SOL_COMPILER_VCXX != 0)
  83. #define SOL_COMPILER_VCXX_I_ SOL_ON
  84. #else
  85. #define SOL_COMPILER_VCXX_I_ SOL_OFF
  86. #endif
  87. #elif defined(_MSC_VER)
  88. #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_ON
  89. #else
  90. #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_OFF
  91. #endif
  92. #if defined(SOL_COMPILER_GCC)
  93. #if defined(SOL_COMPILER_GCC != 0)
  94. #define SOL_COMPILER_GCC_I_ SOL_ON
  95. #else
  96. #define SOL_COMPILER_GCC_I_ SOL_OFF
  97. #endif
  98. #elif defined(__GNUC__)
  99. #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_ON
  100. #else
  101. #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_OFF
  102. #endif
  103. #if defined(SOL_COMPILER_CLANG)
  104. #if defined(SOL_COMPILER_CLANG != 0)
  105. #define SOL_COMPILER_CLANG_I_ SOL_ON
  106. #else
  107. #define SOL_COMPILER_CLANG_I_ SOL_OFF
  108. #endif
  109. #elif defined(__clang__)
  110. #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_ON
  111. #else
  112. #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_OFF
  113. #endif
  114. #if defined(SOL_COMPILER_EDG)
  115. #if defined(SOL_COMPILER_EDG != 0)
  116. #define SOL_COMPILER_EDG_I_ SOL_ON
  117. #else
  118. #define SOL_COMPILER_EDG_I_ SOL_OFF
  119. #endif
  120. #else
  121. #define SOL_COMPILER_EDG_I_ SOL_DEFAULT_OFF
  122. #endif
  123. #if defined(SOL_COMPILER_MINGW)
  124. #if (SOL_COMPILER_MINGW != 0)
  125. #define SOL_COMPILER_MINGW_I_ SOL_ON
  126. #else
  127. #define SOL_COMPILER_MINGW_I_ SOL_OFF
  128. #endif
  129. #elif defined(__MINGW32__)
  130. #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_ON
  131. #else
  132. #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_OFF
  133. #endif
  134. #if SIZE_MAX <= 0xFFFFULL
  135. #define SOL_PLATFORM_X16_I_ SOL_ON
  136. #define SOL_PLATFORM_X86_I_ SOL_OFF
  137. #define SOL_PLATFORM_X64_I_ SOL_OFF
  138. #elif SIZE_MAX <= 0xFFFFFFFFULL
  139. #define SOL_PLATFORM_X16_I_ SOL_OFF
  140. #define SOL_PLATFORM_X86_I_ SOL_ON
  141. #define SOL_PLATFORM_X64_I_ SOL_OFF
  142. #else
  143. #define SOL_PLATFORM_X16_I_ SOL_OFF
  144. #define SOL_PLATFORM_X86_I_ SOL_OFF
  145. #define SOL_PLATFORM_X64_I_ SOL_ON
  146. #endif
  147. // TODO: ARM codes? So far, not needed explicitly...
  148. #define SOL_PLATFORM_ARM32_I_ SOL_OFF
  149. #define SOL_PLATFORM_ARM64_I_ SOL_OFF
  150. #if defined(SOL_PLATFORM_WINDOWS)
  151. #if (SOL_PLATFORM_WINDOWS != 0)
  152. #define SOL_PLATFORM_WINDOWS_I_ SOL_ON
  153. #else
  154. #define SOL_PLATFORM_WINDOWS_I_ SOL_OFF
  155. #endif
  156. #elif defined(_WIN32)
  157. #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_ON
  158. #else
  159. #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_OFF
  160. #endif
  161. #if defined(SOL_PLATFORM_CYGWIN)
  162. #if (SOL_PLATFORM_CYGWIN != 0)
  163. #define SOL_PLATFORM_CYGWIN_I_ SOL_ON
  164. #else
  165. #define SOL_PLATFORM_CYGWIN_I_ SOL_ON
  166. #endif
  167. #elif defined(__CYGWIN__)
  168. #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_ON
  169. #else
  170. #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_OFF
  171. #endif
  172. #if defined(SOL_PLATFORM_APPLE)
  173. #if (SOL_PLATFORM_APPLE != 0)
  174. #define SOL_PLATFORM_APPLE_I_ SOL_ON
  175. #else
  176. #define SOL_PLATFORM_APPLE_I_ SOL_OFF
  177. #endif
  178. #elif defined(__APPLE__)
  179. #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_ON
  180. #else
  181. #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_OFF
  182. #endif
  183. #if defined(SOL_PLATFORM_UNIX)
  184. #if (SOL_PLATFORM_UNIX != 0)
  185. #define SOL_PLATFORM_UNIXLIKE_I_ SOL_ON
  186. #else
  187. #define SOL_PLATFORM_UNIXLIKE_I_ SOL_OFF
  188. #endif
  189. #elif defined(__unix__)
  190. #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAUKT_ON
  191. #else
  192. #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAULT_OFF
  193. #endif
  194. #if defined(SOL_PLATFORM_LINUX)
  195. #if (SOL_PLATFORM_LINUX != 0)
  196. #define SOL_PLATFORM_LINUXLIKE_I_ SOL_ON
  197. #else
  198. #define SOL_PLATFORM_LINUXLIKE_I_ SOL_OFF
  199. #endif
  200. #elif defined(__LINUX__)
  201. #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAUKT_ON
  202. #else
  203. #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAULT_OFF
  204. #endif
  205. #define SOL_PLATFORM_APPLE_IPHONE_I_ SOL_OFF
  206. #define SOL_PLATFORM_BSDLIKE_I_ SOL_OFF
  207. #if defined(SOL_IN_DEBUG_DETECTED)
  208. #if SOL_IN_DEBUG_DETECTED != 0
  209. #define SOL_DEBUG_BUILD_I_ SOL_ON
  210. #else
  211. #define SOL_DEBUG_BUILD_I_ SOL_OFF
  212. #endif
  213. #elif !defined(NDEBUG)
  214. #if SOL_IS_ON(SOL_COMPILER_VCXX) && defined(_DEBUG)
  215. #define SOL_DEBUG_BUILD_I_ SOL_ON
  216. #elif (SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC)) && !defined(__OPTIMIZE__)
  217. #define SOL_DEBUG_BUILD_I_ SOL_ON
  218. #else
  219. #define SOL_DEBUG_BUILD_I_ SOL_OFF
  220. #endif
  221. #else
  222. #define SOL_DEBUG_BUILD_I_ SOL_DEFAULT_OFF
  223. #endif // We are in a debug mode of some sort
  224. #if defined(SOL_NO_EXCEPTIONS)
  225. #if (SOL_NO_EXCEPTIONS != 0)
  226. #define SOL_EXCEPTIONS_I_ SOL_OFF
  227. #else
  228. #define SOL_EXCEPTIONS_I_ SOL_ON
  229. #endif
  230. #elif SOL_IS_ON(SOL_COMPILER_VCXX)
  231. #if !defined(_CPPUNWIND)
  232. #define SOL_EXCEPTIONS_I_ SOL_OFF
  233. #else
  234. #define SOL_EXCEPTIONS_I_ SOL_ON
  235. #endif
  236. #elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC)
  237. #if !defined(__EXCEPTIONS)
  238. #define SOL_EXCEPTIONS_I_ SOL_OFF
  239. #else
  240. #define SOL_EXCEPTIONS_I_ SOL_ON
  241. #endif
  242. #else
  243. #define SOL_EXCEPTIONS_I_ SOL_DEFAULT_ON
  244. #endif
  245. #if defined(SOL_NO_RTTI)
  246. #if (SOL_NO_RTTI != 0)
  247. #define SOL_RTTI_I_ SOL_OFF
  248. #else
  249. #define SOL_RTTI_I_ SOL_ON
  250. #endif
  251. #elif SOL_IS_ON(SOL_COMPILER_VCXX)
  252. #if !defined(_CPPRTTI)
  253. #define SOL_RTTI_I_ SOL_OFF
  254. #else
  255. #define SOL_RTTI_I_ SOL_ON
  256. #endif
  257. #elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC)
  258. #if !defined(__GXX_RTTI)
  259. #define SOL_RTTI_I_ SOL_OFF
  260. #else
  261. #define SOL_RTTI_I_ SOL_ON
  262. #endif
  263. #else
  264. #define SOL_RTTI_I_ SOL_DEFAULT_ON
  265. #endif
  266. #if defined(SOL_NO_THREAD_LOCAL)
  267. #if SOL_NO_THREAD_LOCAL != 0
  268. #define SOL_USE_THREAD_LOCAL_I_ SOL_OFF
  269. #else
  270. #define SOL_USE_THREAD_LOCAL_I_ SOL_ON
  271. #endif
  272. #else
  273. #define SOL_USE_THREAD_LOCAL_I_ SOL_DEFAULT_ON
  274. #endif // thread_local keyword is bjorked on some platforms
  275. #if defined(SOL_ALL_SAFETIES_ON)
  276. #if SOL_ALL_SAFETIES_ON != 0
  277. #define SOL_ALL_SAFETIES_ON_I_ SOL_ON
  278. #else
  279. #define SOL_ALL_SAFETIES_ON_I_ SOL_OFF
  280. #endif
  281. #else
  282. #define SOL_ALL_SAFETIES_ON_I_ SOL_DEFAULT_OFF
  283. #endif
  284. #if defined(SOL_SAFE_GETTER)
  285. #if SOL_SAFE_GETTER != 0
  286. #define SOL_SAFE_GETTER_I_ SOL_ON
  287. #else
  288. #define SOL_SAFE_GETTER_I_ SOL_OFF
  289. #endif
  290. #else
  291. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  292. #define SOL_SAFE_GETTER_I_ SOL_ON
  293. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  294. #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_ON
  295. #else
  296. #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_OFF
  297. #endif
  298. #endif
  299. #if defined(SOL_SAFE_USERTYPE)
  300. #if SOL_SAFE_USERTYPE != 0
  301. #define SOL_SAFE_USERTYPE_I_ SOL_ON
  302. #else
  303. #define SOL_SAFE_USERTYPE_I_ SOL_OFF
  304. #endif
  305. #else
  306. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  307. #define SOL_SAFE_USERTYPE_I_ SOL_ON
  308. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  309. #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_ON
  310. #else
  311. #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_OFF
  312. #endif
  313. #endif
  314. #if defined(SOL_SAFE_REFERENCES)
  315. #if SOL_SAFE_REFERENCES != 0
  316. #define SOL_SAFE_REFERENCES_I_ SOL_ON
  317. #else
  318. #define SOL_SAFE_REFERENCES_I_ SOL_OFF
  319. #endif
  320. #else
  321. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  322. #define SOL_SAFE_REFERENCES_I_ SOL_ON
  323. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  324. #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_ON
  325. #else
  326. #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_OFF
  327. #endif
  328. #endif
  329. #if defined(SOL_SAFE_FUNCTIONS)
  330. #if SOL_SAFE_FUNCTIONS != 0
  331. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON
  332. #else
  333. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF
  334. #endif
  335. #elif defined (SOL_SAFE_FUNCTION_OBJECTS)
  336. #if SOL_SAFE_FUNCTION_OBJECTS != 0
  337. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON
  338. #else
  339. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF
  340. #endif
  341. #else
  342. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  343. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON
  344. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  345. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_ON
  346. #else
  347. #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_OFF
  348. #endif
  349. #endif
  350. #if defined(SOL_SAFE_FUNCTION_CALLS)
  351. #if SOL_SAFE_FUNCTION_CALLS != 0
  352. #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON
  353. #else
  354. #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_OFF
  355. #endif
  356. #else
  357. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  358. #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON
  359. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  360. #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_ON
  361. #else
  362. #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_OFF
  363. #endif
  364. #endif
  365. #if defined(SOL_SAFE_PROXIES)
  366. #if SOL_SAFE_PROXIES != 0
  367. #define SOL_SAFE_PROXIES_I_ SOL_ON
  368. #else
  369. #define SOL_SAFE_PROXIES_I_ SOL_OFF
  370. #endif
  371. #else
  372. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  373. #define SOL_SAFE_PROXIES_I_ SOL_ON
  374. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  375. #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_ON
  376. #else
  377. #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_OFF
  378. #endif
  379. #endif
  380. #if defined(SOL_SAFE_NUMERICS)
  381. #if SOL_SAFE_NUMERICS != 0
  382. #define SOL_SAFE_NUMERICS_I_ SOL_ON
  383. #else
  384. #define SOL_SAFE_NUMERICS_I_ SOL_OFF
  385. #endif
  386. #else
  387. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  388. #define SOL_SAFE_NUMERICS_I_ SOL_ON
  389. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  390. #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_ON
  391. #else
  392. #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_OFF
  393. #endif
  394. #endif
  395. #if defined(SOL_ALL_INTEGER_VALUES_FIT)
  396. #if (SOL_ALL_INTEGER_VALUES_FIT != 0)
  397. #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_ON
  398. #else
  399. #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_OFF
  400. #endif
  401. #elif !SOL_IS_DEFAULT_OFF(SOL_SAFE_NUMERICS) && SOL_IS_OFF(SOL_SAFE_NUMERICS)
  402. // if numerics is intentionally turned off, flip this on
  403. #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_ON
  404. #else
  405. // default to off
  406. #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_OFF
  407. #endif
  408. #if defined(SOL_SAFE_STACK_CHECK)
  409. #if SOL_SAFE_STACK_CHECK != 0
  410. #define SOL_SAFE_STACK_CHECK_I_ SOL_ON
  411. #else
  412. #define SOL_SAFE_STACK_CHECK_I_ SOL_OFF
  413. #endif
  414. #else
  415. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  416. #define SOL_SAFE_STACK_CHECK_I_ SOL_ON
  417. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  418. #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_ON
  419. #else
  420. #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_OFF
  421. #endif
  422. #endif
  423. #if defined(SOL_NO_CHECK_NUMBER_PRECISION)
  424. #if SOL_NO_CHECK_NUMBER_PRECISION != 0
  425. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF
  426. #else
  427. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON
  428. #endif
  429. #elif defined(SOL_NO_CHECKING_NUMBER_PRECISION)
  430. #if SOL_NO_CHECKING_NUMBER_PRECISION != 0
  431. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF
  432. #else
  433. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON
  434. #endif
  435. #else
  436. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  437. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON
  438. #elif SOL_IS_ON(SOL_SAFE_NUMERICS)
  439. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON
  440. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  441. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_ON
  442. #else
  443. #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_OFF
  444. #endif
  445. #endif
  446. #if defined(SOL_STRINGS_ARE_NUMBERS)
  447. #if (SOL_STRINGS_ARE_NUMBERS != 0)
  448. #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_ON
  449. #else
  450. #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_OFF
  451. #endif
  452. #else
  453. #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_DEFAULT_OFF
  454. #endif
  455. #if defined(SOL_ENABLE_INTEROP)
  456. #if SOL_ENABLE_INTEROP != 0
  457. #define SOL_USE_INTEROP_I_ SOL_ON
  458. #else
  459. #define SOL_USE_INTEROP_I_ SOL_OFF
  460. #endif
  461. #elif defined(SOL_USE_INTEROP)
  462. #if SOL_USE_INTEROP != 0
  463. #define SOL_USE_INTEROP_I_ SOL_ON
  464. #else
  465. #define SOL_USE_INTEROP_I_ SOL_OFF
  466. #endif
  467. #else
  468. #define SOL_USE_INTEROP_I_ SOL_DEFAULT_OFF
  469. #endif
  470. #if defined(SOL_NO_NIL)
  471. #if (SOL_NO_NIL != 0)
  472. #define SOL_NIL_I_ SOL_OFF
  473. #else
  474. #define SOL_NIL_I_ SOL_ON
  475. #endif
  476. #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil)
  477. #define SOL_NIL_I_ SOL_DEFAULT_OFF
  478. #else
  479. #define SOL_NIL_I_ SOL_DEFAULT_ON
  480. #endif
  481. #if defined(SOL_USERTYPE_TYPE_BINDING_INFO)
  482. #if (SOL_USERTYPE_TYPE_BINDING_INFO != 0)
  483. #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_ON
  484. #else
  485. #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_OFF
  486. #endif
  487. #else
  488. #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_DEFAULT_ON
  489. #endif // We should generate a my_type.__type table with lots of class information for usertypes
  490. #if defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT)
  491. #if (SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0)
  492. #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON
  493. #else
  494. #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF
  495. #endif
  496. #elif defined(SOL_DEFAULT_AUTOMAGICAL_USERTYPES)
  497. #if (SOL_DEFAULT_AUTOMAGICAL_USERTYPES != 0)
  498. #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON
  499. #else
  500. #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF
  501. #endif
  502. #else
  503. #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_DEFAULT_ON
  504. #endif // make is_automagical on/off by default
  505. #if defined(SOL_STD_VARIANT)
  506. #if (SOL_STD_VARIANT != 0)
  507. #define SOL_STD_VARIANT_I_ SOL_ON
  508. #else
  509. #define SOL_STD_VARIANT_I_ SOL_OFF
  510. #endif
  511. #else
  512. #if SOL_IS_ON(SOL_COMPILER_CLANG) && SOL_IS_ON(SOL_PLATFORM_APPLE)
  513. #if defined(__has_include)
  514. #if __has_include(<variant>)
  515. #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON
  516. #else
  517. #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF
  518. #endif
  519. #else
  520. #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF
  521. #endif
  522. #else
  523. #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON
  524. #endif
  525. #endif // make is_automagical on/off by default
  526. #if defined(SOL_NOEXCEPT_FUNCTION_TYPE)
  527. #if (SOL_NOEXCEPT_FUNCTION_TYPE != 0)
  528. #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON
  529. #else
  530. #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF
  531. #endif
  532. #else
  533. #if defined(__cpp_noexcept_function_type)
  534. #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON
  535. #elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(_MSVC_LANG) && (_MSVC_LANG < 201403L))
  536. // There is a bug in the VC++ compiler??
  537. // on /std:c++latest under x86 conditions (VS 15.5.2),
  538. // compiler errors are tossed for noexcept markings being on function types
  539. // that are identical in every other way to their non-noexcept marked types function types...
  540. // VS 2019: There is absolutely a bug.
  541. #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF
  542. #else
  543. #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_DEFAULT_ON
  544. #endif
  545. #endif // noexcept is part of a function's type
  546. #if defined(SOL_STACK_STRING_OPTIMIZATION_SIZE) && SOL_STACK_STRING_OPTIMIZATION_SIZE > 0
  547. #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ SOL_STACK_STRING_OPTIMIZATION_SIZE
  548. #else
  549. #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ 1024
  550. #endif
  551. #if defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0
  552. #define SOL_ID_SIZE_I_ SOL_ID_SIZE
  553. #else
  554. #define SOL_ID_SIZE_I_ 512
  555. #endif
  556. #if defined(LUA_IDSIZE) && LUA_IDSIZE > 0
  557. #define SOL_FILE_ID_SIZE_I_ LUA_IDSIZE
  558. #elif defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0
  559. #define SOL_FILE_ID_SIZE_I_ SOL_FILE_ID_SIZE
  560. #else
  561. #define SOL_FILE_ID_SIZE_I_ 2048
  562. #endif
  563. #if defined(SOL_PRINT_ERRORS)
  564. #if (SOL_PRINT_ERRORS != 0)
  565. #define SOL_PRINT_ERRORS_I_ SOL_ON
  566. #else
  567. #define SOL_PRINT_ERRORS_I_ SOL_OFF
  568. #endif
  569. #else
  570. #if SOL_IS_ON(SOL_ALL_SAFETIES_ON)
  571. #define SOL_PRINT_ERRORS_I_ SOL_ON
  572. #elif SOL_IS_ON(SOL_DEBUG_BUILD)
  573. #define SOL_PRINT_ERRORS_I_ SOL_DEFAULT_ON
  574. #else
  575. #define SOL_PRINT_ERRORS_I_ SOL_OFF
  576. #endif
  577. #endif
  578. #if defined(SOL_DEFAULT_PASS_ON_ERROR)
  579. #if (SOL_DEFAULT_PASS_ON_ERROR != 0)
  580. #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON
  581. #else
  582. #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_OFF
  583. #endif
  584. #else
  585. #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_DEFAULT_OFF
  586. #endif
  587. #if defined(SOL_USING_CXX_LUA)
  588. #if (SOL_USING_CXX_LUA != 0)
  589. #define SOL_USING_CXX_LUA_I_ SOL_ON
  590. #else
  591. #define SOL_USING_CXX_LUA_I_ SOL_OFF
  592. #endif
  593. #elif defined(SOL_USE_CXX_LUA)
  594. // alternative spelling
  595. #if (SOL_USE_CXX_LUA != 0)
  596. #define SOL_USING_CXX_LUA_I_ SOL_ON
  597. #else
  598. #define SOL_USING_CXX_LUA_I_ SOL_OFF
  599. #endif
  600. #else
  601. #define SOL_USING_CXX_LUA_I_ SOL_DEFAULT_OFF
  602. #endif
  603. #if defined(SOL_USING_CXX_LUAJIT)
  604. #if (SOL_USING_CXX_LUAJIT != 0)
  605. #define SOL_USING_CXX_LUAJIT_I_ SOL_ON
  606. #else
  607. #define SOL_USING_CXX_LUAJIT_I_ SOL_OFF
  608. #endif
  609. #elif defined(SOL_USE_CXX_LUAJIT)
  610. #if (SOL_USE_CXX_LUAJIT != 0)
  611. #define SOL_USING_CXX_LUAJIT_I_ SOL_ON
  612. #else
  613. #define SOL_USING_CXX_LUAJIT_I_ SOL_OFF
  614. #endif
  615. #else
  616. #define SOL_USING_CXX_LUAJIT_I_ SOL_DEFAULT_OFF
  617. #endif
  618. #if defined(SOL_NO_LUA_HPP)
  619. #if (SOL_NO_LUA_HPP != 0)
  620. #define SOL_USE_LUA_HPP_I_ SOL_OFF
  621. #else
  622. #define SOL_USE_LUA_HPP_I_ SOL_ON
  623. #endif
  624. #elif SOL_IS_ON(SOL_USING_CXX_LUA)
  625. #define SOL_USE_LUA_HPP_I_ SOL_OFF
  626. #elif defined(__has_include)
  627. #if __has_include(<lua.hpp>)
  628. #define SOL_USE_LUA_HPP_I_ SOL_ON
  629. #else
  630. #define SOL_USE_LUA_HPP_I_ SOL_OFF
  631. #endif
  632. #else
  633. #define SOL_USE_LUA_HPP_I_ SOL_DEFAULT_ON
  634. #endif
  635. #if defined(SOL_CONTAINERS_START)
  636. #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START
  637. #elif defined(SOL_CONTAINERS_START_INDEX)
  638. #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START_INDEX
  639. #elif defined(SOL_CONTAINER_START_INDEX)
  640. #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINER_START_INDEX
  641. #else
  642. #define SOL_CONTAINER_START_INDEX_I_ 1
  643. #endif
  644. #if defined (SOL_NO_MEMORY_ALIGNMENT)
  645. #if (SOL_NO_MEMORY_ALIGNMENT != 0)
  646. #define SOL_ALIGN_MEMORY_I_ SOL_OFF
  647. #else
  648. #define SOL_ALIGN_MEMORY_I_ SOL_ON
  649. #endif
  650. #else
  651. #define SOL_ALIGN_MEMORY_I_ SOL_DEFAULT_ON
  652. #endif
  653. #if defined(SOL_USE_BOOST)
  654. #if (SOL_USE_BOOST != 0)
  655. #define SOL_USE_BOOST_I_ SOL_ON
  656. #else
  657. #define SOL_USE_BOOST_I_ SOL_OFF
  658. #endif
  659. #else
  660. #define SOL_USE_BOOST_I_ SOL_DEFAULT_OFF
  661. #endif
  662. #if defined(SOL_USE_UNSAFE_BASE_LOOKUP)
  663. #if (SOL_USE_UNSAFE_BASE_LOOKUP != 0)
  664. #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_ON
  665. #else
  666. #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF
  667. #endif
  668. #else
  669. #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_DEFAULT_OFF
  670. #endif
  671. #if defined(SOL_INSIDE_UNREAL)
  672. #if (SOL_INSIDE_UNREAL != 0)
  673. #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON
  674. #else
  675. #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_OFF
  676. #endif
  677. #else
  678. #if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER)
  679. #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_ON
  680. #else
  681. #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_OFF
  682. #endif
  683. #endif
  684. #if defined(SOL_NO_COMPAT)
  685. #if (SOL_NO_COMPAT != 0)
  686. #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_OFF
  687. #else
  688. #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_ON
  689. #endif
  690. #else
  691. #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_DEFAULT_ON
  692. #endif
  693. #if defined(SOL_GET_FUNCTION_POINTER_UNSAFE)
  694. #if (SOL_GET_FUNCTION_POINTER_UNSAFE != 0)
  695. #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_ON
  696. #else
  697. #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_OFF
  698. #endif
  699. #else
  700. #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_DEFAULT_OFF
  701. #endif
  702. #if defined(SOL_CONTAINER_CHECK_IS_EXHAUSTIVE)
  703. #if (SOL_CONTAINER_CHECK_IS_EXHAUSTIVE != 0)
  704. #define SOL_CONTAINER_CHECK_IS_EXHAUSTIVE_I_ SOL_ON
  705. #else
  706. #define SOL_CONTAINER_CHECK_IS_EXHAUSTIVE_I_ SOL_OFF
  707. #endif
  708. #else
  709. #define SOL_CONTAINER_CHECK_IS_EXHAUSTIVE_I_ SOL_DEFAULT_OFF
  710. #endif
  711. #if defined(SOL_FUNCTION_CALL_VALUE_SEMANTICS)
  712. #if (SOL_FUNCTION_CALL_VALUE_SEMANTICS != 0)
  713. #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_ON
  714. #else
  715. #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_OFF
  716. #endif
  717. #else
  718. #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_DEFAULT_OFF
  719. #endif
  720. #if defined(SOL_MINGW_CCTYPE_IS_POISONED)
  721. #if (SOL_MINGW_CCTYPE_IS_POISONED != 0)
  722. #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_ON
  723. #else
  724. #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_OFF
  725. #endif
  726. #elif SOL_IS_ON(SOL_COMPILER_MINGW) && defined(__GNUC__) && (__GNUC__ < 6)
  727. // MinGW is off its rocker in some places...
  728. #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_ON
  729. #else
  730. #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_OFF
  731. #endif
  732. #if defined(SOL_CHAR8_T)
  733. #if (SOL_CHAR8_T != 0)
  734. #define SOL_CHAR8_T_I_ SOL_ON
  735. #else
  736. #define SOL_CHAR8_T_I_ SOL_OFF
  737. #endif
  738. #else
  739. #if defined(__cpp_char8_t)
  740. #define SOL_CHAR8_T_I_ SOL_DEFAULT_ON
  741. #else
  742. #define SOL_CHAR8_T_I_ SOL_DEFAULT_OFF
  743. #endif
  744. #endif
  745. #if SOL_IS_ON(SOL_USE_BOOST)
  746. #include <boost/version.hpp>
  747. #if BOOST_VERSION >= 107500 // Since Boost 1.75.0 boost::none is constexpr
  748. #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr
  749. #else
  750. #define SOL_BOOST_NONE_CONSTEXPR_I_ const
  751. #endif // BOOST_VERSION
  752. #else
  753. // assume boost isn't using a garbage version
  754. #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr
  755. #endif
  756. #if defined(SOL2_CI)
  757. #if (SOL2_CI != 0)
  758. #define SOL2_CI_I_ SOL_ON
  759. #else
  760. #define SOL2_CI_I_ SOL_OFF
  761. #endif
  762. #else
  763. #define SOL2_CI_I_ SOL_DEFAULT_OFF
  764. #endif
  765. #if defined(SOL_ASSERT)
  766. #define SOL_USER_ASSERT_I_ SOL_ON
  767. #else
  768. #define SOL_USER_ASSERT_I_ SOL_DEFAULT_OFF
  769. #endif
  770. #if defined(SOL_ASSERT_MSG)
  771. #define SOL_USER_ASSERT_MSG_I_ SOL_ON
  772. #else
  773. #define SOL_USER_ASSERT_MSG_I_ SOL_DEFAULT_OFF
  774. #endif
  775. #include <sol/prologue.hpp>
  776. #include <sol/epilogue.hpp>
  777. // clang-format on
  778. #include <sol/detail/build_version.hpp>
  779. #endif // SOL_VERSION_HPP