diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex | 559 |
1 files changed, 316 insertions, 243 deletions
diff --git a/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex b/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex index 9d504637338..a4259fe376f 100644 --- a/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex +++ b/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex @@ -35,8 +35,8 @@ \else \expandafter\endinput \fi -\def\ekvdVersion{0.5} -\def\ekvdDate{2020-07-12} +\def\ekvdVersion{0.6} +\def\ekvdDate{2020-10-12} \csname ekvd@tmp\endcsname \expandafter\chardef\csname ekvd@tmp\endcsname=\catcode`\@ \catcode`\@=11 @@ -46,20 +46,25 @@ \let\ekvd@long\ekvd@empty \let\ekvd@prot\ekvd@empty \let\ekvd@ifalso\@secondoftwo + \long\def\ekvd@ifnew##1##2##3{##3}% } \ekvd@clear@prefixes -\long\def\ekvd@exp@Nno#1#2#3% - {% - \expandafter\ekvd@exp@reinsert@n\expandafter{#3}{#1{#2}}% - } -\long\def\ekvd@exp@reinsert@n#1#2{#2{#1}} \protected\def\ekvdefinekeys#1% {% \def\ekvd@set{#1}% - \ekvparse\ekvd@noarg\ekvd@ + \ekvparse\ekvd@noarg\ekvd@arg + } +\protected\def\ekvd@noarg#1% + {% + \let\ekvd@ifnoarg\@firstoftwo + \ekvd@handle{#1}{}% } -\protected\def\ekvd@noarg#1{\ekvd@{#1}\ekvd@noarg@mark} -\protected\long\def\ekvd@#1#2% +\protected\def\ekvd@arg + {% + \let\ekvd@ifnoarg\@secondoftwo + \ekvd@handle + } +\protected\long\def\ekvd@handle#1#2% {% \ekvd@clear@prefixes \edef\ekvd@cur{\detokenize{#1}}% @@ -88,295 +93,338 @@ \protected\def\ekvd@p@protected{\let\ekvd@prot\protected} \let\ekvd@p@protect\ekvd@p@protected \protected\def\ekvd@p@also{\let\ekvd@ifalso\@firstoftwo} -\protected\def\ekvd@t@set#1#2% +\protected\def\ekvd@p@new{\let\ekvd@ifnew\ekvd@assert@new} +\protected\def\ekvd@type@set#1#2% {% \ekvd@assert@not@long \ekvd@assert@not@protected - \ekv@ifempty{#2}% - {\ekvd@err@missing@definition}% + \ekvd@ifnew{NoVal}{#1}% {% - \ekvd@ifalso + \ekv@ifempty{#2}% + {\ekvd@err@missing@definition}% {% - \ekvd@ifnoarg{#2}% - {\ekvd@add@noval{#1}{\ekvchangeset{#1}}}% - {\ekvd@add@noval{#1}{\ekvchangeset{#2}}}% - \ekvd@assert@not@protected@also - }% - {% - \ekvd@ifnoarg{#2}% - {\ekvdefNoVal\ekvd@set{#1}{\ekvchangeset{#1}}}% - {\ekvdefNoVal\ekvd@set{#1}{\ekvchangeset{#2}}}% + \ekvd@ifalso + {% + \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekvd@add@noval{#1}}}% + {\ekvchangeset{#2}}% + \ekvd@assert@not@protected@also + }% + {% + \ekv@expB@unbraceA + {\ekv@expB@unbraceA{\ekvdefNoVal\ekvd@set{#1}}}% + {\ekvchangeset{#2}}% + }% }% }% } -\protected\long\def\ekvd@type@noval#1#2#3#4% +\protected\def\ekvd@t@set#1#2% + {% + \ekvd@ifnoarg + {\ekvd@type@set{#1}{#1}}% + {\ekvd@type@set{#1}{#2}}% + } +\protected\long\def\ekvd@type@noval#1#2#3% {% - \ekvd@assert@arg{#4}% + \ekvd@ifnew{NoVal}{#2}% {% - \ekvd@assert@not@long - \ekvd@prot#2\ekvd@tmp{#4}% - \ekvd@ifalso - {\ekvd@exp@Nno\ekvd@add@noval{#3}\ekvd@tmp{}}% - {\ekvletNoVal\ekvd@set{#3}\ekvd@tmp}% + \ekvd@assert@arg + {% + \ekvd@assert@not@long + \ekvd@prot#1\ekvd@tmp{#3}% + \ekvd@ifalso + {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% + {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% + }% }% } -\protected\def\ekvd@t@noval{\ekvd@type@noval{}\def} -\protected\def\ekvd@t@enoval{\ekvd@type@noval e\edef} -\protected\long\def\ekvd@type@code#1#2#3#4% +\protected\def\ekvd@t@noval{\ekvd@type@noval\def} +\protected\def\ekvd@t@enoval{\ekvd@type@noval\edef} +\protected\long\def\ekvd@type@code#1#2#3% {% - \ekvd@assert@arg{#4} + \ekvd@ifnew{}{#2}% {% - \ekvd@prot\ekvd@long#2\ekvd@tmp##1{#4}% - \ekvd@ifalso - {\ekvd@exp@Nno\ekvd@add@val{#3}{\ekvd@tmp{##1}}{}}% - {\ekvlet\ekvd@set{#3}\ekvd@tmp}% + \ekvd@assert@arg + {% + \ekvd@prot\ekvd@long#1\ekvd@tmp##1{#3}% + \ekvd@ifalso + {\ekv@expB@unbraceA{\ekvd@add@val{#2}}{\ekvd@tmp{##1}}{}}% + {\ekvlet\ekvd@set{#2}\ekvd@tmp}% + }% }% } -\protected\def\ekvd@t@code{\ekvd@type@code{}\def} -\protected\def\ekvd@t@ecode{\ekvd@type@code e\edef} -\protected\long\def\ekvd@type@default#1#2#3#4% +\protected\def\ekvd@t@code{\ekvd@type@code\def} +\protected\def\ekvd@t@ecode{\ekvd@type@code\edef} +\protected\long\def\ekvd@type@default#1#2#3% {% - \ekvd@assert@arg{#4}% + \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#3}% + \ekvifdefined\ekvd@set{#2}% {% + \ekvd@assert@not@new \ekvd@assert@not@long \ekvd@prot\edef\ekvd@tmp {% - \unexpanded\expandafter#2% - {\csname\ekv@name\ekvd@set{#3}\endcsname{#4}}% + \unexpanded\expandafter#1% + {\csname\ekv@name\ekvd@set{#2}\endcsname{#3}}% }% \ekvd@ifalso - {\ekvd@exp@Nno\ekvd@add@noval{#3}\ekvd@tmp{}}% - {\ekvletNoVal\ekvd@set{#3}\ekvd@tmp}% + {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% + {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#3}}% + {\ekvd@err@undefined@key{#2}}% }% } -\protected\def\ekvd@t@default{\ekvd@type@default{}{}} -\protected\def\ekvd@t@qdefault{\ekvd@type@default q{\expandafter\expandafter}} +\protected\def\ekvd@t@default{\ekvd@type@default{}} +\protected\def\ekvd@t@qdefault{\ekvd@type@default{\expandafter\expandafter}} \protected\long\def\ekvd@t@edefault#1#2% {% - \ekvd@assert@arg{#2}% + \ekvd@assert@arg {% \ekvifdefined\ekvd@set{#1}% {% + \ekvd@assert@not@new \ekvd@assert@not@long \ekvd@prot\edef\ekvd@tmp {\csname\ekv@name\ekvd@set{#1}\endcsname{#2}}% \ekvd@ifalso - {\ekvd@exp@Nno\ekvd@add@noval{#1}\ekvd@tmp{}}% + {\ekv@expB@unbraceA{\ekvd@add@noval{#1}}\ekvd@tmp{}}% {\ekvletNoVal\ekvd@set{#1}\ekvd@tmp}% }% {\ekvd@err@undefined@key{#1}}% }% } -\long\def\ekvd@t@initial#1#2% +\long\def\ekvd@type@initial#1#2#3% {% - \ekvd@assert@arg{#2}% + \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#1}% + \ekvifdefined\ekvd@set{#2}% {% + \ekvd@assert@not@new \ekvd@assert@not@also \ekvd@assert@not@long \ekvd@assert@not@protected - \csname\ekv@name\ekvd@set{#1}\endcsname{#2}% + #1{#3}% + \csname\ekv@name\ekvd@set{#2}\expandafter\endcsname\expandafter + {\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#1}}% + {\ekvd@err@undefined@key{#2}}% }% } -\long\def\ekvd@t@oinitial#1#2% +\def\ekvd@t@initial{\ekvd@type@initial{\def\ekvd@tmp}} +\def\ekvd@t@oinitial{\ekvd@type@initial{\ekv@expB@unbraceA{\def\ekvd@tmp}}} +\def\ekvd@t@einitial{\ekvd@type@initial{\edef\ekvd@tmp}} +\protected\def\ekvd@type@bool#1#2#3#4#5% {% - \ekvd@assert@arg{#2}% + \ekvd@ifnew{}{#4}% {% - \ekvifdefined\ekvd@set{#1}% + \ekvd@ifnew{NoVal}{#4}% {% - \ekvd@assert@not@also - \ekvd@assert@not@long - \ekvd@assert@not@protected - \csname\ekv@name\ekvd@set{#1}\expandafter\endcsname\expandafter{#2}% + \ekvd@assert@filledarg{#5}% + {% + \ekvd@newlet#5#3% + \ekvd@type@choice{#4}% + \protected\ekvdefNoVal\ekvd@set{#4}{#1\let#5#2}% + \protected\expandafter\def + \csname\ekvd@choice@name\ekvd@set{#4}{true}\endcsname + {#1\let#5#2}% + \protected\expandafter\def + \csname\ekvd@choice@name\ekvd@set{#4}{false}\endcsname + {#1\let#5#3}% + }% }% - {\ekvd@err@undefined@key{#1}}% }% } -\long\def\ekvd@t@einitial#1#2% +\protected\def\ekvd@t@bool{\ekvd@type@bool{}\iftrue\iffalse} +\protected\def\ekvd@t@gbool{\ekvd@type@bool\global\iftrue\iffalse} +\protected\def\ekvd@t@boolTF{\ekvd@type@bool{}\@firstoftwo\@secondoftwo} +\protected\def\ekvd@t@gboolTF{\ekvd@type@bool\global\@firstoftwo\@secondoftwo} +\protected\def\ekvd@t@invbool{\ekvd@type@bool{}\iffalse\iftrue} +\protected\def\ekvd@t@ginvbool{\ekvd@type@bool\global\iffalse\iftrue} +\protected\def\ekvd@t@invboolTF{\ekvd@type@bool{}\@secondoftwo\@firstoftwo} +\protected\def\ekvd@t@ginvboolTF + {\ekvd@type@bool\global\@secondoftwo\@firstoftwo} +\protected\def\ekvd@type@boolpair#1#2#3#4#5#6% {% - \ekvd@assert@arg{#2}% + \ekvd@ifnew{}{#4}% {% - \ekvifdefined\ekvd@set{#1}% + \ekvd@ifnew{NoVal}{#4}% {% - \ekvd@assert@not@also - \ekvd@assert@not@long - \ekvd@assert@not@protected - \edef\ekvd@tmp{#2}% - \csname\ekv@name\ekvd@set{#1}\expandafter\endcsname\expandafter - {\ekvd@tmp}% + \ekvd@newlet#5#3% + \ekvd@newlet#6#2% + \ekvd@type@choice{#4}% + \protected\ekvdefNoVal\ekvd@set{#4}{#1\let#5#2#1\let#6#3}% + \protected\expandafter\def + \csname\ekvd@choice@name\ekvd@set{#4}{true}\endcsname + {#1\let#5#2#1\let#6#3}% + \protected\expandafter\def + \csname\ekvd@choice@name\ekvd@set{#4}{false}\endcsname + {#1\let#5#3#1\let#6#2}% }% - {\ekvd@err@undefined@key{#1}}% }% } -\protected\def\ekvd@type@bool#1#2#3#4#5#6#7% +\protected\def\ekvd@t@boolpair#1#2% + {\ekvd@assert@twoargs{#2}{\ekvd@type@boolpair{}\iftrue\iffalse{#1}#2}} +\protected\def\ekvd@t@gboolpair#1#2% + {\ekvd@assert@twoargs{#2}{\ekvd@type@boolpair\global\iftrue\iffalse{#1}#2}} +\protected\def\ekvd@t@boolpairTF#1#2% {% - \ekvd@assert@filledarg{#7}% - {% - \ekvd@newlet#7#5% - \ekvd@type@choice{#1bool#2}{#6}% - \protected\ekvdefNoVal\ekvd@set{#6}{#3\let#7#4}% - \protected\expandafter\def - \csname\ekvd@choice@name\ekvd@set{#6}{true}\endcsname - {#3\let#7#4}% - \protected\expandafter\def - \csname\ekvd@choice@name\ekvd@set{#6}{false}\endcsname - {#3\let#7#5}% - }% + \ekvd@assert@twoargs{#2}% + {\ekvd@type@boolpair{}\@firstoftwo\@secondoftwo{#1}#2}% + } +\protected\def\ekvd@t@gboolpairTF#1#2% + {% + \ekvd@assert@twoargs{#2}% + {\ekvd@type@boolpair\global\@firstoftwo\@secondoftwo{#1}#2}% } -\protected\def\ekvd@t@bool{\ekvd@type@bool{}{}{}\iftrue\iffalse} -\protected\def\ekvd@t@gbool{\ekvd@type@bool g{}\global\iftrue\iffalse} -\protected\def\ekvd@t@boolTF{\ekvd@type@bool{}{TF}{}\@firstoftwo\@secondoftwo} -\protected\def\ekvd@t@gboolTF - {\ekvd@type@bool g{TF}\global\@firstoftwo\@secondoftwo} -\protected\def\ekvd@type@data#1#2#3#4#5#6#7#8% +\protected\def\ekvd@type@data#1#2#3#4#5#6% {% - \ekvd@assert@filledarg{#8}% + \ekvd@ifnew{}{#5}% {% - \ekvd@newlet#8#3% - \ekvd@ifalso + \ekvd@assert@filledarg{#6}% {% - \let\ekvd@prot\protected - \ekvd@add@val{#7}{\long#4#8####1#5{####1{#6}}}{}% - }% - {% - \protected\ekvd@long\ekvdef\ekvd@set{#7}% - {\long#4#8####1#5{####1{#6}}}% + \ekvd@newlet#6#1% + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#5}{\long#2#6####1#3{####1{#4}}}{}% + }% + {% + \protected\ekvd@long\ekvdef\ekvd@set{#5}% + {\long#2#6####1#3{####1{#4}}}% + }% }% }% } \protected\def\ekvd@t@data - {\ekvd@type@data{}{}\@secondoftwo\edef{####2}{\unexpanded{##1}}} -\protected\def\ekvd@t@edata{\ekvd@type@data e{}\@secondoftwo\edef{####2}{##1}} + {\ekvd@type@data\@secondoftwo\edef{####2}{\unexpanded{##1}}} +\protected\def\ekvd@t@edata{\ekvd@type@data\@secondoftwo\edef{####2}{##1}} \protected\def\ekvd@t@gdata - {\ekvd@type@data g{}\@secondoftwo\xdef{####2}{\unexpanded{##1}}} -\protected\def\ekvd@t@xdata{\ekvd@type@data x{}\@secondoftwo\xdef{####2}{##1}} -\protected\def\ekvd@t@dataT{\ekvd@type@data{}T\@gobble\edef{}{\unexpanded{##1}}} -\protected\def\ekvd@t@edataT{\ekvd@type@data eT\@gobble\edef{}{##1}} -\protected\def\ekvd@t@gdataT - {\ekvd@type@data gT\@gobble\xdef{}{\unexpanded{##1}}} -\protected\def\ekvd@t@xdataT{\ekvd@type@data xT\@gobble\xdef{}{##1}} -\protected\def\ekvd@type@box#1#2#3#4% - {% - \ekvd@assert@filledarg{#4}% + {\ekvd@type@data\@secondoftwo\xdef{####2}{\unexpanded{##1}}} +\protected\def\ekvd@t@xdata{\ekvd@type@data\@secondoftwo\xdef{####2}{##1}} +\protected\def\ekvd@t@dataT{\ekvd@type@data\@gobble\edef{}{\unexpanded{##1}}} +\protected\def\ekvd@t@edataT{\ekvd@type@data\@gobble\edef{}{##1}} +\protected\def\ekvd@t@gdataT{\ekvd@type@data\@gobble\xdef{}{\unexpanded{##1}}} +\protected\def\ekvd@t@xdataT{\ekvd@type@data\@gobble\xdef{}{##1}} +\protected\def\ekvd@type@box#1#2#3% + {% + \ekvd@ifnew{}{#2}% {% - \ekvd@newreg#4{box}% - \ekvd@ifalso - {% - \let\ekvd@prot\protected - \ekvd@add@val{#3}{#2\setbox#4\hbox{\begingroup##1\endgroup}}{}% - }% + \ekvd@assert@filledarg{#3}% {% - \protected\ekvd@long\ekvdef\ekvd@set{#3}% - {#2\setbox#4\hbox{\begingroup##1\endgroup}}% + \ekvd@newreg#3{box}% + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#2}{#1\setbox#3\hbox{\begingroup##1\endgroup}}{}% + }% + {% + \protected\ekvd@long\ekvdef\ekvd@set{#2}% + {#1\setbox#3\hbox{\begingroup##1\endgroup}}% + }% }% }% } -\protected\def\ekvd@t@box{\ekvd@type@box{}{}} -\protected\def\ekvd@t@gbox{\ekvd@type@box g\global} -\protected\def\ekvd@type@toks#1#2#3#4% +\protected\def\ekvd@t@box{\ekvd@type@box{}} +\protected\def\ekvd@t@gbox{\ekvd@type@box\global} +\protected\def\ekvd@type@toks#1#2#3% {% - \ekvd@assert@filledarg{#4}% + \ekvd@ifnew{}{#2}% {% - \ekvd@newreg#4{toks}% - \ekvd@ifalso + \ekvd@assert@filledarg{#3}% {% - \let\ekvd@prot\protected - \ekvd@add@val{#3}{#2#4{##1}}{}% + \ekvd@newreg#3{toks}% + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#2}{#1#3{##1}}{}% + }% + {\protected\ekvd@long\ekvdef\ekvd@set{#2}{#1#3{##1}}}% }% - {\protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{##1}}}% }% } -\protected\def\ekvd@t@toks{\ekvd@type@toks{}{}} -\protected\def\ekvd@t@gtoks{\ekvd@type@toks{g}\global} -\protected\def\ekvd@type@apptoks#1#2#3#4% +\protected\def\ekvd@t@toks{\ekvd@type@toks{}} +\protected\def\ekvd@t@gtoks{\ekvd@type@toks\global} +\protected\def\ekvd@type@apptoks#1#2#3% {% - \ekvd@assert@filledarg{#4}% + \ekvd@ifnew{}{#2}% {% - \ekvd@newreg#4{toks}% - \ekvd@ifalso - {% - \let\ekvd@prot\protected - \ekvd@add@val{#3}{#2#4\expandafter{\the#4##1}}{}% - }% + \ekvd@assert@filledarg{#3}% {% - \protected\ekvd@long\ekvdef\ekvd@set{#3}% - {#2#4\expandafter{\the#4##1}}% + \ekvd@newreg#3{toks}% + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#2}{#1#3\expandafter{\the#3##1}}{}% + }% + {% + \protected\ekvd@long\ekvdef\ekvd@set{#2}% + {#1#3\expandafter{\the#3##1}}% + }% }% }% } -\protected\def\ekvd@t@apptoks{\ekvd@type@apptoks{}{}} -\protected\def\ekvd@t@gapptoks{\ekvd@type@apptoks{g}\global} -\protected\def\ekvd@type@reg#1#2#3#4#5#6#7% +\protected\def\ekvd@t@apptoks{\ekvd@type@apptoks{}} +\protected\def\ekvd@t@gapptoks{\ekvd@type@apptoks\global} +\protected\def\ekvd@type@reg#1#2#3#4#5#6% {% - \ekvd@assert@filledarg{#7}% + \ekvd@ifnew{}{#5}% {% - \ekvd@newreg#7{#2}% - \ekvd@ifalso + \ekvd@assert@filledarg{#6}% {% - \let\evkd@prot\protected - \ekvd@add@val{#6}{#3#7=#4##1#5\relax}{}% + \ekvd@newreg#6{#1}% + \ekvd@ifalso + {% + \let\evkd@prot\protected + \ekvd@add@val{#5}{#2#6=#3##1#4\relax}{}% + }% + {\protected\ekvd@long\ekvdef\ekvd@set{#5}{#2#6=#3##1#4\relax}}% }% - {\protected\ekvd@long\ekvdef\ekvd@set{#6}{#3#7=#4##1#5\relax}}% }% } -\protected\def\ekvd@t@int{\ekvd@type@reg{int}{count}{}{}{}} -\protected\def\ekvd@t@eint{\ekvd@type@reg{eint}{count}{}\numexpr\relax} -\protected\def\ekvd@t@gint{\ekvd@type@reg{gint}{count}\global{}{}} -\protected\def\ekvd@t@xint{\ekvd@type@reg{xint}{count}\global\numexpr\relax} -\protected\def\ekvd@t@dimen{\ekvd@type@reg{dimen}{dimen}{}{}{}} -\protected\def\ekvd@t@edimen{\ekvd@type@reg{edimen}{dimen}{}\dimexpr\relax} -\protected\def\ekvd@t@gdimen{\ekvd@type@reg{gdimen}{dimen}\global{}{}} -\protected\def\ekvd@t@xdimen{\ekvd@type@reg{xdimen}{dimen}\global\dimexpr\relax} -\protected\def\ekvd@t@skip{\ekvd@type@reg{skip}{skip}{}{}{}} -\protected\def\ekvd@t@eskip{\ekvd@type@reg{eskip}{skip}{}\glueexpr\relax} -\protected\def\ekvd@t@gskip{\ekvd@type@reg{gskip}{skip}\global{}{}} -\protected\def\ekvd@t@xskip{\ekvd@type@reg{xskip}{skip}\global\glueexpr\relax} +\protected\def\ekvd@t@int{\ekvd@type@reg{count}{}{}{}} +\protected\def\ekvd@t@eint{\ekvd@type@reg{count}{}\numexpr\relax} +\protected\def\ekvd@t@gint{\ekvd@type@reg{count}\global{}{}} +\protected\def\ekvd@t@xint{\ekvd@type@reg{count}\global\numexpr\relax} +\protected\def\ekvd@t@dimen{\ekvd@type@reg{dimen}{}{}{}} +\protected\def\ekvd@t@edimen{\ekvd@type@reg{dimen}{}\dimexpr\relax} +\protected\def\ekvd@t@gdimen{\ekvd@type@reg{dimen}\global{}{}} +\protected\def\ekvd@t@xdimen{\ekvd@type@reg{dimen}\global\dimexpr\relax} +\protected\def\ekvd@t@skip{\ekvd@type@reg{skip}{}{}{}} +\protected\def\ekvd@t@eskip{\ekvd@type@reg{skip}{}\glueexpr\relax} +\protected\def\ekvd@t@gskip{\ekvd@type@reg{skip}\global{}{}} +\protected\def\ekvd@t@xskip{\ekvd@type@reg{skip}\global\glueexpr\relax} \protected\def\ekvd@type@store#1#2#3#4% {% - \ekvd@assert@filledarg{#4}% + \ekvd@ifnew{}{#3}% {% - \ekvd@newlet#4\ekvd@empty - \ekvd@ifalso + \ekvd@assert@filledarg{#4}% {% - \let\ekvd@prot\protected - \ekvd@add@val{#3}{#2#4{\unexpanded{##1}}}{}% + \ekvd@newlet#4\ekvd@empty + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#3}{#1#4{#2}}{}% + }% + {\protected\ekvd@long\ekvdef\ekvd@set{#3}{#1#4{#2}}}% }% - {\protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{\unexpanded{##1}}}}% }% } -\protected\def\ekvd@t@store{\ekvd@type@store{}\edef} -\protected\def\ekvd@t@gstore{\ekvd@type@store{g}\xdef} -\protected\def\ekvd@type@estore#1#2#3#4% +\protected\def\ekvd@t@store{\ekvd@type@store\edef{\unexpanded{##1}}} +\protected\def\ekvd@t@gstore{\ekvd@type@store\xdef{\unexpanded{##1}}} +\protected\def\ekvd@t@estore{\ekvd@type@store\edef{##1}} +\protected\def\ekvd@t@xstore{\ekvd@type@store\xdef{##1}} +\protected\long\def\ekvd@type@meta#1#2#3#4#5#6#7% {% - \ekvd@assert@filledarg{#4}% + \ekvd@ifnew{#1}{#6}% {% - \ekvd@newlet#4\ekvd@empty - \ekvd@ifalso + \ekvd@assert@filledarg{#7}% {% - \let\ekvd@prot\protected - \ekvd@add@val{#3}{#2#4{##1}}{}% + \edef\ekvd@tmp{\ekvd@set}% + \expandafter\ekvd@type@meta@a\expandafter{\ekvd@tmp}{#7}{#2}% + \ekvd@ifalso + {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% }% - {\protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{##1}}}% - }% - } -\protected\def\ekvd@t@estore{\ekvd@type@estore{e}\edef} -\protected\def\ekvd@t@xstore{\ekvd@type@estore{x}\xdef} -\protected\long\def\ekvd@type@meta#1#2#3#4#5#6#7#8% - {% - \ekvd@assert@filledarg{#8}% - {% - \edef\ekvd@tmp{\ekvd@set}% - \expandafter\ekvd@type@meta@a\expandafter{\ekvd@tmp}{#8}{#3}% - \ekvd@ifalso - {\ekvd@exp@Nno#4{#7}{\ekvd@tmp#5}{#6}}% - {#2\ekvd@set{#7}\ekvd@tmp}% }% } \protected\long\def\ekvd@type@meta@a#1#2% @@ -391,43 +439,53 @@ {% \ekvd@prot\ekvd@long\def\ekvd@tmp#2{#1}% } -\protected\def\ekvd@t@meta{\ekvd@type@meta{}\ekvlet{##1}\ekvd@add@val{{##1}}{}} +\protected\def\ekvd@t@meta{\ekvd@type@meta{}{##1}\ekvd@add@val{{##1}}{}} \protected\def\ekvd@t@nmeta {% \ekvd@assert@not@long - \ekvd@type@meta - n\ekvletNoVal{}\ekvd@add@noval{}\ekvd@assert@not@long@also + \ekvd@type@meta{NoVal}{}\ekvd@add@noval{}\ekvd@assert@not@long@also } -\protected\long\def\ekvd@type@smeta#1#2#3#4#5#6#7#8% +\protected\long\def\ekvd@type@smeta#1#2#3#4#5#6#7% {% - \ekvd@assert@twoargs{#8}% + \ekvd@ifnew{#1}{#6}% {% - \ekvd@type@meta@a#8{#3}% - \ekvd@ifalso - {\ekvd@exp@Nno#4{#7}{\ekvd@tmp#5}{#6}}% - {#2\ekvd@set{#7}\ekvd@tmp}% + \ekvd@assert@twoargs{#7}% + {% + \ekvd@type@meta@a#7{#2}% + \ekvd@ifalso + {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% + }% }% } -\protected\def\ekvd@t@smeta - {\ekvd@type@smeta{}\ekvlet{##1}\ekvd@add@val{{##1}}{}} +\protected\def\ekvd@t@smeta{\ekvd@type@smeta{}{##1}\ekvd@add@val{{##1}}{}} \protected\def\ekvd@t@snmeta {% \ekvd@assert@not@long - \ekvd@type@smeta - n\ekvletNoVal{}\ekvd@add@noval{}\ekvd@assert@not@long@also + \ekvd@type@smeta{NoVal}{}\ekvd@add@noval{}\ekvd@assert@not@long@also } -\protected\def\ekvd@type@choice#1#2% +\protected\def\ekvd@type@choice#1% {% \ekvd@assert@not@long \ekvd@prot\edef\ekvd@tmp##1% - {% - \unexpanded{\ekvd@h@choice}{\ekvd@choice@name\ekvd@set{#2}{##1}}% - }% + {\unexpanded{\ekvd@h@choice}{\ekvd@choice@name\ekvd@set{#1}{##1}}}% \ekvd@ifalso {% - \ekvd@exp@Nno\ekvd@add@val{#2}{\ekvd@tmp{##1}}\ekvd@assert@not@long@also + \ekvd@assert@val{#1}% + {% + \ekvd@if@not@already@choice{#1}% + {% + \ekv@expB@unbraceA + {% + \expandafter\ekvd@add@aux + \csname\ekv@name\ekvd@set{#1}\endcsname{{##1}}{#1}% + }% + {\ekvd@tmp{##1}}% + {\ekvd@long\ekvdef}\ekvd@assert@not@long@also + }% + }% }% - {\ekvlet\ekvd@set{#2}\ekvd@tmp}% + {\ekvlet\ekvd@set{#1}\ekvd@tmp}% } \protected\def\ekvd@populate@choice {% @@ -440,7 +498,7 @@ \protected\long\def\ekvd@populate@choice@#1#2% {% \ekvd@clear@prefixes - \expandafter\ekvd@assert@arg@msg\expandafter{\ekvd@cur : #1}{#2}% + \expandafter\ekvd@assert@arg@msg\expandafter{\ekvd@cur : #1}% {% \ekvd@ifspace{#1}% {\ekvd@choice@prefix\ekv@mark#1\ekv@stop}% @@ -484,23 +542,35 @@ } \protected\def\ekvd@choice@p@long{\ekvd@choice@invalid@p{long}}% \protected\def\ekvd@choice@p@also{\ekvd@choice@invalid@p{also}}% +\protected\def\ekvd@choice@p@new{\ekvd@choice@invalid@p{new}}% \protected\long\def\ekvd@t@choice#1#2% {% - \ekvd@assert@arg{#2}% + \ekvd@ifnew{}{#1}% {% - \ekvd@type@choice{choice}{#1}% - \def\ekvd@set@choice{#1}% - \ekvd@populate@choice{#2}% + \ekvd@assert@arg + {% + \ekvd@type@choice{#1}% + \def\ekvd@set@choice{#1}% + \ekvd@populate@choice{#2}% + }% }% } \protected\long\expandafter\def\csname ekvd@t@unknown-choice\endcsname#1#2% {% - \ekvd@assert@arg{#2}% + \ifx\ekvd@ifnew\ekvd@assert@new + \ekv@fi@firstoftwo + \fi + \@secondoftwo + {\ekv@ifdefined{\ekvd@unknown@choice@name\ekvd@set{#1}}\ekvd@err@not@new}% + \@firstofone {% - \ekvd@assert@not@long - \ekvd@assert@not@also - \ekvd@prot\expandafter - \def\csname\ekvd@unknown@choice@name\ekvd@set{#1}\endcsname##1{#2}% + \ekvd@assert@arg + {% + \ekvd@assert@not@long + \ekvd@assert@not@also + \ekvd@prot\expandafter + \def\csname\ekvd@unknown@choice@name\ekvd@set{#1}\endcsname##1{#2}% + }% }% } \def\ekvd@h@choice#1% @@ -636,21 +706,10 @@ } \expandafter\ekvd@extract@args\expandafter{\detokenize{macro:}} \edef\ekvd@one@arg@string{\string#1} -\long\def\ekvd@assert@arg#1{\ekvd@ifnoarg{#1}\ekvd@err@missing@definition} -\long\def\ekvd@assert@arg@msg#1#2% - {% - \ekvd@ifnoarg{#2}{\ekvd@err@missing@definition@msg{#1}}% - } -\long\def\ekvd@ifnoarg#1% +\def\ekvd@assert@arg{\ekvd@ifnoarg\ekvd@err@missing@definition} +\long\def\ekvd@assert@arg@msg#1% {% - \ekvd@ifnoarg@\ekvd@ifnoarg@mark#1\ekvd@ifnoarg@mark\ekvd@ifnoarg@t - \ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark\@secondoftwo - } -\long\def\ekvd@ifnoarg@#1\ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark{} -\long\def\ekvd@ifnoarg@t - \ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark\@secondoftwo#1#2% - {% - #1% + \ekvd@ifnoarg{\ekvd@err@missing@definition@msg{#1}}% } \long\def\ekvd@assert@filledarg#1% {% @@ -658,23 +717,35 @@ } \long\def\ekvd@ifnoarg@or@empty#1% {% - \ekvd@ifnoarg{#1}% + \ekvd@ifnoarg \@firstoftwo {\ekv@ifempty{#1}}% } \def\ekvd@assert@not@long{\ifx\ekvd@long\long\ekvd@err@no@prefix{long}\fi} \def\ekvd@assert@not@protected - {% - \ifx\ekvd@prot\protected\ekvd@err@no@prefix{protected}\fi - } + {\ifx\ekvd@prot\protected\ekvd@err@no@prefix{protected}\fi} \def\ekvd@assert@not@also{\ekvd@ifalso{\ekvd@err@no@prefix{also}}{}} \def\ekvd@assert@not@long@also + {\ifx\ekvd@long\long\ekvd@err@no@prefix@also{long}\fi} +\def\ekvd@assert@not@protected@also + {\ifx\ekvd@prot\protected\ekvd@err@no@prefix@also{protected}\fi} +\def\ekvd@assert@new#1#2% + {\csname ekvifdefined#1\endcsname\ekvd@set{#2}{\ekvd@err@not@new}} +\def\ekvd@assert@not@new + {\ifx\ekvd@ifnew\ekvd@assert@new\ekvd@err@no@prefix{new}\fi} +\protected\def\ekvd@if@not@already@choice#1% {% - \ifx\ekvd@long\long\ekvd@err@no@prefix@also{long}\fi + \expandafter\ekvd@if@not@already@choice@a + \csname\ekv@name\ekvd@set{#1}\endcsname + {}\ekvd@h@choice\ekvd@stop } -\def\ekvd@assert@not@protected@also +\protected\def\ekvd@if@not@already@choice@a + {% + \expandafter\ekvd@if@not@already@choice@b + } +\long\protected\def\ekvd@if@not@already@choice@b#1\ekvd@h@choice#2\ekvd@stop {% - \ifx\ekvd@prot\protected\ekvd@err@no@prefix@also{protected}\fi + \ekv@ifempty{#2}\@firstofone\@gobble } \long\def\ekvd@ifspace#1% {% @@ -721,6 +792,8 @@ `\ekvd@extracted@args' for key `\ekvd@cur'% }% } +\protected\def\ekvd@err@not@new + {\ekvd@errm{The key for `\ekvd@cur' is already defined}} \def\ekvd@err@choice@invalid#1% {% \ekvd@err@choice@invalid@#1\ekv@stop |