diff options
author | Karl Berry <karl@freefriends.org> | 2021-09-21 19:46:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-09-21 19:46:07 +0000 |
commit | ee64a20c6539418161b3a70bab10555b70575916 (patch) | |
tree | b11dd8ede8ef2811f4faf9c065df33190051b887 /Master/texmf-dist/source | |
parent | 3fd04452cf9e67e310bd2dc1b151ff114655c8a0 (diff) |
expkv-cs (21sep21)
git-svn-id: svn://tug.org/texlive/trunk@60571 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx | 344 |
1 files changed, 197 insertions, 147 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 f0582ca2366..ffb706b2212 100644 --- a/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx +++ b/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx @@ -43,6 +43,7 @@ This work consists of the file expkv-cs.dtx and the derived files expkv-cs.pdf expkv-cs.sty expkv-cs.tex + t-expkv-cs.tex \endpreamble % stop docstrip adding \endinput @@ -50,6 +51,7 @@ and the derived files expkv-cs.pdf \endpostamble \generate{\file{expkv-cs.sty}{\from{expkv-cs.dtx}{pkg}}} \generate{\file{expkv-cs.tex}{\from{expkv-cs.dtx}{tex}}} +\generate{\file{t-expkv-cs.tex}{\from{expkv-cs.dtx}{ctx}}} \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else @@ -108,6 +110,7 @@ and the derived files expkv-cs.pdf TeX, textit,texttt, usepackage, + usemodule, } ,moretexcs=[6]^^A used packages { @@ -285,8 +288,8 @@ and the derived files expkv-cs.pdf \DoNotIndex{\protected,\ProvidesFile,\ProvidesPackage,\relax,\space,\advance} \DoNotIndex{\@,\unexpanded,\string,\expanded,\dimexpr,\global,\glueexpr,\hbox} \DoNotIndex{\numexpr,\RequirePackage,\setbox,\the,\unless,\xdef,\gdef,\newcount} -\DoNotIndex{\number,\detokenize,\meaning} -\DoNotIndex{\^,\@firstofone,\@firstoftwo,\@gobble,\@secondoftwo} +\DoNotIndex{\number,\detokenize,\meaning,\lccode,\lowercase} +\DoNotIndex{\^,\\,\@firstofone,\@firstoftwo,\@gobble,\@secondoftwo} \DoNotIndex{\ifcsname} \DoNotIndex{\ifx} \DoNotIndex{\ifodd} @@ -372,12 +375,13 @@ and the derived files expkv-cs.pdf % |\ekvcSplit|, is very convenient in my opinion, so if you just want to define % a single macro with just a few keys this might be the way to go. % -% \expkvc\ is usable as generic code and as a \LaTeX\ package. It'll -% automatically load \expkv\ in the same mode as well. To use it, just use one -% of +% \expkvc\ is usable as generic code, as a \LaTeX\ package, and as a \ConTeXt\ +% module. It'll automatically load \expkv\ in the same mode as well. To use it, +% just use one of % \begin{lstlisting} -% \usepackage{expkv-cs} % LaTeX % \input expkv-cs % plainTeX +% \usepackage{expkv-cs} % LaTeX +% \usemodule[expkv-cs] % ConTeXt % \end{lstlisting} % % @@ -1523,6 +1527,22 @@ and the derived files expkv-cs.pdf % \gobbledocstriptag %</pkg> %^^A=<< +%^^A the ConTeXt module >>= +% \subsection{The \ConTeXt\ module} +% \gobbledocstriptag +%<*ctx> +% \begin{macrocode} +\writestatus{loading}{ConTeXt User Module / expkv-cs} +\usemodule[expkv] +\unprotect +\input expkv-cs.tex +\writestatus{loading} + {ConTeXt User Module / expkv-cs / Version \ekvcVersion\space loaded} +\protect\endinput +% \end{macrocode} +% \gobbledocstriptag +%</ctx> +%^^A=<< %^^A main file >>= % \subsection{The Generic Code} % The rest of this implementation will be the generic code. @@ -1548,8 +1568,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{1.1} -\def\ekvcDate{2021-07-07} +\def\ekvcVersion{1.1a} +\def\ekvcDate{2021-09-20} % \end{macrocode} % \end{macro} % @@ -1636,9 +1656,9 @@ and the derived files expkv-cs.pdf } \def\ekvc@ekvset@pre@expander@b#1\ekvc@stop#2\ekvc@stop {% - \unexpanded\expandafter{\ekv@alignsafe}% - \unexpanded{#1}##1\unexpanded{#2}% - \unexpanded\expandafter{\ekv@endalignsafe}% + \ekv@unexpanded\expandafter{\ekv@alignsafe}% + \ekv@unexpanded{#1}##1\ekv@unexpanded{#2}% + \ekv@unexpanded\expandafter{\ekv@endalignsafe}% } % \end{macrocode} % \end{macro} @@ -1675,17 +1695,17 @@ and the derived files expkv-cs.pdf \ekvc@any@long\edef#1##1% {% \expandafter\ekvc@ekvset@pre@expander\expandafter{\ekvc@set}% - \unexpanded\expandafter + \ekv@unexpanded\expandafter {\csname ekvc@split@\the\ekvc@keycount\endcsname}% - \unexpanded\expandafter{\ekvc@initials{}#2}% + \ekv@unexpanded\expandafter{\ekvc@initials{}#2}% }% }% {% \ekvc@any@long\edef#1##1% {% \expandafter\ekvc@ekvset@pre@expander\expandafter{\ekvc@set}% - \unexpanded{#2}% - \unexpanded\expandafter{\ekvc@initials}% + \ekv@unexpanded{#2}% + \ekv@unexpanded\expandafter{\ekvc@initials}% }% }% } @@ -1743,7 +1763,7 @@ and the derived files expkv-cs.pdf {% \begingroup \edef\ekvc@tmp - {\endgroup\def\unexpanded{\ekvc@tmp}{\ekvcSplit@build@argspec@{1}}}% + {\endgroup\def\ekv@unexpanded{\ekvc@tmp}{\ekvcSplit@build@argspec@{1}}}% \ekvc@tmp } \def\ekvcSplit@build@argspec@#1% @@ -1753,7 +1773,7 @@ and the derived files expkv-cs.pdf \fi \@firstofone {% - \unexpanded\expandafter{\csname ekvc@splitmark@#1\endcsname####}#1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@#1\endcsname####}#1% \expandafter\ekvcSplit@build@argspec@\expandafter{\the\numexpr#1+1}% }% } @@ -1763,7 +1783,7 @@ and the derived files expkv-cs.pdf % \begin{macro}[internal] % { % \ekvc@SetupSplitKeys, \ekvc@SetupSplitKeys@a, \ekvc@SetupSplitKeys@b, -% \ekvc@SetupSplitKeys@c, +% \ekvc@SetupSplitKeys@c, \ekvc@SetupSplitKeys@d % \ekvc@SetupSplitKeys@check@unknown,\ekvc@SetupSplitKeys@unknown % } % These macros parse the list of keys and set up the key macros. First we need @@ -1780,24 +1800,26 @@ and the derived files expkv-cs.pdf % Then we need to step the key counter for each key. Also we have to check % whether this key has a |long| prefix so we initialise |\ekvc@long|. % \begin{macrocode} -\protected\def\ekvc@SetupSplitKeys@a#1% +\protected\long\def\ekvc@SetupSplitKeys@a#1% + {\expandafter\ekvc@SetupSplitKeys@b\detokenize{#1}\ekvc@stop} +\protected\def\ekvc@SetupSplitKeys@b#1\ekvc@stop {% \advance\ekvc@keycount1 \let\ekvc@long\ekv@empty \ekvc@ifspace{#1}% - {\ekvc@SetupSplitKeys@b#1\ekvc@stop}% - {\ekvc@SetupSplitKeys@c{#1}}% + {\ekvc@SetupSplitKeys@c#1\ekvc@stop}% + {\ekvc@SetupSplitKeys@d{#1}}% } % \end{macrocode} % If there was a space, there might be a prefix. If so call the prefix macro, -% else call the next step |\ekvc@SetupSplitKeys@c| which will define the key +% else call the next step |\ekvc@SetupSplitKeys@d| which will define the key % macro and add the key's value to the initials list. % \begin{macrocode} -\protected\def\ekvc@SetupSplitKeys@b#1 #2\ekvc@stop +\protected\long\def\ekvc@SetupSplitKeys@c#1 #2\ekvc@stop {% \ekv@ifdefined{ekvc@split@p@#1}% {\csname ekvc@split@p@#1\endcsname{#2}}% - {\ekvc@SetupSplitKeys@c{#1 #2}}% + {\ekvc@SetupSplitKeys@d{#1 #2}}% } % \end{macrocode} % The inner definition is grouped, because we don't want to actually define @@ -1807,18 +1829,18 @@ and the derived files expkv-cs.pdf % 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@setup@splitmacro|. % \begin{macrocode} -\protected\long\def\ekvc@SetupSplitKeys@c#1#2% +\protected\long\def\ekvc@SetupSplitKeys@d#1#2% {% \begingroup \edef\ekvc@tmp {% \endgroup - \long\def\unexpanded{\ekvc@tmp}####1####2% - \unexpanded\expandafter + \long\def\ekv@unexpanded{\ekvc@tmp}####1####2% + \ekv@unexpanded\expandafter {\csname ekvc@splitmark@\the\ekvc@keycount\endcsname}####3% {% ####2% - \unexpanded\expandafter + \ekv@unexpanded\expandafter {\csname ekvc@splitmark@\the\ekvc@keycount\endcsname}{####1}% }% % \end{macrocode} @@ -1829,18 +1851,19 @@ and the derived files expkv-cs.pdf % reordering. % \begin{macrocode} \unless\ifx\ekvc@long\long - \let\unexpanded\expandafter - {\csname ekvc@\ekvc@set(#1)\endcsname\ekvc@tmp}% - \def\unexpanded{\ekvc@tmp}####1% + \let\ekv@unexpanded\expandafter + {\csname ekvc@\ekvc@set(\detokenize{#1})\endcsname\ekvc@tmp}% + \def\ekv@unexpanded{\ekvc@tmp}####1% {% - \unexpanded\expandafter{\csname ekvc@\ekvc@set(#1)\endcsname}% + \ekv@unexpanded\expandafter + {\csname ekvc@\ekvc@set(\detokenize{#1})\endcsname}% {####1}% }% \fi - \def\unexpanded{\ekvc@initials}% + \def\ekv@unexpanded{\ekvc@initials}% {% - \unexpanded\expandafter{\ekvc@initials}% - \unexpanded\expandafter + \ekv@unexpanded\expandafter{\ekvc@initials}% + \ekv@unexpanded\expandafter {\csname ekvc@splitmark@\the\ekvc@keycount\endcsname{#2}}% }% }% @@ -1886,7 +1909,7 @@ and the derived files expkv-cs.pdf {##3#1{##4,##2= {##1} }}% \long\expandafter\def\csname\ekv@name\ekvc@set{}uN\endcsname##1##2#1##3% {##2#1{##3,##1}}% - \edef\ekvc@initials{\unexpanded\expandafter{\ekvc@initials#1{}}}% + \edef\ekvc@initials{\ekv@unexpanded\expandafter{\ekvc@initials#1{}}}% \ekvc@helpers@needed {\expandafter\ekvc@setup@splitmacro\expandafter{\the\ekvc@keycount}}% {}% @@ -1902,7 +1925,7 @@ and the derived files expkv-cs.pdf {% \let\ekvc@long\long \let\ekvc@any@long\long - \ekvc@SetupSplitKeys@c + \ekvc@SetupSplitKeys@d } % \end{macrocode} % \end{macro} @@ -1911,7 +1934,7 @@ and the derived files expkv-cs.pdf % The |short| prefix does essentially nothing, it is only provided to allow % key names starting with |long| that aren't |\long|. % \begin{macrocode} -\def\ekvc@split@p@short{\ekvc@SetupSplitKeys@c} +\def\ekvc@split@p@short{\ekvc@SetupSplitKeys@d} % \end{macrocode} % \end{macro} % @@ -1939,53 +1962,53 @@ and the derived files expkv-cs.pdf \begingroup \edef\ekvc@tmp {% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@1\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@1\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}% ##1##2##3% {##3{##1}##2}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@2\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@2\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% ##3##4% {##4{##1}{##2}##3}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@3\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% - \unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@3\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% ##4##5% {##5{##1}{##2}{##3}##4}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@4\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% - \unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% - \unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@4\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% ##5##6% {##6{##1}{##2}{##3}{##4}##5}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@5\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% - \unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% - \unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% - \unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@5\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% ##6##7% {##7{##1}{##2}{##3}{##4}{##5}##6}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@6\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% - \unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% - \unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% - \unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% - \unexpanded\expandafter{\csname ekvc@splitmark@6\endcsname}##6% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@6\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@6\endcsname}##6% ##7##8% {##8{##1}{##2}{##3}{##4}{##5}{##6}##7}% - \long\gdef\unexpanded\expandafter{\csname ekvc@split@7\endcsname}% - \unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% - \unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% - \unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% - \unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% - \unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% - \unexpanded\expandafter{\csname ekvc@splitmark@6\endcsname}##6% - \unexpanded\expandafter{\csname ekvc@splitmark@7\endcsname}##7% + \long\gdef\ekv@unexpanded\expandafter{\csname ekvc@split@7\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@1\endcsname}##1% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@2\endcsname}##2% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@3\endcsname}##3% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@4\endcsname}##4% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@5\endcsname}##5% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@6\endcsname}##6% + \ekv@unexpanded\expandafter{\csname ekvc@splitmark@7\endcsname}##7% ##8##9% {##9{##1}{##2}{##3}{##4}{##5}{##6}{##7}##8}% } @@ -1999,12 +2022,13 @@ and the derived files expkv-cs.pdf \edef\ekvc@tmp {% \long\gdef - \unexpanded\expandafter{\csname ekvc@split@#1\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@split@#1\endcsname}% ####1% - \unexpanded\expandafter{\csname ekvc@splitmark@#1\endcsname}% + \ekv@unexpanded\expandafter + {\csname ekvc@splitmark@#1\endcsname}% ####2####3% {% - \unexpanded\expandafter + \ekv@unexpanded\expandafter {\csname ekvc@split@\the\numexpr#1-1\relax\endcsname}% ####1{{####2}####3}% }% @@ -2043,16 +2067,16 @@ and the derived files expkv-cs.pdf \ekvc@any@long\edef#1##1% {% \expandafter\ekvc@ekvset@pre@expander\expandafter{\ekvc@set}% - \unexpanded{\ekvc@hash@pack@argument}% - \unexpanded\expandafter{\ekvc@initials\ekvc@stop#2}% + \ekv@unexpanded{\ekvc@hash@pack@argument}% + \ekv@unexpanded\expandafter{\ekvc@initials\ekvc@stop#2}% }% }% {% \ekvc@any@long\edef#1##1% {% \expandafter\ekvc@ekvset@pre@expander\expandafter{\ekvc@set}% - \unexpanded{#2}% - \unexpanded\expandafter{\ekvc@initials\ekvc@stop}% + \ekv@unexpanded{#2}% + \ekv@unexpanded\expandafter{\ekvc@initials\ekvc@stop}% }% }% } @@ -2102,9 +2126,9 @@ and the derived files expkv-cs.pdf % \end{macro} % % \begin{macro}[internal] -% {% +% { % \ekvc@SetupHashKeys,\ekvc@SetupHashKeys@a,\ekvc@SetupHashKeys@b, -% \ekvc@SetupHashKeys@c, +% \ekvc@SetupHashKeys@c,\ekvc@SetupHashKeys@d % \ekvc@SetupHashKeys@check@unknown,\ekvc@SetupHashKeys@unknown % } % This should look awfully familiar as well, since it's just the same as for @@ -2116,18 +2140,20 @@ and the derived files expkv-cs.pdf \let\ekvc@initials\ekv@empty \ekvparse\ekvc@SetupHashKeys@check@unknown\ekvc@SetupHashKeys@a{#1}% } -\protected\def\ekvc@SetupHashKeys@a#1% +\protected\long\def\ekvc@SetupHashKeys@a#1% + {\expandafter\ekvc@SetupHashKeys@b\detokenize{#1}\ekvc@stop} +\protected\def\ekvc@SetupHashKeys@b#1\ekvc@stop {% \let\ekvc@long\ekv@empty \ekvc@ifspace{#1}% - {\ekvc@SetupHashKeys@b#1\ekvc@stop}% - {\ekvc@SetupHashKeys@c{#1}}% + {\ekvc@SetupHashKeys@c#1\ekvc@stop}% + {\ekvc@SetupHashKeys@d{#1}}% } -\protected\def\ekvc@SetupHashKeys@b#1 #2\ekvc@stop +\protected\def\ekvc@SetupHashKeys@c#1 #2\ekvc@stop {% \ekv@ifdefined{ekvc@hash@p@#1}% {\csname ekvc@hash@p@#1\endcsname{#2}}% - {\ekvc@SetupHashKeys@c{#1 #2}}% + {\ekvc@SetupHashKeys@d{#1 #2}}% } % \end{macrocode} % Yes, even the defining macro looks awfully familiar. Instead of numbered we @@ -2136,31 +2162,33 @@ and the derived files expkv-cs.pdf % short keys. And instead of the |\ekvc@setup@splitmacro| we use % |\ekvc@setup@hashmacro|. % \begin{macrocode} -\protected\long\def\ekvc@SetupHashKeys@c#1#2% +\protected\long\def\ekvc@SetupHashKeys@d#1#2% {% \begingroup \edef\ekvc@tmp {% \endgroup - \long\def\unexpanded{\ekvc@tmp}####1####2% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}####3% + \long\def\ekv@unexpanded{\ekvc@tmp}####1####2% + \ekv@unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% + ####3% {% ####2% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}{####1}% + \ekv@unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% + {####1}% }% \unless\ifx\ekvc@long\long - \let\unexpanded\expandafter + \let\ekv@unexpanded\expandafter {\csname ekvc@\ekvc@set(#1)\endcsname\ekvc@tmp}% - \def\unexpanded{\ekvc@tmp}####1% + \def\ekv@unexpanded{\ekvc@tmp}####1% {% - \unexpanded\expandafter{\csname ekvc@\ekvc@set(#1)\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@\ekvc@set(#1)\endcsname}% {####1}% }% \fi - \def\unexpanded{\ekvc@initials}% + \def\ekv@unexpanded{\ekvc@initials}% {% - \unexpanded\expandafter{\ekvc@initials}% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname{#2}}% + \ekv@unexpanded\expandafter{\ekvc@initials}% + \ekv@unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname{#2}}% }% }% \ekvc@tmp @@ -2192,7 +2220,7 @@ and the derived files expkv-cs.pdf \let\csname\ekv@name\ekvc@set{}u\endcsname\ekvc@hash@unknown@kv \expandafter \let\csname\ekv@name\ekvc@set{}uN\endcsname\ekvc@hash@unknown@k - \edef\ekvc@initials{\unexpanded\expandafter{\ekvc@initials#1{}}}% + \edef\ekvc@initials{\ekv@unexpanded\expandafter{\ekvc@initials#1{}}}% \ekvc@setup@hashmacro{...}% }% \long\def\ekvc@hash@unknown@kv##1##2##3#1##4{##3#1{##4,##2= {##1} }}% @@ -2210,7 +2238,7 @@ and the derived files expkv-cs.pdf {% \let\ekvc@long\long \let\ekvc@any@long\long - \ekvc@SetupHashKeys@c + \ekvc@SetupHashKeys@d } % \end{macrocode} % \end{macro} @@ -2219,7 +2247,7 @@ and the derived files expkv-cs.pdf % The |short| prefix does essentially nothing, it is only provided to allow % key names starting with |long| that aren't |\long|. % \begin{macrocode} -\def\ekvc@hash@p@short{\ekvc@SetupHashKeys@c} +\def\ekvc@hash@p@short{\ekvc@SetupHashKeys@d} % \end{macrocode} % \end{macro} % @@ -2240,47 +2268,52 @@ and the derived files expkv-cs.pdf \edef\ekvc@tmp {% \long\gdef - \unexpanded\expandafter{\csname ekvc@fasthash@#1\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@fasthash@#1\endcsname}% ####1% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% - ####2####3\unexpanded{\ekvc@stop}% + \ekv@unexpanded\expandafter + {\csname ekvc@hashmark@#1\endcsname}% + ####2####3\ekv@unexpanded{\ekvc@stop}% {####2}% \long\gdef - \unexpanded\expandafter{\csname ekvc@safehash@#1\endcsname}% + \ekv@unexpanded\expandafter{\csname ekvc@safehash@#1\endcsname}% ####1% {% - \unexpanded\expandafter{\csname ekvc@@safehash@#1\endcsname}% - ####1\unexpanded{\ekvc@mark}{}% - \unexpanded\expandafter + \ekv@unexpanded\expandafter + {\csname ekvc@@safehash@#1\endcsname}% + ####1\ekv@unexpanded{\ekvc@mark}{}% + \ekv@unexpanded\expandafter {% \csname ekvc@hashmark@#1\endcsname{}% \ekvc@mark{\ekvc@err@missing@hash{#1}}\ekvc@stop }% }% \long\gdef - \unexpanded\expandafter{\csname ekvc@@safehash@#1\endcsname}% + \ekv@unexpanded\expandafter + {\csname ekvc@@safehash@#1\endcsname}% ####1% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% - ####2####3\unexpanded{\ekvc@mark}####4####5% - \unexpanded{\ekvc@stop}% + \ekv@unexpanded\expandafter + {\csname ekvc@hashmark@#1\endcsname}% + ####2####3\ekv@unexpanded{\ekvc@mark}####4####5% + \ekv@unexpanded{\ekvc@stop}% {% ####4{####2}% }% - \long\gdef\unexpanded\expandafter + \long\gdef\ekv@unexpanded\expandafter {\csname ekvc@fastsplithash@#1\endcsname}% ####1% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% - ####2####3\unexpanded{\ekvc@stop}####4% + \ekv@unexpanded\expandafter + {\csname ekvc@hashmark@#1\endcsname}% + ####2####3\ekv@unexpanded{\ekvc@stop}####4% {% ####4{####2}% }% - \long\gdef\unexpanded\expandafter + \long\gdef\ekv@unexpanded\expandafter {\csname ekvc@safesplithash@#1\endcsname}####1% {% - \unexpanded\expandafter + \ekv@unexpanded\expandafter {\csname ekvc@@safesplithash@#1\endcsname}% - ####1\unexpanded{\ekvc@mark\ekvc@safe@after@hash}% - \unexpanded\expandafter + ####1\ekv@unexpanded{\ekvc@mark\ekvc@safe@after@hash}% + \ekv@unexpanded\expandafter {% \csname ekvc@hashmark@#1\endcsname{}% \ekvc@mark @@ -2288,12 +2321,13 @@ and the derived files expkv-cs.pdf \ekvc@stop }% }% - \long\gdef\unexpanded\expandafter + \long\gdef\ekv@unexpanded\expandafter {\csname ekvc@@safesplithash@#1\endcsname}% ####1% - \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% - ####2####3\unexpanded{\ekvc@mark}####4####5% - \unexpanded{\ekvc@stop}% + \ekv@unexpanded\expandafter + {\csname ekvc@hashmark@#1\endcsname}% + ####2####3\ekv@unexpanded{\ekvc@mark}####4####5% + \ekv@unexpanded{\ekvc@stop}% {% ####4{####2}% }% @@ -2306,32 +2340,42 @@ and the derived files expkv-cs.pdf % \end{macro} % % \begin{macro}{\ekvcValue} +% \begin{macro}[internal]{\ekvcValue@} % All this does is a few consistency checks on the first argument (not empty, % 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% {% - \unexpanded + \ekv@unexpanded + \expandafter\ekvcValue@\detokenize{#1}\ekvc@stop + } +\def\ekvcValue@#1\ekvc@stop + {% \ekv@ifdefined{ekvc@safehash@#1}% {\csname ekvc@safehash@#1\endcsname}% {\ekvc@err@unknown@hash{#1}\@firstoftwo{{}}}% } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\ekvcValueFast} % To be as fast as possible, this doesn't test for anything, assuming the user % knows best. % \begin{macrocode} -\long\def\ekvcValueFast#1#2{\csname ekvc@fasthash@#1\endcsname#2\ekvc@stop} +\long\def\ekvcValueFast#1#2% + {\csname ekvc@fasthash@\detokenize{#1}\endcsname#2\ekvc@stop} % \end{macrocode} % \end{macro} % -% \begin{macro}{\ekvcValueSplit,\ekvcValueSplit@recover} +% \begin{macro}{\ekvcValueSplit} +% \begin{macro}[internal]{\ekvcValueSplit@,\ekvcValueSplit@recover} % This splits off a single value. % \begin{macrocode} \long\def\ekvcValueSplit#1% + {\expandafter\ekvcValueSplit@\detokenize{#1}\ekvc@stop} +\def\ekvcValueSplit@#1\ekvc@stop {% \ekv@ifdefined{ekvc@safesplithash@#1}% {\csname ekvc@safesplithash@#1\endcsname}% @@ -2340,6 +2384,7 @@ and the derived files expkv-cs.pdf \long\def\ekvcValueSplit@recover#1#2{#2{}} % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[internal]{\ekvc@safe@after@hash} % \begin{macrocode} @@ -2357,7 +2402,7 @@ and the derived files expkv-cs.pdf % sequence. % \begin{macrocode} \long\def\ekvcValueSplitFast#1#2% - {\csname ekvc@fastsplithash@#1\endcsname#2\ekvc@stop} + {\csname ekvc@fastsplithash@\detokenize{#1}\endcsname#2\ekvc@stop} % \end{macrocode} % \end{macro} % @@ -2380,6 +2425,8 @@ and the derived files expkv-cs.pdf % \end{macro} % % \begin{macro}{\ekvcSecondaryKeys} +% \begin{macro}[internal] +% {\ekvcSecondaryKeys@a,\ekvcSecondaryKeys@b,\ekvcSecondaryKeys@c} % The secondary keys are defined pretty similar to the way the originals are, % but here we also introduce some key types (those have a |@t@| in their name) % additionally to the prefixes. @@ -2389,14 +2436,16 @@ and the derived files expkv-cs.pdf \edef\ekvc@set{\string#1}% \ekvparse\ekvc@err@value@required\ekvcSecondaryKeys@a{#2}% } -\protected\def\ekvcSecondaryKeys@a#1% +\protected\long\def\ekvcSecondaryKeys@a#1% + {\expandafter\ekvcSecondaryKeys@b\detokenize{#1}\ekvc@stop} +\protected\def\ekvcSecondaryKeys@b#1\ekvc@stop {% \let\ekvc@long\ekv@empty \ekvc@ifspace{#1}% - {\ekvcSecondaryKeys@b#1\ekvc@stop}% + {\ekvcSecondaryKeys@c#1\ekvc@stop}% {\ekvc@err@missing@type{#1}\@gobble}% } -\protected\def\ekvcSecondaryKeys@b#1 #2\ekvc@stop +\protected\def\ekvcSecondaryKeys@c#1 #2\ekvc@stop {% \ekv@ifdefined{ekvc@p@#1}% {\csname ekvc@p@#1\endcsname}% @@ -2409,6 +2458,7 @@ and the derived files expkv-cs.pdf } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\ekvcChange} % This can be used to change the defaults of an \expkvc\ defined macro. It @@ -2616,7 +2666,7 @@ and the derived files expkv-cs.pdf \ekvc@assert@not@long{default #1}% \edef\ekvc@tmp {% - \unexpanded\expandafter + \ekv@unexpanded\expandafter {\csname\ekv@name\ekvc@set{#1}\endcsname{#2}}% }% \ekvletNoVal\ekvc@set{#1}\ekvc@tmp @@ -2882,8 +2932,8 @@ and the derived files expkv-cs.pdf {% \edef#1% {% - \unexpanded{\ekvc@flag@height}% - \unexpanded\expandafter{\csname\ekvc@flag@name#1\endcsname}% + \ekv@unexpanded{\ekvc@flag@height}% + \ekv@unexpanded\expandafter{\csname\ekvc@flag@name#1\endcsname}% }% \ekv@expargtwice {\expandafter\def\csname\ekvc@flag@name#1\endcsname##1}% @@ -3100,7 +3150,7 @@ and the derived files expkv-cs.pdf % \begin{macrocode} \def\ekvc@extract@mark#1{\expandafter\ekvc@extract@mark@\meaning#1\ekv@stop} \begingroup -\lccode`;=`\# +\lccode`;=`# \lccode`/=`\\ \lowercase{\endgroup \def\ekvc@extract@mark@#1:#2/#3 ;#4\ekv@stop{#3}% @@ -3142,41 +3192,41 @@ and the derived files expkv-cs.pdf {% \errmessage{expkv-cs Error: Too many keys for macro `\string#1'}% } -\protected\def\ekvc@err@value@required#1% +\protected\long\def\ekvc@err@value@required#1% {% - \errmessage{expkv-cs Error: Missing value for key `\unexpanded{#1}'}% + \errmessage{expkv-cs Error: Missing value for key `\ekv@unexpanded{#1}'}% } -\protected\def\ekvc@err@missing@type#1% +\protected\long\def\ekvc@err@missing@type#1% {% \errmessage - {expkv-cs Error: Missing type for secondary key `\unexpanded{#1}'}% + {expkv-cs Error: Missing type for secondary key `\ekv@unexpanded{#1}'}% } -\protected\def\ekvc@err@no@long#1% +\protected\long\def\ekvc@err@no@long#1% {% \errmessage - {expkv-cs Error: prefix `long' not accepted for `\unexpanded{#1}'}% + {expkv-cs Error: prefix `long' not accepted for `\ekv@unexpanded{#1}'}% } -\protected\def\ekvc@err@already@defined#1% +\protected\long\def\ekvc@err@already@defined#1% {% \errmessage{expkv-cs Error: Macro `\string#1' already defined}% } -\protected\def\ekvc@err@unknown@keytype#1% +\protected\long\def\ekvc@err@unknown@keytype#1% {% - \errmessage{expkv-cs Error: Unknown key type `\unexpanded{#1}'}% + \errmessage{expkv-cs Error: Unknown key type `\ekv@unexpanded{#1}'}% } -\protected\def\ekvc@err@unknown@key#1% +\protected\long\def\ekvc@err@unknown@key#1% {% \errmessage - {expkv-cs Error: Unknown key `\unexpanded{#1}' for macro `\ekvc@set'}% + {expkv-cs Error: Unknown key `\ekv@unexpanded{#1}' for macro `\ekvc@set'}% } -\long\def\ekvc@err@no@key@macro#1% +\protected\long\def\ekvc@err@no@key@macro#1% {\errmessage{expkv-cs Error: \string#1 is no key=val macro}} \protected\long\def\ekvc@err@not@two#1% {% \errmessage {% - expkv-cs Error: Definition of `\unexpanded{#1}' doesn't contain exactly - two arguments% + expkv-cs Error: Definition of `\ekv@unexpanded{#1}' doesn't contain + exactly two arguments% }% } % \end{macrocode} |