From ab61cddb6b3f5a55e92a02ca41ad03b86b8b4a47 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Mar 2026 13:02:12 +1100 Subject: [PATCH] xo-interpreter2 stack: refactor: string clases -> xo-stringtable2/ --- xo-alloc2/CMakeLists.txt | 9 ++ {xo-gc => xo-alloc2}/idl/GCObject.json5 | 0 xo-alloc2/include/xo/gc/GCObject.hpp | 22 +++++ xo-alloc2/include/xo/gc/detail/AGCObject.hpp | 87 +++++++++++++++++ .../include/xo/gc/detail/IGCObject_Any.hpp | 93 ++++++++++++++++++ .../include/xo/gc/detail/IGCObject_Xfer.hpp | 95 +++++++++++++++++++ xo-alloc2/include/xo/gc/detail/RGCObject.hpp | 93 ++++++++++++++++++ xo-alloc2/src/gc/IGCObject_Any.cpp | 48 ++++++++++ xo-expression2/CMakeLists.txt | 24 ----- xo-expression2/src/expression2/CMakeLists.txt | 6 -- .../expression2_register_facets.cpp | 5 - .../expression2_register_types.cpp | 7 +- xo-expression2/utest/CMakeLists.txt | 1 - xo-expression2/utest/DDefineExpr.test.cpp | 16 ++-- xo-expression2/utest/DVariable.test.cpp | 12 ++- xo-expression2/utest/X1Collector.test.cpp | 8 +- xo-gc/CMakeLists.txt | 13 --- .../interpreter2/VirtualSchematikaMachine.cpp | 2 +- .../utest/VirtualSchematikaMachine.test.cpp | 2 +- xo-object2/CMakeLists.txt | 20 ---- .../include/xo/reader2/ParserStateMachine.hpp | 2 +- xo-stringtable2/CMakeLists.txt | 44 +++++++++ xo-stringtable2/idl/IGCObject_DString.json5 | 6 +- .../idl/IGCObject_DUniqueString.json5 | 8 +- xo-stringtable2/idl/IPrintable_DString.json5 | 4 +- .../idl/IPrintable_DUniqueString.json5 | 6 +- .../xo/stringtable2}/DUniqueString.hpp | 0 .../include/xo/stringtable2}/StringTable.hpp | 0 .../include/xo/stringtable2}/UniqueString.hpp | 4 +- .../stringtable2/string/IGCObject_DString.hpp | 2 +- .../uniquestring}/IGCObject_DUniqueString.hpp | 2 +- .../IPrintable_DUniqueString.hpp | 0 .../src/stringtable2/CMakeLists.txt | 7 ++ .../src/stringtable2}/DUniqueString.cpp | 0 .../stringtable2}/IGCObject_DUniqueString.cpp | 2 +- .../IPrintable_DUniqueString.cpp | 2 +- .../src/stringtable2}/StringTable.cpp | 0 .../stringtable2_register_facets.cpp | 4 + .../stringtable2_register_types.cpp | 2 + xo-stringtable2/utest/CMakeLists.txt | 1 + .../utest/StringTable.test.cpp | 2 +- 41 files changed, 550 insertions(+), 111 deletions(-) rename {xo-gc => xo-alloc2}/idl/GCObject.json5 (100%) create mode 100644 xo-alloc2/include/xo/gc/GCObject.hpp create mode 100644 xo-alloc2/include/xo/gc/detail/AGCObject.hpp create mode 100644 xo-alloc2/include/xo/gc/detail/IGCObject_Any.hpp create mode 100644 xo-alloc2/include/xo/gc/detail/IGCObject_Xfer.hpp create mode 100644 xo-alloc2/include/xo/gc/detail/RGCObject.hpp create mode 100644 xo-alloc2/src/gc/IGCObject_Any.cpp rename {xo-expression2 => xo-stringtable2}/idl/IGCObject_DUniqueString.json5 (68%) rename {xo-expression2 => xo-stringtable2}/idl/IPrintable_DUniqueString.json5 (76%) rename {xo-expression2/include/xo/expression2 => xo-stringtable2/include/xo/stringtable2}/DUniqueString.hpp (100%) rename {xo-expression2/include/xo/expression2 => xo-stringtable2/include/xo/stringtable2}/StringTable.hpp (100%) rename {xo-expression2/include/xo/expression2 => xo-stringtable2/include/xo/stringtable2}/UniqueString.hpp (58%) rename {xo-expression2/include/xo/expression2/detail => xo-stringtable2/include/xo/stringtable2/uniquestring}/IGCObject_DUniqueString.hpp (99%) rename {xo-expression2/include/xo/expression2/detail => xo-stringtable2/include/xo/stringtable2/uniquestring}/IPrintable_DUniqueString.hpp (100%) rename {xo-expression2/src/expression2 => xo-stringtable2/src/stringtable2}/DUniqueString.cpp (100%) rename {xo-expression2/src/expression2 => xo-stringtable2/src/stringtable2}/IGCObject_DUniqueString.cpp (95%) rename {xo-expression2/src/expression2 => xo-stringtable2/src/stringtable2}/IPrintable_DUniqueString.cpp (92%) rename {xo-expression2/src/expression2 => xo-stringtable2/src/stringtable2}/StringTable.cpp (100%) rename {xo-expression2 => xo-stringtable2}/utest/StringTable.test.cpp (99%) diff --git a/xo-alloc2/CMakeLists.txt b/xo-alloc2/CMakeLists.txt index b4b03193..702f6e55 100644 --- a/xo-alloc2/CMakeLists.txt +++ b/xo-alloc2/CMakeLists.txt @@ -18,6 +18,15 @@ add_definitions(${PROJECT_CXX_FLAGS}) # ---------------------------------------------------------------- +# note: manual target; generated code committed to git +xo_add_genfacet( + TARGET xo-gc-facet-gcobject + FACET GCObject + INPUT idl/GCObject.json5 +) + +# ---------------------------------------------------------------- + # note: manual target; generated code committed to git xo_add_genfacet( TARGET xo-alloc2-facet-resourcevisitor diff --git a/xo-gc/idl/GCObject.json5 b/xo-alloc2/idl/GCObject.json5 similarity index 100% rename from xo-gc/idl/GCObject.json5 rename to xo-alloc2/idl/GCObject.json5 diff --git a/xo-alloc2/include/xo/gc/GCObject.hpp b/xo-alloc2/include/xo/gc/GCObject.hpp new file mode 100644 index 00000000..759e9376 --- /dev/null +++ b/xo-alloc2/include/xo/gc/GCObject.hpp @@ -0,0 +1,22 @@ +/** @file GCObject.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/GCObject.json5] + * 2. jinja2 template for facet .hpp file: + * [facet.hpp.j2] + * 3. idl for facet methods + * [idl/GCObject.json5] + **/ + +#pragma once + +#include "detail/AGCObject.hpp" +#include "detail/IGCObject_Any.hpp" +#include "detail/IGCObject_Xfer.hpp" +#include "detail/RGCObject.hpp" + + +/* end GCObject.hpp */ diff --git a/xo-alloc2/include/xo/gc/detail/AGCObject.hpp b/xo-alloc2/include/xo/gc/detail/AGCObject.hpp new file mode 100644 index 00000000..6f6e7b92 --- /dev/null +++ b/xo-alloc2/include/xo/gc/detail/AGCObject.hpp @@ -0,0 +1,87 @@ +/** @file AGCObject.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/GCObject.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [abstract_facet.hpp.j2] + * 3. idl for facet methods + * [idl/GCObject.json5] + **/ + +#pragma once + +// includes (via {facet_includes}) +#include +#include +#include +#include +#include +#include +#include + +namespace xo { namespace mm { class ACollector; }} + +namespace xo { +namespace mm { + +using Copaque = const void *; +using Opaque = void *; + +/** +GC hooks for collector-aware data +**/ +class AGCObject { +public: + /** @defgroup mm-gcobject-type-traits **/ + ///@{ + // types + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using Copaque = const void *; + using Opaque = void *; + /** type for an amount of memory **/ + using size_type = std::size_t; + /** fomo allocator type **/ + using AAllocator = xo::mm::AAllocator; + /** fomo collector type **/ + using ACollector = xo::mm::ACollector; + ///@} + + /** @defgroup mm-gcobject-methods **/ + ///@{ + // const methods + /** 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; + /** memory consumption for this instance **/ + virtual size_type shallow_size(Copaque data) const noexcept = 0; + /** copy instance using allocator **/ + virtual Opaque shallow_copy(Copaque data, obj mm) const noexcept = 0; + + // nonconst methods + /** during GC: forward immdiate children **/ + virtual size_type forward_children(Opaque data, obj gc) const noexcept = 0; + ///@} +}; /*AGCObject*/ + +/** Implementation IGCObject_DRepr of AGCObject for state DRepr + * should provide a specialization: + * + * template <> + * struct xo::facet::FacetImplementation { + * using Impltype = IGCObject_DRepr; + * }; + * + * then IGCObject_ImplType --> IGCObject_DRepr + **/ +template +using IGCObject_ImplType = xo::facet::FacetImplType; + +} /*namespace mm*/ +} /*namespace xo*/ + +/* AGCObject.hpp */ diff --git a/xo-alloc2/include/xo/gc/detail/IGCObject_Any.hpp b/xo-alloc2/include/xo/gc/detail/IGCObject_Any.hpp new file mode 100644 index 00000000..9ff7bb2e --- /dev/null +++ b/xo-alloc2/include/xo/gc/detail/IGCObject_Any.hpp @@ -0,0 +1,93 @@ +/** @file IGCObject_Any.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/GCObject.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/GCObject.json5] + **/ + +#pragma once + +#include "AGCObject.hpp" +#include + +namespace xo { namespace mm { class IGCObject_Any; } } + +namespace xo { +namespace facet { + +template <> +struct FacetImplementation +{ + using ImplType = xo::mm::IGCObject_Any; +}; + +} +} + +namespace xo { +namespace mm { + + /** @class IGCObject_Any + * @brief AGCObject implementation for empty variant instance + **/ + class IGCObject_Any : public AGCObject { + public: + /** @defgroup mm-gcobject-any-type-traits **/ + ///@{ + + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using size_type = AGCObject::size_type; + using AAllocator = AGCObject::AAllocator; + using ACollector = AGCObject::ACollector; + + ///@} + /** @defgroup mm-gcobject-any-methods **/ + ///@{ + + const AGCObject * iface() const { return std::launder(this); } + + // from AGCObject + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + [[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); } + + // const methods + [[noreturn]] size_type shallow_size(Copaque) const noexcept override { _fatal(); } + [[noreturn]] Opaque shallow_copy(Copaque, obj) const noexcept override { _fatal(); } + + // nonconst methods + [[noreturn]] size_type forward_children(Opaque, obj) const noexcept override; + + ///@} + + private: + /** @defgraoup mm-gcobject-any-private-methods **/ + ///@{ + + [[noreturn]] static void _fatal(); + + ///@} + + public: + /** @defgroup mm-gcobject-any-member-vars **/ + ///@{ + + static typeseq s_typeseq; + static bool _valid; + + ///@} + }; + +} /*namespace mm */ +} /*namespace xo */ + +/* IGCObject_Any.hpp */ diff --git a/xo-alloc2/include/xo/gc/detail/IGCObject_Xfer.hpp b/xo-alloc2/include/xo/gc/detail/IGCObject_Xfer.hpp new file mode 100644 index 00000000..7f094ab7 --- /dev/null +++ b/xo-alloc2/include/xo/gc/detail/IGCObject_Xfer.hpp @@ -0,0 +1,95 @@ +/** @file IGCObject_Xfer.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/GCObject.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/GCObject.json5] + **/ + +#pragma once + +#include +#include +#include +#include + +namespace xo { +namespace mm { + /** @class IGCObject_Xfer + **/ + template + class IGCObject_Xfer : public AGCObject { + public: + /** @defgroup mm-gcobject-xfer-type-traits **/ + ///@{ + /** actual implementation (not generated; often delegates to DRepr) **/ + using Impl = IGCObject_DRepr; + /** integer identifying a type **/ + using typeseq = AGCObject::typeseq; + using size_type = AGCObject::size_type; + using AAllocator = AGCObject::AAllocator; + using ACollector = AGCObject::ACollector; + ///@} + + /** @defgroup mm-gcobject-xfer-methods **/ + ///@{ + + static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; } + static DRepr & _dcast(Opaque d) { return *(DRepr *)d; } + + // from AGCObject + + // builtin methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); } + + // const methods + size_type shallow_size(Copaque data) const noexcept override { + return I::shallow_size(_dcast(data)); + } + Opaque shallow_copy(Copaque data, obj mm) const noexcept override { + return I::shallow_copy(_dcast(data), mm); + } + + // non-const methods + size_type forward_children(Opaque data, obj gc) const noexcept override { + return I::forward_children(_dcast(data), gc); + } + + ///@} + + private: + using I = Impl; + + public: + /** @defgroup mm-gcobject-xfer-member-vars **/ + ///@{ + + /** typeseq for template parameter DRepr **/ + static typeseq s_typeseq; + /** true iff satisfies facet implementation **/ + static bool _valid; + + ///@} + }; + + template + xo::facet::typeseq + IGCObject_Xfer::s_typeseq + = xo::facet::typeseq::id(); + + template + bool + IGCObject_Xfer::_valid + = xo::facet::valid_facet_implementation(); + +} /*namespace mm */ +} /*namespace xo*/ + +/* end IGCObject_Xfer.hpp */ diff --git a/xo-alloc2/include/xo/gc/detail/RGCObject.hpp b/xo-alloc2/include/xo/gc/detail/RGCObject.hpp new file mode 100644 index 00000000..d24994a8 --- /dev/null +++ b/xo-alloc2/include/xo/gc/detail/RGCObject.hpp @@ -0,0 +1,93 @@ +/** @file RGCObject.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/GCObject.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/GCObject.json5] + **/ + +#pragma once + +#include "AGCObject.hpp" + +namespace xo { +namespace mm { + +/** @class RGCObject + **/ +template +class RGCObject : public Object { +private: + using O = Object; + +public: + /** @defgroup mm-gcobject-router-type-traits **/ + ///@{ + using ObjectType = Object; + using DataPtr = Object::DataPtr; + using typeseq = xo::reflect::typeseq; + using size_type = AGCObject::size_type; + using AAllocator = AGCObject::AAllocator; + using ACollector = AGCObject::ACollector; + ///@} + + /** @defgroup mm-gcobject-router-ctors **/ + ///@{ + RGCObject() {} + RGCObject(Object::DataPtr data) : Object{std::move(data)} {} + RGCObject(const AGCObject * iface, void * data) + requires std::is_same_v + : Object(iface, data) {} + + ///@} + /** @defgroup mm-gcobject-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 + size_type shallow_size() const noexcept { + return O::iface()->shallow_size(O::data()); + } + Opaque shallow_copy(obj mm) const noexcept { + return O::iface()->shallow_copy(O::data(), mm); + } + + // non-const methods (still const in router!) + size_type forward_children(obj gc) noexcept { + return O::iface()->forward_children(O::data(), gc); + } + + ///@} + /** @defgroup mm-gcobject-member-vars **/ + ///@{ + + static bool _valid; + + ///@} +}; + +template +bool +RGCObject::_valid = xo::facet::valid_object_router(); + +} /*namespace mm*/ +} /*namespace xo*/ + +namespace xo { namespace facet { + template + struct RoutingFor { + using RoutingType = xo::mm::RGCObject; + }; +} } + +/* end RGCObject.hpp */ diff --git a/xo-alloc2/src/gc/IGCObject_Any.cpp b/xo-alloc2/src/gc/IGCObject_Any.cpp new file mode 100644 index 00000000..95c8cc84 --- /dev/null +++ b/xo-alloc2/src/gc/IGCObject_Any.cpp @@ -0,0 +1,48 @@ +/** @file IGCObject_Any.cpp + * + **/ + +#include "detail/IGCObject_Any.hpp" +#include +#include + +namespace xo { +namespace mm { + +using xo::facet::DVariantPlaceholder; +using xo::facet::typeseq; +using xo::facet::valid_facet_implementation; + +void +IGCObject_Any::_fatal() +{ + /* control here on uninitialized IAllocator_Any. + * Initialized instance will have specific implementation type + */ + std::cerr << "fatal" + << ": attempt to call uninitialized" + << " IGCObject_Any method" + << std::endl; + std::terminate(); +} + +typeseq +IGCObject_Any::s_typeseq = typeseq::id(); + +bool +IGCObject_Any::_valid + = valid_facet_implementation(); + +// nonconst methods + +auto +IGCObject_Any::forward_children(Opaque, obj) const noexcept -> size_type +{ + _fatal(); +} + + +} /*namespace mm*/ +} /*namespace xo*/ + +/* end IGCObject_Any.cpp */ diff --git a/xo-expression2/CMakeLists.txt b/xo-expression2/CMakeLists.txt index c9180ad8..92652b90 100644 --- a/xo-expression2/CMakeLists.txt +++ b/xo-expression2/CMakeLists.txt @@ -394,30 +394,6 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- -# note: manual target; generated code committed to git -xo_add_genfacetimpl( - TARGET xo-expression2-facetimpl-gcobject-uniquestring - FACET_PKG xo_gc - FACET GCObject - REPR UniqueString - INPUT idl/IGCObject_DUniqueString.json5 - OUTPUT_HPP_DIR include/xo/expression2 - OUTPUT_IMPL_SUBDIR detail -) - -# note: manual target; generated code committed to git -xo_add_genfacetimpl( - TARGET xo-expression2-facetimpl-printable-uniquestring - FACET_PKG xo_printable2 - FACET Printable - REPR UniqueString - INPUT idl/IPrintable_DUniqueString.json5 - OUTPUT_HPP_DIR include/xo/expression2 - OUTPUT_IMPL_SUBDIR detail -) - -# ---------------------------------------------------------------- - xo_add_genfacet_all(xo-expression2-genfacet-all) # ---------------------------------------------------------------- diff --git a/xo-expression2/src/expression2/CMakeLists.txt b/xo-expression2/src/expression2/CMakeLists.txt index f05cf2f1..d5bf81f4 100644 --- a/xo-expression2/src/expression2/CMakeLists.txt +++ b/xo-expression2/src/expression2/CMakeLists.txt @@ -63,12 +63,6 @@ set(SELF_SRCS IGCObject_DGlobalSymtab.cpp IPrintable_DGlobalSymtab.cpp - StringTable.cpp - - DUniqueString.cpp - IGCObject_DUniqueString.cpp - IPrintable_DUniqueString.cpp - ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) diff --git a/xo-expression2/src/expression2/expression2_register_facets.cpp b/xo-expression2/src/expression2/expression2_register_facets.cpp index a9edbc20..3cd9413d 100644 --- a/xo-expression2/src/expression2/expression2_register_facets.cpp +++ b/xo-expression2/src/expression2/expression2_register_facets.cpp @@ -5,8 +5,6 @@ #include "expression2_register_facets.hpp" -#include - #include #include #include @@ -43,9 +41,6 @@ namespace xo { { scope log(XO_DEBUG(true)); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - // Expression // +- Constant // +- Variable diff --git a/xo-expression2/src/expression2/expression2_register_types.cpp b/xo-expression2/src/expression2/expression2_register_types.cpp index b3dd21f8..7a64eb1f 100644 --- a/xo-expression2/src/expression2/expression2_register_types.cpp +++ b/xo-expression2/src/expression2/expression2_register_types.cpp @@ -5,7 +5,8 @@ #include "expression2_register_types.hpp" -#include "detail/IGCObject_DConstant.hpp" +#include "Constant.hpp" +//#include "detail/IGCObject_DConstant.hpp" #include "detail/IGCObject_DVariable.hpp" //#include "detail/IGCObject_DDefineExpr.hpp" // when avail //#include "detail/IGCObject_DApplyExpr.hpp" // when avail @@ -13,7 +14,7 @@ #include "detail/IGCObject_DIfElseExpr.hpp" #include "detail/IGCObject_DSequenceExpr.hpp" //#include "detail/IGCObject_DLocalSymtab.hpp" // when avail -#include "detail/IGCObject_DUniqueString.hpp" +//#include "detail/IGCObject_DUniqueString.hpp" //#include "detail/IPrintable_DUniqueString.hpp" // when avail @@ -44,8 +45,6 @@ namespace xo { //ok &= gc.install_type(impl_for()); // when avail - ok &= gc.install_type(impl_for()); - return ok; } } diff --git a/xo-expression2/utest/CMakeLists.txt b/xo-expression2/utest/CMakeLists.txt index 07f10c3b..4273fa9a 100644 --- a/xo-expression2/utest/CMakeLists.txt +++ b/xo-expression2/utest/CMakeLists.txt @@ -3,7 +3,6 @@ set(UTEST_EXE utest.expression2) set(UTEST_SRCS expression2_utest_main.cpp - StringTable.test.cpp X1Collector.test.cpp DConstant.test.cpp DVariable.test.cpp diff --git a/xo-expression2/utest/DDefineExpr.test.cpp b/xo-expression2/utest/DDefineExpr.test.cpp index 648af0f4..184c7556 100644 --- a/xo-expression2/utest/DDefineExpr.test.cpp +++ b/xo-expression2/utest/DDefineExpr.test.cpp @@ -7,17 +7,17 @@ #include #include #include -#include -#include -#include +#include +//#include -#include -#include +#include +//#include + +#include + +#include #include -#include -//#include -//#include #include #include diff --git a/xo-expression2/utest/DVariable.test.cpp b/xo-expression2/utest/DVariable.test.cpp index 51e80a33..31f11301 100644 --- a/xo-expression2/utest/DVariable.test.cpp +++ b/xo-expression2/utest/DVariable.test.cpp @@ -4,17 +4,19 @@ **/ #include "init_expression2.hpp" -#include -#include -#include -#include +#include +//#include +//#include #include + +#include +#include + #include #include #include -#include #include diff --git a/xo-expression2/utest/X1Collector.test.cpp b/xo-expression2/utest/X1Collector.test.cpp index 08fb5ca9..9534667e 100644 --- a/xo-expression2/utest/X1Collector.test.cpp +++ b/xo-expression2/utest/X1Collector.test.cpp @@ -6,15 +6,17 @@ **/ #include "init_expression2.hpp" -#include "StringTable.hpp" -#include "detail/IGCObject_DUniqueString.hpp" #include #include #include -#include #include + +#include +#include +#include + #include #include diff --git a/xo-gc/CMakeLists.txt b/xo-gc/CMakeLists.txt index 573e5acc..2edb0ac3 100644 --- a/xo-gc/CMakeLists.txt +++ b/xo-gc/CMakeLists.txt @@ -18,19 +18,6 @@ add_definitions(${PROJECT_CXX_FLAGS}) # ---------------------------------------------------------------- -# note: manual target; generated code committed to git -xo_add_genfacet( - TARGET xo-gc-facet-gcobject - FACET GCObject - INPUT idl/GCObject.json5 -) - -# ---------------------------------------------------------------- - -xo_add_genfacet_all(xo-gc-genfacet-all) - -# ---------------------------------------------------------------- - # must complete definition of expression lib before configuring examples add_subdirectory(src/gc) add_subdirectory(utest) diff --git a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp index b2d1a675..d0889fa3 100644 --- a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/xo-interpreter2/utest/VirtualSchematikaMachine.test.cpp b/xo-interpreter2/utest/VirtualSchematikaMachine.test.cpp index b312395c..21b5faa3 100644 --- a/xo-interpreter2/utest/VirtualSchematikaMachine.test.cpp +++ b/xo-interpreter2/utest/VirtualSchematikaMachine.test.cpp @@ -6,13 +6,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/xo-object2/CMakeLists.txt b/xo-object2/CMakeLists.txt index 4b27b70e..1735dd5b 100644 --- a/xo-object2/CMakeLists.txt +++ b/xo-object2/CMakeLists.txt @@ -116,26 +116,6 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- -# note: manual target; generated code committed to git -xo_add_genfacetimpl( - TARGET xo-object2-facetimpl-printable-string - FACET_PKG xo_printable2 - FACET Printable - REPR String - INPUT idl/IPrintable_DString.json5 -) - -# note: manual target; generated code committed to git -xo_add_genfacetimpl( - TARGET xo-object2-facetimpl-gcobject-string - FACET_PKG xo_gc - FACET GCObject - REPR String - INPUT idl/IGCObject_DString.json5 -) - -# ---------------------------------------------------------------- - # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-object2-facetimpl-sequence-array diff --git a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp index 0c01e452..a247688a 100644 --- a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp @@ -10,9 +10,9 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/xo-stringtable2/CMakeLists.txt b/xo-stringtable2/CMakeLists.txt index 40f375b6..2c2a6962 100644 --- a/xo-stringtable2/CMakeLists.txt +++ b/xo-stringtable2/CMakeLists.txt @@ -17,6 +17,50 @@ xo_cxx_toplevel_options3() set(PROJECT_CXX_FLAGS "") add_definitions(${PROJECT_CXX_FLAGS}) +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-stringtable2-facetimpl-gcobject-string + FACET_PKG xo_alloc2 + FACET GCObject + REPR String + INPUT idl/IGCObject_DString.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-stringtable2-facetimpl-printable-string + FACET_PKG xo_printable2 + FACET Printable + REPR String + INPUT idl/IPrintable_DString.json5 +) + +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-stringtable2-facetimpl-gcobject-uniquestring + FACET_PKG xo_alloc2 + FACET GCObject + REPR UniqueString + INPUT idl/IGCObject_DUniqueString.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-stringtable2-facetimpl-printable-uniquestring + FACET_PKG xo_printable2 + FACET Printable + REPR UniqueString + INPUT idl/IPrintable_DUniqueString.json5 +) + +# ---------------------------------------------------------------- + +xo_add_genfacet_all(xo-stringtable2-genfacet-all) + # ---------------------------------------------------------------- # output targets diff --git a/xo-stringtable2/idl/IGCObject_DString.json5 b/xo-stringtable2/idl/IGCObject_DString.json5 index caf33fae..6d986ccb 100644 --- a/xo-stringtable2/idl/IGCObject_DString.json5 +++ b/xo-stringtable2/idl/IGCObject_DString.json5 @@ -1,10 +1,10 @@ { mode: "implementation", - output_cpp_dir: "src/object2", - output_hpp_dir: "include/xo/object2", + output_cpp_dir: "src/stringtable2", + output_hpp_dir: "include/xo/stringtable2", output_impl_subdir: "string", includes: [ - "", + "", "" ], local_types: [ ], diff --git a/xo-expression2/idl/IGCObject_DUniqueString.json5 b/xo-stringtable2/idl/IGCObject_DUniqueString.json5 similarity index 68% rename from xo-expression2/idl/IGCObject_DUniqueString.json5 rename to xo-stringtable2/idl/IGCObject_DUniqueString.json5 index 4f79e9de..a5eb0c6a 100644 --- a/xo-expression2/idl/IGCObject_DUniqueString.json5 +++ b/xo-stringtable2/idl/IGCObject_DUniqueString.json5 @@ -1,10 +1,10 @@ { mode: "implementation", - output_cpp_dir: "src/expression2", - output_hpp_dir: "include/xo/expression2", - output_impl_subdir: "detail", + output_cpp_dir: "src/stringtable2", + output_hpp_dir: "include/xo/stringtable2", + output_impl_subdir: "uniquestring", includes: [ - "", + "", "" ], local_types: [ ], diff --git a/xo-stringtable2/idl/IPrintable_DString.json5 b/xo-stringtable2/idl/IPrintable_DString.json5 index 8510938b..bbbd3bc7 100644 --- a/xo-stringtable2/idl/IPrintable_DString.json5 +++ b/xo-stringtable2/idl/IPrintable_DString.json5 @@ -1,7 +1,7 @@ { mode: "implementation", - output_cpp_dir: "src/object2", - output_hpp_dir: "include/xo/object2", + output_cpp_dir: "src/stringtable2", + output_hpp_dir: "include/xo/stringtable2", output_impl_subdir: "string", includes: [ "", "" ], diff --git a/xo-expression2/idl/IPrintable_DUniqueString.json5 b/xo-stringtable2/idl/IPrintable_DUniqueString.json5 similarity index 76% rename from xo-expression2/idl/IPrintable_DUniqueString.json5 rename to xo-stringtable2/idl/IPrintable_DUniqueString.json5 index ba094879..b6af4eb3 100644 --- a/xo-expression2/idl/IPrintable_DUniqueString.json5 +++ b/xo-stringtable2/idl/IPrintable_DUniqueString.json5 @@ -1,8 +1,8 @@ { mode: "implementation", - output_cpp_dir: "src/expression2", - output_hpp_dir: "include/xo/expression2", - output_impl_subdir: "detail", + output_cpp_dir: "src/stringtable2", + output_hpp_dir: "include/xo/stringtable2", + output_impl_subdir: "uniquestring", includes: [ "", "" ], local_types: [ ], diff --git a/xo-expression2/include/xo/expression2/DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp similarity index 100% rename from xo-expression2/include/xo/expression2/DUniqueString.hpp rename to xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp diff --git a/xo-expression2/include/xo/expression2/StringTable.hpp b/xo-stringtable2/include/xo/stringtable2/StringTable.hpp similarity index 100% rename from xo-expression2/include/xo/expression2/StringTable.hpp rename to xo-stringtable2/include/xo/stringtable2/StringTable.hpp diff --git a/xo-expression2/include/xo/expression2/UniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/UniqueString.hpp similarity index 58% rename from xo-expression2/include/xo/expression2/UniqueString.hpp rename to xo-stringtable2/include/xo/stringtable2/UniqueString.hpp index 90cd1cd2..6dfaadfd 100644 --- a/xo-expression2/include/xo/expression2/UniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/UniqueString.hpp @@ -6,7 +6,7 @@ #pragma once #include "DUniqueString.hpp" -#include "detail/IGCObject_DUniqueString.hpp" -#include "detail/IPrintable_DUniqueString.hpp" +#include "uniquestring/IGCObject_DUniqueString.hpp" +#include "uniquestring/IPrintable_DUniqueString.hpp" /* end UniqueString.hpp */ diff --git a/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp index 2a907f37..64382151 100644 --- a/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp similarity index 99% rename from xo-expression2/include/xo/expression2/detail/IGCObject_DUniqueString.hpp rename to xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp index 9968d6da..2150decf 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DUniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/xo-expression2/include/xo/expression2/detail/IPrintable_DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/uniquestring/IPrintable_DUniqueString.hpp similarity index 100% rename from xo-expression2/include/xo/expression2/detail/IPrintable_DUniqueString.hpp rename to xo-stringtable2/include/xo/stringtable2/uniquestring/IPrintable_DUniqueString.hpp diff --git a/xo-stringtable2/src/stringtable2/CMakeLists.txt b/xo-stringtable2/src/stringtable2/CMakeLists.txt index 5874217a..cdf1f223 100644 --- a/xo-stringtable2/src/stringtable2/CMakeLists.txt +++ b/xo-stringtable2/src/stringtable2/CMakeLists.txt @@ -6,9 +6,16 @@ set(SELF_SRCS stringtable2_register_facets.cpp stringtable2_register_types.cpp + StringTable.cpp + DString.cpp IGCObject_DString.cpp IPrintable_DString.cpp + + DUniqueString.cpp + IGCObject_DUniqueString.cpp + IPrintable_DUniqueString.cpp + ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) diff --git a/xo-expression2/src/expression2/DUniqueString.cpp b/xo-stringtable2/src/stringtable2/DUniqueString.cpp similarity index 100% rename from xo-expression2/src/expression2/DUniqueString.cpp rename to xo-stringtable2/src/stringtable2/DUniqueString.cpp diff --git a/xo-expression2/src/expression2/IGCObject_DUniqueString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp similarity index 95% rename from xo-expression2/src/expression2/IGCObject_DUniqueString.cpp rename to xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp index 8238990f..b51f0eb1 100644 --- a/xo-expression2/src/expression2/IGCObject_DUniqueString.cpp +++ b/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp @@ -11,7 +11,7 @@ * [idl/IGCObject_DUniqueString.json5] **/ -#include "detail/IGCObject_DUniqueString.hpp" +#include "uniquestring/IGCObject_DUniqueString.hpp" namespace xo { namespace scm { diff --git a/xo-expression2/src/expression2/IPrintable_DUniqueString.cpp b/xo-stringtable2/src/stringtable2/IPrintable_DUniqueString.cpp similarity index 92% rename from xo-expression2/src/expression2/IPrintable_DUniqueString.cpp rename to xo-stringtable2/src/stringtable2/IPrintable_DUniqueString.cpp index 5f490bd9..ef704dee 100644 --- a/xo-expression2/src/expression2/IPrintable_DUniqueString.cpp +++ b/xo-stringtable2/src/stringtable2/IPrintable_DUniqueString.cpp @@ -11,7 +11,7 @@ * [idl/IPrintable_DUniqueString.json5] **/ -#include "detail/IPrintable_DUniqueString.hpp" +#include "uniquestring/IPrintable_DUniqueString.hpp" namespace xo { namespace scm { diff --git a/xo-expression2/src/expression2/StringTable.cpp b/xo-stringtable2/src/stringtable2/StringTable.cpp similarity index 100% rename from xo-expression2/src/expression2/StringTable.cpp rename to xo-stringtable2/src/stringtable2/StringTable.cpp diff --git a/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp b/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp index 6a3aa41b..e6a97dff 100644 --- a/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp +++ b/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp @@ -5,6 +5,7 @@ #include "stringtable2_register_facets.hpp" +#include #include #include @@ -23,6 +24,9 @@ namespace xo { { scope log(XO_DEBUG(true)); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); FacetRegistry::register_impl(); diff --git a/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp b/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp index fda90742..94afd40e 100644 --- a/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp +++ b/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp @@ -4,6 +4,7 @@ **/ #include "stringtable2_register_types.hpp" +#include "UniqueString.hpp" #include "String.hpp" //#include @@ -23,6 +24,7 @@ namespace xo { bool ok = true; + ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); return ok; diff --git a/xo-stringtable2/utest/CMakeLists.txt b/xo-stringtable2/utest/CMakeLists.txt index 1b0b9798..46f4a4e7 100644 --- a/xo-stringtable2/utest/CMakeLists.txt +++ b/xo-stringtable2/utest/CMakeLists.txt @@ -3,6 +3,7 @@ set(UTEST_EXE utest.stringtable2) set(UTEST_SRCS stringtable2_utest_main.cpp + StringTable.test.cpp DString.test.cpp StringOps.test.cpp ) diff --git a/xo-expression2/utest/StringTable.test.cpp b/xo-stringtable2/utest/StringTable.test.cpp similarity index 99% rename from xo-expression2/utest/StringTable.test.cpp rename to xo-stringtable2/utest/StringTable.test.cpp index 66163c22..c880df66 100644 --- a/xo-expression2/utest/StringTable.test.cpp +++ b/xo-stringtable2/utest/StringTable.test.cpp @@ -3,7 +3,7 @@ * @author Roland Conybeare, Jan 2026 **/ -#include +#include #include #include