[latex3-commits] [git/LaTeX3-latex3-latex3] unicode-data: Make codepoint-to-bytes kernel-only (089f75b84)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Nov 8 14:56:21 CET 2022


Repository : https://github.com/latex3/latex3
On branch  : unicode-data
Link       : https://github.com/latex3/latex3/commit/089f75b841c0606a4ec45e271cea87d7d0c5d437

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

commit 089f75b841c0606a4ec45e271cea87d7d0c5d437
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Nov 8 13:56:21 2022 +0000

    Make codepoint-to-bytes kernel-only
    
    We need this in a few places, but have agreed not
    to provide more widely.


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

089f75b841c0606a4ec45e271cea87d7d0c5d437
 l3kernel/CHANGELOG.md                      |  1 -
 l3kernel/l3deprecation.dtx                 |  4 ++--
 l3kernel/l3kernel-functions.dtx            | 12 ++++++++++++
 l3kernel/l3str-convert.dtx                 |  2 +-
 l3kernel/l3text-purify.dtx                 |  4 ++--
 l3kernel/l3unicode.dtx                     | 20 ++++----------------
 l3kernel/testfiles/m3text006.lvt           |  2 +-
 l3kernel/testfiles/m3unicode001.luatex.tlg | 12 +-----------
 l3kernel/testfiles/m3unicode001.lvt        |  9 ---------
 l3kernel/testfiles/m3unicode001.tlg        | 12 +-----------
 l3kernel/testfiles/m3unicode001.xetex.tlg  | 12 +-----------
 11 files changed, 25 insertions(+), 65 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 7f2787c67..68d2b56bc 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -8,7 +8,6 @@ this project uses date-based 'snapshot' version identifiers.
 ## [Unreleased]
 
 ### Added
-- `\codepoint_to_bytes:n`
 - `\codepoint_to_nfd:n`
 - `\codepoint_generate:n` and `\codepoint_str_generate:n`
 - `\str_casefold:n`
diff --git a/l3kernel/l3deprecation.dtx b/l3kernel/l3deprecation.dtx
index d0a022d40..5568206cb 100644
--- a/l3kernel/l3deprecation.dtx
+++ b/l3kernel/l3deprecation.dtx
@@ -561,8 +561,8 @@
 %
 % \begin{macro}[EXP]{\char_to_utfviii_bytes:n}
 %    \begin{macrocode}
-\__kernel_patch_deprecation:nnNNpn { 2022-10-09 } { \codepoint_to_bytes:n }
-\cs_gset:Npn \char_to_utfviii_bytes:n { \codepoint_to_bytes:n }
+\__kernel_patch_deprecation:nnNNpn { 2022-10-09 } { [ \codepoint_generate:n ] }
+\cs_gset:Npn \char_to_utfviii_bytes:n { \__kernel_codepoint_to_bytes:n }
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/l3kernel/l3kernel-functions.dtx b/l3kernel/l3kernel-functions.dtx
index 384280cdd..9330579a2 100644
--- a/l3kernel/l3kernel-functions.dtx
+++ b/l3kernel/l3kernel-functions.dtx
@@ -105,6 +105,18 @@
 %   all of these tests succeed then the \meta{true code} is run.
 % \end{function}
 %
+% \begin{function}[EXP]{\__kernel_codepoint_to_bytes:n}
+%   \begin{syntax}
+%     \cs{__kernel_codepoint_to_bytes:n} \Arg{codepoint}
+%   \end{syntax}
+%   Converts the \meta{codepoint} to UTF-8 bytes. The expansion
+%   of this function comprises four brace groups, each of which will contain
+%   a hexadecimal value: the appropriate byte. As UTF-8 is a variable-length,
+%   one or more of the groups may be empty: the bytes read in the logical order,
+%   such that a two-byte codepoint will have groups |#1| and |#2| filled
+%   and |#3| and |#4| empty.
+% \end{function}
+%
 % \begin{function}{\__kernel_cs_parm_from_arg_count:nnF}
 %   \begin{syntax}
 %     \cs{__kernel_cs_parm_from_arg_count:nnF} \Arg{follow-on} \Arg{args} \Arg{false code}
diff --git a/l3kernel/l3str-convert.dtx b/l3kernel/l3str-convert.dtx
index 3b5df6dda..9ca53176e 100644
--- a/l3kernel/l3str-convert.dtx
+++ b/l3kernel/l3str-convert.dtx
@@ -2635,7 +2635,7 @@
     \cs_new:Npn \@@_convert_pdfname_bytes:n #1
       {
         \exp_args:Ne \@@_convert_pdfname_bytes_aux:n
-          { \codepoint_to_bytes:n {`#1} }
+          { \__kernel_codepoint_to_bytes:n {`#1} }
       }
     \cs_new:Npn \@@_convert_pdfname_bytes_aux:n #1
       { \@@_convert_pdfname_bytes_aux:nnnn #1 }
diff --git a/l3kernel/l3text-purify.dtx b/l3kernel/l3text-purify.dtx
index dcec40bca..2a6fc7b47 100644
--- a/l3kernel/l3text-purify.dtx
+++ b/l3kernel/l3text-purify.dtx
@@ -486,7 +486,7 @@
         \text_declare_purify_equivalent:Nx #1
           {
             \exp_args:Ne \@@_tmp:n
-              { \codepoint_to_bytes:n { "#2 } }
+              { \__kernel_codepoint_to_bytes:n { "#2 } }
           }
         \@@_loop:Nn
       }
@@ -574,7 +574,7 @@
       \cs_set:Npn \@@_tmp:n #1
         {
           \exp_args:Ne \@@_tmp_aux:n
-            { \codepoint_to_bytes:n { "#1 } }
+            { \__kernel_codepoint_to_bytes:n { "#1 } }
         }
       \cs_set:Npn \@@_tmp_aux:n #1 { \@@_tmp:nnnn #1 }
       \cs_set:Npn \@@_tmp:nnnn #1#2#3#4
diff --git a/l3kernel/l3unicode.dtx b/l3kernel/l3unicode.dtx
index 5c00be01a..a724fa47d 100644
--- a/l3kernel/l3unicode.dtx
+++ b/l3kernel/l3unicode.dtx
@@ -99,18 +99,6 @@
 %   category code $10$.
 % \end{function}
 %
-% \begin{function}[added = 2022-10-09, EXP]{\codepoint_to_bytes:n}
-%   \begin{syntax}
-%     \cs{codepoint_to_bytes:n} \Arg{codepoint}
-%   \end{syntax}
-%   Converts the \meta{codepoint} to UTF-8 bytes. The expansion
-%   of this function comprises four brace groups, each of which will contain
-%   a hexadecimal value: the appropriate byte. As UTF-8 is a variable-length,
-%   one or more of the groups may be empty: the bytes read in the logical order,
-%   such that a two-byte codepoint will have groups |#1| and |#2| filled
-%   and |#3| and |#4| empty.
-% \end{function}
-%
 % \begin{function}[added = 2022-10-09, EXP]{\codepoint_to_nfd:n}
 %   \begin{syntax}
 %     \cs{codepoint_to_nfd:n} \Arg{codepoint}
@@ -180,7 +168,7 @@
             \use:e
               {
                 \exp_not:N \@@_str_generate:nnnn
-                  \codepoint_to_bytes:n {#1}
+                  \__kernel_codepoint_to_bytes:n {#1}
               }
           }
       }
@@ -208,7 +196,7 @@
                 \use:e
                   {
                     \exp_not:N \@@_generate:nnnn
-                      \codepoint_to_bytes:n {#1}
+                      \__kernel_codepoint_to_bytes:n {#1}
                   }
               }
               {
@@ -247,7 +235,7 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\codepoint_to_bytes:n}
+% \begin{macro}[EXP]{\__kernel_codepoint_to_bytes:n}
 % \begin{macro}[EXP]{\@@_to_bytes_auxi:n}
 % \begin{macro}[EXP]{\@@_to_bytes_auxii:Nnn}
 % \begin{macro}[EXP]{\@@_to_bytes_auxiii:n}
@@ -265,7 +253,7 @@
 %   In terms of the algorithm itself, see
 %   \url{https://en.wikipedia.org/wiki/UTF-8} for the octet pattern.
 %    \begin{macrocode}
-\cs_new:Npn \codepoint_to_bytes:n #1
+\cs_new:Npn \__kernel_codepoint_to_bytes:n #1
   {
     \exp_args:Nf \@@_to_bytes_auxi:n
       { \int_eval:n {#1} }
diff --git a/l3kernel/testfiles/m3text006.lvt b/l3kernel/testfiles/m3text006.lvt
index 41d2a8aa7..6760eb808 100644
--- a/l3kernel/testfiles/m3text006.lvt
+++ b/l3kernel/testfiles/m3text006.lvt
@@ -129,7 +129,7 @@
           {
             \exp_args:Ne \test_generate_aux:n
               {
-                \exp_args:Ne \codepoint_to_bytes:n
+                \exp_args:Ne \__kernel_codepoint_to_bytes:n
                   { " \tl_trim_spaces:n {#1} }
               }
           }
diff --git a/l3kernel/testfiles/m3unicode001.luatex.tlg b/l3kernel/testfiles/m3unicode001.luatex.tlg
index ace132b9a..539023027 100644
--- a/l3kernel/testfiles/m3unicode001.luatex.tlg
+++ b/l3kernel/testfiles/m3unicode001.luatex.tlg
@@ -22,17 +22,7 @@ X X
 XaX
 ============================================================
 ============================================================
-TEST 3: Byte decomposition
-============================================================
-{65}{}{}{}
-{195}{142}{}{}
-{206}{137}{}{}
-{225}{182}{173}{}
-{239}{191}{189}{}
-{240}{144}{128}{128}
-============================================================
-============================================================
-TEST 4: Character decomposition
+TEST 3: Character decomposition
 ============================================================
 A
 Î
diff --git a/l3kernel/testfiles/m3unicode001.lvt b/l3kernel/testfiles/m3unicode001.lvt
index 931cf2063..7a5ff1a6b 100644
--- a/l3kernel/testfiles/m3unicode001.lvt
+++ b/l3kernel/testfiles/m3unicode001.lvt
@@ -42,15 +42,6 @@
     X \codepoint_generate:nn { 97 } { 10 } X \NEWLINE
   }
 
-\TESTEXP { Byte~decomposition }
-  {
-    \codepoint_to_bytes:n { `A } \NEWLINE
-    \codepoint_to_bytes:n { "00CE } \NEWLINE
-    \codepoint_to_bytes:n { "0389 } \NEWLINE
-    \codepoint_to_bytes:n { "1DAD } \NEWLINE
-    \codepoint_to_bytes:n { "FFFD } \NEWLINE
-    \codepoint_to_bytes:n { "10000 }
-  }
 
 \TESTEXP { Character~decomposition }
   {
diff --git a/l3kernel/testfiles/m3unicode001.tlg b/l3kernel/testfiles/m3unicode001.tlg
index 3c38d26ef..cb4249d1f 100644
--- a/l3kernel/testfiles/m3unicode001.tlg
+++ b/l3kernel/testfiles/m3unicode001.tlg
@@ -22,17 +22,7 @@ X X
 XaX
 ============================================================
 ============================================================
-TEST 3: Byte decomposition
-============================================================
-{65}{}{}{}
-{195}{142}{}{}
-{206}{137}{}{}
-{225}{182}{173}{}
-{239}{191}{189}{}
-{240}{144}{128}{128}
-============================================================
-============================================================
-TEST 4: Character decomposition
+TEST 3: Character decomposition
 ============================================================
 A
 I^^cc^^82
diff --git a/l3kernel/testfiles/m3unicode001.xetex.tlg b/l3kernel/testfiles/m3unicode001.xetex.tlg
index ace132b9a..539023027 100644
--- a/l3kernel/testfiles/m3unicode001.xetex.tlg
+++ b/l3kernel/testfiles/m3unicode001.xetex.tlg
@@ -22,17 +22,7 @@ X X
 XaX
 ============================================================
 ============================================================
-TEST 3: Byte decomposition
-============================================================
-{65}{}{}{}
-{195}{142}{}{}
-{206}{137}{}{}
-{225}{182}{173}{}
-{239}{191}{189}{}
-{240}{144}{128}{128}
-============================================================
-============================================================
-TEST 4: Character decomposition
+TEST 3: Character decomposition
 ============================================================
 A
 Î





More information about the latex3-commits mailing list.