[latex3-commits] [git/LaTeX3-latex3-latex3] main: Use a common auxiliary for .bool_(g)set: and the inverse version (039e4e9d8)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Nov 22 15:36:07 CET 2021


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/039e4e9d870ba345f4ca22aaee826528673b4e52

>---------------------------------------------------------------

commit 039e4e9d870ba345f4ca22aaee826528673b4e52
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Nov 22 14:36:07 2021 +0000

    Use a common auxiliary for .bool_(g)set: and the inverse version


>---------------------------------------------------------------

039e4e9d870ba345f4ca22aaee826528673b4e52
 l3kernel/l3keys.dtx | 38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 355de420b..6d3b271d0 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -1780,41 +1780,30 @@
 %
 % \subsection{Turning properties into actions}
 %
-% \begin{macro}{\@@_bool_set:Nn, \@@_bool_set:cn}
+% \begin{macro}
+%   {
+%     \@@_bool_set:Nn, \@@_bool_set:cn,
+%     \@@_bool_set_inverse:Nn, \@@_bool_set_inverse:cn
+%   }
+% \begin{macro}{\@@_bool_set:Nnnn}
 %   Boolean keys are really just choices, but all done by hand. The
 %   second argument here is the scope: either empty or \texttt{ g } for
 %   global.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_bool_set:Nn #1#2
-  {
-    \bool_if_exist:NF #1 { \bool_new:N #1 }
-    \@@_choice_make:
-    \@@_cmd_set:nx { \l_keys_path_str / true }
-      { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 }
-    \@@_cmd_set:nx { \l_keys_path_str / false }
-      { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 }
-    \@@_cmd_set:nn { \l_keys_path_str / unknown }
-      {
-        \msg_error:nnx { keys } { boolean-values-only }
-          \l_keys_key_str
-      }
-    \@@_default_set:n { true }
-  }
+  { \@@_bool_set:Nnnn #1 {#2} { true } { false } }
 \cs_generate_variant:Nn \@@_bool_set:Nn { c }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_bool_set_inverse:Nn, \@@_bool_set_inverse:cn}
-%   Inverse boolean setting is much the same.
-%    \begin{macrocode}
 \cs_new_protected:Npn \@@_bool_set_inverse:Nn #1#2
+  { \@@_bool_set:Nnnn #1 {#2} { false } { true } }
+\cs_generate_variant:Nn \@@_bool_set_inverse:Nn { c }
+\cs_new_protected:Npn \@@_bool_set:Nnnn #1#2#3#4
   {
     \bool_if_exist:NF #1 { \bool_new:N #1 }
     \@@_choice_make:
     \@@_cmd_set:nx { \l_keys_path_str / true }
-      { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 }
+      { \exp_not:c { bool_ #2 set_ #3 :N } \exp_not:N #1 }
     \@@_cmd_set:nx { \l_keys_path_str / false }
-      { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 }
+      { \exp_not:c { bool_ #2 set_ #4 :N } \exp_not:N #1 }
     \@@_cmd_set:nn { \l_keys_path_str / unknown }
       {
         \msg_error:nnx { keys } { boolean-values-only }
@@ -1822,9 +1811,10 @@
       }
     \@@_default_set:n { true }
   }
-\cs_generate_variant:Nn \@@_bool_set_inverse:Nn { c }
+\cs_generate_variant:Nn \@@_bool_set:Nn { c }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@@_choice_make:, \@@_multichoice_make:}
 % \begin{macro}{\@@_choice_make:N}





More information about the latex3-commits mailing list.