From bbe9e3a2874a81d4559603fc57aa37a0f53ae4bb Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 14 Apr 2020 21:06:44 +0000
Subject: yquant (14apr20)

git-svn-id: svn://tug.org/texlive/trunk@54737 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/yquant/yquant-tools.tex   | 41 +++++++++++++---------
 1 file changed, 25 insertions(+), 16 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/yquant/yquant-tools.tex')

diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex b/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex
index 15d3c328aad..fe1efecbf47 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex
+++ b/Master/texmf-dist/tex/latex/yquant/yquant-tools.tex
@@ -45,6 +45,11 @@
    \repeat%
 }
 
+\def\yquant@for@break{%
+   \fi%
+   \iffalse%
+}
+
 % Def #1 to be the minimum of #2, ... until \relax
 \protected\def\yquant@min#1{%
    \def#1{2147483647}%
@@ -92,11 +97,11 @@
 % Executes #3 if #1 (single token!) is equal (\ifx) to the first token of #2, and #4 else.
 \def\ifyquant@firsttoken#1#2{%
    % First check whether #2 is present at all...
-   \if\relax\detokenize{#2}\relax%
+   \ifstrempty{#2}{%
       \expandafter\@secondoftwo%
-   \else%
+   }{%
       \ifyquant@firsttoken@aux#1#2\yquant@sep%
-   \fi%
+   }%
 }
 
 \def\ifyquant@firsttoken@aux#1#2#3\yquant@sep{%
@@ -110,11 +115,7 @@
 % Executes #3 if #1 begins with #2, and #4 else - non-expandable
 \protected\def\ifyquant@beginswith#1#2{%
    \def\ifyquant@beginswith@##1#2##2\yquant@end{%
-      \if\relax\detokenize{##1}\relax%
-         \expandafter\@firstoftwo%
-      \else%
-         \expandafter\@secondoftwo%
-      \fi%
+      \ifstrempty{##1}%
    }%
    \ifyquant@beginswith@#1#2\yquant@end%
 }
@@ -148,6 +149,14 @@
    \expandafter\yquant@sort@aux\expandafter0\expandafter{\the\numexpr\yquant@sort@count-1\relax}%
 }
 
+\def\yquant@sort@ascending#1#2{%
+   \ifnum#2>#1 %
+      \expandafter\@firstoftwo%
+   \else%
+      \expandafter\@secondoftwo%
+   \fi%
+}
+
 \protected\def\yquant@sort@aux#1#2{%
    \ifnum#1<#2\relax%
       \yquant@sort@divide{#1}{#2}%
@@ -159,6 +168,8 @@
    \fi%
 }
 
+\def\iftrue@hidden{\iftrue}%
+\def\iffalse@hidden{\iffalse}%
 \protected\def\yquant@sort@divide#1#2{%
    \count0=#1\relax% i
    \count2=#2\relax% j
@@ -167,7 +178,6 @@
    \loop%
       % search an item from the left that is larger or equal to the pivot
       {% protect the outer loop from finding \repeat
-         \csletcs{next}{iftrue}%
          \loop%
             \ifnum\count0<#2\relax%
                \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\yquant@sort@cmp%
@@ -177,21 +187,20 @@
                   \expandafter\expandafter\expandafter{%
                      \csname yquant@sort@item\the\count0\endcsname%
                   }{%
-                     \csletcs{next}{iffalse}%
+                     \expandafter\iffalse@hidden%
                   }{%
                      \advance\count0 by 1 %
+                     \expandafter\iftrue@hidden%
                   }%
             \else%
-               \csletcs{next}{iffalse}%
+               \expandafter\iffalse@hidden%
             \fi%
-            \next%
          \repeat%
          \expandafter%
       }%
       \expandafter\count\expandafter0\expandafter=\the\count0\relax%
       % search an item from the right that is small than the pivot
       {% protect the outer loop from finding \repeat
-         \csletcs{next}{iftrue}%
          \loop%
             \ifnum\count2>#1\relax%
                \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\yquant@sort@cmp%
@@ -202,13 +211,13 @@
                      \csname yquant@sort@item\the\count2\endcsname%
                   }{%
                      \advance\count2 by -1 %
+                     \expandafter\iftrue@hidden%
                   }{%
-                     \csletcs{next}{iffalse}%
+                     \expandafter\iffalse@hidden%
                   }%
             \else%
-               \csletcs{next}{iffalse}%
+               \expandafter\iffalse@hidden%
             \fi%
-            \next%
          \repeat%
          \expandafter
       }%
-- 
cgit v1.2.3

