xo-reader2 xo-expression2: + DSequenceSsm ++ utest
This commit is contained in:
parent
3a290a456c
commit
cd369cf2e8
78 changed files with 898 additions and 158 deletions
|
|
@ -17,6 +17,7 @@ set(SELF_SRCS
|
|||
IExpression_Any.cpp
|
||||
|
||||
IExpression_DConstant.cpp
|
||||
IGCObject_DConstant.cpp
|
||||
IPrintable_DConstant.cpp
|
||||
|
||||
IExpression_DVariable.cpp
|
||||
|
|
@ -33,6 +34,7 @@ set(SELF_SRCS
|
|||
IPrintable_DLambdaExpr.cpp
|
||||
|
||||
IExpression_DIfElseExpr.cpp
|
||||
IGCObject_DIfElseExpr.cpp
|
||||
IPrintable_DIfElseExpr.cpp
|
||||
|
||||
IExpression_DSequenceExpr.cpp
|
||||
|
|
|
|||
|
|
@ -71,6 +71,31 @@ namespace xo {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
DConstant::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DConstant);
|
||||
}
|
||||
|
||||
DConstant *
|
||||
DConstant::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||
{
|
||||
DConstant * copy = (DConstant *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
DConstant::forward_children(obj<ACollector> gc) noexcept
|
||||
{
|
||||
gc.forward_inplace(value_.iface(), (void **)&(value_.data_));
|
||||
|
||||
return shallow_size();
|
||||
}
|
||||
|
||||
bool
|
||||
DConstant::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
#include "DIfElseExpr.hpp"
|
||||
#include "detail/IExpression_DIfElseExpr.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/reflectutil/typeseq.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::print::APrintable;
|
||||
using xo::reflect::typeseq;
|
||||
using xo::facet::FacetRegistry;
|
||||
|
|
@ -120,6 +122,45 @@ namespace xo {
|
|||
}
|
||||
}
|
||||
|
||||
// GCObject facet
|
||||
|
||||
std::size_t
|
||||
DIfElseExpr::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DIfElseExpr);
|
||||
}
|
||||
|
||||
DIfElseExpr *
|
||||
DIfElseExpr::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||
{
|
||||
DIfElseExpr * copy = (DIfElseExpr *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
DIfElseExpr::forward_children(obj<ACollector> gc) noexcept
|
||||
{
|
||||
// GC needs to locate AGCObject iface for each member.
|
||||
{
|
||||
auto gco = FacetRegistry::instance().variant<AGCObject,AExpression>(test_);
|
||||
gc.forward_inplace(gco.iface(), (void **)&(test_.data_));
|
||||
}
|
||||
{
|
||||
auto gco = FacetRegistry::instance().variant<AGCObject,AExpression>(when_true_);
|
||||
gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_));
|
||||
}
|
||||
{
|
||||
auto gco = FacetRegistry::instance().variant<AGCObject,AExpression>(when_false_);
|
||||
gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_));
|
||||
}
|
||||
|
||||
return shallow_size();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
#ifdef NOPE
|
||||
|
|
|
|||
39
xo-expression2/src/expression2/IGCObject_DConstant.cpp
Normal file
39
xo-expression2/src/expression2/IGCObject_DConstant.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DConstant.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DConstant.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DConstant.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IGCObject_DConstant.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DConstant::shallow_size(const DConstant & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DConstant::shallow_copy(const DConstant & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DConstant::forward_children(DConstant & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DConstant.cpp */
|
||||
39
xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp
Normal file
39
xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DIfElseExpr.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DIfElseExpr.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DIfElseExpr.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IGCObject_DIfElseExpr.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DIfElseExpr::shallow_size(const DIfElseExpr & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DIfElseExpr::shallow_copy(const DIfElseExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DIfElseExpr::forward_children(DIfElseExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DIfElseExpr.cpp */
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include <xo/expression2/detail/IPrintable_DUniqueString.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DDefineExpr.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DDefineExpr.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DDefineExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DVariable.hpp>
|
||||
|
|
@ -16,15 +17,19 @@
|
|||
#include <xo/expression2/detail/IPrintable_DVariable.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||
#include <xo/expression2/detail/IGCObject_DConstant.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DConstant.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DApplyExpr.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DApplyExpr.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DApplyExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DLambdaExpr.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DLambdaExpr.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DLambdaExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DIfElseExpr.hpp>
|
||||
#include <xo/expression2/detail/IGCObject_DIfElseExpr.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DIfElseExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DSequenceExpr.hpp>
|
||||
|
|
@ -32,6 +37,7 @@
|
|||
#include <xo/expression2/detail/IPrintable_DSequenceExpr.hpp>
|
||||
|
||||
#include <xo/expression2/symtab/ISymbolTable_DLocalSymtab.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DLocalSymtab.hpp>
|
||||
#include <xo/expression2/symtab/IPrintable_DLocalSymtab.hpp>
|
||||
|
||||
#include <xo/gc/detail/AGCObject.hpp>
|
||||
|
|
@ -60,9 +66,11 @@ namespace xo {
|
|||
// +- DefineExpr
|
||||
// +- ApplyExpr
|
||||
// +- LambdaExpr
|
||||
// \- IfElseExpr
|
||||
// +- IfElseExpr
|
||||
// \- SequenceExpr
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DConstant>();
|
||||
FacetRegistry::register_impl<AGCObject, DConstant>();
|
||||
FacetRegistry::register_impl<APrintable, DConstant>();
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DVariable>();
|
||||
|
|
@ -79,6 +87,7 @@ namespace xo {
|
|||
FacetRegistry::register_impl<APrintable, DLambdaExpr>();
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DIfElseExpr>();
|
||||
FacetRegistry::register_impl<AGCObject, DIfElseExpr>();
|
||||
FacetRegistry::register_impl<APrintable, DIfElseExpr>();
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DSequenceExpr>();
|
||||
|
|
|
|||
|
|
@ -5,11 +5,18 @@
|
|||
|
||||
#include "expression2_register_types.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
|
||||
//#include "detail/IGCObject_DLambdaExpr.hpp" // when avail
|
||||
#include "detail/IGCObject_DIfElseExpr.hpp"
|
||||
#include "detail/IGCObject_DSequenceExpr.hpp"
|
||||
//#include "detail/IGCObject_DLocalSymtab.hpp" // when avail
|
||||
#include "detail/IGCObject_DUniqueString.hpp"
|
||||
|
||||
//#include "detail/IPrintable_DUniqueString.hpp"
|
||||
//#include "detail/IPrintable_DUniqueString.hpp" // when avail
|
||||
|
||||
//#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -27,6 +34,16 @@ namespace xo {
|
|||
|
||||
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, DDefineExpr>()); // when avail
|
||||
//ok &= gc.install_type(impl_for<AGCObject, DApplyExpr>()); // when avail
|
||||
//ok &= gc.install_type(impl_for<AGCObject, DLambdaExpr>()); // when avail
|
||||
ok &= gc.install_type(impl_for<AGCObject, DIfElseExpr>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DSequenceExpr>());
|
||||
|
||||
//ok &= gc.install_type(impl_for<AGCObject, DLocalSymtab>()); // when avail
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DUniqueString>());
|
||||
|
||||
return ok;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue