texlive[56643] Master: expkv-def (12oct20)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 12 23:40:19 CEST 2020


Revision: 56643
          http://tug.org/svn/texlive?view=revision&revision=56643
Author:   karl
Date:     2020-10-12 23:40:18 +0200 (Mon, 12 Oct 2020)
Log Message:
-----------
expkv-def (12oct20)

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/generic/expkv-def/expkv-def.tex
    trunk/Master/tlpkg/bin/tlpkg-ctan-check

Modified: trunk/Master/texmf-dist/doc/latex/expkv-def/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/expkv-def/README.md	2020-10-11 23:53:47 UTC (rev 56642)
+++ trunk/Master/texmf-dist/doc/latex/expkv-def/README.md	2020-10-12 21:40:18 UTC (rev 56643)
@@ -1,7 +1,7 @@
 -------------------------------------------------------------------------------
 # expkv-def -- a key-defining frontend for expkv
 
-Version 2020-07-12 v0.5
+Version 2020-10-12 v0.6
 
 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	2020-10-11 23:53:47 UTC (rev 56642)
+++ trunk/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx	2020-10-12 21:40:18 UTC (rev 56643)
@@ -146,31 +146,24 @@
 \newcommand\key{\meta{key}}
 \newcommand\val{\meta{value}}
 \newcommand\set{\meta{set}}
-\newcommand\enfprot{\textcolor{black}{protected}}
-\newcommand\allprot{\textcolor{gray}{protected}}
-\newcommand\notprot{\textcolor{red!80!black}{protected}}
-\newcommand\enflong{\textcolor{black}{long}}
-\newcommand\alllong{\textcolor{gray}{long}}
-\newcommand\notlong{\textcolor{red!80!black}{long}}
-\newcommand\enfalso{\textcolor{black}{also}}
-\newcommand\allalso{\textcolor{gray}{also}}
-\newcommand\notalso{\textcolor{red!80!black}{also}}
-\newcommand\prefixes[3]
+\newcommand\enfprefix{\textcolor{black}}
+\newcommand\allprefix{\textcolor{gray}}
+\newcommand\notprefix{\textcolor{red!80!black}}
+\newcommand\printprefix[2]
   {^^A
-    \hfill
     \ifcase\numexpr#1\relax\or
-      \enfalso\or
-      \allalso\or
-      \notalso\fi\space
-    \ifcase\numexpr#2\relax\or
-      \enfprot\or
-      \allprot\or
-      \notprot\fi\space
-    \ifcase\numexpr#3\relax\or
-      \enflong\or
-      \alllong\or
-      \notlong\fi
+      \enfprefix{#2}\or
+      \allprefix{#2}\or
+      \notprefix{#2}\fi
   }
+\newcommand\prefixes[4]
+  {^^A
+    \hfill
+    \printprefix{#1}{new}
+    \printprefix{#2}{also}
+    \printprefix{#3}{protected}
+    \printprefix{#4}{long}^^A
+  }
 \hypersetup{linkcolor=red!80!black,urlcolor=purple!80!black}
 \DoNotIndex{\def,\edef,\,,\=,\begingroup,\catcode,\chardef,\csname,\endcsname}
 \DoNotIndex{\endgroup,\endinput,\errmessage,\expandafter,\input,\let,\long}
@@ -282,9 +275,9 @@
 % The two |p|-type prefixes |long| and |protected| are pretty simple by nature,
 % so their description is pretty simple. They affect the \key\ at use-time, so
 % omitting |long| doesn't mean that a \meta{definition} can't contain a |\par|
-% token, only that the \key\ will not accept a |\par| in \val. On the other hand
-% |also| might be simple on first sight as well, but its rules are a bit more
-% complicated.
+% token, only that the \key\ will not accept a |\par| in \val.  On the other
+% hand |new| and |also| might be simple on first sight as well, but their rules
+% are a bit more complicated.
 %
 % \begin{function}{also}
 %   The following key type will be \emph{added} to an existing \key's
@@ -306,9 +299,16 @@
 % \ekvdefinekeys{also-example}
 %   {
 %      bool key      = \ifmybool
-%     ,also code key = \domystuff
+%     ,also code key = \domystuff{#1}
 %   }
 % \end{lstlisting}
+%
+%   If you use |also| on a |choice|, |bool|, |invbool|, or |boolpair| key it is
+%   tried to determine if the key already is of one of those types. If this test
+%   is true the declared choices will be added to the possible choices but the
+%   key's definition will not be changed other than that. If that wouldn't have
+%   been done, the callbacks of the different choices could get called multiple
+%   times.
 % \end{function}
 %
 % \begin{function}{protected,protect}
@@ -320,17 +320,33 @@
 %   The following key will be defined |\long|.
 % \end{function}
 %
+% \begin{function}{new}
+%   The following key must be new (so previously undefined). An error is thrown
+%   if it is already defined and the new definition is ignored. |new| only
+%   asserts that there are no conflicts between |NoVal| keys and other |NoVal|
+%   keys or value taking keys and other value taking keys. For example you can
+%   use the following without an error:
+% \begin{lstlisting}
+% \ekvdefinekeys{new-example}
+%   {
+%      code key       = \domystuffwitharg{#1}
+%     ,new  noval key = \domystuffwithoutarg
+%   }
+% \end{lstlisting}
+% \end{function}
+%
 % \subsubsection{\texttt{t}-Prefixes}\label{sec:prefix:t}
 % Since the |p|-type prefixes apply to some of the |t|-prefixes automatically
 % but sometimes one might be disallowed we need some way to highlight this
 % behaviour. In the following an enforced prefix will be printed black
-% (\texttt{\enfprot}), allowed prefixes will be grey (\texttt{\allprot}), and
-% disallowed prefixes will be red (\texttt{\notprot}). This will be put
-% flush-right in the syntax showing line.
+% (\texttt{\enfprefix{protected}}), allowed prefixes will be grey
+% (\texttt{\allprefix{protected}}), and disallowed prefixes will be red
+% (\texttt{\notprefix{protected}}). This will be put flush-right in the syntax
+% showing line.
 %
 % \begin{function}{code,ecode}
 %   \begin{syntax}
-%     code \key\ = \marg{definition} \prefixes222
+%     code \key\ = \marg{definition} \prefixes2222
 %   \end{syntax}
 %   Define \key\ to expand to \meta{definition}. The \key\ will require a \val\
 %   for which you can use |#1| inside \meta{definition}. The |ecode| variant
@@ -339,7 +355,7 @@
 %
 % \begin{function}{noval,enoval}
 %   \begin{syntax}
-%     noval \key\ = \marg{definition} \prefixes223
+%     noval \key\ = \marg{definition} \prefixes2223
 %   \end{syntax}
 %   The |noval| type defines \key\ to expand to \meta{definition}. The \key\
 %   will not take a \val. |enoval| fully expands \meta{definition} inside an
@@ -348,7 +364,7 @@
 %
 % \begin{function}{default,qdefault,edefault}
 %   \begin{syntax}
-%     default \key\ = \marg{definition} \prefixes223
+%     default \key\ = \marg{definition} \prefixes3223
 %   \end{syntax}
 %   This serves to place a default \val\ for a \key\ that takes an argument, the
 %   \key\ can be of any argument-grabbing kind, and when used without a \val\
@@ -360,7 +376,7 @@
 %
 % \begin{function}{initial,oinitial,einitial}
 %   \begin{syntax}
-%     initial \key\ = \{\val\} \prefixes333
+%     initial \key\ = \{\val\} \prefixes3333
 %   \end{syntax}
 %   With |initial| you can set an initial \val\ for an already defined argument
 %   taking \key. It'll just call the key-macro of \key\ and pass it \val. The
@@ -371,7 +387,7 @@
 %
 % \begin{function}{bool,gbool,boolTF,gboolTF}
 %   \begin{syntax}
-%     bool \key\ = \meta{cs} \prefixes223
+%     bool \key\ = \meta{cs} \prefixes2223
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\iffoo|.
 %   This will define \key\ to be a boolean key, which only takes the values
@@ -394,9 +410,28 @@
 %   choices.
 % \end{function}
 %
+% \begin{function}{invbool,ginvbool,invboolTF,ginvboolTF}
+%   \begin{syntax}
+%     bool \key\ = \meta{cs} \prefixes2223
+%   \end{syntax}
+%   These are inverse boolean keys, they behave like |bool| and friends but set
+%   the opposite meaning to the macro \meta{cs} in each case. So if
+%   \texttt{key=true} is used |invbool| will set \meta{cs} to |\iffalse| and
+%   vice versa.
+% \end{function}
+%
+% \begin{function}{boolpair,gboolpair,boolpairTF,gboolpairTF}
+%   \begin{syntax}
+%     boolpair \key\ = \meta{cs_1}\meta{cs_2} \prefixes2223
+%   \end{syntax}
+%   The |boolpair| key type behaves like both |bool| and |invbool|, the
+%   \meta{cs_1} will be set to the meaning according to the rules of |bool|, and
+%   \meta{cs_2} will be set to the opposite.
+% \end{function}
+%
 % \begin{function}{store,estore,gstore,xstore}
 %   \begin{syntax}
-%     store \key\ = \meta{cs} \prefixes212
+%     store \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|.
 %   This will define \key\ to store \val\ inside of the control sequence. If
@@ -408,7 +443,7 @@
 %
 % \begin{function}{data,edata,gdata,xdata}
 %   \begin{syntax}
-%     data \key\ = \meta{cs} \prefixes212
+%     data \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|. This will
 %   define \key\ to store \val\ inside of the control sequence. But unlike the
@@ -424,7 +459,7 @@
 %
 % \begin{function}{dataT,edataT,gdataT,xdataT}
 %   \begin{syntax}
-%     dataT \key\ = \meta{cs} \prefixes212
+%     dataT \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   Just like |data|, but instead of \meta{cs} grabbing two arguments it'll only
 %   grab one, so by default it'll behave like |\@gobble|, and if a \val\ was
@@ -434,7 +469,7 @@
 %
 % \begin{function}{int,eint,gint,xint}
 %   \begin{syntax}
-%     int \key\ = \meta{cs} \prefixes212
+%     int \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|.
 %   An |int| key will be a \TeX-count register. If \meta{cs} isn't defined yet,
@@ -445,7 +480,7 @@
 %
 % \begin{function}{dimen,edimen,gdimen,xdimen}
 %   \begin{syntax}
-%     dimen \key\ = \meta{cs} \prefixes212
+%     dimen \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|.
 %   This is just like |int| but uses a dimen register, |\newdimen| and
@@ -454,7 +489,7 @@
 %
 % \begin{function}{skip,eskip,gskip,xskip}
 %   \begin{syntax}
-%     skip \key\ = \meta{cs} \prefixes212
+%     skip \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|.
 %   This is just like |int| but uses a skip register, |\newskip| and |\glueexpr|
@@ -463,7 +498,7 @@
 %
 % \begin{function}{toks,gtoks,apptoks,gapptoks}
 %   \begin{syntax}
-%     toks \key\ = \meta{cs} \prefixes212
+%     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
@@ -473,7 +508,7 @@
 %
 % \begin{function}{box,gbox}
 %   \begin{syntax}
-%     box \key\ = \meta{cs} \prefixes212
+%     box \key\ = \meta{cs} \prefixes2212
 %   \end{syntax}
 %   The \meta{cs} should be a single control sequence, such as |\foo|.
 %   Typesets \val\ into a |\hbox| and stores the result in a box register. The
@@ -482,7 +517,7 @@
 %
 % \begin{function}{meta}
 %   \begin{syntax}
-%     meta \key\ = \{\kv, \ldots\} \prefixes222
+%     meta \key\ = \{\kv, \ldots\} \prefixes2222
 %   \end{syntax}
 %   This key type can set other keys, you can access the \val\ which was passed
 %   to \key\ inside the \kv\ list with |#1|. It works by calling a sub-|\ekvset|
@@ -493,7 +528,7 @@
 %
 % \begin{function}{nmeta}
 %   \begin{syntax}
-%     nmeta \key\ = \{\kv, \ldots\} \prefixes223
+%     nmeta \key\ = \{\kv, \ldots\} \prefixes2223
 %   \end{syntax}
 %   This key type can set other keys, the difference to |meta| is, that this key
 %   doesn't take a value, so the \kv\ list is static.
@@ -501,7 +536,7 @@
 %
 % \begin{function}{smeta}
 %   \begin{syntax}
-%     smeta \key\ = \marg{set}\{\kv, \ldots\} \prefixes222
+%     smeta \key\ = \marg{set}\{\kv, \ldots\} \prefixes2222
 %   \end{syntax}
 %   Yet another |meta| variant. An |smeta| key will take a \val\ which you can
 %   access using |#1|, but it sets the \kv\ list inside of \set, so is equal to
@@ -510,7 +545,7 @@
 %
 % \begin{function}{snmeta}
 %   \begin{syntax}
-%     snmeta \key\ = \marg{set}\{\kv, \ldots\} \prefixes223
+%     snmeta \key\ = \marg{set}\{\kv, \ldots\} \prefixes2223
 %   \end{syntax}
 %   And the last |meta| variant. |snmeta| is a combination of |smeta| and
 %   |nmeta|. It doesn't take an argument and sets the \kv\ list inside of \set.
@@ -518,7 +553,7 @@
 %
 % \begin{function}{set}
 %   \begin{syntax}
-%     set \key\ = \marg{set} \prefixes233
+%     set \key\ = \marg{set} \prefixes2233
 %   \end{syntax}
 %   This will define \key\ to change the set of the current |\ekvset|
 %   invocation to \set. You can omit \set\ (including the equals sign),
@@ -530,7 +565,7 @@
 %
 % \begin{function}{choice}
 %   \begin{syntax}
-%     choice \key\ = \{\val=\meta{definition}, \ldots\} \prefixes223
+%     choice \key\ = \{\val=\meta{definition}, \ldots\} \prefixes2223
 %   \end{syntax}
 %   Defines \key\ to be a |choice| key, meaning it will only accept a limited
 %   set of values. You should define each possible \val\ inside of the
@@ -546,12 +581,12 @@
 %
 % \begin{function}{unknown-choice}
 %   \begin{syntax}
-%     unknown-choice \key\ = \marg{definition} \prefixes323
+%     unknown-choice \key\ = \marg{definition} \prefixes2323
 %   \end{syntax}
-%   By default an unknown \val\ passed to a |choice| key will throw an error.
-%   However, with this prefix you can define an alternative action which should
-%   be executed if \key\ received an unknown choice. In \meta{definition} you
-%   can refer to the choice which was passed in with |#1|.
+%   By default an unknown \val\ passed to a |choice| or |bool| key will throw an
+%   error.  However, with this prefix you can define an alternative action which
+%   should be executed if \key\ received an unknown choice. In \meta{definition}
+%   you can refer to the choice which was passed in with |#1|.
 % \end{function}
 %
 % \subsection{Bugs}
@@ -579,8 +614,8 @@
 %     ,skip      keyI = \keyI
 %     ,toks      keyJ = \keyJ
 %     ,default   keyJ = \empty test
-%     ,box       keyK = \keyK
-%     ,qdefault  keyK = text
+%     ,new box   keyK = \keyK
+%     ,qdefault  keyK = K
 %     ,choice    keyL =
 %       {
 %          protected 1 = \texttt{a}
@@ -591,6 +626,8 @@
 %       }
 %     ,edefault  keyL = 2
 %     ,meta      keyM = {keyA={#1},keyB=false}
+%     ,invbool   keyN = \keyN
+%     ,boolpair  keyO = \keyOa\keyOb
 %   }
 % \end{lstlisting}
 %
@@ -718,8 +755,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.5}
-\def\ekvdDate{2020-07-12}
+\def\ekvdVersion{0.6}
+\def\ekvdDate{2020-10-12}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -745,8 +782,8 @@
 % \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
-% |long| and |protected| will just be empty and |ifalso| will be
-% |\@secondoftwo|.
+% |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
@@ -754,23 +791,12 @@
     \let\ekvd at long\ekvd at empty
     \let\ekvd at prot\ekvd at empty
     \let\ekvd at ifalso\@secondoftwo
+    \long\def\ekvd at ifnew##1##2##3{##3}%
   }
 \ekvd at clear@prefixes
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]{\ekvd at exp@Nno,\ekvd at exp@reinsert at n}
-%   These are expansion helpers, similar to what \LaTeX3 uses, but simpler and
-%   for just a few cases
-%    \begin{macrocode}
-\long\def\ekvd at exp@Nno#1#2#3%
-  {%
-    \expandafter\ekvd at exp@reinsert at n\expandafter{#3}{#1{#2}}%
-  }
-\long\def\ekvd at exp@reinsert at n#1#2{#2{#1}}
-%    \end{macrocode}
-% \end{macro}
-%
 % \begin{macro}{\ekvdefinekeys}
 % This is the one front-facing macro which provides the interface to define
 % keys. It's using |\ekvparse| to handle the \kv\ list, the interpretation will
@@ -780,19 +806,29 @@
 \protected\def\ekvdefinekeys#1%
   {%
     \def\ekvd at set{#1}%
-    \ekvparse\ekvd at noarg\ekvd@
+    \ekvparse\ekvd at noarg\ekvd at arg
   }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]{\ekvd at noarg,\ekvd@}
-% |\ekvd at noarg| just places a special marker and gives control to |\ekvd@|.
-% |\ekvd@| has to test whether there is a space inside the key and if so calls
-% the prefix grabbing routine, else we throw an error and ignore the key.
+% \begin{macro}[internal]{\ekvd at noarg,\ekvd at arg,\ekvd at handle}
+% |\ekvd at noarg| and |\ekvd at arg| store whether there was a value in the \kv\
+% pair. |\ekvd at handle| has to test whether there is a space inside the key and
+% if so calls the prefix grabbing routine, else we throw an error and ignore the
+% key.
 %    \begin{macrocode}
-\protected\def\ekvd at noarg#1{\ekvd@{#1}\ekvd at noarg@mark}
-\protected\long\def\ekvd@#1#2%
+\protected\def\ekvd at noarg#1%
   {%
+    \let\ekvd at ifnoarg\@firstoftwo
+    \ekvd at handle{#1}{}%
+  }
+\protected\def\ekvd at arg
+  {%
+    \let\ekvd at ifnoarg\@secondoftwo
+    \ekvd at handle
+  }
+\protected\long\def\ekvd at handle#1#2%
+  {%
     \ekvd at clear@prefixes
     \edef\ekvd at cur{\detokenize{#1}}%
     \ekvd at ifspace{#1}%
@@ -839,7 +875,7 @@
 % \end{macro}
 %
 % \begin{macro}[internal]
-%   {\ekvd at p@long,\ekvd at p@protected,\ekvd at p@protect,\ekvd at p@also}
+%   {\ekvd at p@long,\ekvd at p@protected,\ekvd at p@protect,\ekvd at p@also,\ekvd at p@new}
 % Define the |@p@| type prefixes, they all just store some information in a
 % temporary macro.
 %    \begin{macrocode}
@@ -847,36 +883,45 @@
 \protected\def\ekvd at p@protected{\let\ekvd at prot\protected}
 \let\ekvd at p@protect\ekvd at p@protected
 \protected\def\ekvd at p@also{\let\ekvd at ifalso\@firstoftwo}
+\protected\def\ekvd at p@new{\let\ekvd at ifnew\ekvd at assert@new}
 %    \end{macrocode}
 % \end{macro}
 %
 % \subsubsection{Key Types}
 %
-% \begin{macro}[internal]{\ekvd at t@set}
+% \begin{macro}[internal]{\ekvd at type@set,\ekvd at t@set}
 % The |set| type is quite straight forward, just define a |NoVal| key to call
 % |\ekvchangeset|.
 %    \begin{macrocode}
-\protected\def\ekvd at t@set#1#2%
+\protected\def\ekvd at type@set#1#2%
   {%
     \ekvd at assert@not at long
     \ekvd at assert@not at protected
-    \ekv at ifempty{#2}%
-      {\ekvd at err@missing at definition}%
+    \ekvd at ifnew{NoVal}{#1}%
       {%
-        \ekvd at ifalso
+        \ekv at ifempty{#2}%
+          {\ekvd at err@missing at definition}%
           {%
-            \ekvd at ifnoarg{#2}%
-              {\ekvd at add@noval{#1}{\ekvchangeset{#1}}}%
-              {\ekvd at add@noval{#1}{\ekvchangeset{#2}}}%
-              \ekvd at assert@not at protected@also
+            \ekvd at ifalso
+              {%
+                \ekv at expB@unbraceA{\ekv at expB@unbraceA{\ekvd at add@noval{#1}}}%
+                  {\ekvchangeset{#2}}%
+                  \ekvd at assert@not at protected@also
+              }%
+              {%
+                \ekv at expB@unbraceA
+                  {\ekv at expB@unbraceA{\ekvdefNoVal\ekvd at set{#1}}}%
+                  {\ekvchangeset{#2}}%
+              }%
           }%
-          {%
-            \ekvd at ifnoarg{#2}%
-              {\ekvdefNoVal\ekvd at set{#1}{\ekvchangeset{#1}}}%
-              {\ekvdefNoVal\ekvd at set{#1}{\ekvchangeset{#2}}}%
-          }%
       }%
   }
+\protected\def\ekvd at t@set#1#2%
+  {%
+    \ekvd at ifnoarg
+      {\ekvd at type@set{#1}{#1}}%
+      {\ekvd at type@set{#1}{#2}}%
+  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -888,19 +933,22 @@
 % |@type@|. |noval| and |enoval| are so similar that we can use such a |@type@|
 % macro, even if we could've done |noval| in a slightly faster way without it.
 %    \begin{macrocode}
-\protected\long\def\ekvd at type@noval#1#2#3#4%
+\protected\long\def\ekvd at type@noval#1#2#3%
   {%
-    \ekvd at assert@arg{#4}%
+    \ekvd at ifnew{NoVal}{#2}%
       {%
-        \ekvd at assert@not at long
-        \ekvd at prot#2\ekvd at tmp{#4}%
-        \ekvd at ifalso
-          {\ekvd at exp@Nno\ekvd at add@noval{#3}\ekvd at tmp{}}%
-          {\ekvletNoVal\ekvd at set{#3}\ekvd at tmp}%
+        \ekvd at assert@arg
+          {%
+            \ekvd at assert@not at long
+            \ekvd at prot#1\ekvd at tmp{#3}%
+            \ekvd at ifalso
+              {\ekv at expB@unbraceA{\ekvd at add@noval{#2}}\ekvd at tmp{}}%
+              {\ekvletNoVal\ekvd at set{#2}\ekvd at tmp}%
+          }%
       }%
   }
-\protected\def\ekvd at t@noval{\ekvd at type@noval{}\def}
-\protected\def\ekvd at t@enoval{\ekvd at type@noval e\edef}
+\protected\def\ekvd at t@noval{\ekvd at type@noval\def}
+\protected\def\ekvd at t@enoval{\ekvd at type@noval\edef}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -908,18 +956,21 @@
 % |code| is simple as well, |ecode| has to use |\edef| on a temporary macro,
 % since \expkv\ doesn't provide an |\ekvedef|.
 %    \begin{macrocode}
-\protected\long\def\ekvd at type@code#1#2#3#4%
+\protected\long\def\ekvd at type@code#1#2#3%
   {%
-    \ekvd at assert@arg{#4}
+    \ekvd at ifnew{}{#2}%
       {%
-        \ekvd at prot\ekvd at long#2\ekvd at tmp##1{#4}%
-        \ekvd at ifalso
-          {\ekvd at exp@Nno\ekvd at add@val{#3}{\ekvd at tmp{##1}}{}}%
-          {\ekvlet\ekvd at set{#3}\ekvd at tmp}%
+        \ekvd at assert@arg
+          {%
+            \ekvd at prot\ekvd at long#1\ekvd at tmp##1{#3}%
+            \ekvd at ifalso
+              {\ekv at expB@unbraceA{\ekvd at add@val{#2}}{\ekvd at tmp{##1}}{}}%
+              {\ekvlet\ekvd at set{#2}\ekvd at tmp}%
+          }%
       }%
   }
-\protected\def\ekvd at t@code{\ekvd at type@code{}\def}
-\protected\def\ekvd at t@ecode{\ekvd at type@code e\edef}
+\protected\def\ekvd at t@code{\ekvd at type@code\def}
+\protected\def\ekvd at t@ecode{\ekvd at type@code\edef}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -930,27 +981,28 @@
 % temporary macro that expands |\ekvd at set| and the |\csname| for the key, and in
 % the case of |qdefault| does the first expansion step of the key-macro.
 %    \begin{macrocode}
-\protected\long\def\ekvd at type@default#1#2#3#4%
+\protected\long\def\ekvd at type@default#1#2#3%
   {%
-    \ekvd at assert@arg{#4}%
+    \ekvd at assert@arg
       {%
-        \ekvifdefined\ekvd at set{#3}%
+        \ekvifdefined\ekvd at set{#2}%
           {%
+            \ekvd at assert@not at new
             \ekvd at assert@not at long
             \ekvd at prot\edef\ekvd at tmp
               {%
-                \unexpanded\expandafter#2%
-                  {\csname\ekv at name\ekvd at set{#3}\endcsname{#4}}%
+                \unexpanded\expandafter#1%
+                  {\csname\ekv at name\ekvd at set{#2}\endcsname{#3}}%
               }%
             \ekvd at ifalso
-              {\ekvd at exp@Nno\ekvd at add@noval{#3}\ekvd at tmp{}}%
-              {\ekvletNoVal\ekvd at set{#3}\ekvd at tmp}%
+              {\ekv at expB@unbraceA{\ekvd at add@noval{#2}}\ekvd at tmp{}}%
+              {\ekvletNoVal\ekvd at set{#2}\ekvd at tmp}%
           }%
-          {\ekvd at err@undefined at key{#3}}%
+          {\ekvd at err@undefined at key{#2}}%
       }%
   }
-\protected\def\ekvd at t@default{\ekvd at type@default{}{}}
-\protected\def\ekvd at t@qdefault{\ekvd at type@default q{\expandafter\expandafter}}
+\protected\def\ekvd at t@default{\ekvd at type@default{}}
+\protected\def\ekvd at t@qdefault{\ekvd at type@default{\expandafter\expandafter}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -960,15 +1012,16 @@
 %    \begin{macrocode}
 \protected\long\def\ekvd at t@edefault#1#2%
   {%
-    \ekvd at assert@arg{#2}%
+    \ekvd at assert@arg
       {%
         \ekvifdefined\ekvd at set{#1}%
           {%
+            \ekvd at assert@not at new
             \ekvd at assert@not at long
             \ekvd at prot\edef\ekvd at tmp
               {\csname\ekv at name\ekvd at set{#1}\endcsname{#2}}%
             \ekvd at ifalso
-              {\ekvd at exp@Nno\ekvd at add@noval{#1}\ekvd at tmp{}}%
+              {\ekv at expB@unbraceA{\ekvd at add@noval{#1}}\ekvd at tmp{}}%
               {\ekvletNoVal\ekvd at set{#1}\ekvd at tmp}%
           }%
           {\ekvd at err@undefined at key{#1}}%
@@ -979,80 +1032,113 @@
 %
 % \begin{macro}[internal]{\ekvd at t@initial,\ekvd at t@oinitial,\ekvd at t@einitial}
 %    \begin{macrocode}
-\long\def\ekvd at t@initial#1#2%
+\long\def\ekvd at type@initial#1#2#3%
   {%
-    \ekvd at assert@arg{#2}%
+    \ekvd at assert@arg
       {%
-        \ekvifdefined\ekvd at set{#1}%
+        \ekvifdefined\ekvd at set{#2}%
           {%
+            \ekvd at assert@not at new
             \ekvd at assert@not at also
             \ekvd at assert@not at long
             \ekvd at assert@not at protected
-            \csname\ekv at name\ekvd at set{#1}\endcsname{#2}%
+            #1{#3}%
+            \csname\ekv at name\ekvd at set{#2}\expandafter\endcsname\expandafter
+              {\ekvd at tmp}%
           }%
-          {\ekvd at err@undefined at key{#1}}%
+          {\ekvd at err@undefined at key{#2}}%
       }%
   }
-\long\def\ekvd at t@oinitial#1#2%
+\def\ekvd at t@initial{\ekvd at type@initial{\def\ekvd at tmp}}
+\def\ekvd at t@oinitial{\ekvd at type@initial{\ekv at expB@unbraceA{\def\ekvd at tmp}}}
+\def\ekvd at t@einitial{\ekvd at type@initial{\edef\ekvd at tmp}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]
+%   {
+%     \ekvd at type@bool,\ekvd at t@bool,\ekvd at t@gbool,\ekvd at t@boolTF,\ekvd at t@gboolTF,
+%     \ekvd at t@invbool,\ekvd at t@ginvbool,\ekvd at t@invboolTF,\ekvd at t@ginvboolTF,
+%   }
+% The boolean types are a quicker version of a |choice| that accept |true| and
+% |false|, and set up the |NoVal| action to be identical to \texttt{\key=true}.
+% The |true| and |false| actions are always just |\let|ting the macro in |#7| to
+% some other macro (\emph{e.g.}, \cs[no-index]{iftrue}).
+%    \begin{macrocode}
+\protected\def\ekvd at type@bool#1#2#3#4#5%
   {%
-    \ekvd at assert@arg{#2}%
+    \ekvd at ifnew{}{#4}%
       {%
-        \ekvifdefined\ekvd at set{#1}%
+        \ekvd at ifnew{NoVal}{#4}%
           {%
-            \ekvd at assert@not at also
-            \ekvd at assert@not at long
-            \ekvd at assert@not at protected
-            \csname\ekv at name\ekvd at set{#1}\expandafter\endcsname\expandafter{#2}%
+            \ekvd at assert@filledarg{#5}%
+              {%
+                \ekvd at newlet#5#3%
+                \ekvd at type@choice{#4}%
+                \protected\ekvdefNoVal\ekvd at set{#4}{#1\let#5#2}%
+                \protected\expandafter\def
+                  \csname\ekvd at choice@name\ekvd at set{#4}{true}\endcsname
+                  {#1\let#5#2}%
+                \protected\expandafter\def
+                  \csname\ekvd at choice@name\ekvd at set{#4}{false}\endcsname
+                  {#1\let#5#3}%
+              }%
           }%
-          {\ekvd at err@undefined at key{#1}}%
       }%
   }
-\long\def\ekvd at t@einitial#1#2%
-  {%
-    \ekvd at assert@arg{#2}%
-      {%
-        \ekvifdefined\ekvd at set{#1}%
-          {%
-            \ekvd at assert@not at also
-            \ekvd at assert@not at long
-            \ekvd at assert@not at protected
-            \edef\ekvd at tmp{#2}%
-            \csname\ekv at name\ekvd at set{#1}\expandafter\endcsname\expandafter
-              {\ekvd at tmp}%
-          }%
-          {\ekvd at err@undefined at key{#1}}%
-      }%
-  }
+\protected\def\ekvd at t@bool{\ekvd at type@bool{}\iftrue\iffalse}
+\protected\def\ekvd at t@gbool{\ekvd at type@bool\global\iftrue\iffalse}
+\protected\def\ekvd at t@boolTF{\ekvd at type@bool{}\@firstoftwo\@secondoftwo}
+\protected\def\ekvd at t@gboolTF{\ekvd at type@bool\global\@firstoftwo\@secondoftwo}
+\protected\def\ekvd at t@invbool{\ekvd at type@bool{}\iffalse\iftrue}
+\protected\def\ekvd at t@ginvbool{\ekvd at type@bool\global\iffalse\iftrue}
+\protected\def\ekvd at t@invboolTF{\ekvd at type@bool{}\@secondoftwo\@firstoftwo}
+\protected\def\ekvd at t@ginvboolTF
+  {\ekvd at type@bool\global\@secondoftwo\@firstoftwo}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[internal]
-%   {\ekvd at type@bool,\ekvd at t@bool,\ekvd at t@gbool,\ekvd at t@boolTF,\ekvd at t@gboolTF}
-% The boolean types are a quicker version of a |choice| that accept |true| and
-% |false|, and set up the |NoVal| action to be identical to \texttt{\key=true}.
-% The |true| and |false| actions are always just |\let|ting the macro in |#7| to
-% some other macro (\emph{e.g.}, \cs[no-index]{iftrue}).
+%   {
+%     \ekvd at type@boolpair,
+%     \ekvd at t@boolpair,\ekvd at t@gboolpair,\ekvd at t@boolpairTF,\ekvd at t@gboolpairTF
+%   }
+% The boolean pair types are essentially the same as the boolean types, but set
+% two macros instead of one.
 %    \begin{macrocode}
-\protected\def\ekvd at type@bool#1#2#3#4#5#6#7%
+\protected\def\ekvd at type@boolpair#1#2#3#4#5#6%
   {%
-    \ekvd at assert@filledarg{#7}%
+    \ekvd at ifnew{}{#4}%
       {%
-        \ekvd at newlet#7#5%
-        \ekvd at type@choice{#1bool#2}{#6}%
-        \protected\ekvdefNoVal\ekvd at set{#6}{#3\let#7#4}%
-        \protected\expandafter\def
-          \csname\ekvd at choice@name\ekvd at set{#6}{true}\endcsname
-          {#3\let#7#4}%
-        \protected\expandafter\def
-          \csname\ekvd at choice@name\ekvd at set{#6}{false}\endcsname
-          {#3\let#7#5}%
+        \ekvd at ifnew{NoVal}{#4}%
+          {%
+            \ekvd at newlet#5#3%
+            \ekvd at newlet#6#2%
+            \ekvd at type@choice{#4}%
+            \protected\ekvdefNoVal\ekvd at set{#4}{#1\let#5#2#1\let#6#3}%
+            \protected\expandafter\def
+              \csname\ekvd at choice@name\ekvd at set{#4}{true}\endcsname
+              {#1\let#5#2#1\let#6#3}%
+            \protected\expandafter\def
+              \csname\ekvd at choice@name\ekvd at set{#4}{false}\endcsname
+              {#1\let#5#3#1\let#6#2}%
+          }%
       }%
   }
-\protected\def\ekvd at t@bool{\ekvd at type@bool{}{}{}\iftrue\iffalse}
-\protected\def\ekvd at t@gbool{\ekvd at type@bool g{}\global\iftrue\iffalse}
-\protected\def\ekvd at t@boolTF{\ekvd at type@bool{}{TF}{}\@firstoftwo\@secondoftwo}
-\protected\def\ekvd at t@gboolTF
-  {\ekvd at type@bool g{TF}\global\@firstoftwo\@secondoftwo}
+\protected\def\ekvd at t@boolpair#1#2%
+  {\ekvd at assert@twoargs{#2}{\ekvd at type@boolpair{}\iftrue\iffalse{#1}#2}}
+\protected\def\ekvd at t@gboolpair#1#2%
+  {\ekvd at assert@twoargs{#2}{\ekvd at type@boolpair\global\iftrue\iffalse{#1}#2}}
+\protected\def\ekvd at t@boolpairTF#1#2%
+  {%
+    \ekvd at assert@twoargs{#2}%
+      {\ekvd at type@boolpair{}\@firstoftwo\@secondoftwo{#1}#2}%
+  }
+\protected\def\ekvd at t@gboolpairTF#1#2%
+  {%
+    \ekvd at assert@twoargs{#2}%
+      {\ekvd at type@boolpair\global\@firstoftwo\@secondoftwo{#1}#2}%
+  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1061,33 +1147,35 @@
 %     \ekvd at type@data,\ekvd at t@data,\ekvd at t@gdata,\ekvd at t@dataT,\ekvd at t@gdataT
 %   }
 %    \begin{macrocode}
-\protected\def\ekvd at type@data#1#2#3#4#5#6#7#8%
+\protected\def\ekvd at type@data#1#2#3#4#5#6%
   {%
-    \ekvd at assert@filledarg{#8}%
+    \ekvd at ifnew{}{#5}%
       {%
-        \ekvd at newlet#8#3%
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#6}%
           {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#7}{\long#4#8####1#5{####1{#6}}}{}%
+            \ekvd at newlet#6#1%
+            \ekvd at ifalso
+              {%
+                \let\ekvd at prot\protected
+                \ekvd at add@val{#5}{\long#2#6####1#3{####1{#4}}}{}%
+              }%
+              {%
+                \protected\ekvd at long\ekvdef\ekvd at set{#5}%
+                  {\long#2#6####1#3{####1{#4}}}%
+              }%
           }%
-          {%
-            \protected\ekvd at long\ekvdef\ekvd at set{#7}%
-              {\long#4#8####1#5{####1{#6}}}%
-          }%
       }%
   }
 \protected\def\ekvd at t@data
-  {\ekvd at type@data{}{}\@secondoftwo\edef{####2}{\unexpanded{##1}}}
-\protected\def\ekvd at t@edata{\ekvd at type@data e{}\@secondoftwo\edef{####2}{##1}}
+  {\ekvd at type@data\@secondoftwo\edef{####2}{\unexpanded{##1}}}
+\protected\def\ekvd at t@edata{\ekvd at type@data\@secondoftwo\edef{####2}{##1}}
 \protected\def\ekvd at t@gdata
-  {\ekvd at type@data g{}\@secondoftwo\xdef{####2}{\unexpanded{##1}}}
-\protected\def\ekvd at t@xdata{\ekvd at type@data x{}\@secondoftwo\xdef{####2}{##1}}
-\protected\def\ekvd at t@dataT{\ekvd at type@data{}T\@gobble\edef{}{\unexpanded{##1}}}
-\protected\def\ekvd at t@edataT{\ekvd at type@data eT\@gobble\edef{}{##1}}
-\protected\def\ekvd at t@gdataT
-  {\ekvd at type@data gT\@gobble\xdef{}{\unexpanded{##1}}}
-\protected\def\ekvd at t@xdataT{\ekvd at type@data xT\@gobble\xdef{}{##1}}
+  {\ekvd at type@data\@secondoftwo\xdef{####2}{\unexpanded{##1}}}
+\protected\def\ekvd at t@xdata{\ekvd at type@data\@secondoftwo\xdef{####2}{##1}}
+\protected\def\ekvd at t@dataT{\ekvd at type@data\@gobble\edef{}{\unexpanded{##1}}}
+\protected\def\ekvd at t@edataT{\ekvd at type@data\@gobble\edef{}{##1}}
+\protected\def\ekvd at t@gdataT{\ekvd at type@data\@gobble\xdef{}{\unexpanded{##1}}}
+\protected\def\ekvd at t@xdataT{\ekvd at type@data\@gobble\xdef{}{##1}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1098,24 +1186,27 @@
 % whether the first argument is defined and if not does
 % |\csname new#2\endcsname#1|.
 %    \begin{macrocode}
-\protected\def\ekvd at type@box#1#2#3#4%
+\protected\def\ekvd at type@box#1#2#3%
   {%
-    \ekvd at assert@filledarg{#4}%
+    \ekvd at ifnew{}{#2}%
       {%
-        \ekvd at newreg#4{box}%
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#3}%
           {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#3}{#2\setbox#4\hbox{\begingroup##1\endgroup}}{}%
+            \ekvd at newreg#3{box}%
+            \ekvd at ifalso
+              {%
+                \let\ekvd at prot\protected
+                \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}}%
+              }%
           }%
-          {%
-            \protected\ekvd at long\ekvdef\ekvd at set{#3}%
-              {#2\setbox#4\hbox{\begingroup##1\endgroup}}%
-          }%
       }%
   }
-\protected\def\ekvd at t@box{\ekvd at type@box{}{}}
-\protected\def\ekvd at t@gbox{\ekvd at type@box g\global}
+\protected\def\ekvd at t@box{\ekvd at type@box{}}
+\protected\def\ekvd at t@gbox{\ekvd at type@box\global}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1122,21 +1213,24 @@
 % \begin{macro}[internal]{\ekvd at type@toks,\ekvd at t@toks,\ekvd at t@gtoks}
 % Similar to |box|, but set the |toks|.
 %    \begin{macrocode}
-\protected\def\ekvd at type@toks#1#2#3#4%
+\protected\def\ekvd at type@toks#1#2#3%
   {%
-    \ekvd at assert@filledarg{#4}%
+    \ekvd at ifnew{}{#2}%
       {%
-        \ekvd at newreg#4{toks}%
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#3}%
           {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#3}{#2#4{##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\ekvd at long\ekvdef\ekvd at set{#3}{#2#4{##1}}}%
       }%
   }
-\protected\def\ekvd at t@toks{\ekvd at type@toks{}{}}
-\protected\def\ekvd at t@gtoks{\ekvd at type@toks{g}\global}
+\protected\def\ekvd at t@toks{\ekvd at type@toks{}}
+\protected\def\ekvd at t@gtoks{\ekvd at type@toks\global}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1144,24 +1238,27 @@
 % 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#4%
+\protected\def\ekvd at type@apptoks#1#2#3%
   {%
-    \ekvd at assert@filledarg{#4}%
+    \ekvd at ifnew{}{#2}%
       {%
-        \ekvd at newreg#4{toks}%
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#3}%
           {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#3}{#2#4\expandafter{\the#4##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\ekvd at long\ekvdef\ekvd at set{#3}%
-              {#2#4\expandafter{\the#4##1}}%
-          }%
       }%
   }
-\protected\def\ekvd at t@apptoks{\ekvd at type@apptoks{}{}}
-\protected\def\ekvd at t@gapptoks{\ekvd at type@apptoks{g}\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}
 %
@@ -1174,31 +1271,34 @@
 % The |\ekvd at type@reg| can handle all the types for which the assignment will
 % just be \texttt{\meta{register}=\meta{value}}.
 %    \begin{macrocode}
-\protected\def\ekvd at type@reg#1#2#3#4#5#6#7%
+\protected\def\ekvd at type@reg#1#2#3#4#5#6%
   {%
-    \ekvd at assert@filledarg{#7}%
+    \ekvd at ifnew{}{#5}%
       {%
-        \ekvd at newreg#7{#2}%
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#6}%
           {%
-            \let\evkd at prot\protected
-            \ekvd at add@val{#6}{#3#7=#4##1#5\relax}{}%
+            \ekvd at newreg#6{#1}%
+            \ekvd at ifalso
+              {%
+                \let\evkd at prot\protected
+                \ekvd at add@val{#5}{#2#6=#3##1#4\relax}{}%
+              }%
+              {\protected\ekvd at long\ekvdef\ekvd at set{#5}{#2#6=#3##1#4\relax}}%
           }%
-          {\protected\ekvd at long\ekvdef\ekvd at set{#6}{#3#7=#4##1#5\relax}}%
       }%
   }
-\protected\def\ekvd at t@int{\ekvd at type@reg{int}{count}{}{}{}}
-\protected\def\ekvd at t@eint{\ekvd at type@reg{eint}{count}{}\numexpr\relax}
-\protected\def\ekvd at t@gint{\ekvd at type@reg{gint}{count}\global{}{}}
-\protected\def\ekvd at t@xint{\ekvd at type@reg{xint}{count}\global\numexpr\relax}
-\protected\def\ekvd at t@dimen{\ekvd at type@reg{dimen}{dimen}{}{}{}}
-\protected\def\ekvd at t@edimen{\ekvd at type@reg{edimen}{dimen}{}\dimexpr\relax}
-\protected\def\ekvd at t@gdimen{\ekvd at type@reg{gdimen}{dimen}\global{}{}}
-\protected\def\ekvd at t@xdimen{\ekvd at type@reg{xdimen}{dimen}\global\dimexpr\relax}
-\protected\def\ekvd at t@skip{\ekvd at type@reg{skip}{skip}{}{}{}}
-\protected\def\ekvd at t@eskip{\ekvd at type@reg{eskip}{skip}{}\glueexpr\relax}
-\protected\def\ekvd at t@gskip{\ekvd at type@reg{gskip}{skip}\global{}{}}
-\protected\def\ekvd at t@xskip{\ekvd at type@reg{xskip}{skip}\global\glueexpr\relax}
+\protected\def\ekvd at t@int{\ekvd at type@reg{count}{}{}{}}
+\protected\def\ekvd at t@eint{\ekvd at type@reg{count}{}\numexpr\relax}
+\protected\def\ekvd at t@gint{\ekvd at type@reg{count}\global{}{}}
+\protected\def\ekvd at t@xint{\ekvd at type@reg{count}\global\numexpr\relax}
+\protected\def\ekvd at t@dimen{\ekvd at type@reg{dimen}{}{}{}}
+\protected\def\ekvd at t@edimen{\ekvd at type@reg{dimen}{}\dimexpr\relax}
+\protected\def\ekvd at t@gdimen{\ekvd at type@reg{dimen}\global{}{}}
+\protected\def\ekvd at t@xdimen{\ekvd at type@reg{dimen}\global\dimexpr\relax}
+\protected\def\ekvd at t@skip{\ekvd at type@reg{skip}{}{}{}}
+\protected\def\ekvd at t@eskip{\ekvd at type@reg{skip}{}\glueexpr\relax}
+\protected\def\ekvd at t@gskip{\ekvd at type@reg{skip}\global{}{}}
+\protected\def\ekvd at t@xskip{\ekvd at type@reg{skip}\global\glueexpr\relax}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1208,43 +1308,27 @@
 %    \begin{macrocode}
 \protected\def\ekvd at type@store#1#2#3#4%
   {%
-    \ekvd at assert@filledarg{#4}%
+    \ekvd at ifnew{}{#3}%
       {%
-        \ekvd at newlet#4\ekvd at empty
-        \ekvd at ifalso
+        \ekvd at assert@filledarg{#4}%
           {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#3}{#2#4{\unexpanded{##1}}}{}%
+            \ekvd at newlet#4\ekvd at empty
+            \ekvd at ifalso
+              {%
+                \let\ekvd at prot\protected
+                \ekvd at add@val{#3}{#1#4{#2}}{}%
+              }%
+              {\protected\ekvd at long\ekvdef\ekvd at set{#3}{#1#4{#2}}}%
           }%
-          {\protected\ekvd at long\ekvdef\ekvd at set{#3}{#2#4{\unexpanded{##1}}}}%
       }%
   }
-\protected\def\ekvd at t@store{\ekvd at type@store{}\edef}
-\protected\def\ekvd at t@gstore{\ekvd at type@store{g}\xdef}
+\protected\def\ekvd at t@store{\ekvd at type@store\edef{\unexpanded{##1}}}
+\protected\def\ekvd at t@gstore{\ekvd at type@store\xdef{\unexpanded{##1}}}
+\protected\def\ekvd at t@estore{\ekvd at type@store\edef{##1}}
+\protected\def\ekvd at t@xstore{\ekvd at type@store\xdef{##1}}
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]{\ekvd at type@estore,\ekvd at t@estore,\ekvd at t@xstore}
-% And the straight forward |estore| types.
-%    \begin{macrocode}
-\protected\def\ekvd at type@estore#1#2#3#4%
-  {%
-    \ekvd at assert@filledarg{#4}%
-      {%
-        \ekvd at newlet#4\ekvd at empty
-        \ekvd at ifalso
-          {%
-            \let\ekvd at prot\protected
-            \ekvd at add@val{#3}{#2#4{##1}}{}%
-          }%
-          {\protected\ekvd at long\ekvdef\ekvd at set{#3}{#2#4{##1}}}%
-      }%
-  }
-\protected\def\ekvd at t@estore{\ekvd at type@estore{e}\edef}
-\protected\def\ekvd at t@xstore{\ekvd at type@estore{x}\xdef}
-%    \end{macrocode}
-% \end{macro}
-%
 % \begin{macro}[internal]
 %   {
 %     \ekvd at type@meta,\ekvd at type@meta at a,\ekvd at type@meta at b,\ekvd at type@meta at c,
@@ -1253,15 +1337,18 @@
 % |meta| sets up things such that another instance of |\ekvset| will be run on
 % the argument, with the same \set.
 %    \begin{macrocode}
-\protected\long\def\ekvd at type@meta#1#2#3#4#5#6#7#8%
+\protected\long\def\ekvd at type@meta#1#2#3#4#5#6#7%
   {%
-    \ekvd at assert@filledarg{#8}%
+    \ekvd at ifnew{#1}{#6}%
       {%
-        \edef\ekvd at tmp{\ekvd at set}%
-        \expandafter\ekvd at type@meta at a\expandafter{\ekvd at tmp}{#8}{#3}%
-        \ekvd at ifalso
-          {\ekvd at exp@Nno#4{#7}{\ekvd at tmp#5}{#6}}%
-          {#2\ekvd at set{#7}\ekvd at tmp}%
+        \ekvd at assert@filledarg{#7}%
+          {%
+            \edef\ekvd at tmp{\ekvd at set}%
+            \expandafter\ekvd at type@meta at a\expandafter{\ekvd at tmp}{#7}{#2}%
+            \ekvd at ifalso
+              {\ekv at expB@unbraceA{#3{#6}}{\ekvd at tmp#4}{#5}}%
+              {\csname ekvlet#1\endcsname\ekvd at set{#6}\ekvd at tmp}%
+          }%
       }%
   }
 \protected\long\def\ekvd at type@meta at a#1#2%
@@ -1276,12 +1363,11 @@
   {%
     \ekvd at prot\ekvd at long\def\ekvd at tmp#2{#1}%
   }
-\protected\def\ekvd at t@meta{\ekvd at type@meta{}\ekvlet{##1}\ekvd at add@val{{##1}}{}}
+\protected\def\ekvd at t@meta{\ekvd at type@meta{}{##1}\ekvd at add@val{{##1}}{}}
 \protected\def\ekvd at t@nmeta
   {%
     \ekvd at assert@not at long
-    \ekvd at type@meta
-      n\ekvletNoVal{}\ekvd at add@noval{}\ekvd at assert@not at long@also
+    \ekvd at type@meta{NoVal}{}\ekvd at add@noval{}\ekvd at assert@not at long@also
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1292,23 +1378,24 @@
 % such that the first is the \set\ for which the sub-|\ekvset| and the second is
 % the \kv\ list.
 %    \begin{macrocode}
-\protected\long\def\ekvd at type@smeta#1#2#3#4#5#6#7#8%
+\protected\long\def\ekvd at type@smeta#1#2#3#4#5#6#7%
   {%
-    \ekvd at assert@twoargs{#8}%
+    \ekvd at ifnew{#1}{#6}%
       {%
-        \ekvd at type@meta at a#8{#3}%
-        \ekvd at ifalso
-          {\ekvd at exp@Nno#4{#7}{\ekvd at tmp#5}{#6}}%
-          {#2\ekvd at set{#7}\ekvd at tmp}%
+        \ekvd at assert@twoargs{#7}%
+          {%
+            \ekvd at type@meta at a#7{#2}%
+            \ekvd at ifalso
+              {\ekv at expB@unbraceA{#3{#6}}{\ekvd at tmp#4}{#5}}%
+              {\csname ekvlet#1\endcsname\ekvd at set{#6}\ekvd at tmp}%
+          }%
       }%
   }
-\protected\def\ekvd at t@smeta
-  {\ekvd at type@smeta{}\ekvlet{##1}\ekvd at add@val{{##1}}{}}
+\protected\def\ekvd at t@smeta{\ekvd at type@smeta{}{##1}\ekvd at add@val{{##1}}{}}
 \protected\def\ekvd at t@snmeta
   {%
     \ekvd at assert@not at long
-    \ekvd at type@smeta
-      n\ekvletNoVal{}\ekvd at add@noval{}\ekvd at assert@not at long@also
+    \ekvd at type@smeta{NoVal}{}\ekvd at add@noval{}\ekvd at assert@not at long@also
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1326,18 +1413,28 @@
 % allowed to be long). |\ekvd at type@choice| will just define the choice-key, the
 % handling of the choices definition will be done by |\ekvd at populate@choice|.
 %    \begin{macrocode}
-\protected\def\ekvd at type@choice#1#2%
+\protected\def\ekvd at type@choice#1%
   {%
     \ekvd at assert@not at long
     \ekvd at prot\edef\ekvd at tmp##1%
-      {%
-        \unexpanded{\ekvd at h@choice}{\ekvd at choice@name\ekvd at set{#2}{##1}}%
-      }%
+      {\unexpanded{\ekvd at h@choice}{\ekvd at choice@name\ekvd at set{#1}{##1}}}%
     \ekvd at ifalso
       {%
-        \ekvd at exp@Nno\ekvd at add@val{#2}{\ekvd at tmp{##1}}\ekvd at assert@not at long@also
+        \ekvd at assert@val{#1}%
+          {%
+            \ekvd at if@not at already@choice{#1}%
+              {%
+                \ekv at expB@unbraceA
+                  {%
+                    \expandafter\ekvd at add@aux
+                      \csname\ekv at name\ekvd at set{#1}\endcsname{{##1}}{#1}%
+                  }%
+                  {\ekvd at tmp{##1}}%
+                  {\ekvd at long\ekvdef}\ekvd at assert@not at long@also
+              }%
+          }%
       }%
-      {\ekvlet\ekvd at set{#2}\ekvd at tmp}%
+      {\ekvlet\ekvd at set{#1}\ekvd at tmp}%
   }
 %    \end{macrocode}
 % |\ekvd at populate@choice| just uses |\ekvparse| and then gives control to
@@ -1362,7 +1459,7 @@
 \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}{#2}%
+    \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 stop}%
@@ -1406,6 +1503,7 @@
   }
 \protected\def\ekvd at choice@p at long{\ekvd at choice@invalid at p{long}}%
 \protected\def\ekvd at choice@p at also{\ekvd at choice@invalid at p{also}}%
+\protected\def\ekvd at choice@p at new{\ekvd at choice@invalid at p{new}}%
 %    \end{macrocode}
 % Finally we're able to set up the |@t at choice| macro, which has to store the
 % current choice-key's name, define the key, and parse the available choices.
@@ -1412,11 +1510,14 @@
 %    \begin{macrocode}
 \protected\long\def\ekvd at t@choice#1#2%
   {%
-    \ekvd at assert@arg{#2}%
+    \ekvd at ifnew{}{#1}%
       {%
-        \ekvd at type@choice{choice}{#1}%
-        \def\ekvd at set@choice{#1}%
-        \ekvd at populate@choice{#2}%
+        \ekvd at assert@arg
+          {%
+            \ekvd at type@choice{#1}%
+            \def\ekvd at set@choice{#1}%
+            \ekvd at populate@choice{#2}%
+          }%
       }%
   }
 %    \end{macrocode}
@@ -1426,12 +1527,20 @@
 %    \begin{macrocode}
 \protected\long\expandafter\def\csname ekvd at t@unknown-choice\endcsname#1#2%
   {%
-    \ekvd at assert@arg{#2}%
+    \ifx\ekvd at ifnew\ekvd at assert@new
+      \ekv at fi@firstoftwo
+    \fi
+    \@secondoftwo
+      {\ekv at ifdefined{\ekvd at unknown@choice at name\ekvd at set{#1}}\ekvd at err@not at new}%
+      \@firstofone
       {%
-        \ekvd at assert@not at long
-        \ekvd at assert@not at also
-        \ekvd at prot\expandafter
-        \def\csname\ekvd at unknown@choice at name\ekvd at set{#1}\endcsname##1{#2}%
+        \ekvd at assert@arg
+          {%
+            \ekvd at assert@not at long
+            \ekvd at assert@not at also
+            \ekvd at prot\expandafter
+            \def\csname\ekvd at unknown@choice at name\ekvd at set{#1}\endcsname##1{#2}%
+          }%
       }%
   }
 %    \end{macrocode}
@@ -1644,31 +1753,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]
-%   {
-%     \ekvd at assert@arg,\ekvd at assert@arg at msg,\ekvd at ifnoarg,\ekvd at ifnoarg@,
-%     \ekvd at ifnoarg@
-%   }
-% An |\ifx| comparison would fail if the first token of the user input is a
-% \TeX-if primitive or the user input contains unbalanced \TeX-if constructs, so
-% the test is done using \TeX's argument grabbing logic.
+% \begin{macro}[internal]{\ekvd at assert@arg,\ekvd at assert@arg at msg,\ekvd at ifnoarg}
+% There is no need to actually define |\ekvd at ifnoarg| here, as it will be set by
+% either |\ekvd at arg| or |\ekvd at noarg|.
 %    \begin{macrocode}
-\long\def\ekvd at assert@arg#1{\ekvd at ifnoarg{#1}\ekvd at err@missing at definition}
-\long\def\ekvd at assert@arg at msg#1#2%
+\def\ekvd at assert@arg{\ekvd at ifnoarg\ekvd at err@missing at definition}
+\long\def\ekvd at assert@arg at msg#1%
   {%
-    \ekvd at ifnoarg{#2}{\ekvd at err@missing at definition@msg{#1}}%
+    \ekvd at ifnoarg{\ekvd at err@missing at definition@msg{#1}}%
   }
-\long\def\ekvd at ifnoarg#1%
-  {%
-    \ekvd at ifnoarg@\ekvd at ifnoarg@mark#1\ekvd at ifnoarg@mark\ekvd at ifnoarg@t
-      \ekvd at ifnoarg@mark\ekvd at noarg@mark\ekvd at ifnoarg@mark\@secondoftwo
-  }
-\long\def\ekvd at ifnoarg@#1\ekvd at ifnoarg@mark\ekvd at noarg@mark\ekvd at ifnoarg@mark{}
-\long\def\ekvd at ifnoarg@t
-    \ekvd at ifnoarg@mark\ekvd at noarg@mark\ekvd at ifnoarg@mark\@secondoftwo#1#2%
-  {%
-    #1%
-  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1680,7 +1773,7 @@
   }
 \long\def\ekvd at ifnoarg@or at empty#1%
   {%
-    \ekvd at ifnoarg{#1}%
+    \ekvd at ifnoarg
       \@firstoftwo
       {\ekv at ifempty{#1}}%
   }
@@ -1690,7 +1783,8 @@
 % \begin{macro}[internal]
 %   {
 %     \ekvd at assert@not at long,\ekvd at assert@not at protected,\ekvd at assert@not at also
-%     \ekvd at assert@not at long@also,\ekvd at assert@not at protected@also
+%     \ekvd at assert@not at long@also,\ekvd at assert@not at protected@also,
+%     \ekvd at assert@new,\ekvd at assert@not at new
 %   }
 % Some key-types don't want to be |also|, |\long| or |\protected|, so we provide
 % macros to test this and throw an error, this could be silently ignored but now
@@ -1699,18 +1793,42 @@
 %    \begin{macrocode}
 \def\ekvd at assert@not at long{\ifx\ekvd at long\long\ekvd at err@no at prefix{long}\fi}
 \def\ekvd at assert@not at protected
-  {%
-    \ifx\ekvd at prot\protected\ekvd at err@no at prefix{protected}\fi
-  }
+  {\ifx\ekvd at prot\protected\ekvd at err@no at prefix{protected}\fi}
 \def\ekvd at assert@not at also{\ekvd at ifalso{\ekvd at err@no at prefix{also}}{}}
 \def\ekvd at assert@not at long@also
+  {\ifx\ekvd at long\long\ekvd at err@no at prefix@also{long}\fi}
+\def\ekvd at assert@not at protected@also
+  {\ifx\ekvd at prot\protected\ekvd at err@no at prefix@also{protected}\fi}
+\def\ekvd at assert@new#1#2%
+  {\csname ekvifdefined#1\endcsname\ekvd at set{#2}{\ekvd at err@not at new}}
+\def\ekvd at assert@not at new
+  {\ifx\ekvd at ifnew\ekvd at assert@new\ekvd at err@no at prefix{new}\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]
+%   {
+%     \ekvd at if@not at already@choice, \ekvd at if@not at already@choice at a,
+%     \ekvd at if@not at already@choice at b
+%   }
+% It is bad to use |also| on a key that already contains a |choice|, as both
+% choices would share the same valid values and thus lead to each callback being
+% used twice. The following is a rudimentary test against this.
+%    \begin{macrocode}
+\protected\def\ekvd at if@not at already@choice#1%
   {%
-    \ifx\ekvd at long\long\ekvd at err@no at prefix@also{long}\fi
+    \expandafter\ekvd at if@not at already@choice at a
+      \csname\ekv at name\ekvd at set{#1}\endcsname
+      {}\ekvd at h@choice\ekvd at stop
   }
-\def\ekvd at assert@not at protected@also
+\protected\def\ekvd at if@not at already@choice at a
   {%
-    \ifx\ekvd at prot\protected\ekvd at err@no at prefix@also{protected}\fi
+    \expandafter\ekvd at if@not at already@choice at b
   }
+\long\protected\def\ekvd at if@not at already@choice at b#1\ekvd at h@choice#2\ekvd at stop
+  {%
+    \ekv at ifempty{#2}\@firstofone\@gobble
+  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1741,7 +1859,7 @@
 %     \ekvd at err@missing at type,\ekvd at err@undefined at prefix,\ekvd at err@undefined at key,
 %     \ekvd at err@no at prefix,\ekvd at err@no at prefix@msg,\ekvd at err@no at prefix@also,
 %     \ekvd at err@add at val@on at noval,\ekvd at err@add at noval@on at val,
-%     \ekvd at err@unsupported at arg
+%     \ekvd at err@unsupported at arg,\ekvd at err@not at new
 %   }
 % The non-expandable error messages are boring, so here they are:
 %    \begin{macrocode}
@@ -1781,6 +1899,8 @@
         `\ekvd at extracted@args' for key `\ekvd at cur'%
       }%
   }
+\protected\def\ekvd at err@not at new
+  {\ekvd at errm{The key for `\ekvd at cur' is already defined}} 
 %    \end{macrocode}
 % \end{macro}
 %

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

Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-10-11 23:53:47 UTC (rev 56642)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-10-12 21:40:18 UTC (rev 56643)
@@ -641,7 +641,7 @@
     regcount regexpatch register regstats
     reledmac relenc relsize reotex repeatindex repere repltext
     rerunfilecheck resphilosophica rest-api
-    resumecls resumemac returntogrid reverxii revquantum revtex
+    resumecls resumemac returntogrid reverxii revquantum revtex revtex4-1
     rgltxdoc ribbonproofs rjlparshap rlepsf rmathbr rmpage
     roboto robustcommand robustindex
     romanbar romanbarpagenumber romande romanneg romannum



More information about the tex-live-commits mailing list.