inkcpp_rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +1 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +84 -0
  6. data/LICENSE +7 -0
  7. data/README.md +3 -0
  8. data/Rakefile +16 -0
  9. data/bin/console +15 -0
  10. data/bin/setup +10 -0
  11. data/bin/tapioca +29 -0
  12. data/ext/inkcpp_rb/extconf.rb +19 -0
  13. data/ext/inkcpp_rb/inkcpp/.clang-format +99 -0
  14. data/ext/inkcpp_rb/inkcpp/.github/FUNDING.yml +1 -0
  15. data/ext/inkcpp_rb/inkcpp/.github/workflows/build.yml +344 -0
  16. data/ext/inkcpp_rb/inkcpp/.github/workflows/release.yml +49 -0
  17. data/ext/inkcpp_rb/inkcpp/.gitignore +25 -0
  18. data/ext/inkcpp_rb/inkcpp/.gitmodules +9 -0
  19. data/ext/inkcpp_rb/inkcpp/CMakeLists.txt +170 -0
  20. data/ext/inkcpp_rb/inkcpp/CODE_OF_CONDUCT.md +76 -0
  21. data/ext/inkcpp_rb/inkcpp/CONTRIBUTING.md +55 -0
  22. data/ext/inkcpp_rb/inkcpp/Config.cmake.in +2 -0
  23. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/CMakeLists.txt +13 -0
  24. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.c +38 -0
  25. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.cpp +40 -0
  26. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink +8 -0
  27. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink.json +1 -0
  28. data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example.zip +0 -0
  29. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/InkCPP_DEMO.zip +0 -0
  30. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/CreateThread.png +0 -0
  31. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/HandleChoice.png +0 -0
  32. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ListElementOf.png +0 -0
  33. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalRuntime.png +0 -0
  34. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalThread.png +0 -0
  35. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ObseverChange.png +0 -0
  36. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/TagListGetValue.png +0 -0
  37. data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/YieldResume.png +0 -0
  38. data/ext/inkcpp_rb/inkcpp/Doxyfile +2825 -0
  39. data/ext/inkcpp_rb/inkcpp/LICENSE.txt +22 -0
  40. data/ext/inkcpp_rb/inkcpp/Minimal.runsettings +8 -0
  41. data/ext/inkcpp_rb/inkcpp/README.md +192 -0
  42. data/ext/inkcpp_rb/inkcpp/inkcpp/CMakeLists.txt +67 -0
  43. data/ext/inkcpp_rb/inkcpp/inkcpp/array.h +481 -0
  44. data/ext/inkcpp_rb/inkcpp/inkcpp/avl_array.h +833 -0
  45. data/ext/inkcpp_rb/inkcpp/inkcpp/casting.h +93 -0
  46. data/ext/inkcpp_rb/inkcpp/inkcpp/choice.cpp +54 -0
  47. data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.cpp +124 -0
  48. data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.h +406 -0
  49. data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.cpp +52 -0
  50. data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.h +34 -0
  51. data/ext/inkcpp_rb/inkcpp/inkcpp/executioner.h +179 -0
  52. data/ext/inkcpp_rb/inkcpp/inkcpp/functional.cpp +86 -0
  53. data/ext/inkcpp_rb/inkcpp/inkcpp/functions.cpp +54 -0
  54. data/ext/inkcpp_rb/inkcpp/inkcpp/functions.h +40 -0
  55. data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.cpp +289 -0
  56. data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.h +149 -0
  57. data/ext/inkcpp_rb/inkcpp/inkcpp/header.cpp +44 -0
  58. data/ext/inkcpp_rb/inkcpp/inkcpp/include/choice.h +106 -0
  59. data/ext/inkcpp_rb/inkcpp/inkcpp/include/functional.h +327 -0
  60. data/ext/inkcpp_rb/inkcpp/inkcpp/include/globals.h +196 -0
  61. data/ext/inkcpp_rb/inkcpp/inkcpp/include/list.h +187 -0
  62. data/ext/inkcpp_rb/inkcpp/inkcpp/include/runner.h +291 -0
  63. data/ext/inkcpp_rb/inkcpp/inkcpp/include/snapshot.h +61 -0
  64. data/ext/inkcpp_rb/inkcpp/inkcpp/include/story.h +219 -0
  65. data/ext/inkcpp_rb/inkcpp/inkcpp/include/story_ptr.h +233 -0
  66. data/ext/inkcpp_rb/inkcpp/inkcpp/include/traits.h +270 -0
  67. data/ext/inkcpp_rb/inkcpp/inkcpp/include/types.h +169 -0
  68. data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.cpp +79 -0
  69. data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.h +39 -0
  70. data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.cpp +276 -0
  71. data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.h +356 -0
  72. data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.cpp +841 -0
  73. data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.h +450 -0
  74. data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.cpp +40 -0
  75. data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.h +529 -0
  76. data/ext/inkcpp_rb/inkcpp/inkcpp/operation_bases.h +164 -0
  77. data/ext/inkcpp_rb/inkcpp/inkcpp/operations.h +100 -0
  78. data/ext/inkcpp_rb/inkcpp/inkcpp/output.cpp +528 -0
  79. data/ext/inkcpp_rb/inkcpp/inkcpp/output.h +153 -0
  80. data/ext/inkcpp_rb/inkcpp/inkcpp/platform.h +22 -0
  81. data/ext/inkcpp_rb/inkcpp/inkcpp/random.h +38 -0
  82. data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.cpp +1396 -0
  83. data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.h +336 -0
  84. data/ext/inkcpp_rb/inkcpp/inkcpp/simple_restorable_stack.h +335 -0
  85. data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.cpp +182 -0
  86. data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.h +91 -0
  87. data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_interface.h +57 -0
  88. data/ext/inkcpp_rb/inkcpp/inkcpp/stack.cpp +618 -0
  89. data/ext/inkcpp_rb/inkcpp/inkcpp/stack.h +243 -0
  90. data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.cpp +361 -0
  91. data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.h +92 -0
  92. data/ext/inkcpp_rb/inkcpp/inkcpp/story_ptr.cpp +75 -0
  93. data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.cpp +125 -0
  94. data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.h +67 -0
  95. data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.cpp +149 -0
  96. data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.h +47 -0
  97. data/ext/inkcpp_rb/inkcpp/inkcpp/string_utils.h +207 -0
  98. data/ext/inkcpp_rb/inkcpp/inkcpp/system.cpp +39 -0
  99. data/ext/inkcpp_rb/inkcpp/inkcpp/tuple.hpp +151 -0
  100. data/ext/inkcpp_rb/inkcpp/inkcpp/value.cpp +279 -0
  101. data/ext/inkcpp_rb/inkcpp/inkcpp/value.h +666 -0
  102. data/ext/inkcpp_rb/inkcpp/inkcpp_c/CMakeLists.txt +62 -0
  103. data/ext/inkcpp_rb/inkcpp/inkcpp_c/include/inkcpp.h +393 -0
  104. data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp.cpp +344 -0
  105. data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp_c.pc.in +10 -0
  106. data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/ExternalFunction.c +56 -0
  107. data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Globals.c +98 -0
  108. data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Lists.c +73 -0
  109. data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Observer.c +36 -0
  110. data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Snapshot.c +65 -0
  111. data/ext/inkcpp_rb/inkcpp/inkcpp_cl/CMakeLists.txt +49 -0
  112. data/ext/inkcpp_rb/inkcpp/inkcpp_cl/inkcpp_cl.cpp +215 -0
  113. data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.cpp +209 -0
  114. data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.h +8 -0
  115. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/CMakeLists.txt +37 -0
  116. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.cpp +446 -0
  117. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.h +70 -0
  118. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.cpp +166 -0
  119. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.h +79 -0
  120. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/command.cpp +107 -0
  121. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/compiler.cpp +96 -0
  122. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp +62 -0
  123. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.h +104 -0
  124. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compilation_results.h +22 -0
  125. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compiler.h +44 -0
  126. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json.hpp +24596 -0
  127. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.cpp +411 -0
  128. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.h +62 -0
  129. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.cpp +47 -0
  130. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.h +70 -0
  131. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.cpp +107 -0
  132. data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.h +55 -0
  133. data/ext/inkcpp_rb/inkcpp/inkcpp_py/CMakeLists.txt +19 -0
  134. data/ext/inkcpp_rb/inkcpp/inkcpp_py/example.py +78 -0
  135. data/ext/inkcpp_rb/inkcpp/inkcpp_py/src/module.cpp +317 -0
  136. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/conftest.py +53 -0
  137. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py +35 -0
  138. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Globals.py +40 -0
  139. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Lists.py +43 -0
  140. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Observer.py +27 -0
  141. data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Snapshot.py +57 -0
  142. data/ext/inkcpp_rb/inkcpp/inkcpp_py/unreal_example.ink +71 -0
  143. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Array.cpp +115 -0
  144. data/ext/inkcpp_rb/inkcpp/inkcpp_test/CMakeLists.txt +117 -0
  145. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Callstack.cpp +392 -0
  146. data/ext/inkcpp_rb/inkcpp/inkcpp_test/EmptyStringForDivert.cpp +36 -0
  147. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp +34 -0
  148. data/ext/inkcpp_rb/inkcpp/inkcpp_test/FallbackFunction.cpp +77 -0
  149. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Globals.cpp +73 -0
  150. data/ext/inkcpp_rb/inkcpp/inkcpp_test/InkyJson.cpp +34 -0
  151. data/ext/inkcpp_rb/inkcpp/inkcpp_test/LabelCondition.cpp +60 -0
  152. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Lists.cpp +144 -0
  153. data/ext/inkcpp_rb/inkcpp/inkcpp_test/LookaheadSafe.cpp +46 -0
  154. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Main.cpp +7 -0
  155. data/ext/inkcpp_rb/inkcpp/inkcpp_test/MoveTo.cpp +95 -0
  156. data/ext/inkcpp_rb/inkcpp/inkcpp_test/NewLines.cpp +76 -0
  157. data/ext/inkcpp_rb/inkcpp/inkcpp_test/NoEarlyTags.cpp +33 -0
  158. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Observer.cpp +245 -0
  159. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Pointer.cpp +191 -0
  160. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Restorable.cpp +294 -0
  161. data/ext/inkcpp_rb/inkcpp/inkcpp_test/SpaceAfterBracketChoice.cpp +45 -0
  162. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Stack.cpp +224 -0
  163. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Tags.cpp +131 -0
  164. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ThirdTierChoiceAfterBrackets.cpp +38 -0
  165. data/ext/inkcpp_rb/inkcpp/inkcpp_test/UTF8.cpp +56 -0
  166. data/ext/inkcpp_rb/inkcpp/inkcpp_test/Value.cpp +210 -0
  167. data/ext/inkcpp_rb/inkcpp/inkcpp_test/catch.hpp +17970 -0
  168. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/AHF.ink +7 -0
  169. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ChoiceBracketStory.ink +7 -0
  170. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/EmptyStringForDivert.ink +13 -0
  171. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ExternalFunctionsExecuteProperly.ink +11 -0
  172. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/FallBack.ink +15 -0
  173. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/GlobalStory.ink +9 -0
  174. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LabelConditionStory.ink +5 -0
  175. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LinesStory.ink +42 -0
  176. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListLogicStory.ink +40 -0
  177. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListStory.ink +8 -0
  178. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LookaheadSafe.ink +14 -0
  179. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/MoveTo.ink +36 -0
  180. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/NoEarlyTags.ink +19 -0
  181. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ObserverStory.ink +8 -0
  182. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/SimpleStoryFlow.ink +65 -0
  183. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TagsStory.ink +22 -0
  184. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TheIntercept.ink +1686 -0
  185. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ThirdTierChoiceAfterBracketsStory.ink +13 -0
  186. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF-8-demo.txt +212 -0
  187. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF8Story.ink +218 -0
  188. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inklecate.json +154 -0
  189. data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inky.json +160 -0
  190. data/ext/inkcpp_rb/inkcpp/notes/ArchitectureNotes.md +54 -0
  191. data/ext/inkcpp_rb/inkcpp/notes/ListNotes.md +69 -0
  192. data/ext/inkcpp_rb/inkcpp/notes/OperationNotes.md +35 -0
  193. data/ext/inkcpp_rb/inkcpp/notes/TagsNotes.md +24 -0
  194. data/ext/inkcpp_rb/inkcpp/notes/WhitespaceNotes.md +28 -0
  195. data/ext/inkcpp_rb/inkcpp/proofing/README.md +3 -0
  196. data/ext/inkcpp_rb/inkcpp/proofing/inkcpp_runtime_driver +12 -0
  197. data/ext/inkcpp_rb/inkcpp/pyproject.toml +63 -0
  198. data/ext/inkcpp_rb/inkcpp/setup.py +166 -0
  199. data/ext/inkcpp_rb/inkcpp/shared/CMakeLists.txt +14 -0
  200. data/ext/inkcpp_rb/inkcpp/shared/private/command.h +172 -0
  201. data/ext/inkcpp_rb/inkcpp/shared/private/header.h +46 -0
  202. data/ext/inkcpp_rb/inkcpp/shared/public/config.h +53 -0
  203. data/ext/inkcpp_rb/inkcpp/shared/public/system.h +307 -0
  204. data/ext/inkcpp_rb/inkcpp/shared/public/version.h +14 -0
  205. data/ext/inkcpp_rb/inkcpp/tests/TestAllSequenceTypes.ink +59 -0
  206. data/ext/inkcpp_rb/inkcpp/tests/TestArithmetic.ink +17 -0
  207. data/ext/inkcpp_rb/inkcpp/tests/TestBasicStringLiterals.ink +8 -0
  208. data/ext/inkcpp_rb/inkcpp/tests/TestBasicTunnel.ink +10 -0
  209. data/ext/inkcpp_rb/inkcpp/tests/TestBlanksInInlineSequences.ink +51 -0
  210. data/ext/inkcpp_rb/inkcpp/tests/TestCallStackEvaluation.ink +15 -0
  211. data/ext/inkcpp_rb/inkcpp/tests/TestChoiceCount.ink +15 -0
  212. data/ext/inkcpp_rb/inkcpp/tests/TestChoiceDivertsToDone.ink +6 -0
  213. data/ext/inkcpp_rb/inkcpp/tests/TestChoiceWithBracketsOnly.ink +9 -0
  214. data/ext/inkcpp_rb/inkcpp/tests/TestCompareDivertTargets.ink +26 -0
  215. data/ext/inkcpp_rb/inkcpp/tests/TestComplexTunnels.ink +22 -0
  216. data/ext/inkcpp_rb/inkcpp/tests/TestConditionalChoiceInWeave.ink +19 -0
  217. data/ext/inkcpp_rb/inkcpp/tests/TestTunnelOnwardsAfterTunnel.ink +17 -0
  218. data/ext/inkcpp_rb/inkcpp/unreal/CMakeLists.txt +51 -0
  219. data/ext/inkcpp_rb/inkcpp/unreal/UE_example.ink +92 -0
  220. data/ext/inkcpp_rb/inkcpp/unreal/blueprint_filter.js +377 -0
  221. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Resources/Icon128.png +0 -0
  222. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkAsset.cpp +47 -0
  223. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp +40 -0
  224. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkList.cpp +86 -0
  225. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkRuntime.cpp +265 -0
  226. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp +239 -0
  227. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkVar.cpp +143 -0
  228. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/TagList.cpp +95 -0
  229. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/inkcpp.cpp +13 -0
  230. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h +50 -0
  231. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkChoice.h +58 -0
  232. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkDelegates.h +139 -0
  233. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkList.h +102 -0
  234. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkRuntime.h +177 -0
  235. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkSnapshot.h +30 -0
  236. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkThread.h +215 -0
  237. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkVar.h +245 -0
  238. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/TagList.h +77 -0
  239. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/inkcpp.h +217 -0
  240. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs +62 -0
  241. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.cpp +237 -0
  242. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.h +43 -0
  243. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inkcpp_editor.cpp +13 -0
  244. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inklecate_cmd.cpp.in +24 -0
  245. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Public/inkcpp_editor.h +9 -0
  246. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/inkcpp_editor.Build.cs +61 -0
  247. data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/inkcpp.uplugin +44 -0
  248. data/ext/inkcpp_rb/inkcpp/unreal/render.css +1 -0
  249. data/ext/inkcpp_rb/inkcpp_rb.cpp +321 -0
  250. data/inkcpp_rb.gemspec +54 -0
  251. data/rbi/inkcpp_rb.rbi +211 -0
  252. data/sorbet/config +4 -0
  253. data/sorbet/rbi/annotations/.gitattributes +1 -0
  254. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  255. data/sorbet/rbi/gems/.gitattributes +1 -0
  256. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  257. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  258. data/sorbet/rbi/gems/minitest@5.25.4.rbi +1547 -0
  259. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  260. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  261. data/sorbet/rbi/gems/prism@1.3.0.rbi +40040 -0
  262. data/sorbet/rbi/gems/rake-compiler@1.2.8.rbi +9 -0
  263. data/sorbet/rbi/gems/rake@13.2.1.rbi +3033 -0
  264. data/sorbet/rbi/gems/rbi@0.2.2.rbi +4527 -0
  265. data/sorbet/rbi/gems/rice@4.3.3.rbi +44 -0
  266. data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
  267. data/sorbet/rbi/gems/tapioca@0.16.7.rbi +3611 -0
  268. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  269. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  270. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  271. data/sorbet/tapioca/config.yml +13 -0
  272. data/sorbet/tapioca/require.rb +4 -0
  273. metadata +400 -0
@@ -0,0 +1,529 @@
1
+ /* Copyright (c) 2024 Julian Benda
2
+ *
3
+ * This file is part of inkCPP which is released under MIT license.
4
+ * See file LICENSE.txt or go to
5
+ * https://github.com/JBenda/inkcpp for full license details.
6
+ */
7
+ #pragma once
8
+ #include "value.h"
9
+
10
+ /// Define operation for numeric types.
11
+ /// use generalized types numeric and integral to keep redundancy minimal.
12
+ /// define a cast to support operations like int + float, bool + uint etc.
13
+
14
+ namespace ink::runtime::internal
15
+ {
16
+
17
+ /// list of numeric value types
18
+ /// produces a SFINAE error if type is not part of list
19
+ template<value_type ty>
20
+ using is_numeric_t = typename enable_if<
21
+ ty == value_type::boolean || ty == value_type::int32 || ty == value_type::uint32
22
+ || ty == value_type::float32,
23
+ void>::type;
24
+
25
+ template<value_type ty>
26
+ using is_signed_numeric_t =
27
+ typename enable_if<ty == value_type::int32 || ty == value_type::float32, void>::type;
28
+
29
+ /// list of internal value types
30
+ /// produces a SFINAE error if type is not part of list
31
+ template<value_type ty>
32
+ using is_integral_t = typename enable_if<
33
+ ty == value_type::boolean || ty == value_type::int32 || ty == value_type::uint32, void>::type;
34
+
35
+ namespace casting
36
+ {
37
+ /// define valid casts
38
+
39
+ /// result of operation with int and float is float.
40
+ template<>
41
+ struct cast<value_type::int32, value_type::float32> {
42
+ static constexpr value_type value = value_type::float32;
43
+ };
44
+
45
+ template<>
46
+ struct cast<value_type::uint32, value_type::float32> {
47
+ static constexpr value_type value = value_type::float32;
48
+ };
49
+
50
+ template<>
51
+ struct cast<value_type::boolean, value_type::float32> {
52
+ static constexpr value_type value = value_type::float32;
53
+ };
54
+
55
+ template<>
56
+ struct cast<value_type::int32, value_type::uint32> {
57
+ static constexpr value_type value = value_type::int32;
58
+ };
59
+
60
+ /// result of operation with uint and bool is uint
61
+ template<>
62
+ struct cast<value_type::boolean, value_type::uint32> {
63
+ static constexpr value_type value = value_type::uint32;
64
+ };
65
+
66
+ // result of operation with bool and int is int
67
+ template<>
68
+ struct cast<value_type::boolean, value_type::int32> {
69
+ static constexpr value_type value = value_type::int32;
70
+ };
71
+
72
+ /// defined numeric cast
73
+ /// generic numeric_cast only allow casting to its one type
74
+ template<value_type to>
75
+ inline typename value::ret<to>::type numeric_cast(const value& v)
76
+ {
77
+ if (to == v.type()) {
78
+ return v.get<to>();
79
+ } else {
80
+ inkFail("invalid numeric_cast! from %i to %i", v.type(), to);
81
+ return 0;
82
+ }
83
+ }
84
+
85
+ /// specialisation for uint32
86
+ template<>
87
+ inline typename value::ret<value_type::uint32>::type
88
+ numeric_cast<value_type::uint32>(const value& v)
89
+ {
90
+ switch (v.type()) {
91
+ case value_type::uint32: return v.get<value_type::uint32>();
92
+ /// bool value can cast to uint32
93
+ case value_type::boolean: return static_cast<uint32_t>(v.get<value_type::boolean>());
94
+ default: inkFail("invalid cast to uint!"); return 0;
95
+ }
96
+ }
97
+
98
+ template<>
99
+ inline typename value::ret<value_type::int32>::type numeric_cast<value_type::int32>(const value& v
100
+ )
101
+ {
102
+ switch (v.type()) {
103
+ case value_type::int32: return v.get<value_type::int32>();
104
+ case value_type::uint32: return static_cast<int32_t>(v.get<value_type::uint32>());
105
+ case value_type::boolean: return static_cast<int32_t>(v.get<value_type::boolean>());
106
+ default: inkFail("invalid cast to int!"); return 0;
107
+ }
108
+ }
109
+
110
+ /// specialisation for float32
111
+ template<>
112
+ inline float numeric_cast<value_type::float32>(const value& v)
113
+ {
114
+ switch (v.type()) {
115
+ case value_type::float32: return v.get<value_type::float32>();
116
+ // int value can cast to float
117
+ case value_type::int32: return static_cast<float>(v.get<value_type::int32>());
118
+ case value_type::uint32: return static_cast<float>(v.get<value_type::uint32>());
119
+ default: inkFail("invalid numeric_cast!"); return 0;
120
+ }
121
+ }
122
+
123
+ /// specialisation for boolean
124
+ template<>
125
+ inline bool numeric_cast<value_type::boolean>(const value& v)
126
+ {
127
+ switch (v.type()) {
128
+ case value_type::boolean: return v.get<value_type::boolean>();
129
+ case value_type::int32: return v.get<value_type::int32>() != 0;
130
+ case value_type::uint32: return v.get<value_type::uint32>() != 0;
131
+ case value_type::float32: return v.get<value_type::float32>() != 0;
132
+ default: inkFail("invalid numeric_cast to boolean from: %i", v.type()); return false;
133
+ }
134
+ }
135
+ } // namespace casting
136
+
137
+ template<>
138
+ class operation<Command::FLOOR, value_type::float32, void> : public operation_base<void>
139
+ {
140
+ public:
141
+ using operation_base::operation_base;
142
+ void operator()(basic_eval_stack& stack, value* vals);
143
+ };
144
+
145
+ template<>
146
+ class operation<Command::CEILING, value_type::float32, void> : public operation_base<void>
147
+ {
148
+ public:
149
+ using operation_base::operation_base;
150
+ void operator()(basic_eval_stack& stack, value* vals);
151
+ };
152
+
153
+ template<value_type ty>
154
+ class operation<Command::INT_CAST, ty, is_numeric_t<ty>> : public operation_base<void>
155
+ {
156
+ public:
157
+ using operation_base::operation_base;
158
+
159
+ void operator()(basic_eval_stack& stack, value* vals)
160
+ {
161
+ stack.push(value{}.set<value_type::int32>(static_cast<int32_t>(vals->get<ty>())));
162
+ }
163
+ };
164
+
165
+ template<>
166
+ class operation<Command::IS_EQUAL, value_type::divert, void> : public operation_base<void>
167
+ {
168
+ public:
169
+ using operation_base::operation_base;
170
+
171
+ void operator()(basic_eval_stack& stack, value* vals)
172
+ {
173
+ stack.push(value{}.set<value_type::boolean>(
174
+ vals[0].get<value_type::divert>() == vals[1].get<value_type::divert>()
175
+ ));
176
+ }
177
+ };
178
+
179
+ template<>
180
+ class operation<Command::NOT_EQUAL, value_type::divert, void> : public operation_base<void>
181
+ {
182
+ public:
183
+ using operation_base::operation_base;
184
+
185
+ void operator()(basic_eval_stack& stack, value* vals)
186
+ {
187
+ stack.push(value{}.set<value_type::boolean>(
188
+ vals[0].get<value_type::divert>() != vals[1].get<value_type::divert>()
189
+ ));
190
+ }
191
+ };
192
+
193
+ template<value_type ty>
194
+ class operation<Command::FLOOR, ty, is_integral_t<ty>> : public operation_base<void>
195
+ {
196
+ public:
197
+ using operation_base::operation_base;
198
+
199
+ void operator()(basic_eval_stack& stack, value* vals)
200
+ {
201
+ // for integral types floor(i) == i
202
+ stack.push(vals[0]);
203
+ }
204
+ };
205
+
206
+ template<value_type ty>
207
+ class operation<Command::CEILING, ty, is_integral_t<ty>> : public operation_base<void>
208
+ {
209
+ public:
210
+ using operation_base::operation_base;
211
+
212
+ void operator()(basic_eval_stack& stack, value* vals)
213
+ {
214
+ // for integral types ceil(i) == i
215
+ stack.push(vals[0]);
216
+ }
217
+ };
218
+
219
+ template<value_type ty>
220
+ class operation<Command::ADD, ty, is_numeric_t<ty>> : public operation_base<void>
221
+ {
222
+ public:
223
+ using operation_base::operation_base;
224
+
225
+ void operator()(basic_eval_stack& stack, value* vals)
226
+ {
227
+ stack.push(
228
+ value{}.set<ty>(casting::numeric_cast<ty>(vals[0]) + casting::numeric_cast<ty>(vals[1]))
229
+ );
230
+ }
231
+ };
232
+
233
+ template<value_type ty>
234
+ class operation<Command::SUBTRACT, ty, is_numeric_t<ty>> : public operation_base<void>
235
+ {
236
+ public:
237
+ using operation_base::operation_base;
238
+
239
+ void operator()(basic_eval_stack& stack, value* vals)
240
+ {
241
+ stack.push(
242
+ value{}.set<ty>(casting::numeric_cast<ty>(vals[0]) - casting::numeric_cast<ty>(vals[1]))
243
+ );
244
+ }
245
+ };
246
+
247
+ template<>
248
+ class operation<Command::SUBTRACT, value_type::boolean, void> : public operation_base<void>
249
+ {
250
+ operation<Command::SUBTRACT, value_type::int32> op_int;
251
+
252
+ public:
253
+ template<typename T>
254
+ operation(const T& t)
255
+ : operation_base{t}
256
+ , op_int{t}
257
+ {
258
+ }
259
+
260
+ void operator()(basic_eval_stack& stack, value* vals) { op_int(stack, vals); }
261
+ };
262
+
263
+ template<value_type ty>
264
+ class operation<Command::DIVIDE, ty, is_numeric_t<ty>> : public operation_base<void>
265
+ {
266
+ public:
267
+ using operation_base::operation_base;
268
+
269
+ void operator()(basic_eval_stack& stack, value* vals)
270
+ {
271
+ stack.push(
272
+ value{}.set<ty>(casting::numeric_cast<ty>(vals[0]) / casting::numeric_cast<ty>(vals[1]))
273
+ );
274
+ }
275
+ };
276
+
277
+ template<>
278
+ class operation<Command::DIVIDE, value_type::boolean, void> : public operation_base<void>
279
+ {
280
+ operation<Command::DIVIDE, value_type::int32> op_int;
281
+
282
+ public:
283
+ template<typename T>
284
+ operation(const T& t)
285
+ : operation_base{t}
286
+ , op_int{t}
287
+ {
288
+ }
289
+
290
+ void operator()(basic_eval_stack& stack, value* vals) { op_int(stack, vals); }
291
+ };
292
+
293
+ template<value_type ty>
294
+ class operation<Command::MULTIPLY, ty, is_numeric_t<ty>> : public operation_base<void>
295
+ {
296
+ public:
297
+ using operation_base::operation_base;
298
+
299
+ void operator()(basic_eval_stack& stack, value* vals)
300
+ {
301
+ stack.push(
302
+ value{}.set<ty>(casting::numeric_cast<ty>(vals[0]) * casting::numeric_cast<ty>(vals[1]))
303
+ );
304
+ }
305
+ };
306
+
307
+ template<value_type ty>
308
+ class operation<Command::MOD, ty, is_integral_t<ty>> : public operation_base<void>
309
+ {
310
+ public:
311
+ using operation_base::operation_base;
312
+
313
+ void operator()(basic_eval_stack& stack, value* vals)
314
+ {
315
+ stack.push(
316
+ value{}.set<ty>(casting::numeric_cast<ty>(vals[0]) % casting::numeric_cast<ty>(vals[1]))
317
+ );
318
+ }
319
+ };
320
+
321
+ template<>
322
+ class operation<Command::MOD, value_type::boolean, void> : public operation_base<void>
323
+ {
324
+ operation<Command::MOD, value_type::int32> op_int;
325
+
326
+ public:
327
+ template<typename T>
328
+ operation(const T& t)
329
+ : operation_base{t}
330
+ , op_int{t}
331
+ {
332
+ }
333
+
334
+ void operator()(basic_eval_stack& stack, value* vals) { op_int(stack, vals); }
335
+ };
336
+
337
+ template<value_type ty>
338
+ class operation<Command::IS_EQUAL, ty, is_numeric_t<ty>> : public operation_base<void>
339
+ {
340
+ public:
341
+ using operation_base::operation_base;
342
+
343
+ void operator()(basic_eval_stack& stack, value* vals)
344
+ {
345
+ stack.push(value{}.set<value_type::boolean>(
346
+ casting::numeric_cast<ty>(vals[0]) == casting::numeric_cast<ty>(vals[1])
347
+ ));
348
+ }
349
+ };
350
+
351
+ template<value_type ty>
352
+ class operation<Command::GREATER_THAN, ty, is_numeric_t<ty>> : public operation_base<void>
353
+ {
354
+ public:
355
+ using operation_base::operation_base;
356
+
357
+ void operator()(basic_eval_stack& stack, value* vals)
358
+ {
359
+ stack.push(value{}.set<value_type::boolean>(
360
+ casting::numeric_cast<ty>(vals[0]) > casting::numeric_cast<ty>(vals[1])
361
+ ));
362
+ }
363
+ };
364
+
365
+ template<value_type ty>
366
+ class operation<Command::LESS_THAN, ty, is_numeric_t<ty>> : public operation_base<void>
367
+ {
368
+ public:
369
+ using operation_base::operation_base;
370
+
371
+ void operator()(basic_eval_stack& stack, value* vals)
372
+ {
373
+ stack.push(value{}.set<value_type::boolean>(
374
+ casting::numeric_cast<ty>(vals[0]) < casting::numeric_cast<ty>(vals[1])
375
+ ));
376
+ }
377
+ };
378
+
379
+ template<value_type ty>
380
+ class operation<Command::GREATER_THAN_EQUALS, ty, is_numeric_t<ty>> : public operation_base<void>
381
+ {
382
+ public:
383
+ using operation_base::operation_base;
384
+
385
+ void operator()(basic_eval_stack& stack, value* vals)
386
+ {
387
+ stack.push(value{}.set<value_type::boolean>(
388
+ casting::numeric_cast<ty>(vals[0]) >= casting::numeric_cast<ty>(vals[1])
389
+ ));
390
+ }
391
+ };
392
+
393
+ template<value_type ty>
394
+ class operation<Command::LESS_THAN_EQUALS, ty, is_numeric_t<ty>> : public operation_base<void>
395
+ {
396
+ public:
397
+ using operation_base::operation_base;
398
+
399
+ void operator()(basic_eval_stack& stack, value* vals)
400
+ {
401
+ stack.push(value{}.set<value_type::boolean>(
402
+ casting::numeric_cast<ty>(vals[0]) <= casting::numeric_cast<ty>(vals[1])
403
+ ));
404
+ }
405
+ };
406
+
407
+ template<value_type ty>
408
+ class operation<Command::NOT_EQUAL, ty, is_numeric_t<ty>> : public operation_base<void>
409
+ {
410
+ public:
411
+ using operation_base::operation_base;
412
+
413
+ void operator()(basic_eval_stack& stack, value* vals)
414
+ {
415
+ stack.push(value{}.set<value_type::boolean>(
416
+ casting::numeric_cast<ty>(vals[0]) != casting::numeric_cast<ty>(vals[1])
417
+ ));
418
+ }
419
+ };
420
+
421
+ template<value_type ty>
422
+ class operation<Command::AND, ty, is_integral_t<ty>> : public operation_base<void>
423
+ {
424
+ public:
425
+ using operation_base::operation_base;
426
+
427
+ void operator()(basic_eval_stack& stack, value* vals)
428
+ {
429
+ stack.push(value{}.set<value_type::boolean>(
430
+ casting::numeric_cast<value_type::boolean>(vals[0])
431
+ && casting::numeric_cast<value_type::boolean>(vals[1])
432
+ ));
433
+ }
434
+ };
435
+
436
+ template<value_type ty>
437
+ class operation<Command::OR, ty, is_integral_t<ty>> : public operation_base<void>
438
+ {
439
+ public:
440
+ using operation_base::operation_base;
441
+
442
+ void operator()(basic_eval_stack& stack, value* vals)
443
+ {
444
+ stack.push(value{}.set<value_type::boolean>(
445
+ casting::numeric_cast<value_type::boolean>(vals[0])
446
+ || casting::numeric_cast<value_type::boolean>(vals[1])
447
+ ));
448
+ }
449
+ };
450
+
451
+ template<value_type ty>
452
+ class operation<Command::MIN, ty, is_numeric_t<ty>> : public operation_base<void>
453
+ {
454
+ public:
455
+ using operation_base::operation_base;
456
+
457
+ void operator()(basic_eval_stack& stack, value* vals)
458
+ {
459
+ typename value::ret<ty>::type n[2]
460
+ = {casting::numeric_cast<ty>(vals[0]), casting::numeric_cast<ty>(vals[1])};
461
+ stack.push(value{}.set<ty>(n[0] < n[1] ? n[0] : n[1]));
462
+ }
463
+ };
464
+
465
+ template<value_type ty>
466
+ class operation<Command::MAX, ty, is_numeric_t<ty>> : public operation_base<void>
467
+ {
468
+ public:
469
+ using operation_base::operation_base;
470
+
471
+ void operator()(basic_eval_stack& stack, value* vals)
472
+ {
473
+ typename value::ret<ty>::type n[2]
474
+ = {casting::numeric_cast<ty>(vals[0]), casting::numeric_cast<ty>(vals[1])};
475
+ stack.push(value{}.set<ty>(n[0] > n[1] ? n[0] : n[1]));
476
+ }
477
+ };
478
+
479
+ template<value_type ty>
480
+ class operation<Command::NOT, ty, is_integral_t<ty>> : public operation_base<void>
481
+ {
482
+ public:
483
+ using operation_base::operation_base;
484
+
485
+ void operator()(basic_eval_stack& stack, value* vals)
486
+ {
487
+ stack.push(value{}.set<value_type::boolean>(! vals[0].get<ty>()));
488
+ }
489
+ };
490
+
491
+ template<value_type ty>
492
+ class operation<Command::NEGATE, ty, is_signed_numeric_t<ty>> : public operation_base<void>
493
+ {
494
+ public:
495
+ using operation_base::operation_base;
496
+
497
+ void operator()(basic_eval_stack& stack, value* vals)
498
+ {
499
+ stack.push(value{}.set<ty>(-vals[0].get<ty>()));
500
+ }
501
+ };
502
+
503
+ template<>
504
+ class operation<Command::NEGATE, value_type::boolean, void> : public operation_base<void>
505
+ {
506
+ public:
507
+ using operation_base::operation_base;
508
+
509
+ void operator()(basic_eval_stack& stack, value* vals)
510
+ {
511
+ stack.push(value{}.set<value_type::boolean>(! vals[0].get<value_type::boolean>()));
512
+ }
513
+ };
514
+
515
+ template<>
516
+ class operation<Command::RANDOM, value_type::int32, void> : public operation_base<prng>
517
+ {
518
+ public:
519
+ using operation_base::operation_base;
520
+
521
+ void operator()(basic_eval_stack& stack, value* vals)
522
+ {
523
+ int min = casting::numeric_cast<value_type::int32>(vals[0]);
524
+ int max = casting::numeric_cast<value_type::int32>(vals[1]);
525
+ stack.push(value{}.set<value_type::int32>(static_cast<int32_t>(_prng.rand(max - min + 1) + min))
526
+ );
527
+ }
528
+ };
529
+ } // namespace ink::runtime::internal
@@ -0,0 +1,164 @@
1
+ /* Copyright (c) 2024 Julian Benda
2
+ *
3
+ * This file is part of inkCPP which is released under MIT license.
4
+ * See file LICENSE.txt or go to
5
+ * https://github.com/JBenda/inkcpp for full license details.
6
+ */
7
+ #pragma once
8
+
9
+ /// defines data storage for operations.
10
+ /// provide constructor and handle the data member.
11
+ /// the data member therefore are protected accessible
12
+
13
+ #include "system.h"
14
+ #include "./tuple.hpp"
15
+ #include "random.h"
16
+
17
+ namespace ink::runtime {
18
+ class runner_interface;
19
+ }
20
+ namespace ink::runtime::internal {
21
+ class string_table;
22
+ class list_table;
23
+ class story_impl;
24
+ class globals_impl;
25
+
26
+ /// base class for operations to acquire data and provide flags and
27
+ /// constructor
28
+ template<typename ...>
29
+ class operation_base {
30
+ public:
31
+ static constexpr bool enabled = false;
32
+ template<typename T>
33
+ operation_base(const T&) { static_assert(always_false<T>::value, "use undefined base!"); }
34
+ };
35
+
36
+ template<>
37
+ class operation_base<void> {
38
+ public:
39
+ static constexpr bool enabled = true;
40
+ template<typename T>
41
+ operation_base(const T&) {}
42
+ };
43
+
44
+ // base class for operations which needs a string_table
45
+ template<>
46
+ class operation_base<string_table> {
47
+ public:
48
+ static constexpr bool enabled = true;
49
+ template<typename T>
50
+ operation_base(const T& t) : _string_table{*get<string_table*,T>(t)} {
51
+ static_assert(has_type<string_table*,T>::value, "Executioner "
52
+ "constructor needs a string table to instantiate "
53
+ "some operations!");
54
+ }
55
+
56
+ protected:
57
+ string_table& _string_table;
58
+ };
59
+
60
+ // base class for operations which needs a list_table
61
+ template<>
62
+ class operation_base<list_table> {
63
+ public:
64
+ static constexpr bool enabled = true;
65
+ template<typename T>
66
+ operation_base(const T& t) : _list_table{*get<list_table*,T>(t)} {
67
+ static_assert(has_type<list_table*,T>::value, "Executioner "
68
+ "constructor needs a list table to instantiate "
69
+ "some operations!");
70
+ }
71
+
72
+ protected:
73
+ list_table& _list_table;
74
+ };
75
+
76
+ // base class for operations which needs a list_table
77
+ template<>
78
+ class operation_base<prng> {
79
+ public:
80
+ static constexpr bool enabled = true;
81
+ template<typename T>
82
+ operation_base(const T& t) : _prng{*get<prng*,T>(t)} {
83
+ static_assert(has_type<prng*,T>::value, "Executioner "
84
+ "constructor needs a list table to instantiate "
85
+ "some operations!");
86
+ }
87
+
88
+ protected:
89
+ prng& _prng;
90
+ };
91
+
92
+
93
+ template<>
94
+ class operation_base<list_table, prng> {
95
+ public:
96
+ static constexpr bool enabled = true;
97
+ template<typename T>
98
+ operation_base(const T& t)
99
+ : _list_table{*get<list_table*,T>(t)}, _prng{*get<prng*,T>(t)}
100
+ {
101
+ static_assert(has_type<list_table*,T>::value, "Executioner "
102
+ "constructor needs a list table to instantiate "
103
+ "some operations!");
104
+ static_assert(has_type<prng*,T>::value, "Executioner "
105
+ "constructor needs a RNG to instantiate "
106
+ "some operations!");
107
+ }
108
+
109
+ protected:
110
+ list_table& _list_table;
111
+ prng& _prng;
112
+ };
113
+
114
+ template<>
115
+ class operation_base<const story_impl, globals_impl> {
116
+ template<typename T>
117
+ static const story_impl& get_story(const T& t) {
118
+ if constexpr (has_type<const story_impl*,T>::value) {
119
+ return *get<const story_impl*,T>(t);
120
+ } else {
121
+ static_assert(has_type<story_impl*,T>::value, "Executioner "
122
+ "constructor needs a story_impl to instantiate "
123
+ "container related operations!");
124
+ return *get<story_impl*,T>(t);
125
+ }
126
+ }
127
+ public:
128
+ static constexpr bool enabled = true;
129
+ template<typename T>
130
+ operation_base(const T& t)
131
+ : _story{get_story(t)}, _visit_counts{*get<globals_impl*,T>(t)}
132
+ {
133
+ static_assert(has_type<globals_impl*,T>::value, "Executioner "
134
+ "constructor needs access to globals to instantiate "
135
+ "container related operations!");
136
+ }
137
+
138
+ protected:
139
+ const story_impl& _story;
140
+ globals_impl& _visit_counts;
141
+ };
142
+
143
+ template<>
144
+ class operation_base<const runner_interface> {
145
+ template<typename T>
146
+ static const runner_interface& get_const(const T& t) {
147
+ if constexpr (has_type<const runner_interface*,T>::value) {
148
+ return *get<const runner_interface*,T>(t);
149
+ } else {
150
+ static_assert(has_type<runner_interface*,T>::value,
151
+ "Executioner constructor needs a runner to instantiate.");
152
+ return *get<runner_interface*,T>(t);
153
+ }
154
+ }
155
+ public:
156
+ static constexpr bool enabled = true;
157
+ template<typename T>
158
+ operation_base(const T& t)
159
+ : _runner{get_const(t)}
160
+ { }
161
+ protected:
162
+ const runner_interface& _runner;
163
+ };
164
+ }