[latex3-commits] [l3svn] 02/02: Make \str_fold_case:n and related f-type expandable

noreply at latex-project.org noreply at latex-project.org
Mon Mar 7 17:21:23 CET 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit 7f4b50a96122c67a3fc91a5d5aafedfaf1352294
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Mar 7 16:20:33 2016 +0000

    Make \str_fold_case:n and related f-type expandable
    
    This comes up in a few places, and we are unlikely to
    need case changing in tight loops so it should be OK.
---
 l3kernel/l3str.dtx                      |   41 ++++++++++++++++++++++---------
 l3kernel/testfiles/m3expl001.luatex.tlg |    6 ++---
 l3kernel/testfiles/m3expl001.ptex.tlg   |    3 +++
 l3kernel/testfiles/m3expl001.tlg        |    3 +++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    3 +++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    6 ++---
 l3kernel/testfiles/m3expl003.luatex.tlg |    6 ++---
 l3kernel/testfiles/m3expl003.ptex.tlg   |    3 +++
 l3kernel/testfiles/m3expl003.tlg        |    3 +++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    3 +++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    6 ++---
 11 files changed, 59 insertions(+), 24 deletions(-)

diff --git a/l3kernel/l3str.dtx b/l3kernel/l3str.dtx
index 93f80b6..914bdba 100644
--- a/l3kernel/l3str.dtx
+++ b/l3kernel/l3str.dtx
@@ -497,7 +497,7 @@
 %   \end{texnote}
 % \end{function}
 %
-% \begin{function}[rEXP, added = 2014-06-19, updated = 2015-09-04]
+% \begin{function}[EXP, added = 2014-06-19, updated = 2016-03-07]
 %   {\str_fold_case:n, \str_fold_case:V}
 %   \begin{syntax}
 %     \cs{str_fold_case:n} \Arg{tokens}
@@ -1397,6 +1397,9 @@
 %   }
 % \begin{macro}[aux, EXP]{\@@_change_case:nn}
 % \begin{macro}[aux, EXP]{\@@_change_case_aux:nn}
+% \begin{macro}[aux, EXP]{\@@_change_case_result:n}
+% \begin{macro}[aux, EXP]{\@@_change_case_output:nw, \@@_change_case_output:fw}
+% \begin{macro}[aux, EXP]{\@@_change_case_end:nw}
 % \begin{macro}[aux, EXP]{\@@_change_case_loop:nw}
 % \begin{macro}[aux, EXP]{\@@_change_case_space:n}
 % \begin{macro}[aux, EXP]{\@@_change_case_char:nN}
@@ -1421,7 +1424,12 @@
 \cs_new:Npn \@@_change_case_aux:nn #1#2
   {
     \@@_change_case_loop:nw {#2} #1 \q_recursion_tail \q_recursion_stop
+      \@@_change_case_result:n { }
   }
+\cs_new:Npn \@@_change_case_output:nw #1#2 \@@_change_case_result:n #3
+  { #2 \@@_change_case_result:n { #3 #1 } }
+\cs_generate_variant:Nn  \@@_change_case_output:nw { f }
+\cs_new:Npn \@@_change_case_end:wn #1 \@@_change_case_result:n #2 { #2 }
 \cs_new:Npn \@@_change_case_loop:nw #1#2 \q_recursion_stop
   {
     \tl_if_head_is_space:nTF {#2}
@@ -1432,16 +1440,20 @@
 \use:x
   { \cs_new:Npn \exp_not:N \@@_change_case_space:n ##1 \c_space_tl }
   {
-    \c_space_tl
+    \@@_change_case_output:nw { ~ }
     \@@_change_case_loop:nw {#1}
   }
 \cs_new:Npn \@@_change_case_char:nN #1#2
   {
-    \quark_if_recursion_tail_stop:N #2
+    \quark_if_recursion_tail_stop_do:Nn #2
+      { \@@_change_case_end:wn }
     \cs_if_exist:cTF { c__unicode_ #1 _ #2 _tl }
-      { \tl_to_str:c { c__unicode_ #1 _ #2 _tl } }
+      {
+        \@@_change_case_output:fw
+          { \tl_to_str:c { c__unicode_ #1 _ #2 _tl } }
+      }
       { \@@_change_case_char_aux:nN {#1} #2 }
-    \__str_change_case_loop:nw {#1}
+    \@@_change_case_loop:nw {#1}
   }
 %    \end{macrocode}
 %   For Unicode engines there's a look up to see if the current character
@@ -1453,18 +1465,20 @@
   {
     \cs_new:Npn \@@_change_case_char_aux:nN #1#2
       {
-        \int_compare:nNnTF { \use:c { @@_lookup_ #1 :N } #2 } = { 0 }
-          { #2 }
+        \int_compare:nNnTF { \use:c { __str_lookup_ #1 :N } #2 } = { 0 }
+          { \@@_change_case_output:nw {#2} }
           {
-            \utex_char:D \use:c { @@_lookup_ #1 :N } #2 ~
+            \@@_change_case_output:fw
+              { \utex_char:D \use:c { __str_lookup_ #1 :N } #2 ~ }
           }
       }
-    \cs_new_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 }
-    \cs_new_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 }
-    \cs_new_eq:NN \@@_lookup_fold:N \@@_lookup_lower:N
+    \cs_set_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 }
+    \cs_set_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 }
+    \cs_set_eq:NN \@@_lookup_fold:N \@@_lookup_lower:N
   }
   {
-    \cs_new:Npn \@@_change_case_char_aux:nN #1#2 { #2 }
+    \cs_new:Npn \@@_change_case_char_aux:nN #1#2
+      { \@@_change_case_output:nw {#2} }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1474,6 +1488,9 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{variable}
 %   {
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index a37b5f0..3bdb50a 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -764,13 +764,13 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
 Defining \__str_change_case_char_aux:nN on line ...
-Defining \__str_lookup_lower:N on line ...
-Defining \__str_lookup_upper:N on line ...
-Defining \__str_lookup_fold:N on line ...
 Defining \c_ampersand_str on line ...
 Defining \c_atsign_str on line ...
 Defining \c_backslash_str on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 4307c18..6fdd043 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index d2009df..29357cf 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 8ba87ae..1d528f0 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index a6e048c..adcb23f 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -762,13 +762,13 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
 Defining \__str_change_case_char_aux:nN on line ...
-Defining \__str_lookup_lower:N on line ...
-Defining \__str_lookup_upper:N on line ...
-Defining \__str_lookup_fold:N on line ...
 Defining \c_ampersand_str on line ...
 Defining \c_atsign_str on line ...
 Defining \c_backslash_str on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 2478f49..725c18f 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -764,13 +764,13 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
 Defining \__str_change_case_char_aux:nN on line ...
-Defining \__str_lookup_lower:N on line ...
-Defining \__str_lookup_upper:N on line ...
-Defining \__str_lookup_fold:N on line ...
 Defining \c_ampersand_str on line ...
 Defining \c_atsign_str on line ...
 Defining \c_backslash_str on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 2f29cd1..ba0d495 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 394142f..85476a0 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 2a41f3a..8b81736 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -762,6 +762,9 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 10279c8..8a398f8 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -762,13 +762,13 @@ Defining \str_lower_case:f on line ...
 Defining \str_upper_case:f on line ...
 Defining \__str_change_case:nn on line ...
 Defining \__str_change_case_aux:nn on line ...
+Defining \__str_change_case_output:nw on line ...
+Defining \__str_change_case_output:fw on line ...
+Defining \__str_change_case_end:wn on line ...
 Defining \__str_change_case_loop:nw on line ...
 Defining \__str_change_case_space:n on line ...
 Defining \__str_change_case_char:nN on line ...
 Defining \__str_change_case_char_aux:nN on line ...
-Defining \__str_lookup_lower:N on line ...
-Defining \__str_lookup_upper:N on line ...
-Defining \__str_lookup_fold:N on line ...
 Defining \c_ampersand_str on line ...
 Defining \c_atsign_str on line ...
 Defining \c_backslash_str on line ...

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list