[latex3-commits] [git/LaTeX3-latex3-latex3] master: Implement \bool_xor:nnTF instead of just \bool_xor_p:nn (c323049)
Bruno Le Floch
bruno at le-floch.fr
Wed May 9 20:07:33 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/c323049c2b826690c123a06a5884849f64e2b45b
>---------------------------------------------------------------
commit c323049c2b826690c123a06a5884849f64e2b45b
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Wed May 9 14:01:11 2018 -0400
Implement \bool_xor:nnTF instead of just \bool_xor_p:nn
>---------------------------------------------------------------
c323049c2b826690c123a06a5884849f64e2b45b
l3kernel/l3prg.dtx | 19 +++++++++++--------
l3kernel/testfiles/m3expl001.luatex.tlg | 3 +++
l3kernel/testfiles/m3expl001.ptex.tlg | 3 +++
l3kernel/testfiles/m3expl001.tlg | 3 +++
l3kernel/testfiles/m3expl001.uptex.tlg | 3 +++
l3kernel/testfiles/m3expl001.xetex.tlg | 3 +++
l3kernel/testfiles/m3expl003.luatex.tlg | 3 +++
l3kernel/testfiles/m3expl003.ptex.tlg | 3 +++
l3kernel/testfiles/m3expl003.tlg | 3 +++
l3kernel/testfiles/m3expl003.uptex.tlg | 3 +++
l3kernel/testfiles/m3expl003.xetex.tlg | 3 +++
l3kernel/testfiles/m3prg003.lvt | 6 +++++-
l3kernel/testfiles/m3prg003.tlg | 4 ++++
13 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/l3kernel/l3prg.dtx b/l3kernel/l3prg.dtx
index 4643375..0c37cd3 100644
--- a/l3kernel/l3prg.dtx
+++ b/l3kernel/l3prg.dtx
@@ -484,13 +484,13 @@
% expression.
% \end{function}
%
-% \begin{function}[EXP, updated = 2017-07-15]{\bool_xor_p:nn}
+% \begin{function}[EXP, pTF, added = 2018-05-09]{\bool_xor:nn}
% \begin{syntax}
% \cs{bool_xor_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+% \cs{bool_xor:nnTF} \Arg{boolexpr_1} \Arg{boolexpr_2} \Arg{true code} \Arg{false code}
% \end{syntax}
% Implements an \enquote{exclusive or} operation between two boolean
-% expressions. There is no infix operation for this logical
-% operator.
+% expressions. There is no infix operation for this logical operation.
% \end{function}
%
% \section{Logical loops}
@@ -1261,16 +1261,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\bool_xor_p:nn}
+% \begin{macro}[pTF]{\bool_xor:nn}
% \UnitTested
% Exclusive or. If the boolean expressions have same truth value,
% return \texttt{false}, otherwise return \texttt{true}.
% \begin{macrocode}
-\cs_new:Npn \bool_xor_p:nn #1#2
+\prg_new_conditional:Npnn \bool_xor:nn #1#2 { p , T , F , TF }
{
- \int_compare:nNnTF { \bool_if_p:n {#1} } = { \bool_if_p:n {#2} }
- \c_false_bool
- \c_true_bool
+ \bool_if:nT {#1} \reverse_if:N
+ \if_predicate:w \bool_if_p:n {#2}
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
}
% \end{macrocode}
% \end{macro}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 6cf375c..754d3fd 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -1593,6 +1593,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index f385ca0..8a4040f 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index c6c098a..2ed968e 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 338718d..14d35ea 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 000951d..af77637 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 6cf375c..754d3fd 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -1593,6 +1593,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index f385ca0..8a4040f 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index c6c098a..2ed968e 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 338718d..14d35ea 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 000951d..af77637 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -1591,6 +1591,9 @@ Defining \bool_lazy_or:nnF on line ...
Defining \bool_lazy_or:nnTF on line ...
Defining \bool_not_p:n on line ...
Defining \bool_xor_p:nn on line ...
+Defining \bool_xor:nnT on line ...
+Defining \bool_xor:nnF on line ...
+Defining \bool_xor:nnTF on line ...
Defining \bool_while_do:Nn on line ...
Defining \bool_until_do:Nn on line ...
Defining \bool_while_do:cn on line ...
diff --git a/l3kernel/testfiles/m3prg003.lvt b/l3kernel/testfiles/m3prg003.lvt
index 1d67ca4..e9c19c6 100644
--- a/l3kernel/testfiles/m3prg003.lvt
+++ b/l3kernel/testfiles/m3prg003.lvt
@@ -89,7 +89,11 @@
\bool_xor_p:nn { \c_true_bool }{ \c_true_bool } \NEWLINE
\bool_xor_p:nn { \c_true_bool }{ \c_false_bool } \NEWLINE
\bool_xor_p:nn { \c_false_bool }{ \c_true_bool } \NEWLINE
- \bool_xor_p:nn { \c_false_bool }{ \c_false_bool }
+ \bool_xor_p:nn { \c_false_bool }{ \c_false_bool } \NEWLINE
+ \bool_xor:nnTF { \c_true_bool }{ \c_true_bool } \TRUE \FALSE \NEWLINE
+ \bool_xor:nnTF { \c_true_bool }{ \c_false_bool } \TRUE \FALSE \NEWLINE
+ \bool_xor:nnTF { \c_false_bool }{ \c_true_bool } \TRUE \FALSE \NEWLINE
+ \bool_xor:nnTF { \c_false_bool }{ \c_false_bool } \TRUE \FALSE
}
diff --git a/l3kernel/testfiles/m3prg003.tlg b/l3kernel/testfiles/m3prg003.tlg
index f688873..b05e062 100644
--- a/l3kernel/testfiles/m3prg003.tlg
+++ b/l3kernel/testfiles/m3prg003.tlg
@@ -83,6 +83,10 @@ TEST 7: XOR
\c_true_bool
\c_true_bool
\c_false_bool
+FALSE
+TRUE
+TRUE
+FALSE
============================================================
============================================================
TEST 8: bool_set
More information about the latex3-commits
mailing list