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,172 @@
|
|
|
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
|
+
namespace ink
|
|
10
|
+
{
|
|
11
|
+
// Commands (max 255)
|
|
12
|
+
enum class Command : unsigned char
|
|
13
|
+
{
|
|
14
|
+
// == Value Commands: Push values onto the stack
|
|
15
|
+
STR,
|
|
16
|
+
INT,
|
|
17
|
+
BOOL,
|
|
18
|
+
FLOAT,
|
|
19
|
+
VALUE_POINTER,
|
|
20
|
+
DIVERT_VAL,
|
|
21
|
+
LIST,
|
|
22
|
+
NEWLINE,
|
|
23
|
+
GLUE,
|
|
24
|
+
VOID,
|
|
25
|
+
TAG,
|
|
26
|
+
|
|
27
|
+
// == Diverts
|
|
28
|
+
DIVERT,
|
|
29
|
+
DIVERT_TO_VARIABLE,
|
|
30
|
+
TUNNEL,
|
|
31
|
+
FUNCTION,
|
|
32
|
+
|
|
33
|
+
// == Terminal commands
|
|
34
|
+
DONE,
|
|
35
|
+
END,
|
|
36
|
+
TUNNEL_RETURN,
|
|
37
|
+
FUNCTION_RETURN,
|
|
38
|
+
|
|
39
|
+
// == Variable definitions
|
|
40
|
+
DEFINE_TEMP,
|
|
41
|
+
SET_VARIABLE,
|
|
42
|
+
|
|
43
|
+
// == Evaluation stack
|
|
44
|
+
START_EVAL,
|
|
45
|
+
END_EVAL,
|
|
46
|
+
OUTPUT,
|
|
47
|
+
POP,
|
|
48
|
+
DUPLICATE,
|
|
49
|
+
PUSH_VARIABLE_VALUE,
|
|
50
|
+
VISIT,
|
|
51
|
+
TURN, /// How many choices where made since start of the story
|
|
52
|
+
READ_COUNT,
|
|
53
|
+
SEQUENCE,
|
|
54
|
+
SEED,
|
|
55
|
+
|
|
56
|
+
// == String stack
|
|
57
|
+
START_STR,
|
|
58
|
+
END_STR,
|
|
59
|
+
START_TAG,
|
|
60
|
+
END_TAG,
|
|
61
|
+
|
|
62
|
+
// == Choice commands
|
|
63
|
+
CHOICE,
|
|
64
|
+
|
|
65
|
+
// == Threading
|
|
66
|
+
THREAD,
|
|
67
|
+
// == thinary operations
|
|
68
|
+
LIST_RANGE,
|
|
69
|
+
OP_BEGIN = LIST_RANGE,
|
|
70
|
+
TERNARY_OPERATORS_START = LIST_RANGE,
|
|
71
|
+
TERNARY_OPERATORS_END = LIST_RANGE,
|
|
72
|
+
// == Binary operators
|
|
73
|
+
ADD,
|
|
74
|
+
BINARY_OPERATORS_START = ADD,
|
|
75
|
+
SUBTRACT,
|
|
76
|
+
DIVIDE,
|
|
77
|
+
MULTIPLY,
|
|
78
|
+
MOD,
|
|
79
|
+
RANDOM,
|
|
80
|
+
IS_EQUAL,
|
|
81
|
+
GREATER_THAN,
|
|
82
|
+
LESS_THAN,
|
|
83
|
+
GREATER_THAN_EQUALS,
|
|
84
|
+
LESS_THAN_EQUALS,
|
|
85
|
+
NOT_EQUAL,
|
|
86
|
+
AND,
|
|
87
|
+
OR,
|
|
88
|
+
MIN,
|
|
89
|
+
MAX,
|
|
90
|
+
HAS,
|
|
91
|
+
HASNT,
|
|
92
|
+
INTERSECTION,
|
|
93
|
+
LIST_INT,
|
|
94
|
+
BINARY_OPERATORS_END = LIST_INT,
|
|
95
|
+
|
|
96
|
+
// == Unary operators
|
|
97
|
+
UNARY_OPERATORS_START,
|
|
98
|
+
NOT = UNARY_OPERATORS_START,
|
|
99
|
+
NEGATE,
|
|
100
|
+
LIST_COUNT,
|
|
101
|
+
LIST_MIN,
|
|
102
|
+
LIST_MAX,
|
|
103
|
+
READ_COUNT_VAR,
|
|
104
|
+
TURNS,
|
|
105
|
+
lrnd,
|
|
106
|
+
FLOOR,
|
|
107
|
+
CEILING,
|
|
108
|
+
INT_CAST,
|
|
109
|
+
LIST_ALL,
|
|
110
|
+
LIST_INVERT,
|
|
111
|
+
LIST_VALUE,
|
|
112
|
+
UNARY_OPERATORS_END = LIST_VALUE,
|
|
113
|
+
CHOICE_COUNT,
|
|
114
|
+
OP_END,
|
|
115
|
+
|
|
116
|
+
// == Container tracking
|
|
117
|
+
START_CONTAINER_MARKER = OP_END,
|
|
118
|
+
END_CONTAINER_MARKER,
|
|
119
|
+
|
|
120
|
+
// == Function calls
|
|
121
|
+
CALL_EXTERNAL,
|
|
122
|
+
|
|
123
|
+
NUM_COMMANDS,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Flags for commands
|
|
127
|
+
enum class CommandFlag : unsigned char
|
|
128
|
+
{
|
|
129
|
+
NO_FLAGS = 0,
|
|
130
|
+
|
|
131
|
+
// == Choice Flags ==
|
|
132
|
+
CHOICE_HAS_CONDITION = 1 << 0,
|
|
133
|
+
CHOICE_HAS_START_CONTENT = 1 << 1,
|
|
134
|
+
CHOICE_HAS_CHOICE_ONLY_CONTENT = 1 << 2,
|
|
135
|
+
CHOICE_IS_INVISIBLE_DEFAULT = 1 << 3,
|
|
136
|
+
CHOICE_IS_ONCE_ONLY = 1 << 4,
|
|
137
|
+
|
|
138
|
+
// == Divert flags
|
|
139
|
+
DIVERT_HAS_CONDITION = 1 << 0,
|
|
140
|
+
DIVERT_IS_FALLTHROUGH = 1 << 1, // Divert was auto-generated as a result of falling out of a containers content
|
|
141
|
+
|
|
142
|
+
// == Container marker
|
|
143
|
+
CONTAINER_MARKER_TRACK_VISITS = 1 << 0,
|
|
144
|
+
CONTAINER_MARKER_TRACK_TURNS = 1 << 1,
|
|
145
|
+
CONTAINER_MARKER_ONLY_FIRST = 1 << 2,
|
|
146
|
+
|
|
147
|
+
// == Variable assignment
|
|
148
|
+
ASSIGNMENT_IS_REDEFINE = 1 << 0,
|
|
149
|
+
|
|
150
|
+
// == Function/Tunnel flags
|
|
151
|
+
FUNCTION_TO_VARIABLE = 1 << 0,
|
|
152
|
+
TUNNEL_TO_VARIABLE = 1 << 0,
|
|
153
|
+
FALLBACK_FUNCTION = 1 << 1,
|
|
154
|
+
// note a internal function which should only be called if external reference is not working
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
inline bool operator& (CommandFlag lhs, CommandFlag rhs)
|
|
158
|
+
{
|
|
159
|
+
return (static_cast<unsigned char>(lhs) & static_cast<unsigned char>(rhs)) > 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
inline CommandFlag& operator|= (CommandFlag& lhs, CommandFlag rhs)
|
|
163
|
+
{
|
|
164
|
+
lhs = static_cast<CommandFlag>(static_cast<unsigned char>(lhs) | static_cast<unsigned char>(rhs));
|
|
165
|
+
return lhs;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template<typename PayloadType>
|
|
169
|
+
constexpr unsigned int CommandSize = sizeof(Command) + sizeof(CommandFlag) + sizeof(PayloadType);
|
|
170
|
+
|
|
171
|
+
extern const char* CommandStrings[];
|
|
172
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "system.h"
|
|
10
|
+
|
|
11
|
+
namespace ink::internal {
|
|
12
|
+
|
|
13
|
+
struct header {
|
|
14
|
+
static header parse_header(const char* data);
|
|
15
|
+
|
|
16
|
+
template<typename T>
|
|
17
|
+
static T swap_bytes(const T& value) {
|
|
18
|
+
char data[sizeof(T)];
|
|
19
|
+
for (int i = 0; i < sizeof(T); ++i) {
|
|
20
|
+
data[i] = reinterpret_cast<const char*>(&value)[sizeof(T)-1-i];
|
|
21
|
+
}
|
|
22
|
+
return *reinterpret_cast<const T*>(data);
|
|
23
|
+
}
|
|
24
|
+
list_flag read_list_flag(const char*& ptr) const {
|
|
25
|
+
list_flag result = *reinterpret_cast<const list_flag*>(ptr);
|
|
26
|
+
ptr += sizeof(list_flag);
|
|
27
|
+
if (endien == ink::internal::header::endian_types::differ) {
|
|
28
|
+
result.flag = swap_bytes(result.flag);
|
|
29
|
+
result.list_id = swap_bytes(result.list_id);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
enum class endian_types: uint16_t {
|
|
35
|
+
none = 0,
|
|
36
|
+
same = 0x0001,
|
|
37
|
+
differ = 0x0100
|
|
38
|
+
} endien = endian_types::none;
|
|
39
|
+
uint32_t ink_version_number = 0;
|
|
40
|
+
uint32_t ink_bin_version_number = 0;
|
|
41
|
+
static constexpr size_t Size = ///< actual data size of Header,
|
|
42
|
+
/// because padding of struct may
|
|
43
|
+
/// differ between platforms
|
|
44
|
+
sizeof(uint16_t) + 2 * sizeof(uint32_t);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
#ifdef INKCPP_API
|
|
10
|
+
# define INK_ENABLE_UNREAL
|
|
11
|
+
#elif INKCPP_BUILD_CLIB
|
|
12
|
+
# define INK_ENABLE_CSTD
|
|
13
|
+
#else
|
|
14
|
+
# define INK_ENABLE_STL
|
|
15
|
+
# define INK_ENABLE_CSTD
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Only turn on if you have json.hpp and you want to use it with the compiler
|
|
19
|
+
// #define INK_EXPOSE_JSON
|
|
20
|
+
|
|
21
|
+
namespace ink::config
|
|
22
|
+
{
|
|
23
|
+
/// set limitations which are required to minimize heap allocations.
|
|
24
|
+
/// if required you can set them to -x then, the system will use dynamic
|
|
25
|
+
/// allocation for this type, with an initial size of x.
|
|
26
|
+
static constexpr int limitGlobalVariables = -50;
|
|
27
|
+
static constexpr int limitGlobalVariableObservers = -10;
|
|
28
|
+
static constexpr int limitThreadDepth = -10;
|
|
29
|
+
static constexpr int limitEvalStackDepth = -20;
|
|
30
|
+
static constexpr int limitContainerDepth = -20;
|
|
31
|
+
/** number of lists which can be accessed with get_var
|
|
32
|
+
* before the story must continue
|
|
33
|
+
* @attention list vars are only valid until the story continous!
|
|
34
|
+
*/
|
|
35
|
+
static constexpr int limitEditableLists = -5;
|
|
36
|
+
/// number of simultaneous active tags
|
|
37
|
+
static constexpr int limitActiveTags = -10;
|
|
38
|
+
// temporary variables and callstack;
|
|
39
|
+
static constexpr int limitRuntimeStack = -20;
|
|
40
|
+
// references and callstack
|
|
41
|
+
static constexpr int limitReferenceStack = -20;
|
|
42
|
+
// max number of elements in one output (a string is one element)
|
|
43
|
+
// no dynamic support now! (FIXME)
|
|
44
|
+
static constexpr int limitOutputSize = 200;
|
|
45
|
+
// max number of choices per choice
|
|
46
|
+
static constexpr int maxChoices = -10;
|
|
47
|
+
// max number of list types, and there total amount of flags
|
|
48
|
+
static constexpr int maxListTypes = -20;
|
|
49
|
+
static constexpr int maxFlags = -200;
|
|
50
|
+
// number of max initelized lists
|
|
51
|
+
static constexpr int maxLists = -50;
|
|
52
|
+
static constexpr int maxArrayCallArity = 10;
|
|
53
|
+
} // namespace ink::config
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "config.h"
|
|
10
|
+
|
|
11
|
+
#ifdef INK_ENABLE_UNREAL
|
|
12
|
+
# include "Misc/AssertionMacros.h"
|
|
13
|
+
# include "Misc/CString.h"
|
|
14
|
+
# include "HAL/UnrealMemory.h"
|
|
15
|
+
# include "Hash/CityHash.h"
|
|
16
|
+
|
|
17
|
+
#endif
|
|
18
|
+
#ifdef INK_ENABLE_STL
|
|
19
|
+
# include <exception>
|
|
20
|
+
# include <stdexcept>
|
|
21
|
+
# include <optional>
|
|
22
|
+
# include <cctype>
|
|
23
|
+
# include <cstdint>
|
|
24
|
+
# include <cstdio>
|
|
25
|
+
# include <cstdarg>
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
// Platform specific defines //
|
|
29
|
+
|
|
30
|
+
#ifdef INK_ENABLE_UNREAL
|
|
31
|
+
# define inkZeroMemory(buff, len) FMemory::Memset(buff, 0, len)
|
|
32
|
+
# define inkAssert(condition, text, ...) checkf(condition, TEXT(text), ##__VA_ARGS__)
|
|
33
|
+
# define inkFail(text, ...) checkf(false, TEXT(text), ##__VA_ARGS__)
|
|
34
|
+
# define FORMAT_STRING_STR "%hs"
|
|
35
|
+
#else
|
|
36
|
+
# define inkZeroMemory ink::internal::zero_memory
|
|
37
|
+
# define inkAssert ink::ink_assert
|
|
38
|
+
# define inkFail(...) ink::ink_assert(false, __VA_ARGS__)
|
|
39
|
+
# define FORMAT_STRING_STR "%s"
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
namespace ink
|
|
43
|
+
{
|
|
44
|
+
/** define basic numeric type
|
|
45
|
+
* @todo use a less missleading name
|
|
46
|
+
*/
|
|
47
|
+
typedef unsigned int uint32_t;
|
|
48
|
+
|
|
49
|
+
/** Name hash (used for temporary variables) */
|
|
50
|
+
typedef uint32_t hash_t;
|
|
51
|
+
|
|
52
|
+
/** Invalid hash value */
|
|
53
|
+
const hash_t InvalidHash = 0;
|
|
54
|
+
|
|
55
|
+
#ifdef INK_ENABLE_UNREAL
|
|
56
|
+
/** Simple hash for serialization of strings */
|
|
57
|
+
inline hash_t hash_string(const char* string)
|
|
58
|
+
{
|
|
59
|
+
return CityHash32(string, FCStringAnsi::Strlen(string));
|
|
60
|
+
}
|
|
61
|
+
#else
|
|
62
|
+
hash_t hash_string(const char* string);
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
/** Byte type */
|
|
66
|
+
typedef unsigned char byte_t;
|
|
67
|
+
|
|
68
|
+
/** Used to identify an offset in a data table (like a string in the string table) */
|
|
69
|
+
typedef uint32_t offset_t;
|
|
70
|
+
|
|
71
|
+
/** Instruction pointer used for addressing within the story instructions */
|
|
72
|
+
typedef const unsigned char* ip_t;
|
|
73
|
+
|
|
74
|
+
/** Used for the size of arrays */
|
|
75
|
+
typedef unsigned int size_t;
|
|
76
|
+
|
|
77
|
+
/** Used as the unique identifier for an ink container */
|
|
78
|
+
typedef uint32_t container_t;
|
|
79
|
+
|
|
80
|
+
/** Used to uniquely identify threads */
|
|
81
|
+
typedef uint32_t thread_t;
|
|
82
|
+
|
|
83
|
+
/** Used to unique identify a list flag */
|
|
84
|
+
struct list_flag {
|
|
85
|
+
int16_t list_id;
|
|
86
|
+
int16_t flag;
|
|
87
|
+
|
|
88
|
+
bool operator==(const list_flag& o) const { return list_id == o.list_id && flag == o.flag; }
|
|
89
|
+
|
|
90
|
+
bool operator!=(const list_flag& o) const { return ! (*this == o); }
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** value of an unset list_flag */
|
|
94
|
+
constexpr list_flag null_flag{-1, -1};
|
|
95
|
+
/** value representing an empty list */
|
|
96
|
+
constexpr list_flag empty_flag{-1, 0};
|
|
97
|
+
|
|
98
|
+
namespace internal
|
|
99
|
+
{
|
|
100
|
+
/** Checks if a string is only whitespace*/
|
|
101
|
+
static bool is_whitespace(const char* string, bool includeNewline = true)
|
|
102
|
+
{
|
|
103
|
+
// Iterate string
|
|
104
|
+
while (true) {
|
|
105
|
+
switch (*(string++)) {
|
|
106
|
+
case 0: return true;
|
|
107
|
+
case '\n':
|
|
108
|
+
if (! includeNewline)
|
|
109
|
+
return false;
|
|
110
|
+
case '\t':
|
|
111
|
+
case ' ': continue;
|
|
112
|
+
default: return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** check if character can be only part of a word, when two part of word characters put together
|
|
118
|
+
* the will be a space inserted I049
|
|
119
|
+
*/
|
|
120
|
+
inline bool is_part_of_word(char character) { return isalpha(character) || isdigit(character); }
|
|
121
|
+
|
|
122
|
+
inline constexpr bool is_whitespace(char character, bool includeNewline = true)
|
|
123
|
+
{
|
|
124
|
+
switch (character) {
|
|
125
|
+
case '\n':
|
|
126
|
+
if (! includeNewline)
|
|
127
|
+
return false;
|
|
128
|
+
case '\t': [[fallthrough]];
|
|
129
|
+
case ' ': return true;
|
|
130
|
+
default: return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#ifndef INK_ENABLE_UNREAL
|
|
135
|
+
/** populate memory with Zero */
|
|
136
|
+
void zero_memory(void* buffer, size_t length);
|
|
137
|
+
#endif
|
|
138
|
+
} // namespace internal
|
|
139
|
+
|
|
140
|
+
#ifdef INK_ENABLE_STL
|
|
141
|
+
/** exception type thrown if something goes wrong */
|
|
142
|
+
using ink_exception = std::runtime_error;
|
|
143
|
+
#else
|
|
144
|
+
// Non-STL exception class
|
|
145
|
+
class ink_exception
|
|
146
|
+
{
|
|
147
|
+
public:
|
|
148
|
+
ink_exception(const char* msg)
|
|
149
|
+
: _msg(msg)
|
|
150
|
+
{
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
inline const char* message() const { return _msg; }
|
|
154
|
+
|
|
155
|
+
private:
|
|
156
|
+
const char* _msg;
|
|
157
|
+
};
|
|
158
|
+
#endif
|
|
159
|
+
|
|
160
|
+
// assert
|
|
161
|
+
#ifndef INK_ENABLE_UNREAL
|
|
162
|
+
template<typename... Args>
|
|
163
|
+
void ink_assert(bool condition, const char* msg = nullptr, Args... args)
|
|
164
|
+
{
|
|
165
|
+
static const char* EMPTY = "";
|
|
166
|
+
if (msg == nullptr) {
|
|
167
|
+
msg = EMPTY;
|
|
168
|
+
}
|
|
169
|
+
if (! condition) {
|
|
170
|
+
if constexpr (sizeof...(args) > 0) {
|
|
171
|
+
char* message = static_cast<char*>(malloc(snprintf(nullptr, 0, msg, args...) + 1));
|
|
172
|
+
sprintf(message, msg, args...);
|
|
173
|
+
throw ink_exception(message);
|
|
174
|
+
} else {
|
|
175
|
+
throw ink_exception(msg);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
template<typename... Args>
|
|
181
|
+
[[noreturn]] inline void ink_assert(const char* msg = nullptr, Args... args)
|
|
182
|
+
{
|
|
183
|
+
ink_assert(false, msg, args...);
|
|
184
|
+
exit(EXIT_FAILURE);
|
|
185
|
+
}
|
|
186
|
+
#endif
|
|
187
|
+
|
|
188
|
+
namespace runtime::internal
|
|
189
|
+
{
|
|
190
|
+
constexpr unsigned abs(int i) { return i < 0 ? -i : i; }
|
|
191
|
+
|
|
192
|
+
template<typename T>
|
|
193
|
+
struct always_false {
|
|
194
|
+
static constexpr bool value = false;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
template<bool Con, typename T1, typename T2>
|
|
198
|
+
struct if_type {
|
|
199
|
+
using type = T1;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
template<typename T1, typename T2>
|
|
203
|
+
struct if_type<false, T1, T2> {
|
|
204
|
+
using type = T2;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
template<bool Con, typename T1, typename T2>
|
|
208
|
+
using if_t = typename if_type<Con, T1, T2>::type;
|
|
209
|
+
|
|
210
|
+
template<bool Enable, typename T = void>
|
|
211
|
+
struct enable_if {
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
template<typename T>
|
|
215
|
+
struct enable_if<true, T> {
|
|
216
|
+
using type = T;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
template<bool Enable, typename T = void>
|
|
220
|
+
using enable_if_t = typename enable_if<Enable, T>::type;
|
|
221
|
+
} // namespace runtime::internal
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
#ifdef INK_ENABLE_STL
|
|
225
|
+
/** custom optional implementation for usage if STL is disabled
|
|
226
|
+
* @tparam T type contaied in optional
|
|
227
|
+
*/
|
|
228
|
+
template<typename T>
|
|
229
|
+
using optional = std::optional<T>;
|
|
230
|
+
/** an empty #optional */
|
|
231
|
+
constexpr std::nullopt_t nullopt = std::nullopt;
|
|
232
|
+
#else
|
|
233
|
+
struct nullopt_t {
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
constexpr nullopt_t nullopt;
|
|
237
|
+
|
|
238
|
+
template<typename T>
|
|
239
|
+
class optional
|
|
240
|
+
{
|
|
241
|
+
public:
|
|
242
|
+
optional() {}
|
|
243
|
+
|
|
244
|
+
optional(nullopt_t) {}
|
|
245
|
+
|
|
246
|
+
optional(T&& val)
|
|
247
|
+
: _has_value{true}
|
|
248
|
+
, _value{val}
|
|
249
|
+
{
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
optional(const T& val)
|
|
253
|
+
: _has_value{true}
|
|
254
|
+
, _value{val}
|
|
255
|
+
{
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const T& operator*() const { return _value; }
|
|
259
|
+
|
|
260
|
+
T& operator*() { return _value; }
|
|
261
|
+
|
|
262
|
+
const T* operator->() const { return &_value; }
|
|
263
|
+
|
|
264
|
+
T* operator->() { return &_value; }
|
|
265
|
+
|
|
266
|
+
constexpr bool has_value() const { return _has_value; }
|
|
267
|
+
|
|
268
|
+
constexpr T& value()
|
|
269
|
+
{
|
|
270
|
+
test_value();
|
|
271
|
+
return _value;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
constexpr const T& value() const
|
|
275
|
+
{
|
|
276
|
+
test_value();
|
|
277
|
+
return _value;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
constexpr operator bool() const { return has_value(); }
|
|
281
|
+
|
|
282
|
+
template<typename U>
|
|
283
|
+
constexpr T value_or(U&& u) const
|
|
284
|
+
{
|
|
285
|
+
return _has_value ? _value : static_cast<T>(u);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
template<typename... Args>
|
|
289
|
+
T& emplace(Args... args)
|
|
290
|
+
{
|
|
291
|
+
_value.~T();
|
|
292
|
+
return *(new (&_value) T(args...));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private:
|
|
296
|
+
void test_value() const
|
|
297
|
+
{
|
|
298
|
+
if (! _has_value) {
|
|
299
|
+
inkFail("Can't access empty optional!");
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
bool _has_value = false;
|
|
304
|
+
T _value;
|
|
305
|
+
};
|
|
306
|
+
#endif
|
|
307
|
+
} // namespace ink
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "system.h"
|
|
10
|
+
|
|
11
|
+
namespace ink {
|
|
12
|
+
constexpr uint32_t InkBinVersion = 1; ///< Supportet version of ink.bin files
|
|
13
|
+
constexpr uint32_t InkVersion = 21; ///< Supported version of ink.json files
|
|
14
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Once: one two
|
|
3
|
+
Stopping: one two two two
|
|
4
|
+
Default: one two two two
|
|
5
|
+
Cycle: one two one two
|
|
6
|
+
Shuffle: two two one one
|
|
7
|
+
Shuffle stopping: two one final final
|
|
8
|
+
Shuffle once: one one
|
|
9
|
+
**/
|
|
10
|
+
|
|
11
|
+
~ SEED_RANDOM(1)
|
|
12
|
+
|
|
13
|
+
Once: {f_once()} {f_once()} {f_once()} {f_once()}
|
|
14
|
+
Stopping: {f_stopping()} {f_stopping()} {f_stopping()} {f_stopping()}
|
|
15
|
+
Default: {f_default()} {f_default()} {f_default()} {f_default()}
|
|
16
|
+
Cycle: {f_cycle()} {f_cycle()} {f_cycle()} {f_cycle()}
|
|
17
|
+
Shuffle: {f_shuffle()} {f_shuffle()} {f_shuffle()} {f_shuffle()}
|
|
18
|
+
Shuffle stopping: {f_shuffle_stopping()} {f_shuffle_stopping()} {f_shuffle_stopping()} {f_shuffle_stopping()}
|
|
19
|
+
Shuffle once: {f_shuffle_once()} {f_shuffle_once()} {f_shuffle_once()} {f_shuffle_once()}
|
|
20
|
+
|
|
21
|
+
== function f_once ==
|
|
22
|
+
{once:
|
|
23
|
+
- one
|
|
24
|
+
- two
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
== function f_stopping ==
|
|
28
|
+
{stopping:
|
|
29
|
+
- one
|
|
30
|
+
- two
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
== function f_default ==
|
|
34
|
+
{one|two}
|
|
35
|
+
|
|
36
|
+
== function f_cycle ==
|
|
37
|
+
{cycle:
|
|
38
|
+
- one
|
|
39
|
+
- two
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
== function f_shuffle ==
|
|
43
|
+
{shuffle:
|
|
44
|
+
- one
|
|
45
|
+
- two
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
== function f_shuffle_stopping ==
|
|
49
|
+
{stopping shuffle:
|
|
50
|
+
- one
|
|
51
|
+
- two
|
|
52
|
+
- final
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
== function f_shuffle_once ==
|
|
56
|
+
{shuffle once:
|
|
57
|
+
- one
|
|
58
|
+
- two
|
|
59
|
+
}
|