inkcpp_rb 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
+ #pragma once
8
+
9
+ #include "system.h"
10
+ #include <string>
11
+ #include <vector>
12
+ #include <ostream>
13
+
14
+ namespace ink
15
+ {
16
+ namespace compiler
17
+ {
18
+ namespace internal
19
+ {
20
+ // Simple stream for writing data to an expanding binary stream in memory
21
+ class binary_stream
22
+ {
23
+ public:
24
+ binary_stream();
25
+ ~binary_stream();
26
+
27
+ // Writes an arbitrary type
28
+ template<typename T>
29
+ size_t write(const T& value)
30
+ {
31
+ return write((const byte_t*)&value, sizeof(T));
32
+ }
33
+
34
+ // Write a string plus a null terminator
35
+
36
+ // Writes data to the end of the stream
37
+ size_t write(const byte_t* data, size_t len);
38
+
39
+ // Writes the data in the buffer into another stream
40
+ void write_to(std::ostream& out) const;
41
+
42
+ // Gets the current position in memory of the write head
43
+ size_t pos() const;
44
+
45
+ template<typename T>
46
+ void set(size_t offset, const T& value)
47
+ {
48
+ set(offset, (const byte_t*)&value, sizeof(T));
49
+ }
50
+
51
+ // Writes data into an old position
52
+ void set(size_t offset, const byte_t* data, size_t len);
53
+
54
+ // reset to 0
55
+ void reset();
56
+
57
+ // read a byte from stream
58
+ byte_t get(size_t offset) const;
59
+
60
+ private:
61
+ // Size of a data slab. Whenever
62
+ // a slab runs out of data,
63
+ // a new slab is allocated.
64
+ const size_t DATA_SIZE = 256;
65
+
66
+ // Prior slabs
67
+ std::vector<byte_t*> _slabs;
68
+
69
+ // Current slab being written to
70
+ byte_t* _currentSlab = nullptr;
71
+
72
+ // Write head
73
+ byte_t* _ptr = nullptr;
74
+ };
75
+ template<>
76
+ size_t binary_stream::write(const std::string& value);
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,107 @@
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 "command.h"
8
+
9
+ namespace ink
10
+ {
11
+ // Command strings used by compiler
12
+ const char* CommandStrings[] = {
13
+ "inkcpp_STR",
14
+ "inkcpp_INT",
15
+ "inkcpp_BOOL",
16
+ "inkcpp_FLOAT",
17
+ "inkcpp_VALUE_POINTER",
18
+ "inkcpp_DIVERT_VAL",
19
+ "inkcpp_LIST",
20
+ "\n",
21
+ "<>",
22
+ "void",
23
+ "inkcpp_TAG",
24
+ "inkcpp_DIVERT",
25
+ "inkcpp_DIVERT_TO_VARIABLE",
26
+ "inkcpp_TUNNEL",
27
+ "inkcpp_FUNCTION",
28
+ "done",
29
+ "end",
30
+ "->->",
31
+ "~ret",
32
+
33
+ "inkcpp_DEFINE_TEMP",
34
+ "inkcpp_SET_VARIABLE",
35
+
36
+ "ev",
37
+ "/ev",
38
+ "out",
39
+ "pop",
40
+ "du",
41
+ "inkcpp_PUSH_VARIABLE_VALUE",
42
+ "visit",
43
+ "turn",
44
+ "inkcpp_READ_COUNT",
45
+ "seq",
46
+ "srnd",
47
+
48
+ "str",
49
+ "/str",
50
+ "#",
51
+ "/#",
52
+
53
+ "inkcpp_CHOICE",
54
+ "thread",
55
+
56
+ "range",
57
+
58
+ "+",
59
+ "-",
60
+ "/",
61
+ "*",
62
+ "%",
63
+ "rnd",
64
+ "==",
65
+ ">",
66
+ "<",
67
+ ">=",
68
+ "<=",
69
+ "!=",
70
+ "&&",
71
+ "||",
72
+ "MIN",
73
+ "MAX",
74
+ "?",
75
+ "!?",
76
+ "L^",
77
+ "listInt",
78
+
79
+ "!",
80
+ "~",
81
+ "LIST_COUNT",
82
+ "LIST_MIN",
83
+ "LIST_MAX",
84
+ "readc",
85
+ "turns",
86
+ "lrnd",
87
+ "FLOOR",
88
+ "CEILING",
89
+ "INT",
90
+ "LIST_ALL",
91
+ "LIST_INVERT",
92
+ "LIST_VALUE",
93
+ "choiceCnt",
94
+
95
+ "START_CONTAINER",
96
+ "END_CONTAINER",
97
+
98
+ "CALL_EXTERNAL"
99
+ };
100
+
101
+ template<unsigned A, unsigned B>
102
+ struct equal {
103
+ static_assert(A == B, "Not equal!");
104
+ };
105
+ equal<sizeof(CommandStrings) / sizeof(const char*), (int)(Command::NUM_COMMANDS)> dum;
106
+ static_assert(sizeof(CommandStrings) / sizeof(const char*) == (int)Command::NUM_COMMANDS, "CommandStrings list muss match Command enumeration");
107
+ }
@@ -0,0 +1,96 @@
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 "compiler.h"
8
+
9
+ #include "json_compiler.h"
10
+ #include "binary_emitter.h"
11
+
12
+ #include <fstream>
13
+
14
+ namespace ink::compiler
15
+ {
16
+ void run(const nlohmann::json& src, std::ostream& out, compilation_results* results)
17
+ {
18
+ using namespace internal;
19
+
20
+ // Create compiler and emitter
21
+ json_compiler compiler;
22
+ binary_emitter emitter;
23
+
24
+ // Compile into emitter
25
+ compiler.compile(src, &emitter, results);
26
+
27
+ // write emitter's results into the stream
28
+ emitter.output(out);
29
+ }
30
+
31
+ void run(const char* filenameIn, const char* filenameOut, compilation_results* results)
32
+ {
33
+ // Load JSON
34
+ nlohmann::json j;
35
+ std::ifstream fin(filenameIn);
36
+ fin >> j;
37
+
38
+ // Open output stream
39
+ std::ofstream fout(filenameOut, std::ios::binary | std::ios::out);
40
+
41
+ // Run compiler
42
+ ink::compiler::run(j, fout, results);
43
+
44
+ // Close file
45
+ fout.close();
46
+ }
47
+
48
+ void run(const char* filenameIn, std::ostream& out, compilation_results* results)
49
+ {
50
+ // Load JSON
51
+ nlohmann::json j;
52
+ std::ifstream fin(filenameIn);
53
+ fin >> j;
54
+
55
+ // Run compiler
56
+ ink::compiler::run(j, out, results);
57
+ }
58
+
59
+ void run(const nlohmann::json& j, const char* filenameOut, compilation_results* results)
60
+ {
61
+ // Open output stream
62
+ std::ofstream fout(filenameOut, std::ios::binary | std::ios::out);
63
+
64
+ // Run compiler
65
+ ink::compiler::run(j, fout, results);
66
+
67
+ // Close file
68
+ fout.close();
69
+ }
70
+
71
+ void run(std::istream& in, std::ostream& out, compilation_results* results)
72
+ {
73
+ // Load JSON
74
+ nlohmann::json j;
75
+ in >> j;
76
+
77
+ // Run compiler
78
+ ink::compiler::run(j, out, results);
79
+ }
80
+
81
+ void run(std::istream& in, const char* filenameOut, compilation_results* results)
82
+ {
83
+ // Load JSON
84
+ nlohmann::json j;
85
+ in >> j;
86
+
87
+ // Open output stream
88
+ std::ofstream fout(filenameOut, std::ios::binary | std::ios::out);
89
+
90
+ // Run compiler
91
+ ink::compiler::run(j, fout, results);
92
+
93
+ // Close file
94
+ fout.close();
95
+ }
96
+ } // namespace ink::compiler
@@ -0,0 +1,62 @@
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 "emitter.h"
8
+
9
+ namespace ink::compiler::internal
10
+ {
11
+ void emitter::start(int ink_version, compilation_results* results)
12
+ {
13
+ // store
14
+ _ink_version = ink_version;
15
+ set_results(results);
16
+
17
+ // reset
18
+ _container_map.clear();
19
+ _max_container_index = 0;
20
+
21
+ // initialize
22
+ initialize();
23
+ }
24
+
25
+ void emitter::finish(container_t max_container_index)
26
+ {
27
+ // store max index
28
+ _max_container_index = max_container_index;
29
+
30
+ // finalize
31
+ finalize();
32
+ }
33
+
34
+ void emitter::add_start_to_container_map(uint32_t offset, container_t index)
35
+ {
36
+ if (_container_map.rbegin() != _container_map.rend())
37
+ {
38
+ if (_container_map.rbegin()->first > offset)
39
+ {
40
+ warn() << "Container map written out of order. Wrote container at offset "
41
+ << offset << " after container with offset " << _container_map.rbegin()->first << std::flush;
42
+ }
43
+ }
44
+
45
+ _container_map.push_back(std::make_pair(offset, index));
46
+ setContainerIndex(index);
47
+ }
48
+
49
+ void emitter::add_end_to_container_map(uint32_t offset, container_t index)
50
+ {
51
+ if (_container_map.rbegin() != _container_map.rend())
52
+ {
53
+ if (_container_map.rbegin()->first > offset)
54
+ {
55
+ warn() << "Container map written out of order. Wrote container at offset "
56
+ << offset << " after container with offset " << _container_map.rbegin()->first << std::flush;
57
+ }
58
+ }
59
+
60
+ _container_map.push_back(std::make_pair(offset, index));
61
+ }
62
+ }
@@ -0,0 +1,104 @@
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 "command.h"
10
+ #include "system.h"
11
+ #include "reporter.h"
12
+ #include <string>
13
+ #include <vector>
14
+
15
+ namespace ink::compiler::internal
16
+ {
17
+ class list_data;
18
+
19
+ // Abstract base class for emitters which write ink commands to a file
20
+ class emitter : public reporter
21
+ {
22
+ public:
23
+ virtual ~emitter() { }
24
+
25
+ // starts up the emitter (and calls initialize)
26
+ void start(int ink_version, compilation_results* results = nullptr);
27
+
28
+ // tells the emitter compilation is done (and calls finalize)
29
+ void finish(container_t max_container_index);
30
+
31
+ // start a container
32
+ virtual uint32_t start_container(int index_in_parent, const std::string& name) = 0;
33
+
34
+ // ends a container
35
+ virtual uint32_t end_container() = 0;
36
+
37
+ // checks if _root contains a container named name to check
38
+ // if name is in valid internal function name
39
+ // @return number of arguments functions takes (arity)
40
+ // @retval -1 if the function was not found
41
+ virtual int function_container_arguments(const std::string& name) = 0;
42
+
43
+ // Writes a command with an optional payload
44
+ virtual void write_raw(Command command, CommandFlag flag = CommandFlag::NO_FLAGS, const char* payload = nullptr, ink::size_t payload_size = 0) = 0;
45
+
46
+ // Writes a command with a path as the payload
47
+ virtual void write_path(Command command, CommandFlag flag, const std::string& path, bool useCountIndex = false) = 0;
48
+
49
+ // Writes a command with a variable as the payload
50
+ virtual void write_variable(Command command, CommandFlag flag, const std::string& name) = 0;
51
+
52
+ // Writes a command with a string payload
53
+ virtual void write_string(Command command, CommandFlag flag, const std::string& string) = 0;
54
+
55
+ // write a command with a list payload
56
+ virtual void write_list(Command commmand, CommandFlag flag, const std::vector<list_flag>& list) = 0;
57
+
58
+ // Callback for nop commands
59
+ virtual void handle_nop(int index_in_parent) = 0;
60
+
61
+ // adds a fallthrough divert
62
+ virtual uint32_t fallthrough_divert() = 0;
63
+
64
+ // Patches a fallthrough divert at the given position to divert to the current position
65
+ virtual void patch_fallthroughs(uint32_t position) = 0;
66
+
67
+ // Adds a container start marker to the container map
68
+ void add_start_to_container_map(uint32_t offset, container_t index);
69
+
70
+ // Adds a container end marker to the container map
71
+ void add_end_to_container_map(uint32_t offset, container_t index);
72
+
73
+ // add list definitions
74
+ virtual void set_list_meta(const list_data& lists_defs) = 0;
75
+
76
+ // Helpers
77
+ template<typename T>
78
+ void write(Command command, const T& param, CommandFlag flag = CommandFlag::NO_FLAGS)
79
+ {
80
+ static_assert(sizeof(T) == 4, "Parameters must be 4 bytes long");
81
+ write_raw(command, flag, (const char*)(&param), sizeof(T));
82
+ }
83
+
84
+ protected:
85
+ // Initialize (clear state, get ready for a new file)
86
+ virtual void initialize() = 0;
87
+
88
+ // Finalize (do any post processing necessary)
89
+ virtual void finalize() = 0;
90
+
91
+ // Set container index for visit tracking
92
+ virtual void setContainerIndex(container_t index) = 0;
93
+
94
+ protected:
95
+ typedef std::vector<std::pair<uint32_t, container_t>> container_map;
96
+
97
+ // container map
98
+ container_map _container_map;
99
+ container_t _max_container_index;
100
+
101
+ // ink version
102
+ int _ink_version;
103
+ };
104
+ }
@@ -0,0 +1,22 @@
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 <vector>
10
+ #include <string>
11
+
12
+ namespace ink::compiler
13
+ {
14
+ /** list of errors/warnings */
15
+ typedef std::vector<std::string> error_list;
16
+
17
+ /** stores results from the compilation process */
18
+ struct compilation_results {
19
+ error_list warnings; ///< list of all warnings generated
20
+ error_list errors; ///< list of all errors generated
21
+ };
22
+ } // namespace ink::compiler
@@ -0,0 +1,44 @@
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 "config.h"
10
+ #ifdef INK_EXPOSE_JSON
11
+ # ifdef INK_ENABLE_UNREAL
12
+ # error Exposing JSON is not supported currently in UE
13
+ # endif
14
+ # include "../json.hpp"
15
+ #endif
16
+ #include "compilation_results.h"
17
+ #include <iostream>
18
+
19
+ namespace ink
20
+ {
21
+ /** collection of functions to compile a story.json to story.bin */
22
+ namespace compiler
23
+ {
24
+ /** file -> file */
25
+ void run(const char* filenameIn, const char* filenameOut, compilation_results* results = nullptr);
26
+
27
+ /** file -> stream */
28
+ void run(const char* filenameIn, std::ostream& out, compilation_results* results = nullptr);
29
+
30
+ #ifdef INK_EXPOSE_JSON
31
+ /** JSON -> file */
32
+ void run(const nlohmann::json&, const char* filenameOut, compilation_results* results = nullptr);
33
+
34
+ /** JSON -> stream */
35
+ void run(const nlohmann::json&, std::ostream& out, compilation_results* results = nullptr);
36
+ #endif
37
+
38
+ /** stream -> stream */
39
+ void run(std::istream& in, std::ostream& out, compilation_results* results = nullptr);
40
+
41
+ /** stream -> file */
42
+ void run(std::istream& in, const char* filenameOut, compilation_results* results = nullptr);
43
+ } // namespace compiler
44
+ } // namespace ink