[latex3-commits] [git/latex3] main: Rename \bool_case_true:n(TF) to (stable) \bool_case:n(TF) (725b61f1e)

latex-team at latex-proejct.org latex-team at latex-proejct.org
Wed May 3 16:34:34 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/725b61f1e2c8056b88bd28abe9a56d850fb35303

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

commit 725b61f1e2c8056b88bd28abe9a56d850fb35303
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed May 3 15:34:34 2023 +0100

    Rename \bool_case_true:n(TF) to (stable) \bool_case:n(TF)


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

725b61f1e2c8056b88bd28abe9a56d850fb35303
 l3kernel/CHANGELOG.md             |  2 +
 l3kernel/l3candidates.dtx         | 88 ---------------------------------------
 l3kernel/l3deprecation.dtx        | 19 +++++++++
 l3kernel/l3prg.dtx                | 79 +++++++++++++++++++++++++++++++++++
 l3kernel/testfiles/m3prg005.lvt   |  4 +-
 l3kernel/testfiles/m3quark001.tlg |  4 +-
 6 files changed, 104 insertions(+), 92 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 81a7f906d..b799ac651 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -8,6 +8,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## [Unreleased]
 
 ### Added
+- `\bool_case:n(TF)` (renamed from  `\bool_case_true:n(TF)`)
 - `\flag_ensure_raised:n` (renamed from `\flag_raise_if_clear:n`)
 - `\iow_wrap_allow_break:` (renamed from `\iow_allow_break:`)
 
@@ -35,6 +36,7 @@ this project uses date-based 'snapshot' version identifiers.
   - `\sys_if_rand_exist:(TF)`
   - `\tl_range_braced:Nnn` and `\tl_range_unbraced:Nnn`
 - Experimental functions now renamed
+  - `\bool_case_true:n(TF)` (now `\bool_case:n(TF)`)
   - `\flag_raise_if_clear:n` (now `\flag_raise_if_clear:n`)
   - `\iow_allow_break:` (now `\iow_wrap_allow_break:`)
 - Experimental functions moved to kernel-internal:
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 845713262..de800744a 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -84,48 +84,6 @@
 % into the kernel. However, real use sometimes leads to better ideas, so functions from this module are
 % \textbf{not necessarily stable} and we may have to adjust them!
 %
-% \section{Additions to \pkg{l3prg}}
-%
-% \begin{function}[added = 2019-02-10, EXP, noTF]
-%   {\bool_case_true:n}
-%   \begin{syntax}
-%     \cs{bool_case_true:nTF} \\
-%     ~~|{| \\
-%     ~~~~\Arg{boolexpr case_1} \Arg{code case_1} \\
-%     ~~~~\Arg{boolexpr case_2} \Arg{code case_2} \\
-%     ~~~~\ldots \\
-%     ~~~~\Arg{boolexpr case_n} \Arg{code case_n} \\
-%     ~~|}| \\
-%     ~~\Arg{true code}
-%     ~~\Arg{false code}
-%   \end{syntax}
-%   Evaluates in turn each of the \meta{boolean expression cases} until
-%   the first one that evaluates to \texttt{true}.
-%   The \meta{code} associated to this first case is left in the input
-%   stream, followed by the \meta{true code}, and other cases are
-%   discarded.  If none of the cases match then only the \meta{false
-%   code} is inserted. The function \cs{bool_case_true:n},
-%   which does nothing if there is no match, is
-%   also available. For example
-%   \begin{verbatim}
-%     \bool_case_true:nF
-%       {
-%         { \dim_compare_p:n { \l__mypkg_wd_dim <= 10pt } }
-%             { Fits }
-%         { \int_compare_p:n { \l__mypkg_total_int >= 10 } }
-%             { Many }
-%         { \l__mypkg_special_bool }
-%             { Special }
-%       }
-%       { No idea! }
-%   \end{verbatim}
-%   leaves \enquote{\texttt{Fits}} or \enquote{\texttt{Many}} or
-%   \enquote{\texttt{Special}} or \enquote{\texttt{No idea!}} in the
-%   input stream, in a way similar to some other language's
-%   \enquote{\texttt{if} \ldots\ \texttt{elseif} \ldots\ \texttt{elseif} \ldots\
-%   \texttt{else} \ldots}.
-% \end{function}
-%
 % \section{Additions to \pkg{l3seq}}
 %
 % \begin{function}[rEXP]
@@ -315,52 +273,6 @@
 %<*package>
 %    \end{macrocode}
 %
-% \subsection{Additions to \pkg{l3prg}}
-%
-%    \begin{macrocode}
-%<@@=bool>
-%    \end{macrocode}
-%
-% \begin{variable}{\s_@@_mark,\s_@@_stop}
-%   Internal scan marks.
-%    \begin{macrocode}
-\scan_new:N \s_@@_mark
-\scan_new:N \s_@@_stop
-%    \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}[EXP, noTF]{\bool_case_true:n}
-% \begin{macro}{\@@_case:NnTF}
-% \begin{macro}{\@@_case:w,\@@_case_end:nw}
-%   For boolean cases the overall idea is the same as for
-%   \cs{tl_case:nnTF} as described in \pkg{l3tl}.
-%    \begin{macrocode}
-\cs_new:Npn \bool_case_true:nTF
-  { \exp:w \@@_case:nTF }
-\cs_new:Npn \bool_case_true:nT #1#2
-  { \exp:w \@@_case:nTF {#1} {#2} { } }
-\cs_new:Npn \bool_case_true:nF #1
-  { \exp:w \@@_case:nTF {#1} { } }
-\cs_new:Npn \bool_case_true:n #1
-  { \exp:w \@@_case:nTF {#1} { } { } }
-\cs_new:Npn \@@_case:nTF #1#2#3
-  {
-    \@@_case:w
-    #1 \c_true_bool { } \s_@@_mark {#2} \s_@@_mark {#3} \s_@@_stop
-  }
-\cs_new:Npn \@@_case:w #1#2
-  {
-    \bool_if:nTF {#1}
-      { \@@_case_end:nw {#2} }
-      { \@@_case:w }
-  }
-\cs_new:Npn \@@_case_end:nw #1#2#3 \s_@@_mark #4#5 \s_@@_stop
-  { \exp_end: #1 #4 }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
 % \subsection{Additions to \pkg{l3prop}}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/l3deprecation.dtx b/l3kernel/l3deprecation.dtx
index 790a511e4..0182605e0 100644
--- a/l3kernel/l3deprecation.dtx
+++ b/l3kernel/l3deprecation.dtx
@@ -447,6 +447,25 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \subsection{Deprecated \pkg{l3prg} functions}
+%
+%    \begin{macrocode}
+%<@@=cs>
+%    \end{macrocode}
+%
+% \begin{macro}[EXP, noTF]{\bool_case_true:n}
+%    \begin{macrocode}
+\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:n }
+\cs_gset:Npn \bool_case_true:n { \bool_case:n }
+\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nT }
+\cs_gset:Npn \bool_case_true:nT { \bool_case:nT }
+\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nF }
+\cs_gset:Npn \bool_case_true:nF { \bool_case:nF }
+\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nTF }
+\cs_gset:Npn \bool_case_true:nTF { \bool_case:nTF }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Deprecated \pkg{l3str} functions}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/l3prg.dtx b/l3kernel/l3prg.dtx
index 770b11401..7d8a77805 100644
--- a/l3kernel/l3prg.dtx
+++ b/l3kernel/l3prg.dtx
@@ -637,6 +637,45 @@
 %   then loops until the \meta{boolean expression} is \texttt{false}.
 % \end{function}
 %
+% \begin{function}[added = 2023-05-03, EXP, noTF]{\bool_case:n}
+%   \begin{syntax}
+%     \cs{bool_case:nTF} \\
+%     ~~|{| \\
+%     ~~~~\Arg{boolexpr case_1} \Arg{code case_1} \\
+%     ~~~~\Arg{boolexpr case_2} \Arg{code case_2} \\
+%     ~~~~\ldots \\
+%     ~~~~\Arg{boolexpr case_n} \Arg{code case_n} \\
+%     ~~|}| \\
+%     ~~\Arg{true code}
+%     ~~\Arg{false code}
+%   \end{syntax}
+%   Evaluates in turn each of the \meta{boolean expression cases} until
+%   the first one that evaluates to \texttt{true}.
+%   The \meta{code} associated to this first case is left in the input
+%   stream, followed by the \meta{true code}, and other cases are
+%   discarded.  If none of the cases match then only the \meta{false
+%   code} is inserted. The function \cs{bool_case_true:n},
+%   which does nothing if there is no match, is
+%   also available. For example
+%   \begin{verbatim}
+%     \bool_case:nF
+%       {
+%         { \dim_compare_p:n { \l__mypkg_wd_dim <= 10pt } }
+%             { Fits }
+%         { \int_compare_p:n { \l__mypkg_total_int >= 10 } }
+%             { Many }
+%         { \l__mypkg_special_bool }
+%             { Special }
+%       }
+%       { No idea! }
+%   \end{verbatim}
+%   leaves \enquote{\texttt{Fits}} or \enquote{\texttt{Many}} or
+%   \enquote{\texttt{Special}} or \enquote{\texttt{No idea!}} in the
+%   input stream, in a way similar to some other language's
+%   \enquote{\texttt{if} \ldots\ \texttt{elseif} \ldots\ \texttt{elseif} \ldots\
+%   \texttt{else} \ldots}.
+% \end{function}
+%
 % \section{Producing multiple copies}
 %
 % \begin{function}[updated = 2011-07-04, EXP]{\prg_replicate:nn}
@@ -1483,6 +1522,46 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{variable}{\s_@@_mark,\s_@@_stop}
+%   Internal scan marks.
+%    \begin{macrocode}
+\scan_new:N \s_@@_mark
+\scan_new:N \s_@@_stop
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP, noTF]{\bool_case:n}
+% \begin{macro}{\@@_case:NnTF}
+% \begin{macro}{\@@_case:w,a\@@_case_end:nw}
+%   For boolean cases the overall idea is the same as for
+%   \cs{tl_case:nnTF} as described in \pkg{l3tl}.
+%    \begin{macrocode}
+\cs_new:Npn \bool_case:nTF
+  { \exp:w \@@_case:nTF }
+\cs_new:Npn \bool_case:nT #1#2
+  { \exp:w \@@_case:nTF {#1} {#2} { } }
+\cs_new:Npn \bool_case:nF #1
+  { \exp:w \@@_case:nTF {#1} { } }
+\cs_new:Npn \bool_case:n #1
+  { \exp:w \@@_case:nTF {#1} { } { } }
+\cs_new:Npn \@@_case:nTF #1#2#3
+  {
+    \@@_case:w
+    #1 \c_true_bool { } \s_@@_mark {#2} \s_@@_mark {#3} \s_@@_stop
+  }
+\cs_new:Npn \@@_case:w #1#2
+  {
+    \bool_if:nTF {#1}
+      { \@@_case_end:nw {#2} }
+      { \@@_case:w }
+  }
+\cs_new:Npn \@@_case_end:nw #1#2#3 \s_@@_mark #4#5 \s_@@_stop
+  { \exp_end: #1 #4 }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \subsection{Producing multiple copies}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3prg005.lvt b/l3kernel/testfiles/m3prg005.lvt
index 3911a5ad8..9de32d46a 100644
--- a/l3kernel/testfiles/m3prg005.lvt
+++ b/l3kernel/testfiles/m3prg005.lvt
@@ -73,7 +73,7 @@
 
 \TESTEXP { bool_case }
   {
-    \bool_case_true:nTF
+    \bool_case:nTF
       {
         { \int_compare_p:n { 1 > 2 } } { \ERROR }
         { \dim_compare_p:n { 10pt < 20pt } } { \TRUE }
@@ -82,7 +82,7 @@
       { \TRUE }
       { \ERROR }
     \NEWLINE
-    \bool_case_true:nTF
+    \bool_case:nTF
       {
         { \int_compare_p:n { 1 > 2 } } { \ERROR }
         { \dim_compare_p:n { 10pt < 20pt } && \c_false_bool } { \ERROR }
diff --git a/l3kernel/testfiles/m3quark001.tlg b/l3kernel/testfiles/m3quark001.tlg
index c952f45c5..ba8fed6d9 100644
--- a/l3kernel/testfiles/m3quark001.tlg
+++ b/l3kernel/testfiles/m3quark001.tlg
@@ -95,6 +95,8 @@ already been used for a scan mark.
 \s__seq_stop 
 \s__int_mark 
 \s__int_stop 
+\s__bool_mark 
+\s__bool_stop 
 \s__clist_mark 
 \s__clist_stop 
 \s__char_stop 
@@ -141,8 +143,6 @@ already been used for a scan mark.
 \s__text_stop 
 \s__text_recursion_tail 
 \s__text_recursion_stop 
-\s__bool_mark 
-\s__bool_stop 
 \s__expl_stop 
 \s__hook_mark 
 \s__debug_stop 





More information about the latex3-commits mailing list.