[latex3-commits] [l3svn] branch master updated: Remove avoidable use of \tex_lowercase:D

noreply at latex-project.org noreply at latex-project.org
Fri Aug 28 11:11:43 CEST 2015


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

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  9cdf5d6   Remove avoidable use of \tex_lowercase:D
9cdf5d6 is described below

commit 9cdf5d61e6c65a7e782f5a85cf22bc9828641556
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Aug 28 10:06:29 2015 +0100

    Remove avoidable use of \tex_lowercase:D
    
    In anticipation of addressing the status of \tl_to_lowercase:n,
    the first stage is to tidy up internal use of case changing. Here,
    places where an alternative for use of the 'raw' primitive are
    addressed. (One use is left in l3str-format-new.dtx but relates to
    \fp_to_scientific:n, which itself needs adjustment for other reasons.)
    
    The use of \tl_to_lowercase:n and provision of new interfaces for
    generating 'odd' characters is outstanding. Note there is one change
    from \tex_lowercase:D to \tl_to_lowercase:n here which will later
    change again.
    
    Note that there are no uses of \tex_uppercase:D in the code base.
---
 l3kernel/l3basics.dtx       |   37 ++++++++---------
 l3kernel/l3expan.dtx        |   97 +++++++++++++++++++++----------------------
 l3kernel/l3unicode-data.dtx |    9 ++--
 l3trial/xfont/xfss.dtx      |   14 +++----
 4 files changed, 75 insertions(+), 82 deletions(-)

diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index 95d382d..4911470 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -2142,9 +2142,9 @@
 %   for the boolean.  For example,
 %   |\__cs_split_function:NN \foo_bar:cnx \use_i:nnn| as input
 %   becomes |\use_i:nnn {foo_bar} {cnx} \c_true_bool|.
-%
-%   We can't use a literal |:| because it has the wrong catcode here, so
-%   it's transformed from |@| with \cs{tex_lowercase:D}.
+%   
+%   We cannot use |:| directly as it has the wrong category code so
+%   an |x|-type expansion is used to force the conversion.
 %
 %   First ensure that we actually get a properly evaluated string by
 %   expanding \cs{cs_to_str:N} twice.  If the function contained a
@@ -2157,25 +2157,22 @@
 %   auxiliary trims the trailing \cs{q_mark} from the function name if
 %   present (that is, if the original function had no colon).
 %    \begin{macrocode}
-\group_begin:
-\tex_lccode:D  `\@ = `\: \scan_stop:
-\tex_catcode:D `\@ = 12 ~
-\tex_lowercase:D
+\cs_set:Npx \__cs_split_function:NN #1
   {
-    \group_end:
-    \cs_set:Npn \__cs_split_function:NN #1
-      {
-        \exp_after:wN \exp_after:wN
-        \exp_after:wN \__cs_split_function_auxi:w
-          \cs_to_str:N #1 \q_mark \c_true_bool
-          @ \q_mark \c_false_bool
-          \q_stop
-      }
-    \cs_set:Npn \__cs_split_function_auxi:w #1 @ #2 \q_mark #3#4 \q_stop #5
-      { \__cs_split_function_auxii:w #5 #1 \q_mark \q_stop {#2} #3 }
-    \cs_set:Npn \__cs_split_function_auxii:w #1#2 \q_mark #3 \q_stop
-      { #1 {#2} }
+    \exp_not:N \exp_after:wN \exp_not:N \exp_after:wN
+    \exp_not:N \exp_after:wN \exp_not:N \__cs_split_function_auxi:w
+      \exp_not:N \cs_to_str:N #1 \exp_not:N \q_mark \c_true_bool
+      \token_to_str:N : \exp_not:N \q_mark \c_false_bool
+      \exp_not:N \q_stop
+  }
+\use:x
+  {
+    \cs_set:Npn \exp_not:N \__cs_split_function_auxi:w
+      ##1 \token_to_str:N : ##2 \exp_not:N \q_mark ##3##4 \exp_not:N \q_stop ##5
   }
+  { \__cs_split_function_auxii:w #5 #1 \q_mark \q_stop {#2} #3 }
+\cs_set:Npn \__cs_split_function_auxii:w #1#2 \q_mark #3 \q_stop
+  { #1 {#2} }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx
index bb09d4e..5aa79e4 100644
--- a/l3kernel/l3expan.dtx
+++ b/l3kernel/l3expan.dtx
@@ -1529,35 +1529,34 @@
 %   auxiliary, and |#3| is \cs{cs_new_protected_nopar:Npx}, otherwise it
 %   is \cs{cs_new_nopar:Npx}.
 %    \begin{macrocode}
-\group_begin:
-  \tex_catcode:D `\M = 12 \scan_stop:
-  \tex_catcode:D `\A = 12 \scan_stop:
-  \tex_catcode:D `\P = 12 \scan_stop:
-  \tex_catcode:D `\R = 12 \scan_stop:
-\tex_lowercase:D
+\cs_new_protected:Npx \@@_generate_variant:N #1
   {
-    \group_end:
-    \cs_new_protected:Npn \@@_generate_variant:N #1
-      {
-        \exp_after:wN \if_meaning:w \exp_not:N #1 #1
-          \cs_set_eq:NN \@@_tmp:w \cs_new_protected_nopar:Npx
-        \else:
-          \exp_after:wN \@@_generate_variant:ww
-            \token_to_meaning:N #1 MA \q_mark
-            \q_mark \cs_new_protected_nopar:Npx
-            PR
-            \q_mark \cs_new_nopar:Npx
-            \q_stop
-        \fi:
-      }
-    \cs_new_protected:Npn \@@_generate_variant:ww #1 MA #2 \q_mark
-      { \@@_generate_variant:wwNw #1 }
-    \cs_new_protected:Npn \@@_generate_variant:wwNw
-        #1 PR #2 \q_mark #3 #4 \q_stop
-      {
-        \cs_set_eq:NN \@@_tmp:w #3
-      }
+    \exp_not:N \exp_after:wN \exp_not:N \if_meaning:w
+      \exp_not:N \exp_not:N #1 #1
+      \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected_nopar:Npx
+    \exp_not:N \else:
+      \exp_not:N \exp_after:wN \exp_not:N \@@_generate_variant:ww
+        \exp_not:N \token_to_meaning:N #1 \tl_to_str:n { ma }
+          \exp_not:N \q_mark
+        \exp_not:N \q_mark \cs_new_protected_nopar:Npx
+        \tl_to_str:n { pr }
+        \exp_not:N \q_mark \cs_new_nopar:Npx
+        \exp_not:N \q_stop
+    \exp_not:N \fi:
+  }
+\use:x
+  {
+    \cs_new_protected:Npn \exp_not:N \@@_generate_variant:ww
+      ##1 \tl_to_str:n { ma } ##2 \exp_not:N \q_mark
+  }
+  { \@@_generate_variant:wwNw #1 }
+\use:x
+  {
+    \cs_new_protected:Npn \exp_not:N \@@_generate_variant:wwNw
+      ##1 \tl_to_str:n { pr } ##2 \exp_not:N \q_mark
+      ##3 ##4 \exp_not:N \q_stop
   }
+  { \cs_set_eq:NN \@@_tmp:w #3 }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1836,32 +1835,32 @@
 %   protected, and the next variant to be defined using that internal
 %   variant should be protected.
 %    \begin{macrocode}
-\group_begin:
-  \tex_catcode:D `\X = 12 \scan_stop:
-  \tex_lccode:D `\N = `\N \scan_stop:
-\tex_lowercase:D
+\cs_new_protected:Npx \@@_generate_internal_variant:n #1
   {
-    \group_end:
-    \cs_new_protected:Npn \@@_generate_internal_variant:n #1
-      {
-        \@@_generate_internal_variant:wwnNwnn
-          #1 \q_mark
-            { \cs_set_eq:NN \@@_tmp:w \cs_new_protected_nopar:Npx }
-            \cs_new_protected_nopar:cpx
-          X \q_mark
-            { }
-            \cs_new_nopar:cpx
-        \q_stop
-          { exp_args:N #1 }
-          { \@@_generate_internal_variant_loop:n #1 { : \use_i:nn } }
-      }
-    \cs_new_protected:Npn \@@_generate_internal_variant:wwnNwnn
-        #1 X #2 \q_mark #3 #4 #5 \q_stop #6 #7
+    \exp_not:N \@@_generate_internal_variant:wwnNwnn
+      #1 \exp_not:N \q_mark
+        { \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected_nopar:Npx }
+        \cs_new_protected_nopar:cpx
+      \token_to_str:N x \exp_not:N \q_mark
+        { }
+        \cs_new_nopar:cpx
+    \exp_not:N \q_stop
+      { exp_args:N #1 }
       {
-        #3
-        \cs_if_free:cT {#6} { #4 {#6} {#7} }
+        \exp_not:N \@@_generate_internal_variant_loop:n #1
+          { : \exp_not:N \use_i:nn }
       }
   }
+\use:x
+  {
+    \cs_new_protected:Npn \exp_not:N \@@_generate_internal_variant:wwnNwnn
+        ##1 \token_to_str:N x ##2 \exp_not:N \q_mark
+        ##3 ##4 ##5 \exp_not:N \q_stop ##6 ##7
+  }
+  {
+    #3
+    \cs_if_free:cT {#6} { #4 {#6} {#7} }
+  }
 %    \end{macrocode}
 %   This command grabs char by char outputting |\::#1| (not expanded
 %   further).  We avoid tests by putting a trailing |: \use_i:nn|, which
diff --git a/l3kernel/l3unicode-data.dtx b/l3kernel/l3unicode-data.dtx
index ab5800b..6a0827e 100644
--- a/l3kernel/l3unicode-data.dtx
+++ b/l3kernel/l3unicode-data.dtx
@@ -299,14 +299,11 @@
           }
       }
   }
-\group_begin:
-\char_set_lccode:nn { `\* } { `\: }
-\tex_lowercase:D
+\use:x
   {
-    \group_end:
-    \cs_new_protected:Npn \__unicode_parse_line_auxi:w #1 *
+    \cs_new_protected:Npn \exp_not:N \__unicode_parse_line_auxi:w
+      ##1 \token_to_str:N : ~ ##2 , ~ ##3 ~ ##4 \scan_stop:
   }
-       ~ #2 , ~ #3 ~ #4 \scan_stop:
   { \tl_set:Nn \l__unicode_tmp_tl { #2 , ~ #3 } }
 \clist_map_inline:nn
   { UnicodeData , SpecialCasing , CaseFolding }
diff --git a/l3trial/xfont/xfss.dtx b/l3trial/xfont/xfss.dtx
index 73a78c6..c2deaf4 100644
--- a/l3trial/xfont/xfss.dtx
+++ b/l3trial/xfont/xfss.dtx
@@ -1,6 +1,6 @@
 % \iffalse
 %
-%% File xfss.dtx Copyright (C) 2011,2012 The LaTeX3 Project
+%% File xfss.dtx Copyright (C) 2011,2012,2015 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -415,12 +415,14 @@
 % \subsubsection{Function variants}
 %
 %    \begin{macrocode}
+\cs_generate_variant:Nn \file_input:n { x }
 \cs_generate_variant:Nn \prop_gput:Nnn {Nx, Nxx, cx,cxx}
 \cs_generate_variant:Nn \prop_if_in:NnTF {Nx}
 \cs_generate_variant:Nn \prop_gpop:NnNTF {Nx}
 \cs_generate_variant:Nn \prop_gpop:NnNF {cx}
 \cs_generate_variant:Nn \prop_gpop:NnN {cx}
 \cs_generate_variant:Nn \prop_get:NnNT {cx}
+\cs_generate_variant:Nn \str_fold_case:n { V }
 %    \end{macrocode}
 %
 % \subsubsection{General}
@@ -1246,11 +1248,9 @@
           { \l_xfss_encoding_tl + \l_xfss_family_tl}
         \tl_new:c { \l_xfss_encoding_tl + \l_xfss_family_tl}
         \xfss_switch_catcodes:
-        \use:x
-          {
-            \tex_lowercase:D
-              { \file_input:n { \l_xfss_encoding_tl \l_xfss_family_tl .fd } }
-          }
+        \tl_set:Nx \l_xfss_tmpa_tl {  \l_xfss_encoding_tl \l_xfss_family_tl .fd }
+        \file_input:x
+          { \str_fold_case:V \l_xfss_tmpa_tl }
       }
   }
 %    \end{macrocode}
@@ -2303,7 +2303,7 @@
       { \DeclareTextCompositeCommand #1 {#2} {#3} }
     \group_begin:
       \tex_lccode:D \c_zero #4
-      \tex_lowercase:D  {
+      \tl_to_lowercase:n  {
     \group_end:
     \l_xfss_tmpa_tl ^^@ }
   }

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


More information about the latex3-commits mailing list