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,321 @@
1
+ #include <iostream>
2
+ #include <rice/rice.hpp>
3
+ #include <rice/stl.hpp>
4
+
5
+ #include <ink/story.h>
6
+ #include <ink/choice.h>
7
+ #include <ink/snapshot.h>
8
+ #include <ink/globals.h>
9
+ #include <ink/runner.h>
10
+ #include <ink/types.h>
11
+ #include <ink/compiler.h>
12
+ #include <ink/list.h>
13
+ #include <ink/compilation_results.h>
14
+
15
+ using namespace Rice;
16
+ using runner = ink::runtime::runner_interface;
17
+ using runner_ptr = ink::runtime::runner;
18
+ using globals = ink::runtime::globals_interface;
19
+ using globals_ptr = ink::runtime::globals;
20
+ using story = ink::runtime::story;
21
+ using story_ptr = ink::runtime::story_ptr<globals>;
22
+ using choice = ink::runtime::choice;
23
+ using value = ink::runtime::value;
24
+ using list = ink::runtime::list_interface;
25
+ using snapshot = ink::runtime::snapshot;
26
+ //TODO: probably should be a shared pointer / smart pointer
27
+ using bound_func = std::function<value(std::vector<value>&)>;
28
+
29
+ namespace Rice::detail
30
+ {
31
+ template<>
32
+ struct Type<bound_func*>
33
+ {
34
+ static bool verify()
35
+ {
36
+ return true;
37
+ }
38
+ };
39
+
40
+ template<>
41
+ class From_Ruby<bound_func*>
42
+ {
43
+ public:
44
+ From_Ruby() = default;
45
+
46
+ explicit From_Ruby(Arg* arg) : arg_(arg)
47
+ {
48
+ }
49
+
50
+ bool is_convertible(VALUE value)
51
+ {
52
+ return rb_obj_is_proc(value) == RUBY_Qtrue;
53
+ }
54
+
55
+ bound_func* convert(VALUE lambda)
56
+ {
57
+ VALUE check = detail::protect(rb_obj_is_proc, lambda);
58
+ if(check != RUBY_Qtrue){
59
+ throw std::runtime_error("Object is not convertible");
60
+ }
61
+ bound_func * result = new bound_func([lambda](std::vector<value> & args) {
62
+ detail::To_Ruby<value> to_convertor;
63
+ VALUE ary = rb_ary_new2(args.size());
64
+ for(value v: args) {
65
+ rb_ary_push(ary, to_convertor.convert(v));
66
+ }
67
+ VALUE v = rb_proc_call(lambda, ary);
68
+ detail::From_Ruby<value> from_convertor;
69
+ switch(TYPE(v)) {
70
+ case T_FIXNUM:
71
+ return value((int32_t)NUM2INT(v));
72
+ case T_FLOAT:
73
+ return value((float)RFLOAT_VALUE(v));
74
+ case T_STRING:
75
+ return value(StringValueCStr(v));
76
+ case T_OBJECT:
77
+ if(from_convertor.is_convertible(v)) {
78
+ value result = from_convertor.convert(v);
79
+ return result;
80
+ } else {
81
+ const char * str = rb_string_value_cstr(&v);
82
+ if(str != NULL) {
83
+ return value(str);
84
+ } else {
85
+ return value(RB_TEST(v));
86
+ }
87
+ }
88
+ }
89
+ throw std::runtime_error("Result must be a valid ink value type");
90
+ });
91
+ return result;
92
+ }
93
+
94
+ private:
95
+ Arg* arg_ = nullptr;
96
+ };
97
+ }
98
+
99
+
100
+ std::string list_to_str(const list& list)
101
+ {
102
+ std::stringstream out;
103
+ out << "[";
104
+ bool first = true;
105
+ for (const auto& flag : list) {
106
+ if (first) {
107
+ first = false;
108
+ } else {
109
+ out << ", ";
110
+ }
111
+ out << flag;
112
+ }
113
+ out << "]";
114
+ return out.str();
115
+ }
116
+
117
+ extern "C"
118
+ void Init_inkcpp_rb() {
119
+ Rice::Module rb_mInk = define_module("Ink");
120
+ rb_mInk.const_set(Rice::Identifier("VERSION"), Rice::String("0.1.0"));
121
+
122
+ Data_Type<ink::compiler::compilation_results> rb_cCompilationResults = define_class_under<ink::compiler::compilation_results>(rb_mInk, "CompilationResults")
123
+ .define_method("warnings", [](ink::compiler::compilation_results &results) {
124
+ return results.warnings;
125
+ }, Return().takeOwnership())
126
+ .define_method("errors", [](ink::compiler::compilation_results &results) {
127
+ return results.errors;
128
+ }, Return().takeOwnership());
129
+ rb_mInk.define_singleton_function("compile_file", [](std::string &in_file, std::string &out_file) {
130
+ ink::compiler::compilation_results * results = new ink::compiler::compilation_results();
131
+ ink::compiler::run(in_file.c_str(), out_file.c_str(), results);
132
+ return results;
133
+ }, Return().takeOwnership())
134
+ .define_singleton_function("compile_json", [](std::string &in_stream) {
135
+ std::istringstream istream(in_stream);
136
+ std::ostringstream ostream;
137
+ ink::compiler::compilation_results * results = new ink::compiler::compilation_results();
138
+ ink::compiler::run(istream, ostream, results);
139
+ delete results;
140
+ return ostream.str();
141
+ }, Return().takeOwnership());
142
+ Data_Type<choice> rb_cChoice = define_class_under<choice>(rb_mInk, "Choice")
143
+ .define_method("index", &choice::index)
144
+ .define_method("text", &choice::text)
145
+ .define_method("has_tags", &choice::has_tags)
146
+ .define_method("num_tags", &choice::num_tags)
147
+ .define_method("get_tag", &choice::get_tag);
148
+ Data_Type<snapshot> rb_cSnapshot = define_class_under<snapshot>(rb_mInk, "Snapshot")
149
+ .define_singleton_method("from_binary", [](const std::string & data){
150
+ return snapshot::from_binary((const unsigned char *)data.c_str(), data.length(), false);
151
+ }, Return().takeOwnership())
152
+ .define_singleton_method("from_file", &snapshot::from_file, Return().takeOwnership())
153
+ .define_method("get_data", &snapshot::get_data)
154
+ .define_method("get_data_len", &snapshot::get_data_len)
155
+ .define_method("num_runners", &snapshot::num_runners)
156
+ .define_method("write_to_file", &snapshot::write_to_file);
157
+ Data_Type<runner> rb_cRunner = define_class_under<runner>(rb_mInk, "Runner")
158
+ .define_method("set_rng_seed", &runner::set_rng_seed)
159
+ .define_method("can_continue", &runner::can_continue)
160
+ .define_method("choose", &runner::choose)
161
+ .define_method("has_tags", &runner::has_tags)
162
+ .define_method("num_tags", &runner::num_tags)
163
+ .define_method("num_choices", &runner::num_choices)
164
+ .define_method("get_tag", &runner::get_tag)
165
+ .define_method("move_to", [](runner &self, std::string &path) {
166
+ return self.move_to(ink::hash_string(path.c_str()));
167
+ })
168
+ .define_method("getline", [](runner &self) {
169
+ return self.getline();
170
+ }, Return().takeOwnership())
171
+ .define_method("create_snapshot", &runner::create_snapshot, Return().takeOwnership())
172
+ .define_method("getall", [](runner &self){
173
+ return self.getall();
174
+ }, Return().takeOwnership())
175
+ .define_iterator(&runner::begin, &runner::end, "each_choice")
176
+ .define_method("get_choice", &runner::get_choice)
177
+ .define_method("bind_void", [](runner &self, std::string &function_name, bound_func * callback, bool lookahead_safe){
178
+ self.bind(function_name.c_str(), [callback](size_t len, const value* vals) {
179
+ std::vector args(vals, vals + len);
180
+ return (*callback)(args);
181
+ }, lookahead_safe);
182
+ })
183
+ .define_method("bind", [](runner &self, std::string &function_name, bound_func * callback, bool lookahead_safe){
184
+ self.bind(function_name.c_str(), [callback](size_t len, const value* vals) {
185
+ std::vector args(vals, vals + len);
186
+ return (*callback)(args);
187
+ }, lookahead_safe);
188
+ }, Arg("function_name"), Arg("callback"), Arg("lookahead_safe") = false);
189
+ Data_Type<runner_ptr> rb_cRunnerImpl = define_class_under<runner_ptr>(rb_mInk, "RunnerImpl")
190
+ .define_method("get", [](runner_ptr &self) {
191
+ return self.get();
192
+ });
193
+
194
+ Data_Type<list::iterator::Flag> rb_cFlag = define_class_under<list::iterator::Flag>(rb_mInk, "Flag")
195
+ .define_attr("name", &list::iterator::Flag::flag_name, AttrAccess::Read)
196
+ .define_attr("list_name", &list::iterator::Flag::list_name, AttrAccess::Read);
197
+ list::iterator (list::*begin_ptr)() const = &list::begin;
198
+ list::iterator (list::*end_ptr)() const = &list::end;
199
+ Data_Type<list> rb_cList = define_class_under<list>(rb_mInk, "List")
200
+ .define_method("add", &list::add)
201
+ .define_method("remove", &list::remove)
202
+ .define_method("contains", &list::contains)
203
+ .define_method("to_s", &list_to_str, Return().takeOwnership())
204
+ .define_method("flags_from", [](list &self, std::string & list_name) {
205
+ std::vector<list::iterator::Flag> result;
206
+ for (list::iterator it = self.begin(list_name.c_str()); it != self.end(); ++it) {
207
+ result.push_back(*it);
208
+ }
209
+ return result;
210
+ }, Return().takeOwnership())
211
+ .define_method("to_vec", [](list &self) {
212
+ std::vector<list::iterator::Flag> result;
213
+ for (const auto& flag : self) {
214
+ result.push_back(flag);
215
+ }
216
+ return result;
217
+ }, Return().takeOwnership());
218
+ // Include enumerable support
219
+
220
+
221
+ Enum<value::Type> rb_cValueType = define_enum<value::Type>("ValueType", rb_mInk)
222
+ .define_value("INT32", value::Type::Int32)
223
+ .define_value("FLOAT", value::Type::Float)
224
+ .define_value("UINT32", value::Type::Uint32)
225
+ .define_value("STRING", value::Type::String)
226
+ .define_value("LIST", value::Type::List)
227
+ .define_value("BOOL", value::Type::Bool);
228
+ Data_Type<value> rb_cValue = define_class_under<value>(rb_mInk, "Value")
229
+ .define_singleton_function("from_int", [](int32_t num){
230
+ return value(num);
231
+ })
232
+ .define_singleton_function("from_bool", [](bool b){
233
+ return value(b);
234
+ })
235
+ .define_singleton_function("from_float", [](float f) {
236
+ return value(f);
237
+ })
238
+ .define_singleton_function("from_string", [](std::string & s) {
239
+ return value(s.c_str());
240
+ })
241
+ .define_singleton_function("from_uint", [](uint32_t num) {
242
+ return value(num);
243
+ })
244
+ .define_singleton_function("from_list", [](list & l) {
245
+ return value(&l);
246
+ })
247
+ .define_singleton_function("from_value", [](value & v) {
248
+ return value(v);
249
+ })
250
+ .define_attr("type", &value::type, Rice::AttrAccess::Read)
251
+ .define_method("to_s", [](value &self) {
252
+ switch(self.type) {
253
+ case value::Type::Bool: return std::string(self.get<value::Type::Bool>() ? "true" : "false");
254
+ case value::Type::Uint32: return std::to_string(self.get<value::Type::Uint32>());
255
+ case value::Type::Int32: return std::to_string(self.get<value::Type::Int32>());
256
+ case value::Type::String: return std::string(self.get<value::Type::String>());
257
+ case value::Type::Float: return std::to_string(self.get<value::Type::Float>());
258
+ case value::Type::List: {
259
+ return list_to_str(*self.get<value::Type::List>());
260
+ }
261
+ }
262
+ throw std::runtime_error("value is in an invalid state");
263
+ })
264
+ .define_method("to_i", [](value &self) {
265
+ switch(self.type) {
266
+ case value::Type::Bool: return int64_t(self.get<value::Type::Bool>() ? 1 : 0);
267
+ case value::Type::Uint32: return int64_t(self.get<value::Type::Uint32>());
268
+ case value::Type::Int32: return int64_t(self.get<value::Type::Int32>());
269
+ case value::Type::String: return (int64_t) 0;
270
+ case value::Type::Float: return int64_t (round(self.get<value::Type::Float>()));
271
+ case value::Type::List: return (int64_t) 0;
272
+ }
273
+ throw std::runtime_error("value is in an invalid state");
274
+ })
275
+ .define_method("to_f", [](value &self) {
276
+ switch(self.type) {
277
+ case value::Type::Bool: return double(self.get<value::Type::Bool>() ? 1 : 0);
278
+ case value::Type::Uint32: return double(self.get<value::Type::Uint32>());
279
+ case value::Type::Int32: return double(self.get<value::Type::Int32>());
280
+ case value::Type::String: return (double) 0;
281
+ case value::Type::Float: return double (self.get<value::Type::Float>());
282
+ case value::Type::List: return (double) 0;
283
+ }
284
+ throw std::runtime_error("value is in an invalid state");
285
+ })
286
+ .define_method("to_list", [](value &self) {
287
+ if(self.type != value::Type::List) {
288
+ throw std::runtime_error("Not a list");
289
+ }
290
+ return self.get<value::Type::List>();
291
+ });
292
+ Data_Type<globals> rb_cGlobals = define_class_under<globals>(rb_mInk, "Globals")
293
+ .define_method("[]", [](globals &self, std::string &key) {
294
+ const char * k = key.c_str();
295
+ auto res = self.get<value>(k);
296
+ if(!res.has_value()) {
297
+ throw std::runtime_error("No value");
298
+ }
299
+ return res.value();
300
+ })
301
+ .define_method("[]=", [](globals &self, std::string &key, value &value) {
302
+ const char * k = key.c_str();
303
+ if(!self.set(k, value)) {
304
+ throw std::runtime_error("Could not set");
305
+ }
306
+ });
307
+
308
+ Data_Type<story_ptr> rb_cStoryImpl = define_class_under<story_ptr>(rb_mInk, "StoryImpl")
309
+ .define_method("get", [](story_ptr &self) {
310
+ return self.get();
311
+ });
312
+ Data_Type<story> rb_cStory = define_class_under<story>(rb_mInk, "Story")
313
+ .define_singleton_function("from_file", &story::from_file, Return().takeOwnership())
314
+ .define_singleton_function("from_binary", [](std::string &data) {
315
+ return story::from_binary((unsigned char *) data.c_str(), data.length(), false);
316
+ }, Return().takeOwnership())
317
+ .define_method("new_globals", &story::new_globals, Return().takeOwnership())
318
+ .define_method("new_runner", &story::new_runner, Arg("globals") = (story_ptr) nullptr, Return().takeOwnership())
319
+ .define_method("new_globals_from_snapshot", &story::new_globals_from_snapshot, Return().takeOwnership())
320
+ .define_method("new_runner_from_snapshot", &story::new_runner_from_snapshot, Arg("snapshot"), Arg("globals") = (story_ptr) nullptr, Arg("idx"), Return().takeOwnership());
321
+ }
data/inkcpp_rb.gemspec ADDED
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "inkcpp_rb"
5
+ spec.version = "0.1.0"
6
+ spec.authors = ["Chris Zelenak"]
7
+ spec.email = ["chris@zelenak.me"]
8
+ spec.licenses = ["MIT"]
9
+
10
+ spec.summary = "inkcpp bindings in Ruby"
11
+ spec.description = "inkcpp bindings in Ruby"
12
+ spec.homepage = "https://git.sr.ht/~netshade/inkcpp_rb"
13
+ spec.required_ruby_version = ">= 2.6.0"
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://git.sr.ht/~netshade/inkcpp_rb"
19
+ spec.metadata["changelog_uri"] = "https://git.sr.ht/~netshade/inkcpp_rb/tree/main/item/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ submodules = %w{inkcpp}
24
+ submodule_files = submodules.flat_map do |module_name|
25
+ base_submodule_path = File.join("ext", "inkcpp_rb", module_name)
26
+ submodule_path = File.join(File.expand_path(__dir__), base_submodule_path)
27
+ Dir.chdir(submodule_path) do
28
+ files = `git ls-files -z`.split("\x0").map { |module_file| File.join(base_submodule_path, module_file) }
29
+ raise "Submodule not checked out" if files.empty?
30
+ files
31
+ end
32
+ end
33
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
+ `git ls-files -z`.split("\x0").reject do |f|
35
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
36
+ end
37
+ end + submodule_files
38
+ spec.bindir = "exe"
39
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
40
+ spec.require_paths = ["lib"]
41
+ spec.extensions = ["ext/inkcpp_rb/extconf.rb"]
42
+
43
+ # Uncomment to register a new dependency of your gem
44
+ # spec.add_dependency "example-gem", "~> 1.0"
45
+ spec.add_development_dependency "rake-compiler", "~> 1.2.8"
46
+ spec.add_development_dependency "rice", "~> 4.3.3"
47
+ spec.add_development_dependency "sorbet", "~> 0.5.0"
48
+ spec.add_development_dependency "sorbet-runtime", "~> 0.5.0"
49
+ spec.add_development_dependency "tapioca", "~> 0.16.0"
50
+ spec.add_development_dependency "debug", "~> 1.1.0"
51
+
52
+ # For more information and examples about making a new gem, check out our
53
+ # guide at: https://bundler.io/guides/creating_gem.html
54
+ end
data/rbi/inkcpp_rb.rbi ADDED
@@ -0,0 +1,211 @@
1
+ # typed: strict
2
+
3
+ module Ink
4
+ class CompilationResults
5
+ sig { returns(T.untyped) }
6
+ def warnings; end
7
+
8
+ sig { returns(T.untyped) }
9
+ def errors; end
10
+ end
11
+
12
+ sig { params(in_file: String, out_file: String).returns(Ink::CompilationResults)}
13
+ def self.compile_file(in_file, out_file); end
14
+
15
+ sig { params(in_json: String).returns(String) }
16
+ def self.compile_json(in_json); end
17
+
18
+ class Flag
19
+ sig { returns(String) }
20
+ def name; end
21
+
22
+ sig { returns(String) }
23
+ def list_name; end
24
+ end
25
+ class Choice
26
+ sig { returns(Integer) }
27
+ def index; end
28
+
29
+ sig { returns(String) }
30
+ def text; end
31
+
32
+ sig { returns(T::Boolean) }
33
+ def has_tags; end
34
+
35
+ sig { returns(Integer) }
36
+ def num_tags; end
37
+
38
+ sig { params(index: Integer).returns(String) }
39
+ def get_tag(index); end
40
+ end
41
+ class List
42
+ sig { params(flag: String).void }
43
+ def add(flag); end
44
+
45
+ sig { params(flag: String).void }
46
+ def remove(flag); end
47
+
48
+ sig { params(flag: String).returns(T::Boolean) }
49
+ def contains(flag); end
50
+
51
+ sig { params(list_name: String).returns(T.untyped) }
52
+ def flags_from(list_name); end
53
+
54
+ sig { returns(T.untyped) }
55
+ def to_vec; end
56
+ end
57
+
58
+ class ValueType < T::Enum
59
+ enums do
60
+ INT32 = new
61
+ FLOAT = new
62
+ UINT32 = new
63
+ STRING = new
64
+ LIST = new
65
+ BOOL = new
66
+ end
67
+ end
68
+
69
+ class Value
70
+ sig { params(value: Integer).returns(Ink::Value) }
71
+ def self.from_int(value); end
72
+
73
+ sig { params(value: T::Boolean).returns(Ink::Value) }
74
+ def self.from_bool(value); end
75
+
76
+ sig { params(value: Float).returns(Ink::Value) }
77
+ def self.from_float(value); end
78
+
79
+ sig { params(value: String).returns(Ink::Value) }
80
+ def self.from_string(value); end
81
+
82
+ sig { params(value: Integer).returns(Ink::Value) }
83
+ def self.from_uint(value); end
84
+
85
+ sig { params(value: Ink::List).returns(Ink::Value) }
86
+ def self.from_list(value); end
87
+
88
+ sig { params(value: Ink::Value).returns(Ink::Value) }
89
+ def self.from_value(value); end
90
+
91
+ sig { returns(Ink::ValueType) }
92
+ def type; end
93
+
94
+ sig { returns(String) }
95
+ def to_s; end
96
+
97
+ sig { returns(Integer) }
98
+ def to_i; end
99
+
100
+ sig { returns(Float) }
101
+ def to_f; end
102
+
103
+ sig { returns(Ink::Value) }
104
+ def to_list; end
105
+ end
106
+
107
+ class Runner
108
+ sig { params(seed: Integer).void }
109
+ def set_rng_seed(seed); end
110
+
111
+ sig { returns(T::Boolean) }
112
+ def can_continue; end
113
+
114
+ sig { params(index: Integer).void }
115
+ def choose(index); end
116
+
117
+ sig { returns(T::Boolean) }
118
+ def has_tags; end
119
+
120
+ sig { returns(Integer) }
121
+ def num_tags; end
122
+
123
+ sig { returns(Integer) }
124
+ def num_choices; end
125
+
126
+ sig { params(index: Integer).returns(String) }
127
+ def get_tag(index); end
128
+
129
+ sig { params(path: String).returns(T::Boolean) }
130
+ def move_to(path); end
131
+
132
+ sig { returns(String) }
133
+ def getline; end
134
+
135
+ sig { returns(Ink::Snapshot) }
136
+ def create_snapshot; end
137
+
138
+ sig { returns(String) }
139
+ def getall; end
140
+
141
+ sig { returns(T::Enumerable[Ink::Choice]) }
142
+ def each_choice; end
143
+
144
+ sig { params(index: Integer).returns(Ink::Choice) }
145
+ def get_choice(index); end
146
+
147
+ sig { params(name: String, callback: T.proc.params(argsVec: T.untyped).void, lookahead_safe: T::Boolean).void }
148
+ def bind_void(name, callback, lookahead_safe); end
149
+
150
+ sig { params(name: String, callback: T.proc.params(argsVec: T.untyped).returns(Ink::Value), lookahead_safe: T::Boolean).void }
151
+ def bind(name, callback, lookahead_safe); end
152
+ end
153
+
154
+ class Globals
155
+ sig { params(key: String).returns(T.nilable(Ink::Value)) }
156
+ def [](key); end
157
+
158
+ sig { params(key: String, value: Ink::Value).void }
159
+ def []=(key, value); end
160
+ end
161
+
162
+ class Snapshot
163
+ sig { params(data: String).returns(Ink::Snapshot) }
164
+ def self.from_binary(data); end
165
+
166
+ sig { params(file: String).returns(Ink::Snapshot) }
167
+ def self.from_file(file); end
168
+
169
+ sig { returns(String) }
170
+ def get_data; end
171
+
172
+ sig { returns(Integer) }
173
+ def get_data_len; end
174
+
175
+ sig { returns(Integer) }
176
+ def num_runners; end
177
+
178
+ sig { params(file: String).void }
179
+ def write_to_file(file); end
180
+ end
181
+
182
+ class RunnerImpl
183
+ sig { returns(T.nilable(Ink::Runner)) }
184
+ def get; end
185
+ end
186
+
187
+ class StoryImpl
188
+ sig { returns(T.nilable(Ink::Globals)) }
189
+ def get; end
190
+ end
191
+
192
+ class Story
193
+ sig { params(story: String).returns(T.nilable(Ink::Story)) }
194
+ def self.from_file(story); end
195
+
196
+ sig { params(data: String).returns(T.nilable(Ink::Story)) }
197
+ def self.from_binary(data); end
198
+
199
+ sig { returns(T.nilable(Ink::StoryImpl)) }
200
+ def self.new_globals(); end
201
+
202
+ sig { params(globals: T.nilable(Ink::StoryImpl)).returns(Ink::RunnerImpl) }
203
+ def self.new_runner(globals); end
204
+
205
+ sig { params(snapshot: Ink::Snapshot).returns(Ink::StoryImpl) }
206
+ def self.new_globals_from_snapshot(snapshot); end
207
+
208
+ sig { params(snapshot: Ink::Snapshot, globals: T.nilable(Ink::StoryImpl), index: Integer).returns(Ink::StoryImpl) }
209
+ def self.new_runner_from_snapshot(snapshot, globals, index); end
210
+ end
211
+ end
data/sorbet/config ADDED
@@ -0,0 +1,4 @@
1
+ --dir
2
+ .
3
+ --ignore=tmp/
4
+ --ignore=vendor/
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-vendored=true