git subrepo clone git@github.com:Rconybea/xo-procedure2.git xo-procedure2
subrepo: subdir: "xo-procedure2" merged: "58848bc9" upstream: origin: "git@github.com:Rconybea/xo-procedure2.git" branch: "main" commit: "58848bc9" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
This commit is contained in:
parent
154e65e7df
commit
e2d181dd73
102 changed files with 5231 additions and 0 deletions
12
xo-procedure2/.gitrepo
Normal file
12
xo-procedure2/.gitrepo
Normal file
|
|
@ -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
|
||||
169
xo-procedure2/CMakeLists.txt
Normal file
169
xo-procedure2/CMakeLists.txt
Normal file
|
|
@ -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
|
||||
2
xo-procedure2/README.md
Normal file
2
xo-procedure2/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# xo-procedure2
|
||||
gc-aware function interface for Schematika
|
||||
41
xo-procedure2/cmake/xo-bootstrap-macros.cmake
Normal file
41
xo-procedure2/cmake/xo-bootstrap-macros.cmake
Normal file
|
|
@ -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()
|
||||
15
xo-procedure2/cmake/xo_procedure2Config.cmake.in
Normal file
15
xo-procedure2/cmake/xo_procedure2Config.cmake.in
Normal file
|
|
@ -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@")
|
||||
25
xo-procedure2/doc/implementation.rst
Normal file
25
xo-procedure2/doc/implementation.rst
Normal file
|
|
@ -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
|
||||
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_0.json5
Normal file
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_0.json5
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//<xo/procedure2/GCObjectConversion_DPrimitive_gco_0.hpp>
|
||||
"<xo/alloc2/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_1_gco.json5
Normal file
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_1_gco.json5
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//<xo/procedure2/GCObjectConversion_DPrimitive_gco_1_gco.hpp>
|
||||
"<xo/alloc2/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//<xo/procedure2/GCObjectConversion_DPrimitive_gco_2_gco_gco.hpp>
|
||||
"<xo/alloc2/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5
Normal file
19
xo-procedure2/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//<xo/procedure2/GCObjectConversion_DPrimitive_gco_2_gco_gco.hpp>
|
||||
"<xo/alloc2/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//<xo/procedure2/GCObjectConversion_DPrimitive_gco_3_dict_string_gco.hpp>
|
||||
"<xo/alloc2/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
18
xo-procedure2/idl/IPrintable_DPrimitive_gco_0.json5
Normal file
18
xo-procedure2/idl/IPrintable_DPrimitive_gco_0.json5
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
22
xo-procedure2/idl/IPrintable_DPrimitive_gco_1_gco.json5
Normal file
22
xo-procedure2/idl/IPrintable_DPrimitive_gco_1_gco.json5
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>",
|
||||
// "<xo/procedure2/RuntimeContext.hpp>",
|
||||
// "<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
// "<xo/procedure2/Procedure.hpp>",
|
||||
// "<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
18
xo-procedure2/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5
Normal file
18
xo-procedure2/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_0.json5
Normal file
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_0.json5
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/procedure2/RuntimeContext.hpp>",
|
||||
"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
"<xo/procedure2/Procedure.hpp>",
|
||||
"<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_1_gco.json5
Normal file
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_1_gco.json5
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/procedure2/RuntimeContext.hpp>",
|
||||
"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
"<xo/procedure2/Procedure.hpp>",
|
||||
"<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/procedure2/RuntimeContext.hpp>",
|
||||
"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
"<xo/procedure2/Procedure.hpp>",
|
||||
"<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5
Normal file
20
xo-procedure2/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/procedure2/RuntimeContext.hpp>",
|
||||
"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
"<xo/procedure2/Procedure.hpp>",
|
||||
"<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
"<xo/procedure2/RuntimeContext.hpp>",
|
||||
"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
"<xo/procedure2/Procedure.hpp>",
|
||||
"<xo/procedure2/detail/IProcedure_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
18
xo-procedure2/idl/IRuntimeContext_DSimpleRcx.json5
Normal file
18
xo-procedure2/idl/IRuntimeContext_DSimpleRcx.json5
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
output_cpp_dir: "src/procedure2/facet",
|
||||
output_hpp_dir: "include/xo/procedure2",
|
||||
output_impl_subdir: "detail",
|
||||
includes: [
|
||||
//"<xo/procedure2/RuntimeContext.hpp>",
|
||||
//"<xo/procedure2/detail/IRuntimeContext_Xfer.hpp>",
|
||||
],
|
||||
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" ],
|
||||
}
|
||||
72
xo-procedure2/idl/Procedure.json5
Normal file
72
xo-procedure2/idl/Procedure.json5
Normal file
|
|
@ -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\"",
|
||||
"<xo/alloc2/GCObject.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<AGCObject>",
|
||||
args: [
|
||||
{type: "obj<ARuntimeContext>", name: "rcx"},
|
||||
{type: "const DArray *", name: "args"},
|
||||
]
|
||||
}
|
||||
],
|
||||
router_facet_explicit_content: [ ],
|
||||
}
|
||||
98
xo-procedure2/idl/RuntimeContext.json5
Normal file
98
xo-procedure2/idl/RuntimeContext.json5
Normal file
|
|
@ -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: [
|
||||
"<xo/stringtable2/StringTable.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
"<xo/alloc2/Collector.hpp>",
|
||||
"<xo/arena/MemorySizeInfo.hpp>"
|
||||
],
|
||||
// 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<AAllocator>",
|
||||
args: [],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
{
|
||||
name: "collector",
|
||||
doc: [ "collector facet for allocator. If non-null, same data pointer as allocator" ],
|
||||
return_type: "obj<ACollector>",
|
||||
args: [],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
{
|
||||
name: "error_allocator",
|
||||
doc: [ "last-resort allocator for erros. e.g. regular allocator exhausted" ],
|
||||
return_type: "obj<AAllocator>",
|
||||
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: [ ],
|
||||
}
|
||||
0
xo-procedure2/include/xo/procedure2/.gitkeep
Normal file
0
xo-procedure2/include/xo/procedure2/.gitkeep
Normal file
213
xo-procedure2/include/xo/procedure2/DPrimitive.hpp
Normal file
213
xo-procedure2/include/xo/procedure2/DPrimitive.hpp
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
/** @file DPrimitive.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RuntimeContext.hpp"
|
||||
#include <xo/type/Type.hpp>
|
||||
#include <xo/object2/DArray.hpp>
|
||||
#include <xo/alloc2/GCObjectConversion.hpp>
|
||||
#include <xo/alloc2/GCObjectVisitor.hpp>
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/reflect/Reflect.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <string_view>
|
||||
|
||||
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 <typename Fn>
|
||||
struct PmFnTraits;
|
||||
|
||||
/** specialization for function pointers **/
|
||||
template <typename R, typename... Args>
|
||||
struct PmFnTraits<R(*)(obj<ARuntimeContext> rcx, Args...)> {
|
||||
/** function return type **/
|
||||
using return_type = R;
|
||||
/** tuple type for function arguments (except for runtime context) **/
|
||||
using args_tuple = std::tuple<Args...>;
|
||||
/** number of arguments (except for runtime context) **/
|
||||
static constexpr std::size_t n_args = sizeof...(Args);
|
||||
|
||||
/** arg_type<i> is the type of the i'th argument to Fn.
|
||||
* (starting from argument after runtime context)
|
||||
**/
|
||||
template <std::size_t I>
|
||||
using arg_type = std::tuple_element_t<I, args_tuple>;
|
||||
};
|
||||
|
||||
/** specialization for function references **/
|
||||
template <typename R, typename... Args>
|
||||
struct PmFnTraits<R(&)(obj<ARuntimeContext>, Args...)> : PmFnTraits<R(*)(obj<ARuntimeContext>, Args...)> {};
|
||||
|
||||
/** specialization for plain function types **/
|
||||
template <typename R, typename... Args>
|
||||
struct PmFnTraits<R(obj<ARuntimeContext>, Args...)> : PmFnTraits<R(*)(obj<ARuntimeContext>, 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<T>) -> list<T>
|
||||
* @endpre
|
||||
* but implementation has signature:
|
||||
* @pre
|
||||
* (obj<AGCobject> x obj<AGCObject,DList>) -> obj<AGCObject,DList>
|
||||
* @endpre
|
||||
**/
|
||||
template <typename Fn>
|
||||
class Primitive {
|
||||
public:
|
||||
using FunctionPtrType = Fn;
|
||||
using Traits = detail::PmFnTraits<Fn>;
|
||||
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<AType> type, Fn fn)
|
||||
: name_{name},
|
||||
type_{type},
|
||||
fn_td_{Reflect::require<Fn>()},
|
||||
fn_{fn} {}
|
||||
|
||||
static Primitive * _make(obj<AAllocator> mm, std::string_view name, Fn fn) {
|
||||
void * mem = mm.alloc_for<Primitive>();
|
||||
|
||||
return new (mem) Primitive(name, obj<AType>(), fn);
|
||||
}
|
||||
|
||||
static Primitive * _make(obj<AAllocator> mm,
|
||||
std::string_view name,
|
||||
obj<AType> type,
|
||||
Fn fn)
|
||||
{
|
||||
void * mem = mm.alloc_for<Primitive>();
|
||||
|
||||
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<AGCObject> apply_nocheck(obj<ARuntimeContext> rcx, const DArray * args) {
|
||||
return _apply_nocheck(rcx, args,
|
||||
std::make_index_sequence<Traits::n_args>{});
|
||||
}
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-primitive-printable-facet **/
|
||||
///@{
|
||||
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-primitive-gcobject-facet **/
|
||||
///@{
|
||||
Primitive * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
private:
|
||||
template <std::size_t... Is>
|
||||
obj<AGCObject> _apply_nocheck(obj<ARuntimeContext> rcx,
|
||||
const DArray * args,
|
||||
std::index_sequence<Is...>)
|
||||
{
|
||||
using xo::facet::FacetRegistry;
|
||||
|
||||
using R = typename Traits::return_type;
|
||||
|
||||
assert(args);
|
||||
|
||||
obj<AAllocator> mm = rcx.allocator();
|
||||
|
||||
R result
|
||||
= fn_(rcx,
|
||||
GCObjectConversion<typename Traits::template arg_type<Is>>::from_gco(mm, args->at(Is))... );
|
||||
|
||||
return GCObjectConversion<R>::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<AType> type_;
|
||||
|
||||
/** type description for implementation function
|
||||
* Note that this type description will have additional first argument
|
||||
* for obj<ARuntimeContext>
|
||||
**/
|
||||
TypeDescr fn_td_;
|
||||
|
||||
/** function implementation **/
|
||||
Fn fn_;
|
||||
}; /*Primitive*/
|
||||
|
||||
template <typename Fn>
|
||||
bool
|
||||
Primitive<Fn>::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"Primitive<Fn>",
|
||||
refrtag("name", name_),
|
||||
refrtag("td", fn_td_),
|
||||
refrtag("fn", fn_));
|
||||
}
|
||||
|
||||
template <typename Fn>
|
||||
Primitive<Fn> *
|
||||
Primitive<Fn>::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
template <typename Fn>
|
||||
void
|
||||
Primitive<Fn>::visit_gco_children(xo::mm::VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept {
|
||||
gc.visit_poly_child(reason, &type_);
|
||||
//{
|
||||
// auto e = type_.to_facet<AGCObject>(); // FacetRegistry dep
|
||||
// gc.forward_inplace(e.iface(), (void **)&(type_.data_));
|
||||
//}
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DPrimitive.hpp */
|
||||
20
xo-procedure2/include/xo/procedure2/DPrimitive_gco_0.hpp
Normal file
20
xo-procedure2/include/xo/procedure2/DPrimitive_gco_0.hpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/** @file DPrimitive_gco_0.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::obj;
|
||||
|
||||
using DPrimitive_gco_0 = Primitive<obj<AGCObject> (*)(obj<ARuntimeContext>)>;
|
||||
}
|
||||
}
|
||||
|
||||
/* end DPrimitive_gco_0.hpp */
|
||||
21
xo-procedure2/include/xo/procedure2/DPrimitive_gco_1_gco.hpp
Normal file
21
xo-procedure2/include/xo/procedure2/DPrimitive_gco_1_gco.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file DPrimitive_gco_1_gco.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::obj;
|
||||
|
||||
using DPrimitive_gco_1_gco = Primitive<obj<AGCObject> (*)(obj<ARuntimeContext>,
|
||||
obj<AGCObject>)>;
|
||||
}
|
||||
}
|
||||
|
||||
/* end DPrimitive_gco_1_gco.hpp */
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/** @file DPrimitive_gco_2_dict_string.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/object2/Dictionary.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::obj;
|
||||
|
||||
using DPrimitive_gco_2_dict_string
|
||||
= Primitive<obj<AGCObject> (*)(obj<ARuntimeContext>,
|
||||
obj<AGCObject,DDictionary>,
|
||||
obj<AGCObject,DString>)>;
|
||||
}
|
||||
}
|
||||
|
||||
/* end DPrimitive_gco_2_dict_string.hpp */
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/** @file DPrimitive_gco_2_gco_gco.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::obj;
|
||||
|
||||
using DPrimitive_gco_2_gco_gco = Primitive<obj<AGCObject> (*)(obj<ARuntimeContext>,
|
||||
obj<AGCObject>,
|
||||
obj<AGCObject>)>;
|
||||
}
|
||||
}
|
||||
|
||||
/* end DPrimitive_gco_2_gco_gco.hpp */
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/** @file DPrimitive_gco_3_dict_string_gco.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/object2/Dictionary.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::obj;
|
||||
|
||||
using DPrimitive_gco_3_dict_string_gco
|
||||
= Primitive<obj<AGCObject> (*)(obj<ARuntimeContext>,
|
||||
obj<AGCObject,DDictionary>,
|
||||
obj<AGCObject,DString>,
|
||||
obj<AGCObject>)>;
|
||||
}
|
||||
}
|
||||
|
||||
/* end DPrimitive_gco_3_dict_string_gco.hpp */
|
||||
45
xo-procedure2/include/xo/procedure2/DSimpleRcx.hpp
Normal file
45
xo-procedure2/include/xo/procedure2/DSimpleRcx.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/** @file DSimpleRcx.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/stringtable2/StringTable.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
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<AAllocator> mm, obj<AAllocator> error_mm, StringTable * st)
|
||||
: allocator_{mm}, error_allocator_{error_mm},
|
||||
stringtable_{st} {}
|
||||
|
||||
obj<AAllocator> allocator() const noexcept { return allocator_; }
|
||||
obj<ACollector> collector() const noexcept;
|
||||
obj<AAllocator> error_allocator() const noexcept { return error_allocator_; }
|
||||
StringTable * stringtable() const noexcept { return stringtable_; }
|
||||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
||||
private:
|
||||
obj<AAllocator> allocator_;
|
||||
obj<AAllocator> error_allocator_;
|
||||
StringTable * stringtable_ = nullptr;
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DSimpleRcx.hpp */
|
||||
47
xo-procedure2/include/xo/procedure2/GcPrimitives.hpp
Normal file
47
xo-procedure2/include/xo/procedure2/GcPrimitives.hpp
Normal file
|
|
@ -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<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: report gc object-type statistics **/
|
||||
static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: report gc object-age statistics **/
|
||||
static DPrimitive_gco_0 * make_report_gc_object_ages_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: report gc location of a value **/
|
||||
static DPrimitive_gco_1_gco * make_gc_location_of_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: request collection **/
|
||||
static DPrimitive_gco_1_gco * make_request_gc_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
/* end GcPrimitives.hpp */
|
||||
62
xo-procedure2/include/xo/procedure2/ObjectPrimitives.hpp
Normal file
62
xo-procedure2/include/xo/procedure2/ObjectPrimitives.hpp
Normal file
|
|
@ -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<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: fetch nth element of a sequence **/
|
||||
static DPrimitive_gco_2_gco_gco * make_nth_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: create cons cell **/
|
||||
static DPrimitive_gco_2_gco_gco * make_cons_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: set first member of cons cell **/
|
||||
static DPrimitive_gco_2_gco_gco * make_set_car_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive for creating a dictionary instance **/
|
||||
static DPrimitive_gco_0 * make_dict_make_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive for creating a dictionary instance **/
|
||||
static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj<AAllocator> 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<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: get fixed number of args for function **/
|
||||
static DPrimitive_gco_1_gco * make_fn_n_args_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ObjectPrimitives.hpp */
|
||||
113
xo-procedure2/include/xo/procedure2/PrimitiveRegistry.hpp
Normal file
113
xo-procedure2/include/xo/procedure2/PrimitiveRegistry.hpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/** @file PrimitiveRegistry.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Procedure.hpp"
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/reflect/TypeDescr.hpp>
|
||||
#include <functional>
|
||||
|
||||
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<uint64_t>(x) & static_cast<uint64_t>(y));
|
||||
}
|
||||
|
||||
/** provided by VSM to receive created primitives.
|
||||
* InstallSink(pm) adopts a primitive
|
||||
**/
|
||||
using InstallSink = std::function<bool (std::string_view name,
|
||||
xo::reflect::TypeDescr fn_td,
|
||||
obj<AProcedure> 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<bool (obj<ARuntimeContext> rcx,
|
||||
//obj<AAllocator> mm,
|
||||
//StringTable * stbl,
|
||||
InstallSink sink,
|
||||
InstallFlags flags)>;
|
||||
|
||||
public:
|
||||
/** singleton instance **/
|
||||
static PrimitiveRegistry & instance();
|
||||
|
||||
template <typename PrimitiveRepr>
|
||||
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<AProcedure,PrimitiveRepr>(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<ARuntimeContext> rcx,
|
||||
//obj<AAllocator> mm,
|
||||
//StringTable * stbl,
|
||||
InstallSink sink,
|
||||
InstallFlags flags);
|
||||
|
||||
|
||||
private:
|
||||
/** a set of factories that create primitives **/
|
||||
std::vector<InstallSource> init_seq_v_;
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end PrimitiveRegistry.hpp */
|
||||
11
xo-procedure2/include/xo/procedure2/Primitive_gco_0.hpp
Normal file
11
xo-procedure2/include/xo/procedure2/Primitive_gco_0.hpp
Normal file
|
|
@ -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 */
|
||||
11
xo-procedure2/include/xo/procedure2/Primitive_gco_1_gco.hpp
Normal file
11
xo-procedure2/include/xo/procedure2/Primitive_gco_1_gco.hpp
Normal file
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
22
xo-procedure2/include/xo/procedure2/Procedure.hpp
Normal file
22
xo-procedure2/include/xo/procedure2/Procedure.hpp
Normal file
|
|
@ -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 */
|
||||
22
xo-procedure2/include/xo/procedure2/RuntimeContext.hpp
Normal file
22
xo-procedure2/include/xo/procedure2/RuntimeContext.hpp
Normal file
|
|
@ -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 */
|
||||
29
xo-procedure2/include/xo/procedure2/SetupProcedure2.hpp
Normal file
29
xo-procedure2/include/xo/procedure2/SetupProcedure2.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/** @file SetupProcedure2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PrimitiveRegistry.hpp"
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
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<xo::mm::ACollector> gc);
|
||||
static bool register_primitives(obj<ARuntimeContext> rcx,
|
||||
InstallSink sink,
|
||||
InstallFlags flags);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* end SetupProcedure2.hpp */
|
||||
11
xo-procedure2/include/xo/procedure2/SimpleRcx.hpp
Normal file
11
xo-procedure2/include/xo/procedure2/SimpleRcx.hpp
Normal file
|
|
@ -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 */
|
||||
86
xo-procedure2/include/xo/procedure2/detail/AProcedure.hpp
Normal file
86
xo-procedure2/include/xo/procedure2/detail/AProcedure.hpp
Normal file
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
#include <xo/facet/typeseq.hpp>
|
||||
|
||||
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<AFacet> will have non-null vtable (via IFacet_Any) with all methods terminating.
|
||||
**/
|
||||
bool _has_null_vptr() const noexcept { return *reinterpret_cast<const void * const *>(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<AGCObject> apply_nocheck(Opaque data, obj<ARuntimeContext> rcx, const DArray * args) = 0;
|
||||
///@}
|
||||
}; /*AProcedure*/
|
||||
|
||||
/** Implementation IProcedure_DRepr of AProcedure for state DRepr
|
||||
* should provide a specialization:
|
||||
*
|
||||
* template <>
|
||||
* struct xo::facet::FacetImplementation<AProcedure, DRepr> {
|
||||
* using Impltype = IProcedure_DRepr;
|
||||
* };
|
||||
*
|
||||
* then IProcedure_ImplType<DRepr> --> IProcedure_DRepr
|
||||
**/
|
||||
template <typename DRepr>
|
||||
using IProcedure_ImplType = xo::facet::FacetImplType<AProcedure, DRepr>;
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* AProcedure.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 <xo/stringtable2/StringTable.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/arena/MemorySizeInfo.hpp>
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
#include <xo/facet/typeseq.hpp>
|
||||
|
||||
|
||||
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<AFacet> will have non-null vtable (via IFacet_Any) with all methods terminating.
|
||||
**/
|
||||
bool _has_null_vptr() const noexcept { return *reinterpret_cast<const void * const *>(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<AAllocator> allocator(Copaque data) const noexcept = 0;
|
||||
/** collector facet for allocator. If non-null, same data pointer as allocator **/
|
||||
virtual obj<ACollector> collector(Copaque data) const noexcept = 0;
|
||||
/** last-resort allocator for erros. e.g. regular allocator exhausted **/
|
||||
virtual obj<AAllocator> 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<ARuntimeContext, DRepr> {
|
||||
* using Impltype = IRuntimeContext_DRepr;
|
||||
* };
|
||||
*
|
||||
* then IRuntimeContext_ImplType<DRepr> --> IRuntimeContext_DRepr
|
||||
**/
|
||||
template <typename DRepr>
|
||||
using IRuntimeContext_ImplType = xo::facet::FacetImplType<ARuntimeContext, DRepr>;
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* ARuntimeContext.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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DPrimitive_gco_0.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DPrimitive_gco_0; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DPrimitive_gco_0>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DPrimitive_gco_0,
|
||||
xo::scm::IGCObject_DPrimitive_gco_0>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DPrimitive_gco_1_gco.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DPrimitive_gco_1_gco; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DPrimitive_gco_1_gco>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DPrimitive_gco_1_gco,
|
||||
xo::scm::IGCObject_DPrimitive_gco_1_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#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<xo::mm::AGCObject,
|
||||
xo::scm::DPrimitive_gco_2_dict_string>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_dict_string,
|
||||
xo::scm::IGCObject_DPrimitive_gco_2_dict_string>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#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<xo::mm::AGCObject,
|
||||
xo::scm::DPrimitive_gco_2_gco_gco>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_gco_gco,
|
||||
xo::scm::IGCObject_DPrimitive_gco_2_gco_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#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<xo::mm::AGCObject,
|
||||
xo::scm::DPrimitive_gco_3_dict_string_gco>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DPrimitive_gco_3_dict_string_gco,
|
||||
xo::scm::IGCObject_DPrimitive_gco_3_dict_string_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#include "DPrimitive_gco_0.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IPrintable_DPrimitive_gco_0; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::print::APrintable,
|
||||
xo::scm::DPrimitive_gco_0>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DPrimitive_gco_0,
|
||||
xo::scm::IPrintable_DPrimitive_gco_0>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -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 <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#include "DPrimitive_gco_1_gco.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IPrintable_DPrimitive_gco_1_gco; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::print::APrintable,
|
||||
xo::scm::DPrimitive_gco_1_gco>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DPrimitive_gco_1_gco,
|
||||
xo::scm::IPrintable_DPrimitive_gco_1_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -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 <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#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<xo::print::APrintable,
|
||||
xo::scm::DPrimitive_gco_2_dict_string>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_dict_string,
|
||||
xo::scm::IPrintable_DPrimitive_gco_2_dict_string>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -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 <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#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<xo::print::APrintable,
|
||||
xo::scm::DPrimitive_gco_2_gco_gco>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_gco_gco,
|
||||
xo::scm::IPrintable_DPrimitive_gco_2_gco_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -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 <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#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<xo::print::APrintable,
|
||||
xo::scm::DPrimitive_gco_3_dict_string_gco>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DPrimitive_gco_3_dict_string_gco,
|
||||
xo::scm::IPrintable_DPrimitive_gco_3_dict_string_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -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 <xo/facet/obj.hpp>
|
||||
|
||||
namespace xo { namespace scm { class IProcedure_Any; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::AProcedure,
|
||||
DVariantPlaceholder>
|
||||
{
|
||||
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<AGCObject> apply_nocheck(Opaque, obj<ARuntimeContext>, 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 */
|
||||
|
|
@ -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 <xo/procedure2/RuntimeContext.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_Xfer.hpp>
|
||||
#include <xo/procedure2/Procedure.hpp>
|
||||
#include <xo/procedure2/detail/IProcedure_Xfer.hpp>
|
||||
#include "DPrimitive_gco_0.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IProcedure_DPrimitive_gco_0; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::AProcedure,
|
||||
xo::scm::DPrimitive_gco_0>
|
||||
{
|
||||
using ImplType = xo::scm::IProcedure_Xfer
|
||||
<xo::scm::DPrimitive_gco_0,
|
||||
xo::scm::IProcedure_DPrimitive_gco_0>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObject> apply_nocheck(DPrimitive_gco_0 & self, obj<ARuntimeContext> rcx, const DArray * args);
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/procedure2/RuntimeContext.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_Xfer.hpp>
|
||||
#include <xo/procedure2/Procedure.hpp>
|
||||
#include <xo/procedure2/detail/IProcedure_Xfer.hpp>
|
||||
#include "DPrimitive_gco_1_gco.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IProcedure_DPrimitive_gco_1_gco; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::AProcedure,
|
||||
xo::scm::DPrimitive_gco_1_gco>
|
||||
{
|
||||
using ImplType = xo::scm::IProcedure_Xfer
|
||||
<xo::scm::DPrimitive_gco_1_gco,
|
||||
xo::scm::IProcedure_DPrimitive_gco_1_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObject> apply_nocheck(DPrimitive_gco_1_gco & self, obj<ARuntimeContext> rcx, const DArray * args);
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/procedure2/RuntimeContext.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_Xfer.hpp>
|
||||
#include <xo/procedure2/Procedure.hpp>
|
||||
#include <xo/procedure2/detail/IProcedure_Xfer.hpp>
|
||||
#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<xo::scm::AProcedure,
|
||||
xo::scm::DPrimitive_gco_2_dict_string>
|
||||
{
|
||||
using ImplType = xo::scm::IProcedure_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_dict_string,
|
||||
xo::scm::IProcedure_DPrimitive_gco_2_dict_string>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObject> apply_nocheck(DPrimitive_gco_2_dict_string & self, obj<ARuntimeContext> rcx, const DArray * args);
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/procedure2/RuntimeContext.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_Xfer.hpp>
|
||||
#include <xo/procedure2/Procedure.hpp>
|
||||
#include <xo/procedure2/detail/IProcedure_Xfer.hpp>
|
||||
#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<xo::scm::AProcedure,
|
||||
xo::scm::DPrimitive_gco_2_gco_gco>
|
||||
{
|
||||
using ImplType = xo::scm::IProcedure_Xfer
|
||||
<xo::scm::DPrimitive_gco_2_gco_gco,
|
||||
xo::scm::IProcedure_DPrimitive_gco_2_gco_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObject> apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj<ARuntimeContext> rcx, const DArray * args);
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/procedure2/RuntimeContext.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_Xfer.hpp>
|
||||
#include <xo/procedure2/Procedure.hpp>
|
||||
#include <xo/procedure2/detail/IProcedure_Xfer.hpp>
|
||||
#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<xo::scm::AProcedure,
|
||||
xo::scm::DPrimitive_gco_3_dict_string_gco>
|
||||
{
|
||||
using ImplType = xo::scm::IProcedure_Xfer
|
||||
<xo::scm::DPrimitive_gco_3_dict_string_gco,
|
||||
xo::scm::IProcedure_DPrimitive_gco_3_dict_string_gco>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AGCObject> apply_nocheck(DPrimitive_gco_3_dict_string_gco & self, obj<ARuntimeContext> rcx, const DArray * args);
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IProcedure_Xfer
|
||||
**/
|
||||
template <typename DRepr, typename IProcedure_DRepr>
|
||||
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<AGCObject> apply_nocheck(Opaque data, obj<ARuntimeContext> 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 <typename DRepr, typename IProcedure_DRepr>
|
||||
xo::facet::typeseq
|
||||
IProcedure_Xfer<DRepr, IProcedure_DRepr>::s_typeseq
|
||||
= xo::facet::typeseq::id<DRepr>();
|
||||
|
||||
template <typename DRepr, typename IProcedure_DRepr>
|
||||
bool
|
||||
IProcedure_Xfer<DRepr, IProcedure_DRepr>::_valid
|
||||
= xo::facet::valid_facet_implementation<AProcedure,
|
||||
IProcedure_Xfer>();
|
||||
|
||||
} /*namespace scm */
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_Xfer.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 <xo/facet/obj.hpp>
|
||||
|
||||
namespace xo { namespace scm { class IRuntimeContext_Any; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::ARuntimeContext,
|
||||
DVariantPlaceholder>
|
||||
{
|
||||
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<AAllocator> allocator(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] obj<ACollector> collector(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] obj<AAllocator> 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 */
|
||||
|
|
@ -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<xo::scm::ARuntimeContext,
|
||||
xo::scm::DSimpleRcx>
|
||||
{
|
||||
using ImplType = xo::scm::IRuntimeContext_Xfer
|
||||
<xo::scm::DSimpleRcx,
|
||||
xo::scm::IRuntimeContext_DSimpleRcx>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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<AAllocator> allocator(const DSimpleRcx & self) noexcept;
|
||||
/** collector facet for allocator. If non-null, same data pointer as allocator **/
|
||||
static obj<ACollector> collector(const DSimpleRcx & self) noexcept;
|
||||
/** last-resort allocator for erros. e.g. regular allocator exhausted **/
|
||||
static obj<AAllocator> 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 */
|
||||
|
|
@ -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 <xo/stringtable2/StringTable.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/arena/MemorySizeInfo.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IRuntimeContext_Xfer
|
||||
**/
|
||||
template <typename DRepr, typename IRuntimeContext_DRepr>
|
||||
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<AAllocator> allocator(Copaque data) const noexcept override {
|
||||
return I::allocator(_dcast(data));
|
||||
}
|
||||
obj<ACollector> collector(Copaque data) const noexcept override {
|
||||
return I::collector(_dcast(data));
|
||||
}
|
||||
obj<AAllocator> 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 <typename DRepr, typename IRuntimeContext_DRepr>
|
||||
xo::facet::typeseq
|
||||
IRuntimeContext_Xfer<DRepr, IRuntimeContext_DRepr>::s_typeseq
|
||||
= xo::facet::typeseq::id<DRepr>();
|
||||
|
||||
template <typename DRepr, typename IRuntimeContext_DRepr>
|
||||
bool
|
||||
IRuntimeContext_Xfer<DRepr, IRuntimeContext_DRepr>::_valid
|
||||
= xo::facet::valid_facet_implementation<ARuntimeContext,
|
||||
IRuntimeContext_Xfer>();
|
||||
|
||||
} /*namespace scm */
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IRuntimeContext_Xfer.hpp */
|
||||
91
xo-procedure2/include/xo/procedure2/detail/RProcedure.hpp
Normal file
91
xo-procedure2/include/xo/procedure2/detail/RProcedure.hpp
Normal file
|
|
@ -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 <typename Object>
|
||||
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<typename Object::DataType, xo::facet::DVariantPlaceholder>
|
||||
: 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<AGCObject> apply_nocheck(obj<ARuntimeContext> rcx, const DArray * args) {
|
||||
return O::iface()->apply_nocheck(O::data(), rcx, args);
|
||||
}
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-procedure-member-vars **/
|
||||
///@{
|
||||
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
template <typename Object>
|
||||
bool
|
||||
RProcedure<Object>::_valid = xo::facet::valid_object_router<Object>();
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
namespace xo { namespace facet {
|
||||
template <typename Object>
|
||||
struct RoutingFor<xo::scm::AProcedure, Object> {
|
||||
using RoutingType = xo::scm::RProcedure<Object>;
|
||||
};
|
||||
} }
|
||||
|
||||
/* end RProcedure.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 <typename Object>
|
||||
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<typename Object::DataType, xo::facet::DVariantPlaceholder>
|
||||
: 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<AAllocator> allocator() const noexcept {
|
||||
return O::iface()->allocator(O::data());
|
||||
}
|
||||
obj<ACollector> collector() const noexcept {
|
||||
return O::iface()->collector(O::data());
|
||||
}
|
||||
obj<AAllocator> 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 <typename Object>
|
||||
bool
|
||||
RRuntimeContext<Object>::_valid = xo::facet::valid_object_router<Object>();
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
namespace xo { namespace facet {
|
||||
template <typename Object>
|
||||
struct RoutingFor<xo::scm::ARuntimeContext, Object> {
|
||||
using RoutingType = xo::scm::RRuntimeContext<Object>;
|
||||
};
|
||||
} }
|
||||
|
||||
/* end RRuntimeContext.hpp */
|
||||
58
xo-procedure2/include/xo/procedure2/init_primitives.hpp
Normal file
58
xo-procedure2/include/xo/procedure2/init_primitives.hpp
Normal file
|
|
@ -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<double (*)(double)>;
|
||||
using Primitive_f64_2_f64_f64 = Primitive<double (*)(double, double)>;
|
||||
#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 */
|
||||
21
xo-procedure2/include/xo/procedure2/init_procedure2.hpp
Normal file
21
xo-procedure2/include/xo/procedure2/init_procedure2.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file init_procedure2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
namespace xo {
|
||||
/* tag to represent the xo-procedure2/ subsystem within ordered iniitalization */
|
||||
enum S_procedure2_tag {};
|
||||
|
||||
template <>
|
||||
struct InitSubsys<S_procedure2_tag> {
|
||||
static void init();
|
||||
static InitEvidence require();
|
||||
};
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_procedure2.hpp */
|
||||
13
xo-procedure2/include/xo/procedure2/primitives.hpp
Normal file
13
xo-procedure2/include/xo/procedure2/primitives.hpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/** @file primitives.hpp **/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
struct Primitives {
|
||||
static void init_primitives();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* end primitives.hpp */
|
||||
54
xo-procedure2/src/procedure2/CMakeLists.txt
Normal file
54
xo-procedure2/src/procedure2/CMakeLists.txt
Normal file
|
|
@ -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
|
||||
16
xo-procedure2/src/procedure2/DPrimitive.cpp
Normal file
16
xo-procedure2/src/procedure2/DPrimitive.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/** @file DPrimitive.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "DPrimitive.hpp"
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DPrimitive.cpp */
|
||||
29
xo-procedure2/src/procedure2/DSimpleRcx.cpp
Normal file
29
xo-procedure2/src/procedure2/DSimpleRcx.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/** @file DSimpleRcx.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#include "DSimpleRcx.hpp"
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::ACollector;
|
||||
|
||||
namespace scm {
|
||||
|
||||
obj<ACollector>
|
||||
DSimpleRcx::collector() const noexcept
|
||||
{
|
||||
return allocator_.try_to_facet<ACollector>();
|
||||
}
|
||||
|
||||
void
|
||||
DSimpleRcx::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
allocator_.visit_pools(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* end DSimpleRcx.cpp */
|
||||
172
xo-procedure2/src/procedure2/GcPrimitives.cpp
Normal file
172
xo-procedure2/src/procedure2/GcPrimitives.cpp
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/** @file GcPrimitives.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "GcPrimitives.hpp"
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/object2/Boolean.hpp>
|
||||
//#include <xo/gc/X1Collector.hpp>
|
||||
#include <xo/type/FunctionType.hpp>
|
||||
#include <xo/type/AtomicType.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/Generation.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::ACollector;
|
||||
//using xo::mm::DX1Collector;
|
||||
using xo::mm::Generation;
|
||||
|
||||
namespace scm {
|
||||
|
||||
// ----- report-gc-status -----
|
||||
|
||||
obj<AGCObject>
|
||||
xfer_report_gc_statistics(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
if (rcx.collector()) {
|
||||
obj<AGCObject> 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<AAllocator> mm,
|
||||
StringTable * stbl)
|
||||
{
|
||||
(void)stbl;
|
||||
|
||||
auto any_ty = DAtomicType::make(mm, Metatype::t_any());
|
||||
auto pm_ty = obj<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_report_gc_object_types(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
if (rcx.collector()) {
|
||||
obj<AGCObject> 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<AAllocator> mm,
|
||||
StringTable * stbl)
|
||||
{
|
||||
(void)stbl;
|
||||
|
||||
auto any_ty = DAtomicType::make(mm, Metatype::t_any());
|
||||
auto pm_ty = obj<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_report_gc_object_ages(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
if (rcx.collector()) {
|
||||
obj<AGCObject> 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<AAllocator> mm,
|
||||
StringTable * stbl)
|
||||
{
|
||||
(void)stbl;
|
||||
|
||||
auto any_ty = DAtomicType::make(mm, Metatype::t_any());
|
||||
auto pm_ty = obj<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_gc_location_of(obj<ARuntimeContext> rcx, obj<AGCObject> 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<AAllocator> 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<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_request_gc(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> upto_gco)
|
||||
{
|
||||
bool have_gc = false;
|
||||
|
||||
if (rcx.collector()) {
|
||||
Generation upto(obj<AGCObject,DInteger>::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<AAllocator> 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<AType,DFunctionType>(DFunctionType::_make(mm,
|
||||
bool_ty,
|
||||
int_ty));
|
||||
|
||||
return DPrimitive_gco_1_gco::_make(mm, "request-gc", pm_ty, &xfer_request_gc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* end GcPrimitives.cpp */
|
||||
309
xo-procedure2/src/procedure2/ObjectPrimitives.cpp
Normal file
309
xo-procedure2/src/procedure2/ObjectPrimitives.cpp
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
/** @file ObjectPrimitives.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "ObjectPrimitives.hpp"
|
||||
#include <xo/object2/RuntimeError.hpp>
|
||||
#include <xo/object2/Dictionary.hpp>
|
||||
#include <xo/object2/Sequence.hpp>
|
||||
#include <xo/object2/List.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/type/FunctionType.hpp>
|
||||
#include <xo/type/ListType.hpp>
|
||||
#include <xo/type/TypeVarRef.hpp>
|
||||
#include <xo/type/AtomicType.hpp>
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <unistd.h> // 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<AGCObject>
|
||||
xfer_cwd(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char * cwd = ::getcwd(buf, sizeof(buf));
|
||||
|
||||
return obj<AGCObject,DString>(DString::from_cstr(rcx.allocator(), cwd));
|
||||
}
|
||||
|
||||
DPrimitive_gco_0 *
|
||||
ObjectPrimitives::make_cwd_pm(obj<AAllocator> mm, StringTable * stbl)
|
||||
{
|
||||
(void)stbl;
|
||||
|
||||
auto str_ty = DAtomicType::make(mm, Metatype::t_str());
|
||||
auto cwd_ty
|
||||
= obj<AType,DFunctionType>(DFunctionType::_make(mm, str_ty));
|
||||
|
||||
return DPrimitive_gco_0::_make(mm, "cwd", cwd_ty, &xfer_cwd);
|
||||
}
|
||||
|
||||
// ----- nth -----
|
||||
|
||||
// TODO: seq_gc -> obj<ASequence>
|
||||
// n_gco -> obj<AGCObject,DInteger>
|
||||
//
|
||||
obj<AGCObject>
|
||||
xfer_nth(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> seq_gco,
|
||||
obj<AGCObject> n_gco)
|
||||
{
|
||||
(void)rcx;
|
||||
|
||||
obj<ASequence> seq = seq_gco.to_facet<ASequence>();
|
||||
auto n = obj<AGCObject,DInteger>::from(n_gco);
|
||||
|
||||
return seq.at(n->value());
|
||||
}
|
||||
|
||||
DPrimitive_gco_2_gco_gco *
|
||||
ObjectPrimitives::make_nth_pm(obj<AAllocator> 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<T> x int -> T **/
|
||||
auto nth_ty
|
||||
= obj<AType,DFunctionType>
|
||||
(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<AGCObject>
|
||||
xfer_cons(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> car,
|
||||
obj<AGCObject> cdr)
|
||||
{
|
||||
(void)rcx;
|
||||
|
||||
auto cdr_list = obj<AGCObject,DList>::from(cdr);
|
||||
|
||||
return DList::cons(rcx.allocator(),
|
||||
car,
|
||||
cdr_list.data());
|
||||
}
|
||||
|
||||
DPrimitive_gco_2_gco_gco *
|
||||
ObjectPrimitives::make_cons_pm(obj<AAllocator> 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<T> -> list<T> **/
|
||||
auto cons_ty
|
||||
= obj<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_set_car(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> cell_arg,
|
||||
obj<AGCObject> dest)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
(void)rcx;
|
||||
(void)dest;
|
||||
|
||||
auto cell = obj<AGCObject,DList>::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<AAllocator> 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<T> x any -> list<T> **/
|
||||
auto pm_ty
|
||||
= obj<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_dict_make(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
return obj<AGCObject,DDictionary>(DDictionary::empty(rcx.allocator(),
|
||||
8 /*cap*/));
|
||||
}
|
||||
|
||||
DPrimitive_gco_0 *
|
||||
ObjectPrimitives::make_dict_make_pm(obj<AAllocator> 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<AType,DFunctionType>(DFunctionType::_make(mm,
|
||||
dict_ty));
|
||||
|
||||
return DPrimitive_gco_0::_make(mm, "dict_make", pm_ty, &xfer_dict_make);
|
||||
}
|
||||
|
||||
// ----- dict_at -----
|
||||
|
||||
obj<AGCObject>
|
||||
xfer_dict_lookup(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject,DDictionary> dict,
|
||||
obj<AGCObject,DString> 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<AGCObject,DRuntimeError>
|
||||
(DRuntimeError::_make(rcx.allocator(),
|
||||
src_fn, error));
|
||||
}
|
||||
}
|
||||
|
||||
DPrimitive_gco_2_dict_string *
|
||||
ObjectPrimitives::make_dict_lookup_pm(obj<AAllocator> 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<AType,DFunctionType>
|
||||
(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<AGCObject>
|
||||
xfer_dict_upsert(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject,DDictionary> dict,
|
||||
obj<AGCObject,DString> key,
|
||||
obj<AGCObject> 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<APrintable>(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<AAllocator> 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<AType,DFunctionType>(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<AGCObject>
|
||||
xfer_fn_n_args(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> 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<AProcedure,AGCObject>(fn_gco);
|
||||
|
||||
assert(fn_proc);
|
||||
|
||||
return DInteger::box<AGCObject>(rcx.allocator(), fn_proc.n_args());
|
||||
}
|
||||
|
||||
DPrimitive_gco_1_gco *
|
||||
ObjectPrimitives::make_fn_n_args_pm(obj<AAllocator> 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<AType,DFunctionType>(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 */
|
||||
52
xo-procedure2/src/procedure2/PrimitiveRegistry.cpp
Normal file
52
xo-procedure2/src/procedure2/PrimitiveRegistry.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/** @file PrimitiveRegistry.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "PrimitiveRegistry.hpp"
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
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<ARuntimeContext> rcx,
|
||||
//obj<AAllocator> 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*/
|
||||
166
xo-procedure2/src/procedure2/SetupProcedure2.cpp
Normal file
166
xo-procedure2/src/procedure2/SetupProcedure2.cpp
Normal file
|
|
@ -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 <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
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<ARuntimeContext, DSimpleRcx>();
|
||||
|
||||
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_0>();
|
||||
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_0>();
|
||||
FacetRegistry::register_impl<APrintable, DPrimitive_gco_0>();
|
||||
|
||||
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_1_gco>();
|
||||
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_1_gco>();
|
||||
FacetRegistry::register_impl<APrintable, DPrimitive_gco_1_gco>();
|
||||
|
||||
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_2_gco_gco>();
|
||||
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_2_gco_gco>();
|
||||
FacetRegistry::register_impl<APrintable, DPrimitive_gco_2_gco_gco>();
|
||||
|
||||
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_2_dict_string>();
|
||||
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_2_dict_string>();
|
||||
FacetRegistry::register_impl<APrintable, DPrimitive_gco_2_dict_string>();
|
||||
|
||||
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_3_dict_string_gco>();
|
||||
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_3_dict_string_gco>();
|
||||
FacetRegistry::register_impl<APrintable, DPrimitive_gco_3_dict_string_gco>();
|
||||
|
||||
log && log(xtag("DSimpleRcx.tseq", typeseq::id<DSimpleRcx>()));
|
||||
log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id<DPrimitive_gco_0>()));
|
||||
log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id<DPrimitive_gco_1_gco>()));
|
||||
log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id<DPrimitive_gco_2_gco_gco>()));
|
||||
log && log(xtag("DPrimitive_gco_2_dict_string.tseq", typeseq::id<DPrimitive_gco_2_dict_string>()));
|
||||
log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id<DPrimitive_gco_3_dict_string_gco>()));
|
||||
|
||||
log && log(xtag("ARuntimeContext.tseq", typeseq::id<ARuntimeContext>()));
|
||||
log && log(xtag("AProcedure.tseq", typeseq::id<AProcedure>()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SetupProcedure2::register_types(obj<ACollector> 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<AGCObject, DPrimitive_gco_0>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DPrimitive_gco_1_gco>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DPrimitive_gco_2_gco_gco>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DPrimitive_gco_2_dict_string>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DPrimitive_gco_3_dict_string_gco>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool
|
||||
SetupProcedure2::register_primitives(obj<ARuntimeContext> rcx,
|
||||
InstallSink sink,
|
||||
InstallFlags flags)
|
||||
{
|
||||
obj<AAllocator> 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 */
|
||||
|
|
@ -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<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DPrimitive_gco_0.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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DPrimitive_gco_1_gco.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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DPrimitive_gco_2_dict_string.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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DPrimitive_gco_2_gco_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<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DPrimitive_gco_3_dict_string_gco.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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
48
xo-procedure2/src/procedure2/facet/IProcedure_Any.cpp
Normal file
48
xo-procedure2/src/procedure2/facet/IProcedure_Any.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/** @file IProcedure_Any.cpp
|
||||
*
|
||||
**/
|
||||
|
||||
#include "detail/IProcedure_Any.hpp"
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
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<DVariantPlaceholder>();
|
||||
|
||||
bool
|
||||
IProcedure_Any::_valid
|
||||
= valid_facet_implementation<AProcedure, IProcedure_Any>();
|
||||
|
||||
// nonconst methods
|
||||
|
||||
auto
|
||||
IProcedure_Any::apply_nocheck(Opaque, obj<ARuntimeContext>, const DArray *) -> obj<AGCObject>
|
||||
{
|
||||
_fatal();
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_Any.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<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_0.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<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_1_gco.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<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_2_dict_string.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<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_2_gco_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<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_3_dict_string_gco.cpp */
|
||||
42
xo-procedure2/src/procedure2/facet/IRuntimeContext_Any.cpp
Normal file
42
xo-procedure2/src/procedure2/facet/IRuntimeContext_Any.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/** @file IRuntimeContext_Any.cpp
|
||||
*
|
||||
**/
|
||||
|
||||
#include "detail/IRuntimeContext_Any.hpp"
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
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<DVariantPlaceholder>();
|
||||
|
||||
bool
|
||||
IRuntimeContext_Any::_valid
|
||||
= valid_facet_implementation<ARuntimeContext, IRuntimeContext_Any>();
|
||||
|
||||
// nonconst methods
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IRuntimeContext_Any.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<AAllocator>
|
||||
{
|
||||
return self.allocator();
|
||||
}
|
||||
|
||||
auto
|
||||
IRuntimeContext_DSimpleRcx::collector(const DSimpleRcx & self) noexcept -> obj<ACollector>
|
||||
{
|
||||
return self.collector();
|
||||
}
|
||||
|
||||
auto
|
||||
IRuntimeContext_DSimpleRcx::error_allocator(const DSimpleRcx & self) noexcept -> obj<AAllocator>
|
||||
{
|
||||
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 */
|
||||
113
xo-procedure2/src/procedure2/init_primitives.cpp
Normal file
113
xo-procedure2/src/procedure2/init_primitives.cpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/** @file init_primitives.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "init_primitives.hpp"
|
||||
#include "DPrimitive.hpp"
|
||||
#include <xo/object2/Float.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/object2/Boolean.hpp>
|
||||
#include <xo/object2/number/GCObjectConversion_DFloat.hpp>
|
||||
#include <xo/object2/number/GCObjectConversion_DInteger.hpp>
|
||||
#include <xo/alloc2/GCObjectConversion.hpp>
|
||||
#include <xo/facet/facet.hpp>
|
||||
#include <cmath>
|
||||
|
||||
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 */
|
||||
43
xo-procedure2/src/procedure2/init_procedure2.cpp
Normal file
43
xo-procedure2/src/procedure2/init_procedure2.cpp
Normal file
|
|
@ -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 <xo/object2/init_object2.hpp>
|
||||
#include <xo/type/init_type.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::SetupProcedure2;
|
||||
using xo::scm::PrimitiveRegistry;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_procedure2_tag>::init()
|
||||
{
|
||||
SetupProcedure2::register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&SetupProcedure2::register_types);
|
||||
PrimitiveRegistry::instance().register_primitives(&SetupProcedure2::register_primitives);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
InitSubsys<S_procedure2_tag>::require()
|
||||
{
|
||||
InitEvidence retval;
|
||||
|
||||
/* recursive subsystem deps for xo-object2/ */
|
||||
retval ^= InitSubsys<S_object2_tag>::require();
|
||||
retval ^= InitSubsys<S_type_tag>::require();
|
||||
|
||||
/* xo-procedure2/'s own initialization code */
|
||||
retval ^= Subsystem::provide<S_procedure2_tag>("procedure2", &init);
|
||||
|
||||
return retval;
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_procedure2.cpp */
|
||||
12
xo-procedure2/utest/CMakeLists.txt
Normal file
12
xo-procedure2/utest/CMakeLists.txt
Normal file
|
|
@ -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)
|
||||
149
xo-procedure2/utest/DPrimitive.test.cpp
Normal file
149
xo-procedure2/utest/DPrimitive.test.cpp
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/** @file DPrimitive.test.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include <xo/procedure2/init_procedure2.hpp>
|
||||
#include <xo/procedure2/init_primitives.hpp>
|
||||
#include <xo/procedure2/DSimpleRcx.hpp>
|
||||
#include <xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp>
|
||||
#include <xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp>
|
||||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/DArray.hpp>
|
||||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <sstream>
|
||||
|
||||
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<S_procedure2_tag>::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<AAllocator>::mkobj(&arena);
|
||||
|
||||
DSimpleRcx rcx_data(alloc);
|
||||
obj<ARuntimeContext> rcx = with_facet<ARuntimeContext>::mkobj(&rcx_data);
|
||||
|
||||
// 3.0 * 7.0 = 21.0
|
||||
obj<AGCObject> x = DFloat::box<AGCObject>(alloc, 3.0);
|
||||
obj<AGCObject> y = DFloat::box<AGCObject>(alloc, 7.0);
|
||||
DArray * args = DArray::array(alloc, x, y);
|
||||
|
||||
obj<AGCObject> result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args);
|
||||
|
||||
auto result_float = obj<AGCObject,DFloat>::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<AAllocator>::mkobj(&arena);
|
||||
|
||||
DSimpleRcx rcx_data(alloc);
|
||||
obj<ARuntimeContext> rcx = with_facet<ARuntimeContext>::mkobj(&rcx_data);
|
||||
|
||||
// 3 * 7 = 21
|
||||
obj<AGCObject> x = DInteger::box<AGCObject>(alloc, 3L);
|
||||
obj<AGCObject> y = DInteger::box<AGCObject>(alloc, 7L);
|
||||
DArray * args = DArray::array(alloc, x, y);
|
||||
|
||||
obj<AGCObject> result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args);
|
||||
|
||||
auto result_int = obj<AGCObject,DInteger>::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<AAllocator>::mkobj(&arena);
|
||||
|
||||
DSimpleRcx rcx_data(alloc);
|
||||
obj<ARuntimeContext> rcx = with_facet<ARuntimeContext>::mkobj(&rcx_data);
|
||||
|
||||
// 3 * 7.0 = 21.0 (mixed: result is float)
|
||||
obj<AGCObject> x = DInteger::box<AGCObject>(alloc, 3L);
|
||||
obj<AGCObject> y = DFloat::box<AGCObject>(alloc, 7.0);
|
||||
DArray * args = DArray::array(alloc, x, y);
|
||||
|
||||
obj<AGCObject> result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args);
|
||||
|
||||
auto result_float = obj<AGCObject,DFloat>::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<APrintable,DPrimitive_gco_2_gco_gco> 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 */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue