xo-reader2: + init_reader2 + reader2_register_types
This commit is contained in:
parent
3198e30234
commit
a96196b365
5 changed files with 111 additions and 3 deletions
21
include/xo/reader2/init_reader2.hpp
Normal file
21
include/xo/reader2/init_reader2.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file init_reader2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
namespace xo {
|
||||
/* tag to represent the xo-reader2/ subsystem within ordered initialization */
|
||||
enum S_reader2_tag {};
|
||||
|
||||
template <>
|
||||
struct InitSubsys<S_reader2_tag> {
|
||||
static void init();
|
||||
static InitEvidence require();
|
||||
};
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_reader2.hpp */
|
||||
17
include/xo/reader2/reader2_register_types.hpp
Normal file
17
include/xo/reader2/reader2_register_types.hpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/** @file reader2_register_types.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/gc/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register reader2 gc-aware types with collector **/
|
||||
bool reader2_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
/* end reader2_register_types.hpp */
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set(SELF_LIB xo_reader2)
|
||||
set(SELF_SRCS
|
||||
#init_reader2.cpp
|
||||
init_reader2.cpp
|
||||
|
||||
ParserStateMachine.cpp
|
||||
ParserStack.cpp
|
||||
|
|
@ -14,7 +14,7 @@ set(SELF_SRCS
|
|||
ISyntaxStateMachine_DExprSeqState.cpp
|
||||
|
||||
reader2_register_facets.cpp
|
||||
#reader2_register_types.cpp
|
||||
reader2_register_types.cpp
|
||||
)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
|
|
@ -26,5 +26,5 @@ xo_dependency(${SELF_LIB} xo_expression2)
|
|||
#xo_dependency(${SELF_LIB} xo_object2)
|
||||
#xo_dependency(${SELF_LIB} xo_printable2)
|
||||
#xo_dependency(${SELF_LIB} xo_flatstring)
|
||||
#xo_dependency(${SELF_LIB} subsys)
|
||||
xo_dependency(${SELF_LIB} subsys)
|
||||
#xo_dependency(${SELF_LIB} indentlog)
|
||||
|
|
|
|||
41
src/reader2/init_reader2.cpp
Normal file
41
src/reader2/init_reader2.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/** @file init_reader2.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "init_reader2.hpp"
|
||||
#include "reader2_register_facets.hpp"
|
||||
#include "reader2_register_types.hpp"
|
||||
|
||||
#include <xo/expression2/init_expression2.hpp>
|
||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::reader2_register_facets;
|
||||
using xo::scm::reader2_register_types;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_reader2_tag>::init()
|
||||
{
|
||||
reader2_register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&reader2_register_types);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
InitSubsys<S_reader2_tag>::require()
|
||||
{
|
||||
InitEvidence retval;
|
||||
|
||||
/* direct subsystem deps for xo-reader2/ */
|
||||
retval ^= InitSubsys<S_expression2_tag>::require();
|
||||
|
||||
/* xo-reader2/'s own initialization code */
|
||||
retval ^= Subsystem::provide<S_reader2_tag>("reader2", &init);
|
||||
|
||||
return retval;
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_reader2.cpp */
|
||||
29
src/reader2/reader2_register_types.cpp
Normal file
29
src/reader2/reader2_register_types.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/** @file reader2_register_types.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "reader2_register_types.hpp"
|
||||
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::ACollector;
|
||||
using xo::scope;
|
||||
|
||||
namespace scm {
|
||||
bool
|
||||
reader2_register_types(obj<ACollector> /*gc*/)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
/* no gc-aware types yet; scaffold for future use */
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end reader2_register_types.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue