From d107ea542392f127d0434795790f01b2d5afeae8 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 14 Jan 2026 00:09:45 -0500 Subject: [PATCH] xo-expression2: + IExpression_DConstant --- xo-expression2/CMakeLists.txt | 12 ++++ .../idl/IExpression_DConstant.json5 | 11 ++++ .../include/xo/expression2/DConstant.hpp | 2 + .../xo/expression2/IExpression_DConstant.hpp | 63 +++++++++++++++++++ xo-expression2/src/expression2/CMakeLists.txt | 3 +- .../src/expression2/IExpression_DConstant.cpp | 45 +++++++++++++ .../interpreter2/VirtualSchematikaMachine.cpp | 1 + 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 xo-expression2/idl/IExpression_DConstant.json5 create mode 100644 xo-expression2/include/xo/expression2/IExpression_DConstant.hpp create mode 100644 xo-expression2/src/expression2/IExpression_DConstant.cpp diff --git a/xo-expression2/CMakeLists.txt b/xo-expression2/CMakeLists.txt index 3adeccfa..df5a0c56 100644 --- a/xo-expression2/CMakeLists.txt +++ b/xo-expression2/CMakeLists.txt @@ -32,6 +32,18 @@ xo_add_genfacet( OUTPUT_CPP_DIR src/expression2 ) +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-expression2-facetimpl-expression-constant + FACET_PKG xo_expression2 + FACET Expression + REPR Constant + INPUT idl/IExpression_DConstant.json5 + OUTPUT_HPP_DIR include/xo/expression2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/expression2 +) + # ---------------------------------------------------------------- # header-only library diff --git a/xo-expression2/idl/IExpression_DConstant.json5 b/xo-expression2/idl/IExpression_DConstant.json5 new file mode 100644 index 00000000..89842432 --- /dev/null +++ b/xo-expression2/idl/IExpression_DConstant.json5 @@ -0,0 +1,11 @@ +{ + mode: "implementation", + includes: [ "\"Expression.hpp\"" ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Expression.json5", + brief: "provide AExpression interface for DConstant state", + using_doxygen: true, + repr: "DConstant", + doc: ["doc for something or other IExpression+DConstant" ], +} diff --git a/xo-expression2/include/xo/expression2/DConstant.hpp b/xo-expression2/include/xo/expression2/DConstant.hpp index 29776912..9d2014b9 100644 --- a/xo-expression2/include/xo/expression2/DConstant.hpp +++ b/xo-expression2/include/xo/expression2/DConstant.hpp @@ -3,6 +3,8 @@ * @author Roland Conybeare, Jan 2026 **/ +#pragma once + #include "TypeRef.hpp" #include "exprtype.hpp" #include diff --git a/xo-expression2/include/xo/expression2/IExpression_DConstant.hpp b/xo-expression2/include/xo/expression2/IExpression_DConstant.hpp new file mode 100644 index 00000000..b08d8814 --- /dev/null +++ b/xo-expression2/include/xo/expression2/IExpression_DConstant.hpp @@ -0,0 +1,63 @@ +/** @file IExpression_DConstant.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IExpression_DConstant.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IExpression_DConstant.json5] + **/ + +#pragma once + +#include "Expression.hpp" +#include "DConstant.hpp" + +namespace xo { namespace scm { class IExpression_DConstant; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IExpression_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IExpression_DConstant + **/ + class IExpression_DConstant { + public: + /** @defgroup scm-expression-dconstant-type-traits **/ + ///@{ + using TypeDescr = xo::scm::AExpression::TypeDescr; + ///@} + /** @defgroup scm-expression-dconstant-methods **/ + ///@{ + // const methods + /** expression type (constant | apply | ..) **/ + static exprtype extype(const DConstant & self) noexcept; + /** placeholder for type giving possible values for this expression **/ + static TypeRef typeref(const DConstant & self) noexcept; + /** type giving possible values for this expression. Maybe null before typecheck **/ + static TypeDescr valuetype(const DConstant & self) noexcept; + + // non-const methods + /** assing to valuetype member. Useful when scaffolding expressions **/ + static void assign_valuetype(DConstant & self, TypeDescr td) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-expression2/src/expression2/CMakeLists.txt b/xo-expression2/src/expression2/CMakeLists.txt index b91033c7..956d405a 100644 --- a/xo-expression2/src/expression2/CMakeLists.txt +++ b/xo-expression2/src/expression2/CMakeLists.txt @@ -4,7 +4,8 @@ set(SELF_LIB xo_expression2) set(SELF_SRCS DConstant.cpp TypeRef.cpp - #IExpression_Any.cpp + IExpression_Any.cpp + IExpression_DConstant.cpp expression2_register_facets.cpp ) diff --git a/xo-expression2/src/expression2/IExpression_DConstant.cpp b/xo-expression2/src/expression2/IExpression_DConstant.cpp new file mode 100644 index 00000000..39f8135c --- /dev/null +++ b/xo-expression2/src/expression2/IExpression_DConstant.cpp @@ -0,0 +1,45 @@ +/** @file IExpression_DConstant.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IExpression_DConstant.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IExpression_DConstant.json5] +**/ + +#include "IExpression_DConstant.hpp" + +namespace xo { + namespace scm { + auto + IExpression_DConstant::extype(const DConstant & self) noexcept -> exprtype + { + return self.extype(); + } + + auto + IExpression_DConstant::typeref(const DConstant & self) noexcept -> TypeRef + { + return self.typeref(); + } + + auto + IExpression_DConstant::valuetype(const DConstant & self) noexcept -> TypeDescr + { + return self.valuetype(); + } + + auto + IExpression_DConstant::assign_valuetype(DConstant & self, TypeDescr td) noexcept -> void + { + self.assign_valuetype(td); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IExpression_DConstant.cpp */ \ No newline at end of file diff --git a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp index 5882dc89..012b16f6 100644 --- a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp @@ -4,6 +4,7 @@ **/ #include "VirtualSchematikaMachine.hpp" +#include #include #include