[latex3-commits] [git/LaTeX3-latex3-latex3] master: Track cctabs by number (fixes #496) (349a980)

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Nov 3 00:27:05 CET 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/349a9809aec8cde22976bd4d22df7472daf2890f

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

commit 349a9809aec8cde22976bd4d22df7472daf2890f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Nov 2 23:27:05 2018 +0000

    Track cctabs by number (fixes #496)
    
    This is needed as we can't have a constant intarray ....


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

349a9809aec8cde22976bd4d22df7472daf2890f
 l3experimental/l3cctab/l3cctab.dtx |   41 ++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/l3experimental/l3cctab/l3cctab.dtx b/l3experimental/l3cctab/l3cctab.dtx
index 7f829b5..07a1446 100644
--- a/l3experimental/l3cctab/l3cctab.dtx
+++ b/l3experimental/l3cctab/l3cctab.dtx
@@ -160,10 +160,8 @@
 %   tables need to be followed. There is also a sequence stack for the
 %   dynamic tables themselves.
 %    \begin{macrocode}
-%<*initex>
 \int_new:N  \g_@@_allocate_int
 \int_gset:Nn \g_@@_allocate_int { -1 }
-%</initex>
 \int_new:N \g_@@_stack_int
 \seq_new:N \g_@@_stack_seq
 %    \end{macrocode}
@@ -267,21 +265,29 @@
 %    \begin{macrocode}
   {
     \cs_new_protected:Npn \@@_gstore:Nnn #1#2#3
-      { \intarray_gset:Nnn #1 { #2 + 1 } {#3} }
+      {
+        \intarray_gset:cnn
+          { g_@@_ \int_use:N #1 _cctab } { #2 + 1 } {#3}
+      }
 %    \end{macrocode}
 %   Following the \LuaTeX{} pattern, a new table starts with \IniTeX{} codes.
 %    \begin{macrocode}
     \cs_new_protected:Npn \cctab_new:N #1
       {
-        \intarray_new:Nn #1 { 256 }
+        \int_gadd:Nn \g_@@_allocate_int { 1 }
+        \int_const:Nn #1 { \g_@@_allocate_int }
+        \intarray_new:cn { g_@@_ \int_use:N #1 _cctab } { 256 }
         \int_step_inline:nn { 256 }
-          { \intarray_gset:Nnn #1 {##1} { 12 } }
+          {
+            \intarray_gset:cnn
+              { g_@@_ \int_use:N #1 _cctab } {##1} { 12 }
+          }
         \@@_gstore:Nnn #1 { 0 } { 9 }
         \@@_gstore:Nnn #1 { 13 } { 5 }
         \@@_gstore:Nnn #1 { 32 } { 10 }
         \@@_gstore:Nnn #1 { 37 } { 14 }
-        \int_step_inline:nnn { 65 } { 90 }
-          { \intarray_gset:Nnn #1 {##1} { 11 } }
+        \int_step_inline:nnn { 64 } { 89 }
+          { \@@_gstore:Nnn #1 {##1} { 11 } }
         \@@_gstore:Nnn #1 { 92 } { 0 }
         \int_step_inline:nnn { 97 } { 122 }
           { \@@_gstore:Nnn #1 {##1} { 11 } }
@@ -308,7 +314,10 @@
         \int_step_inline:nn { 256 }
           {
             \char_set_catcode:nn { ##1 - 1 }
-              { \intarray_item:Nn #1 {##1} }
+              {
+                \intarray_item:cn
+                  { g_@@_ \int_use:N #1 _cctab } {##1}
+              }
           }
       }
     \cs_generate_variant:Nn \intarray_new:Nn { c }
@@ -333,7 +342,7 @@
           #2
           \int_step_inline:nn { 256 }
             {
-              \intarray_gset:Nnn #1 {##1}
+              \intarray_gset:cnn { g_@@_ \int_use:N #1 _cctab } {##1}
                 { \char_value_catcode:n { ##1 - 1 } }
             }
         \group_end:
@@ -345,27 +354,19 @@
 % \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
+    \cctab_new:N #1
+    \cctab_gset:Nn #1 {#2}
   }
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{variable}
 %   {
+%     \c_initex_cctab   ,
 %     \c_code_cctab     ,
 %     \c_document_cctab ,
 %     \c_initex_cctab   ,





More information about the latex3-commits mailing list