[latex3-commits] [git/LaTeX3-latex3-latex3] master: Check if cctab exists / provide INITEX cctab (0a18a3e55)

Phelype Oleinik phe.h.o1 at gmail.com
Mon Sep 9 14:13:47 CEST 2019


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

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

commit 0a18a3e55a73240dbd96637ab9b83e01fc4fe0c9
Author: Phelype Oleinik <phe.h.o1 at gmail.com>
Date:   Mon Sep 9 09:13:47 2019 -0300

    Check if cctab exists / provide INITEX cctab


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

0a18a3e55a73240dbd96637ab9b83e01fc4fe0c9
 l3experimental/l3cctab/l3cctab.dtx                 | 31 +++++++++++++++++++---
 .../l3cctab/testfiles/m3cctab000.luatex.tlg        |  1 +
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/l3experimental/l3cctab/l3cctab.dtx b/l3experimental/l3cctab/l3cctab.dtx
index 85a029b9b..ff8b03d6c 100644
--- a/l3experimental/l3cctab/l3cctab.dtx
+++ b/l3experimental/l3cctab/l3cctab.dtx
@@ -226,7 +226,7 @@
 %   done by using a stack of tables which are not read only, and actually
 %   having them as \enquote{in use} copies.
 %    \begin{macrocode}
-    \cs_new_protected:Npn \cctab_begin:N #1
+    \cs_new_protected:Npn \@@_begin:N #1
       {
         \seq_gpush:Nx \g_@@_stack_seq { \tex_the:D \tex_catcodetable:D }
         \tex_catcodetable:D #1
@@ -295,7 +295,7 @@
           { \@@_gstore:Nnn #1 {##1} { 11 } }
         \@@_gstore:Nnn #1 { 127 } { 15 }
       }
-    \cs_new_protected:Npn \cctab_begin:N #1
+    \cs_new_protected:Npn \@@_begin:N #1
       {
         \int_gadd:Nn \g_@@_stack_int { 2 }
         \int_compare:nNnT \g_@@_stack_int > \c_max_register_int
@@ -356,6 +356,31 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\cctab_begin:N}
+%   Check if a \meta{cctab~var} exists before trying to use it.
+%   Otherwise the code would throw an ``undefined control sequence''.
+%    \begin{macrocode}
+\cs_new_protected:Npn \cctab_begin:N #1
+  {
+    \cctab_if_exist:NTF #1
+      { \__cctab_begin:N #1 }
+      {
+        \__kernel_msg_error:nnx { kernel } { variable-not-defined }
+          { \token_to_str:N #1 }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\cctab_if_exist:N,\cctab_if_exist:c}
+%    \begin{macrocode}
+\prg_new_eq_conditional:NNn \cctab_if_exist:N \cs_if_exist:N
+  { TF , T , F , p }
+\prg_new_eq_conditional:NNn \cctab_if_exist:c \cs_if_exist:c
+  { TF , T , F , p }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\cctab_const:Nn}
 %    \begin{macrocode}
 \cs_new_protected:Npn \cctab_const:Nn #1#2
@@ -371,7 +396,6 @@
 %     \c_initex_cctab   ,
 %     \c_code_cctab     ,
 %     \c_document_cctab ,
-%     \c_initex_cctab   ,
 %     \c_other_cctab    ,
 %     \c_str_cctab
 %   }  
@@ -379,6 +403,7 @@
 %   The \texttt{other} and \texttt{string} ones are done by completely
 %   ignoring the existing codes as this makes life a lot less complex.
 %    \begin{macrocode}
+\cctab_new:N \c_initex_cctab
 \cctab_const:Nn \c_code_cctab { }
 \cctab_const:Nn \c_document_cctab
   {
diff --git a/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg b/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
index 1fb6365bd..d83682d85 100644
--- a/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
+++ b/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
@@ -5,6 +5,7 @@ Author: Joseph Wright
 Package: l3cctab ....-..-.. L3 Experimental category code tables
 \g__cctab_allocate_int=\count...
 \g__cctab_stack_int=\count...
+\c_initex_cctab=\catcodetable...
 \c_code_cctab=\catcodetable...
 \c_document_cctab=\catcodetable...
 \c_other_cctab=\catcodetable...





More information about the latex3-commits mailing list