From 3fdf82ec77f470d0bf97c17c3085ef2fd58ea65f Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 19 Oct 2020 03:01:17 +0000
Subject: CTAN sync 202010190301

---
 macros/generic/expkv-cs/expkv-cs.dtx | 60 ++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 26 deletions(-)

(limited to 'macros/generic/expkv-cs/expkv-cs.dtx')

diff --git a/macros/generic/expkv-cs/expkv-cs.dtx b/macros/generic/expkv-cs/expkv-cs.dtx
index 28218c7984..7dd4c6aad6 100644
--- a/macros/generic/expkv-cs/expkv-cs.dtx
+++ b/macros/generic/expkv-cs/expkv-cs.dtx
@@ -800,8 +800,8 @@ and the derived files           expkv-cs.pdf
 % \begin{macro}{\ekvcVersion,\ekvcDate}
 % We're on our first input, so lets store the version and date in a macro.
 %    \begin{macrocode}
-\def\ekvcVersion{0.5}
-\def\ekvcDate{2020-10-11}
+\def\ekvcVersion{0.6}
+\def\ekvcDate{2020-10-18}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -821,6 +821,22 @@ and the derived files           expkv-cs.pdf
 % |\ekvc@tmp| will be reused later, but we don't need it to ever store
 % information long-term after \expkvc\ was initialized.
 %
+% \begin{macro}[internal]{\ekvc@zero}
+%   There are different ways to define a |\romannumeral| expansion. If the
+%   control is never given to user input, the fastest way is to just execute
+%   your code and use a |\chardef|ed zero to end it afterwards.  If the control
+%   is given to user input (so user input should be expanded) the fastest and
+%   best way is to use |\romannumeral`\^^@|, this will expand the user input
+%   until something unexpandable is found or a space (which would then be
+%   gobbled). However, we want to use the former approach since we don't want to
+%   expand any user input, just make sure own code is expanded in two steps.
+%   Since we want to use the |\chardef| variant, we have to actually provide
+%   such a token.
+%    \begin{macrocode}
+\chardef\ekvc@zero0
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[internal]{\ekvc@keycount}
 %   We'll need to keep count how many keys must be defined for each macro in the
 %   |split| variants.
@@ -1378,12 +1394,11 @@ and the derived files           expkv-cs.pdf
                   ####1%
                 {%
                   \unexpanded\expandafter{\csname ekvc@@safehash@#1\endcsname}%
-                  ####1\unexpanded{\ekvc@mark}{ }%
+                  ####1\unexpanded{\ekvc@mark\ekvc@zero}%
                   \unexpanded\expandafter
                     {%
-                      \csname ekvc@hashmark@#1\endcsname
-                      {\ekvc@err@missing@hash{#1} }%
-                      \ekvc@mark{}\ekvc@stop
+                      \csname ekvc@hashmark@#1\endcsname\ekvc@zero
+                      \ekvc@mark{\ekvc@err@missing@hash{#1}}\ekvc@stop
                     }%
                 }%
               \long\gdef
@@ -1438,12 +1453,12 @@ and the derived files           expkv-cs.pdf
 %   hash macro exists) and then call that hash-grabbing macro that will also
 %   test whether the hash is inside of |#2| or not.
 %    \begin{macrocode}
-\long\def\ekvcValue#1#2%
+\long\def\ekvcValue#1%
   {%
-    \romannumeral`\^^@%
+    \romannumeral
     \ekv@ifdefined{ekvc@safehash@#1}%
-      {\csname ekvc@safehash@#1\endcsname{#2}}%
-      {\ekvc@err@unknown@hash{#1} }% keep this space
+      {\csname ekvc@safehash@#1\endcsname}%
+      {\ekvc@err@unknown@hash{#1}\@firstoftwo\ekvc@zero}%
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1456,14 +1471,18 @@ and the derived files           expkv-cs.pdf
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\ekvcValueSplit}
+% \begin{macro}{\ekvcValueSplit,\ekvcValueSplit@recover}
 %   This splits off a single value.
 %    \begin{macrocode}
-\long\def\ekvcValueSplit#1#2#3%
+\long\def\ekvcValueSplit#1%
   {%
     \ekv@ifdefined{ekvc@safesplithash@#1}%
-      {\csname ekvc@safesplithash@#1\endcsname{#2}{#3}}%
-      {\ekvc@err@unknown@hash{#1}#3{}{#2}}%
+      {\csname ekvc@safesplithash@#1\endcsname}%
+      {\ekvc@err@unknown@hash{#1}\ekvcValueSplit@recover}%
+  }
+\long\def\ekvcValueSplit@recover#1#2%
+  {%
+    #2{#1}{}%
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1494,17 +1513,6 @@ and the derived files           expkv-cs.pdf
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]{\ekvcValueSplitFast@a}
-%   This step then expands the hash function once and passes the result to |#3|
-%   which should be a single control sequence.
-%    \begin{macrocode}
-\long\def\ekvcValueSplitFast@#1#2#3%
-  {%
-    \expandafter#3\expandafter{#1#2\ekvc@stop}%
-  }
-%    \end{macrocode}
-% \end{macro}
-%
 % \begin{macro}[internal]
 %   {
 %     \ekvc@safehash@,\ekvc@fasthash@,
@@ -1516,7 +1524,7 @@ and the derived files           expkv-cs.pdf
 %   thrown by |\ekvcValueFast| in three expansion steps. The safe hash variant
 %   has to also stop the |\romannumeral| expansion.
 %    \begin{macrocode}
-\long\def\ekvc@safehash@#1{\ekvc@err@empty@hash\@gobble{} }% keep this space
+\long\def\ekvc@safehash@#1{\ekvc@err@empty@hash\ekvc@zero}
 \long\def\ekvc@fasthash@#1\ekvc@stop{\ekvc@err@empty@hash}
 \long\def\ekvc@safesplithash@#1#2{\ekvc@err@empty@hash#2{#1}{}}
 \long\def\ekvc@fastsplithash@#1\ekvc@stop#2{\ekvc@err@empty@hash#2{#1}{}}
-- 
cgit v1.2.3

