[latex3-commits] [git/latex3] master: Add l3candidates \bool_const:Nn (see #257) (03ca82e)

Bruno Le Floch bruno at le-floch.fr
Wed Nov 29 04:55:11 CET 2017


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/03ca82e94d5e413bcad0aca98c112aa64e1dd9f1

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

commit 03ca82e94d5e413bcad0aca98c112aa64e1dd9f1
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Tue Nov 28 22:55:11 2017 -0500

    Add l3candidates \bool_const:Nn (see #257)


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

03ca82e94d5e413bcad0aca98c112aa64e1dd9f1
 l3kernel/l3candidates.dtx               |   25 +++++++++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl001.tlg        |    2 ++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl003.tlg        |    2 ++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    2 ++
 l3kernel/testfiles/m3prg003.lvt         |    4 +++-
 l3kernel/testfiles/m3prg003.tlg         |    2 ++
 13 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 3bc1c17..6de5708 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -370,6 +370,17 @@
 %   space might be removed as well.
 % \end{function}
 %
+% \section{Additions to \pkg{l3prg}}
+%
+% \begin{function}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn}
+%   \begin{syntax}
+%     \cs{bool_const:Nn} \meta{boolean} \Arg{boolexpr}
+%   \end{syntax}
+%   Creates a new constant \meta{boolean} or raises an error if the name
+%   is already taken. The value of the \meta{boolean} is set globally to
+%   the result of evaluating the \meta{boolexpr}.
+% \end{function}
+%
 % \section{Additions to \pkg{l3prop}}
 %
 % \begin{function}[EXP]{\prop_count:N, \prop_count:c}
@@ -1961,6 +1972,20 @@
 % \end{macro}
 % \end{macro}
 %
+% \subsection{Additions to \pkg{l3prg}}
+%
+% \begin{macro}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn}
+%   A merger between \cs{tl_const:Nn} and \cs{bool_set:Nn}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \bool_const:Nn #1#2
+  {
+    \__chk_if_free_cs:N #1
+    \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2}
+  }
+\cs_generate_variant:Nn \bool_const:Nn { 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 5694611..b160a68 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5512,6 +5512,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 6778ac8..e0cf785 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5502,6 +5502,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 082ca0e..ceb472f 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5502,6 +5502,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 dc00bf4..f21ed1a 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5500,6 +5500,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 1314e0c..4497478 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5485,6 +5485,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 5694611..b160a68 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5512,6 +5512,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 6778ac8..e0cf785 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5502,6 +5502,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 082ca0e..ceb472f 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5502,6 +5502,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 dc00bf4..f21ed1a 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5500,6 +5500,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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 1314e0c..4497478 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5485,6 +5485,8 @@ Defining \exp_args:Nnnff on line ...
 Defining \msg_expandable_error:nnff on line ...
 Defining \msg_expandable_error:nnf on line ...
 Defining \__msg_expandable_error_module:nn on line ...
+Defining \bool_const:Nn on line ...
+Defining \bool_const:cn 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/m3prg003.lvt b/l3kernel/testfiles/m3prg003.lvt
index 63f986a..df3bccb 100644
--- a/l3kernel/testfiles/m3prg003.lvt
+++ b/l3kernel/testfiles/m3prg003.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2008-2012 The LaTeX3 project
+% Copyright (C) 2008-2012,2017 The LaTeX3 project
 %
 
 \documentclass{minimal}
@@ -101,6 +101,8 @@
     \int_compare_p:nNn 2=2
   }
   \bool_if:NTF \l_tmpa_bool \TRUE \FALSE
+  \bool_const:cn { c_A_bool } { ! \l_tmpa_bool }
+  \bool_if:NTF \c_A_bool \TRUE \FALSE
 }
 
 \TESTEXP{Basics~of~not~logic-code}{
diff --git a/l3kernel/testfiles/m3prg003.tlg b/l3kernel/testfiles/m3prg003.tlg
index 7b8f3f8..f688873 100644
--- a/l3kernel/testfiles/m3prg003.tlg
+++ b/l3kernel/testfiles/m3prg003.tlg
@@ -96,6 +96,8 @@ misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
 TRUE
+Defining \c_A_bool on line ...
+FALSE
 ============================================================
 ============================================================
 TEST 9: Basics of not logic-code





More information about the latex3-commits mailing list