diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-05-27 12:37:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-05-27 12:37:50 +0200 |
commit | 32381f97e98465953bfde24b4436093e70fbe70f (patch) | |
tree | 1f585cf7af509e76c64aca108cecd23acd6fb437 /source/luametatex/source/tex/texconditional.c | |
parent | bb8ae12f4f94189fd1540b201e2aea78f485de97 (diff) | |
download | context-32381f97e98465953bfde24b4436093e70fbe70f.tar.gz |
2023-05-27 12:16:00
Diffstat (limited to 'source/luametatex/source/tex/texconditional.c')
-rw-r--r-- | source/luametatex/source/tex/texconditional.c | 27 |
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; |