Skip to content

Commit

Permalink
Add l3candidates \bool_const:Nn (see #257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Le Floch committed Nov 29, 2017
1 parent 2dfdd63 commit 03ca82e
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 1 deletion.
25 changes: 25 additions & 0 deletions l3kernel/l3candidates.dtx
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl001.luatex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl001.ptex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl001.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl001.uptex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl001.xetex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl003.luatex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl003.ptex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl003.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl003.uptex.tlg
Expand Up @@ -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 ...
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3expl003.xetex.tlg
Expand Up @@ -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 ...
Expand Down
4 changes: 3 additions & 1 deletion 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}
Expand Down Expand Up @@ -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}{
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3prg003.tlg
Expand Up @@ -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
Expand Down

0 comments on commit 03ca82e

Please sign in to comment.