[latex3-commits] [git/LaTeX3-latex3-latex3] master: \cctab_const:Nn (see #470) (38c0c94)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Oct 2 08:55:11 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/38c0c945b50d8b302d5b8fd93b4dfe597029efdc

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

commit 38c0c945b50d8b302d5b8fd93b4dfe597029efdc
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Oct 2 07:55:11 2018 +0100

    \cctab_const:Nn (see #470)


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

38c0c945b50d8b302d5b8fd93b4dfe597029efdc
 l3experimental/l3cctab/l3cctab.dtx                 |   40 ++++++++++++++++----
 .../l3cctab/testfiles/m3cctab000.luatex.tlg        |    2 +-
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/l3experimental/l3cctab/l3cctab.dtx b/l3experimental/l3cctab/l3cctab.dtx
index 46f5331..64ae7e2 100644
--- a/l3experimental/l3cctab/l3cctab.dtx
+++ b/l3experimental/l3cctab/l3cctab.dtx
@@ -65,6 +65,15 @@
 %   used by \IniTeX{}.
 % \end{function}
 %
+% \begin{function}{\cctab_const:Nn}
+%   \begin{syntax}
+%     \cs{cctab_const:Nn} \meta{category code table} \Arg{category code set up}
+%   \end{syntax}
+%   Creates a new category code table and applies the
+%   \meta{category code set up} on top of prevailing settings, then saves
+%   as a constant table.
+% \end{function}
+%
 % \begin{function}{\cctab_gset:Nn}
 %   \begin{syntax}
 %     \cs{cctab_gset:Nn} \meta{category code table} \Arg{category code set up}
@@ -349,6 +358,25 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{variable}{\g_@@_tmp_cctab}
+%   Scratch space.
+%    \begin{macrocode}
+\cctab_new:N \g_@@_tmp_cctab
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\cctab_const:Nn}
+%   Creating constant tables is a bit tricky: we do it in a two part
+%   fashion via a temporary one.
+%    \begin{macrocode}
+\cs_new_protected:Npn \cctab_const:Nn #1#2
+  {
+    \cctab_gset:Nn \g_@@_tmp_cctab {#2}
+    \cs_new_eq:NN #1 \g_@@_tmp_cctab
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{variable}
 %   {
 %     \c_code_cctab     ,
@@ -361,12 +389,8 @@
 %   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_code_cctab
-\cctab_new:N \c_document_cctab
-\cctab_new:N \c_other_cctab
-\cctab_new:N \c_str_cctab
-\cctab_gset:Nn \c_code_cctab { }
-\cctab_gset:Nn \c_document_cctab
+\cctab_const:Nn \c_code_cctab { }
+\cctab_const:Nn \c_document_cctab
   {
     \char_set_catcode_space:n          { 9 }
     \char_set_catcode_space:n          { 32 }
@@ -374,12 +398,12 @@
     \char_set_catcode_math_subscript:n { 95 }
     \char_set_catcode_active:n         { 126 }
   }
-\cctab_gset:Nn \c_other_cctab
+\cctab_const:Nn \c_other_cctab
   {
     \int_step_inline:nnn { 0 } { 127 }
       { \char_set_catcode_other:n {#1} }
   }
-\cctab_gset:Nn \c_str_cctab
+\cctab_const:Nn \c_str_cctab
   {
     \int_step_inline:nnn { 0 } { 127 }
       { \char_set_catcode_other:n {#1} }
diff --git a/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg b/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
index 2b6fc4d..852132a 100644
--- a/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
+++ b/l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
@@ -4,5 +4,5 @@ Author: Joseph Wright
 (l3cctab.sty
 Package: l3cctab ....-..-.. L3 Experimental category code tables
 \g__cctab_stack_int=\count...
-\c_code_cctab=\catcodetable...
+\g__cctab_tmp_cctab=\catcodetable...
 )





More information about the latex3-commits mailing list