[latex3-commits] [l3svn] r6898 - Change most uses of || or && to bool_lazy functions (see #217)

noreply at latex-project.org noreply at latex-project.org
Sun Feb 12 06:54:18 CET 2017


Author: bruno
Date: 2017-02-12 06:54:17 +0100 (Sun, 12 Feb 2017)
New Revision: 6898

Modified:
   trunk/l3build/l3build.dtx
   trunk/l3experimental/l3str/l3str-convert.dtx
   trunk/l3experimental/xgalley/l3galley.dtx
   trunk/l3kernel/expl3.dtx
   trunk/l3kernel/l3candidates.dtx
   trunk/l3kernel/l3doc.dtx
   trunk/l3kernel/l3sys.dtx
   trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx
Log:
Change most uses of || or && to bool_lazy functions (see #217)


Modified: trunk/l3build/l3build.dtx
===================================================================
--- trunk/l3build/l3build.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3build/l3build.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -783,11 +783,11 @@
 %   \bool_set:Nn \l_tmpa_bool
 %    {
 %     \int_compare_p:nNn 1=1
-%     && \bool_if_p:n
+%     && \bool_lazy_any_p:n
 %      {
-%       \int_compare_p:nNn 2=3 ||
-%       \int_compare_p:nNn 4=4 ||
-%       \int_compare_p:nNn 1=\ERROR % is skipped
+%        { \int_compare_p:nNn 2=3 }
+%        { \int_compare_p:nNn 4=4 }
+%        { \int_compare_p:nNn 1=\ERROR } % is skipped
 %      }
 %     && \int_compare_p:nNn 2=2
 %    }

Modified: trunk/l3experimental/l3str/l3str-convert.dtx
===================================================================
--- trunk/l3experimental/l3str/l3str-convert.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3experimental/l3str/l3str-convert.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -1003,9 +1003,9 @@
 %   to raise the flag \texttt{str_byte}.  Spaces have already been given
 %   the correct category code when this function is called.
 %    \begin{macrocode}
-\bool_if:nTF
+\bool_lazy_any:nTF
   {
-    \sys_if_engine_luatex_p: ||
+    \sys_if_engine_luatex_p:
     \sys_if_engine_xetex_p:
   }
   {
@@ -1036,9 +1036,9 @@
 %   The simplest unescaping method removes non-bytes from
 %   \cs{g_@@_result_tl}.
 %    \begin{macrocode}
-\bool_if:nTF
+\bool_lazy_any:nTF
   {
-    \sys_if_engine_luatex_p: ||
+    \sys_if_engine_luatex_p:
     \sys_if_engine_xetex_p:
   }
   {
@@ -1089,9 +1089,9 @@
 %    \begin{macrocode}
 \group_begin:
   \char_set_catcode_other:n { 0 }
-  \bool_if:nTF
+  \bool_lazy_any:nTF
     {
-      \sys_if_engine_luatex_p: ||
+      \sys_if_engine_luatex_p:
       \sys_if_engine_xetex_p:
     }
 %    \end{macrocode}
@@ -1404,9 +1404,9 @@
 % Messages used for other escapings and
 % encodings are defined in each definition file.
 %    \begin{macrocode}
-\bool_if:nT
+\bool_lazy_any:nT
   {
-    \sys_if_engine_luatex_p: ||
+    \sys_if_engine_luatex_p:
     \sys_if_engine_xetex_p:
   }
   {

Modified: trunk/l3experimental/xgalley/l3galley.dtx
===================================================================
--- trunk/l3experimental/xgalley/l3galley.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3experimental/xgalley/l3galley.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -1251,12 +1251,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_par_update_cutout:
   {
-    \bool_if:nF
+    \bool_lazy_and:nnF
+      { \seq_if_empty_p:N \g_@@_cutout_left_seq }
+      { \seq_if_empty_p:N \g_@@_cutout_right_seq }
       {
-           \seq_if_empty_p:N \g_@@_cutout_left_seq
-        && \seq_if_empty_p:N \g_@@_cutout_right_seq
-      }
-      {
         \prg_replicate:nn \tex_prevgraf:D
           {
             \seq_gpop_left:NN \g_@@_cutout_left_seq  \l_@@_tmp_tl
@@ -1266,11 +1264,9 @@
       }
     \int_compare:nNnT \l_@@_group_level_int = \etex_currentgrouplevel:D
       {
-        \bool_if:nT
-          {
-               \seq_if_empty_p:N \g_@@_cutout_left_seq
-            && \seq_if_empty_p:N \g_@@_cutout_right_seq
-          }
+        \bool_lazy_and:nnT
+          { \seq_if_empty_p:N \g_@@_cutout_left_seq }
+          { \seq_if_empty_p:N \g_@@_cutout_right_seq }
           { \bool_gset_false:N \g_@@_cutout_active_bool }
       }
   }
@@ -1833,11 +1829,9 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parshape_set_margins:
   {
-    \bool_if:nTF
-      {
-           \dim_compare_p:nNn \l_galley_total_left_margin_dim  = \c_zero_dim
-        && \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim
-      }
+    \bool_lazy_and:nnTF
+      { \dim_compare_p:nNn \l_galley_total_left_margin_dim  = \c_zero_dim }
+      { \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim }
       { \tex_parshape:D \c_zero }
       {
         \tex_parshape:D
@@ -1855,12 +1849,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parshape_set_indents:
   {
-    \bool_if:nF
+    \bool_lazy_and:nnF
+      { \seq_if_empty_p:N \l_@@_parshape_left_indent_seq }
+      { \seq_if_empty_p:N \l_@@_parshape_right_indent_seq }
       {
-           \seq_if_empty_p:N \l_@@_parshape_left_indent_seq
-        && \seq_if_empty_p:N \l_@@_parshape_right_indent_seq
-      }
-      {
         \@@_parshape_set_indents:NN
           \l_@@_parshape_left_indent_seq
           \l_@@_parshape_right_indent_seq
@@ -1896,12 +1888,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parshape_set_cutouts:
   {
-    \bool_if:nF
+    \bool_lazy_and:nnF
+      { \seq_if_empty_p:N \g_@@_cutout_left_seq }
+      { \seq_if_empty_p:N \g_@@_cutout_right_seq }
       {
-           \seq_if_empty_p:N \g_@@_cutout_left_seq
-        && \seq_if_empty_p:N \g_@@_cutout_right_seq
-      }
-      {
         \@@_parshape_set_cutouts:n { left }
         \@@_parshape_set_cutouts:n { right }
         \int_set:Nn \l_@@_tmp_int

Modified: trunk/l3kernel/expl3.dtx
===================================================================
--- trunk/l3kernel/expl3.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3kernel/expl3.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -1714,11 +1714,9 @@
   \sys_if_engine_xetex:TF
     { xdvipdfmx }
     {
-      \bool_if:nTF
-        {
-             \cs_if_exist_p:N  \pdftex_pdfoutput:D
-          && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero
-        }
+      \bool_lazy_and:nnTF
+        { \cs_if_exist_p:N  \pdftex_pdfoutput:D }
+        { \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero }
         { pdfmode }
         { dvips }
     }

Modified: trunk/l3kernel/l3candidates.dtx
===================================================================
--- trunk/l3kernel/l3candidates.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3kernel/l3candidates.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -3640,11 +3640,11 @@
   {
     \token_if_expandable:NTF #1
       {
-        \bool_if:nTF
+        \bool_lazy_any:nTF
           {
-               \token_if_protected_macro_p:N      #1
-            || \token_if_protected_long_macro_p:N #1
-            || \token_if_eq_meaning_p:NN \q_recursion_tail #1
+            { \token_if_eq_meaning_p:NN \q_recursion_tail #1 }
+            { \token_if_protected_macro_p:N      #1 }
+            { \token_if_protected_long_macro_p:N #1 }
           }
           { \use_ii:nn }
           { \use_i:nn }
@@ -3786,11 +3786,9 @@
               #2 \q_recursion_stop
           }
           {
-            \bool_if:nTF
-              {
-                   \token_if_cs_p:N #1
-                || ! ( \int_compare_p:nNn { `#1 } = { "0307 } )
-              }
+            \bool_lazy_or:nnTF
+              { \token_if_cs_p:N #1 }
+              { ! \int_compare_p:nNn { `#1 } = { "0307 } }
               { \@@_change_case_output:Vwn \c__unicode_dotless_i_tl }
               {
                 \@@_change_case_output:nwn { i }
@@ -3923,15 +3921,15 @@
           #3 \q_recursion_stop
       }
       {
-        \bool_if:nT
+        \bool_lazy_and:nnT
+          { ! \token_if_cs_p:N #2 }
           {
-            ! \token_if_cs_p:N #2
-            &&
-              (
-                   \int_compare_p:nNn { `#2 } = { "0300 }
-                || \int_compare_p:nNn { `#2 } = { "0301 }
-                || \int_compare_p:nNn { `#2 } = { "0303 }
-              )
+            \bool_lazy_any_p:n
+              {
+                { \int_compare_p:nNn { `#2 } = { "0300 } }
+                { \int_compare_p:nNn { `#2 } = { "0301 } }
+                { \int_compare_p:nNn { `#2 } = { "0303 } }
+              }
           }
           { \@@_change_case_output:Vwn \c__unicode_dot_above_tl }
         #1 #2#3 \q_recursion_stop
@@ -3978,11 +3976,9 @@
           #3 \q_recursion_stop
       }
       {
-        \bool_if:nTF
-          {
-               ! \token_if_cs_p:N #2
-            && \int_compare_p:nNn { `#2 } = { "0307 }
-          }
+        \bool_lazy_and:nnTF
+          { ! \token_if_cs_p:N #2 }
+          { \int_compare_p:nNn { `#2 } = { "0307 } }
           { #1 }
           { #1 #2 }
         #3 \q_recursion_stop
@@ -4559,12 +4555,10 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_change_case_mixed_nl:Nnw #1
   {
-    \bool_if:nTF
+    \bool_lazy_or:nnTF
+      { \int_compare_p:nNn { `#1 } = { `i } }
+      { \int_compare_p:nNn { `#1 } = { `I } }
       {
-           \int_compare_p:nNn { `#1 } = { `i }
-        || \int_compare_p:nNn { `#1 } = { `I }
-      }
-      {
         \@@_change_case_output:nwn { I }
         \@@_change_case_mixed_nl:Nw
       }
@@ -4583,14 +4577,12 @@
           #3 \q_recursion_stop
       }
       {
-        \bool_if:nTF
+        \bool_lazy_and:nnTF
+          { ! ( \token_if_cs_p:N #2 ) }
           {
-            ! ( \token_if_cs_p:N #2 )
-            &&
-              (
-                   \int_compare_p:nNn { `#2 } = { `j }
-                || \int_compare_p:nNn { `#2 } = { `J }
-              )
+            \bool_lazy_or_p:nn
+              { \int_compare_p:nNn { `#2 } = { `j } }
+              { \int_compare_p:nNn { `#2 } = { `J } }
           }
           {
             \@@_change_case_output:nwn { J }

Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3kernel/l3doc.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -2477,11 +2477,9 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_typeset_dates:
   {
-    \bool_if:nF
-      {
-        \tl_if_empty_p:N \l_@@_date_added_tl &&
-        \tl_if_empty_p:N \l_@@_date_updated_tl
-      }
+    \bool_lazy_and:nnF
+      { \tl_if_empty_p:N \l_@@_date_added_tl }
+      { \tl_if_empty_p:N \l_@@_date_updated_tl }
       { \midrule }
     \tl_if_empty:NF \l_@@_date_added_tl
       {
@@ -2972,12 +2970,12 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_macro_end_check_tested:
   {
-    \bool_if:nT
+    \bool_lazy_all:nT
      {
-       \g_@@_checktest_bool &&
-       ! \l_@@_macro_aux_bool &&
-       ! \l_@@_macro_var_bool &&
-       ! \l_@@_macro_tested_bool
+       { \g_@@_checktest_bool }
+       { ! \l_@@_macro_aux_bool }
+       { ! \l_@@_macro_var_bool }
+       { ! \l_@@_macro_tested_bool }
      }
      {
        \seq_gput_right:Nx \g_@@_not_tested_seq
@@ -3039,12 +3037,10 @@
   }
 \cs_new_protected:Npn \@@_print_documented:
   {
-    \bool_if:nT
+    \bool_lazy_or:nnF
+      { \l_@@_macro_aux_bool }
+      { \l_@@_macro_internal_bool }
       {
-        ! \l_@@_macro_aux_bool &&
-        ! \l_@@_macro_internal_bool
-      }
-      {
         \int_set:Nn \l_@@_tmpa_int
           { \seq_count:N \g_@@_nested_names_seq }
         \tl_if_empty:NTF \l_@@_macro_documented_tl
@@ -3517,8 +3513,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_show_functions_defined:
   {
-    \bool_if:nT
-      { \g_@@_typeset_implementation_bool && \g_@@_checkfunc_bool }
+    \bool_lazy_and:nnT
+      { \g_@@_typeset_implementation_bool } { \g_@@_checkfunc_bool }
       {
         \iow_term:x { \c_@@_iow_separator_tl \iow_newline: }
         \iow_open:Nn \g_@@_func_iow { \c_sys_jobname_str .cmds }

Modified: trunk/l3kernel/l3sys.dtx
===================================================================
--- trunk/l3kernel/l3sys.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3kernel/l3sys.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -268,12 +268,9 @@
 % \begin{variable}{\c_sys_output_str}
 %   This is a simple enough concept: the two views here are complementary.
 %    \begin{macrocode}
-\bool_if:nTF
+\int_compare:nNnTF
+  { \cs_if_exist_use:NF \pdftex_pdfoutput:D \c_zero } > \c_zero
   {
-       \cs_if_exist_p:N  \pdftex_pdfoutput:D
-    && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero
-  }
-  {
     \cs_new_eq:NN \sys_if_output_dvi:T  \use_none:n
     \cs_new_eq:NN \sys_if_output_dvi:F  \use:n
     \cs_new_eq:NN \sys_if_output_dvi:TF \use_ii:nn

Modified: trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx
===================================================================
--- trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx	2017-02-12 05:09:14 UTC (rev 6897)
+++ trunk/l3trial/l3kernel-extras/l3kernel-extras.dtx	2017-02-12 05:54:17 UTC (rev 6898)
@@ -841,12 +841,10 @@
   { \tl_length:n \l_tmpc_int \msg_term:x }
   {
     \cs_new_eq:cN { __cs_deprecated_ \cs_to_str:N #1 } #1
-    \bool_if:nTF
+    \bool_lazy_or:nnTF
+      { \token_if_protected_macro_p:N #1 }
+      { \token_if_protected_long_macro_p:N #1 }
       {
-        \token_if_protected_macro_p:N #1
-        || \token_if_protected_long_macro_p:N #1
-      }
-      {
         \cs_gset_protected:Npx #1
           {
             \exp_not:N \__cs_protected_deprecated:N \exp_not:N #1
@@ -1083,7 +1081,9 @@
               \__char_show_code:n { ef }
             }
         }
-      \bool_if:nF { \__char_show_p:n { lp } && \__char_show_p:n { rp } }
+      \bool_lazy_and:nnF
+        { \__char_show_p:n { lp } }
+        { \__char_show_p:n { rp } }
         {
           \tl_put_right:Nx \l__char_internal_tl
             {
@@ -1092,11 +1092,11 @@
               right ~ margin ~ \__char_show_code:n { rp }
             }
         }
-      \bool_if:nF
+      \bool_lazy_all:nF
         {
-          \__char_show_p:n { knbs }
-          && \__char_show_p:n { stbs }
-          && \__char_show_p:n { shbs }
+          { \__char_show_p:n { knbs } }
+          { \__char_show_p:n { stbs } }
+          { \__char_show_p:n { shbs } }
         }
         {
           \tl_put_right:Nx \l__char_internal_tl
@@ -1107,7 +1107,9 @@
               minus ~ \__char_show_code:n { shbs }
             }
         }
-      \bool_if:nF { \__char_show_p:n { knbc } && \__char_show_p:n { knac } }
+      \bool_lazy_and:nnF
+        { \__char_show_p:n { knbc } }
+        { \__char_show_p:n { knac } }
         {
           \tl_put_right:Nx \l__char_internal_tl
             {



More information about the latex3-commits mailing list