diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-29 21:47:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-29 21:47:48 +0000 |
commit | e8abb8d95794509452efd78015e313f61cee603a (patch) | |
tree | b77e4f1263d986a7779c082d39f4fb09835585d2 /Master/texmf-dist/tex | |
parent | badecb2781bf6fc7dc099639ab6430901e2d94bf (diff) |
expkv-def/ (29jan22)
git-svn-id: svn://tug.org/texlive/trunk@61796 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
3 files changed, 164 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex b/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex index 8f3e674678e..f79c6e0a045 100644 --- a/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex +++ b/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2020-2021 Jonathan P. Spratte +%% Copyright (C) 2020-2022 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 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 913de4162cf..2582a0d868f 100644 --- a/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex +++ b/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2020-2021 Jonathan P. Spratte +%% Copyright (C) 2020-2022 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 @@ -36,16 +36,27 @@ \else \expandafter\endinput \fi -\def\ekvdVersion{0.8c} -\def\ekvdDate{2021-09-20} +\def\ekvdVersion{0.9} +\def\ekvdDate{2022-01-29} \csname ekvd@tmp\endcsname \expandafter\chardef\csname ekvd@tmp\endcsname=\catcode`\@ \catcode`\@=11 -\def\ekvd@empty{} +\protected\long\def\ekvd@ifprimitive#1% + {% + \begingroup + \edef\ekvd@tmpa{\string #1}% + \edef\ekvd@tmpb{\meaning#1}% + \expandafter + \endgroup + \ifx\ekvd@tmpa\ekvd@tmpb + \ekv@fi@firstoftwo + \fi + \@secondoftwo + } \protected\def\ekvd@clear@prefixes {% - \let\ekvd@long\ekvd@empty - \let\ekvd@prot\ekvd@empty + \let\ekvd@long\ekv@empty + \let\ekvd@prot\ekv@empty \let\ekvd@ifalso\@secondoftwo \long\def\ekvd@ifnew##1##2##3{##3}% } @@ -68,7 +79,7 @@ \protected\long\def\ekvd@handle#1\ekvd@stop#2% {% \ekvd@clear@prefixes - \edef\ekvd@cur{\detokenize{#1}}% + \def\ekvd@cur{#1}% \ekvd@ifspace{#1}% {\ekvd@prefix\ekv@mark#1\ekv@stop{#2}}% \ekvd@err@missing@type @@ -323,11 +334,11 @@ \ekvd@ifalso {% \let\ekvd@prot\protected - \ekvd@add@val{#2}{#1\setbox#3\hbox{\begingroup##1\endgroup}}{}% + \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}}% + {#1\setbox#3=\hbox{\begingroup##1\endgroup}}% }% }% }% @@ -344,35 +355,90 @@ \ekvd@ifalso {% \let\ekvd@prot\protected - \ekvd@add@val{#2}{#1#3{##1}}{}% + \ekvd@add@val{#2}{#1#3={##1}}{}% }% - {\protected\ekvd@long\ekvdef\ekvd@set{#2}{#1#3{##1}}}% + {\protected\ekvd@long\ekvdef\ekvd@set{#2}{#1#3={##1}}}% }% }% } \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@ifprimitive\toksapp {% - \ekvd@ifnew{}{#2}% + \protected\def\ekvd@type@preapptoks#1#2#3% {% - \ekvd@assert@filledarg{#3}% + \ekvd@ifnew{}{#2}% {% - \ekvd@newreg#3{toks}% - \ekvd@ifalso + \ekvd@assert@filledarg{#3}% {% - \let\ekvd@prot\protected - \ekvd@add@val{#2}{#1#3\expandafter{\the#3##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\def\ekvd@t@apptoks{\ekvd@type@preapptoks\toksapp} + \protected\def\ekvd@t@gapptoks{\ekvd@type@preapptoks\gtoksapp} + \protected\def\ekvd@t@pretoks{\ekvd@type@preapptoks\tokspre} + \protected\def\ekvd@t@gpretoks{\ekvd@type@preapptoks\gtokspre} + } + {% + \protected\def\ekvd@type@apptoks#1#2#3% + {% + \ekvd@ifnew{}{#2}% + {% + \ekvd@assert@filledarg{#3}% {% - \protected\ekvd@long\ekvdef\ekvd@set{#2}% - {#1#3\expandafter{\the#3##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\global} + \newtoks\ekvd@toks + \protected\def\ekvd@type@pretoks#1#2#3% + {% + \ekvd@ifnew{}{#2}% + {% + \ekvd@assert@filledarg{#3}% + {% + \ekvd@newreg#3{toks}% + \ekvd@ifalso + {% + \let\ekvd@prot\protected + \ekvd@add@val{#2}% + {% + \ekvd@toks={##1}% + #1#3=\expandafter{\the\expandafter\ekvd@toks\the#3}% + }% + {}% + }% + {% + \protected\ekvd@long\ekvdef\ekvd@set{#2}% + {% + \ekvd@toks={##1}% + #1#3=\expandafter{\the\expandafter\ekvd@toks\the#3}% + }% + }% + }% + }% + } + \protected\def\ekvd@t@pretoks{\ekvd@type@pretoks{}} + \protected\def\ekvd@t@gpretoks{\ekvd@type@pretoks\global} } -\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@ifnew{}{#5}% @@ -407,7 +473,7 @@ {% \ekvd@assert@filledarg{#4}% {% - \ekvd@newlet#4\ekvd@empty + \ekvd@newlet#4\ekv@empty \ekvd@ifalso {% \let\ekvd@prot\protected @@ -475,8 +541,13 @@ \protected\def\ekvd@type@choice#1% {% \ekvd@assert@not@long - \ekvd@prot\edef\ekvd@tmp##1% - {\ekv@unexpanded{\ekvd@h@choice}{\ekvd@choice@name\ekvd@set{#1}{##1}}}% + \ekv@expargtwice{\ekvd@prot\def\ekvd@tmp##1}% + {% + \expandafter\expandafter\expandafter + \ekvd@h@choice + \expandafter\expandafter\expandafter + {\expandafter\ekvd@choice@name\expandafter{\ekvd@set}{#1}{##1}}% + }% \ekvd@ifalso {% \ekvd@assert@val{#1}% @@ -506,36 +577,35 @@ \protected\long\def\ekvd@populate@choice@#1#2% {% \ekvd@clear@prefixes - \expandafter\ekvd@assert@arg@msg\expandafter{\ekvd@cur : #1}% + \ekvd@ifspace{#1}% + {\ekvd@choice@prefix{\ekv@mark#1}\ekv@mark#1\ekv@stop}% {% - \ekvd@ifspace{#1}% - {\ekvd@choice@prefix\ekv@mark#1\ekv@stop}% - {% - \expandafter\def - \csname\ekvd@choice@name\ekvd@set\ekvd@set@choice{#1}\endcsname - }% - {#2}% + \expandafter\edef + \csname\ekvd@choice@name\ekvd@set\ekvd@set@choice{#1}\endcsname }% + {\unexpanded{#2}}% } -\protected\def\ekvd@choice@prefix#1 +\protected\def\ekvd@choice@prefix#1#2 {% - \ekv@strip{#1}\ekvd@choice@prefix@\ekv@mark + \ekv@strip{#2}{\ekvd@choice@prefix@{#1}}\ekv@mark } -\protected\def\ekvd@choice@prefix@#1#2\ekv@stop +\protected\def\ekvd@choice@prefix@#1#2#3\ekv@stop {% - \ekv@ifdefined{ekvd@choice@p@#1}% + \ekv@ifdefined{ekvd@choice@p@#2}% {% - \csname ekvd@choice@p@#1\endcsname - \ekvd@ifspace{#2}% - {\ekvd@choice@prefix#2\ekv@stop}% - {% - \ekvd@prot\expandafter\def - \csname - \ekv@strip{#2}{\ekvd@choice@name\ekvd@set\ekvd@set@choice}% - \endcsname - }% + \csname ekvd@choice@p@#2\endcsname + \ekvd@ifspace{#3}% + {\ekvd@choice@prefix{#3}#3\ekv@stop}% + {\ekvd@choice@prefix@done{#3}}% }% - {\ekvd@err@undefined@prefix{#1}\@gobble}% + {\ekvd@choice@prefix@done{#1}}% + } +\protected\def\ekvd@choice@prefix@done#1% + {% + \ekvd@prot\expandafter\edef + \csname + \ekv@strip{#1}{\ekvd@choice@name\ekvd@set\ekvd@set@choice}% + \endcsname } \protected\def\ekvd@choice@p@protected{\let\ekvd@prot\protected} \let\ekvd@choice@p@protect\ekvd@choice@p@protected @@ -563,6 +633,46 @@ }% }% } +\protected\long\expandafter\def\csname ekvd@t@choice-store\endcsname + {\ekvd@type@choicespecial\ekvd@populate@choicestore} +\protected\long\expandafter\def\csname ekvd@t@choice-enum\endcsname + {\ekvd@type@choicespecial\ekvd@populate@choiceenum} +\protected\long\def\ekvd@type@choicespecial#1#2#3% + {% + \ekvd@ifnew{}{#2}% + {% + \ekvd@assert@twoargs{#3}% + {% + \ekvd@type@choice{#2}% + \def\ekvd@set@choice{#2}% + #1#3% + }% + }% + } +\protected\long\def\ekvd@populate@choicestore#1% + {% + \ekvd@newlet#1\ekv@empty + \ekvcsvloop{\ekvd@populate@choicestore@#1}% + } +\protected\long\def\ekvd@populate@choicestore@#1#2% + {% + \protected\expandafter\edef + \csname\ekvd@choice@name\ekvd@set\ekvd@set@choice{#2}\endcsname + {\unexpanded{\edef#1{\unexpanded{#2}}}}% + } +\protected\long\def\ekvd@populate@choiceenum#1% + {% + \ekvd@newreg#1{count}% + \def\ekvd@tmp{0}% + \ekvcsvloop{\ekvd@populate@choiceenum@#1}% + } +\protected\long\def\ekvd@populate@choiceenum@#1#2% + {% + \protected\expandafter\edef + \csname\ekvd@choice@name\ekvd@set\ekvd@set@choice{#2}\endcsname + {#1=\@firstofone{\ekvd@tmp} }% + \edef\ekvd@tmp{\the\numexpr\ekvd@tmp+1\relax}% + } \protected\long\expandafter\def\csname ekvd@t@unknown-choice\endcsname#1#2% {% \ekvd@assert@new@for@name{\ekvd@unknown@choice@name\ekvd@set{#1}}% @@ -763,7 +873,7 @@ \protected\def\ekvd@assert@noval@#1% {% \expandafter\ekvd@extract@args\meaning#1\ekvd@stop - \unless\ifx\ekvd@extracted@args\ekvd@empty + \unless\ifx\ekvd@extracted@args\ekv@empty \ekvd@err@unsupported@arg \fi \@firstofone @@ -887,7 +997,7 @@ {\ekvd@errm{Misuse of the unknown type found while processing `\ekvd@cur'}} \def\ekvd@err@choice@invalid#1% {% - \ekvd@err@choice@invalid@#1\ekv@stop + \ekvd@err@choice@invalid@#1% } \begingroup \catcode40=8 @@ -895,13 +1005,13 @@ \@firstofone{\endgroup \def\ekvd@choice@name#1#2#3% {% - ekvd#1(#2)#3% + ekvd#1(#2)\detokenize{#3}% } \def\ekvd@unknown@choice@name#1#2% {% ekvd:u:#1(#2)% } -\def\ekvd@err@choice@invalid@ ekvd#1(#2)#3\ekv@stop% +\def\ekvd@err@choice@invalid@ ekvd#1(#2)\detokenize#3% {% \ekv@ifdefined{\ekvd@unknown@choice@name{#1}{#2}}% {\csname\ekvd@unknown@choice@name{#1}{#2}\endcsname{#3}}% diff --git a/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty b/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty index c6075002674..37278b8213e 100644 --- a/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty +++ b/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2020-2021 Jonathan P. Spratte +%% Copyright (C) 2020-2022 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 |