xo-expression2: streamline setup
This commit is contained in:
parent
1075e16668
commit
ba19c627e5
7 changed files with 58 additions and 93 deletions
25
include/xo/expression2/SetupExpression2.hpp
Normal file
25
include/xo/expression2/SetupExpression2.hpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/** @file SetupExpression2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
class SetupExpression2 {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
|
||||
public:
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
static bool register_facets();
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
static bool register_types(obj<ACollector> gc);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* end SetupExpression2.hpp */
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/** @file expression2_register_facets.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool expression2_register_facets();
|
||||
}
|
||||
}
|
||||
|
||||
/* end expression2_register_facets.hpp */
|
||||
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool expression2_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
set(SELF_LIB xo_expression2)
|
||||
set(SELF_SRCS
|
||||
init_expression2.cpp
|
||||
expression2_register_facets.cpp
|
||||
expression2_register_types.cpp
|
||||
SetupExpression2.cpp
|
||||
|
||||
DConstant.cpp
|
||||
DVariable.cpp
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
/** @file expression2_register_facets.cpp
|
||||
/** @file SetupExpression2.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "expression2_register_facets.hpp"
|
||||
|
||||
//#include <xo/expression2/detail/IExpression_DVariable.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DVariable.hpp>
|
||||
//#include <xo/expression2/detail/IPrintable_DVariable.hpp>
|
||||
#include "SetupExpression2.hpp"
|
||||
|
||||
#include <xo/expression2/DefineExpr.hpp>
|
||||
#include <xo/expression2/Variable.hpp>
|
||||
|
|
@ -17,8 +13,8 @@
|
|||
#include <xo/expression2/ApplyExpr.hpp>
|
||||
#include <xo/expression2/LambdaExpr.hpp>
|
||||
#include <xo/expression2/IfElseExpr.hpp>
|
||||
#include <xo/expression2/SequenceExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DSequenceExpr.hpp>
|
||||
#include <xo/expression2/detail/IGCObject_DSequenceExpr.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DSequenceExpr.hpp>
|
||||
|
||||
|
|
@ -36,10 +32,11 @@ namespace xo {
|
|||
using xo::facet::FacetRegistry;
|
||||
using xo::facet::TypeRegistry;
|
||||
using xo::facet::typeseq;
|
||||
using xo::facet::impl_for;
|
||||
|
||||
namespace scm {
|
||||
bool
|
||||
expression2_register_facets()
|
||||
SetupExpression2::register_facets()
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
|
|
@ -126,7 +123,28 @@ namespace xo {
|
|||
|
||||
return true;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
|
||||
bool
|
||||
SetupExpression2::register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DConstant>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DVariable>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DTypename>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DDefineExpr>());
|
||||
//ok &= gc.install_type(impl_for<AGCObject, DApplyExpr>()); // when avail
|
||||
ok &= gc.install_type(impl_for<AGCObject, DLambdaExpr>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DIfElseExpr>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DSequenceExpr>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DLocalSymtab>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DGlobalSymtab>());
|
||||
|
||||
return ok;
|
||||
} } /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end expression2_register_facets.cpp */
|
||||
/* end SetupExpression2.cpp */
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/** @file expression2_register_types.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "expression2_register_types.hpp"
|
||||
|
||||
#include "DefineExpr.hpp"
|
||||
#include "Constant.hpp"
|
||||
#include "Variable.hpp"
|
||||
#include "Typename.hpp"
|
||||
//#include "detail/IGCObject_DDefineExpr.hpp" // when avail
|
||||
//#include "detail/IGCObject_DApplyExpr.hpp" // when avail
|
||||
#include "LambdaExpr.hpp"
|
||||
#include "IfElseExpr.hpp"
|
||||
#include "SequenceExpr.hpp"
|
||||
#include "LocalSymtab.hpp"
|
||||
#include "GlobalSymtab.hpp"
|
||||
//#include "detail/IGCObject_DLocalSymtab.hpp" // when avail
|
||||
//#include "detail/IGCObject_DUniqueString.hpp"
|
||||
|
||||
//#include "detail/IPrintable_DUniqueString.hpp" // when avail
|
||||
|
||||
#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
|
||||
expression2_register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DConstant>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DVariable>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DTypename>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DDefineExpr>());
|
||||
//ok &= gc.install_type(impl_for<AGCObject, DApplyExpr>()); // when avail
|
||||
ok &= gc.install_type(impl_for<AGCObject, DLambdaExpr>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DIfElseExpr>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DSequenceExpr>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DLocalSymtab>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DGlobalSymtab>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end expression2_register_types.cpp */
|
||||
|
|
@ -4,23 +4,22 @@
|
|||
**/
|
||||
|
||||
#include "init_expression2.hpp"
|
||||
#include "expression2_register_facets.hpp"
|
||||
#include "SetupExpression2.hpp"
|
||||
#include "expression2_register_types.hpp"
|
||||
|
||||
#include <xo/procedure2/init_procedure2.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::expression2_register_facets;
|
||||
using xo::scm::expression2_register_types;
|
||||
using xo::scm::SetupExpression2;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_expression2_tag>::init()
|
||||
{
|
||||
expression2_register_facets();
|
||||
SetupExpression2::register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&expression2_register_types);
|
||||
CollectorTypeRegistry::instance().register_types(&SetupExpression2::register_types);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue