refactor: + xo-stringtable2 w/ DString impl
This commit is contained in:
parent
133f1d212d
commit
dc530ea9d8
57 changed files with 387 additions and 78 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<ACollector> gc) {
|
||||
CollectorTypeRegistry::install_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <xo/object2/DString.hpp>
|
||||
#include <xo/stringtable2/DString.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "expression2_register_types.hpp"
|
||||
|
||||
#include <xo/procedure2/init_procedure2.hpp>
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::expression2_register_facets;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
//#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
//#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
|
|||
|
|
@ -13,10 +13,8 @@
|
|||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
//#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
//#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
#include <xo/object2/boolean/IGCObject_DBoolean.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
//#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
//#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
|
|||
|
|
@ -9,10 +9,8 @@
|
|||
#include <xo/expression2/detail/IPrintable_DVariable.hpp>
|
||||
#include <xo/expression2/StringTable.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
|
|||
|
|
@ -12,14 +12,10 @@
|
|||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/DList.hpp>
|
||||
#include <xo/object2/DString.hpp>
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
|
||||
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
|
||||
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
|
||||
#include <xo/stringtable2/DString.hpp>
|
||||
|
||||
#include <xo/gc/X1Collector.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "interpreter2_register_types.hpp"
|
||||
|
||||
#include <xo/reader2/init_reader2.hpp>
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::interpreter2_register_facets;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register object2 (facet,impl) combinations with FacetRegistry **/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
#include "init_object2.hpp"
|
||||
#include "object2_register_facets.hpp"
|
||||
#include "object2_register_types.hpp"
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/stringtable2/init_stringtable2.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/init_alloc2.hpp>
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -29,6 +30,7 @@ namespace xo {
|
|||
|
||||
/* direct subsystem deps for xo-object2/ */
|
||||
retval ^= InitSubsys<S_alloc2_tag>::require();
|
||||
retval ^= InitSubsys<S_stringtable2_tag>::require();
|
||||
|
||||
/* xo-expression2/'s own initialization code */
|
||||
retval ^= Subsystem::provide<S_object2_tag>("object2", &init);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <xo/object2/Boolean.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/object2/Float.hpp>
|
||||
#include <xo/object2/String.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
|
||||
#include <xo/printable2/detail/APrintable.hpp>
|
||||
#include <xo/alloc2/alloc/AAllocator.hpp>
|
||||
|
|
@ -70,7 +70,6 @@ namespace xo {
|
|||
log && log(xtag("DBoolean.tseq", typeseq::id<DBoolean>()));
|
||||
log && log(xtag("DFloat.tseq", typeseq::id<DFloat>()));
|
||||
log && log(xtag("DInteger.tseq", typeseq::id<DInteger>()));
|
||||
log && log(xtag("DString.tseq", typeseq::id<DString>()));
|
||||
log && log(xtag("DArray.tseq", typeseq::id<DArray>()));
|
||||
log && log(xtag("DDictionary.tseq", typeseq::id<DDictionary>()));
|
||||
log && log(xtag("DRuntimeError.tseq", typeseq::id<DRuntimeError>()));
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ namespace xo {
|
|||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DInteger>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DString>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DList>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DArray>());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
#include <xo/object2/list/IGCObject_DList.hpp>
|
||||
#include <xo/object2/list/IPrintable_DList.hpp>
|
||||
|
||||
#include <xo/object2/DString.hpp>
|
||||
#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
#include <xo/object2/string/IPrintable_DString.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
//#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
//#include <xo/object2/string/IPrintable_DString.hpp>
|
||||
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "number/IGCObject_DInteger.hpp"
|
||||
#include "list/IGCObject_DList.hpp"
|
||||
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/gc/DX1Collector.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <xo/object2/Dictionary.hpp>
|
||||
#include <xo/object2/String.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include "DPrimitive.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "procedure2_register_types.hpp"
|
||||
|
||||
#include <xo/object2/init_object2.hpp>
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::procedure2_register_facets;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <xo/expression2/Expression.hpp>
|
||||
#include <xo/object2/DString.hpp>
|
||||
#include <xo/stringtable2/DString.hpp>
|
||||
#include <xo/indentlog/print/pretty.hpp>
|
||||
#include <string_view>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,15 +18,13 @@
|
|||
#include <xo/object2/Boolean.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/object2/Float.hpp>
|
||||
#include <xo/object2/String.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
|
||||
#ifdef NOT_YET
|
||||
#include "define_xs.hpp"
|
||||
#include "paren_xs.hpp"
|
||||
#include "sequence_xs.hpp"
|
||||
#include "progress_xs.hpp"
|
||||
#endif
|
||||
|
||||
namespace xo {
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@
|
|||
#include <xo/expression2/Constant.hpp>
|
||||
//#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||
|
||||
#include <xo/object2/DString.hpp>
|
||||
#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
//#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
|
||||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
#include <xo/object2/Float.hpp>
|
||||
//#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
//#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
|
||||
#include <xo/object2/DBoolean.hpp>
|
||||
#include <xo/object2/boolean/IGCObject_DBoolean.hpp>
|
||||
#include <xo/object2/Boolean.hpp>
|
||||
//#include <xo/object2/boolean/IGCObject_DBoolean.hpp>
|
||||
|
||||
#include <xo/alloc2/GCObject.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <xo/expression2/init_expression2.hpp>
|
||||
#include <xo/numeric/init_numeric.hpp>
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::reader2_register_facets;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include <xo/procedure2/Primitive_gco_2_gco_gco.hpp>
|
||||
#include <xo/object2/Float.hpp>
|
||||
#include <xo/object2/Integer.hpp>
|
||||
#include <xo/object2/String.hpp>
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
|
||||
#include <xo/facet/TypeRegistry.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
|
@ -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<S_reader2_tag>::require());
|
||||
|
||||
|
|
|
|||
31
xo-stringtable2/CMakeLists.txt
Normal file
31
xo-stringtable2/CMakeLists.txt
Normal file
|
|
@ -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
|
||||
41
xo-stringtable2/cmake/xo-bootstrap-macros.cmake
Normal file
41
xo-stringtable2/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()
|
||||
16
xo-stringtable2/cmake/xo_stringtable2Config.cmake.in
Normal file
16
xo-stringtable2/cmake/xo_stringtable2Config.cmake.in
Normal file
|
|
@ -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@")
|
||||
0
xo-stringtable2/include/xo/stringtable2/.gitkeep
Normal file
0
xo-stringtable2/include/xo/stringtable2/.gitkeep
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file init_stringtable2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
namespace xo {
|
||||
/* tag to represent the xo-expression2/ subsystem within ordered initialization */
|
||||
enum S_stringtable2_tag {};
|
||||
|
||||
template <>
|
||||
struct InitSubsys<S_stringtable2_tag> {
|
||||
static void init();
|
||||
static InitEvidence require();
|
||||
};
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_stringtable2.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 */
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/** @file stringtable2_register_types.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register stringtable2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool stringtable2_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
/* end stringtable2_register_types.hpp */
|
||||
28
xo-stringtable2/src/stringtable2/CMakeLists.txt
Normal file
28
xo-stringtable2/src/stringtable2/CMakeLists.txt
Normal file
|
|
@ -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
|
||||
43
xo-stringtable2/src/stringtable2/init_stringtable2.cpp
Normal file
43
xo-stringtable2/src/stringtable2/init_stringtable2.cpp
Normal file
|
|
@ -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 <xo/stringtable2/init_stringtable2.hpp>
|
||||
//n#include <xo/printable2/init_printable2.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/init_alloc2.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::stringtable2_register_facets;
|
||||
using xo::scm::stringtable2_register_types;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_stringtable2_tag>::init()
|
||||
{
|
||||
stringtable2_register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&stringtable2_register_types);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
InitSubsys<S_stringtable2_tag>::require()
|
||||
{
|
||||
InitEvidence retval;
|
||||
|
||||
/* direct subsystem deps for xo-stringtable2/ */
|
||||
retval ^= InitSubsys<S_alloc2_tag>::require();
|
||||
//retval ^= InitSubsys<S_printable_tag>::require();
|
||||
|
||||
/* xo-expression2/'s own initialization code */
|
||||
retval ^= Subsystem::provide<S_stringtable2_tag>("stringtable2", &init);
|
||||
|
||||
return retval;
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_stringtable2.cpp */
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/** @file stringtable2_register_facets.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "stringtable2_register_facets.hpp"
|
||||
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
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<AGCObject, DString>();
|
||||
FacetRegistry::register_impl<APrintable, DString>();
|
||||
|
||||
log && log(xtag("DString.tseq", typeseq::id<DString>()));
|
||||
|
||||
return true;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end stringtable2_register_facets.cpp */
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/** @file stringtable2_register_types.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "stringtable2_register_types.hpp"
|
||||
#include "String.hpp"
|
||||
|
||||
//#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
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<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DString>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end stringtable2_register_types.cpp */
|
||||
13
xo-stringtable2/utest/CMakeLists.txt
Normal file
13
xo-stringtable2/utest/CMakeLists.txt
Normal file
|
|
@ -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)
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "init_object2.hpp"
|
||||
#include "init_stringtable2.hpp"
|
||||
#include "StringOps.hpp"
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
|
||||
|
|
@ -21,7 +21,8 @@ namespace xo {
|
|||
using xo::facet::obj;
|
||||
|
||||
namespace ut {
|
||||
static InitEvidence s_init = (InitSubsys<S_object2_tag>::require());
|
||||
|
||||
static InitEvidence s_init = (InitSubsys<S_stringtable2_tag>::require());
|
||||
|
||||
TEST_CASE("DString-init", "[object2][DString]")
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include <xo/object2/StringOps.hpp>
|
||||
#include <xo/stringtable2/StringOps.hpp>
|
||||
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <cstring>
|
||||
|
|
@ -19,6 +19,7 @@ namespace xo {
|
|||
using xo::facet::obj;
|
||||
|
||||
namespace ut {
|
||||
|
||||
TEST_CASE("StringOps-empty", "[object2][StringOps]")
|
||||
{
|
||||
ArenaConfig cfg { .name_ = "testarena",
|
||||
24
xo-stringtable2/utest/stringtable2_utest_main.cpp
Normal file
24
xo-stringtable2/utest/stringtable2_utest_main.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* file stringtable2_utest_main.cpp */
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
#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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue