xo-numeric: + less than dispatch (also in schematika parser)

This commit is contained in:
Roland Conybeare 2026-02-27 22:55:14 +11:00
commit 5791cd59ce
12 changed files with 83 additions and 13 deletions

View file

@ -58,6 +58,14 @@ namespace xo {
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()));
}
// ----- Integer op Float -----
obj<AGCObject>
@ -104,6 +112,14 @@ namespace xo {
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());
}
}
}

View file

@ -54,7 +54,12 @@ namespace xo {
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());
}
}
}

View file

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

View file

@ -191,6 +191,18 @@ namespace xo {
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);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -35,6 +35,10 @@ namespace xo {
NumericPrimitives::s_cmpne_gco_gco_pm("_cmpne",
&NumericDispatch::cmp_notequal);
DPrimitive_gco_2_gco_gco
NumericPrimitives::s_cmplt_gco_gco_pm("_cmplt",
&NumericDispatch::cmp_less);
} /*namespace scm*/
} /*namespace xo*/

View file

@ -40,7 +40,8 @@ namespace xo {
&FloatOps::add,
&FloatOps::subtract,
&FloatOps::cmp_equal,
&FloatOps::cmp_notequal);
&FloatOps::cmp_notequal,
&FloatOps::cmp_less);
NumericDispatch::instance().register_impl<DFloat, DInteger>
(&FloatIntegerOps::multiply,
@ -48,7 +49,8 @@ namespace xo {
&FloatIntegerOps::add,
&FloatIntegerOps::subtract,
&FloatIntegerOps::cmp_equal,
&FloatIntegerOps::cmp_notequal);
&FloatIntegerOps::cmp_notequal,
&FloatIntegerOps::cmp_less);
NumericDispatch::instance().register_impl<DInteger, DFloat>
(&IntegerFloatOps::multiply,
@ -56,7 +58,8 @@ namespace xo {
&IntegerFloatOps::add,
&IntegerFloatOps::subtract,
&IntegerFloatOps::cmp_equal,
&IntegerFloatOps::cmp_notequal);
&IntegerFloatOps::cmp_notequal,
&IntegerFloatOps::cmp_less);
NumericDispatch::instance().register_impl<DInteger, DInteger>
(&IntegerOps::multiply,
@ -64,7 +67,8 @@ namespace xo {
&IntegerOps::add,
&IntegerOps::subtract,
&IntegerOps::cmp_equal,
&IntegerOps::cmp_notequal);
&IntegerOps::cmp_notequal,
&IntegerOps::cmp_less);
log && log(xtag("ANumeric.tseq", typeseq::id<ANumeric>()));