texlive[61796] Master/texmf-dist: expkv-def/ (29jan22)
commits+karl at tug.org
commits+karl at tug.org
Sat Jan 29 22:47:48 CET 2022
Revision: 61796
http://tug.org/svn/texlive?view=revision&revision=61796
Author: karl
Date: 2022-01-29 22:47:48 +0100 (Sat, 29 Jan 2022)
Log Message:
-----------
expkv-def/ (29jan22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/expkv-def/README.md
trunk/Master/texmf-dist/doc/latex/expkv-def/expkv-def.pdf
trunk/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx
trunk/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex
trunk/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex
trunk/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty
Modified: trunk/Master/texmf-dist/doc/latex/expkv-def/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/expkv-def/README.md 2022-01-29 21:46:43 UTC (rev 61795)
+++ trunk/Master/texmf-dist/doc/latex/expkv-def/README.md 2022-01-29 21:47:48 UTC (rev 61796)
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv-def -- a key-defining frontend for expkv
-Version 2021-09-20 v0.8c
+Version 2022-01-29 v0.9
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-def/expkv-def.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx 2022-01-29 21:46:43 UTC (rev 61795)
+++ trunk/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx 2022-01-29 21:47:48 UTC (rev 61796)
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% File: expkv-def.dtx Copyright (C) 2020-2021 Jonathan P. Spratte
+% File: expkv-def.dtx 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
@@ -27,7 +27,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
@@ -623,14 +623,15 @@
% instead.
% \end{function}
%
-% \begin{function}{toks,gtoks,apptoks,gapptoks}
+% \begin{function}{toks,gtoks,apptoks,gapptoks,pretoks,gpretoks}
% \begin{syntax}
% toks \key\ = \meta{cs} \prefixes2212
% \end{syntax}
% The \meta{cs} should be a single control sequence, such as |\foo|.
% Store \val\ inside of a toks-register. The |g| variants use |\global|, the
-% |app| variants append \val\ to the contents of that register. If \meta{cs}
-% is not yet defined it will be initialised with |\newtoks|.
+% |app| variants append \val\ to the contents of that register, the |pre|
+% variants will prepend \val. If \meta{cs} is not yet defined it will be
+% initialised with |\newtoks|.
% \end{function}
%
% \begin{function}{box,gbox}
@@ -706,6 +707,49 @@
% interface to remove certain choices.
% \end{function}
%
+% \begin{function}{choice-store}
+% \begin{syntax}
+% choice-store \key\ = \meta{cs}\{\val, \ldots\} \prefixes2223
+% \end{syntax}
+% This is defines a special type of |choice| key that'll store the given
+% choice inside the macro \meta{cs} (so \meta{cs} should be a single control
+% sequence name such as |\foo|). Since storing inside a macro can't be done
+% expandably every choice-code is |\protected|, you might define the
+% |choice-store| key itself as |protected| as well if you want. Since the
+% definition of each choice is predefined with this key type the choice list
+% should just be a comma separated list of valid choices.
+% \end{function}
+% This means that the following |choice| and |choice-store| keys are equivalent
+% at use time:
+% \begin{lstlisting}
+% \newcommand*\mya{}
+% \ekvdefinekeys{example}
+% {
+% choice key1 = {a=\def\mya{a}, b=\def\mya{b}, c=\def\mya{c}}
+% ,choice-store key2 = \mya{a,b,c}
+% }
+% \end{lstlisting}
+%
+% \begin{function}{choice-enum}
+% \begin{syntax}
+% choice-enum \key\ = \meta{cs}\{\val, \ldots\} \prefixes2223
+% \end{syntax}
+% This is similar to |choice-store|, the differences are: \meta{cs} should be
+% a count-register or is initialised as such if the \meta{cs} is undefined
+% (via |\newcount|); instead of the value the position of the value in the
+% given list is stored in this register (zero-based).
+% \end{function}
+% This means that the following |choice| and |choice-enum| keys are equivalent
+% at use time:
+% \begin{lstlisting}
+% \newcount\myb
+% \ekvdefinekeys{example}
+% {
+% choice key1 = {a={\myb=0 }, b={\myb=1 }, c={\myb=2 }}
+% ,choice-enum key2 = \myb{a,b,c}
+% }
+% \end{lstlisting}
+%
% \begin{function}{unknown-choice}
% \begin{syntax}
% unknown-choice \key\ = \marg{definition} \prefixes2323
@@ -956,8 +1000,8 @@
% \begin{macro}{\ekvdVersion,\ekvdDate}
% We're on our first input, so lets store the version and date in a macro.
% \begin{macrocode}
-\def\ekvdVersion{0.8c}
-\def\ekvdDate{2021-09-20}
+\def\ekvdVersion{0.9}
+\def\ekvdDate{2022-01-29}
% \end{macrocode}
% \end{macro}
%
@@ -978,8 +1022,25 @@
% defining. But we don't need it to ever store information long-term after
% \expkvd\ was initialized.
%
+% \begin{macro}[internal]{\ekvd at ifprimitive}
+% \begin{macrocode}
+\protected\long\def\ekvd at ifprimitive#1%
+ {%
+ \begingroup
+ \edef\ekvd at tmpa{\string #1}%
+ \edef\ekvd at tmpb{\meaning#1}%
+ \expandafter
+ \endgroup
+ \ifx\ekvd at tmpa\ekvd at tmpb
+ \ekv at fi@firstoftwo
+ \fi
+ \@secondoftwo
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal]
-% {\ekvd at long,\ekvd at prot,\ekvd at clear@prefixes,\ekvd at empty,\ekvd at ifalso}
+% {\ekvd at long,\ekvd at prot,\ekvd at clear@prefixes,\ekvd at ifalso}
% \expkvd\ will use |\ekvd at long|, |\ekvd at prot|, and |\ekvd at ifalso| to store
% whether a key should be defined as |\long| or |\protected| or adds an action
% to an existing key, and we have to clear them for every new key. By default
@@ -986,11 +1047,10 @@
% |long| and |protected| will just be empty, |ifalso| will be
% |\@secondoftwo|, and |ifnew| will just use its third argument.
% \begin{macrocode}
-\def\ekvd at empty{}
\protected\def\ekvd at clear@prefixes
{%
- \let\ekvd at long\ekvd at empty
- \let\ekvd at prot\ekvd at empty
+ \let\ekvd at long\ekv at empty
+ \let\ekvd at prot\ekv at empty
\let\ekvd at ifalso\@secondoftwo
\long\def\ekvd at ifnew##1##2##3{##3}%
}
@@ -1031,7 +1091,7 @@
\protected\long\def\ekvd at handle#1\ekvd at stop#2%
{%
\ekvd at clear@prefixes
- \edef\ekvd at cur{\detokenize{#1}}%
+ \def\ekvd at cur{#1}%
\ekvd at ifspace{#1}%
{\ekvd at prefix\ekv at mark#1\ekv at stop{#2}}%
\ekvd at err@missing at type
@@ -1409,11 +1469,11 @@
\ekvd at ifalso
{%
\let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1\setbox#3\hbox{\begingroup##1\endgroup}}{}%
+ \ekvd at add@val{#2}{#1\setbox#3=\hbox{\begingroup##1\endgroup}}{}%
}%
{%
\protected\ekvd at long\ekvdef\ekvd at set{#2}%
- {#1\setbox#3\hbox{\begingroup##1\endgroup}}%
+ {#1\setbox#3=\hbox{\begingroup##1\endgroup}}%
}%
}%
}%
@@ -1436,9 +1496,9 @@
\ekvd at ifalso
{%
\let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1#3{##1}}{}%
+ \ekvd at add@val{#2}{#1#3={##1}}{}%
}%
- {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3{##1}}}%
+ {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3={##1}}}%
}%
}%
}
@@ -1447,31 +1507,86 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\ekvd at type@apptoks,\ekvd at t@apptoks,\ekvd at t@gapptoks}
+% \begin{macro}[internal]{\ekvd at type@preapptoks,\ekvd at t@apptoks,\ekvd at t@gapptoks}
% Just like |toks|, but expand the current contents of the |toks| register to
% append the new contents.
% \begin{macrocode}
-\protected\def\ekvd at type@apptoks#1#2#3%
+\ekvd at ifprimitive\toksapp
{%
- \ekvd at ifnew{}{#2}%
+ \protected\def\ekvd at type@preapptoks#1#2#3%
{%
- \ekvd at assert@filledarg{#3}%
+ \ekvd at ifnew{}{#2}%
{%
- \ekvd at newreg#3{toks}%
- \ekvd at ifalso
+ \ekvd at assert@filledarg{#3}%
{%
- \let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1#3\expandafter{\the#3##1}}{}%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}{#1#3{##1}}{}%
+ }%
+ {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3{##1}}}%
}%
+ }%
+ }
+ \protected\def\ekvd at t@apptoks{\ekvd at type@preapptoks\toksapp}
+ \protected\def\ekvd at t@gapptoks{\ekvd at type@preapptoks\gtoksapp}
+ \protected\def\ekvd at t@pretoks{\ekvd at type@preapptoks\tokspre}
+ \protected\def\ekvd at t@gpretoks{\ekvd at type@preapptoks\gtokspre}
+ }
+ {%
+ \protected\def\ekvd at type@apptoks#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@filledarg{#3}%
{%
- \protected\ekvd at long\ekvdef\ekvd at set{#2}%
- {#1#3\expandafter{\the#3##1}}%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}{#1#3=\expandafter{\the#3##1}}{}%
+ }%
+ {%
+ \protected\ekvd at long\ekvdef\ekvd at set{#2}%
+ {#1#3=\expandafter{\the#3##1}}%
+ }%
}%
}%
- }%
+ }
+ \protected\def\ekvd at t@apptoks{\ekvd at type@apptoks{}}
+ \protected\def\ekvd at t@gapptoks{\ekvd at type@apptoks\global}
+ \newtoks\ekvd at toks
+ \protected\def\ekvd at type@pretoks#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@filledarg{#3}%
+ {%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}%
+ {%
+ \ekvd at toks={##1}%
+ #1#3=\expandafter{\the\expandafter\ekvd at toks\the#3}%
+ }%
+ {}%
+ }%
+ {%
+ \protected\ekvd at long\ekvdef\ekvd at set{#2}%
+ {%
+ \ekvd at toks={##1}%
+ #1#3=\expandafter{\the\expandafter\ekvd at toks\the#3}%
+ }%
+ }%
+ }%
+ }%
+ }
+ \protected\def\ekvd at t@pretoks{\ekvd at type@pretoks{}}
+ \protected\def\ekvd at t@gpretoks{\ekvd at type@pretoks\global}
}
-\protected\def\ekvd at t@apptoks{\ekvd at type@apptoks{}}
-\protected\def\ekvd at t@gapptoks{\ekvd at type@apptoks\global}
% \end{macrocode}
% \end{macro}
%
@@ -1525,7 +1640,7 @@
{%
\ekvd at assert@filledarg{#4}%
{%
- \ekvd at newlet#4\ekvd at empty
+ \ekvd at newlet#4\ekv at empty
\ekvd at ifalso
{%
\let\ekvd at prot\protected
@@ -1615,10 +1730,12 @@
%
% \begin{macro}[internal]
% {
-% \ekvd at type@choice,\ekvd at populate@choice,\ekvd at populate@choice@,
-% \ekvd at populate@choice at noarg,\ekvd at choice@prefix,\ekvd at choice@prefix@,
+% \ekvd at type@choice,
+% \ekvd at populate@choice,\ekvd at populate@choice@,\ekvd at populate@choice at noarg,
+% \ekvd at choice@prefix,\ekvd at choice@prefix@,\ekvd at choice@prefix at done,
% \ekvd at choice@p at protected,\ekvd at choice@p at protect,
-% \ekvd at choice@p at long,\ekvd at choice@p at long@,\ekvd at t@choice
+% \ekvd at choice@p at long,\ekvd at choice@p at long@,
+% \ekvd at t@choice
% }
% The |choice| type is by far the most complex type, as we have to run a
% sub-parser on the choice-definition list, which should support the |@p@| type
@@ -1629,8 +1746,13 @@
\protected\def\ekvd at type@choice#1%
{%
\ekvd at assert@not at long
- \ekvd at prot\edef\ekvd at tmp##1%
- {\ekv at unexpanded{\ekvd at h@choice}{\ekvd at choice@name\ekvd at set{#1}{##1}}}%
+ \ekv at expargtwice{\ekvd at prot\def\ekvd at tmp##1}%
+ {%
+ \expandafter\expandafter\expandafter
+ \ekvd at h@choice
+ \expandafter\expandafter\expandafter
+ {\expandafter\ekvd at choice@name\expandafter{\ekvd at set}{#1}{##1}}%
+ }%
\ekvd at ifalso
{%
\ekvd at assert@val{#1}%
@@ -1672,37 +1794,36 @@
\protected\long\def\ekvd at populate@choice@#1#2%
{%
\ekvd at clear@prefixes
- \expandafter\ekvd at assert@arg at msg\expandafter{\ekvd at cur : #1}%
+ \ekvd at ifspace{#1}%
+ {\ekvd at choice@prefix{\ekv at mark#1}\ekv at mark#1\ekv at stop}%
{%
- \ekvd at ifspace{#1}%
- {\ekvd at choice@prefix\ekv at mark#1\ekv at stop}%
- {%
- \expandafter\def
- \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#1}\endcsname
- }%
- {#2}%
+ \expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#1}\endcsname
}%
+ {\unexpanded{#2}}%
}
-\protected\def\ekvd at choice@prefix#1
+\protected\def\ekvd at choice@prefix#1#2
{%
- \ekv at strip{#1}\ekvd at choice@prefix@\ekv at mark
+ \ekv at strip{#2}{\ekvd at choice@prefix@{#1}}\ekv at mark
}
-\protected\def\ekvd at choice@prefix@#1#2\ekv at stop
+\protected\def\ekvd at choice@prefix@#1#2#3\ekv at stop
{%
- \ekv at ifdefined{ekvd at choice@p@#1}%
+ \ekv at ifdefined{ekvd at choice@p@#2}%
{%
- \csname ekvd at choice@p@#1\endcsname
- \ekvd at ifspace{#2}%
- {\ekvd at choice@prefix#2\ekv at stop}%
- {%
- \ekvd at prot\expandafter\def
- \csname
- \ekv at strip{#2}{\ekvd at choice@name\ekvd at set\ekvd at set@choice}%
- \endcsname
- }%
+ \csname ekvd at choice@p@#2\endcsname
+ \ekvd at ifspace{#3}%
+ {\ekvd at choice@prefix{#3}#3\ekv at stop}%
+ {\ekvd at choice@prefix at done{#3}}%
}%
- {\ekvd at err@undefined at prefix{#1}\@gobble}%
+ {\ekvd at choice@prefix at done{#1}}%
}
+\protected\def\ekvd at choice@prefix at done#1%
+ {%
+ \ekvd at prot\expandafter\edef
+ \csname
+ \ekv at strip{#1}{\ekvd at choice@name\ekvd at set\ekvd at set@choice}%
+ \endcsname
+ }
\protected\def\ekvd at choice@p at protected{\let\ekvd at prot\protected}
\let\ekvd at choice@p at protect\ekvd at choice@p at protected
\protected\def\ekvd at choice@invalid at p#1\ekvd at ifspace#2%
@@ -1736,6 +1857,82 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\ekvd at t@choice-store,\ekvd at t@choice-enum}
+% These two types define a special kind of |choice| key and are quite similar,
+% the only difference is what the different choices do (hence they use a
+% shared initialisation which differs in the chosen |populate| step).
+% \begin{macrocode}
+\protected\long\expandafter\def\csname ekvd at t@choice-store\endcsname
+ {\ekvd at type@choicespecial\ekvd at populate@choicestore}
+\protected\long\expandafter\def\csname ekvd at t@choice-enum\endcsname
+ {\ekvd at type@choicespecial\ekvd at populate@choiceenum}
+% \end{macrocode}
+% \begin{macro}[internal]{\ekvd at type@choicespecial}
+% Initialise similar to a |choice| key. The difference is that we require two
+% arguments (which we assert), a macro to store things in, and a |csv|-list
+% containing the allowed values. |#1| is the |populate| macro according to the
+% type used.
+% \begin{macrocode}
+\protected\long\def\ekvd at type@choicespecial#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@twoargs{#3}%
+ {%
+ \ekvd at type@choice{#2}%
+ \def\ekvd at set@choice{#2}%
+ #1#3%
+ }%
+ }%
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}[internal]
+% {\ekvd at populate@choicestore,\ekvd at populate@choicestore@}
+% We initialise the storing macro if it doesn't yet exist, and then we loop
+% over the value list. The |\edef|s with |\unexpanded| are both necessary to
+% be able to store macro parameter tokens (the outer protects at define time,
+% the inner at use time).
+% \begin{macrocode}
+\protected\long\def\ekvd at populate@choicestore#1%
+ {%
+ \ekvd at newlet#1\ekv at empty
+ \ekvcsvloop{\ekvd at populate@choicestore@#1}%
+ }
+\protected\long\def\ekvd at populate@choicestore@#1#2%
+ {%
+ \protected\expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#2}\endcsname
+ {\unexpanded{\edef#1{\unexpanded{#2}}}}%
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}[internal]
+% {\ekvd at populate@choiceenum,\ekvd at populate@choiceenum@}
+% This is similar to the population of a |choice-store| type, but instead of
+% storing the values in a macro this initialises a count and stores the
+% position of the value in the list inside that count (zero-indexed). The
+% space is necessary to terminate the number scanning, which is the reason we
+% use |\@firstofone| (so that the space after the macro name isn't gobbled by
+% \TeX).
+% \begin{macrocode}
+\protected\long\def\ekvd at populate@choiceenum#1%
+ {%
+ \ekvd at newreg#1{count}%
+ \def\ekvd at tmp{0}%
+ \ekvcsvloop{\ekvd at populate@choiceenum@#1}%
+ }
+\protected\long\def\ekvd at populate@choiceenum@#1#2%
+ {%
+ \protected\expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#2}\endcsname
+ {#1=\@firstofone{\ekvd at tmp} }%
+ \edef\ekvd at tmp{\the\numexpr\ekvd at tmp+1\relax}%
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}[internal]{\ekvd at t@unknown-choice}
% \begin{macrocode}
\protected\long\expandafter\def\csname ekvd at t@unknown-choice\endcsname#1#2%
@@ -2043,7 +2240,7 @@
\protected\def\ekvd at assert@noval@#1%
{%
\expandafter\ekvd at extract@args\meaning#1\ekvd at stop
- \unless\ifx\ekvd at extracted@args\ekvd at empty
+ \unless\ifx\ekvd at extracted@args\ekv at empty
\ekvd at err@unsupported at arg
\fi
\@firstofone
@@ -2243,7 +2440,7 @@
% \begin{macrocode}
\def\ekvd at err@choice at invalid#1%
{%
- \ekvd at err@choice at invalid@#1\ekv at stop
+ \ekvd at err@choice at invalid@#1%
}
\begingroup
\catcode40=8
@@ -2251,13 +2448,13 @@
\@firstofone{\endgroup
\def\ekvd at choice@name#1#2#3%
{%
- ekvd#1(#2)#3%
+ ekvd#1(#2)\detokenize{#3}%
}
\def\ekvd at unknown@choice at name#1#2%
{%
ekvd:u:#1(#2)%
}
-\def\ekvd at err@choice at invalid@ ekvd#1(#2)#3\ekv at stop%
+\def\ekvd at err@choice at invalid@ ekvd#1(#2)\detokenize#3%
{%
\ekv at ifdefined{\ekvd at unknown@choice at name{#1}{#2}}%
{\csname\ekvd at unknown@choice at name{#1}{#2}\endcsname{#3}}%
Modified: trunk/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex 2022-01-29 21:46:43 UTC (rev 61795)
+++ trunk/Master/texmf-dist/tex/context/third/expkv-def/t-expkv-def.tex 2022-01-29 21:47:48 UTC (rev 61796)
@@ -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
Modified: trunk/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex 2022-01-29 21:46:43 UTC (rev 61795)
+++ trunk/Master/texmf-dist/tex/generic/expkv-def/expkv-def.tex 2022-01-29 21:47:48 UTC (rev 61796)
@@ -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 at tmp\endcsname
\expandafter\chardef\csname ekvd at tmp\endcsname=\catcode`\@
\catcode`\@=11
-\def\ekvd at empty{}
+\protected\long\def\ekvd at ifprimitive#1%
+ {%
+ \begingroup
+ \edef\ekvd at tmpa{\string #1}%
+ \edef\ekvd at tmpb{\meaning#1}%
+ \expandafter
+ \endgroup
+ \ifx\ekvd at tmpa\ekvd at tmpb
+ \ekv at fi@firstoftwo
+ \fi
+ \@secondoftwo
+ }
\protected\def\ekvd at clear@prefixes
{%
- \let\ekvd at long\ekvd at empty
- \let\ekvd at prot\ekvd at empty
+ \let\ekvd at long\ekv at empty
+ \let\ekvd at prot\ekv at empty
\let\ekvd at ifalso\@secondoftwo
\long\def\ekvd at ifnew##1##2##3{##3}%
}
@@ -68,7 +79,7 @@
\protected\long\def\ekvd at handle#1\ekvd at stop#2%
{%
\ekvd at clear@prefixes
- \edef\ekvd at cur{\detokenize{#1}}%
+ \def\ekvd at cur{#1}%
\ekvd at ifspace{#1}%
{\ekvd at prefix\ekv at mark#1\ekv at stop{#2}}%
\ekvd at err@missing at type
@@ -323,11 +334,11 @@
\ekvd at ifalso
{%
\let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1\setbox#3\hbox{\begingroup##1\endgroup}}{}%
+ \ekvd at add@val{#2}{#1\setbox#3=\hbox{\begingroup##1\endgroup}}{}%
}%
{%
\protected\ekvd at long\ekvdef\ekvd at set{#2}%
- {#1\setbox#3\hbox{\begingroup##1\endgroup}}%
+ {#1\setbox#3=\hbox{\begingroup##1\endgroup}}%
}%
}%
}%
@@ -344,35 +355,90 @@
\ekvd at ifalso
{%
\let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1#3{##1}}{}%
+ \ekvd at add@val{#2}{#1#3={##1}}{}%
}%
- {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3{##1}}}%
+ {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3={##1}}}%
}%
}%
}
\protected\def\ekvd at t@toks{\ekvd at type@toks{}}
\protected\def\ekvd at t@gtoks{\ekvd at type@toks\global}
-\protected\def\ekvd at type@apptoks#1#2#3%
+\ekvd at ifprimitive\toksapp
{%
- \ekvd at ifnew{}{#2}%
+ \protected\def\ekvd at type@preapptoks#1#2#3%
{%
- \ekvd at assert@filledarg{#3}%
+ \ekvd at ifnew{}{#2}%
{%
- \ekvd at newreg#3{toks}%
- \ekvd at ifalso
+ \ekvd at assert@filledarg{#3}%
{%
- \let\ekvd at prot\protected
- \ekvd at add@val{#2}{#1#3\expandafter{\the#3##1}}{}%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}{#1#3{##1}}{}%
+ }%
+ {\protected\ekvd at long\ekvdef\ekvd at set{#2}{#1#3{##1}}}%
}%
+ }%
+ }
+ \protected\def\ekvd at t@apptoks{\ekvd at type@preapptoks\toksapp}
+ \protected\def\ekvd at t@gapptoks{\ekvd at type@preapptoks\gtoksapp}
+ \protected\def\ekvd at t@pretoks{\ekvd at type@preapptoks\tokspre}
+ \protected\def\ekvd at t@gpretoks{\ekvd at type@preapptoks\gtokspre}
+ }
+ {%
+ \protected\def\ekvd at type@apptoks#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@filledarg{#3}%
{%
- \protected\ekvd at long\ekvdef\ekvd at set{#2}%
- {#1#3\expandafter{\the#3##1}}%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}{#1#3=\expandafter{\the#3##1}}{}%
+ }%
+ {%
+ \protected\ekvd at long\ekvdef\ekvd at set{#2}%
+ {#1#3=\expandafter{\the#3##1}}%
+ }%
}%
}%
- }%
+ }
+ \protected\def\ekvd at t@apptoks{\ekvd at type@apptoks{}}
+ \protected\def\ekvd at t@gapptoks{\ekvd at type@apptoks\global}
+ \newtoks\ekvd at toks
+ \protected\def\ekvd at type@pretoks#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@filledarg{#3}%
+ {%
+ \ekvd at newreg#3{toks}%
+ \ekvd at ifalso
+ {%
+ \let\ekvd at prot\protected
+ \ekvd at add@val{#2}%
+ {%
+ \ekvd at toks={##1}%
+ #1#3=\expandafter{\the\expandafter\ekvd at toks\the#3}%
+ }%
+ {}%
+ }%
+ {%
+ \protected\ekvd at long\ekvdef\ekvd at set{#2}%
+ {%
+ \ekvd at toks={##1}%
+ #1#3=\expandafter{\the\expandafter\ekvd at toks\the#3}%
+ }%
+ }%
+ }%
+ }%
+ }
+ \protected\def\ekvd at t@pretoks{\ekvd at type@pretoks{}}
+ \protected\def\ekvd at t@gpretoks{\ekvd at type@pretoks\global}
}
-\protected\def\ekvd at t@apptoks{\ekvd at type@apptoks{}}
-\protected\def\ekvd at t@gapptoks{\ekvd at type@apptoks\global}
\protected\def\ekvd at type@reg#1#2#3#4#5#6%
{%
\ekvd at ifnew{}{#5}%
@@ -407,7 +473,7 @@
{%
\ekvd at assert@filledarg{#4}%
{%
- \ekvd at newlet#4\ekvd at empty
+ \ekvd at newlet#4\ekv at empty
\ekvd at ifalso
{%
\let\ekvd at prot\protected
@@ -475,8 +541,13 @@
\protected\def\ekvd at type@choice#1%
{%
\ekvd at assert@not at long
- \ekvd at prot\edef\ekvd at tmp##1%
- {\ekv at unexpanded{\ekvd at h@choice}{\ekvd at choice@name\ekvd at set{#1}{##1}}}%
+ \ekv at expargtwice{\ekvd at prot\def\ekvd at tmp##1}%
+ {%
+ \expandafter\expandafter\expandafter
+ \ekvd at h@choice
+ \expandafter\expandafter\expandafter
+ {\expandafter\ekvd at choice@name\expandafter{\ekvd at set}{#1}{##1}}%
+ }%
\ekvd at ifalso
{%
\ekvd at assert@val{#1}%
@@ -506,37 +577,36 @@
\protected\long\def\ekvd at populate@choice@#1#2%
{%
\ekvd at clear@prefixes
- \expandafter\ekvd at assert@arg at msg\expandafter{\ekvd at cur : #1}%
+ \ekvd at ifspace{#1}%
+ {\ekvd at choice@prefix{\ekv at mark#1}\ekv at mark#1\ekv at stop}%
{%
- \ekvd at ifspace{#1}%
- {\ekvd at choice@prefix\ekv at mark#1\ekv at stop}%
- {%
- \expandafter\def
- \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#1}\endcsname
- }%
- {#2}%
+ \expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#1}\endcsname
}%
+ {\unexpanded{#2}}%
}
-\protected\def\ekvd at choice@prefix#1
+\protected\def\ekvd at choice@prefix#1#2
{%
- \ekv at strip{#1}\ekvd at choice@prefix@\ekv at mark
+ \ekv at strip{#2}{\ekvd at choice@prefix@{#1}}\ekv at mark
}
-\protected\def\ekvd at choice@prefix@#1#2\ekv at stop
+\protected\def\ekvd at choice@prefix@#1#2#3\ekv at stop
{%
- \ekv at ifdefined{ekvd at choice@p@#1}%
+ \ekv at ifdefined{ekvd at choice@p@#2}%
{%
- \csname ekvd at choice@p@#1\endcsname
- \ekvd at ifspace{#2}%
- {\ekvd at choice@prefix#2\ekv at stop}%
- {%
- \ekvd at prot\expandafter\def
- \csname
- \ekv at strip{#2}{\ekvd at choice@name\ekvd at set\ekvd at set@choice}%
- \endcsname
- }%
+ \csname ekvd at choice@p@#2\endcsname
+ \ekvd at ifspace{#3}%
+ {\ekvd at choice@prefix{#3}#3\ekv at stop}%
+ {\ekvd at choice@prefix at done{#3}}%
}%
- {\ekvd at err@undefined at prefix{#1}\@gobble}%
+ {\ekvd at choice@prefix at done{#1}}%
}
+\protected\def\ekvd at choice@prefix at done#1%
+ {%
+ \ekvd at prot\expandafter\edef
+ \csname
+ \ekv at strip{#1}{\ekvd at choice@name\ekvd at set\ekvd at set@choice}%
+ \endcsname
+ }
\protected\def\ekvd at choice@p at protected{\let\ekvd at prot\protected}
\let\ekvd at choice@p at protect\ekvd at choice@p at protected
\protected\def\ekvd at choice@invalid at p#1\ekvd at ifspace#2%
@@ -563,6 +633,46 @@
}%
}%
}
+\protected\long\expandafter\def\csname ekvd at t@choice-store\endcsname
+ {\ekvd at type@choicespecial\ekvd at populate@choicestore}
+\protected\long\expandafter\def\csname ekvd at t@choice-enum\endcsname
+ {\ekvd at type@choicespecial\ekvd at populate@choiceenum}
+\protected\long\def\ekvd at type@choicespecial#1#2#3%
+ {%
+ \ekvd at ifnew{}{#2}%
+ {%
+ \ekvd at assert@twoargs{#3}%
+ {%
+ \ekvd at type@choice{#2}%
+ \def\ekvd at set@choice{#2}%
+ #1#3%
+ }%
+ }%
+ }
+\protected\long\def\ekvd at populate@choicestore#1%
+ {%
+ \ekvd at newlet#1\ekv at empty
+ \ekvcsvloop{\ekvd at populate@choicestore@#1}%
+ }
+\protected\long\def\ekvd at populate@choicestore@#1#2%
+ {%
+ \protected\expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#2}\endcsname
+ {\unexpanded{\edef#1{\unexpanded{#2}}}}%
+ }
+\protected\long\def\ekvd at populate@choiceenum#1%
+ {%
+ \ekvd at newreg#1{count}%
+ \def\ekvd at tmp{0}%
+ \ekvcsvloop{\ekvd at populate@choiceenum@#1}%
+ }
+\protected\long\def\ekvd at populate@choiceenum@#1#2%
+ {%
+ \protected\expandafter\edef
+ \csname\ekvd at choice@name\ekvd at set\ekvd at set@choice{#2}\endcsname
+ {#1=\@firstofone{\ekvd at tmp} }%
+ \edef\ekvd at tmp{\the\numexpr\ekvd at tmp+1\relax}%
+ }
\protected\long\expandafter\def\csname ekvd at t@unknown-choice\endcsname#1#2%
{%
\ekvd at assert@new at for@name{\ekvd at unknown@choice at name\ekvd at set{#1}}%
@@ -763,7 +873,7 @@
\protected\def\ekvd at assert@noval@#1%
{%
\expandafter\ekvd at extract@args\meaning#1\ekvd at stop
- \unless\ifx\ekvd at extracted@args\ekvd at empty
+ \unless\ifx\ekvd at extracted@args\ekv at empty
\ekvd at err@unsupported at arg
\fi
\@firstofone
@@ -887,7 +997,7 @@
{\ekvd at errm{Misuse of the unknown type found while processing `\ekvd at cur'}}
\def\ekvd at err@choice at invalid#1%
{%
- \ekvd at err@choice at invalid@#1\ekv at stop
+ \ekvd at err@choice at invalid@#1%
}
\begingroup
\catcode40=8
@@ -895,13 +1005,13 @@
\@firstofone{\endgroup
\def\ekvd at choice@name#1#2#3%
{%
- ekvd#1(#2)#3%
+ ekvd#1(#2)\detokenize{#3}%
}
\def\ekvd at unknown@choice at name#1#2%
{%
ekvd:u:#1(#2)%
}
-\def\ekvd at err@choice at invalid@ ekvd#1(#2)#3\ekv at stop%
+\def\ekvd at err@choice at invalid@ ekvd#1(#2)\detokenize#3%
{%
\ekv at ifdefined{\ekvd at unknown@choice at name{#1}{#2}}%
{\csname\ekvd at unknown@choice at name{#1}{#2}\endcsname{#3}}%
Modified: trunk/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty 2022-01-29 21:46:43 UTC (rev 61795)
+++ trunk/Master/texmf-dist/tex/latex/expkv-def/expkv-def.sty 2022-01-29 21:47:48 UTC (rev 61796)
@@ -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
More information about the tex-live-commits
mailing list.