From dc530ea9d80dfca33f3c7667dc3564cad3908d79 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Mar 2026 00:50:58 +1100 Subject: [PATCH] refactor: + xo-stringtable2 w/ DString impl --- CMakeLists.txt | 1 + .../xo/alloc2}/CollectorTypeRegistry.hpp | 0 xo-alloc2/src/alloc2/CMakeLists.txt | 5 +++ .../src/alloc2}/CollectorTypeRegistry.cpp | 9 ++-- .../src/alloc2}/ICollector_Any.cpp | 0 .../src/alloc2}/IGCObject_Any.cpp | 0 .../include/xo/expression2/DUniqueString.hpp | 2 +- .../src/expression2/init_expression2.cpp | 2 +- xo-expression2/utest/DApplyExpr.test.cpp | 8 ++-- xo-expression2/utest/DConstant.test.cpp | 6 +-- xo-expression2/utest/DDefineExpr.test.cpp | 8 ++-- xo-expression2/utest/DIfElseExpr.test.cpp | 8 ++-- xo-expression2/utest/DVariable.test.cpp | 6 +-- xo-expression2/utest/X1Collector.test.cpp | 10 ++--- xo-gc/src/gc/CMakeLists.txt | 5 --- .../src/interpreter2/init_interpreter2.cpp | 2 +- xo-object2/cmake/xo_object2Config.cmake.in | 1 + .../xo/object2/object2_register_facets.hpp | 2 - xo-object2/src/object2/CMakeLists.txt | 5 +-- xo-object2/src/object2/init_object2.cpp | 4 +- .../src/object2/object2_register_facets.cpp | 3 +- .../src/object2/object2_register_types.cpp | 2 - xo-object2/utest/CMakeLists.txt | 4 +- xo-object2/utest/Printable.test.cpp | 6 +-- xo-object2/utest/X1Collector.test.cpp | 2 +- .../DPrimitive_gco_3_dict_string_gco.hpp | 2 +- .../src/procedure2/init_procedure2.cpp | 2 +- .../include/xo/reader2/ParserResult.hpp | 2 +- xo-reader2/src/reader2/DExpectExprSsm.cpp | 4 +- xo-reader2/src/reader2/DToplevelSeqSsm.cpp | 16 +++---- xo-reader2/src/reader2/init_reader2.cpp | 2 +- xo-reader2/utest/SchematikaParser.test.cpp | 10 ++--- xo-stringtable2/CMakeLists.txt | 31 +++++++++++++ .../cmake/xo-bootstrap-macros.cmake | 41 ++++++++++++++++++ .../cmake/xo_stringtable2Config.cmake.in | 16 +++++++ .../idl/IGCObject_DString.json5 | 0 .../idl/IPrintable_DString.json5 | 0 .../include/xo/stringtable2/.gitkeep | 0 .../include/xo/stringtable2}/DString.hpp | 0 .../include/xo/stringtable2}/String.hpp | 0 .../include/xo/stringtable2}/StringOps.hpp | 0 .../xo/stringtable2/init_stringtable2.hpp | 21 +++++++++ .../string/IGCObject_DString.hpp | 0 .../string/IPrintable_DString.hpp | 0 .../stringtable2_register_facets.hpp | 15 +++++++ .../stringtable2_register_types.hpp | 17 ++++++++ .../src/stringtable2/CMakeLists.txt | 28 ++++++++++++ .../src/stringtable2}/DString.cpp | 0 .../src/stringtable2}/IGCObject_DString.cpp | 0 .../src/stringtable2}/IPrintable_DString.cpp | 0 .../src/stringtable2/init_stringtable2.cpp | 43 +++++++++++++++++++ .../stringtable2_register_facets.cpp | 36 ++++++++++++++++ .../stringtable2_register_types.cpp | 33 ++++++++++++++ xo-stringtable2/utest/CMakeLists.txt | 13 ++++++ .../utest/DString.test.cpp | 5 ++- .../utest/StringOps.test.cpp | 3 +- .../utest/stringtable2_utest_main.cpp | 24 +++++++++++ 57 files changed, 387 insertions(+), 78 deletions(-) rename {xo-gc/include/xo/gc => xo-alloc2/include/xo/alloc2}/CollectorTypeRegistry.hpp (100%) rename {xo-gc/src/gc => xo-alloc2/src/alloc2}/CollectorTypeRegistry.cpp (92%) rename {xo-gc/src/gc => xo-alloc2/src/alloc2}/ICollector_Any.cpp (100%) rename {xo-gc/src/gc => xo-alloc2/src/alloc2}/IGCObject_Any.cpp (100%) create mode 100644 xo-stringtable2/CMakeLists.txt create mode 100644 xo-stringtable2/cmake/xo-bootstrap-macros.cmake create mode 100644 xo-stringtable2/cmake/xo_stringtable2Config.cmake.in rename {xo-object2 => xo-stringtable2}/idl/IGCObject_DString.json5 (100%) rename {xo-object2 => xo-stringtable2}/idl/IPrintable_DString.json5 (100%) create mode 100644 xo-stringtable2/include/xo/stringtable2/.gitkeep rename {xo-object2/include/xo/object2 => xo-stringtable2/include/xo/stringtable2}/DString.hpp (100%) rename {xo-object2/include/xo/object2 => xo-stringtable2/include/xo/stringtable2}/String.hpp (100%) rename {xo-object2/include/xo/object2 => xo-stringtable2/include/xo/stringtable2}/StringOps.hpp (100%) create mode 100644 xo-stringtable2/include/xo/stringtable2/init_stringtable2.hpp rename {xo-object2/include/xo/object2 => xo-stringtable2/include/xo/stringtable2}/string/IGCObject_DString.hpp (100%) rename {xo-object2/include/xo/object2 => xo-stringtable2/include/xo/stringtable2}/string/IPrintable_DString.hpp (100%) create mode 100644 xo-stringtable2/include/xo/stringtable2/stringtable2_register_facets.hpp create mode 100644 xo-stringtable2/include/xo/stringtable2/stringtable2_register_types.hpp create mode 100644 xo-stringtable2/src/stringtable2/CMakeLists.txt rename {xo-object2/src/object2 => xo-stringtable2/src/stringtable2}/DString.cpp (100%) rename {xo-object2/src/object2 => xo-stringtable2/src/stringtable2}/IGCObject_DString.cpp (100%) rename {xo-object2/src/object2 => xo-stringtable2/src/stringtable2}/IPrintable_DString.cpp (100%) create mode 100644 xo-stringtable2/src/stringtable2/init_stringtable2.cpp create mode 100644 xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp create mode 100644 xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp create mode 100644 xo-stringtable2/utest/CMakeLists.txt rename {xo-object2 => xo-stringtable2}/utest/DString.test.cpp (99%) rename {xo-object2 => xo-stringtable2}/utest/StringOps.test.cpp (98%) create mode 100644 xo-stringtable2/utest/stringtable2_utest_main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e2f44f43..84d8b6cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ add_subdirectory(xo-callback) add_subdirectory(xo-printable2) # experiment w/ facet object model add_subdirectory(xo-alloc) add_subdirectory(xo-alloc2) # experiment w/ facet object model +add_subdirectory(xo-stringtable2) # experiment w/ facet object model add_subdirectory(xo-gc) # experiment w/ facet object model add_subdirectory(xo-object) add_subdirectory(xo-object2) # experiment w/ facet object model diff --git a/xo-gc/include/xo/gc/CollectorTypeRegistry.hpp b/xo-alloc2/include/xo/alloc2/CollectorTypeRegistry.hpp similarity index 100% rename from xo-gc/include/xo/gc/CollectorTypeRegistry.hpp rename to xo-alloc2/include/xo/alloc2/CollectorTypeRegistry.hpp diff --git a/xo-alloc2/src/alloc2/CMakeLists.txt b/xo-alloc2/src/alloc2/CMakeLists.txt index 29890c5f..00230b96 100644 --- a/xo-alloc2/src/alloc2/CMakeLists.txt +++ b/xo-alloc2/src/alloc2/CMakeLists.txt @@ -6,6 +6,11 @@ set(SELF_SRCS init_alloc2.cpp alloc2_register_facets.cpp + CollectorTypeRegistry.cpp + + ICollector_Any.cpp + IGCObject_Any.cpp + AAllocator.cpp IAllocator_Any.cpp IAllocator_DArena.cpp diff --git a/xo-gc/src/gc/CollectorTypeRegistry.cpp b/xo-alloc2/src/alloc2/CollectorTypeRegistry.cpp similarity index 92% rename from xo-gc/src/gc/CollectorTypeRegistry.cpp rename to xo-alloc2/src/alloc2/CollectorTypeRegistry.cpp index cb039dd8..98d45a86 100644 --- a/xo-gc/src/gc/CollectorTypeRegistry.cpp +++ b/xo-alloc2/src/alloc2/CollectorTypeRegistry.cpp @@ -7,21 +7,24 @@ namespace xo { namespace mm { CollectorTypeRegistry & - CollectorTypeRegistry::instance() { + CollectorTypeRegistry::instance() + { static CollectorTypeRegistry s_instance; return s_instance; } void - CollectorTypeRegistry::register_types(init_function_type fn) { + CollectorTypeRegistry::register_types(init_function_type fn) + { scope log(XO_DEBUG(true)); init_seq_v_.push_back(fn); } bool - CollectorTypeRegistry::install_types(obj gc) { + CollectorTypeRegistry::install_types(obj gc) + { scope log(XO_DEBUG(true)); bool ok = true; diff --git a/xo-gc/src/gc/ICollector_Any.cpp b/xo-alloc2/src/alloc2/ICollector_Any.cpp similarity index 100% rename from xo-gc/src/gc/ICollector_Any.cpp rename to xo-alloc2/src/alloc2/ICollector_Any.cpp diff --git a/xo-gc/src/gc/IGCObject_Any.cpp b/xo-alloc2/src/alloc2/IGCObject_Any.cpp similarity index 100% rename from xo-gc/src/gc/IGCObject_Any.cpp rename to xo-alloc2/src/alloc2/IGCObject_Any.cpp diff --git a/xo-expression2/include/xo/expression2/DUniqueString.hpp b/xo-expression2/include/xo/expression2/DUniqueString.hpp index e43624bd..9f56a9c9 100644 --- a/xo-expression2/include/xo/expression2/DUniqueString.hpp +++ b/xo-expression2/include/xo/expression2/DUniqueString.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/xo-expression2/src/expression2/init_expression2.cpp b/xo-expression2/src/expression2/init_expression2.cpp index 1ee5ec9e..0d107316 100644 --- a/xo-expression2/src/expression2/init_expression2.cpp +++ b/xo-expression2/src/expression2/init_expression2.cpp @@ -8,7 +8,7 @@ #include "expression2_register_types.hpp" #include -#include +#include namespace xo { using xo::scm::expression2_register_facets; diff --git a/xo-expression2/utest/DApplyExpr.test.cpp b/xo-expression2/utest/DApplyExpr.test.cpp index 1b922333..17b3dca6 100644 --- a/xo-expression2/utest/DApplyExpr.test.cpp +++ b/xo-expression2/utest/DApplyExpr.test.cpp @@ -20,10 +20,10 @@ #include #include -#include -#include -#include -#include +#include +#include +//#include +//#include #include #include diff --git a/xo-expression2/utest/DConstant.test.cpp b/xo-expression2/utest/DConstant.test.cpp index fd8e9b1b..a45d39d8 100644 --- a/xo-expression2/utest/DConstant.test.cpp +++ b/xo-expression2/utest/DConstant.test.cpp @@ -13,10 +13,8 @@ #include #include -#include -#include -#include -#include +#include +#include #include #include diff --git a/xo-expression2/utest/DDefineExpr.test.cpp b/xo-expression2/utest/DDefineExpr.test.cpp index 5f78891d..648af0f4 100644 --- a/xo-expression2/utest/DDefineExpr.test.cpp +++ b/xo-expression2/utest/DDefineExpr.test.cpp @@ -14,10 +14,10 @@ #include #include -#include -#include -#include -#include +#include +#include +//#include +//#include #include #include diff --git a/xo-expression2/utest/DIfElseExpr.test.cpp b/xo-expression2/utest/DIfElseExpr.test.cpp index 2dee2f26..4a7dcf70 100644 --- a/xo-expression2/utest/DIfElseExpr.test.cpp +++ b/xo-expression2/utest/DIfElseExpr.test.cpp @@ -15,10 +15,10 @@ #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 9c26a7c4..51e80a33 100644 --- a/xo-expression2/utest/DVariable.test.cpp +++ b/xo-expression2/utest/DVariable.test.cpp @@ -9,10 +9,8 @@ #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 b872d877..08fb5ca9 100644 --- a/xo-expression2/utest/X1Collector.test.cpp +++ b/xo-expression2/utest/X1Collector.test.cpp @@ -12,14 +12,10 @@ #include #include #include -#include - -#include -#include - -#include -#include +#include +#include +#include #include #include diff --git a/xo-gc/src/gc/CMakeLists.txt b/xo-gc/src/gc/CMakeLists.txt index 985592b0..6690932f 100644 --- a/xo-gc/src/gc/CMakeLists.txt +++ b/xo-gc/src/gc/CMakeLists.txt @@ -3,11 +3,6 @@ set(SELF_LIB xo_gc) set(SELF_SRCS - CollectorTypeRegistry.cpp - - ICollector_Any.cpp - IGCObject_Any.cpp - IAllocator_DX1Collector.cpp ICollector_DX1Collector.cpp IAllocIterator_DX1CollectorIterator.cpp diff --git a/xo-interpreter2/src/interpreter2/init_interpreter2.cpp b/xo-interpreter2/src/interpreter2/init_interpreter2.cpp index 07308863..73a6a5c2 100644 --- a/xo-interpreter2/src/interpreter2/init_interpreter2.cpp +++ b/xo-interpreter2/src/interpreter2/init_interpreter2.cpp @@ -9,7 +9,7 @@ #include "interpreter2_register_types.hpp" #include -#include +#include namespace xo { using xo::scm::interpreter2_register_facets; diff --git a/xo-object2/cmake/xo_object2Config.cmake.in b/xo-object2/cmake/xo_object2Config.cmake.in index 22772095..78ee9e0f 100644 --- a/xo-object2/cmake/xo_object2Config.cmake.in +++ b/xo-object2/cmake/xo_object2Config.cmake.in @@ -3,6 +3,7 @@ include(CMakeFindDependencyMacro) find_dependency(reflect) find_dependency(xo_gc) +find_dependency(xo_stringtable2) find_dependency(xo_printable2) find_dependency(subsys) find_dependency(indentlog) diff --git a/xo-object2/include/xo/object2/object2_register_facets.hpp b/xo-object2/include/xo/object2/object2_register_facets.hpp index 7f42d5a0..7fb75cc7 100644 --- a/xo-object2/include/xo/object2/object2_register_facets.hpp +++ b/xo-object2/include/xo/object2/object2_register_facets.hpp @@ -5,8 +5,6 @@ #pragma once -#include - namespace xo { namespace scm { /** Register object2 (facet,impl) combinations with FacetRegistry **/ diff --git a/xo-object2/src/object2/CMakeLists.txt b/xo-object2/src/object2/CMakeLists.txt index e9ae687a..f0aaefb7 100644 --- a/xo-object2/src/object2/CMakeLists.txt +++ b/xo-object2/src/object2/CMakeLists.txt @@ -33,10 +33,6 @@ set(SELF_SRCS IGCObject_DBoolean.cpp IPrintable_DBoolean.cpp - DString.cpp - IGCObject_DString.cpp - IPrintable_DString.cpp - DDictionary.cpp IGCObject_DDictionary.cpp IPrintable_DDictionary.cpp @@ -50,6 +46,7 @@ xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 $ # note: deps here must also appear in cmake/xo_object2Config.cmake.in xo_dependency(${SELF_LIB} reflect) xo_dependency(${SELF_LIB} xo_gc) +xo_dependency(${SELF_LIB} xo_stringtable2) xo_dependency(${SELF_LIB} xo_printable2) xo_dependency(${SELF_LIB} subsys) xo_dependency(${SELF_LIB} indentlog) diff --git a/xo-object2/src/object2/init_object2.cpp b/xo-object2/src/object2/init_object2.cpp index bcf7608c..7e4f6e4d 100644 --- a/xo-object2/src/object2/init_object2.cpp +++ b/xo-object2/src/object2/init_object2.cpp @@ -6,7 +6,8 @@ #include "init_object2.hpp" #include "object2_register_facets.hpp" #include "object2_register_types.hpp" -#include +#include +#include #include namespace xo { @@ -29,6 +30,7 @@ namespace xo { /* direct subsystem deps for xo-object2/ */ retval ^= InitSubsys::require(); + retval ^= InitSubsys::require(); /* xo-expression2/'s own initialization code */ retval ^= Subsystem::provide("object2", &init); diff --git a/xo-object2/src/object2/object2_register_facets.cpp b/xo-object2/src/object2/object2_register_facets.cpp index 0b127179..3710b1d7 100644 --- a/xo-object2/src/object2/object2_register_facets.cpp +++ b/xo-object2/src/object2/object2_register_facets.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -70,7 +70,6 @@ namespace xo { log && log(xtag("DBoolean.tseq", typeseq::id())); log && log(xtag("DFloat.tseq", typeseq::id())); log && log(xtag("DInteger.tseq", typeseq::id())); - log && log(xtag("DString.tseq", typeseq::id())); log && log(xtag("DArray.tseq", typeseq::id())); log && log(xtag("DDictionary.tseq", typeseq::id())); log && log(xtag("DRuntimeError.tseq", typeseq::id())); diff --git a/xo-object2/src/object2/object2_register_types.cpp b/xo-object2/src/object2/object2_register_types.cpp index 3e0d50d1..20ae3b8e 100644 --- a/xo-object2/src/object2/object2_register_types.cpp +++ b/xo-object2/src/object2/object2_register_types.cpp @@ -36,8 +36,6 @@ namespace xo { ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); diff --git a/xo-object2/utest/CMakeLists.txt b/xo-object2/utest/CMakeLists.txt index 573fefd6..7843e0e9 100644 --- a/xo-object2/utest/CMakeLists.txt +++ b/xo-object2/utest/CMakeLists.txt @@ -4,8 +4,8 @@ set(UTEST_EXE utest.object2) set(UTEST_SRCS object2_utest_main.cpp DArray.test.cpp - DString.test.cpp - StringOps.test.cpp +# DString.test.cpp +# StringOps.test.cpp X1Collector.test.cpp Printable.test.cpp ) diff --git a/xo-object2/utest/Printable.test.cpp b/xo-object2/utest/Printable.test.cpp index 2ca792fa..15de595d 100644 --- a/xo-object2/utest/Printable.test.cpp +++ b/xo-object2/utest/Printable.test.cpp @@ -12,9 +12,9 @@ #include #include -#include -#include -#include +#include +//#include +//#include #include #include diff --git a/xo-object2/utest/X1Collector.test.cpp b/xo-object2/utest/X1Collector.test.cpp index a2a2dec5..55e0107c 100644 --- a/xo-object2/utest/X1Collector.test.cpp +++ b/xo-object2/utest/X1Collector.test.cpp @@ -15,7 +15,7 @@ #include "number/IGCObject_DInteger.hpp" #include "list/IGCObject_DList.hpp" -#include +#include #include #include diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp index 29f18b23..f566fee2 100644 --- a/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp +++ b/xo-procedure2/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include #include "DPrimitive.hpp" diff --git a/xo-procedure2/src/procedure2/init_procedure2.cpp b/xo-procedure2/src/procedure2/init_procedure2.cpp index aaa6a021..bc7e53ab 100644 --- a/xo-procedure2/src/procedure2/init_procedure2.cpp +++ b/xo-procedure2/src/procedure2/init_procedure2.cpp @@ -9,7 +9,7 @@ #include "procedure2_register_types.hpp" #include -#include +#include namespace xo { using xo::scm::procedure2_register_facets; diff --git a/xo-reader2/include/xo/reader2/ParserResult.hpp b/xo-reader2/include/xo/reader2/ParserResult.hpp index 492b78b0..9cdf1424 100644 --- a/xo-reader2/include/xo/reader2/ParserResult.hpp +++ b/xo-reader2/include/xo/reader2/ParserResult.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include #include diff --git a/xo-reader2/src/reader2/DExpectExprSsm.cpp b/xo-reader2/src/reader2/DExpectExprSsm.cpp index aef5c7a4..40ed2476 100644 --- a/xo-reader2/src/reader2/DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/DExpectExprSsm.cpp @@ -18,15 +18,13 @@ #include #include #include -#include +#include #include #include #ifdef NOT_YET #include "define_xs.hpp" #include "paren_xs.hpp" -#include "sequence_xs.hpp" -#include "progress_xs.hpp" #endif namespace xo { diff --git a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp index 493c745e..d7444e43 100644 --- a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp +++ b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp @@ -17,17 +17,17 @@ #include //#include -#include -#include +#include +//#include -#include -#include +#include +//#include -#include -#include +#include +//#include -#include -#include +#include +//#include #include diff --git a/xo-reader2/src/reader2/init_reader2.cpp b/xo-reader2/src/reader2/init_reader2.cpp index a6e1a7b0..df0de7c0 100644 --- a/xo-reader2/src/reader2/init_reader2.cpp +++ b/xo-reader2/src/reader2/init_reader2.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include namespace xo { using xo::scm::reader2_register_facets; diff --git a/xo-reader2/utest/SchematikaParser.test.cpp b/xo-reader2/utest/SchematikaParser.test.cpp index 0404a800..c299306f 100644 --- a/xo-reader2/utest/SchematikaParser.test.cpp +++ b/xo-reader2/utest/SchematikaParser.test.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -25,10 +25,10 @@ namespace xo { using xo::scm::ParserConfig; using xo::scm::SchematikaParser; - using xo::scm::ASyntaxStateMachine; - using xo::scm::syntaxstatetype; +// using xo::scm::ASyntaxStateMachine; +// using xo::scm::syntaxstatetype; // using xo::scm::DDefineSsm; - using xo::scm::DExpectExprSsm; +// using xo::scm::DExpectExprSsm; using xo::scm::AExpression; using xo::scm::DDefineExpr; @@ -51,7 +51,7 @@ namespace xo { using xo::mm::AAllocator; using xo::mm::DArena; using xo::mm::MemorySizeInfo; - using xo::facet::with_facet; +// using xo::facet::with_facet; static InitEvidence s_init = (InitSubsys::require()); diff --git a/xo-stringtable2/CMakeLists.txt b/xo-stringtable2/CMakeLists.txt new file mode 100644 index 00000000..40f375b6 --- /dev/null +++ b/xo-stringtable2/CMakeLists.txt @@ -0,0 +1,31 @@ +# xo-stringtable2/CMakeLists.txt + +cmake_minimum_required(VERSION 3.10) + +project(xo_stringtable2 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 + +add_subdirectory(src/stringtable2) +add_subdirectory(utest) + +# ---------------------------------------------------------------- +# cmake export + +xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) + +# end CMakeLists.txt diff --git a/xo-stringtable2/cmake/xo-bootstrap-macros.cmake b/xo-stringtable2/cmake/xo-bootstrap-macros.cmake new file mode 100644 index 00000000..592272c0 --- /dev/null +++ b/xo-stringtable2/cmake/xo-bootstrap-macros.cmake @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------- +# for example: +# $ PREFIX=/usr/local # for example +# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build +# +# will get +# CMAKE_MODULE_PATH +# from xo-cmake-config --cmake-module-path +# +# and expect .cmake macros in +# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake +# ---------------------------------------------------------------- + +find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED) + +if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND") + message(FATAL "could not find xo-cmake-config executable") +endif() + +message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") + +if (XO_SUBMODULE_BUILD) + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # local version of xo-cmake macros + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/xo-cmake/cmake") + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +else() + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # default to typical install location for xo-project-macros + execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH) + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +endif() + +# needs to have been installed somewhere on CMAKE_MODULE_PATH, +# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX) +# +include(xo_macros/xo_cxx) + +xo_cxx_bootstrap_message() diff --git a/xo-stringtable2/cmake/xo_stringtable2Config.cmake.in b/xo-stringtable2/cmake/xo_stringtable2Config.cmake.in new file mode 100644 index 00000000..0a084ae9 --- /dev/null +++ b/xo-stringtable2/cmake/xo_stringtable2Config.cmake.in @@ -0,0 +1,16 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +# note: changes to find_dependency() calls here +# must coordinate with xo_dependency() calls +# in CMakeLists.txt +# +find_dependency(xo_alloc2) +find_dependency(xo_printable2) +find_dependency(subsys) +find_dependency(indentlog) + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/xo-object2/idl/IGCObject_DString.json5 b/xo-stringtable2/idl/IGCObject_DString.json5 similarity index 100% rename from xo-object2/idl/IGCObject_DString.json5 rename to xo-stringtable2/idl/IGCObject_DString.json5 diff --git a/xo-object2/idl/IPrintable_DString.json5 b/xo-stringtable2/idl/IPrintable_DString.json5 similarity index 100% rename from xo-object2/idl/IPrintable_DString.json5 rename to xo-stringtable2/idl/IPrintable_DString.json5 diff --git a/xo-stringtable2/include/xo/stringtable2/.gitkeep b/xo-stringtable2/include/xo/stringtable2/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/xo-object2/include/xo/object2/DString.hpp b/xo-stringtable2/include/xo/stringtable2/DString.hpp similarity index 100% rename from xo-object2/include/xo/object2/DString.hpp rename to xo-stringtable2/include/xo/stringtable2/DString.hpp diff --git a/xo-object2/include/xo/object2/String.hpp b/xo-stringtable2/include/xo/stringtable2/String.hpp similarity index 100% rename from xo-object2/include/xo/object2/String.hpp rename to xo-stringtable2/include/xo/stringtable2/String.hpp diff --git a/xo-object2/include/xo/object2/StringOps.hpp b/xo-stringtable2/include/xo/stringtable2/StringOps.hpp similarity index 100% rename from xo-object2/include/xo/object2/StringOps.hpp rename to xo-stringtable2/include/xo/stringtable2/StringOps.hpp diff --git a/xo-stringtable2/include/xo/stringtable2/init_stringtable2.hpp b/xo-stringtable2/include/xo/stringtable2/init_stringtable2.hpp new file mode 100644 index 00000000..4a48ceb1 --- /dev/null +++ b/xo-stringtable2/include/xo/stringtable2/init_stringtable2.hpp @@ -0,0 +1,21 @@ +/** @file init_stringtable2.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-expression2/ subsystem within ordered initialization */ + enum S_stringtable2_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; +} /*namespace xo*/ + +/* end init_stringtable2.hpp */ diff --git a/xo-object2/include/xo/object2/string/IGCObject_DString.hpp b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp similarity index 100% rename from xo-object2/include/xo/object2/string/IGCObject_DString.hpp rename to xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp diff --git a/xo-object2/include/xo/object2/string/IPrintable_DString.hpp b/xo-stringtable2/include/xo/stringtable2/string/IPrintable_DString.hpp similarity index 100% rename from xo-object2/include/xo/object2/string/IPrintable_DString.hpp rename to xo-stringtable2/include/xo/stringtable2/string/IPrintable_DString.hpp diff --git a/xo-stringtable2/include/xo/stringtable2/stringtable2_register_facets.hpp b/xo-stringtable2/include/xo/stringtable2/stringtable2_register_facets.hpp new file mode 100644 index 00000000..36f66106 --- /dev/null +++ b/xo-stringtable2/include/xo/stringtable2/stringtable2_register_facets.hpp @@ -0,0 +1,15 @@ +/** @file stringtable2_register_facets.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +namespace xo { + namespace scm { + /** Register object2 (facet,impl) combinations with FacetRegistry **/ + bool stringtable2_register_facets(); + } +} + +/* end stringtable2_register_facets.hpp */ diff --git a/xo-stringtable2/include/xo/stringtable2/stringtable2_register_types.hpp b/xo-stringtable2/include/xo/stringtable2/stringtable2_register_types.hpp new file mode 100644 index 00000000..724d2478 --- /dev/null +++ b/xo-stringtable2/include/xo/stringtable2/stringtable2_register_types.hpp @@ -0,0 +1,17 @@ +/** @file stringtable2_register_types.hpp + * + * @author Roland Conybeare, Dec 2025 + **/ + +#pragma once + +#include + +namespace xo { + namespace scm { + /** Register stringtable2 (facet,impl) combinations with FacetRegistry **/ + bool stringtable2_register_types(obj gc); + } +} + +/* end stringtable2_register_types.hpp */ diff --git a/xo-stringtable2/src/stringtable2/CMakeLists.txt b/xo-stringtable2/src/stringtable2/CMakeLists.txt new file mode 100644 index 00000000..5874217a --- /dev/null +++ b/xo-stringtable2/src/stringtable2/CMakeLists.txt @@ -0,0 +1,28 @@ +# xo-stringtable2/src/stringtable2/CMakeLists.txt + +set(SELF_LIB xo_stringtable2) +set(SELF_SRCS + init_stringtable2.cpp + stringtable2_register_facets.cpp + stringtable2_register_types.cpp + + DString.cpp + IGCObject_DString.cpp + IPrintable_DString.cpp +) + +xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) +xo_install_include_tree3(include/xo/stringtable2) + +# ---------------------------------------------------------------- +# input dependencies +# +# NOTE: dependency set here must be kept consistent with +# xo-stringtable2/cmake/xo_stringtable2Config.cmake.in + +xo_dependency(${SELF_LIB} xo_alloc2) +xo_dependency(${SELF_LIB} xo_printable2) +xo_dependency(${SELF_LIB} subsys) +xo_dependency(${SELF_LIB} indentlog) + +# end src/stringtable2/CMakeLists.txt diff --git a/xo-object2/src/object2/DString.cpp b/xo-stringtable2/src/stringtable2/DString.cpp similarity index 100% rename from xo-object2/src/object2/DString.cpp rename to xo-stringtable2/src/stringtable2/DString.cpp diff --git a/xo-object2/src/object2/IGCObject_DString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp similarity index 100% rename from xo-object2/src/object2/IGCObject_DString.cpp rename to xo-stringtable2/src/stringtable2/IGCObject_DString.cpp diff --git a/xo-object2/src/object2/IPrintable_DString.cpp b/xo-stringtable2/src/stringtable2/IPrintable_DString.cpp similarity index 100% rename from xo-object2/src/object2/IPrintable_DString.cpp rename to xo-stringtable2/src/stringtable2/IPrintable_DString.cpp diff --git a/xo-stringtable2/src/stringtable2/init_stringtable2.cpp b/xo-stringtable2/src/stringtable2/init_stringtable2.cpp new file mode 100644 index 00000000..26d84abe --- /dev/null +++ b/xo-stringtable2/src/stringtable2/init_stringtable2.cpp @@ -0,0 +1,43 @@ +/** @file init_stringtable2.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "init_stringtable2.hpp" +#include "stringtable2_register_facets.hpp" +#include "stringtable2_register_types.hpp" +#include +//n#include +#include +#include + +namespace xo { + using xo::scm::stringtable2_register_facets; + using xo::scm::stringtable2_register_types; + using xo::mm::CollectorTypeRegistry; + + void + InitSubsys::init() + { + stringtable2_register_facets(); + + CollectorTypeRegistry::instance().register_types(&stringtable2_register_types); + } + + InitEvidence + InitSubsys::require() + { + InitEvidence retval; + + /* direct subsystem deps for xo-stringtable2/ */ + retval ^= InitSubsys::require(); + //retval ^= InitSubsys::require(); + + /* xo-expression2/'s own initialization code */ + retval ^= Subsystem::provide("stringtable2", &init); + + return retval; + } +} /*namespace xo*/ + +/* end init_stringtable2.cpp */ diff --git a/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp b/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp new file mode 100644 index 00000000..6a3aa41b --- /dev/null +++ b/xo-stringtable2/src/stringtable2/stringtable2_register_facets.cpp @@ -0,0 +1,36 @@ +/** @file stringtable2_register_facets.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "stringtable2_register_facets.hpp" + +#include + +#include +#include + +namespace xo { + using xo::print::APrintable; + using xo::mm::AGCObject; + using xo::scm::DString; + using xo::facet::FacetRegistry; + using xo::facet::typeseq; + + namespace scm { + bool + stringtable2_register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + log && log(xtag("DString.tseq", typeseq::id())); + + return true; + } + } /*namespace scm*/ +} /*namespace xo*/ + +/* end stringtable2_register_facets.cpp */ diff --git a/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp b/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp new file mode 100644 index 00000000..fda90742 --- /dev/null +++ b/xo-stringtable2/src/stringtable2/stringtable2_register_types.cpp @@ -0,0 +1,33 @@ +/** @file stringtable2_register_types.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "stringtable2_register_types.hpp" +#include "String.hpp" + +//#include +#include + +namespace xo { + using xo::mm::ACollector; + using xo::mm::AGCObject; + using xo::facet::impl_for; + using xo::scope; + + namespace scm { + bool + stringtable2_register_types(obj gc) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + ok &= gc.install_type(impl_for()); + + return ok; + } + } +} /*namespace xo*/ + +/* end stringtable2_register_types.cpp */ diff --git a/xo-stringtable2/utest/CMakeLists.txt b/xo-stringtable2/utest/CMakeLists.txt new file mode 100644 index 00000000..1b0b9798 --- /dev/null +++ b/xo-stringtable2/utest/CMakeLists.txt @@ -0,0 +1,13 @@ +# built unittest xo-object2/utest + +set(UTEST_EXE utest.stringtable2) +set(UTEST_SRCS + stringtable2_utest_main.cpp + DString.test.cpp + StringOps.test.cpp +) + +xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS}) +xo_self_dependency(${UTEST_EXE} xo_stringtable2) +#xo_dependency(${UTEST_EXE} randomgen) +xo_external_target_dependency(${UTEST_EXE} Catch2 Catch2::Catch2) diff --git a/xo-object2/utest/DString.test.cpp b/xo-stringtable2/utest/DString.test.cpp similarity index 99% rename from xo-object2/utest/DString.test.cpp rename to xo-stringtable2/utest/DString.test.cpp index 53db8e7f..9a7e1168 100644 --- a/xo-object2/utest/DString.test.cpp +++ b/xo-stringtable2/utest/DString.test.cpp @@ -3,7 +3,7 @@ * @author Roland Conybeare, Jan 2026 **/ -#include "init_object2.hpp" +#include "init_stringtable2.hpp" #include "StringOps.hpp" #include #include @@ -21,7 +21,8 @@ namespace xo { using xo::facet::obj; namespace ut { - static InitEvidence s_init = (InitSubsys::require()); + + static InitEvidence s_init = (InitSubsys::require()); TEST_CASE("DString-init", "[object2][DString]") { diff --git a/xo-object2/utest/StringOps.test.cpp b/xo-stringtable2/utest/StringOps.test.cpp similarity index 98% rename from xo-object2/utest/StringOps.test.cpp rename to xo-stringtable2/utest/StringOps.test.cpp index 26464f90..ac9cee81 100644 --- a/xo-object2/utest/StringOps.test.cpp +++ b/xo-stringtable2/utest/StringOps.test.cpp @@ -3,7 +3,7 @@ * @author Roland Conybeare, Jan 2026 **/ -#include +#include #include #include #include @@ -19,6 +19,7 @@ namespace xo { using xo::facet::obj; namespace ut { + TEST_CASE("StringOps-empty", "[object2][StringOps]") { ArenaConfig cfg { .name_ = "testarena", diff --git a/xo-stringtable2/utest/stringtable2_utest_main.cpp b/xo-stringtable2/utest/stringtable2_utest_main.cpp new file mode 100644 index 00000000..206c1067 --- /dev/null +++ b/xo-stringtable2/utest/stringtable2_utest_main.cpp @@ -0,0 +1,24 @@ +/* file stringtable2_utest_main.cpp */ + +#include + +#define CATCH_CONFIG_RUNNER +#include "catch2/catch.hpp" + +int +main(int argc, char* argv[]) +{ + using xo::Subsystem; + + // Your custom initialization code here + Subsystem::initialize_all(); + + // Run Catch2's test session + int result = Catch::Session().run(argc, argv); + + // cleanup here, if any + + return result; +} + +/* end stringtable2_utest_main.cpp */