summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-10-18 20:50:35 +0000
committerKarl Berry <karl@freefriends.org>2020-10-18 20:50:35 +0000
commit151f78ebe407960b74e3de8f81f6d66a75ae4e70 (patch)
tree49c25b1e40c3e0e0a476361a6b81d9aff91f2874 /Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
parent2458e28321675fc6c1c4d3dded4c870551017152 (diff)
expkv-cs (18oct20)
git-svn-id: svn://tug.org/texlive/trunk@56693 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx')
-rw-r--r--Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx60
1 files changed, 34 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx b/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
index 28218c79845..7dd4c6aad6f 100644
--- a/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
+++ b/Master/texmf-dist/source/latex/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}{}}