texlive[61109] Master/texmf-dist: expkv-cs (21nov21)
commits+karl at tug.org
commits+karl at tug.org
Sun Nov 21 22:12:01 CET 2021
Revision: 61109
http://tug.org/svn/texlive?view=revision&revision=61109
Author: karl
Date: 2021-11-21 22:12:01 +0100 (Sun, 21 Nov 2021)
Log Message:
-----------
expkv-cs (21nov21)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md
trunk/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf
trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex
Modified: trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md 2021-11-21 21:11:31 UTC (rev 61108)
+++ trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md 2021-11-21 21:12:01 UTC (rev 61109)
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv-cs -- define expandable key=val macros using expkv
-Version 2021-09-20 v1.1a
+Version 2021-11-21 v1.1b
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
Modified: trunk/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx 2021-11-21 21:11:31 UTC (rev 61108)
+++ trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx 2021-11-21 21:12:01 UTC (rev 61109)
@@ -1568,8 +1568,8 @@
% \begin{macro}{\ekvcVersion,\ekvcDate}
% We're on our first input, so lets store the version and date in a macro.
% \begin{macrocode}
-\def\ekvcVersion{1.1a}
-\def\ekvcDate{2021-09-20}
+\def\ekvcVersion{1.1b}
+\def\ekvcDate{2021-11-21}
% \end{macrocode}
% \end{macro}
%
@@ -1783,7 +1783,7 @@
% \begin{macro}[internal]
% {
% \ekvc at SetupSplitKeys, \ekvc at SetupSplitKeys@a, \ekvc at SetupSplitKeys@b,
-% \ekvc at SetupSplitKeys@c, \ekvc at SetupSplitKeys@d
+% \ekvc at SetupSplitKeys@c, \ekvc at SetupSplitKeys@d, \ekvc at SetupSplitKeys@e,
% \ekvc at SetupSplitKeys@check at unknown,\ekvc at SetupSplitKeys@unknown
% }
% These macros parse the list of keys and set up the key macros. First we need
@@ -1791,7 +1791,7 @@
% \begin{macrocode}
\protected\long\def\ekvc at SetupSplitKeys
{%
- \ekvc at keycount=0
+ \ekvc at keycount=\ekv at zero
\let\ekvc at any@long\ekv at empty
\let\ekvc at initials\ekv at empty
\ekvparse\ekvc at SetupSplitKeys@check at unknown\ekvc at SetupSplitKeys@a
@@ -1829,20 +1829,15 @@
% the value given to the key. Additionally we'll need a sorting macro for each
% key count in use so we set it up with |\ekvc at setup@splitmacro|.
% \begin{macrocode}
-\protected\long\def\ekvc at SetupSplitKeys@d#1#2%
+\protected\def\ekvc at SetupSplitKeys@d
{%
- \begingroup
- \edef\ekvc at tmp
- {%
- \endgroup
- \long\def\ekv at unexpanded{\ekvc at tmp}####1####2%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname}####3%
- {%
- ####2%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname}{####1}%
- }%
+ \begingroup\expandafter\endgroup
+ \expandafter\ekvc at SetupSplitKeys@e
+ \csname ekvc at splitmark@\the\ekvc at keycount\endcsname
+ }
+\protected\long\def\ekvc at SetupSplitKeys@e#1#2#3%
+ {%
+ \long\def\ekvc at tmp##1##2#1##3{##2#1{##1}}%
% \end{macrocode}
% The short variant needs a bit of special treatment. The key macro will be
% short to throw the correct error, but since there might be long macros
@@ -1850,25 +1845,16 @@
% use a two step approach, first grabbing only the short argument, then
% reordering.
% \begin{macrocode}
- \unless\ifx\ekvc at long\long
- \let\ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(\detokenize{#1})\endcsname\ekvc at tmp}%
- \def\ekv at unexpanded{\ekvc at tmp}####1%
- {%
- \ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(\detokenize{#1})\endcsname}%
- {####1}%
- }%
- \fi
- \def\ekv at unexpanded{\ekvc at initials}%
- {%
- \ekv at unexpanded\expandafter{\ekvc at initials}%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname{#2}}%
- }%
- }%
- \ekvc at tmp
- \ekvlet\ekvc at set{#1}\ekvc at tmp
+ \unless\ifx\ekvc at long\long
+ \expandafter\let\csname ekvc@\ekvc at set(#2)\endcsname\ekvc at tmp
+ \edef\ekvc at tmp##1%
+ {%
+ \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#2)\endcsname}%
+ {##1}%
+ }%
+ \fi
+ \ekvlet\ekvc at set{#2}\ekvc at tmp
+ \edef\ekvc at initials{\ekv at unexpanded\expandafter{\ekvc at initials#1{#3}}}%
\ekvc at helpers@needed
{\expandafter\ekvc at setup@splitmacro\expandafter{\the\ekvc at keycount}}%
{}%
@@ -2128,7 +2114,7 @@
% \begin{macro}[internal]
% {
% \ekvc at SetupHashKeys,\ekvc at SetupHashKeys@a,\ekvc at SetupHashKeys@b,
-% \ekvc at SetupHashKeys@c,\ekvc at SetupHashKeys@d
+% \ekvc at SetupHashKeys@c,\ekvc at SetupHashKeys@d,\ekvc at SetupHashKeys@e,
% \ekvc at SetupHashKeys@check at unknown,\ekvc at SetupHashKeys@unknown
% }
% This should look awfully familiar as well, since it's just the same as for
@@ -2156,6 +2142,15 @@
{\ekvc at SetupHashKeys@d{#1 #2}}%
}
% \end{macrocode}
+% Again we build the marker, this time instead of a numbered one a named
+% hashmark, inside a group to not actually define the macro used as a marker.
+% \begin{macrocode}
+\protected\long\def\ekvc at SetupHashKeys@d#1%
+ {%
+ \begingroup\expandafter\endgroup
+ \expandafter\ekvc at SetupHashKeys@e\csname ekvc at hashmark@#1\endcsname{#1}%
+ }
+% \end{macrocode}
% Yes, even the defining macro looks awfully familiar. Instead of numbered we
% have named marks. Still the key macros grab everything up to their
% respective mark and reorder the arguments. The same quirk is applied for
@@ -2162,38 +2157,20 @@
% short keys. And instead of the |\ekvc at setup@splitmacro| we use
% |\ekvc at setup@hashmacro|.
% \begin{macrocode}
-\protected\long\def\ekvc at SetupHashKeys@d#1#2%
+\protected\long\def\ekvc at SetupHashKeys@e#1#2#3%
{%
- \begingroup
- \edef\ekvc at tmp
- {%
- \endgroup
- \long\def\ekv at unexpanded{\ekvc at tmp}####1####2%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname}%
- ####3%
- {%
- ####2%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname}%
- {####1}%
- }%
- \unless\ifx\ekvc at long\long
- \let\ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(#1)\endcsname\ekvc at tmp}%
- \def\ekv at unexpanded{\ekvc at tmp}####1%
- {%
- \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#1)\endcsname}%
- {####1}%
- }%
- \fi
- \def\ekv at unexpanded{\ekvc at initials}%
- {%
- \ekv at unexpanded\expandafter{\ekvc at initials}%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname{#2}}%
- }%
- }%
- \ekvc at tmp
- \ekvlet\ekvc at set{#1}\ekvc at tmp
- \ekvc at setup@hashmacro{#1}%
+ \long\def\ekvc at tmp##1##2#1##3{##2#1{##1}}%
+ \unless\ifx\ekvc at long\long
+ \expandafter\let\csname ekvc@\ekvc at set(#2)\endcsname\ekvc at tmp
+ \edef\ekvc at tmp##1%
+ {%
+ \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#2)\endcsname}%
+ {##1}%
+ }%
+ \fi
+ \ekvlet\ekvc at set{#2}\ekvc at tmp
+ \edef\ekvc at initials{\ekv at unexpanded\expandafter{\ekvc at initials#1{#3}}}%
+ \ekvc at setup@hashmacro{#2}%
}
% \end{macrocode}
% \begin{macrocode}
@@ -2479,7 +2456,10 @@
% \end{macro}
%
% \begin{macro}[internal]
-% {\ekvc at change,\ekvc at change@a,\ekvc at change@b,\ekvc at change@c}
+% {
+% \ekvc at change ,\ekvc at change@a,\ekvc at change@b,
+% \ekvc at change@c,\ekvc at change@d,\ekvc at change@e
+% }
% First we need to see whether the macro is currently |\long|. For this we get
% the meaning and will parse it. |#1| is the macro name in which we want to
% change the defaults.
@@ -2502,11 +2482,12 @@
\expandafter\ekvc at change@a\expandafter{\detokenize{macro:}}
% \end{macrocode}
% Next we expand the macro once to get its contents (including the current
-% default values with their markers). |#1| is either |\long| or empty, |#2| is
-% the macro.
+% default values with their markers) and place |\ekvc at stop| instead of an
+% argument as a marker for the last step. |#1| is either |\long| or empty,
+% |#2| is the macro.
% \begin{macrocode}
\protected\def\ekvc at change@b#1#2%
- {\expandafter\ekvc at change@c\expandafter{#2{##1}}{#1}#2}
+ {\expandafter\ekvc at change@c\expandafter{#2\ekvc at stop}{#1}#2}
% \end{macrocode}
% Here we place an unbalanced closing brace after the expansion of the macro.
% Then we just parse the \kv-list with |\ekvset|, that will exchange the
@@ -2518,25 +2499,24 @@
% \begin{macrocode}
\ekv at exparg{\protected\long\def\ekvc at change@c#1#2#3#4}%
{%
- \expandafter\iffalse\expandafter{\expandafter\fi
+ \expandafter\iffalse\expandafter{\expandafter{\expandafter\fi
\ekvset{\string#3}{#4}%
\ekvc at change@d{#2}{#3}%
#1%
- }%
+ }}%
}
% \end{macrocode}
-% The final step needs to put an unbalanced opening brace after |\def|. We do
-% that with the help of a temporary macro which stores everything necessary
-% for |\def| and expand an |\iffalse}\fi| construct to leave a single
-% opening brace. |#1| will be either empty or |\long| and |#2| is the macro.
-% Each of the macros defined with \expkvc\ takes exactly one parameter, so we
-% put that here as |####1|.
+% The final step needs to put an unbalanced opening brace after |\edef|. Also
+% we have to protect everything from further expanding with the exception of
+% the redefined macro's argument, which is why we placed the |\ekvc at stop|
+% earlier. Then we need to also protect the rest of the contents from further
+% expanding using |\unexpanded| with another unbalanced opening brace.
+% |#1| will be either empty or |\long| and |#2| is the macro.
% \begin{macrocode}
\protected\def\ekvc at change@d#1#2%
- {%
- \def\ekvc at tmp{#1\def#2####1}%
- \expandafter\ekvc at tmp\expandafter{\iffalse}\fi
- }
+ {#1\edef#2##1{\expandafter\ekvc at change@e\iffalse}\fi}
+\long\def\ekvc at change@e#1\ekvc at stop
+ {\ekv at unexpanded{#1}##1\ekv at unexpanded\expandafter{\iffalse}\fi}
% \end{macrocode}
% \end{macro}
%
@@ -3018,8 +2998,8 @@
% \end{macro}
%
% \begin{macro}{\ekvcFlagIf}
-% As already explained, truthiness is defined as a flag's height is odd, so we
-% just branch accordingly here.
+% As already explained, truthiness is defined as a flag's height being odd, so
+% we just branch accordingly here.
% \begin{macrocode}
\def\ekvcFlagIf#1%
{%
Modified: trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex 2021-11-21 21:11:31 UTC (rev 61108)
+++ trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex 2021-11-21 21:12:01 UTC (rev 61109)
@@ -36,8 +36,8 @@
\else
\expandafter\endinput
\fi
-\def\ekvcVersion{1.1a}
-\def\ekvcDate{2021-09-20}
+\def\ekvcVersion{1.1b}
+\def\ekvcDate{2021-11-21}
\csname ekvc at tmp\endcsname
\expandafter\chardef\csname ekvc at tmp\endcsname=\catcode`\@
\catcode`\@=11
@@ -149,7 +149,7 @@
}
\protected\long\def\ekvc at SetupSplitKeys
{%
- \ekvc at keycount=0
+ \ekvc at keycount=\ekv at zero
\let\ekvc at any@long\ekv at empty
\let\ekvc at initials\ekv at empty
\ekvparse\ekvc at SetupSplitKeys@check at unknown\ekvc at SetupSplitKeys@a
@@ -170,39 +170,25 @@
{\csname ekvc at split@p@#1\endcsname{#2}}%
{\ekvc at SetupSplitKeys@d{#1 #2}}%
}
-\protected\long\def\ekvc at SetupSplitKeys@d#1#2%
+\protected\def\ekvc at SetupSplitKeys@d
{%
- \begingroup
- \edef\ekvc at tmp
- {%
- \endgroup
- \long\def\ekv at unexpanded{\ekvc at tmp}####1####2%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname}####3%
- {%
- ####2%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname}{####1}%
- }%
- \unless\ifx\ekvc at long\long
- \let\ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(\detokenize{#1})\endcsname\ekvc at tmp}%
- \def\ekv at unexpanded{\ekvc at tmp}####1%
- {%
- \ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(\detokenize{#1})\endcsname}%
- {####1}%
- }%
- \fi
- \def\ekv at unexpanded{\ekvc at initials}%
- {%
- \ekv at unexpanded\expandafter{\ekvc at initials}%
- \ekv at unexpanded\expandafter
- {\csname ekvc at splitmark@\the\ekvc at keycount\endcsname{#2}}%
- }%
- }%
- \ekvc at tmp
- \ekvlet\ekvc at set{#1}\ekvc at tmp
+ \begingroup\expandafter\endgroup
+ \expandafter\ekvc at SetupSplitKeys@e
+ \csname ekvc at splitmark@\the\ekvc at keycount\endcsname
+ }
+\protected\long\def\ekvc at SetupSplitKeys@e#1#2#3%
+ {%
+ \long\def\ekvc at tmp##1##2#1##3{##2#1{##1}}%
+ \unless\ifx\ekvc at long\long
+ \expandafter\let\csname ekvc@\ekvc at set(#2)\endcsname\ekvc at tmp
+ \edef\ekvc at tmp##1%
+ {%
+ \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#2)\endcsname}%
+ {##1}%
+ }%
+ \fi
+ \ekvlet\ekvc at set{#2}\ekvc at tmp
+ \edef\ekvc at initials{\ekv at unexpanded\expandafter{\ekvc at initials#1{#3}}}%
\ekvc at helpers@needed
{\expandafter\ekvc at setup@splitmacro\expandafter{\the\ekvc at keycount}}%
{}%
@@ -391,39 +377,26 @@
{\csname ekvc at hash@p@#1\endcsname{#2}}%
{\ekvc at SetupHashKeys@d{#1 #2}}%
}
-\protected\long\def\ekvc at SetupHashKeys@d#1#2%
+\protected\long\def\ekvc at SetupHashKeys@d#1%
{%
- \begingroup
- \edef\ekvc at tmp
- {%
- \endgroup
- \long\def\ekv at unexpanded{\ekvc at tmp}####1####2%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname}%
- ####3%
- {%
- ####2%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname}%
- {####1}%
- }%
- \unless\ifx\ekvc at long\long
- \let\ekv at unexpanded\expandafter
- {\csname ekvc@\ekvc at set(#1)\endcsname\ekvc at tmp}%
- \def\ekv at unexpanded{\ekvc at tmp}####1%
- {%
- \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#1)\endcsname}%
- {####1}%
- }%
- \fi
- \def\ekv at unexpanded{\ekvc at initials}%
- {%
- \ekv at unexpanded\expandafter{\ekvc at initials}%
- \ekv at unexpanded\expandafter{\csname ekvc at hashmark@#1\endcsname{#2}}%
- }%
- }%
- \ekvc at tmp
- \ekvlet\ekvc at set{#1}\ekvc at tmp
- \ekvc at setup@hashmacro{#1}%
+ \begingroup\expandafter\endgroup
+ \expandafter\ekvc at SetupHashKeys@e\csname ekvc at hashmark@#1\endcsname{#1}%
}
+\protected\long\def\ekvc at SetupHashKeys@e#1#2#3%
+ {%
+ \long\def\ekvc at tmp##1##2#1##3{##2#1{##1}}%
+ \unless\ifx\ekvc at long\long
+ \expandafter\let\csname ekvc@\ekvc at set(#2)\endcsname\ekvc at tmp
+ \edef\ekvc at tmp##1%
+ {%
+ \ekv at unexpanded\expandafter{\csname ekvc@\ekvc at set(#2)\endcsname}%
+ {##1}%
+ }%
+ \fi
+ \ekvlet\ekvc at set{#2}\ekvc at tmp
+ \edef\ekvc at initials{\ekv at unexpanded\expandafter{\ekvc at initials#1{#3}}}%
+ \ekvc at setup@hashmacro{#2}%
+ }
\protected\long\def\ekvc at SetupHashKeys@check at unknown#1%
{%
\begingroup
@@ -616,20 +589,19 @@
}
\expandafter\ekvc at change@a\expandafter{\detokenize{macro:}}
\protected\def\ekvc at change@b#1#2%
- {\expandafter\ekvc at change@c\expandafter{#2{##1}}{#1}#2}
+ {\expandafter\ekvc at change@c\expandafter{#2\ekvc at stop}{#1}#2}
\ekv at exparg{\protected\long\def\ekvc at change@c#1#2#3#4}%
{%
- \expandafter\iffalse\expandafter{\expandafter\fi
+ \expandafter\iffalse\expandafter{\expandafter{\expandafter\fi
\ekvset{\string#3}{#4}%
\ekvc at change@d{#2}{#3}%
#1%
- }%
+ }}%
}
\protected\def\ekvc at change@d#1#2%
- {%
- \def\ekvc at tmp{#1\def#2####1}%
- \expandafter\ekvc at tmp\expandafter{\iffalse}\fi
- }
+ {#1\edef#2##1{\expandafter\ekvc at change@e\iffalse}\fi}
+\long\def\ekvc at change@e#1\ekvc at stop
+ {\ekv at unexpanded{#1}##1\ekv at unexpanded\expandafter{\iffalse}\fi}
\def\ekvc at change@iflong#1%
{%
\protected\def\ekvc at change@iflong##1%
More information about the tex-live-commits
mailing list.