summaryrefslogtreecommitdiff
path: root/source/luametatex/source/tex/texconditional.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/luametatex/source/tex/texconditional.c')
-rw-r--r--source/luametatex/source/tex/texconditional.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/luametatex/source/tex/texconditional.c b/source/luametatex/source/tex/texconditional.c
index b2219e2ab..b4541f342 100644
--- a/source/luametatex/source/tex/texconditional.c
+++ b/source/luametatex/source/tex/texconditional.c
@@ -578,6 +578,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_int_code:
result = tex_scan_int(0, NULL) == 0;
goto RESULT;
+ case if_interval_int_code:
+ {
+ scaled n0 = tex_scan_int(0, NULL);
+ scaled n1 = tex_scan_int(0, NULL);
+ scaled n2 = tex_scan_int(0, NULL);
+ result = n1 - n2;
+ result = result == 0 ? 1 : (result > 0 ? result <= n0 : -result <= n0);
+ }
+ goto RESULT;
case if_abs_posit_code:
case if_posit_code:
{
@@ -608,6 +617,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_posit_code:
result = tex_posit_eq_zero(tex_scan_posit(0));
goto RESULT;
+ case if_interval_posit_code:
+ {
+ halfword n0 = tex_scan_posit(0);
+ halfword n1 = tex_scan_posit(0);
+ halfword n2 = tex_scan_posit(0);
+ result = tex_posit_sub(n1, n2);
+ result = tex_posit_eq_zero(result) ? 1 : (tex_posit_gt_zero(result) ? tex_posit_le(result, n0) : tex_posit_le(tex_posit_neg(result), n0));
+ }
+ goto RESULT;
case if_abs_dim_code:
case if_dim_code:
{
@@ -638,6 +656,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_dim_code:
result = tex_scan_dimen(0, 0, 0, 0, NULL) == 0;
goto RESULT;
+ case if_interval_dim_code:
+ {
+ scaled n0 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ scaled n1 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ scaled n2 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ result = n1 - n2;
+ result = result == 0 ? 1 : (result > 0 ? result <= n0 : -result <= n0);
+ }
+ goto RESULT;
case if_odd_code:
result = odd(tex_scan_int(0, NULL));
goto RESULT;