[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3cctab: refactor the chk_if_valid check (0f3e04aad)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Jul 16 12:13:16 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/0f3e04aada7461029764b4be499501b20b789138

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

commit 0f3e04aada7461029764b4be499501b20b789138
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Fri Jun 26 23:29:57 2020 +0200

    l3cctab: refactor the chk_if_valid check


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

0f3e04aada7461029764b4be499501b20b789138
 l3kernel/l3cctab.dtx | 73 ++++++++++++++++++++++++----------------------------
 1 file changed, 33 insertions(+), 40 deletions(-)

diff --git a/l3kernel/l3cctab.dtx b/l3kernel/l3cctab.dtx
index 9683d7969..66141d311 100644
--- a/l3kernel/l3cctab.dtx
+++ b/l3kernel/l3cctab.dtx
@@ -419,7 +419,8 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_chk_if_valid:N}
+% \begin{macro}[TF]{\@@_chk_if_valid:N}
+% \begin{macro}{\@@_chk_if_valid_aux:NTF}
 %   Checks whether the argument is defined and whether it is a valid
 %   \meta{cctab~var}. In \LuaTeX{} the validity of the \meta{cctab~var}
 %   is checked by the engine, which complains if the argument is not a
@@ -427,60 +428,52 @@
 %   command is an intarray variable (the underlying definition is a copy
 %   of the \texttt{cmr10} font).
 %    \begin{macrocode}
-\sys_if_engine_luatex:TF
+\prg_new_protected_conditional:Npnn \@@_chk_if_valid:N #1
+  { TF , T , F }
   {
-    \prg_new_protected_conditional:Npnn \@@_chk_if_valid:N #1
-      { TF , T , F }
+    \cctab_if_exist:NTF #1
       {
-        \cctab_if_exist:NTF #1
+        \@@_chk_if_valid_aux:NTF #1
+          { \prg_return_true: }
           {
+            \__kernel_msg_error:nnx { kernel } { invalid-cctab }
+              { \token_to_str:N #1 }
+            \prg_return_false:
+          }
+      }
+      {
+        \__kernel_msg_error:nnx { kernel } { command-not-defined }
+          { \token_to_str:N #1 }
+        \prg_return_false:
+      }
+  }
+\sys_if_engine_luatex:TF
+  {
+    \cs_new_protected:Npn \@@_chk_if_valid_aux:NTF #1
+      {
 %<*initex>
-            \bool_lazy_and:nnTF
-              { \int_if_odd_p:n {#1} }
-              { \int_compare_p:nNn {#1-1} < { \g_@@_allocate_int } }
+        \bool_lazy_and:nnTF
+          { \int_if_odd_p:n {#1} }
+          { \int_compare_p:nNn {#1-1} < { \g_@@_allocate_int } }
 %</initex>
 %<*package>
-            \int_compare:nNnTF {#1-1} < { \e at alloc@ccodetable at count }
+        \int_compare:nNnTF {#1-1} < { \e at alloc@ccodetable at count }
 %</package>
-              { \prg_return_true: }
-              {
-                \__kernel_msg_error:nnx { kernel } { invalid-cctab }
-                  { \token_to_str:N #1 }
-                \prg_return_false:
-              }
-          }
-          {
-            \__kernel_msg_error:nnx { kernel } { command-not-defined }
-              { \token_to_str:N #1 }
-            \prg_return_false:
-          }
       }
   }
   {
-    \prg_new_protected_conditional:Npnn \@@_chk_if_valid:N #1
-      { TF , T , F }
+    \cs_new_protected:Npn \@@_chk_if_valid_aux:NTF #1
       {
-        \cctab_if_exist:NTF #1
-          {
-            \exp_args:Nf \str_if_in:nnTF
-              { \cs_meaning:N #1 }
-              { select~font~cmr10~at~ }
-              { \prg_return_true: }
-              {
-                \__kernel_msg_error:nnx { kernel } { invalid-cctab }
-                  { \token_to_str:N #1 }
-                \prg_return_false:
-              }
-          }
-          {
-            \__kernel_msg_error:nnx { kernel } { command-not-defined }
-              { \token_to_str:N #1 }
-            \prg_return_false:
-          }
+        \exp_args:Nf \str_if_in:nnTF
+          { \cs_meaning:N #1 }
+          { select~font~cmr10~at~ }
       }
   }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
+%
+% \subsection{Constant category code tables}
 %
 % \begin{macro}{\cctab_const:Nn,\cctab_const:cn}
 %  Creates a new \meta{cctab~var} then sets it with the current and





More information about the latex3-commits mailing list.