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.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +84 -0
- data/LICENSE +7 -0
- data/README.md +3 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +10 -0
- data/bin/tapioca +29 -0
- data/ext/inkcpp_rb/extconf.rb +19 -0
- data/ext/inkcpp_rb/inkcpp/.clang-format +99 -0
- data/ext/inkcpp_rb/inkcpp/.github/FUNDING.yml +1 -0
- data/ext/inkcpp_rb/inkcpp/.github/workflows/build.yml +344 -0
- data/ext/inkcpp_rb/inkcpp/.github/workflows/release.yml +49 -0
- data/ext/inkcpp_rb/inkcpp/.gitignore +25 -0
- data/ext/inkcpp_rb/inkcpp/.gitmodules +9 -0
- data/ext/inkcpp_rb/inkcpp/CMakeLists.txt +170 -0
- data/ext/inkcpp_rb/inkcpp/CODE_OF_CONDUCT.md +76 -0
- data/ext/inkcpp_rb/inkcpp/CONTRIBUTING.md +55 -0
- data/ext/inkcpp_rb/inkcpp/Config.cmake.in +2 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/CMakeLists.txt +13 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.c +38 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink.json +1 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example.zip +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/InkCPP_DEMO.zip +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/CreateThread.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/HandleChoice.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ListElementOf.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalRuntime.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalThread.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ObseverChange.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/TagListGetValue.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/YieldResume.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Doxyfile +2825 -0
- data/ext/inkcpp_rb/inkcpp/LICENSE.txt +22 -0
- data/ext/inkcpp_rb/inkcpp/Minimal.runsettings +8 -0
- data/ext/inkcpp_rb/inkcpp/README.md +192 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/CMakeLists.txt +67 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/array.h +481 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/avl_array.h +833 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/casting.h +93 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/choice.cpp +54 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.cpp +124 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.h +406 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.cpp +52 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.h +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/executioner.h +179 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functional.cpp +86 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functions.cpp +54 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functions.h +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.cpp +289 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.h +149 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/header.cpp +44 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/choice.h +106 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/functional.h +327 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/globals.h +196 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/list.h +187 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/runner.h +291 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/snapshot.h +61 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/story.h +219 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/story_ptr.h +233 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/traits.h +270 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/types.h +169 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.cpp +79 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.h +39 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.cpp +276 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.h +356 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.cpp +841 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.h +450 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.h +529 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/operation_bases.h +164 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/operations.h +100 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/output.cpp +528 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/output.h +153 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/platform.h +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/random.h +38 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.cpp +1396 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.h +336 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/simple_restorable_stack.h +335 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.cpp +182 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.h +91 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_interface.h +57 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/stack.cpp +618 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/stack.h +243 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.cpp +361 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.h +92 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_ptr.cpp +75 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.cpp +125 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.h +67 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.cpp +149 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.h +47 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_utils.h +207 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/system.cpp +39 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/tuple.hpp +151 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/value.cpp +279 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/value.h +666 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/CMakeLists.txt +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/include/inkcpp.h +393 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp.cpp +344 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp_c.pc.in +10 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/ExternalFunction.c +56 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Globals.c +98 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Lists.c +73 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Observer.c +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Snapshot.c +65 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/CMakeLists.txt +49 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/inkcpp_cl.cpp +215 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.cpp +209 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.h +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/CMakeLists.txt +37 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.cpp +446 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.h +70 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.cpp +166 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.h +79 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/command.cpp +107 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/compiler.cpp +96 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.h +104 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compilation_results.h +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compiler.h +44 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json.hpp +24596 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.cpp +411 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.h +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.cpp +47 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.h +70 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.cpp +107 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.h +55 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/CMakeLists.txt +19 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/example.py +78 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/src/module.cpp +317 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/conftest.py +53 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py +35 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Globals.py +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Lists.py +43 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Observer.py +27 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Snapshot.py +57 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/unreal_example.ink +71 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Array.cpp +115 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/CMakeLists.txt +117 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Callstack.cpp +392 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/EmptyStringForDivert.cpp +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/FallbackFunction.cpp +77 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Globals.cpp +73 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/InkyJson.cpp +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/LabelCondition.cpp +60 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Lists.cpp +144 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/LookaheadSafe.cpp +46 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Main.cpp +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/MoveTo.cpp +95 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/NewLines.cpp +76 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/NoEarlyTags.cpp +33 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Observer.cpp +245 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Pointer.cpp +191 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Restorable.cpp +294 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/SpaceAfterBracketChoice.cpp +45 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Stack.cpp +224 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Tags.cpp +131 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ThirdTierChoiceAfterBrackets.cpp +38 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/UTF8.cpp +56 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Value.cpp +210 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/catch.hpp +17970 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/AHF.ink +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ChoiceBracketStory.ink +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/EmptyStringForDivert.ink +13 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ExternalFunctionsExecuteProperly.ink +11 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/FallBack.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/GlobalStory.ink +9 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LabelConditionStory.ink +5 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LinesStory.ink +42 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListLogicStory.ink +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListStory.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LookaheadSafe.ink +14 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/MoveTo.ink +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/NoEarlyTags.ink +19 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ObserverStory.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/SimpleStoryFlow.ink +65 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TagsStory.ink +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TheIntercept.ink +1686 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ThirdTierChoiceAfterBracketsStory.ink +13 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF-8-demo.txt +212 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF8Story.ink +218 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inklecate.json +154 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inky.json +160 -0
- data/ext/inkcpp_rb/inkcpp/notes/ArchitectureNotes.md +54 -0
- data/ext/inkcpp_rb/inkcpp/notes/ListNotes.md +69 -0
- data/ext/inkcpp_rb/inkcpp/notes/OperationNotes.md +35 -0
- data/ext/inkcpp_rb/inkcpp/notes/TagsNotes.md +24 -0
- data/ext/inkcpp_rb/inkcpp/notes/WhitespaceNotes.md +28 -0
- data/ext/inkcpp_rb/inkcpp/proofing/README.md +3 -0
- data/ext/inkcpp_rb/inkcpp/proofing/inkcpp_runtime_driver +12 -0
- data/ext/inkcpp_rb/inkcpp/pyproject.toml +63 -0
- data/ext/inkcpp_rb/inkcpp/setup.py +166 -0
- data/ext/inkcpp_rb/inkcpp/shared/CMakeLists.txt +14 -0
- data/ext/inkcpp_rb/inkcpp/shared/private/command.h +172 -0
- data/ext/inkcpp_rb/inkcpp/shared/private/header.h +46 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/config.h +53 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/system.h +307 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/version.h +14 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestAllSequenceTypes.ink +59 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestArithmetic.ink +17 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBasicStringLiterals.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBasicTunnel.ink +10 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBlanksInInlineSequences.ink +51 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestCallStackEvaluation.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceCount.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceDivertsToDone.ink +6 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceWithBracketsOnly.ink +9 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestCompareDivertTargets.ink +26 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestComplexTunnels.ink +22 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestConditionalChoiceInWeave.ink +19 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestTunnelOnwardsAfterTunnel.ink +17 -0
- data/ext/inkcpp_rb/inkcpp/unreal/CMakeLists.txt +51 -0
- data/ext/inkcpp_rb/inkcpp/unreal/UE_example.ink +92 -0
- data/ext/inkcpp_rb/inkcpp/unreal/blueprint_filter.js +377 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Resources/Icon128.png +0 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkAsset.cpp +47 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkList.cpp +86 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkRuntime.cpp +265 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp +239 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkVar.cpp +143 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/TagList.cpp +95 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/inkcpp.cpp +13 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h +50 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkChoice.h +58 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkDelegates.h +139 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkList.h +102 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkRuntime.h +177 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkSnapshot.h +30 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkThread.h +215 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkVar.h +245 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/TagList.h +77 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/inkcpp.h +217 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs +62 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.cpp +237 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.h +43 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inkcpp_editor.cpp +13 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inklecate_cmd.cpp.in +24 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Public/inkcpp_editor.h +9 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/inkcpp_editor.Build.cs +61 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/inkcpp.uplugin +44 -0
- data/ext/inkcpp_rb/inkcpp/unreal/render.css +1 -0
- data/ext/inkcpp_rb/inkcpp_rb.cpp +321 -0
- data/inkcpp_rb.gemspec +54 -0
- data/rbi/inkcpp_rb.rbi +211 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/minitest@5.25.4.rbi +1547 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/prism@1.3.0.rbi +40040 -0
- data/sorbet/rbi/gems/rake-compiler@1.2.8.rbi +9 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3033 -0
- data/sorbet/rbi/gems/rbi@0.2.2.rbi +4527 -0
- data/sorbet/rbi/gems/rice@4.3.3.rbi +44 -0
- data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
- data/sorbet/rbi/gems/tapioca@0.16.7.rbi +3611 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +400 -0
|
@@ -0,0 +1,182 @@
|
|
|
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 "snapshot_impl.h"
|
|
8
|
+
|
|
9
|
+
#include "story_impl.h"
|
|
10
|
+
#include "globals_impl.h"
|
|
11
|
+
#include "runner_impl.h"
|
|
12
|
+
|
|
13
|
+
#include <cstring>
|
|
14
|
+
#ifdef INK_ENABLE_STL
|
|
15
|
+
#include <fstream>
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
namespace ink::runtime
|
|
19
|
+
{
|
|
20
|
+
snapshot* snapshot::from_binary(const unsigned char* data, size_t length, bool freeOnDestroy)
|
|
21
|
+
{
|
|
22
|
+
return new internal::snapshot_impl(data, length, freeOnDestroy);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#ifdef INK_ENABLE_STL
|
|
26
|
+
snapshot* snapshot::from_file(const char* filename) {
|
|
27
|
+
std::ifstream ifs(filename, std::ios::binary | std::ios::ate);
|
|
28
|
+
if(!ifs.is_open()) {
|
|
29
|
+
throw ink_exception("Failed to open snapshot file: " + std::string(filename));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
size_t length = static_cast<size_t>(ifs.tellg());
|
|
33
|
+
unsigned char* data = new unsigned char[length];
|
|
34
|
+
ifs.seekg(0, std::ios::beg);
|
|
35
|
+
ifs.read(reinterpret_cast<char*>(data), length);
|
|
36
|
+
ifs.close();
|
|
37
|
+
|
|
38
|
+
return from_binary(data, length);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void snapshot::write_to_file(const char* filename) const
|
|
42
|
+
{
|
|
43
|
+
std::ofstream ofs(filename, std::ios::binary);
|
|
44
|
+
if(!ofs.is_open()) {
|
|
45
|
+
throw ink_exception("Failed to open file to write snapshot: "
|
|
46
|
+
+ std::string(filename));
|
|
47
|
+
}
|
|
48
|
+
ofs.write(reinterpret_cast<const char*>(get_data()), get_data_len());
|
|
49
|
+
}
|
|
50
|
+
#endif
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
namespace ink::runtime::internal
|
|
54
|
+
{
|
|
55
|
+
size_t snapshot_impl::file_size(size_t serialization_length, size_t runner_cnt) {
|
|
56
|
+
return serialization_length + sizeof(header) + (runner_cnt + 1) * sizeof(size_t);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const unsigned char* snapshot_impl::get_data() const {
|
|
60
|
+
return _file;
|
|
61
|
+
}
|
|
62
|
+
size_t snapshot_impl::get_data_len() const {
|
|
63
|
+
return _length;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
snapshot_impl::snapshot_impl(const globals_impl& globals)
|
|
67
|
+
: _managed{true}
|
|
68
|
+
{
|
|
69
|
+
snapshot_interface::snapper snapper{
|
|
70
|
+
globals.strings(),
|
|
71
|
+
globals._owner->string(0)
|
|
72
|
+
};
|
|
73
|
+
_length = globals.snap(nullptr, snapper);
|
|
74
|
+
size_t runner_cnt = 0;
|
|
75
|
+
for(auto node = globals._runners_start; node; node = node->next)
|
|
76
|
+
{
|
|
77
|
+
_length += node->object->snap(nullptr, snapper);
|
|
78
|
+
++runner_cnt;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_length = file_size(_length, runner_cnt);
|
|
82
|
+
_header.length = _length;
|
|
83
|
+
_header.num_runners = runner_cnt;
|
|
84
|
+
unsigned char* data = new unsigned char[_length];
|
|
85
|
+
_file = data;
|
|
86
|
+
unsigned char* ptr = data;
|
|
87
|
+
// write header
|
|
88
|
+
memcpy(ptr, &_header, sizeof(_header));
|
|
89
|
+
// write lookup table
|
|
90
|
+
ptr += sizeof(header);
|
|
91
|
+
{
|
|
92
|
+
size_t offset = (ptr - data) + (_header.num_runners + 1) * sizeof(size_t);
|
|
93
|
+
memcpy(ptr, &offset, sizeof(offset));
|
|
94
|
+
ptr += sizeof(offset);
|
|
95
|
+
offset += globals.snap(nullptr, snapper);
|
|
96
|
+
for(auto node = globals._runners_start; node; node = node->next)
|
|
97
|
+
{
|
|
98
|
+
memcpy(ptr, &offset, sizeof(offset));
|
|
99
|
+
ptr += sizeof(offset);
|
|
100
|
+
offset += node->object->snap(nullptr, snapper);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
ptr += globals.snap(ptr, snapper);
|
|
105
|
+
for (auto node = globals._runners_start; node; node = node->next)
|
|
106
|
+
{
|
|
107
|
+
ptr += node->object->snap(ptr, snapper);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
snapshot_impl::snapshot_impl(const unsigned char* data, size_t length, bool managed)
|
|
112
|
+
: _file{data}, _length{length}, _managed{managed}
|
|
113
|
+
{
|
|
114
|
+
const unsigned char* ptr = data;
|
|
115
|
+
memcpy(&_header, ptr, sizeof(_header));
|
|
116
|
+
inkAssert(_header.length == _length, "Corrupted file length");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
size_t snap_choice::snap(unsigned char* data, const snapper& snapper) const{
|
|
121
|
+
unsigned char* ptr = data;
|
|
122
|
+
bool should_write = data != nullptr;
|
|
123
|
+
ptr = snap_write(ptr, _index, should_write);
|
|
124
|
+
ptr = snap_write(ptr, _path, should_write);
|
|
125
|
+
ptr = snap_write(ptr, _thread, should_write);
|
|
126
|
+
// handle difference between no tag and first tag
|
|
127
|
+
if (_tags == nullptr) {
|
|
128
|
+
ptr = snap_write(ptr, false, should_write);
|
|
129
|
+
} else {
|
|
130
|
+
ptr = snap_write(ptr, true, should_write);
|
|
131
|
+
std::uintptr_t offset = _tags != nullptr ? _tags - snapper.current_runner_tags : 0;
|
|
132
|
+
ptr = snap_write(ptr, offset, should_write);
|
|
133
|
+
}
|
|
134
|
+
ptr = snap_write(ptr, snapper.strings.get_id(_text), should_write);
|
|
135
|
+
return ptr - data;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const unsigned char* snap_choice::snap_load(const unsigned char* data, const loader& loader){
|
|
139
|
+
const unsigned char* ptr = data;
|
|
140
|
+
ptr = snap_read(ptr, _index);
|
|
141
|
+
ptr = snap_read(ptr, _path);
|
|
142
|
+
ptr = snap_read(ptr, _thread);
|
|
143
|
+
bool has_tags;
|
|
144
|
+
ptr = snap_read(ptr, has_tags);
|
|
145
|
+
if (has_tags) {
|
|
146
|
+
std::uintptr_t offset;
|
|
147
|
+
ptr = snap_read(ptr, offset);
|
|
148
|
+
_tags = loader.current_runner_tags + offset;
|
|
149
|
+
} else {
|
|
150
|
+
_tags = nullptr;
|
|
151
|
+
}
|
|
152
|
+
size_t string_id;
|
|
153
|
+
ptr = snap_read(ptr, string_id);
|
|
154
|
+
_text = loader.string_table[string_id];
|
|
155
|
+
return ptr;
|
|
156
|
+
}
|
|
157
|
+
size_t snap_tag::snap(unsigned char* data, const snapper& snapper) const{
|
|
158
|
+
unsigned char* ptr = data;
|
|
159
|
+
bool should_write = data != nullptr;
|
|
160
|
+
if (_str == nullptr) {
|
|
161
|
+
ptr = snap_write(ptr, false, should_write);
|
|
162
|
+
} else {
|
|
163
|
+
size_t id = snapper.strings.get_id(_str);
|
|
164
|
+
ptr = snap_write(ptr, true, should_write);
|
|
165
|
+
ptr = snap_write(ptr, id, should_write);
|
|
166
|
+
}
|
|
167
|
+
return ptr - data;
|
|
168
|
+
}
|
|
169
|
+
const unsigned char* snap_tag::snap_load(const unsigned char* data, const loader& loader){
|
|
170
|
+
const unsigned char* ptr = data;
|
|
171
|
+
bool has_content;
|
|
172
|
+
ptr = snap_read(ptr, has_content);
|
|
173
|
+
if (!has_content) {
|
|
174
|
+
_str = nullptr;
|
|
175
|
+
} else {
|
|
176
|
+
size_t id;
|
|
177
|
+
ptr = snap_read(ptr, id);
|
|
178
|
+
_str = loader.string_table[id];
|
|
179
|
+
}
|
|
180
|
+
return ptr;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 "snapshot.h"
|
|
10
|
+
#include "snapshot_interface.h"
|
|
11
|
+
#include "array.h"
|
|
12
|
+
#include "choice.h"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace ink::runtime::internal
|
|
16
|
+
{
|
|
17
|
+
class snap_choice : public snapshot_interface, public choice {
|
|
18
|
+
public:
|
|
19
|
+
using choice::choice;
|
|
20
|
+
snap_choice(const choice& c) : choice{c} {}
|
|
21
|
+
snap_choice(choice&& c) : choice{c} {}
|
|
22
|
+
size_t snap(unsigned char* data, const snapper&) const;
|
|
23
|
+
const unsigned char* snap_load(const unsigned char* data, const loader&);
|
|
24
|
+
};
|
|
25
|
+
static_assert(sizeof(snap_choice) == sizeof(choice));
|
|
26
|
+
|
|
27
|
+
class snap_tag : public snapshot_interface {
|
|
28
|
+
public:
|
|
29
|
+
snap_tag() : _str{nullptr} {}
|
|
30
|
+
snap_tag(const char* str) : _str{str} {}
|
|
31
|
+
operator const char*() const { return _str; }
|
|
32
|
+
snap_tag& operator=( const char* str) { _str = str; return *this; }
|
|
33
|
+
size_t snap(unsigned char*, const snapper&) const;
|
|
34
|
+
const unsigned char* snap_load(const unsigned char* data, const loader&);
|
|
35
|
+
const char* const* ptr() const { return &_str; }
|
|
36
|
+
private:
|
|
37
|
+
const char* _str;
|
|
38
|
+
};
|
|
39
|
+
static_assert(sizeof(snap_tag) == sizeof(const char*));
|
|
40
|
+
|
|
41
|
+
class snapshot_impl : public snapshot
|
|
42
|
+
{
|
|
43
|
+
public:
|
|
44
|
+
~snapshot_impl() override {
|
|
45
|
+
if (_managed) { delete[] _file; }
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
managed_array<const char*, true, 5>& strings() const {
|
|
49
|
+
return string_table;
|
|
50
|
+
}
|
|
51
|
+
const unsigned char* get_data() const override;
|
|
52
|
+
size_t get_data_len() const override;
|
|
53
|
+
|
|
54
|
+
snapshot_impl(const globals_impl&);
|
|
55
|
+
// write down all allocated strings
|
|
56
|
+
// replace pointer with idx
|
|
57
|
+
// reconsrtuct static strings index
|
|
58
|
+
// list_table _data & _entry_state
|
|
59
|
+
snapshot_impl(const unsigned char* data, size_t length, bool managed);
|
|
60
|
+
|
|
61
|
+
const unsigned char* get_globals_snap() const {
|
|
62
|
+
return _file + get_offset(0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const unsigned char* get_runner_snap(size_t idx) const {
|
|
66
|
+
return _file + get_offset(idx + 1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
size_t num_runners() const override { return _header.num_runners; }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
// file information
|
|
73
|
+
// only populated when loading snapshots
|
|
74
|
+
mutable managed_array<const char*, true, 5> string_table;
|
|
75
|
+
const unsigned char* _file;
|
|
76
|
+
size_t _length;
|
|
77
|
+
bool _managed;
|
|
78
|
+
static size_t file_size(size_t, size_t);
|
|
79
|
+
struct header {
|
|
80
|
+
size_t num_runners;
|
|
81
|
+
size_t length;
|
|
82
|
+
|
|
83
|
+
} _header;
|
|
84
|
+
|
|
85
|
+
size_t get_offset(size_t idx) const {
|
|
86
|
+
inkAssert(idx <= _header.num_runners, "Out of Bound access for runner in snapshot.");
|
|
87
|
+
return reinterpret_cast<const size_t*>(_file + sizeof(header))[idx];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 "snapshot.h"
|
|
10
|
+
#include <cstring>
|
|
11
|
+
|
|
12
|
+
namespace ink::runtime::internal
|
|
13
|
+
{
|
|
14
|
+
class globals_impl;
|
|
15
|
+
class value;
|
|
16
|
+
class string_table;
|
|
17
|
+
template<typename,bool,size_t>
|
|
18
|
+
class managed_array;
|
|
19
|
+
|
|
20
|
+
class snapshot_interface {
|
|
21
|
+
public:
|
|
22
|
+
constexpr snapshot_interface(){};
|
|
23
|
+
static unsigned char* snap_write(unsigned char* ptr, const void* data, size_t length, bool write)
|
|
24
|
+
{
|
|
25
|
+
if (write) { memcpy(ptr, data, length); }
|
|
26
|
+
return ptr + length;
|
|
27
|
+
}
|
|
28
|
+
template<typename T>
|
|
29
|
+
static unsigned char* snap_write(unsigned char* ptr, const T& data, bool write)
|
|
30
|
+
{
|
|
31
|
+
return snap_write(ptr, &data, sizeof(data), write);
|
|
32
|
+
}
|
|
33
|
+
static const unsigned char* snap_read(const unsigned char* ptr, void* data, size_t length)
|
|
34
|
+
{
|
|
35
|
+
memcpy(data, ptr, length);
|
|
36
|
+
return ptr + length;
|
|
37
|
+
}
|
|
38
|
+
template<typename T>
|
|
39
|
+
static const unsigned char* snap_read(const unsigned char* ptr, T& data)
|
|
40
|
+
{
|
|
41
|
+
return snap_read(ptr, &data, sizeof(data));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
struct snapper {
|
|
45
|
+
const string_table& strings;
|
|
46
|
+
const char* story_string_table;
|
|
47
|
+
const char*const* current_runner_tags;
|
|
48
|
+
};
|
|
49
|
+
struct loader {
|
|
50
|
+
managed_array<const char*, true, 5>& string_table; /// FIXME: make configurable
|
|
51
|
+
const char* story_string_table;
|
|
52
|
+
const char*const* current_runner_tags;
|
|
53
|
+
};
|
|
54
|
+
size_t snap(unsigned char* data, snapper&) const { inkFail("Snap function not implemented"); return 0; };
|
|
55
|
+
const unsigned char* snap_load(const unsigned char* data, loader&) { inkFail("Snap function not implemented"); return nullptr;};
|
|
56
|
+
};
|
|
57
|
+
}
|