xo-reader2: + op>= support

This commit is contained in:
Roland Conybeare 2026-03-12 23:41:21 -05:00
commit 1b4d5744d2
11 changed files with 93 additions and 17 deletions

View file

@ -74,6 +74,14 @@ namespace xo {
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>
@ -136,6 +144,14 @@ namespace xo {
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());
}
}
}

View file

@ -23,49 +23,64 @@ namespace xo {
FloatOps::divide(obj<ARuntimeContext> rcx,
DFloat * x, DFloat * y)
{
return DFloat::box<AGCObject>(rcx.allocator(), x->value() / y->value());
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());
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());
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());
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());
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());
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());
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());
}
}
}

View file

@ -69,6 +69,13 @@ namespace xo {
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());
}
}
}

View file

@ -162,6 +162,18 @@ namespace xo {
x, y);
}
obj<AGCObject>
NumericDispatch::cmp_greatequal(obj<ARuntimeContext> rcx,
obj<AGCObject> x,
obj<AGCObject> y)
{
return dispatch(rcx,
"NumericDispatch::cmp_great",
"incomparable types in x>=y",
&AnonymizedNumericOps::cmpge_,
x, y);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -42,7 +42,8 @@ namespace xo {
&FloatOps::cmp_equal,
&FloatOps::cmp_notequal,
&FloatOps::cmp_less,
&FloatOps::cmp_lessequal);
&FloatOps::cmp_lessequal,
&FloatOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DFloat, DInteger>
(&FloatIntegerOps::multiply,
@ -52,7 +53,8 @@ namespace xo {
&FloatIntegerOps::cmp_equal,
&FloatIntegerOps::cmp_notequal,
&FloatIntegerOps::cmp_less,
&FloatIntegerOps::cmp_lessequal);
&FloatIntegerOps::cmp_lessequal,
&FloatIntegerOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DInteger, DFloat>
(&IntegerFloatOps::multiply,
@ -62,7 +64,8 @@ namespace xo {
&IntegerFloatOps::cmp_equal,
&IntegerFloatOps::cmp_notequal,
&IntegerFloatOps::cmp_less,
&IntegerFloatOps::cmp_lessequal);
&IntegerFloatOps::cmp_lessequal,
&IntegerFloatOps::cmp_greatequal);
NumericDispatch::instance().register_impl<DInteger, DInteger>
(&IntegerOps::multiply,
@ -72,7 +75,8 @@ namespace xo {
&IntegerOps::cmp_equal,
&IntegerOps::cmp_notequal,
&IntegerOps::cmp_less,
&IntegerOps::cmp_lessequal);
&IntegerOps::cmp_lessequal,
&IntegerOps::cmp_greatequal);
log && log(xtag("ANumeric.tseq", typeseq::id<ANumeric>()));

View file

@ -74,6 +74,8 @@ namespace xo {
flags & InstallFlags::f_essential);
ok = ok & install_aux(sink, mm, "_cmple", &NumericDispatch::cmp_lessequal,
flags & InstallFlags::f_essential);
ok = ok & install_aux(sink, mm, "_cmpge", &NumericDispatch::cmp_greatequal,
flags & InstallFlags::f_essential);
return ok;
}