[latex3-commits] [git/LaTeX3-latex3-latex3] main: Use cctab to fix catcodes when loading l3str-convert files (be10cbe69)

Bruno Le Floch blflatex at gmail.com
Fri May 14 01:31:03 CEST 2021


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/be10cbe69119305065a3d6ff6018f6ebb39507a0

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

commit be10cbe69119305065a3d6ff6018f6ebb39507a0
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Fri May 14 00:46:59 2021 +0200

    Use cctab to fix catcodes when loading l3str-convert files
    
    I dare not do the same for l3backend files (see #717) but it seems
    like one just needs to change how \__kernel_sys_configuration_load:n
    is defined: use \cctab_begin:N \c_document_cctab ... \cctab_end:
    instead of  \ExplSyntaxOff ... \ExplSyntaxOn.  Alternatively we
    could try basing \ExplSyntaxOn/Off on cctab, with extra handling of
    the @ character.


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

be10cbe69119305065a3d6ff6018f6ebb39507a0
 l3kernel/l3str-convert.dtx                         | 28 +---------------------
 l3kernel/testfiles/m3str-convert002.luatex.tlg     |  1 +
 ...-convert004.tlg => m3str-convert004.luatex.tlg} |  1 +
 l3kernel/testfiles/m3str-convert004.lvt            |  2 +-
 ...-convert006.tlg => m3str-convert006.luatex.tlg} |  1 +
 5 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/l3kernel/l3str-convert.dtx b/l3kernel/l3str-convert.dtx
index c9ce040ee..4a84cb821 100644
--- a/l3kernel/l3str-convert.dtx
+++ b/l3kernel/l3str-convert.dtx
@@ -824,7 +824,7 @@
             \file_if_exist:nTF { l3str-#2- \l_@@_internal_tl .def }
               {
                 \group_begin:
-                  \@@_load_catcodes:
+                  \cctab_select:N \c_code_cctab
                   \file_input:n { l3str-#2- \l_@@_internal_tl .def }
                 \group_end:
               }
@@ -880,32 +880,6 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\@@_load_catcodes:}
-%   Since encoding files may be loaded at arbitrary places in a \TeX{}
-%   document, including within verbatim mode, we set the catcodes of all
-%   characters appearing in any encoding definition file.
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_load_catcodes:
-  {
-    \char_set_catcode_escape:N \\
-    \char_set_catcode_group_begin:N \{
-    \char_set_catcode_group_end:N \}
-    \char_set_catcode_math_toggle:N \$
-    \char_set_catcode_alignment:N \&
-    \char_set_catcode_parameter:N \#
-    \char_set_catcode_math_superscript:N \^
-    \char_set_catcode_ignore:N \ %
-    \char_set_catcode_space:N \~
-    \tl_map_function:nN { abcdefghijklmnopqrstuvwxyz_:ABCDEFILNPSTUX }
-      \char_set_catcode_letter:N
-    \tl_map_function:nN { 0123456789"'?*+-.(),`!/<>[];= }
-      \char_set_catcode_other:N
-    \char_set_catcode_comment:N \%
-    \int_set:Nn \tex_endlinechar:D {32}
-  }
-%    \end{macrocode}
-% \end{macro}
-%
 % \subsubsection{Byte unescape and escape}
 %
 % Strings of bytes may need to be stored in auxiliary files in safe
diff --git a/l3kernel/testfiles/m3str-convert002.luatex.tlg b/l3kernel/testfiles/m3str-convert002.luatex.tlg
index c1cfa2766..6eb36a091 100644
--- a/l3kernel/testfiles/m3str-convert002.luatex.tlg
+++ b/l3kernel/testfiles/m3str-convert002.luatex.tlg
@@ -4,6 +4,7 @@ Author: Bruno Le Floch
 ============================================================
 TEST 1: Escaping hex
 ============================================================
+\g__cctab_internaliii_cctab=\catcodetable...
 (l3str-enc-iso88591.def)
 000102030405060708090A0B0C0D0E0F
 TRUE
diff --git a/l3kernel/testfiles/m3str-convert004.tlg b/l3kernel/testfiles/m3str-convert004.luatex.tlg
similarity index 98%
copy from l3kernel/testfiles/m3str-convert004.tlg
copy to l3kernel/testfiles/m3str-convert004.luatex.tlg
index 136f3063d..d009ce3c7 100644
--- a/l3kernel/testfiles/m3str-convert004.tlg
+++ b/l3kernel/testfiles/m3str-convert004.luatex.tlg
@@ -4,6 +4,7 @@ Author: Bruno Le Floch
 ============================================================
 TEST 1: Load all definition files
 ============================================================
+\g__cctab_internalii_cctab=\catcodetable...
 (l3str-enc-iso88591.def
 Defining \__str_convert_decode_iso88591: on line ...
 Defining \__str_convert_encode_iso88591: on line ...
diff --git a/l3kernel/testfiles/m3str-convert004.lvt b/l3kernel/testfiles/m3str-convert004.lvt
index fdc18e627..0d221c949 100644
--- a/l3kernel/testfiles/m3str-convert004.lvt
+++ b/l3kernel/testfiles/m3str-convert004.lvt
@@ -22,7 +22,7 @@
     \group_begin:
       \int_step_inline:nnnn { 0 } { 1 } { 255 }
         { \char_set_catcode_invalid:n {#1} }
-      \__str_load_catcodes:
+      \cctab_select:N \c_code_cctab
       \clist_map_inline:nn
         {
           iso 8859 1 , iso 8859 2 , iso 8859 3 , iso 8859 4 , iso 8859 5 ,
diff --git a/l3kernel/testfiles/m3str-convert006.tlg b/l3kernel/testfiles/m3str-convert006.luatex.tlg
similarity index 99%
copy from l3kernel/testfiles/m3str-convert006.tlg
copy to l3kernel/testfiles/m3str-convert006.luatex.tlg
index a9180edb9..5d5fde383 100644
--- a/l3kernel/testfiles/m3str-convert006.tlg
+++ b/l3kernel/testfiles/m3str-convert006.luatex.tlg
@@ -4,6 +4,7 @@ Author: Bruno Le Floch
 ============================================================
 TEST 1: Complete 8-bit encodings
 ============================================================
+\g__cctab_internaliii_cctab=\catcodetable...
 (l3str-enc-iso88591.def)
 TRUE
 TRUE





More information about the latex3-commits mailing list.