xo-XXX -> .xo-XXX (prep subrepo)

This commit is contained in:
Roland Conybeare 2026-06-06 22:00:54 -04:00
commit cf0bd4d975
2105 changed files with 0 additions and 0 deletions

View file

@ -1,25 +0,0 @@
# numeric/CMakeLists.txt
set(SELF_LIB xo_numeric)
set(SELF_SRCS
init_numeric.cpp
SetupNumeric.cpp
NumericPrimitives.cpp
NumericDispatch.cpp
INumeric_Any.cpp
FloatIntegerOps.cpp
FloatOps.cpp
IntegerOps.cpp
)
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
xo_dependency(${SELF_LIB} xo_procedure2)
xo_dependency(${SELF_LIB} subsys)
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
# ----------------------------------------------------------------
# docs targets depend on other library/utest/exec targets above,
# --> must come after them.
#
#add_subdirectory(docs)

View file

@ -1,174 +0,0 @@
/** @file FloatIntegerOps.cp
*
* @author Roland Conybeare, Feb 2206
**/
#include "FloatIntegerOps.hpp"
#include "float/INumeric_DFloat.hpp"
#include <xo/object2/Boolean.hpp>
namespace xo {
using xo::mm::AGCObject;
namespace scm {
// ----- Float op Integer -----
obj<AGCObject>
FloatIntegerOps::multiply(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() * y->value());
}
obj<AGCObject>
FloatIntegerOps::divide(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() / y->value());
}
obj<AGCObject>
FloatIntegerOps::add(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() + y->value());
}
obj<AGCObject>
FloatIntegerOps::subtract(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() - y->value());
}
obj<AGCObject>
FloatIntegerOps::cmp_equal(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() == DFloat::value_type(y->value()));
}
obj<AGCObject>
FloatIntegerOps::cmp_notequal(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() != DFloat::value_type(y->value()));
}
obj<AGCObject>
FloatIntegerOps::cmp_less(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() < DFloat::value_type(y->value()));
}
obj<AGCObject>
FloatIntegerOps::cmp_lessequal(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() <= DFloat::value_type(y->value()));
}
obj<AGCObject>
FloatIntegerOps::cmp_greater(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() > DFloat::value_type(y->value()));
}
obj<AGCObject>
FloatIntegerOps::cmp_greatequal(obj<ARuntimeContext> rcx,
DFloat * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() >= DFloat::value_type(y->value()));
}
// ----- Integer op Float -----
obj<AGCObject>
IntegerFloatOps::multiply(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() * y->value());
}
obj<AGCObject>
IntegerFloatOps::divide(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() / y->value());
}
obj<AGCObject>
IntegerFloatOps::add(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() + y->value());
}
obj<AGCObject>
IntegerFloatOps::subtract(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() - y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_equal(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) == y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_notequal(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) != y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_less(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) < y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_lessequal(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) <= y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_greater(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) > y->value());
}
obj<AGCObject>
IntegerFloatOps::cmp_greatequal(obj<ARuntimeContext> rcx,
DInteger * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
DFloat::value_type(x->value()) >= y->value());
}
}
}
/* end FloatIntegerOps.cpp */

View file

@ -1,96 +0,0 @@
/** @file FloatOps.cp
*
* @author Roland Conybeare, Feb 2206
**/
#include "FloatOps.hpp"
#include "float/INumeric_DFloat.hpp"
#include <xo/object2/Boolean.hpp>
namespace xo {
using xo::mm::AGCObject;
namespace scm {
obj<AGCObject>
FloatOps::multiply(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() * y->value());
}
obj<AGCObject>
FloatOps::divide(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(),
x->value() / y->value());
}
obj<AGCObject>
FloatOps::add(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(),
x->value() + y->value());
}
obj<AGCObject>
FloatOps::subtract(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(),
x->value() - y->value());
}
obj<AGCObject>
FloatOps::cmp_equal(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() == y->value());
}
obj<AGCObject>
FloatOps::cmp_notequal(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() != y->value());
}
obj<AGCObject>
FloatOps::cmp_less(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() < y->value());
}
obj<AGCObject>
FloatOps::cmp_lessequal(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() <= y->value());
}
obj<AGCObject>
FloatOps::cmp_greater(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() > y->value());
}
obj<AGCObject>
FloatOps::cmp_greatequal(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(),
x->value() >= y->value());
}
}
}
/* end FloatOps.cpp */

View file

@ -1,42 +0,0 @@
/** @file INumeric_Any.cpp
*
**/
#include "detail/INumeric_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace scm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
void
INumeric_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " INumeric_Any method"
<< std::endl;
std::terminate();
}
typeseq
INumeric_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
INumeric_Any::_valid
= valid_facet_implementation<ANumeric, INumeric_Any>();
// nonconst methods
} /*namespace scm*/
} /*namespace xo*/
/* end INumeric_Any.cpp */

View file

@ -1,22 +0,0 @@
/** @file INumeric_DFloat.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/INumeric_DFloat.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/INumeric_DFloat.json5]
**/
#include "float/INumeric_DFloat.hpp"
namespace xo {
namespace scm {
} /*namespace scm*/
} /*namespace xo*/
/* end INumeric_DFloat.cpp */

View file

@ -1,22 +0,0 @@
/** @file INumeric_DInteger.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/INumeric_DInteger.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/INumeric_DInteger.json5]
**/
#include "integer/INumeric_DInteger.hpp"
namespace xo {
namespace scm {
} /*namespace scm*/
} /*namespace xo*/
/* end INumeric_DInteger.cpp */

View file

@ -1,89 +0,0 @@
/** @file IntegerOps.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "IntegerOps.hpp"
#include "integer/INumeric_DInteger.hpp"
#include <xo/object2/Boolean.hpp>
namespace xo {
using xo::scm::DBoolean;
using xo::mm::AGCObject;
namespace scm {
obj<AGCObject>
IntegerOps::multiply(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DInteger::box<AGCObject>(rcx.allocator(), x->value() * y->value());
}
obj<AGCObject>
IntegerOps::divide(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DInteger::box<AGCObject>(rcx.allocator(), x->value() / y->value());
}
obj<AGCObject>
IntegerOps::add(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DInteger::box<AGCObject>(rcx.allocator(), x->value() + y->value());
}
obj<AGCObject>
IntegerOps::subtract(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DInteger::box<AGCObject>(rcx.allocator(), x->value() - y->value());
}
obj<AGCObject>
IntegerOps::cmp_equal(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() == y->value());
}
obj<AGCObject>
IntegerOps::cmp_notequal(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() != y->value());
}
obj<AGCObject>
IntegerOps::cmp_less(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() < y->value());
}
obj<AGCObject>
IntegerOps::cmp_lessequal(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() <= y->value());
}
obj<AGCObject>
IntegerOps::cmp_greater(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() > y->value());
}
obj<AGCObject>
IntegerOps::cmp_greatequal(obj<ARuntimeContext> rcx,
DInteger * x, DInteger * y)
{
return DBoolean::box<AGCObject>(rcx.allocator(), x->value() >= y->value());
}
}
}
/* end IntegerOps.cpp */

View file

@ -1,192 +0,0 @@
/** @file NumericDispatch.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "NumericDispatch.hpp"
#include <xo/object2/RuntimeError.hpp>
#include <xo/facet/TypeRegistry.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::mm::AGCObject;
using xo::facet::TypeRegistry;
namespace scm {
void
NumericDispatch::visit_pools(const MemorySizeVisitor & visitor)
{
dispatch_.visit_pools(visitor);
}
obj<AGCObject>
NumericDispatch::dispatch(obj<ARuntimeContext> rcx,
const char * caller,
const char * error_headline,
BinaryOp AnonymizedNumericOps::* member_ptr,
obj<AGCObject> x,
obj<AGCObject> y)
{
KeyType key(x._typeseq(), y._typeseq());
auto target_fn
= NumericDispatch::instance().dispatch_[key].*member_ptr;
if (!target_fn) {
// FIXME: use {fmt} here
std::stringstream ss;
tosn(ss,
error_headline,
xtag("x.tseq", x._typeseq()),
xtag("x.type", TypeRegistry::id2name(x._typeseq())),
xtag("x.data", x.data()),
xtag("y.tseq", y._typeseq()),
xtag("y.type", TypeRegistry::id2name(y._typeseq())),
xtag("y.data", y.data()));
return DRuntimeError::make(rcx.allocator(),
caller,
ss.str().c_str());
}
return (*target_fn)(rcx, x.data(), y.data());
}
obj<AGCObject>
NumericDispatch::multiply(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::multiply",
"incomparable types in x*y",
&AnonymizedNumericOps::multiply_,
x, y);
}
obj<AGCObject>
NumericDispatch::divide(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::divide",
"incomparable types in x/y",
&AnonymizedNumericOps::divide_,
x, y);
#ifdef OBSOLETE
KeyType key(x._typeseq(), y._typeseq());
auto target_fn
= NumericDispatch::instance().dispatch_[key].divide_;
if (!target_fn)
assert(false);
return (*target_fn)(rcx, x.data(), y.data());
#endif
}
obj<AGCObject>
NumericDispatch::add(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::add",
"incomparable types in x+y",
&AnonymizedNumericOps::add_,
x, y);
}
obj<AGCObject>
NumericDispatch::subtract(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::subtract",
"incomparable types in x-y",
&AnonymizedNumericOps::subtract_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_equal(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_equal",
"incomparable types in x==y",
&AnonymizedNumericOps::cmpeq_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_notequal(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_notequal",
"incomparable types in x!=y",
&AnonymizedNumericOps::cmpne_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_less(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_less",
"incomparable types in x<y",
&AnonymizedNumericOps::cmplt_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_lessequal(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_lessequal",
"incomparable types in x<=y",
&AnonymizedNumericOps::cmple_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_greater(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_greater",
"incomparable types in x>y",
&AnonymizedNumericOps::cmpgt_,
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_greatequal(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_greatequal",
"incomparable types in x>=y",
&AnonymizedNumericOps::cmpge_,
x, y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end NumericDispatch.cpp **/

View file

@ -1,182 +0,0 @@
/** @file NumericPrimitives.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "NumericPrimitives.hpp"
#include "NumericDispatch.hpp"
#include <xo/type/AtomicType.hpp>
#include <xo/type/FunctionType.hpp>
namespace xo {
using xo::mm::AAllocator;
//using xo::mm::AGCObject;
namespace scm {
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_multiply_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
// TODO: want to expand this to record schedule based on argument types.
//
// e.g. f64 x f64 -> f64
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op+: numeric x numeric -> numeric
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, numeric_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_multiply_pm_name, pm_ty,
&NumericDispatch::multiply);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_divide_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op+: numeric x numeric -> numeric
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, numeric_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_divide_pm_name, pm_ty,
&NumericDispatch::divide);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_add_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op+: numeric x numeric -> numeric
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, numeric_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_add_pm_name, pm_ty,
&NumericDispatch::add);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_subtract_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op+: numeric x numeric -> numeric
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, numeric_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_sub_pm_name, pm_ty,
&NumericDispatch::subtract);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmpeq_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op==: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmpeq_pm_name, pm_ty,
&NumericDispatch::cmp_equal);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmpne_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op!=: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmpne_pm_name, pm_ty,
&NumericDispatch::cmp_notequal);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmplt_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op!=: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmplt_pm_name, pm_ty,
&NumericDispatch::cmp_less);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmple_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op!=: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmple_pm_name, pm_ty,
&NumericDispatch::cmp_lessequal);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmpgt_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op!=: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmpgt_pm_name, pm_ty,
&NumericDispatch::cmp_greater);
}
DPrimitive_gco_2_gco_gco *
NumericPrimitives::make_cmpge_pm(obj<AAllocator> mm,
StringTable * stbl)
{
(void)stbl;
auto booleic_ty = DAtomicType::make(mm, Metatype::t_booleic());
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
// #op!=: numeric x numeric -> booleic
auto pm_ty = obj<AType,DFunctionType>
(DFunctionType::_make(mm, booleic_ty, numeric_ty, numeric_ty));
return DPrimitive_gco_2_gco_gco::_make(mm, c_cmpge_pm_name, pm_ty,
&NumericDispatch::cmp_greatequal);
}
} /*namespace scm*/
} /*namespace xo*/
/* end NumericDispatch.cpp */

View file

@ -1,162 +0,0 @@
/** @file SetupNumeric.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "SetupNumeric.hpp"
#include "NumericDispatch.hpp"
#include "Numeric.hpp"
#include "NumericPrimitives.hpp"
#include "NumericDispatch.hpp"
#include "FloatIntegerOps.hpp"
#include "FloatOps.hpp"
#include "float/INumeric_DFloat.hpp"
#include "IntegerOps.hpp"
#include "integer/INumeric_DInteger.hpp"
#include <xo/procedure2/Primitive_gco_2_gco_gco.hpp>
#include <xo/object2/DFloat.hpp>
#include <xo/object2/Integer.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/reflectutil/typeseq.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::mm::AAllocator;
using xo::facet::FacetRegistry;
using xo::reflect::typeseq;
namespace scm {
bool
SetupNumeric::register_facets()
{
scope log(XO_DEBUG(true));
FacetRegistry::register_impl<ANumeric, DInteger>();
NumericDispatch::instance().register_impl<DFloat, DFloat>
(&FloatOps::multiply,
&FloatOps::divide,
&FloatOps::add,
&FloatOps::subtract,
&FloatOps::cmp_equal,
&FloatOps::cmp_notequal,
&FloatOps::cmp_less,
&FloatOps::cmp_lessequal,
&FloatOps::cmp_greater,
&FloatOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DFloat, DInteger>
(&FloatIntegerOps::multiply,
&FloatIntegerOps::divide,
&FloatIntegerOps::add,
&FloatIntegerOps::subtract,
&FloatIntegerOps::cmp_equal,
&FloatIntegerOps::cmp_notequal,
&FloatIntegerOps::cmp_less,
&FloatIntegerOps::cmp_lessequal,
&FloatIntegerOps::cmp_greater,
&FloatIntegerOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DInteger, DFloat>
(&IntegerFloatOps::multiply,
&IntegerFloatOps::divide,
&IntegerFloatOps::add,
&IntegerFloatOps::subtract,
&IntegerFloatOps::cmp_equal,
&IntegerFloatOps::cmp_notequal,
&IntegerFloatOps::cmp_less,
&IntegerFloatOps::cmp_lessequal,
&IntegerFloatOps::cmp_greater,
&IntegerFloatOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DInteger, DInteger>
(&IntegerOps::multiply,
&IntegerOps::divide,
&IntegerOps::add,
&IntegerOps::subtract,
&IntegerOps::cmp_equal,
&IntegerOps::cmp_notequal,
&IntegerOps::cmp_less,
&IntegerOps::cmp_lessequal,
&IntegerOps::cmp_greater,
&IntegerOps::cmp_greatequal);
log && log(xtag("ANumeric.tseq", typeseq::id<ANumeric>()));
return true;
}
bool
SetupNumeric::register_primitives(obj<ARuntimeContext> rcx,
InstallSink sink,
InstallFlags flags)
{
obj<AAllocator> mm = rcx.allocator();
StringTable * stbl = rcx.stringtable();
scope log(XO_DEBUG(false));
bool ok = true;
/* "_mul" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_multiply_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_div" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_divide_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_add" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_add_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_sub" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_subtract_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmpeq" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmpeq_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmpne" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmpne_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmplt" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmplt_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmple" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmple_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmpgt" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmpgt_pm(mm, stbl),
flags & InstallFlags::f_essential));
/* "_cmpge" */
ok = ok & (PrimitiveRegistry::install_aux
(sink,
NumericPrimitives::make_cmpge_pm(mm, stbl),
flags & InstallFlags::f_essential));
return ok;
}
} /*namespace scm*/
} /*namespace xo*/
/* end SetupNumeric.cpp */

View file

@ -1,41 +0,0 @@
/** @file init_numeric.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "init_numeric.hpp"
#include "SetupNumeric.hpp"
#include <xo/procedure2/init_procedure2.hpp>
#include "Subsystem.hpp"
namespace xo {
using xo::scm::SetupNumeric;
//using xo::scm::numeric_register_primitives;
using xo::scm::PrimitiveRegistry;
void
InitSubsys<S_numeric_tag>::init()
{
SetupNumeric::register_facets();
PrimitiveRegistry::instance().register_primitives(&SetupNumeric::register_primitives);
}
InitEvidence
InitSubsys<S_numeric_tag>::require()
{
InitEvidence retval;
/* direct subsystem deps for xo-numeric/ */
retval ^= InitSubsys<S_procedure2_tag>::require();
/* xo-numeric/'s own initialization code */
retval ^= Subsystem::provide<S_numeric_tag>("numeric", &init);
return retval;
}
} /*namespace xo*/
/* end init_numeric.cpp */