From 151f78ebe407960b74e3de8f81f6d66a75ae4e70 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 18 Oct 2020 20:50:35 +0000 Subject: expkv-cs (18oct20) git-svn-id: svn://tug.org/texlive/trunk@56693 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/expkv-cs/README.md | 2 +- Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf | Bin 321211 -> 321681 bytes .../texmf-dist/source/latex/expkv-cs/expkv-cs.dtx | 60 ++++++++++++--------- .../texmf-dist/tex/generic/expkv-cs/expkv-cs.tex | 36 ++++++------- 4 files changed, 53 insertions(+), 45 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/expkv-cs/README.md b/Master/texmf-dist/doc/latex/expkv-cs/README.md index d7ca7d3bce5..704f877adf1 100644 --- a/Master/texmf-dist/doc/latex/expkv-cs/README.md +++ b/Master/texmf-dist/doc/latex/expkv-cs/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv-cs -- define expandable key=val macros using expkv -Version 2020-10-11 v0.5 +Version 2020-10-18 v0.6 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf b/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf index e2188f691a5..d8b76f5514b 100644 Binary files a/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf and b/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf differ 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}{}} diff --git a/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex b/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex index d1f3ccc1df1..38f5d3af810 100644 --- a/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex +++ b/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex @@ -35,11 +35,12 @@ \else \expandafter\endinput \fi -\def\ekvcVersion{0.5} -\def\ekvcDate{2020-10-11} +\def\ekvcVersion{0.6} +\def\ekvcDate{2020-10-18} \csname ekvc@tmp\endcsname \expandafter\chardef\csname ekvc@tmp\endcsname=\catcode`\@ \catcode`\@=11 +\chardef\ekvc@zero0 \newcount\ekvc@keycount \def\ekvc@long{} \def\ekvc@any@long{} @@ -397,12 +398,11 @@ ####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 @@ -449,19 +449,23 @@ \endgroup }% } -\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}% } \long\def\ekvcValueFast#1#2{\csname ekvc@fasthash@#1\endcsname#2\ekvc@stop} -\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}{}% } \long\def\ekvc@safe@found@hash#1#2\ekvc@stop#3% {% @@ -475,11 +479,7 @@ {% \csname ekvc@fastsplithash@#1\endcsname#2\ekvc@stop } -\long\def\ekvcValueSplitFast@#1#2#3% - {% - \expandafter#3\expandafter{#1#2\ekvc@stop}% - } -\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