[latex3-commits] [git/LaTeX3-latex3-latex3] master: Implement candidate \bool_set_inverse:N (0749b49)

Bruno Le Floch bruno at le-floch.fr
Thu May 10 19:36:30 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/0749b498922194406975575f443242f9abfa9dbb

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

commit 0749b498922194406975575f443242f9abfa9dbb
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Thu May 10 13:36:30 2018 -0400

    Implement candidate \bool_set_inverse:N


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

0749b498922194406975575f443242f9abfa9dbb
 l3kernel/l3candidates.dtx               |   25 +++++++++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |    4 ++++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    4 ++++
 l3kernel/testfiles/m3expl001.tlg        |    4 ++++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    4 ++++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    4 ++++
 l3kernel/testfiles/m3expl003.luatex.tlg |    4 ++++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    4 ++++
 l3kernel/testfiles/m3expl003.tlg        |    4 ++++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    4 ++++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    4 ++++
 l3kernel/testfiles/m3prg002.lvt         |    8 ++++++++
 l3kernel/testfiles/m3prg002.tlg         |   19 +++++++++++++++++++
 13 files changed, 92 insertions(+)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 4070e8b..ac00707 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -591,6 +591,18 @@
 %   the result of evaluating the \meta{boolexpr}.
 % \end{function}
 %
+% \begin{function}[added = 2018-05-10]
+%   {
+%     \bool_set_inverse:N , \bool_set_inverse:c ,
+%     \bool_gset_inverse:N, \bool_gset_inverse:c
+%   }
+%   \begin{syntax}
+%     \cs{bool_set_inverse:N} \meta{boolean}
+%   \end{syntax}
+%   Toggles the \meta{boolean} from \texttt{true} to \texttt{false} and
+%   conversely: sets it to the inverse of its current value.
+% \end{function}
+%
 % \section{Additions to \pkg{l3prop}}
 %
 % \begin{function}[EXP]{\prop_count:N, \prop_count:c}
@@ -2359,6 +2371,19 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[added = 2018-05-10]
+%   {\bool_set_inverse:N, \bool_set_inverse:c, \bool_gset_inverse:N, \bool_gset_inverse:c}
+%   Set to \texttt{false} or \texttt{true} locally or globally.
+%    \begin{macrocode}
+\cs_new_protected:Npn \bool_set_inverse:N #1
+  { \bool_if:NTF #1 { \bool_set_false:N } { \bool_set_true:N } #1 }
+\cs_generate_variant:Nn \bool_set_inverse:N { c }
+\cs_new_protected:Npn \bool_gset_inverse:N #1
+  { \bool_if:NTF #1 { \bool_gset_false:N } { \bool_gset_true:N } #1 }
+\cs_generate_variant:Nn \bool_gset_inverse:N { c }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Additions to \pkg{l3prop}}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 754d3fd..a2f7c6e 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5747,6 +5747,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 8a4040f..4791c10 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5741,6 +5741,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 2ed968e..d51d14e 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5741,6 +5741,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 14d35ea..68c79c3 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5738,6 +5738,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index af77637..eea0c26 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5719,6 +5719,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 754d3fd..a2f7c6e 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5747,6 +5747,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 8a4040f..4791c10 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5741,6 +5741,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 2ed968e..d51d14e 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5741,6 +5741,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 14d35ea..68c79c3 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5738,6 +5738,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index af77637..eea0c26 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5719,6 +5719,10 @@ Defining \msg_show_item:nn on line ...
 Defining \msg_show_item_unbraced:nn on line ...
 Defining \bool_const:Nn on line ...
 Defining \bool_const:cn on line ...
+Defining \bool_set_inverse:N on line ...
+Defining \bool_set_inverse:c on line ...
+Defining \bool_gset_inverse:N on line ...
+Defining \bool_gset_inverse:c on line ...
 Defining \prop_count:N on line ...
 Defining \__prop_count:nn on line ...
 Defining \prop_count:c on line ...
diff --git a/l3kernel/testfiles/m3prg002.lvt b/l3kernel/testfiles/m3prg002.lvt
index 048b5b9..ec62b7b 100644
--- a/l3kernel/testfiles/m3prg002.lvt
+++ b/l3kernel/testfiles/m3prg002.lvt
@@ -54,6 +54,14 @@
   \group_end:
   \TYPE{A:}\bool_if:NTF \myboola {\TRUE}{\FALSE}
   \TYPE{B:}\bool_if:NTF \myboolb {\TRUE}{\FALSE}
+  \bool_set_inverse:N \myboola
+  \group_begin:
+    \bool_set_inverse:N \myboola
+    \bool_gset_inverse:N \myboolb
+    \bool_log:N \myboola
+  \group_end:
+  \bool_log:N \myboola
+  \bool_log:N \myboolb
 }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/l3kernel/testfiles/m3prg002.tlg b/l3kernel/testfiles/m3prg002.tlg
index 38f9354..2b0e64b 100644
--- a/l3kernel/testfiles/m3prg002.tlg
+++ b/l3kernel/testfiles/m3prg002.tlg
@@ -88,6 +88,25 @@ A:
 TRUE
 B:
 TRUE
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/local-global"
+! 
+! Inconsistent local/global assignment
+! 
+! See the LaTeX3 documentation for further information.
+! 
+! For immediate help type H <return>.
+!...............................................  
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+| 
+| Global assignment to a local variable '\myboolb'.
+|...............................................
+> \myboola=true.
+> \myboola=false.
+> \myboolb=false.
 ============================================================
 ============================================================
 TEST 4: Boolean conditionals





More information about the latex3-commits mailing list