diff --git a/xo-procedure2/.gitrepo b/xo-procedure2/.gitrepo new file mode 100644 index 00000000..f0b013bb --- /dev/null +++ b/xo-procedure2/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme +; +[subrepo] + remote = git@github.com:Rconybea/xo-procedure2.git + branch = main + commit = 58848bc9928836e54a0f9291fe1b08f8b5ffaded + parent = 154e65e7dfd6bdd64df2d241930fba7c5e39a568 + method = merge + cmdver = 0.4.9 diff --git a/xo-procedure2/CMakeLists.txt b/xo-procedure2/CMakeLists.txt new file mode 100644 index 00000000..c567a383 --- /dev/null +++ b/xo-procedure2/CMakeLists.txt @@ -0,0 +1,169 @@ +# xo-procedure2/CMakeLists.txt + +cmake_minimum_required(VERSION 3.10) + +project(xo_procedure2 VERSION 1.0) +enable_language(CXX) + +include(GNUInstallDirs) +include(cmake/xo-bootstrap-macros.cmake) + +xo_cxx_toplevel_options3() + +# ---------------------------------------------------------------- +# c++ settings + +# one-time project-specific c++ flags. usually empty +set(PROJECT_CXX_FLAGS "") +add_definitions(${PROJECT_CXX_FLAGS}) + +# ---------------------------------------------------------------- +# output targets + +# note: manual target; generated code committed to git +xo_add_genfacet( + TARGET xo-procedure2-facet-procedure + FACET Procedure + INPUT idl/Procedure.json5 + ) + +# note: manual target; generated code committed to git +xo_add_genfacet( + TARGET xo-procedure2-facet-runtimecontext + FACET RuntimeContext + INPUT idl/RuntimeContext.json5 + ) + +# ---------------------------------------------------------------- + +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-runtimecontext-simplercx + FACET_PKG xo_procedure2 + INPUT idl/IRuntimeContext_DSimpleRcx.json5 + ) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_0 + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_0.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_0 + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_0.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_0 + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_0.json5 +) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_1_gco + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_1_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_1_gco + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_1_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_1_gco + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_1_gco.json5 +) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_gco_gco + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_gco_gco + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 +) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_dict_string + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_2_dict_string.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_dict_string + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_2_dict_string.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_dict_string + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_2_dict_string.json5 +) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_3_dict_string_gco + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_3_dict_string_gco + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 +) + +# ---------------------------------------------------------------- + +xo_add_genfacet_all(xo-procedure2-genfacet-all) + +# ---------------------------------------------------------------- + +add_subdirectory(src/procedure2) +add_subdirectory(utest) + +# end CMakeLists.txt diff --git a/xo-procedure2/README.md b/xo-procedure2/README.md new file mode 100644 index 00000000..c47415a1 --- /dev/null +++ b/xo-procedure2/README.md @@ -0,0 +1,2 @@ +# xo-procedure2 +gc-aware function interface for Schematika diff --git a/xo-procedure2/cmake/xo-bootstrap-macros.cmake b/xo-procedure2/cmake/xo-bootstrap-macros.cmake new file mode 100644 index 00000000..592272c0 --- /dev/null +++ b/xo-procedure2/cmake/xo-bootstrap-macros.cmake @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------- +# for example: +# $ PREFIX=/usr/local # for example +# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build +# +# will get +# CMAKE_MODULE_PATH +# from xo-cmake-config --cmake-module-path +# +# and expect .cmake macros in +# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake +# ---------------------------------------------------------------- + +find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED) + +if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND") + message(FATAL "could not find xo-cmake-config executable") +endif() + +message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") + +if (XO_SUBMODULE_BUILD) + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # local version of xo-cmake macros + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/xo-cmake/cmake") + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +else() + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # default to typical install location for xo-project-macros + execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH) + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +endif() + +# needs to have been installed somewhere on CMAKE_MODULE_PATH, +# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX) +# +include(xo_macros/xo_cxx) + +xo_cxx_bootstrap_message() diff --git a/xo-procedure2/cmake/xo_procedure2Config.cmake.in b/xo-procedure2/cmake/xo_procedure2Config.cmake.in new file mode 100644 index 00000000..250797df --- /dev/null +++ b/xo-procedure2/cmake/xo_procedure2Config.cmake.in @@ -0,0 +1,15 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +# note: changes to find_dependency() calls here +# must coordinate with xo_dependency() calls +# in CMakeLists.txt +# +find_dependency(xo_type) +find_dependency(xo_object2) +find_dependency(subsys) + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/xo-procedure2/doc/implementation.rst b/xo-procedure2/doc/implementation.rst new file mode 100644 index 00000000..418dc759 --- /dev/null +++ b/xo-procedure2/doc/implementation.rst @@ -0,0 +1,25 @@ +.. _implementation: + +.. toctree:: + :maxdepth: 2 + +Components +========== + +Library dependency tower for *xo-procedure2* + +.. ditaa:: + + +--------------------------------+ + | xo_gc | + +--------------------------------+ + | xo_alloc2 | + +--------------------------------+ + | xo_facet | + +----------------+---------------+ + | xo_reflectutil | xo_indentlog | + +----------------+---------------+ + | xo_cmake | + +--------------------------------+ + +Expect to have xo_facet depending on xo_arena instead of using std::unordered_map diff --git a/xo-procedure2/idl/IGCObject_DPrimitive_gco_0.json5 b/xo-procedure2/idl/IGCObject_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..e101b65c --- /dev/null +++ b/xo-procedure2/idl/IGCObject_DPrimitive_gco_0.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement AGCObject for DPrimitive _ -> gco" ], +} diff --git a/xo-procedure2/idl/IGCObject_DPrimitive_gco_1_gco.json5 b/xo-procedure2/idl/IGCObject_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..68a74f68 --- /dev/null +++ b/xo-procedure2/idl/IGCObject_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement AGCObject for DPrimitive (gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 b/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..af5861aa --- /dev/null +++ b/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement AGCObject for DPrimitive (dict x string) -> gco" ], +} diff --git a/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..e012bd84 --- /dev/null +++ b/xo-procedure2/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement AGCObject for DPrimitive (gco x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 b/xo-procedure2/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..7c61aea6 --- /dev/null +++ b/xo-procedure2/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement AGCObject for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IPrintable_DPrimitive_gco_0.json5 b/xo-procedure2/idl/IPrintable_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..7b88b4e7 --- /dev/null +++ b/xo-procedure2/idl/IPrintable_DPrimitive_gco_0.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement APrintable for DPrimitive _ -> gco" ], +} diff --git a/xo-procedure2/idl/IPrintable_DPrimitive_gco_1_gco.json5 b/xo-procedure2/idl/IPrintable_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..44493560 --- /dev/null +++ b/xo-procedure2/idl/IPrintable_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,22 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", +// "", +// "", +// "", +// "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement APrintable for DPrimitive (gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 b/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..b37a21ac --- /dev/null +++ b/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement APrintable for DPrimitive (dict x string) -> gco" ], +} diff --git a/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 b/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..7b75e0b5 --- /dev/null +++ b/xo-procedure2/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement APrintable for DPrimitive (gco x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 b/xo-procedure2/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..639402c7 --- /dev/null +++ b/xo-procedure2/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement APrintable for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IProcedure_DPrimitive_gco_0.json5 b/xo-procedure2/idl/IProcedure_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..4b0600f5 --- /dev/null +++ b/xo-procedure2/idl/IProcedure_DPrimitive_gco_0.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement AProcedure for DPrimitive _ -> gco" ], +} diff --git a/xo-procedure2/idl/IProcedure_DPrimitive_gco_1_gco.json5 b/xo-procedure2/idl/IProcedure_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..55007323 --- /dev/null +++ b/xo-procedure2/idl/IProcedure_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement AProcedure for DPrimitive (gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 b/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..1d47b474 --- /dev/null +++ b/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement AProcedure for DPrimitive (dict x string) -> gco" ], +} diff --git a/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 b/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..e74b53c4 --- /dev/null +++ b/xo-procedure2/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement AProcedure for DPrimitive (gco x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 b/xo-procedure2/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..ffb820dc --- /dev/null +++ b/xo-procedure2/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement AProcedure for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/xo-procedure2/idl/IRuntimeContext_DSimpleRcx.json5 b/xo-procedure2/idl/IRuntimeContext_DSimpleRcx.json5 new file mode 100644 index 00000000..ea42239b --- /dev/null +++ b/xo-procedure2/idl/IRuntimeContext_DSimpleRcx.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + //"", + //"", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/RuntimeContext.json5", + brief: "provide ARuntimeContext interface for DSimpleRcx", + using_doxygen: true, + repr: "DSimpleRcx", + doc: [ "implement ARuntimeContext for DSimpleRcx" ], +} diff --git a/xo-procedure2/idl/Procedure.json5 b/xo-procedure2/idl/Procedure.json5 new file mode 100644 index 00000000..25e1fed7 --- /dev/null +++ b/xo-procedure2/idl/Procedure.json5 @@ -0,0 +1,72 @@ +// can regenerate downstream .*pp files with either: +// cmake --build -- xo-procedure2-facet-procedure +// cmake --build -- xo-procedure2-genfacet-all + +{ + mode: "facet", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + // includes in ASyntaxStateMachine.hpp + includes: [ + "\"RuntimeContext.hpp\"", + "", + ], + // extra includes in Procedure.hpp, if any + user_hpp_includes: [ + ], + namespace1: "xo", + namespace2: "scm", + // text after includes, before AProcedure + pretext: [ + //"namespace xo { namespace scm { class ARuntimeContext; } }", + "namespace xo { namespace scm { class DArray; } }", + ], + facet: "Procedure", + detail_subdir: "detail", + brief: "abstraction for a schematika procedure i.e. something callable", + using_doxygen: true, + doc: [ + "Abstraction for a schematika procedure" + ], + types: [ + { + name: "AGCObject", + definition: "xo::mm::AGCObject", + doc: [ "a gc-aware object" ], + }, + // { name: string, doc: [ string ], definition: string }, + ], + const_methods: [ + { + name: "is_nary", + doc: [ "true iff procedure takes n arguments" ], + return_type: "bool", + args: [], + const: true, + noexcept: true, + attributes: [] + }, + { + name: "n_args", + doc: ["number of arguments. -1 for n-ary" ], + return_type: "std::int32_t", + args: [], + const: true, + noexcept: true, + attributes: [] + } + ], + nonconst_methods: [ + { + name: "apply_nocheck", + doc: ["invoke procedure; assume arguments satisfy type system" ], + return_type: "obj", + args: [ + {type: "obj", name: "rcx"}, + {type: "const DArray *", name: "args"}, + ] + } + ], + router_facet_explicit_content: [ ], +} diff --git a/xo-procedure2/idl/RuntimeContext.json5 b/xo-procedure2/idl/RuntimeContext.json5 new file mode 100644 index 00000000..fd829e6d --- /dev/null +++ b/xo-procedure2/idl/RuntimeContext.json5 @@ -0,0 +1,98 @@ +{ + mode: "facet", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + // includes in ARuntimeContext.hpp + includes: [ + "", + "", + "", + "" + ], + // extra includes in RuntimeContext.hpp, if any + user_hpp_includes: [ + ], + namespace1: "xo", + namespace2: "scm", + // text after includes, before ARuntimeContext + pretext: [ + //"namespace xo { namespace mm { class AAllocator; } }", + ], + facet: "RuntimeContext", + detail_subdir: "detail", + brief: "runtime context for application code. At minimum provides allocator", + using_doxygen: true, + doc: [ + "Runtime application context" + ], + types: [ + { + name: "AAllocator", + definition: "xo::mm::AAllocator", + doc: [ "xo memory allocator" ], + }, + { + name: "ACollector", + definition: "xo::mm::ACollector", + doc: [ "xo garbage collector" ], + }, + { + name: "MemorySizeVisitor", + definition: "xo::mm::MemorySizeVisitor", + doc: [ "function to visit memory pools" ], + }, + ], + const_methods: [ + { + name: "allocator", + doc: [ "default allocator to use for objects" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, + { + name: "collector", + doc: [ "collector facet for allocator. If non-null, same data pointer as allocator" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, + { + name: "error_allocator", + doc: [ "last-resort allocator for erros. e.g. regular allocator exhausted" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, + { + name: "stringtable", + doc: [ "stringtable for unique symbols" ], + return_type: "StringTable *", + args: [], + const: true, + noexcept: true, + attributes: [], + }, + { + name: "visit_pools", + doc: [ "invoke visitor for each distinct memory pool" ], + return_type: "void", + args: [ + {type: "MemorySizeVisitor", name: "visitor"} + ], + const: true, + noexcept: false, + attributes: [], + }, + ], + nonconst_methods: [ + ], + router_facet_explicit_content: [ ], +} diff --git a/xo-procedure2/include/xo/procedure2/.gitkeep b/xo-procedure2/include/xo/procedure2/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp new file mode 100644 index 00000000..a5b01251 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp @@ -0,0 +1,213 @@ +/** @file DPrimitive.hpp + * + * @author Roland Conybeare, Jan 2025 + **/ + +#pragma once + +#include "RuntimeContext.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace xo { + namespace scm { + namespace detail { + /** @brief Extract return type and argument types from a function type. + * + * Primary template (undefined) - specializations handle specific cases + **/ + template + struct PmFnTraits; + + /** specialization for function pointers **/ + template + struct PmFnTraits rcx, Args...)> { + /** function return type **/ + using return_type = R; + /** tuple type for function arguments (except for runtime context) **/ + using args_tuple = std::tuple; + /** number of arguments (except for runtime context) **/ + static constexpr std::size_t n_args = sizeof...(Args); + + /** arg_type is the type of the i'th argument to Fn. + * (starting from argument after runtime context) + **/ + template + using arg_type = std::tuple_element_t; + }; + + /** specialization for function references **/ + template + struct PmFnTraits, Args...)> : PmFnTraits, Args...)> {}; + + /** specialization for plain function types **/ + template + struct PmFnTraits, Args...)> : PmFnTraits, Args...)> {}; + } + + /** @brief Schematika primitive with fixed number of arguments + * + * Distinction between type-constructor (@ref type_) and + * type-description (@ref fn_td_): type-constructor is narrower; + * it may lift into schematika type system some information about function + * behavior. For example + * @pre + * cons :: (T x list) -> list + * @endpre + * but implementation has signature: + * @pre + * (obj x obj) -> obj + * @endpre + **/ + template + class Primitive { + public: + using FunctionPtrType = Fn; + using Traits = detail::PmFnTraits; + using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; + using AAllocator = xo::mm::AAllocator; + using DArray = xo::scm::DArray; + using Reflect = xo::reflect::Reflect; + using TypeDescr = xo::reflect::TypeDescr; + using ppindentinfo = xo::print::ppindentinfo; + + public: + /** @defgroup scm-primitive-ctors constructors **/ + ///@{ + + Primitive(std::string_view name, obj type, Fn fn) + : name_{name}, + type_{type}, + fn_td_{Reflect::require()}, + fn_{fn} {} + + static Primitive * _make(obj mm, std::string_view name, Fn fn) { + void * mem = mm.alloc_for(); + + return new (mem) Primitive(name, obj(), fn); + } + + static Primitive * _make(obj mm, + std::string_view name, + obj type, + Fn fn) + { + void * mem = mm.alloc_for(); + + return new (mem) Primitive(name, type, fn); + } + + ///@} + /** @defgroup scm-primitive-methods general methods **/ + ///@{ + + static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } + + TypeDescr fn_td() const noexcept { return fn_td_; } + std::string_view name() const noexcept { return name_; } + bool is_nary() const noexcept { return false; } + + obj apply_nocheck(obj rcx, const DArray * args) { + return _apply_nocheck(rcx, args, + std::make_index_sequence{}); + } + + ///@} + /** @defgroup scm-primitive-printable-facet **/ + ///@{ + + bool pretty(const ppindentinfo & ppii) const; + + ///@} + /** @defgroup scm-primitive-gcobject-facet **/ + ///@{ + Primitive * gco_shallow_move(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; + ///@} + + private: + template + obj _apply_nocheck(obj rcx, + const DArray * args, + std::index_sequence) + { + using xo::facet::FacetRegistry; + + using R = typename Traits::return_type; + + assert(args); + + obj mm = rcx.allocator(); + + R result + = fn_(rcx, + GCObjectConversion>::from_gco(mm, args->at(Is))... ); + + return GCObjectConversion::to_gco(mm, result); + } + + private: + /** name of this primitive **/ + std::string_view name_; + + /** primitive type-constructor. These are non-trivial to establish; + * not convenient to establish in ctor + **/ + obj type_; + + /** type description for implementation function + * Note that this type description will have additional first argument + * for obj + **/ + TypeDescr fn_td_; + + /** function implementation **/ + Fn fn_; + }; /*Primitive*/ + + template + bool + Primitive::pretty(const ppindentinfo & ppii) const + { + return ppii.pps()->pretty_struct + (ppii, + "Primitive", + refrtag("name", name_), + refrtag("td", fn_td_), + refrtag("fn", fn_)); + } + + template + Primitive * + Primitive::gco_shallow_move(obj gc) noexcept { + return gc.std_move_for(this); + } + + template + void + Primitive::visit_gco_children(xo::mm::VisitReason reason, + obj gc) noexcept { + gc.visit_poly_child(reason, &type_); + //{ + // auto e = type_.to_facet(); // FacetRegistry dep + // gc.forward_inplace(e.iface(), (void **)&(type_.data_)); + //} + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DPrimitive.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_0.hpp new file mode 100644 index 00000000..b6b02a94 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_0.hpp @@ -0,0 +1,20 @@ +/** @file DPrimitive_gco_0.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_0 = Primitive (*)(obj)>; + } +} + +/* end DPrimitive_gco_0.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..8e939677 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_1_gco.hpp @@ -0,0 +1,21 @@ +/** @file DPrimitive_gco_1_gco.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_1_gco = Primitive (*)(obj, + obj)>; + } +} + +/* end DPrimitive_gco_1_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..521dc2e1 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,25 @@ +/** @file DPrimitive_gco_2_dict_string.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_2_dict_string + = Primitive (*)(obj, + obj, + obj)>; + } +} + +/* end DPrimitive_gco_2_dict_string.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..a5895af3 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,22 @@ +/** @file DPrimitive_gco_2_gco_gco.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_2_gco_gco = Primitive (*)(obj, + obj, + obj)>; + } +} + +/* end DPrimitive_gco_2_gco_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..f566fee2 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,26 @@ +/** @file DPrimitive_gco_3_dict_string_gco.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include +#include +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_3_dict_string_gco + = Primitive (*)(obj, + obj, + obj, + obj)>; + } +} + +/* end DPrimitive_gco_3_dict_string_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/DSimpleRcx.hpp b/xo-procedure2/include/xo/procedure2/DSimpleRcx.hpp new file mode 100644 index 00000000..1bdf1f73 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/DSimpleRcx.hpp @@ -0,0 +1,45 @@ +/** @file DSimpleRcx.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include + +namespace xo { + namespace scm { + + /** @brief Minimal runtime context. + * + * Minimal runtime context provides an allocator, + * and nothing more. + **/ + class DSimpleRcx { + public: + using AAllocator = xo::mm::AAllocator; + using ACollector = xo::mm::ACollector; + using MemorySizeVisitor = xo::mm::MemorySizeVisitor; + + public: + DSimpleRcx(obj mm, obj error_mm, StringTable * st) + : allocator_{mm}, error_allocator_{error_mm}, + stringtable_{st} {} + + obj allocator() const noexcept { return allocator_; } + obj collector() const noexcept; + obj error_allocator() const noexcept { return error_allocator_; } + StringTable * stringtable() const noexcept { return stringtable_; } + void visit_pools(const MemorySizeVisitor & visitor) const; + + private: + obj allocator_; + obj error_allocator_; + StringTable * stringtable_ = nullptr; + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DSimpleRcx.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/GcPrimitives.hpp b/xo-procedure2/include/xo/procedure2/GcPrimitives.hpp new file mode 100644 index 00000000..b52b12c2 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/GcPrimitives.hpp @@ -0,0 +1,47 @@ +/** @file GcPrimitives.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + + /** @rbief primitives centered on gc/ data structures. + * (i.e. X1Collector) + **/ + class GcPrimitives { + public: + using AAllocator = xo::mm::AAllocator; + + public: + /** create primitive: report gc statistics **/ + static DPrimitive_gco_0 * make_report_gc_statistics_pm(obj mm, + StringTable * stbl); + + /** create primitive: report gc object-type statistics **/ + static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj mm, + StringTable * stbl); + + /** create primitive: report gc object-age statistics **/ + static DPrimitive_gco_0 * make_report_gc_object_ages_pm(obj mm, + StringTable * stbl); + + /** create primitive: report gc location of a value **/ + static DPrimitive_gco_1_gco * make_gc_location_of_pm(obj mm, + StringTable * stbl); + + /** create primitive: request collection **/ + static DPrimitive_gco_1_gco * make_request_gc_pm(obj mm, + StringTable * stbl); + }; + + } /*namespace scm*/ +} /*namespace xo*/ + + +/* end GcPrimitives.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/ObjectPrimitives.hpp b/xo-procedure2/include/xo/procedure2/ObjectPrimitives.hpp new file mode 100644 index 00000000..87a80457 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/ObjectPrimitives.hpp @@ -0,0 +1,62 @@ +/** @file ObjectPrimitives.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_2_dict_string.hpp" +#include "Primitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + /** @brief primitives centered on object2/ data structures. + * + * Note: they don't reside in object2/ because DPrimitive + * not available yet at that level + **/ + class ObjectPrimitives { + public: + using AAllocator = xo::mm::AAllocator; + + public: + /** create primitive: report current working directory **/ + static DPrimitive_gco_0 * make_cwd_pm(obj mm, + StringTable * stbl); + + /** create primitive: fetch nth element of a sequence **/ + static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm, + StringTable * stbl); + + /** create primitive: create cons cell **/ + static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm, + StringTable * stbl); + + /** create primitive: set first member of cons cell **/ + static DPrimitive_gco_2_gco_gco * make_set_car_pm(obj mm, + StringTable * stbl); + + /** create primitive for creating a dictionary instance **/ + static DPrimitive_gco_0 * make_dict_make_pm(obj mm, + StringTable * stbl); + + /** create primitive for creating a dictionary instance **/ + static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj mm, + StringTable * stbl); + + /** create primitive that upserts a key,value pair into a dictionary **/ + static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm, + StringTable * stbl); + + /** create primitive: get fixed number of args for function **/ + static DPrimitive_gco_1_gco * make_fn_n_args_pm(obj mm, + StringTable * stbl); + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end ObjectPrimitives.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/PrimitiveRegistry.hpp b/xo-procedure2/include/xo/procedure2/PrimitiveRegistry.hpp new file mode 100644 index 00000000..f2110d46 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/PrimitiveRegistry.hpp @@ -0,0 +1,113 @@ +/** @file PrimitiveRegistry.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include + +namespace xo { + namespace scm { + /** partition primitives based on scope. + * Each primitive associates with exactly one flag value. + * Flags also operate as bitmasks when calling + * @ref PrimitiveRegistry::install_primitives() + **/ + enum class InstallFlags { + f_none = 0x0, + + /** mandatory primitives, necessary for operator support, + * e.g. _add needed to implement infix + + **/ + f_essential = 0x1, + f_generalpurpose = 0x2, + + /** all primitives **/ + f_all = f_essential | f_generalpurpose, + }; + + inline InstallFlags operator&(InstallFlags x, InstallFlags y) { + return InstallFlags(static_cast(x) & static_cast(y)); + } + + /** provided by VSM to receive created primitives. + * InstallSink(pm) adopts a primitive + **/ + using InstallSink = std::function pm, + InstallFlags flags)>; + + /** @class PrimitiveRegistry + * + * @brief Runtime registry for primitives + * + * Singleton to remember setup code for known primitives. + * Use to gather primitives for installation in global + * environment for a virtual schematika machine (VSM) + **/ + class PrimitiveRegistry { + public: + using AAllocator = xo::mm::AAllocator; + + /** provided by a subsystem that provides primitives. + * Allocates primitives using memory from mm, delivering them + * to InstallSink sink. + **/ + using InstallSource = std::function rcx, + //obj mm, + //StringTable * stbl, + InstallSink sink, + InstallFlags flags)>; + + public: + /** singleton instance **/ + static PrimitiveRegistry & instance(); + + template + static bool install_aux(InstallSink sink, + PrimitiveRepr * pm, + InstallFlags flags) { + scope log(XO_DEBUG(false)); + + if (flags != InstallFlags::f_none) { + log && log("create primitive", xtag("name", pm->name())); + + return sink(pm->name(), + pm->fn_td(), + obj(pm), + flags); + } else { + log && log("skip primitive", xtag("name", pm->name())); + + return true; + } + } + + /** remember primitive-factory @p source_fn **/ + void register_primitives(InstallSource source_fn); + + /** create primitives using memory from @p mm, + * with global strings in @p stbl. + * delivering each primitive to @p sink. + **/ + bool install_primitives(obj rcx, + //obj mm, + //StringTable * stbl, + InstallSink sink, + InstallFlags flags); + + + private: + /** a set of factories that create primitives **/ + std::vector init_seq_v_; + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end PrimitiveRegistry.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Primitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/Primitive_gco_0.hpp new file mode 100644 index 00000000..00b2d866 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Primitive_gco_0.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_0_gco_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_0.hpp" +#include "detail/IProcedure_DPrimitive_gco_0.hpp" +#include "detail/IGCObject_DPrimitive_gco_0.hpp" +#include "detail/IPrintable_DPrimitive_gco_0.hpp" + +/* end Primitive_gco_2_gco_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Primitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/Primitive_gco_1_gco.hpp new file mode 100644 index 00000000..a30f8d4f --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Primitive_gco_1_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_1_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_1_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_1_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_1_gco.hpp" + +/* end Primitive_gco_1_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Primitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/Primitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..69f116a8 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Primitive_gco_2_dict_string.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_2_dict_string.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_2_dict_string.hpp" +#include "detail/IProcedure_DPrimitive_gco_2_dict_string.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" +#include "detail/IPrintable_DPrimitive_gco_2_dict_string.hpp" + +/* end Primitive_gco_2_dict_string.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..9e6814f4 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_2_gco_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" + +/* end Primitive_gco_2_gco_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..40a49864 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_3_dict_string_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp" + +/* end Primitive_gco_3_dict_string_gco.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/Procedure.hpp b/xo-procedure2/include/xo/procedure2/Procedure.hpp new file mode 100644 index 00000000..05d1b661 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/Procedure.hpp @@ -0,0 +1,22 @@ +/** @file Procedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for facet .hpp file: + * [facet.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "detail/AProcedure.hpp" +#include "detail/IProcedure_Any.hpp" +#include "detail/IProcedure_Xfer.hpp" +#include "detail/RProcedure.hpp" + + +/* end Procedure.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/RuntimeContext.hpp b/xo-procedure2/include/xo/procedure2/RuntimeContext.hpp new file mode 100644 index 00000000..48891944 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/RuntimeContext.hpp @@ -0,0 +1,22 @@ +/** @file RuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for facet .hpp file: + * [facet.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "detail/ARuntimeContext.hpp" +#include "detail/IRuntimeContext_Any.hpp" +#include "detail/IRuntimeContext_Xfer.hpp" +#include "detail/RRuntimeContext.hpp" + + +/* end RuntimeContext.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/SetupProcedure2.hpp b/xo-procedure2/include/xo/procedure2/SetupProcedure2.hpp new file mode 100644 index 00000000..1363d7eb --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/SetupProcedure2.hpp @@ -0,0 +1,29 @@ +/** @file SetupProcedure2.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include "PrimitiveRegistry.hpp" +#include + +namespace xo { + namespace scm { + struct SetupProcedure2 { + public: + using ACollector = xo::mm::ACollector; + + public: + /** Register procedure2 (facet,impl) combinations with FacetRegistry **/ + static bool register_facets(); + /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ + static bool register_types(obj gc); + static bool register_primitives(obj rcx, + InstallSink sink, + InstallFlags flags); + }; + } +} + +/* end SetupProcedure2.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/SimpleRcx.hpp b/xo-procedure2/include/xo/procedure2/SimpleRcx.hpp new file mode 100644 index 00000000..2fdc4929 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/SimpleRcx.hpp @@ -0,0 +1,11 @@ +/** @file SimpleRcx.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include "DSimpleRcx.hpp" +#include "detail/IRuntimeContext_DSimpleRcx.hpp" + +/* end SimpleRcx.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/AProcedure.hpp b/xo-procedure2/include/xo/procedure2/detail/AProcedure.hpp new file mode 100644 index 00000000..2197c5df --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/AProcedure.hpp @@ -0,0 +1,86 @@ +/** @file AProcedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [abstract_facet.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +// includes (via {facet_includes}) +#include "RuntimeContext.hpp" +#include +#include +#include +#include + +namespace xo { namespace scm { class DArray; } } + +namespace xo { +namespace scm { + +using Copaque = const void *; +using Opaque = void *; + +/** +Abstraction for a schematika procedure +**/ +class AProcedure { +public: + /** @defgroup scm-procedure-type-traits **/ + ///@{ + // types + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using Copaque = const void *; + using Opaque = void *; + /** a gc-aware object **/ + using AGCObject = xo::mm::AGCObject; + ///@} + + /** @defgroup scm-procedure-methods **/ + ///@{ + // const methods + /** An uninitialized AProcedure instance will have zero vtable pointer (per {linux,osx} abi). + * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example + * obj will have non-null vtable (via IFacet_Any) with all methods terminating. + **/ + bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } + /** RTTI: unique id# for actual runtime data representation **/ + virtual typeseq _typeseq() const noexcept = 0; + /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ + virtual void _drop(Opaque d) const noexcept = 0; + /** true iff procedure takes n arguments **/ + virtual bool is_nary(Copaque data) const noexcept = 0; + /** number of arguments. -1 for n-ary **/ + virtual std::int32_t n_args(Copaque data) const noexcept = 0; + + // nonconst methods + /** invoke procedure; assume arguments satisfy type system **/ + virtual obj apply_nocheck(Opaque data, obj rcx, const DArray * args) = 0; + ///@} +}; /*AProcedure*/ + +/** Implementation IProcedure_DRepr of AProcedure for state DRepr + * should provide a specialization: + * + * template <> + * struct xo::facet::FacetImplementation { + * using Impltype = IProcedure_DRepr; + * }; + * + * then IProcedure_ImplType --> IProcedure_DRepr + **/ +template +using IProcedure_ImplType = xo::facet::FacetImplType; + +} /*namespace scm*/ +} /*namespace xo*/ + +/* AProcedure.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/ARuntimeContext.hpp b/xo-procedure2/include/xo/procedure2/detail/ARuntimeContext.hpp new file mode 100644 index 00000000..a6d6d4c3 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -0,0 +1,95 @@ +/** @file ARuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [abstract_facet.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +// includes (via {facet_includes}) +#include +#include +#include +#include +#include +#include +#include + + +namespace xo { +namespace scm { + +using Copaque = const void *; +using Opaque = void *; + +/** +Runtime application context +**/ +class ARuntimeContext { +public: + /** @defgroup scm-runtimecontext-type-traits **/ + ///@{ + // types + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using Copaque = const void *; + using Opaque = void *; + /** xo memory allocator **/ + using AAllocator = xo::mm::AAllocator; + /** xo garbage collector **/ + using ACollector = xo::mm::ACollector; + /** function to visit memory pools **/ + using MemorySizeVisitor = xo::mm::MemorySizeVisitor; + ///@} + + /** @defgroup scm-runtimecontext-methods **/ + ///@{ + // const methods + /** An uninitialized ARuntimeContext instance will have zero vtable pointer (per {linux,osx} abi). + * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example + * obj will have non-null vtable (via IFacet_Any) with all methods terminating. + **/ + bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } + /** RTTI: unique id# for actual runtime data representation **/ + virtual typeseq _typeseq() const noexcept = 0; + /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ + virtual void _drop(Opaque d) const noexcept = 0; + /** default allocator to use for objects **/ + virtual obj allocator(Copaque data) const noexcept = 0; + /** collector facet for allocator. If non-null, same data pointer as allocator **/ + virtual obj collector(Copaque data) const noexcept = 0; + /** last-resort allocator for erros. e.g. regular allocator exhausted **/ + virtual obj error_allocator(Copaque data) const noexcept = 0; + /** stringtable for unique symbols **/ + virtual StringTable * stringtable(Copaque data) const noexcept = 0; + /** invoke visitor for each distinct memory pool **/ + virtual void visit_pools(Copaque data, MemorySizeVisitor visitor) const = 0; + + // nonconst methods + ///@} +}; /*ARuntimeContext*/ + +/** Implementation IRuntimeContext_DRepr of ARuntimeContext for state DRepr + * should provide a specialization: + * + * template <> + * struct xo::facet::FacetImplementation { + * using Impltype = IRuntimeContext_DRepr; + * }; + * + * then IRuntimeContext_ImplType --> IRuntimeContext_DRepr + **/ +template +using IRuntimeContext_ImplType = xo::facet::FacetImplType; + +} /*namespace scm*/ +} /*namespace xo*/ + +/* ARuntimeContext.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..93e4f5d4 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -0,0 +1,69 @@ +/** @file IGCObject_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_0 + **/ + class IGCObject_DPrimitive_gco_0 { + public: + /** @defgroup scm-gcobject-dprimitive_gco_0-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_0-methods **/ + ///@{ + // const methods + + // non-const methods + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj fn) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..40388dff --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,69 @@ +/** @file IGCObject_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_1_gco + **/ + class IGCObject_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + + // non-const methods + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, obj fn) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..29705521 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,69 @@ +/** @file IGCObject_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_2_dict_string + **/ + class IGCObject_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-gcobject-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + + // non-const methods + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, obj fn) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..13ab7b3e --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,69 @@ +/** @file IGCObject_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_2_gco_gco + **/ + class IGCObject_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + + // non-const methods + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, obj fn) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..bcf0f9ba --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,69 @@ +/** @file IGCObject_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_3_dict_string_gco + **/ + class IGCObject_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + + // non-const methods + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, obj fn) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..d8b30128 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_0 + **/ + class IPrintable_DPrimitive_gco_0 { + public: + /** @defgroup scm-printable-dprimitive_gco_0-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_0-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_0 & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..f3743cc4 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_1_gco + **/ + class IPrintable_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_1_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..fac4a58b --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_2_dict_string + **/ + class IPrintable_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-printable-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_2_dict_string & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..688ee6eb --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_2_gco_gco + **/ + class IPrintable_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_2_gco_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..4ef7ada3 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_3_dict_string_gco + **/ + class IPrintable_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_3_dict_string_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_Any.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_Any.hpp new file mode 100644 index 00000000..10dccea5 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_Any.hpp @@ -0,0 +1,91 @@ +/** @file IProcedure_Any.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "AProcedure.hpp" +#include + +namespace xo { namespace scm { class IProcedure_Any; } } + +namespace xo { +namespace facet { + +template <> +struct FacetImplementation +{ + using ImplType = xo::scm::IProcedure_Any; +}; + +} +} + +namespace xo { +namespace scm { + + /** @class IProcedure_Any + * @brief AProcedure implementation for empty variant instance + **/ + class IProcedure_Any : public AProcedure { + public: + /** @defgroup scm-procedure-any-type-traits **/ + ///@{ + + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using AGCObject = AProcedure::AGCObject; + + ///@} + /** @defgroup scm-procedure-any-methods **/ + ///@{ + + const AProcedure * iface() const { return std::launder(this); } + + // from AProcedure + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + [[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); } + + // const methods + [[noreturn]] bool is_nary(Copaque) const noexcept override { _fatal(); } + [[noreturn]] std::int32_t n_args(Copaque) const noexcept override { _fatal(); } + + // nonconst methods + [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; + + ///@} + + private: + /** @defgraoup scm-procedure-any-private-methods **/ + ///@{ + + [[noreturn]] static void _fatal(); + + ///@} + + public: + /** @defgroup scm-procedure-any-member-vars **/ + ///@{ + + static typeseq s_typeseq; + static bool _valid; + + ///@} + }; + +} /*namespace scm */ +} /*namespace xo */ + +/* IProcedure_Any.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..cd1a9b3a --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_0 + **/ + class IProcedure_DPrimitive_gco_0 { + public: + /** @defgroup scm-procedure-dprimitive_gco_0-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_0-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_0 & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_0 & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_0 & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..415874f8 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_1_gco + **/ + class IProcedure_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_1_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_1_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_1_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..bdb5bc81 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_2_dict_string + **/ + class IProcedure_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-procedure-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_2_dict_string & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_2_dict_string & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_2_dict_string & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..858edfa5 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_2_gco_gco + **/ + class IProcedure_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_2_gco_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_2_gco_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..6001397c --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_3_dict_string_gco + **/ + class IProcedure_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_3_dict_string_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_3_dict_string_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_3_dict_string_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/xo-procedure2/include/xo/procedure2/detail/IProcedure_Xfer.hpp new file mode 100644 index 00000000..ebbbeb41 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -0,0 +1,99 @@ +/** @file IProcedure_Xfer.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + * + * variables: + * {facet_hpp_fname} -> Procedure.hpp + * {impl_hpp_subdir} -> detail + * {facet_ns1} -> xo + * {facet_detail_subdir} -> detail + * {abstract_facet_fname} -> AProcedure.hpp + **/ + +#pragma once + +#include "AProcedure.hpp" +#include "RuntimeContext.hpp" +#include + +namespace xo { +namespace scm { + /** @class IProcedure_Xfer + **/ + template + class IProcedure_Xfer : public AProcedure { + public: + /** @defgroup scm-procedure-xfer-type-traits **/ + ///@{ + /** actual implementation (not generated; often delegates to DRepr) **/ + using Impl = IProcedure_DRepr; + /** integer identifying a type **/ + using typeseq = AProcedure::typeseq; + using AGCObject = AProcedure::AGCObject; + ///@} + + /** @defgroup scm-procedure-xfer-methods **/ + ///@{ + + static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; } + static DRepr & _dcast(Opaque d) { return *(DRepr *)d; } + + // from AProcedure + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); } + + // const methods + bool is_nary(Copaque data) const noexcept override { + return I::is_nary(_dcast(data)); + } + std::int32_t n_args(Copaque data) const noexcept override { + return I::n_args(_dcast(data)); + } + + // non-const methods + obj apply_nocheck(Opaque data, obj rcx, const DArray * args) override { + return I::apply_nocheck(_dcast(data), rcx, args); + } + + ///@} + + private: + using I = Impl; + + public: + /** @defgroup scm-procedure-xfer-member-vars **/ + ///@{ + + /** typeseq for template parameter DRepr **/ + static typeseq s_typeseq; + /** true iff satisfies facet implementation **/ + static bool _valid; + + ///@} + }; + + template + xo::facet::typeseq + IProcedure_Xfer::s_typeseq + = xo::facet::typeseq::id(); + + template + bool + IProcedure_Xfer::_valid + = xo::facet::valid_facet_implementation(); + +} /*namespace scm */ +} /*namespace xo*/ + +/* end IProcedure_Xfer.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Any.hpp new file mode 100644 index 00000000..89a0d7a9 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -0,0 +1,95 @@ +/** @file IRuntimeContext_Any.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "ARuntimeContext.hpp" +#include + +namespace xo { namespace scm { class IRuntimeContext_Any; } } + +namespace xo { +namespace facet { + +template <> +struct FacetImplementation +{ + using ImplType = xo::scm::IRuntimeContext_Any; +}; + +} +} + +namespace xo { +namespace scm { + + /** @class IRuntimeContext_Any + * @brief ARuntimeContext implementation for empty variant instance + **/ + class IRuntimeContext_Any : public ARuntimeContext { + public: + /** @defgroup scm-runtimecontext-any-type-traits **/ + ///@{ + + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; + + ///@} + /** @defgroup scm-runtimecontext-any-methods **/ + ///@{ + + const ARuntimeContext * iface() const { return std::launder(this); } + + // from ARuntimeContext + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + [[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); } + + // const methods + [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } + [[noreturn]] obj collector(Copaque) const noexcept override { _fatal(); } + [[noreturn]] obj error_allocator(Copaque) const noexcept override { _fatal(); } + [[noreturn]] StringTable * stringtable(Copaque) const noexcept override { _fatal(); } + [[noreturn]] void visit_pools(Copaque, MemorySizeVisitor) const override { _fatal(); } + + // nonconst methods + + ///@} + + private: + /** @defgraoup scm-runtimecontext-any-private-methods **/ + ///@{ + + [[noreturn]] static void _fatal(); + + ///@} + + public: + /** @defgroup scm-runtimecontext-any-member-vars **/ + ///@{ + + static typeseq s_typeseq; + static bool _valid; + + ///@} + }; + +} /*namespace scm */ +} /*namespace xo */ + +/* IRuntimeContext_Any.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp new file mode 100644 index 00000000..cf2a052f --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -0,0 +1,69 @@ +/** @file IRuntimeContext_DSimpleRcx.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DSimpleRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DSimpleRcx.json5] + **/ + +#pragma once + +#include "RuntimeContext.hpp" +#include "DSimpleRcx.hpp" + +namespace xo { namespace scm { class IRuntimeContext_DSimpleRcx; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IRuntimeContext_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IRuntimeContext_DSimpleRcx + **/ + class IRuntimeContext_DSimpleRcx { + public: + /** @defgroup scm-runtimecontext-dsimplercx-type-traits **/ + ///@{ + using AAllocator = xo::scm::ARuntimeContext::AAllocator; + using ACollector = xo::scm::ARuntimeContext::ACollector; + using MemorySizeVisitor = xo::scm::ARuntimeContext::MemorySizeVisitor; + using Copaque = xo::scm::ARuntimeContext::Copaque; + using Opaque = xo::scm::ARuntimeContext::Opaque; + ///@} + /** @defgroup scm-runtimecontext-dsimplercx-methods **/ + ///@{ + // const methods + /** default allocator to use for objects **/ + static obj allocator(const DSimpleRcx & self) noexcept; + /** collector facet for allocator. If non-null, same data pointer as allocator **/ + static obj collector(const DSimpleRcx & self) noexcept; + /** last-resort allocator for erros. e.g. regular allocator exhausted **/ + static obj error_allocator(const DSimpleRcx & self) noexcept; + /** stringtable for unique symbols **/ + static StringTable * stringtable(const DSimpleRcx & self) noexcept; + /** invoke visitor for each distinct memory pool **/ + static void visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp new file mode 100644 index 00000000..ad33ea54 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -0,0 +1,109 @@ +/** @file IRuntimeContext_Xfer.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + * + * variables: + * {facet_hpp_fname} -> RuntimeContext.hpp + * {impl_hpp_subdir} -> detail + * {facet_ns1} -> xo + * {facet_detail_subdir} -> detail + * {abstract_facet_fname} -> ARuntimeContext.hpp + **/ + +#pragma once + +#include "ARuntimeContext.hpp" +#include +#include +#include +#include + +namespace xo { +namespace scm { + /** @class IRuntimeContext_Xfer + **/ + template + class IRuntimeContext_Xfer : public ARuntimeContext { + public: + /** @defgroup scm-runtimecontext-xfer-type-traits **/ + ///@{ + /** actual implementation (not generated; often delegates to DRepr) **/ + using Impl = IRuntimeContext_DRepr; + /** integer identifying a type **/ + using typeseq = ARuntimeContext::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; + ///@} + + /** @defgroup scm-runtimecontext-xfer-methods **/ + ///@{ + + static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; } + static DRepr & _dcast(Opaque d) { return *(DRepr *)d; } + + // from ARuntimeContext + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); } + + // const methods + obj allocator(Copaque data) const noexcept override { + return I::allocator(_dcast(data)); + } + obj collector(Copaque data) const noexcept override { + return I::collector(_dcast(data)); + } + obj error_allocator(Copaque data) const noexcept override { + return I::error_allocator(_dcast(data)); + } + StringTable * stringtable(Copaque data) const noexcept override { + return I::stringtable(_dcast(data)); + } + void visit_pools(Copaque data, MemorySizeVisitor visitor) const override { + return I::visit_pools(_dcast(data), visitor); + } + + // non-const methods + + ///@} + + private: + using I = Impl; + + public: + /** @defgroup scm-runtimecontext-xfer-member-vars **/ + ///@{ + + /** typeseq for template parameter DRepr **/ + static typeseq s_typeseq; + /** true iff satisfies facet implementation **/ + static bool _valid; + + ///@} + }; + + template + xo::facet::typeseq + IRuntimeContext_Xfer::s_typeseq + = xo::facet::typeseq::id(); + + template + bool + IRuntimeContext_Xfer::_valid + = xo::facet::valid_facet_implementation(); + +} /*namespace scm */ +} /*namespace xo*/ + +/* end IRuntimeContext_Xfer.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/RProcedure.hpp b/xo-procedure2/include/xo/procedure2/detail/RProcedure.hpp new file mode 100644 index 00000000..191bd37e --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/RProcedure.hpp @@ -0,0 +1,91 @@ +/** @file RProcedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "AProcedure.hpp" + +namespace xo { +namespace scm { + +/** @class RProcedure + **/ +template +class RProcedure : public Object { +private: + using O = Object; + +public: + /** @defgroup scm-procedure-router-type-traits **/ + ///@{ + using ObjectType = Object; + using DataPtr = Object::DataPtr; + using typeseq = xo::reflect::typeseq; + using AGCObject = AProcedure::AGCObject; + ///@} + + /** @defgroup scm-procedure-router-ctors **/ + ///@{ + RProcedure() {} + RProcedure(Object::DataPtr data) : Object{std::move(data)} {} + RProcedure(const AProcedure * iface, void * data) + requires std::is_same_v + : Object(iface, data) {} + + ///@} + /** @defgroup scm-procedure-router-methods **/ + ///@{ + + // explicit injected content + + // builtin methods + typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + void _drop() const noexcept { O::iface()->_drop(O::data()); } + + // const methods + bool is_nary() const noexcept { + return O::iface()->is_nary(O::data()); + } + std::int32_t n_args() const noexcept { + return O::iface()->n_args(O::data()); + } + + // non-const methods (still const in router!) + obj apply_nocheck(obj rcx, const DArray * args) { + return O::iface()->apply_nocheck(O::data(), rcx, args); + } + + ///@} + /** @defgroup scm-procedure-member-vars **/ + ///@{ + + static bool _valid; + + ///@} +}; + +template +bool +RProcedure::_valid = xo::facet::valid_object_router(); + +} /*namespace scm*/ +} /*namespace xo*/ + +namespace xo { namespace facet { + template + struct RoutingFor { + using RoutingType = xo::scm::RProcedure; + }; +} } + +/* end RProcedure.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/detail/RRuntimeContext.hpp b/xo-procedure2/include/xo/procedure2/detail/RRuntimeContext.hpp new file mode 100644 index 00000000..9c047fd2 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -0,0 +1,99 @@ +/** @file RRuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "ARuntimeContext.hpp" + +namespace xo { +namespace scm { + +/** @class RRuntimeContext + **/ +template +class RRuntimeContext : public Object { +private: + using O = Object; + +public: + /** @defgroup scm-runtimecontext-router-type-traits **/ + ///@{ + using ObjectType = Object; + using DataPtr = Object::DataPtr; + using typeseq = xo::reflect::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; + ///@} + + /** @defgroup scm-runtimecontext-router-ctors **/ + ///@{ + RRuntimeContext() {} + RRuntimeContext(Object::DataPtr data) : Object{std::move(data)} {} + RRuntimeContext(const ARuntimeContext * iface, void * data) + requires std::is_same_v + : Object(iface, data) {} + + ///@} + /** @defgroup scm-runtimecontext-router-methods **/ + ///@{ + + // explicit injected content + + // builtin methods + typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + void _drop() const noexcept { O::iface()->_drop(O::data()); } + + // const methods + obj allocator() const noexcept { + return O::iface()->allocator(O::data()); + } + obj collector() const noexcept { + return O::iface()->collector(O::data()); + } + obj error_allocator() const noexcept { + return O::iface()->error_allocator(O::data()); + } + StringTable * stringtable() const noexcept { + return O::iface()->stringtable(O::data()); + } + void visit_pools(MemorySizeVisitor visitor) const { + return O::iface()->visit_pools(O::data(), visitor); + } + + // non-const methods (still const in router!) + + ///@} + /** @defgroup scm-runtimecontext-member-vars **/ + ///@{ + + static bool _valid; + + ///@} +}; + +template +bool +RRuntimeContext::_valid = xo::facet::valid_object_router(); + +} /*namespace scm*/ +} /*namespace xo*/ + +namespace xo { namespace facet { + template + struct RoutingFor { + using RoutingType = xo::scm::RRuntimeContext; + }; +} } + +/* end RRuntimeContext.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/init_primitives.hpp b/xo-procedure2/include/xo/procedure2/init_primitives.hpp new file mode 100644 index 00000000..14f5fdc8 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/init_primitives.hpp @@ -0,0 +1,58 @@ +/** @file init_primitives.hpp **/ + +#pragma once + +#include "DPrimitive.hpp" +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { +/** TODO: move this into xo-reader2 ? **/ + +#ifdef NOT_YET + using Primitive_f64_1_f64 = Primitive; + using Primitive_f64_2_f64_f64 = Primitive; +#endif + + struct Primitives { +#ifdef OBSOLETE // see xo-numeric/src/numeric/NumericPrimitives.cpp + /** polymorphic multiply + * + * TODO: this will want to move to xo-numeric/ + * so we can dispatch on vector, matrix, function types + **/ + static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; + + /** polymorphic subtract + * + * TODO: this will want to move to xo-numeric/ + * so we can dispatch on vector, matrix, function types + **/ + static DPrimitive_gco_2_gco_gco s_sub_gco_gco_pm; + + /** polymorphic equality comparison + * + * TODO: this will want to move to x-numeric/ + **/ + static DPrimitive_gco_2_gco_gco s_equal_gco_gco_pm; +#endif + +#ifdef NOT_YET + static Primitive_f64_1_f64 s_neg_f64_pm; + + static Primitive_f64_2_f64_f64 s_add_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_sub_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_mul_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_div_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_pow_f64_f64_pm; + + static Primitive_f64_1_f64 s_log_f64_pm; + static Primitive_f64_1_f64 s_sin_f64_pm; + static Primitive_f64_1_f64 s_cos_f64_pm; + static Primitive_f64_1_f64 s_tan_f64_pm; +#endif + }; + } +} + +/* end init_primitives.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/init_procedure2.hpp b/xo-procedure2/include/xo/procedure2/init_procedure2.hpp new file mode 100644 index 00000000..793cc061 --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/init_procedure2.hpp @@ -0,0 +1,21 @@ +/** @file init_procedure2.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-procedure2/ subsystem within ordered iniitalization */ + enum S_procedure2_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; +} /*namespace xo*/ + +/* end init_procedure2.hpp */ diff --git a/xo-procedure2/include/xo/procedure2/primitives.hpp b/xo-procedure2/include/xo/procedure2/primitives.hpp new file mode 100644 index 00000000..e2e0d88a --- /dev/null +++ b/xo-procedure2/include/xo/procedure2/primitives.hpp @@ -0,0 +1,13 @@ +/** @file primitives.hpp **/ + +#pragma once + +namespace xo { + namespace scm { + struct Primitives { + static void init_primitives(); + }; + } +} + +/* end primitives.hpp */ diff --git a/xo-procedure2/src/procedure2/CMakeLists.txt b/xo-procedure2/src/procedure2/CMakeLists.txt new file mode 100644 index 00000000..f4314fea --- /dev/null +++ b/xo-procedure2/src/procedure2/CMakeLists.txt @@ -0,0 +1,54 @@ +# xo-procedure2/src/CMakeLists.txt + +set(SELF_LIB xo_procedure2) +set(SELF_SRCS + init_procedure2.cpp + init_primitives.cpp + SetupProcedure2.cpp + ObjectPrimitives.cpp + GcPrimitives.cpp + PrimitiveRegistry.cpp + DPrimitive.cpp + DSimpleRcx.cpp + facet/IRuntimeContext_Any.cpp + facet/IRuntimeContext_DSimpleRcx.cpp + facet/IProcedure_Any.cpp + facet/IGCObject_DPrimitive_gco_0.cpp + facet/IProcedure_DPrimitive_gco_0.cpp + facet/IPrintable_DPrimitive_gco_0.cpp + facet/IGCObject_DPrimitive_gco_1_gco.cpp + facet/IProcedure_DPrimitive_gco_1_gco.cpp + facet/IPrintable_DPrimitive_gco_1_gco.cpp + facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp + facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp + facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp + facet/IGCObject_DPrimitive_gco_2_dict_string.cpp + facet/IProcedure_DPrimitive_gco_2_dict_string.cpp + facet/IPrintable_DPrimitive_gco_2_dict_string.cpp + facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp + facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp + facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp +) + +xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) +xo_install_include_tree3(include/xo/procedure2) + +# ---------------------------------------------------------------- +# input dependencies +# +# NOTE: dependency set here must be kept consistent with +# xo-procedure2/cmake/xo_procedure2Config.cmake.in + +xo_dependency(${SELF_LIB} xo_type) +xo_dependency(${SELF_LIB} xo_object2) +xo_dependency(${SELF_LIB} subsys) + +xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) + +# ---------------------------------------------------------------- +# docs targets depend on other library/utest/exec targets above, +# --> must come after them. +# +#add_subdirectory(docs) + +# end src/CMakeLists.txt diff --git a/xo-procedure2/src/procedure2/DPrimitive.cpp b/xo-procedure2/src/procedure2/DPrimitive.cpp new file mode 100644 index 00000000..44903cc2 --- /dev/null +++ b/xo-procedure2/src/procedure2/DPrimitive.cpp @@ -0,0 +1,16 @@ +/** @file DPrimitive.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "DPrimitive.hpp" +#include + +namespace xo { + namespace scm { + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DPrimitive.cpp */ diff --git a/xo-procedure2/src/procedure2/DSimpleRcx.cpp b/xo-procedure2/src/procedure2/DSimpleRcx.cpp new file mode 100644 index 00000000..471cad75 --- /dev/null +++ b/xo-procedure2/src/procedure2/DSimpleRcx.cpp @@ -0,0 +1,29 @@ +/** @file DSimpleRcx.cpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DSimpleRcx.hpp" +#include +#include + +namespace xo { + using xo::mm::ACollector; + + namespace scm { + + obj + DSimpleRcx::collector() const noexcept + { + return allocator_.try_to_facet(); + } + + void + DSimpleRcx::visit_pools(const MemorySizeVisitor & visitor) const + { + allocator_.visit_pools(visitor); + } + } +} + +/* end DSimpleRcx.cpp */ diff --git a/xo-procedure2/src/procedure2/GcPrimitives.cpp b/xo-procedure2/src/procedure2/GcPrimitives.cpp new file mode 100644 index 00000000..353c0741 --- /dev/null +++ b/xo-procedure2/src/procedure2/GcPrimitives.cpp @@ -0,0 +1,172 @@ +/** @file GcPrimitives.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "GcPrimitives.hpp" +#include +#include +//#include +#include +#include +#include +#include + +namespace xo { + using xo::mm::ACollector; + //using xo::mm::DX1Collector; + using xo::mm::Generation; + + namespace scm { + + // ----- report-gc-status ----- + + obj + xfer_report_gc_statistics(obj rcx) + { + if (rcx.collector()) { + obj stats; + bool ok = rcx.collector().report_statistics(rcx.allocator(), + rcx.error_allocator(), + &stats); + + if (ok && stats) + return stats; + } + + return DBoolean::box(rcx.allocator(), false); + } + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_statistics_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-statistics", pm_ty, &xfer_report_gc_statistics); + } + + // ----- report-gc-object-types ----- + + obj + xfer_report_gc_object_types(obj rcx) + { + if (rcx.collector()) { + obj stats; + bool ok = rcx.collector().report_object_types(rcx.allocator(), rcx.error_allocator(), &stats); + + if (ok && stats) + return stats; + } + + return DBoolean::box(rcx.allocator(), false); + } + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_object_types_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-object-types", pm_ty, &xfer_report_gc_object_types); + + } + + // ----- report-gc-object-ages ----- + + obj + xfer_report_gc_object_ages(obj rcx) + { + if (rcx.collector()) { + obj stats; + bool ok = rcx.collector().report_object_ages(rcx.allocator(), rcx.error_allocator(), &stats); + + if (ok && stats) + return stats; + } + + return DBoolean::box(rcx.allocator(), false); + } + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_object_ages_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-object-ages", pm_ty, &xfer_report_gc_object_ages); + } + + // ----- gc-location-of ----- + + obj + xfer_gc_location_of(obj rcx, obj gco) + { + std::int32_t location_code = 0; + + if (rcx.collector()) { + location_code = rcx.collector().locate_address(gco.data()); + } + + return DInteger::box(rcx.allocator(), location_code); + } + + DPrimitive_gco_1_gco * + GcPrimitives::make_gc_location_of_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, int_ty, any_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "gc-location-of", pm_ty, &xfer_gc_location_of); + } + + // ----- request-gc ----- + + obj + xfer_request_gc(obj rcx, + obj upto_gco) + { + bool have_gc = false; + + if (rcx.collector()) { + Generation upto(obj::from(upto_gco)); + + rcx.collector().request_gc(upto); + + have_gc = true; + } + + return DBoolean::box(rcx.allocator(), have_gc); + } + + DPrimitive_gco_1_gco * + GcPrimitives::make_request_gc_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto bool_ty = DAtomicType::make(mm, Metatype::t_bool()); + auto pm_ty = obj(DFunctionType::_make(mm, + bool_ty, + int_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "request-gc", pm_ty, &xfer_request_gc); + } + } +} + +/* end GcPrimitives.cpp */ diff --git a/xo-procedure2/src/procedure2/ObjectPrimitives.cpp b/xo-procedure2/src/procedure2/ObjectPrimitives.cpp new file mode 100644 index 00000000..367a0bc4 --- /dev/null +++ b/xo-procedure2/src/procedure2/ObjectPrimitives.cpp @@ -0,0 +1,309 @@ +/** @file ObjectPrimitives.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "ObjectPrimitives.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for getcwd() + +namespace xo { + using xo::scm::ASequence; + using xo::print::APrintable; + using xo::mm::AAllocator; + using xo::mm::AGCObject; + using xo::facet::FacetRegistry; + using xo::facet::TypeRegistry; + + namespace scm { + + // ----- cwd ----- + + obj + xfer_cwd(obj rcx) + { + char buf[PATH_MAX]; + char * cwd = ::getcwd(buf, sizeof(buf)); + + return obj(DString::from_cstr(rcx.allocator(), cwd)); + } + + DPrimitive_gco_0 * + ObjectPrimitives::make_cwd_pm(obj mm, StringTable * stbl) + { + (void)stbl; + + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto cwd_ty + = obj(DFunctionType::_make(mm, str_ty)); + + return DPrimitive_gco_0::_make(mm, "cwd", cwd_ty, &xfer_cwd); + } + + // ----- nth ----- + + // TODO: seq_gc -> obj + // n_gco -> obj + // + obj + xfer_nth(obj rcx, + obj seq_gco, + obj n_gco) + { + (void)rcx; + + obj seq = seq_gco.to_facet(); + auto n = obj::from(n_gco); + + return seq.at(n->value()); + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_nth_pm(obj mm, StringTable * stbl) + { + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + /** nth_ty: list x int -> T **/ + auto nth_ty + = obj + (DFunctionType::_make(mm, + T_ty, + list_T_ty, + int_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "nth", nth_ty, &xfer_nth); + } + + // ----- cons ----- + + obj + xfer_cons(obj rcx, + obj car, + obj cdr) + { + (void)rcx; + + auto cdr_list = obj::from(cdr); + + return DList::cons(rcx.allocator(), + car, + cdr_list.data()); + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_cons_pm(obj mm, StringTable * stbl) + { + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + /** cons_ty: T x list -> list **/ + auto cons_ty + = obj(DFunctionType::_make(mm, + list_T_ty, + T_ty, + list_T_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "cons", cons_ty, &xfer_cons); + } + + // ----- set-car ----- + + obj + xfer_set_car(obj rcx, + obj cell_arg, + obj dest) + { + scope log(XO_DEBUG(true)); + + (void)rcx; + (void)dest; + + auto cell = obj::from(cell_arg); + + assert(!cell->is_empty()); + + if (!cell->is_empty()) { + cell->assign_head(rcx.allocator(), dest); + } + + return cell; + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_set_car_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + /** pm_ty: list x any -> list **/ + auto pm_ty + = obj(DFunctionType::_make(mm, + list_T_ty, + any_ty, + list_T_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "set-car", pm_ty, &xfer_set_car); + } + + // ----- dict_make ----- + + obj + xfer_dict_make(obj rcx) + { + return obj(DDictionary::empty(rcx.allocator(), + 8 /*cap*/)); + } + + DPrimitive_gco_0 * + ObjectPrimitives::make_dict_make_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + // nit: technically better to use empty struct type here + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto pm_ty = obj(DFunctionType::_make(mm, + dict_ty)); + + return DPrimitive_gco_0::_make(mm, "dict_make", pm_ty, &xfer_dict_make); + } + + // ----- dict_at ----- + + obj + xfer_dict_lookup(obj rcx, + obj dict, + obj key) + { + auto opt = dict->lookup(key.data()); + + if (opt) { + return opt.value(); + } else { + DString * src_fn = DString::from_cstr(rcx.allocator(), "dict_lookup"); + DString * error = DString::printf(rcx.allocator(), + 100, + "no value in dict for key [%s]", key.data()->data()); + + return obj + (DRuntimeError::_make(rcx.allocator(), + src_fn, error)); + } + } + + DPrimitive_gco_2_dict_string * + ObjectPrimitives::make_dict_lookup_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + // dict_ty: generic dictionary + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + // pm_ty: dict x string -> any + auto pm_ty = obj + (DFunctionType::_make(mm, any_ty, dict_ty, str_ty)); + + return DPrimitive_gco_2_dict_string::_make + (mm, "dict_lookup", pm_ty, &xfer_dict_lookup); + } + + // ----- dict_upsert ----- + + obj + xfer_dict_upsert(obj rcx, + obj dict, + obj key, + obj value) + { + scope log(XO_DEBUG(true)); + + log && log(xtag("dict.tseq", dict._typeseq()), + xtag("dict.tname", TypeRegistry::id2name(dict._typeseq()))); + log && log(xtag("key.tseq", key._typeseq()), + xtag("key.tname", TypeRegistry::id2name(key._typeseq()))); + log && log(xtag("value.tseq", value._typeseq()), + xtag("value.tname", TypeRegistry::id2name(value._typeseq()))); + + auto value_pr = FacetRegistry::instance().variant(value); + + log && log(xtag("value", value_pr)); + + dict->upsert(rcx.allocator(), + DDictionary::pair_type(key.data(), value)); + + return dict; + } + + DPrimitive_gco_3_dict_string_gco * + ObjectPrimitives::make_dict_upsert_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + // pm_ty: dict x string x any -> dict + auto pm_ty = obj(DFunctionType::_make(mm, + dict_ty, + dict_ty, + str_ty, + any_ty)); + + return DPrimitive_gco_3_dict_string_gco::_make + (mm, "dict_upsert", pm_ty, &xfer_dict_upsert); + } + + // ----- fn_n_args ----- + + obj + xfer_fn_n_args(obj rcx, + obj fn_gco) + { + + scope log(XO_DEBUG(true)); + + log && log(xtag("fn_gco.tseq", fn_gco._typeseq())); + log && log(xtag("fn_gco.tname", TypeRegistry::id2name(fn_gco._typeseq()))); + + auto fn_proc = FacetRegistry::instance().try_variant(fn_gco); + + assert(fn_proc); + + return DInteger::box(rcx.allocator(), fn_proc.n_args()); + } + + DPrimitive_gco_1_gco * + ObjectPrimitives::make_fn_n_args_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto integer_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto callable_ty = DAtomicType::make(mm, Metatype::t_callable()); + auto pm_ty = obj(DFunctionType::_make(mm, + integer_ty, + callable_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "fn_n_args", pm_ty, &xfer_fn_n_args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end ObjectPrimitives.cpp */ diff --git a/xo-procedure2/src/procedure2/PrimitiveRegistry.cpp b/xo-procedure2/src/procedure2/PrimitiveRegistry.cpp new file mode 100644 index 00000000..6e606bea --- /dev/null +++ b/xo-procedure2/src/procedure2/PrimitiveRegistry.cpp @@ -0,0 +1,52 @@ +/** @file PrimitiveRegistry.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "PrimitiveRegistry.hpp" +#include + +namespace xo { + namespace scm { + PrimitiveRegistry & + PrimitiveRegistry::instance() + { + static PrimitiveRegistry s_instance; + + return s_instance; + } + + void + PrimitiveRegistry::register_primitives(InstallSource factory) + { + scope log(XO_DEBUG(true)); + + init_seq_v_.push_back(factory); + } + + bool + PrimitiveRegistry::install_primitives(obj rcx, + //obj mm, + //StringTable * stbl, + InstallSink sink, + InstallFlags flags) + { + scope log(XO_DEBUG(false)); + + bool ok = true; + + size_t i = 0; + size_t n = init_seq_v_.size(); + log && log("run n init steps", xtag("n", n)); + + for (const auto & fn : init_seq_v_) { + log && log("do install fn (", i+1, "/", n, ")"); + + ok = ok & fn(rcx, /*mm, stbl,*/ sink, flags); + ++i; + } + + return ok; + } + } +} /*namespace xo*/ diff --git a/xo-procedure2/src/procedure2/SetupProcedure2.cpp b/xo-procedure2/src/procedure2/SetupProcedure2.cpp new file mode 100644 index 00000000..3ab0b52d --- /dev/null +++ b/xo-procedure2/src/procedure2/SetupProcedure2.cpp @@ -0,0 +1,166 @@ +/** @file SetupProcedure2.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "SetupProcedure2.hpp" +#include "Procedure.hpp" +#include "ObjectPrimitives.hpp" +#include "GcPrimitives.hpp" +#include "SimpleRcx.hpp" +#include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_2_dict_string.hpp" +#include "Primitive_gco_3_dict_string_gco.hpp" + +#include +#include +#include +#include + +namespace xo { + using xo::mm::AAllocator; + using xo::facet::FacetRegistry; + using xo::facet::impl_for; + using xo::facet::typeseq; + using xo::print::APrintable; + + namespace scm { + bool + SetupProcedure2::register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + log && log(xtag("DSimpleRcx.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_2_dict_string.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); + + log && log(xtag("ARuntimeContext.tseq", typeseq::id())); + log && log(xtag("AProcedure.tseq", typeseq::id())); + + return true; + } + + bool + SetupProcedure2::register_types(obj gc) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + // (note: don't currently intend to support AGCObject for DSimpleRcx) + + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + + return ok; + } + + bool + SetupProcedure2::register_primitives(obj rcx, + InstallSink sink, + InstallFlags flags) + { + obj mm = rcx.allocator(); + StringTable * stbl = rcx.stringtable(); + + scope log(XO_DEBUG(false)); + + bool ok = true; + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_cwd_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_nth_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_cons_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_set_car_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_make_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_lookup_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_upsert_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_fn_n_args_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + // ----- gc primitives ----- + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_statistics_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_object_types_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_object_ages_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_gc_location_of_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_request_gc_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + return ok; + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end SetupProcedure2.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..80b04c15 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -0,0 +1,32 @@ +/** @file IGCObject_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_0.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_0::gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque + { + return self.gco_shallow_move(gc); + } + auto + IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj fn) noexcept -> void + { + self.visit_gco_children(reason, fn); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_0.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..865cd641 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,32 @@ +/** @file IGCObject_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_1_gco::gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque + { + return self.gco_shallow_move(gc); + } + auto + IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, obj fn) noexcept -> void + { + self.visit_gco_children(reason, fn); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_1_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..5e9bbcb3 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,32 @@ +/** @file IGCObject_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_2_dict_string::gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque + { + return self.gco_shallow_move(gc); + } + auto + IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, obj fn) noexcept -> void + { + self.visit_gco_children(reason, fn); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_2_dict_string.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..ef410d88 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,32 @@ +/** @file IGCObject_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_2_gco_gco::gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque + { + return self.gco_shallow_move(gc); + } + auto + IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, obj fn) noexcept -> void + { + self.visit_gco_children(reason, fn); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..58e26deb --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,32 @@ +/** @file IGCObject_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_3_dict_string_gco::gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque + { + return self.gco_shallow_move(gc); + } + auto + IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, obj fn) noexcept -> void + { + self.visit_gco_children(reason, fn); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_0.cpp b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..af23021e --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_0.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_0.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_0::pretty(const DPrimitive_gco_0 & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_0.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_1_gco.cpp b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..9769c1b4 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_1_gco::pretty(const DPrimitive_gco_1_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_1_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..dea86c00 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_2_dict_string::pretty(const DPrimitive_gco_2_dict_string & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_2_dict_string.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..c8b7c2d8 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_2_gco_gco::pretty(const DPrimitive_gco_2_gco_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..68312304 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_3_dict_string_gco::pretty(const DPrimitive_gco_3_dict_string_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_Any.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_Any.cpp new file mode 100644 index 00000000..8ff611c7 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_Any.cpp @@ -0,0 +1,48 @@ +/** @file IProcedure_Any.cpp + * + **/ + +#include "detail/IProcedure_Any.hpp" +#include +#include + +namespace xo { +namespace scm { + +using xo::facet::DVariantPlaceholder; +using xo::facet::typeseq; +using xo::facet::valid_facet_implementation; + +void +IProcedure_Any::_fatal() +{ + /* control here on uninitialized IAllocator_Any. + * Initialized instance will have specific implementation type + */ + std::cerr << "fatal" + << ": attempt to call uninitialized" + << " IProcedure_Any method" + << std::endl; + std::terminate(); +} + +typeseq +IProcedure_Any::s_typeseq = typeseq::id(); + +bool +IProcedure_Any::_valid + = valid_facet_implementation(); + +// nonconst methods + +auto +IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj +{ + _fatal(); +} + + +} /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_Any.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_0.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..220f566e --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_0.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_0.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_0::is_nary(const DPrimitive_gco_0 & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_0::n_args(const DPrimitive_gco_0 & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_0::apply_nocheck(DPrimitive_gco_0 & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_0.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_1_gco.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..e491e806 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_1_gco::is_nary(const DPrimitive_gco_1_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_1_gco::n_args(const DPrimitive_gco_1_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_1_gco::apply_nocheck(DPrimitive_gco_1_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_1_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..ddc92094 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_2_dict_string::is_nary(const DPrimitive_gco_2_dict_string & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_2_dict_string::n_args(const DPrimitive_gco_2_dict_string & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_2_dict_string::apply_nocheck(DPrimitive_gco_2_dict_string & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_2_dict_string.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..1207429f --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_2_gco_gco::is_nary(const DPrimitive_gco_2_gco_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_2_gco_gco::n_args(const DPrimitive_gco_2_gco_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..334267aa --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::is_nary(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::n_args(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::apply_nocheck(DPrimitive_gco_3_dict_string_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IRuntimeContext_Any.cpp b/xo-procedure2/src/procedure2/facet/IRuntimeContext_Any.cpp new file mode 100644 index 00000000..195bd135 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IRuntimeContext_Any.cpp @@ -0,0 +1,42 @@ +/** @file IRuntimeContext_Any.cpp + * + **/ + +#include "detail/IRuntimeContext_Any.hpp" +#include +#include + +namespace xo { +namespace scm { + +using xo::facet::DVariantPlaceholder; +using xo::facet::typeseq; +using xo::facet::valid_facet_implementation; + +void +IRuntimeContext_Any::_fatal() +{ + /* control here on uninitialized IAllocator_Any. + * Initialized instance will have specific implementation type + */ + std::cerr << "fatal" + << ": attempt to call uninitialized" + << " IRuntimeContext_Any method" + << std::endl; + std::terminate(); +} + +typeseq +IRuntimeContext_Any::s_typeseq = typeseq::id(); + +bool +IRuntimeContext_Any::_valid + = valid_facet_implementation(); + +// nonconst methods + + +} /*namespace scm*/ +} /*namespace xo*/ + +/* end IRuntimeContext_Any.cpp */ diff --git a/xo-procedure2/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp b/xo-procedure2/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp new file mode 100644 index 00000000..d32f5740 --- /dev/null +++ b/xo-procedure2/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp @@ -0,0 +1,52 @@ +/** @file IRuntimeContext_DSimpleRcx.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DSimpleRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DSimpleRcx.json5] +**/ + +#include "detail/IRuntimeContext_DSimpleRcx.hpp" + +namespace xo { + namespace scm { + auto + IRuntimeContext_DSimpleRcx::allocator(const DSimpleRcx & self) noexcept -> obj + { + return self.allocator(); + } + + auto + IRuntimeContext_DSimpleRcx::collector(const DSimpleRcx & self) noexcept -> obj + { + return self.collector(); + } + + auto + IRuntimeContext_DSimpleRcx::error_allocator(const DSimpleRcx & self) noexcept -> obj + { + return self.error_allocator(); + } + + auto + IRuntimeContext_DSimpleRcx::stringtable(const DSimpleRcx & self) noexcept -> StringTable * + { + return self.stringtable(); + } + + auto + IRuntimeContext_DSimpleRcx::visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor) -> void + { + self.visit_pools(visitor); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IRuntimeContext_DSimpleRcx.cpp */ diff --git a/xo-procedure2/src/procedure2/init_primitives.cpp b/xo-procedure2/src/procedure2/init_primitives.cpp new file mode 100644 index 00000000..58b9d7aa --- /dev/null +++ b/xo-procedure2/src/procedure2/init_primitives.cpp @@ -0,0 +1,113 @@ +/** @file init_primitives.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "init_primitives.hpp" +#include "DPrimitive.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace xo { + using xo::mm::AAllocator; + using xo::scm::DFloat; + using xo::facet::with_facet; + + namespace scm { +#ifdef NOT_YET + double + neg_f64(double x) { + return -x; + } + + double + add_f64_f64(double x, double y) { + return x + y; + } + + double + sub_f64_f64(double x, double y) { + return x - y; + } +#endif + +#ifdef NOT_YET + double + mul_f64_f64(double x, double y) { + return x * y; + } + + double + div_f64_f64(double x, double y) { + return x / y; + } + + double + pow_f64_f64(double x, double y) { + return ::pow(x, y); + } + + double + log_f64(double x) { + return ::log(x); + } + + double + sin_f64(double x) { + return ::sin(x); + } + + double + cos_f64(double x) { + return ::cos(x); + } + + double + tan_f64(double x) { + return ::tan(x); + } +#endif + +#ifdef NOT_YET + Primitive_f64_1_f64 + Primitives::s_neg_f64_pm("_neg_d", + &neg_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_add_f64_f64_pm("_add_d_d", &add_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_sub_f64_f64_pm("_sub_d_d", &sub_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_mul_f64_f64_pm("_mul_d_d", &mul_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_div_f64_f64_pm("_div_d_d", &div_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_pow_f64_f64_pm("_pow_d_d", &pow_f64_f64); + + Primitive_f64_1_f64 + Primitives::s_log_f64_pm("_log_d", &log_f64); + + Primitive_f64_1_f64 + Primitives::s_sin_f64_pm("_sin_d", &sin_f64); + + Primitive_f64_1_f64 + Primitives::s_cos_f64_pm("_cos_d", &cos_f64); + + Primitive_f64_1_f64 + Primitives::s_tan_f64_pm("_tan_d", &tan_f64); +#endif + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end init_primitives.cpp */ diff --git a/xo-procedure2/src/procedure2/init_procedure2.cpp b/xo-procedure2/src/procedure2/init_procedure2.cpp new file mode 100644 index 00000000..34c349f6 --- /dev/null +++ b/xo-procedure2/src/procedure2/init_procedure2.cpp @@ -0,0 +1,43 @@ +/** @file init_procedure2.cpp + * + * @author Roland Conybeare, Jan 2026 +**/ + +#include "init_procedure2.hpp" +#include "init_primitives.hpp" +#include "SetupProcedure2.hpp" +#include +#include +#include + +namespace xo { + using xo::scm::SetupProcedure2; + using xo::scm::PrimitiveRegistry; + using xo::mm::CollectorTypeRegistry; + + void + InitSubsys::init() + { + SetupProcedure2::register_facets(); + + CollectorTypeRegistry::instance().register_types(&SetupProcedure2::register_types); + PrimitiveRegistry::instance().register_primitives(&SetupProcedure2::register_primitives); + } + + InitEvidence + InitSubsys::require() + { + InitEvidence retval; + + /* recursive subsystem deps for xo-object2/ */ + retval ^= InitSubsys::require(); + retval ^= InitSubsys::require(); + + /* xo-procedure2/'s own initialization code */ + retval ^= Subsystem::provide("procedure2", &init); + + return retval; + } +} /*namespace xo*/ + +/* end init_procedure2.cpp */ diff --git a/xo-procedure2/utest/CMakeLists.txt b/xo-procedure2/utest/CMakeLists.txt new file mode 100644 index 00000000..e758d282 --- /dev/null +++ b/xo-procedure2/utest/CMakeLists.txt @@ -0,0 +1,12 @@ +# built unittest xo-procedure2/utest + +set(UTEST_EXE utest.procedure2) +set(UTEST_SRCS + procedure2_utest_main.cpp + DPrimitive.test.cpp + DSimpleRcx.test.cpp +) + +xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS}) +xo_self_dependency(${UTEST_EXE} xo_procedure2) +xo_external_target_dependency(${UTEST_EXE} Catch2 Catch2::Catch2) diff --git a/xo-procedure2/utest/DPrimitive.test.cpp b/xo-procedure2/utest/DPrimitive.test.cpp new file mode 100644 index 00000000..5d0fc318 --- /dev/null +++ b/xo-procedure2/utest/DPrimitive.test.cpp @@ -0,0 +1,149 @@ +/** @file DPrimitive.test.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace xo { + using xo::scm::Primitives; + using xo::scm::DSimpleRcx; + using xo::scm::ARuntimeContext; + using xo::scm::DFloat; + using xo::scm::DInteger; + using xo::scm::DArray; + using xo::scm::DPrimitive_gco_2_gco_gco; + using xo::mm::AAllocator; + using xo::mm::AGCObject; + using xo::mm::DArena; + using xo::mm::ArenaConfig; + using xo::print::APrintable; + using xo::print::ppstate_standalone; + using xo::print::ppconfig; + using xo::facet::with_facet; + using xo::facet::obj; + using xo::scope; + + namespace ut { + static InitEvidence s_init = InitSubsys::require(); + + TEST_CASE("DPrimitive-init", "[procedure2][DPrimitive]") + { + REQUIRE(s_init.evidence()); + } + + // MOVE THESE TO xo-numeric/ + // Should work using NumericPrimitives::s_mul_gco_gco + +#ifdef OBSOLETE + TEST_CASE("DPrimitive-n_args", "[procedure2][DPrimitive]") + { + // s_mul_gco_gco_pm takes 2 AGCObject args + REQUIRE(Primitives::s_mul_gco_gco_pm.n_args() == 2); + } + + TEST_CASE("DPrimitive-is_nary", "[procedure2][DPrimitive]") + { + REQUIRE(Primitives::s_mul_gco_gco_pm.is_nary() == false); + } + + TEST_CASE("DPrimitive-apply_nocheck-float-float", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3.0 * 7.0 = 21.0 + obj x = DFloat::box(alloc, 3.0); + obj y = DFloat::box(alloc, 7.0); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_float = obj::from(result); + REQUIRE(result_float); + REQUIRE(result_float.data()->value() == 21.0); + } + + TEST_CASE("DPrimitive-apply_nocheck-int-int", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3 * 7 = 21 + obj x = DInteger::box(alloc, 3L); + obj y = DInteger::box(alloc, 7L); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_int = obj::from(result); + REQUIRE(result_int); + REQUIRE(result_int.data()->value() == 21L); + } + + TEST_CASE("DPrimitive-apply_nocheck-int-float", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3 * 7.0 = 21.0 (mixed: result is float) + obj x = DInteger::box(alloc, 3L); + obj y = DFloat::box(alloc, 7.0); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_float = obj::from(result); + REQUIRE(result_float); + REQUIRE(result_float.data()->value() == 21.0); + } + + TEST_CASE("DPrimitive-pretty", "[procedure2][DPrimitive][pp]") + { + scope log(XO_DEBUG(false)); + + std::stringstream ss; + ppconfig ppc; + ppstate_standalone pps(&ss, 0, &ppc); + + obj prim_pr(&Primitives::s_mul_gco_gco_pm); + pps.pretty(prim_pr); + + std::string output = ss.str(); + + log && log(output); + + CHECK(output.find("_mul") != std::string::npos); + } +#endif + + } /*namespace ut*/ +} /*namespace xo*/ + +/* end DPrimitive.test.cpp */ diff --git a/xo-procedure2/utest/DSimpleRcx.test.cpp b/xo-procedure2/utest/DSimpleRcx.test.cpp new file mode 100644 index 00000000..0fe56b86 --- /dev/null +++ b/xo-procedure2/utest/DSimpleRcx.test.cpp @@ -0,0 +1,69 @@ +/** @file DSimpleRcx.test.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include +#include +#include +#include +#include +#include + +namespace xo { + using xo::scm::DSimpleRcx; + using xo::scm::ARuntimeContext; + using xo::scm::StringTable; + using xo::mm::AAllocator; + using xo::mm::DArena; + using xo::mm::ArenaConfig; + using xo::facet::with_facet; + using xo::facet::obj; + + namespace ut { + static InitEvidence s_init = InitSubsys::require(); + + TEST_CASE("DSimpleRcx-init", "[procedure2][DSimpleRcx]") + { + REQUIRE(s_init.evidence()); + } + + TEST_CASE("DSimpleRcx-construct", "[procedure2][DSimpleRcx]") + { + ArenaConfig cfg { .name_ = "testarena", + .size_ = 4*1024 }; + + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + auto stbl = StringTable(1024 /*hint_max_capacity*/, + false /*!debug_flag*/); + + DSimpleRcx rcx(alloc, alloc, &stbl); + + REQUIRE((void*)rcx.allocator().data() == (void*)alloc.data()); + REQUIRE(rcx.stringtable() == &stbl); + } + + TEST_CASE("DSimpleRcx-as-ARuntimeContext", "[procedure2][DSimpleRcx]") + { + ArenaConfig cfg { .name_ = "testarena", + .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + auto stbl = StringTable(1024 /*hint_max_capacity*/, + false /*!debug_flag*/); + + DSimpleRcx rcx(alloc, alloc, &stbl); + obj rcx_obj = with_facet::mkobj(&rcx); + + // verify we can recover allocator from obj + obj recovered_alloc = rcx_obj.allocator(); + + REQUIRE((void*)recovered_alloc.data() == (void*)alloc.data()); + } + + } /*namespace ut*/ +} /*namespace xo*/ + +/* end DSimpleRcx.test.cpp */ diff --git a/xo-procedure2/utest/procedure2_utest_main.cpp b/xo-procedure2/utest/procedure2_utest_main.cpp new file mode 100644 index 00000000..477099bc --- /dev/null +++ b/xo-procedure2/utest/procedure2_utest_main.cpp @@ -0,0 +1,20 @@ +/* file procedure2_utest_main.cpp */ + +#include + +#define CATCH_CONFIG_RUNNER +#include "catch2/catch.hpp" + +int +main(int argc, char* argv[]) +{ + using xo::Subsystem; + + Subsystem::initialize_all(); + + int result = Catch::Session().run(argc, argv); + + return result; +} + +/* end procedure2_utest_main.cpp */