inkcpp_rb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,666 @@
|
|
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
|
+
/// The value class contains the information which type its hold and a small
|
10
|
+
/// piece of information to access the data.
|
11
|
+
/// use explicit getter and setter to make access more uniform.
|
12
|
+
/// define different value_types, and the mapping between type and data.
|
13
|
+
|
14
|
+
#include "system.h"
|
15
|
+
#include "command.h"
|
16
|
+
#include "list_table.h"
|
17
|
+
#include "snapshot_impl.h"
|
18
|
+
#include "tuple.hpp"
|
19
|
+
#include "types.h"
|
20
|
+
|
21
|
+
#ifdef INK_ENABLE_STL
|
22
|
+
# include <iosfwd>
|
23
|
+
#endif
|
24
|
+
|
25
|
+
|
26
|
+
namespace ink::runtime::internal
|
27
|
+
{
|
28
|
+
class basic_stream;
|
29
|
+
|
30
|
+
/// different existing value_types
|
31
|
+
enum class value_type {
|
32
|
+
BEGIN, // To find the start of list
|
33
|
+
none = BEGIN, // no type -> invalid
|
34
|
+
OP_BEGIN, // first type to operate on
|
35
|
+
divert = OP_BEGIN, // divert to different story position
|
36
|
+
PRINT_BEGIN, // first printable value
|
37
|
+
boolean = PRINT_BEGIN, // boolean variable
|
38
|
+
uint32, // 32bit unsigned integer variable
|
39
|
+
int32, // 32bit integer variable
|
40
|
+
float32, // 32bit floating point value
|
41
|
+
list, // id of list in list_table
|
42
|
+
list_flag, // a single list flag
|
43
|
+
string, // Pointer to string
|
44
|
+
OP_END, // END of types where we can operate on
|
45
|
+
newline = OP_END, // newline symbol
|
46
|
+
PRINT_END, // END of printable values
|
47
|
+
marker = PRINT_END, // special marker (used in output stream)
|
48
|
+
value_pointer, // a pointer to an value
|
49
|
+
glue, // glue symbol
|
50
|
+
func_start, // start of function marker
|
51
|
+
func_end, // end of function marker
|
52
|
+
null, // void value, for function returns
|
53
|
+
ex_fn_not_found, // value for failed external function calls
|
54
|
+
tunnel_frame, // return from tunnel
|
55
|
+
function_frame, // return from function
|
56
|
+
thread_frame, // return from thread
|
57
|
+
thread_start, // start of thread frame
|
58
|
+
thread_end, // end of thread frame
|
59
|
+
jump_marker // callstack jump
|
60
|
+
};
|
61
|
+
|
62
|
+
// add operator for value_type (to simplify usage templates).
|
63
|
+
constexpr value_type operator+(value_type t, int i)
|
64
|
+
{
|
65
|
+
return static_cast<value_type>(static_cast<int>(t) + i);
|
66
|
+
}
|
67
|
+
|
68
|
+
// add operator for Command (to simplify usage in templates).
|
69
|
+
constexpr Command operator+(Command c, int i)
|
70
|
+
{
|
71
|
+
return static_cast<Command>(static_cast<int>(c) + i);
|
72
|
+
}
|
73
|
+
|
74
|
+
struct string_type {
|
75
|
+
constexpr string_type(const char* string, bool allocated)
|
76
|
+
: str{string}
|
77
|
+
, allocated{allocated}
|
78
|
+
{
|
79
|
+
}
|
80
|
+
|
81
|
+
constexpr string_type(const char* string)
|
82
|
+
: str{string}
|
83
|
+
, allocated{true}
|
84
|
+
{
|
85
|
+
}
|
86
|
+
|
87
|
+
operator const char*() const { return str; }
|
88
|
+
|
89
|
+
const char* str;
|
90
|
+
bool allocated;
|
91
|
+
};
|
92
|
+
|
93
|
+
class value;
|
94
|
+
|
95
|
+
template<value_type ty, typename T, typename ENV>
|
96
|
+
class redefine
|
97
|
+
{
|
98
|
+
public:
|
99
|
+
redefine(const ENV&) {}
|
100
|
+
|
101
|
+
value operator()(const T& lh, const T& rh);
|
102
|
+
};
|
103
|
+
|
104
|
+
/**
|
105
|
+
* @brief class to wrap stack value to common type.
|
106
|
+
*/
|
107
|
+
class value : public snapshot_interface
|
108
|
+
{
|
109
|
+
public:
|
110
|
+
// snapshot interface
|
111
|
+
size_t snap(unsigned char* data, const snapper&) const;
|
112
|
+
const unsigned char* snap_load(const unsigned char* data, const loader&);
|
113
|
+
|
114
|
+
/// help struct to determine cpp type which represent the value_type
|
115
|
+
template<value_type>
|
116
|
+
struct ret {
|
117
|
+
using type = void;
|
118
|
+
};
|
119
|
+
|
120
|
+
constexpr value()
|
121
|
+
: snapshot_interface()
|
122
|
+
, bool_value{0}
|
123
|
+
, _type{value_type::none}
|
124
|
+
{
|
125
|
+
}
|
126
|
+
|
127
|
+
constexpr explicit value(value_type type)
|
128
|
+
: bool_value{0}
|
129
|
+
, _type{type}
|
130
|
+
{
|
131
|
+
}
|
132
|
+
|
133
|
+
explicit value(const ink::runtime::value& val);
|
134
|
+
bool set(const ink::runtime::value& val);
|
135
|
+
ink::runtime::value to_interface_value(list_table&) const;
|
136
|
+
|
137
|
+
/// get value of the type (if possible)
|
138
|
+
template<value_type ty>
|
139
|
+
typename ret<ty>::type get() const
|
140
|
+
{
|
141
|
+
static_assert(ty != ty, "No getter for this type defined!");
|
142
|
+
}
|
143
|
+
|
144
|
+
/// check if value evaluates to true
|
145
|
+
bool truthy(const list_table& lists) const;
|
146
|
+
|
147
|
+
/// set value of type (if possible)
|
148
|
+
template<value_type ty, typename... Args>
|
149
|
+
constexpr value& set(Args... args)
|
150
|
+
{
|
151
|
+
static_assert(sizeof...(Args) != sizeof...(Args), "No setter for this type defined!");
|
152
|
+
return *this;
|
153
|
+
}
|
154
|
+
|
155
|
+
/// get type of value
|
156
|
+
constexpr value_type type() const { return _type; }
|
157
|
+
|
158
|
+
/// returns if type is printable (see value_type)
|
159
|
+
constexpr bool printable() const
|
160
|
+
{
|
161
|
+
return _type >= value_type::PRINT_BEGIN && _type < value_type::PRINT_END;
|
162
|
+
}
|
163
|
+
|
164
|
+
friend basic_stream& operator<<(basic_stream& os, const value&);
|
165
|
+
// friend basic_stream& operator>>(basic_stream& is, value&); // TODO: implement
|
166
|
+
#ifdef INK_ENABLE_STL
|
167
|
+
/** write value string to ostream
|
168
|
+
* @param lists may set to list_table if list serelasation needed
|
169
|
+
*/
|
170
|
+
std::ostream& write(std::ostream&, const list_table* lists = nullptr) const;
|
171
|
+
#endif
|
172
|
+
|
173
|
+
/// execute the type exclusive overwrite function and return a new value with
|
174
|
+
/// this new type
|
175
|
+
template<typename... T>
|
176
|
+
value redefine(const value& oth, T&... env) const;
|
177
|
+
|
178
|
+
private:
|
179
|
+
template<value_type ty, typename... T>
|
180
|
+
value redefine(const value& oth, const tuple<T*...>& env) const
|
181
|
+
{
|
182
|
+
if constexpr (ty == value_type::OP_END) {
|
183
|
+
inkFail("Can't redefine value with this type! (It is not an variable type!)");
|
184
|
+
return value{};
|
185
|
+
} else if (ty != type()) {
|
186
|
+
return redefine<ty + 1>(oth, env);
|
187
|
+
} else {
|
188
|
+
return internal::redefine<ty, typename ret<ty>::type, tuple<T*...>>(env
|
189
|
+
)(get<ty>(), oth.get<ty>());
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/// actual storage
|
194
|
+
union {
|
195
|
+
bool bool_value;
|
196
|
+
int32_t int32_value;
|
197
|
+
string_type string_value;
|
198
|
+
uint32_t uint32_value;
|
199
|
+
float float_value;
|
200
|
+
|
201
|
+
struct {
|
202
|
+
uint32_t jump;
|
203
|
+
uint32_t thread_id;
|
204
|
+
} jump;
|
205
|
+
|
206
|
+
list_table::list list_value;
|
207
|
+
list_flag list_flag_value;
|
208
|
+
|
209
|
+
struct {
|
210
|
+
uint32_t addr;
|
211
|
+
bool eval; // was eval mode active in frame above
|
212
|
+
} frame_value;
|
213
|
+
|
214
|
+
struct {
|
215
|
+
hash_t name;
|
216
|
+
int ci;
|
217
|
+
} pointer;
|
218
|
+
};
|
219
|
+
|
220
|
+
static constexpr size_t max_value_size = sizeof_largest_type<
|
221
|
+
decltype(bool_value), decltype(int32_value), decltype(string_value), decltype(uint32_value),
|
222
|
+
decltype(float_value), decltype(jump), decltype(list_value), decltype(list_flag_value),
|
223
|
+
decltype(frame_value), decltype(pointer)>();
|
224
|
+
value_type _type;
|
225
|
+
};
|
226
|
+
|
227
|
+
template<value_type ty, typename T, typename ENV>
|
228
|
+
value redefine<ty, T, ENV>::operator()(const T& lh, const T& rh)
|
229
|
+
{
|
230
|
+
return value{}.set<ty>(rh);
|
231
|
+
}
|
232
|
+
|
233
|
+
// define get and set for int32
|
234
|
+
template<>
|
235
|
+
struct value::ret<value_type::int32> {
|
236
|
+
using type = int32_t;
|
237
|
+
};
|
238
|
+
|
239
|
+
template<>
|
240
|
+
inline int32_t value::get<value_type::int32>() const
|
241
|
+
{
|
242
|
+
return int32_value;
|
243
|
+
}
|
244
|
+
|
245
|
+
template<>
|
246
|
+
inline constexpr value& value::set<value_type::int32, int32_t>(int32_t v)
|
247
|
+
{
|
248
|
+
int32_value = v;
|
249
|
+
_type = value_type::int32;
|
250
|
+
return *this;
|
251
|
+
}
|
252
|
+
|
253
|
+
// define get and set for uint32
|
254
|
+
template<>
|
255
|
+
struct value::ret<value_type::uint32> {
|
256
|
+
using type = uint32_t;
|
257
|
+
};
|
258
|
+
|
259
|
+
template<>
|
260
|
+
inline uint32_t value::get<value_type::uint32>() const
|
261
|
+
{
|
262
|
+
return uint32_value;
|
263
|
+
}
|
264
|
+
|
265
|
+
template<>
|
266
|
+
inline constexpr value& value::set<value_type::uint32, uint32_t>(uint32_t v)
|
267
|
+
{
|
268
|
+
uint32_value = v;
|
269
|
+
_type = value_type::uint32;
|
270
|
+
return *this;
|
271
|
+
}
|
272
|
+
|
273
|
+
// define get and set for divert
|
274
|
+
template<>
|
275
|
+
struct value::ret<value_type::divert> {
|
276
|
+
using type = uint32_t;
|
277
|
+
};
|
278
|
+
|
279
|
+
template<>
|
280
|
+
inline uint32_t value::get<value_type::divert>() const
|
281
|
+
{
|
282
|
+
return uint32_value;
|
283
|
+
}
|
284
|
+
|
285
|
+
template<>
|
286
|
+
inline constexpr value& value::set<value_type::divert, uint32_t>(uint32_t v)
|
287
|
+
{
|
288
|
+
uint32_value = v;
|
289
|
+
_type = value_type::divert;
|
290
|
+
return *this;
|
291
|
+
}
|
292
|
+
|
293
|
+
// define get and set for float
|
294
|
+
template<>
|
295
|
+
struct value::ret<value_type::float32> {
|
296
|
+
using type = float;
|
297
|
+
};
|
298
|
+
|
299
|
+
template<>
|
300
|
+
inline float value::get<value_type::float32>() const
|
301
|
+
{
|
302
|
+
return float_value;
|
303
|
+
}
|
304
|
+
|
305
|
+
template<>
|
306
|
+
inline constexpr value& value::set<value_type::float32, float>(float v)
|
307
|
+
{
|
308
|
+
float_value = v;
|
309
|
+
_type = value_type::float32;
|
310
|
+
return *this;
|
311
|
+
}
|
312
|
+
|
313
|
+
// define get and set for boolean
|
314
|
+
template<>
|
315
|
+
struct value::ret<value_type::boolean> {
|
316
|
+
using type = bool;
|
317
|
+
};
|
318
|
+
|
319
|
+
template<>
|
320
|
+
inline bool value::get<value_type::boolean>() const
|
321
|
+
{
|
322
|
+
return bool_value;
|
323
|
+
}
|
324
|
+
|
325
|
+
template<>
|
326
|
+
inline constexpr value& value::set<value_type::boolean, bool>(bool v)
|
327
|
+
{
|
328
|
+
bool_value = v;
|
329
|
+
_type = value_type::boolean;
|
330
|
+
return *this;
|
331
|
+
}
|
332
|
+
|
333
|
+
template<>
|
334
|
+
inline constexpr value& value::set<value_type::boolean, int>(int v)
|
335
|
+
{
|
336
|
+
bool_value = static_cast<bool>(v);
|
337
|
+
_type = value_type::boolean;
|
338
|
+
return *this;
|
339
|
+
}
|
340
|
+
|
341
|
+
// define get and set for list
|
342
|
+
template<>
|
343
|
+
struct value::ret<value_type::list> {
|
344
|
+
using type = list_table::list;
|
345
|
+
};
|
346
|
+
|
347
|
+
template<>
|
348
|
+
inline list_table::list value::get<value_type::list>() const
|
349
|
+
{
|
350
|
+
return list_value;
|
351
|
+
}
|
352
|
+
|
353
|
+
template<>
|
354
|
+
inline constexpr value& value::set<value_type::list, list_table::list>(list_table::list list)
|
355
|
+
{
|
356
|
+
list_value = list;
|
357
|
+
_type = value_type::list;
|
358
|
+
return *this;
|
359
|
+
}
|
360
|
+
|
361
|
+
// define get and set for list_flag
|
362
|
+
template<>
|
363
|
+
struct value::ret<value_type::list_flag> {
|
364
|
+
using type = list_flag;
|
365
|
+
};
|
366
|
+
|
367
|
+
template<>
|
368
|
+
inline list_flag value::get<value_type::list_flag>() const
|
369
|
+
{
|
370
|
+
return list_flag_value;
|
371
|
+
}
|
372
|
+
|
373
|
+
template<>
|
374
|
+
inline constexpr value& value::set<value_type::list_flag, list_flag>(list_flag flag)
|
375
|
+
{
|
376
|
+
list_flag_value = flag;
|
377
|
+
_type = value_type::list_flag;
|
378
|
+
return *this;
|
379
|
+
}
|
380
|
+
|
381
|
+
// define get and set for string
|
382
|
+
template<>
|
383
|
+
struct value::ret<value_type::string> {
|
384
|
+
using type = string_type;
|
385
|
+
};
|
386
|
+
|
387
|
+
template<>
|
388
|
+
inline string_type value::get<value_type::string>() const
|
389
|
+
{
|
390
|
+
return string_value;
|
391
|
+
}
|
392
|
+
|
393
|
+
template<>
|
394
|
+
inline constexpr value& value::set<value_type::string, const char*>(const char* v)
|
395
|
+
{
|
396
|
+
string_value = {v};
|
397
|
+
_type = value_type::string;
|
398
|
+
return *this;
|
399
|
+
}
|
400
|
+
|
401
|
+
template<>
|
402
|
+
inline constexpr value& value::set<value_type::string, char*>(char* v)
|
403
|
+
{
|
404
|
+
string_value = {v};
|
405
|
+
_type = value_type::string;
|
406
|
+
return *this;
|
407
|
+
}
|
408
|
+
|
409
|
+
template<>
|
410
|
+
inline constexpr value&
|
411
|
+
value::set<value_type::string, const char*, bool>(const char* v, bool allocated)
|
412
|
+
{
|
413
|
+
string_value = {v, allocated};
|
414
|
+
_type = value_type::string;
|
415
|
+
return *this;
|
416
|
+
}
|
417
|
+
|
418
|
+
template<>
|
419
|
+
inline constexpr value& value::set<value_type::string, char*, bool>(char* v, bool allocated)
|
420
|
+
{
|
421
|
+
string_value = {v, allocated};
|
422
|
+
_type = value_type::string;
|
423
|
+
return *this;
|
424
|
+
}
|
425
|
+
|
426
|
+
template<>
|
427
|
+
inline constexpr value& value::set<value_type::string, string_type>(string_type str)
|
428
|
+
{
|
429
|
+
string_value = str;
|
430
|
+
_type = value_type::string;
|
431
|
+
return *this;
|
432
|
+
}
|
433
|
+
|
434
|
+
// define get and set for pointer
|
435
|
+
template<>
|
436
|
+
struct value::ret<value_type::value_pointer> {
|
437
|
+
using type = decltype(value::pointer);
|
438
|
+
};
|
439
|
+
|
440
|
+
template<>
|
441
|
+
inline value::ret<value_type::value_pointer>::type value::get<value_type::value_pointer>() const
|
442
|
+
{
|
443
|
+
return pointer;
|
444
|
+
}
|
445
|
+
|
446
|
+
template<>
|
447
|
+
inline constexpr value& value::set<value_type::value_pointer, hash_t, int>(hash_t name, int ci)
|
448
|
+
{
|
449
|
+
_type = value_type::value_pointer;
|
450
|
+
pointer.name = name;
|
451
|
+
pointer.ci = ci;
|
452
|
+
return *this;
|
453
|
+
}
|
454
|
+
|
455
|
+
// define getter and setter for jump_marker
|
456
|
+
template<>
|
457
|
+
struct value::ret<value_type::jump_marker> {
|
458
|
+
using type = decltype(value::jump);
|
459
|
+
};
|
460
|
+
|
461
|
+
template<>
|
462
|
+
inline value::ret<value_type::jump_marker>::type value::get<value_type::jump_marker>() const
|
463
|
+
{
|
464
|
+
return jump;
|
465
|
+
}
|
466
|
+
|
467
|
+
template<>
|
468
|
+
inline constexpr value&
|
469
|
+
value::set<value_type::jump_marker, decltype(value::jump)>(decltype(value::jump) v)
|
470
|
+
{
|
471
|
+
jump = v;
|
472
|
+
_type = value_type::jump_marker;
|
473
|
+
return *this;
|
474
|
+
}
|
475
|
+
|
476
|
+
template<>
|
477
|
+
inline constexpr value&
|
478
|
+
value::set<value_type::jump_marker, uint32_t, uint32_t>(uint32_t v, uint32_t j)
|
479
|
+
{
|
480
|
+
jump.jump = v;
|
481
|
+
jump.thread_id = j;
|
482
|
+
_type = value_type::jump_marker;
|
483
|
+
return *this;
|
484
|
+
}
|
485
|
+
|
486
|
+
// define getter and setter for thread_start
|
487
|
+
template<>
|
488
|
+
struct value::ret<value_type::thread_start> {
|
489
|
+
using type = decltype(value::jump);
|
490
|
+
};
|
491
|
+
|
492
|
+
template<>
|
493
|
+
inline value::ret<value_type::thread_start>::type value::get<value_type::thread_start>() const
|
494
|
+
{
|
495
|
+
return jump;
|
496
|
+
}
|
497
|
+
|
498
|
+
template<>
|
499
|
+
inline constexpr value&
|
500
|
+
value::set<value_type::thread_start, decltype(value::jump)>(decltype(value::jump) v)
|
501
|
+
{
|
502
|
+
jump = v;
|
503
|
+
_type = value_type::thread_start;
|
504
|
+
return *this;
|
505
|
+
}
|
506
|
+
|
507
|
+
template<>
|
508
|
+
inline constexpr value&
|
509
|
+
value::set<value_type::thread_start, uint32_t, uint32_t>(uint32_t v, uint32_t j)
|
510
|
+
{
|
511
|
+
jump.jump = v;
|
512
|
+
jump.thread_id = j;
|
513
|
+
_type = value_type::thread_start;
|
514
|
+
return *this;
|
515
|
+
}
|
516
|
+
|
517
|
+
// define getter and setter for thread_end
|
518
|
+
template<>
|
519
|
+
struct value::ret<value_type::thread_end> {
|
520
|
+
using type = uint32_t;
|
521
|
+
};
|
522
|
+
|
523
|
+
template<>
|
524
|
+
inline uint32_t value::get<value_type::thread_end>() const
|
525
|
+
{
|
526
|
+
return uint32_value;
|
527
|
+
}
|
528
|
+
|
529
|
+
template<>
|
530
|
+
inline constexpr value& value::set<value_type::thread_end, uint32_t>(uint32_t v)
|
531
|
+
{
|
532
|
+
uint32_value = v;
|
533
|
+
_type = value_type::thread_end;
|
534
|
+
return *this;
|
535
|
+
}
|
536
|
+
|
537
|
+
// define setter for values without storage
|
538
|
+
template<>
|
539
|
+
inline constexpr value& value::set<value_type::marker>()
|
540
|
+
{
|
541
|
+
_type = value_type::marker;
|
542
|
+
return *this;
|
543
|
+
}
|
544
|
+
|
545
|
+
template<>
|
546
|
+
inline constexpr value& value::set<value_type::glue>()
|
547
|
+
{
|
548
|
+
_type = value_type::glue;
|
549
|
+
return *this;
|
550
|
+
}
|
551
|
+
|
552
|
+
template<>
|
553
|
+
inline constexpr value& value::set<value_type::ex_fn_not_found>()
|
554
|
+
{
|
555
|
+
_type = value_type::ex_fn_not_found;
|
556
|
+
return *this;
|
557
|
+
}
|
558
|
+
|
559
|
+
template<>
|
560
|
+
inline constexpr value& value::set<value_type::newline>()
|
561
|
+
{
|
562
|
+
_type = value_type::newline;
|
563
|
+
return *this;
|
564
|
+
}
|
565
|
+
|
566
|
+
template<>
|
567
|
+
struct value::ret<value_type::newline> {
|
568
|
+
using type = const char*;
|
569
|
+
};
|
570
|
+
|
571
|
+
template<>
|
572
|
+
inline const char* value::get<value_type::newline>() const
|
573
|
+
{
|
574
|
+
static const char line_break[] = "\n";
|
575
|
+
return line_break;
|
576
|
+
}
|
577
|
+
|
578
|
+
template<>
|
579
|
+
inline constexpr value& value::set<value_type::func_start>()
|
580
|
+
{
|
581
|
+
_type = value_type::func_start;
|
582
|
+
return *this;
|
583
|
+
}
|
584
|
+
|
585
|
+
template<>
|
586
|
+
inline constexpr value& value::set<value_type::func_end>()
|
587
|
+
{
|
588
|
+
_type = value_type::func_end;
|
589
|
+
return *this;
|
590
|
+
}
|
591
|
+
|
592
|
+
template<>
|
593
|
+
inline constexpr value& value::set<value_type::null>()
|
594
|
+
{
|
595
|
+
_type = value_type::null;
|
596
|
+
return *this;
|
597
|
+
}
|
598
|
+
|
599
|
+
template<>
|
600
|
+
inline constexpr value& value::set<value_type::none>()
|
601
|
+
{
|
602
|
+
_type = value_type::none;
|
603
|
+
return *this;
|
604
|
+
}
|
605
|
+
|
606
|
+
// getter and setter for different frame types
|
607
|
+
// FIXME: the getter are not used?
|
608
|
+
template<>
|
609
|
+
struct value::ret<value_type::function_frame> {
|
610
|
+
using type = decltype(frame_value);
|
611
|
+
};
|
612
|
+
|
613
|
+
template<>
|
614
|
+
inline typename value::ret<value_type::function_frame>::type
|
615
|
+
value::get<value_type::function_frame>() const
|
616
|
+
{
|
617
|
+
return frame_value;
|
618
|
+
}
|
619
|
+
|
620
|
+
template<>
|
621
|
+
inline constexpr value& value::set<value_type::function_frame, uint32_t>(uint32_t v, bool evalOn)
|
622
|
+
{
|
623
|
+
frame_value.addr = v;
|
624
|
+
frame_value.eval = evalOn;
|
625
|
+
_type = value_type::function_frame;
|
626
|
+
return *this;
|
627
|
+
}
|
628
|
+
|
629
|
+
// FIXME: the getter are not used?
|
630
|
+
/* template<> struct value::ret<value_type::tunnel_frame>{ using type = uint32_t; }; */
|
631
|
+
/* template<> inline uint32_t value::get<value_type::tunnel_frame>() const { return uint32_value; }
|
632
|
+
*/
|
633
|
+
template<>
|
634
|
+
inline constexpr value& value::set<value_type::tunnel_frame, uint32_t>(uint32_t v, bool evalOn)
|
635
|
+
{
|
636
|
+
frame_value.addr = v;
|
637
|
+
frame_value.eval = evalOn;
|
638
|
+
_type = value_type::tunnel_frame;
|
639
|
+
return *this;
|
640
|
+
}
|
641
|
+
|
642
|
+
// FIXME: the getter are not used?
|
643
|
+
/* template<> struct value::ret<value_type::thread_frame>{ using type = uint32_t; }; */
|
644
|
+
/* template<> inline uint32_t value::get<value_type::thread_frame>() const { return uint32_value; }
|
645
|
+
*/
|
646
|
+
template<>
|
647
|
+
inline constexpr value& value::set<value_type::thread_frame, uint32_t>(uint32_t v, bool evalOn)
|
648
|
+
{
|
649
|
+
frame_value.addr = v;
|
650
|
+
frame_value.eval = evalOn;
|
651
|
+
_type = value_type::thread_frame;
|
652
|
+
return *this;
|
653
|
+
}
|
654
|
+
|
655
|
+
// static constexpr instantiations of flag values
|
656
|
+
namespace values
|
657
|
+
{
|
658
|
+
static constexpr value marker = value(value_type::marker);
|
659
|
+
static constexpr value glue = value(value_type::glue);
|
660
|
+
static constexpr value newline = value(value_type::newline);
|
661
|
+
static constexpr value func_start = value(value_type::func_start);
|
662
|
+
static constexpr value func_end = value(value_type::func_end);
|
663
|
+
static constexpr value null = value(value_type::null);
|
664
|
+
static constexpr value ex_fn_not_found = value(value_type::ex_fn_not_found);
|
665
|
+
} // namespace values
|
666
|
+
} // namespace ink::runtime::internal
|
@@ -0,0 +1,62 @@
|
|
1
|
+
add_library(inkcpp_c inkcpp.cpp
|
2
|
+
$<TARGET_OBJECTS:inkcpp_o>
|
3
|
+
$<TARGET_OBJECTS:inkcpp_compiler_o> )
|
4
|
+
target_include_directories(inkcpp_c PUBLIC
|
5
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
6
|
+
$<INSTALL_INTERFACE:include>
|
7
|
+
)
|
8
|
+
target_include_directories(inkcpp_c PUBLIC
|
9
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
10
|
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/inkcpp/include>
|
11
|
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/inkcpp_compiler/include>
|
12
|
+
$<INSTALL_INTERFACE:include>
|
13
|
+
)
|
14
|
+
set_target_properties(inkcpp_c PROPERTIES PUBLIC_HEADER "include/inkcpp.h")
|
15
|
+
target_link_libraries(inkcpp_c PRIVATE inkcpp_shared)
|
16
|
+
target_compile_definitions(inkcpp_c PRIVATE INK_BUILD_CLIB)
|
17
|
+
|
18
|
+
install(TARGETS inkcpp_c
|
19
|
+
EXPORT inkcppTarget
|
20
|
+
ARCHIVE DESTINATION "lib/ink"
|
21
|
+
COMPONENT lib EXCLUDE_FROM_ALL
|
22
|
+
PUBLIC_HEADER DESTINATION "include/ink/c"
|
23
|
+
COMPONENT lib EXCLUDE_FROM_ALL
|
24
|
+
)
|
25
|
+
|
26
|
+
install(TARGETS inkcpp_c inkcpp_shared
|
27
|
+
EXPORT inkcpp_cTarget
|
28
|
+
ARCHIVE DESTINATION "lib/ink"
|
29
|
+
COMPONENT clib EXCLUDE_FROM_ALL
|
30
|
+
PUBLIC_HEADER DESTINATION "include/ink/"
|
31
|
+
COMPONENT clib EXCLUDE_FROM_ALL)
|
32
|
+
|
33
|
+
include(CMakePackageConfigHelpers)
|
34
|
+
configure_package_config_file(${PROJECT_SOURCE_DIR}/Config.cmake.in
|
35
|
+
"${CMAKE_CURRENT_BINARY_DIR}/inkcppConfig.cmake"
|
36
|
+
INSTALL_DESTINATION "lib/cmake/inkcpp"
|
37
|
+
NO_SET_AND_CHECK_MACRO
|
38
|
+
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
39
|
+
write_basic_package_version_file(
|
40
|
+
"${CMAKE_CURRENT_BINARY_DIR}/inkcppConfigVersion.cmake"
|
41
|
+
VERSION "${inkcpp_VERSION_MAJOR}.${inkcpp_VERSION_MINOR}"
|
42
|
+
COMPATIBILITY AnyNewerVersion)
|
43
|
+
install(FILES
|
44
|
+
${CMAKE_CURRENT_BINARY_DIR}/inkcppConfig.cmake
|
45
|
+
${CMAKE_CURRENT_BINARY_DIR}/inkcppConfigVersion.cmake
|
46
|
+
DESTINATION lib/cmake/inkcpp COMPONENT clib EXCLUDE_FROM_ALL)
|
47
|
+
export(EXPORT inkcpp_cTarget
|
48
|
+
FILE "${CMAKE_CURRENT_BINARY_DIR}/inkcppTargets.cmake")
|
49
|
+
install(EXPORT inkcpp_cTarget
|
50
|
+
FILE inkcppTargets.cmake DESTINATION "lib/cmake/inkcpp"
|
51
|
+
COMPONENT clib EXCLUDE_FROM_ALL)
|
52
|
+
|
53
|
+
# configure in two steps to get the current installation prefix
|
54
|
+
set(PREFIX "@PREFIX@")
|
55
|
+
configure_file(
|
56
|
+
${CMAKE_CURRENT_SOURCE_DIR}/inkcpp_c.pc.in
|
57
|
+
${CMAKE_BINARY_DIR}/inkcpp_c.pc.in
|
58
|
+
@ONLY)
|
59
|
+
install(CODE [[
|
60
|
+
get_filename_component(PREFIX ${CMAKE_INSTALL_PREFIX} ABSOLUTE)
|
61
|
+
configure_file(inkcpp_c.pc.in ${PREFIX}/lib/pkgconfig/inkcpp.pc @ONLY)
|
62
|
+
]] COMPONENT clib EXCLUDE_FROM_ALL)
|