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,79 @@
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
+ #include "list_impl.h"
8
+ #include "list.h"
9
+ #include "list_table.h"
10
+
11
+ namespace ink::runtime::internal
12
+ {
13
+ bool list_impl::contains(const char* flag_name) const
14
+ {
15
+ auto flag = _list_table->toFlag(flag_name);
16
+ inkAssert(flag.has_value(), "No flag with name found! " FORMAT_STRING_STR "'", flag_name);
17
+ return _list_table->has(list_table::list{_list}, *flag);
18
+ }
19
+
20
+ void list_impl::add(const char* flag_name)
21
+ {
22
+ auto flag = _list_table->toFlag(flag_name);
23
+ inkAssert(flag.has_value(), "No flag with name found to add! '" FORMAT_STRING_STR "'", flag_name);
24
+ _list = _list_table->add(list_table::list{_list}, *flag).lid;
25
+ }
26
+
27
+ void list_impl::remove(const char* flag_name)
28
+ {
29
+ auto flag = _list_table->toFlag(flag_name);
30
+ inkAssert(
31
+ flag.has_value(), "No flag with name found to remove! '" FORMAT_STRING_STR "'", flag_name
32
+ );
33
+ _list = _list_table->sub(list_table::list{_list}, *flag).lid;
34
+ }
35
+
36
+ void list_impl::next(const char*& flag_name, const char*& list_name, int& i, bool one_list_only)
37
+ const
38
+ {
39
+ if (i == -1) {
40
+ return;
41
+ }
42
+
43
+ list_flag flag{.list_id = static_cast<int16_t>(i >> 16), .flag = static_cast<int16_t>(i & 0xFF)};
44
+ if (flag_name != nullptr) {
45
+ ++flag.flag;
46
+ }
47
+ if (flag.flag >= _list_table->_list_end[flag.list_id]) {
48
+ next_list:
49
+ if (one_list_only) {
50
+ i = -1;
51
+ return;
52
+ }
53
+ flag.flag = 0;
54
+ do {
55
+ ++flag.list_id;
56
+ if (static_cast<size_t>(flag.list_id) >= _list_table->_list_end.size()) {
57
+ i = -1;
58
+ return;
59
+ }
60
+ } while (! _list_table->hasList(_list_table->getPtr(_list), flag.list_id));
61
+ }
62
+ while (! _list_table->has(list_table::list{_list}, flag)) {
63
+ ++flag.flag;
64
+ if (flag.flag >= _list_table->_list_end[flag.list_id] - _list_table->listBegin(flag.list_id)) {
65
+ goto next_list;
66
+ }
67
+ }
68
+ flag_name = _list_table->_flag_names[_list_table->toFid(flag)];
69
+ list_name = _list_table->_list_names[flag.list_id];
70
+
71
+ i = (flag.list_id << 16) | flag.flag;
72
+ }
73
+
74
+ list_interface::iterator list_impl::begin(const char* list_name) const
75
+ {
76
+ size_t list_id = _list_table->get_list_id(list_name).list_id;
77
+ return ++new_iterator(nullptr, list_id << 16, true);
78
+ }
79
+ } // namespace ink::runtime::internal
@@ -0,0 +1,39 @@
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
+ #include "list.h"
10
+
11
+ namespace ink::runtime::internal {
12
+ class list_table;
13
+ class value;
14
+ class list_impl final : public list_interface {
15
+ public:
16
+ list_impl(list_table& table, int lid) : list_interface(table, lid) {}
17
+ int get_lid() const { return _list; }
18
+
19
+ bool contains(const char* flag_name) const override;
20
+ void add(const char* flag_name) override;
21
+ void remove(const char* flag_name) override;
22
+
23
+ list_interface::iterator begin() const override {
24
+ return ++new_iterator(nullptr, 0);
25
+ }
26
+
27
+ list_interface::iterator begin(const char* list_name) const override;
28
+ list_interface::iterator end() const override {
29
+ return new_iterator(nullptr, -1);
30
+ }
31
+
32
+ private:
33
+ friend ink::runtime::internal::value;
34
+
35
+ /// @todo wrong iteration order, first lists then flags
36
+ void next(const char*& flag_name, const char*& list_name, int& i, bool one_list_only)
37
+ const override;
38
+ };
39
+ }
@@ -0,0 +1,276 @@
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
+ /// implements operations on lists
8
+
9
+ #include "stack.h"
10
+ #include "value.h"
11
+ #include "operations.h"
12
+ #include "list_table.h"
13
+
14
+ #define call4_Wrap(OP, RET, FUN) call4_Wrap_diff(OP, RET, RET, RET, RET, FUN)
15
+ #define call4_Wrap_diff(OP, RET0, RET1, RET2, RET3, FUN) \
16
+ void operation<Command::OP, value_type::list, void>::operator()( \
17
+ basic_eval_stack& stack, value* vals \
18
+ ) \
19
+ { \
20
+ call4(RET0, RET1, RET2, RET3, FUN); \
21
+ }
22
+
23
+ #define call4(RET0, RET1, RET2, RET3, FUN) \
24
+ if (vals[0].type() == value_type::list_flag) { \
25
+ if (vals[1].type() == value_type::list) { \
26
+ stack.push(value{}.set<value_type::RET0>( \
27
+ _list_table.FUN(vals[0].get<value_type::list_flag>(), vals[1].get<value_type::list>()) \
28
+ )); \
29
+ } else { \
30
+ inkAssert( \
31
+ vals[1].type() == value_type::list_flag, \
32
+ "list operation was called but second argument is not a list or list_flag" \
33
+ ); \
34
+ stack.push(value{}.set<value_type::RET1>(_list_table.FUN( \
35
+ vals[0].get<value_type::list_flag>(), vals[1].get<value_type::list_flag>() \
36
+ ))); \
37
+ } \
38
+ } else { \
39
+ inkAssert( \
40
+ vals[0].type() == value_type::list, \
41
+ "list operation was called but first argument is not a list or a list_flag!" \
42
+ ); \
43
+ if (vals[1].type() == value_type::list) { \
44
+ stack.push(value{}.set<value_type::RET2>( \
45
+ _list_table.FUN(vals[0].get<value_type::list>(), vals[1].get<value_type::list>()) \
46
+ )); \
47
+ } else { \
48
+ inkAssert( \
49
+ vals[1].type() == value_type::list_flag, \
50
+ "list operation was called but second argument ist not a list or list_flag!" \
51
+ ); \
52
+ stack.push(value{}.set<value_type::RET3>( \
53
+ _list_table.FUN(vals[0].get<value_type::list>(), vals[1].get<value_type::list_flag>()) \
54
+ )); \
55
+ } \
56
+ }
57
+
58
+ #define call2(OP, RET0, RET1, FUN) \
59
+ void operation<Command::OP, value_type::list, void>::operator()( \
60
+ basic_eval_stack& stack, value* vals \
61
+ ) \
62
+ { \
63
+ stack.push(value{}.set<value_type::RET0>(_list_table.FUN(vals[0].get<value_type::list>()))); \
64
+ } \
65
+ void operation<Command::OP, value_type::list_flag, void>::operator()( \
66
+ basic_eval_stack& stack, value* vals \
67
+ ) \
68
+ { \
69
+ stack.push(value{}.set<value_type::RET1>(_list_table.FUN(vals[0].get<value_type::list_flag>()) \
70
+ )); \
71
+ }
72
+
73
+ namespace ink::runtime::internal
74
+ {
75
+ void operation<Command::ADD, value_type::list, void>::operator()(
76
+ basic_eval_stack& stack, value* vals
77
+ )
78
+ {
79
+ if (vals[1].type() == value_type::int32 || vals[1].type() == value_type::uint32) {
80
+ int i = vals[1].type() == value_type::int32
81
+ ? vals[1].get<value_type::int32>()
82
+ : static_cast<int>(vals[1].get<value_type::uint32>());
83
+ inkAssert(
84
+ vals[0].type() == value_type::list,
85
+ "try to use list add function but value is not of type list"
86
+ );
87
+ stack.push(value{}.set<value_type::list>(_list_table.add(vals[0].get<value_type::list>(), i)));
88
+ } else {
89
+ call4(list, list, list, list, add);
90
+ }
91
+ }
92
+
93
+ void operation<Command::ADD, value_type::list_flag, void>::operator()(
94
+ basic_eval_stack& stack, value* vals
95
+ )
96
+ {
97
+ inkAssert(
98
+ vals[0].type() == value_type::list_flag,
99
+ "try to use add function with list_flag results but first argument is not a list_flag!"
100
+ );
101
+ inkAssert(
102
+ vals[1].type() == value_type::int32 || vals[1].type() == value_type::uint32,
103
+ "try modify a list flag with a non intiger type!"
104
+ );
105
+ int i = vals[1].type() == value_type::int32 ? vals[1].get<value_type::int32>()
106
+ : static_cast<int>(vals[1].get<value_type::uint32>());
107
+ stack.push(
108
+ value{}.set<value_type::list_flag>(_list_table.add(vals[0].get<value_type::list_flag>(), i))
109
+ );
110
+ }
111
+
112
+ void operation<Command::SUBTRACT, value_type::list, void>::operator()(
113
+ basic_eval_stack& stack, value* vals
114
+ )
115
+ {
116
+ if (vals[1].type() == value_type::int32 || vals[1].type() == value_type::uint32) {
117
+ int i = vals[1].type() == value_type::int32 ? vals[1].get<value_type::int32>()
118
+ : vals[1].get<value_type::uint32>();
119
+ inkAssert(
120
+ vals[0].type() == value_type::list,
121
+ "A in list resulting subtraction needs at leas one list as argument!"
122
+ );
123
+ stack.push(value{}.set<value_type::list>(_list_table.sub(vals[0].get<value_type::list>(), i)));
124
+ } else {
125
+ call4(list_flag, list_flag, list, list, sub);
126
+ }
127
+ }
128
+
129
+ void operation<Command::SUBTRACT, value_type::list_flag, void>::operator()(
130
+ basic_eval_stack& stack, value* vals
131
+ )
132
+ {
133
+ inkAssert(
134
+ vals[0].type() == value_type::list_flag,
135
+ "subtraction resulting in list_flag needs a list_flag as first arguments!"
136
+ );
137
+ inkAssert(
138
+ vals[1].type() == value_type::int32 || vals[1].type() == value_type::uint32,
139
+ "Try to subtract non integer value from list_flag."
140
+ );
141
+ int i = vals[1].type() == value_type::int32 ? vals[1].get<value_type::int32>()
142
+ : vals[1].get<value_type::uint32>();
143
+ stack.push(
144
+ value{}.set<value_type::list_flag>(_list_table.sub(vals[0].get<value_type::list_flag>(), i))
145
+ );
146
+ }
147
+
148
+ void operation<Command::INTERSECTION, value_type::list, void>::operator()(
149
+ basic_eval_stack& stack, value* vals
150
+ )
151
+ {
152
+ call4(list_flag, list_flag, list, list_flag, intersect);
153
+ }
154
+
155
+ call2(NOT, boolean, boolean, not_bool);
156
+ call2(LIST_COUNT, int32, int32, count);
157
+ call2(LIST_MIN, list_flag, list_flag, min);
158
+ call2(LIST_MAX, list_flag, list_flag, max);
159
+ call2(LIST_ALL, list, list, all);
160
+ call2(LIST_INVERT, list, list, invert);
161
+
162
+ call4_Wrap(LESS_THAN, boolean, less);
163
+ call4_Wrap(LESS_THAN_EQUALS, boolean, less_equal);
164
+ call4_Wrap(GREATER_THAN, boolean, greater);
165
+ call4_Wrap(GREATER_THAN_EQUALS, boolean, greater_equal);
166
+ call4_Wrap(IS_EQUAL, boolean, equal);
167
+ call4_Wrap(NOT_EQUAL, boolean, not_equal);
168
+ call4_Wrap(HAS, boolean, has);
169
+ call4_Wrap(HASNT, boolean, hasnt);
170
+
171
+ void operation<Command::lrnd, value_type::list, void>::operator()(
172
+ basic_eval_stack& stack, value* vals
173
+ )
174
+ {
175
+ stack.push(
176
+ value{}.set<value_type::list_flag>(_list_table.lrnd(vals[0].get<value_type::list>(), _prng))
177
+ );
178
+ }
179
+
180
+ void operation<Command::lrnd, value_type::list_flag, void>::operator()(
181
+ basic_eval_stack& stack, value* vals
182
+ )
183
+ {
184
+ stack.push(
185
+ value{}.set<value_type::list_flag>(_list_table.lrnd(vals[0].get<value_type::list_flag>()))
186
+ );
187
+ }
188
+
189
+ void operation<Command::LIST_INT, value_type::string, void>::operator()(
190
+ basic_eval_stack& stack, value* vals
191
+ )
192
+ {
193
+ inkAssert(
194
+ vals[0].type() == value_type::string,
195
+ "list_flag construction needs the list name as string as first argument!"
196
+ );
197
+ inkAssert(
198
+ vals[1].type() == value_type::int32,
199
+ "list_flag construction needs the flag numeric value as second argument!"
200
+ );
201
+ list_flag entry = _list_table.get_list_id(vals[0].get<value_type::string>());
202
+ entry.flag = vals[1].get<value_type::int32>();
203
+ entry = _list_table.external_fvalue_to_internal(entry);
204
+ stack.push(value{}.set<value_type::list_flag>(entry));
205
+ }
206
+
207
+ int get_limit(const value& val, const list_table& lists)
208
+ {
209
+ if (val.type() == value_type::int32) {
210
+ return val.get<value_type::int32>();
211
+ } else {
212
+ inkAssert(val.type() == value_type::list_flag, "flag value must be a integer or a list_flag");
213
+ return lists.get_flag_value(val.get<value_type::list_flag>());
214
+ }
215
+ }
216
+
217
+ void operation<Command::LIST_RANGE, value_type::list, void>::operator()(
218
+ basic_eval_stack& stack, value* vals
219
+ )
220
+ {
221
+ inkAssert(vals[0].type() == value_type::list, "Can't get range of non list type!");
222
+ stack.push(value{}.set<value_type::list>(_list_table.range(
223
+ vals[0].get<value_type::list>(), get_limit(vals[1], _list_table),
224
+ get_limit(vals[2], _list_table)
225
+ )));
226
+ }
227
+
228
+ void convert_bools(value* vals, const list_table& lists, bool* res)
229
+ {
230
+ for (int i = 0; i < 2; ++i) {
231
+ switch (vals[i].type()) {
232
+ case value_type::list: res[i] = lists.to_bool(vals[i].get<value_type::list>()); break;
233
+ case value_type::list_flag:
234
+ res[i] = lists.to_bool(vals[i].get<value_type::list_flag>());
235
+ break;
236
+ default: res[i] = casting::numeric_cast<value_type::boolean>(vals[i]);
237
+ }
238
+ }
239
+ }
240
+
241
+ void operation<Command::AND, value_type::list, void>::operator()(
242
+ basic_eval_stack& stack, value* vals
243
+ )
244
+ {
245
+ bool res[2];
246
+ convert_bools(vals, _list_table, res);
247
+ stack.push(value{}.set<value_type::boolean>(res[0] && res[1]));
248
+ }
249
+
250
+ void operation<Command::AND, value_type::list_flag, void>::operator()(
251
+ basic_eval_stack& stack, value* vals
252
+ )
253
+ {
254
+ bool res[2];
255
+ convert_bools(vals, _list_table, res);
256
+ stack.push(value{}.set<value_type::boolean>(res[0] && res[1]));
257
+ }
258
+
259
+ void operation<Command::OR, value_type::list, void>::operator()(
260
+ basic_eval_stack& stack, value* vals
261
+ )
262
+ {
263
+ bool res[2];
264
+ convert_bools(vals, _list_table, res);
265
+ stack.push(value{}.set<value_type::boolean>(res[0] || res[1]));
266
+ }
267
+
268
+ void operation<Command::OR, value_type::list_flag, void>::operator()(
269
+ basic_eval_stack& stack, value* vals
270
+ )
271
+ {
272
+ bool res[2];
273
+ convert_bools(vals, _list_table, res);
274
+ stack.push(value{}.set<value_type::boolean>(res[0] || res[1]));
275
+ }
276
+ } // namespace ink::runtime::internal