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,393 @@
1
+ #ifndef _INKCPP_H
2
+ #define _INKCPP_H
3
+
4
+ #include <stdint.h>
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #else
9
+ typedef struct HInkSnapshot HInkSnapshot;
10
+ typedef struct HInkChoice HInkChoice;
11
+ typedef struct HInkList HInkList;
12
+ typedef struct InkListIter InkListIter;
13
+ typedef struct InkFlag InkFlag;
14
+ typedef struct InkValue InkValue;
15
+ typedef struct HInkRunner HInkRunner;
16
+ typedef struct HInkGlobals HInkGlobals;
17
+ typedef struct HInkSTory HInkStory;
18
+ #endif
19
+
20
+ /** @defgroup clib Clib Interface
21
+ * C bindings for inkcpp
22
+ *
23
+ * There are two different ways to get the C bindings.
24
+ * 1. Use the distributed `<os>-lib.zip` for a C++ and C lib combined, then use CMake for the
25
+ * linkadge (or do it manually)
26
+ * 2. Use the distrubuted `<os>-clib.zip` for a C only lib, then use CMake, or pkg-config.
27
+ *
28
+ * Please note that the included header is different between this two installation methods.
29
+ * 1. `#include <ink/c/inkcpp.h>`
30
+ * 2. `#include <ink/inkcpp.h>`
31
+ *
32
+ * @section example_c Example
33
+ *
34
+ * To setup an example for option `1.` and `2.` if you use cmake checkout @ref cmake and replace
35
+ * `target_link_libraries` with `target_link_libraries(main inkcpp_c)` The story and source file
36
+ * can be used as @ref src_main_c "noted down"
37
+ *
38
+ * For setup an example for option `2.` without cmake create a directory with the files below:
39
+ * + `main.c`: found below
40
+ * + `test.ink.json`: found at @ref src_story_json
41
+ *
42
+ * And extract `<os>-clib.zip` from the [release
43
+ * page](https://github.com/JBenda/inkcpp/releases/latest) to `/MY/INKCPP/EXAMPLE_INSTALL/PATH`.
44
+ * <br/> To run the example do the following:
45
+ *
46
+ * + change the `prefix=...` in `/MY/INKCPP/EXAMPLE_INSTALL/PATH/lib/pkgconfig/inkcpp.pc`
47
+ * to `prefix=/MY/INKCPP_EXAMPLE_INSTALL_PATH/`
48
+ * + `export PKG_CONFIG_PATH=/MY/INKCPP/EXAMPLE_INSTALL/PATH/lib/pkgconfig`
49
+ * + `gcc -c main.c $(pkg-config --cflags inkcpp)`
50
+ * + `g++ -o main main.o $(pkg-config --libs inkcpp)`
51
+ * + `./main`
52
+ *
53
+ * As a sideproduct a file named `test.bin` should be created coaining the binary format used by
54
+ * inkCPP.
55
+ *
56
+ * @subsection src_main_c main.c
57
+ * @include cmake_example/main.c
58
+ */
59
+
60
+ /** @class HInkSnapshot
61
+ * @ingroup clib
62
+ * @brief Handler for a @ref ink::runtime::snapshot "ink snapshot"
63
+ * @copydetails ink::runtime::snapshot
64
+ */
65
+ struct HInkSnapshot;
66
+ /** @memberof HInkSnapshot
67
+ * @copydoc ink::runtime::snapshot::from_file()
68
+ */
69
+ HInkSnapshot* ink_snapshot_from_file(const char* filename);
70
+ /** @memberof HInkSnapshot
71
+ * @copydoc ink::runtime::snapshot::num_runners()
72
+ * @param self
73
+ */
74
+ int ink_snapshot_num_runners(const HInkSnapshot* self);
75
+ /** @memberof HInkSnapshot
76
+ * @copydoc ink::runtime::snapshot::write_to_file()
77
+ * @param self
78
+ */
79
+ void ink_snapshot_write_to_file(const HInkSnapshot* self, const char* filename);
80
+
81
+ /** @class HInkChoice
82
+ * @ingroup clib
83
+ * @brief Handler for a @ref ink::runtime::choice "ink choice"
84
+ * @copydetails ink::runtime::choice
85
+ */
86
+ struct HInkChoice;
87
+ /** @memberof HInkChoice
88
+ * @copydoc ink::runtime::choice::text
89
+ * @param self
90
+ */
91
+ const char* ink_choice_text(const HInkChoice* self);
92
+ /** @memberof HInkChoice
93
+ * @copydoc ink::runtime::choice::num_tags
94
+ * @param self
95
+ */
96
+ int ink_choice_num_tags(const HInkChoice* self);
97
+ /** @memberof HInkChoice
98
+ * @copydoc ink::runtime::choice::get_tag
99
+ * @param self
100
+ */
101
+ const char* ink_choice_get_tag(const HInkChoice* self, int index);
102
+
103
+ /** @class HInkList
104
+ * @ingroup clib
105
+ * @brief Handler for a @ref ink::runtime::list_interface "ink list"
106
+ */
107
+ struct HInkList;
108
+
109
+ /**
110
+ * Iterater used to iterate flags of a ::HInkList
111
+ * @see ink_list_flags() ink_list_flags_from()
112
+ * @ingroup clib
113
+ * @code
114
+ * const HInkList* list = ...;
115
+ * InkListIter iter;
116
+ * if (ink_list_flags(list, &iter)) {
117
+ * do {
118
+ * iter->flag_name;
119
+ * iter->list_name;
120
+ * // ...
121
+ * } while(ink_list_iter_next(&iter));
122
+ * }
123
+ * @endcode
124
+ */
125
+ struct InkListIter {
126
+ const void* _data; ///< @private
127
+ int _i; ///< @private
128
+ int _single_list; ///< @private
129
+ const char* flag_name; ///< Name of the current flag
130
+ const char* list_name; ///< name of the list the flag corresponds to
131
+ };
132
+
133
+ void ink_list_add(HInkList* self, const char* flag_name);
134
+ void ink_list_remove(HInkList* self, const char* flag_name);
135
+ int ink_list_contains(const HInkList* self, const char* flag_name);
136
+ /**
137
+ * @memberof HInkList
138
+ * Creates an Iterator over all flags contained in a list.
139
+ * @see @ref InkListIter for a usage example
140
+ * @retval 0 if the list contains no flags and the iterator would be invalid
141
+ */
142
+ int ink_list_flags(const HInkList* self, InkListIter* iter);
143
+ /**
144
+ * @memberof HInkList
145
+ * Creates an Iterator over all flags contained in a list assziated with a defined list.
146
+ * @see @ref InkListIter for a usage example
147
+ * @param self
148
+ * @param list_name name of defined list which elements should be filterd
149
+ * @param[out] iter constructed iterator
150
+ * @retval 0 if the list contains no flags and the iterator would be invalid
151
+ */
152
+ int ink_list_flags_from(const HInkList* self, const char* list_name, InkListIter* iter);
153
+ /**
154
+ * @memberof InkListIter
155
+ * @retval 0 if the there is no next element
156
+ * @retval 1 if a new flag can be found in iter.flag_name
157
+ */
158
+ int ink_list_iter_next(InkListIter* self);
159
+
160
+ /** Repserentation of a ink variable.
161
+ * @ingroup clib
162
+ * The concret type contained is noted in @ref InkValue::type "type", please use this information
163
+ * to access the corresponding field of the union
164
+ * @attention a InkValue of type @ref InkValue::Type::ValueTypeNone "ValueTypeNone" dose not
165
+ * contain any value! It is use e.g. at @ref HInkGlobals::ink_globals_get() "ink_globals_get()"
166
+ */
167
+ struct InkValue {
168
+ union {
169
+ int bool_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeBool "ValueTypeBool"
170
+ uint32_t uint32_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeUint32
171
+ ///< "ValueTypeUint32"
172
+ int32_t int32_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeInt32
173
+ ///< "ValueTypeInt32"
174
+ const char* string_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeString
175
+ ///< "ValueTypeString"
176
+ float float_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeFloat
177
+ ///< "ValueTypeFloat"
178
+ HInkList*
179
+ list_v; ///< contains value if #type == @ref InkValue::Type::ValueTypeList "ValueTypeList"
180
+ };
181
+
182
+ /// indicates which type is contained in the value
183
+ enum Type {
184
+ ValueTypeNone, ///< the Value does not contain any value
185
+ ValueTypeBool, ///< a boolean
186
+ ValueTypeUint32, ///< a unsigned integer
187
+ ValueTypeInt32, ///< a signed integer
188
+ ValueTypeString, ///< a string
189
+ ValueTypeFloat, ///< a floating point number
190
+ ValueTypeList ///< a ink list
191
+ } type; ///< indicates type contained in value
192
+ };
193
+
194
+ // const char* ink_value_to_string(const InkValue* self);
195
+
196
+ /** @memberof HInkRunner
197
+ * Callback for a Ink external function which returns void
198
+ * @param argc number of arguments
199
+ * @param argv array containing the arguments
200
+ */
201
+ typedef InkValue (*InkExternalFunction)(int argc, const InkValue argv[]);
202
+ /** @memberof HInkRunner
203
+ * Callback for a Ink external function wihich returns a value
204
+ * @param argc number of arguments
205
+ * @param argv array contaning the arguments
206
+ * @return value to be furthe process by the ink runtime
207
+ */
208
+ typedef void (*InkExternalFunctionVoid)(int argc, const InkValue argv[]);
209
+
210
+ /** @class HInkRunner
211
+ * @ingroup clib
212
+ * A handle for an @ref ink::runtime::runner_interface "ink runner"
213
+ * @copydetails ink::runtime::runner_interface
214
+ */
215
+ struct HInkRunner;
216
+ /** @memberof HInkRunner
217
+ * Deconstructs the Runner and all frees assoziated resources
218
+ */
219
+ void ink_runner_delete(HInkRunner* self);
220
+ /** @memberof HInkRunner
221
+ * Creates a snapshot, for later reloading.
222
+ * @attention All runners assoziated with the same globals will create the same snapshot
223
+ * @ref ::HInkSnapshot
224
+ */
225
+ HInkSnapshot* ink_runner_create_snapshot(const HInkRunner* self);
226
+ /** @memberof HInkRunner
227
+ * @copydoc ink::runtime::runner_interface::can_continue()
228
+ */
229
+ int ink_runner_can_continue(const HInkRunner* self);
230
+ /** @memberof HInkRunner
231
+ * @copydoc ink::runtime::runner_interface::getline_alloc()
232
+ */
233
+ const char* ink_runner_get_line(HInkRunner* self);
234
+ /** @memberof HInkRunner
235
+ * @copydoc ink::runtime::runner_interface::num_tags()
236
+ */
237
+ int ink_runner_num_tags(const HInkRunner* self);
238
+ /** @memberof HInkRunner
239
+ * @copydoc ink::runtime::runner_interface::get_tag()
240
+ * @param self
241
+ */
242
+ const char* ink_runner_tag(const HInkRunner* self, int index);
243
+ /** @memberof HInkRunner
244
+ * @copydoc ink::runtime::runner_interface::num_choices()
245
+ * @param self
246
+ */
247
+ int ink_runner_num_choices(const HInkRunner* self);
248
+ /** @memberof HInkRunner
249
+ * @copydoc ink::runtime::runner_interface::get_choice()
250
+ * @param self
251
+ */
252
+ const HInkChoice* ink_runner_get_choice(const HInkRunner* self, int index);
253
+ /** @memberof HInkRunner
254
+ * @copydoc ink::runtime::runner_interface::choose()
255
+ * @param self
256
+ */
257
+ void ink_runner_choose(HInkRunner* self, int index);
258
+
259
+ /** @memberof HInkRunner
260
+ * Binds a external function which is called form the runtime, with no return value.
261
+ * @see ink_runner_bind()
262
+ * @param self
263
+ * @param function_name declared in ink script
264
+ * @param callback
265
+ * @param lookaheadSafe if false stop glue lookahead if encounter this function
266
+ * this prevents double execution of external functions but can lead to
267
+ * missing glues
268
+ */
269
+ void ink_runner_bind_void(
270
+ HInkRunner* self, const char* function_name, InkExternalFunctionVoid callback,
271
+ int lookaheadSafe
272
+ );
273
+ /** @memberof HInkRunner
274
+ * Binds a external function which is called from the runtime, with a return vallue.
275
+ * @see ink_runner_bind_void()
276
+ * @param self
277
+ * @param function_name name of external function declared inside ink script
278
+ * @param callback
279
+ * @param lookaheadSafe if false stop glue lookahead if encounter this function
280
+ * this prevents double execution of external functions but can lead to
281
+ * missing glues
282
+ */
283
+ void ink_runner_bind(
284
+ HInkRunner* self, const char* function_name, InkExternalFunction callback, int lookaheadSafe
285
+ );
286
+
287
+
288
+ /** @class HInkGlobals
289
+ * @ingroup clib
290
+ * Handle for the @ref ink::runtime::globals_interface "global variable store" shared among ink
291
+ * runners.
292
+ * @copydetails ink::runtime::globals_interface
293
+ */
294
+ struct HInkGlobals;
295
+ /** @memberof HInkGlobals
296
+ * @param new_value contains the value newly assigned
297
+ * @param old_value contains the previous value or a @ref InkValue::Type::ValueTypeNone
298
+ * "ValueTypeNone" if the variable was previously unset.
299
+ */
300
+ typedef void (*InkObserver)(InkValue new_value, InkValue old_value);
301
+ /** @memberof HInkGlobals
302
+ * Deconstructs the globals store and frees all assoziated memories.
303
+ * @attention invalidates all assoziated @ref HInkRunner
304
+ */
305
+ void ink_globals_delete(HInkGlobals* self);
306
+ /** @memberof HInkGlobals
307
+ * Creates a snapshot for later reloading.
308
+ * @attention All runners assoziated with the same globals will create the same snapshot.
309
+ * @ref ::HInkSnapshot
310
+ */
311
+ HInkSnapshot* ink_globals_create_snapshot(const HInkGlobals* self);
312
+ /** @memberof HInkGlobals
313
+ * assignes a observer to the variable with the corresponding name.
314
+ * The observer is called each time the value of the variable gets assigned.
315
+ * To monitor value changes compare the old with new value (see @ref InkObserver)
316
+ */
317
+ void ink_globals_observe(HInkGlobals* self, const char* variable_name, InkObserver observer);
318
+ /** @memberof HInkGlobals
319
+ * Gets the value of a global variable
320
+ * @param variable_name name of variable (same as in ink script)
321
+ * @param self
322
+ * @retval InkValue::Type::ValueTypeNone iff the variable does not exist
323
+ */
324
+ InkValue ink_globals_get(const HInkGlobals* self, const char* variable_name);
325
+ /** @memberof HInkGlobals
326
+ * Sets the value of a globals variable.
327
+ * @param variable_name name of variable (same as in ink script)
328
+ * @param self
329
+ * @param value
330
+ * @return false if the variable was not set, because the variable with this name does no exists
331
+ * or the value did not match.
332
+ */
333
+ int ink_globals_set(HInkGlobals* self, const char* variable_name, InkValue value);
334
+
335
+ /** @class HInkStory
336
+ * @ingroup clib
337
+ * Handle for a loaded @ref ink::runtime::story "ink story"
338
+ * @copydetails ink::runtime::story
339
+ * @see HInkGlobals
340
+ * @see HInkRunner
341
+ */
342
+ struct HInkStory;
343
+ /** @memberof HInkStory
344
+ * @copydoc ink::runtime::story::from_file
345
+ */
346
+ HInkStory* ink_story_from_file(const char* filename);
347
+ /** @memberof HInkStory
348
+ * deletes a story and all assoziated resources
349
+ * @param self
350
+ * @attention this will invalidate all ::HInkRunner and ::HInkGlobals handles assoziated with this
351
+ * story
352
+ */
353
+ void ink_story_delete(HInkStory* self);
354
+ /** @memberof HInkStory
355
+ * @copydoc ink::runtime::story::new_globals
356
+ * @param self
357
+ */
358
+ HInkGlobals* ink_story_new_globals(HInkStory* self);
359
+ /** @memberof HInkStory
360
+ * @copydoc ink::runtime::story::new_runner
361
+ * @param self
362
+ */
363
+ HInkRunner* ink_story_new_runner(HInkStory* self, HInkGlobals* store);
364
+ /** @memberof HInkStory
365
+ * @copydoc ink::runtime::story::new_globals_from_snapshot
366
+ * @param self
367
+ */
368
+ HInkGlobals* ink_story_new_globals_from_snapshot(HInkStory* self, const HInkSnapshot* obj);
369
+ /** @memberof HInkStory
370
+ * @copydoc ink::runtime::story::new_runner_from_snapshot
371
+ * @param self
372
+ */
373
+ HInkRunner* ink_story_new_runner_from_snapshot(
374
+ HInkStory* self, const HInkSnapshot* obj, HInkGlobals* store, int runner_id
375
+ );
376
+
377
+ /**
378
+ * @ingroup clib
379
+ * Compiles a .ink.json file to an inkCPP .bin file.
380
+ * @param input_filename path to file contaning input data (.ink.json)
381
+ * @param output_filename path to file output data will be written (.bin)
382
+ * @param error if not NULL will contain a error message if an error occures (else will be set to
383
+ * NULL)
384
+ */
385
+ void
386
+ ink_compile_json(const char* input_filename, const char* output_filename, const char** error);
387
+
388
+
389
+ #ifdef __cplusplus
390
+ }
391
+ #endif
392
+
393
+ #endif