From 6c15c4fc80a80df5104f2e9214a877d5da3a3284 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 12 Apr 2021 20:04:05 +0000 Subject: expkv-cs (12apr21) git-svn-id: svn://tug.org/texlive/trunk@58852 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/generic/expkv-cs/expkv-cs.tex | 163 ++++++++++++++++++--- 1 file changed, 144 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex/generic') 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 38f5d3af810..8bcce4fcee5 100644 --- a/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex +++ b/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2020 Jonathan P. Spratte +%% Copyright (C) 2020-2021 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -35,12 +35,11 @@ \else \expandafter\endinput \fi -\def\ekvcVersion{0.6} -\def\ekvcDate{2020-10-18} +\def\ekvcVersion{0.8} +\def\ekvcDate{2021-04-12} \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{} @@ -398,10 +397,10 @@ ####1% {% \unexpanded\expandafter{\csname ekvc@@safehash@#1\endcsname}% - ####1\unexpanded{\ekvc@mark\ekvc@zero}% + ####1\unexpanded{\ekvc@mark\ekv@zero}% \unexpanded\expandafter {% - \csname ekvc@hashmark@#1\endcsname\ekvc@zero + \csname ekvc@hashmark@#1\endcsname\ekv@zero \ekvc@mark{\ekvc@err@missing@hash{#1}}\ekvc@stop }% }% @@ -454,7 +453,7 @@ \romannumeral \ekv@ifdefined{ekvc@safehash@#1}% {\csname ekvc@safehash@#1\endcsname}% - {\ekvc@err@unknown@hash{#1}\@firstoftwo\ekvc@zero}% + {\ekvc@err@unknown@hash{#1}\@firstoftwo\ekv@zero}% } \long\def\ekvcValueFast#1#2{\csname ekvc@fasthash@#1\endcsname#2\ekvc@stop} \long\def\ekvcValueSplit#1% @@ -479,7 +478,7 @@ {% \csname ekvc@fastsplithash@#1\endcsname#2\ekvc@stop } -\long\def\ekvc@safehash@#1{\ekvc@err@empty@hash\ekvc@zero} +\long\def\ekvc@safehash@#1{\ekvc@err@empty@hash\ekv@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}{}} @@ -577,6 +576,138 @@ }% {\ekvc@err@unknown@key{#1}}% } +\protected\expandafter\def\csname ekvc@t@flag-bool\endcsname#1#2% + {% + \ekvc@assert@not@long{flag-bool #1}% + \unless\ifdefined#2\ekvcFlagNew#2\fi + \ekvdef\ekvc@set{#1}% + {% + \ekv@ifdefined{ekvc@flag@set@##1}% + {% + \csname ekvc@flag@set@##1\expandafter\endcsname + \ekvcFlagHeight#2\ekv@stop#2% + }% + {\ekvc@err@invalid@bool{##1}}% + }% + } +\protected\def\ekvc@type@flag#1#2#3#4% + {% + \ekvc@assert@not@long{flag-#1 #3}% + \unless\ifdefined#4\ekvcFlagNew#4\fi + \ekv@exparg{\ekvdefNoVal\ekvc@set{#3}}{#2#4}% + } +\protected\expandafter\def\csname ekvc@t@flag-true\endcsname + {\ekvc@type@flag{true}\ekvcFlagSetTrue} +\protected\expandafter\def\csname ekvc@t@flag-false\endcsname + {\ekvc@type@flag{false}\ekvcFlagSetFalse} +\protected\expandafter\def\csname ekvc@t@flag-raise\endcsname + {\ekvc@type@flag{raise}\ekvcFlagRaise} +\def\ekvc@flag@name{ekvcf\string} +\def\ekvc@flag@namescheme#1#2{ekvch#2#1} +\let\ekvcFlagHeight\number +\protected\def\ekvcFlagNew#1% + {% + \edef#1% + {% + \unexpanded{\ekvc@flag@height}% + \unexpanded\expandafter{\csname\ekvc@flag@name#1\endcsname}% + }% + \ekv@expargtwice + {\expandafter\def\csname\ekvc@flag@name#1\endcsname##1}% + {\expandafter\ekvc@flag@namescheme\expandafter{\string#1}{##1}}% + } +\def\ekvc@flag@height#1% + {% + \ifcsname#10\endcsname + \ekvc@flag@height@1\ekv@stop#1% + \fi + \@firstofone{0} % leave this space + } +\def\ekvc@flag@height@#1\ekv@stop#2\fi\@firstofone#3% + {% + \fi + \ifcsname#2{#1}\endcsname + \expandafter\ekvc@flag@height@\the\numexpr#1+1\relax\ekv@stop#2% + \fi + \@firstofone{#1}% + } +\ekv@exparg{\def\ekvcFlagRaise#1}% + {% + \expandafter\expandafter\expandafter\@gobble\expandafter + \csname\ekvc@flag@namescheme{\string#1}{\ekvcFlagHeight#1}\endcsname + } +\def\ekvcFlagSetTrue#1% + {\expandafter\ekvc@flag@set@true\ekvcFlagHeight#1\ekv@stop#1} +\def\ekvcFlagSetFalse#1% + {\expandafter\ekvc@flag@set@false\ekvcFlagHeight#1\ekv@stop#1} +\def\ekvc@flag@set@true#1% + {% + \def\ekvc@flag@set@true##1\ekv@stop##2% + {% + \ifodd##1 + \ekv@fi@gobble + \fi + \@firstofone{\expandafter\@gobble\csname#1\endcsname}% + }% + \def\ekvc@flag@set@false##1\ekv@stop##2% + {% + \ifodd##1 + \ekv@fi@firstofone + \fi + \@gobble{\expandafter\@gobble\csname#1\endcsname}% + }% + } +\expandafter\ekvc@flag@set@true\expandafter + {\ekvc@flag@namescheme{\string#2}{#1}} +\def\ekvcFlagIf#1% + {% + \ifodd#1% + \ekv@fi@firstoftwo + \fi + \@secondoftwo + } +\ekv@exparg{\def\ekvcFlagIfRaised#1}% + {% + \expandafter\ifcsname\ekvc@flag@namescheme{\string#1}0\endcsname + \ekv@fi@firstoftwo + \fi + \@secondoftwo + } +\protected\def\ekvcFlagReset#1% + {\expandafter\ekvc@flag@reset\csname\ekvc@flag@name#1\endcsname} +\protected\def\ekvc@flag@reset#1% + {% + \ifcsname#10\endcsname + \expandafter\let\csname#10\endcsname\ekvc@undefined + \ekvc@flag@reset@1\ekv@stop#1% + \fi + } +\protected\def\ekvc@flag@reset@#1\ekv@stop#2\fi + {% + \fi + \ifcsname#2{#1}\endcsname + \expandafter\let\csname#2{#1}\endcsname\ekvc@undefined + \expandafter\ekvc@flag@reset@\the\numexpr#1+1\relax\ekv@stop#2% + \fi + } +\def\ekvcFlagGetHeight#1% + {\expandafter\ekvc@flag@get@height@single\ekvcFlagHeight#1\ekv@stop} +\long\def\ekvc@flag@get@height@single#1\ekv@stop#2{#2{#1}} +\def\ekvcFlagGetHeights#1% + {% + \ekvc@flag@get@heights#1\ekv@stop{}% + } +\def\ekvc@flag@get@heights#1% + {% + \ekv@gobbleto@stop#1\ekvc@flag@get@heights@done\ekv@stop + \expandafter\ekvc@flag@get@heights@\ekvcFlagHeight#1\ekv@stop + } +\def\ekvc@flag@get@heights@#1\ekv@stop#2\ekv@stop#3% + {\ekvc@flag@get@heights#2\ekv@stop{#3{#1}}} +\long\def\ekvc@flag@get@heights@done + \ekv@stop + \expandafter\ekvc@flag@get@heights@\ekvcFlagHeight\ekv@stop\ekv@stop#1#2% + {#2{#1}} \long\def\ekvc@ifspace#1% {% \ekvc@ifspace@#1 \ekv@ifempty@B @@ -618,22 +749,16 @@ \errmessage {expkv-cs Error: Unknown key `\unexpanded{#1}' for macro `\ekvc@set'}% } -\begingroup -\edef\ekvc@err +\def\ekvc@err#1% {% - \endgroup - \unexpanded{\long\def\ekvc@err}##1% - {% - \unexpanded{\expandafter\ekvc@err@\@firstofone}% - {\unexpanded\expandafter{\csname ! expkv-cs Error:\endcsname}##1.}% - \unexpanded{\ekv@stop}% - }% + \long\def\ekvc@err##1{\expandafter\ekv@err@\@firstofone{#1##1.}\ekv@stop}% } -\ekvc@err -\def\ekvc@err@{\expandafter\ekv@gobbleto@stop} +\begingroup\expandafter\endgroup +\expandafter\ekvc@err\csname ! expkv-cs Error:\endcsname \long\def\ekvc@err@unknown@hash#1{\ekvc@err{unknown hash `#1'}} \long\def\ekvc@err@missing@hash#1{\ekvc@err{hash `#1' not found}} \long\def\ekvc@err@empty@hash{\ekvc@err{empty hash}} +\def\ekvc@err@invalid@bool#1{\ekvc@err{invalid boolean value `#1'}} \catcode`\@=\ekvc@tmp %% %% -- cgit v1.2.3