[latex3-commits] [git/latex3] master: Add l3candidates \seq_const_from_clist:Nn (see #257) (ec327ea)

Bruno Le Floch bruno at le-floch.fr
Wed Nov 29 03:25:48 CET 2017


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

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

commit ec327ea7f20b5b5d07fc2ba67cafd3d3c07e6d6d
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Tue Nov 28 21:25:48 2017 -0500

    Add l3candidates \seq_const_from_clist:Nn (see #257)


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

ec327ea7f20b5b5d07fc2ba67cafd3d3c07e6d6d
 l3experimental/xgalley/xgalley.dtx      |   10 ++-------
 l3kernel/l3candidates.dtx               |   21 +++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl001.tlg        |    2 ++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl003.tlg        |    2 ++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    2 ++
 l3kernel/testfiles/m3seq007.lvt         |   34 ++++++++++++++++++++++++++++++-
 l3kernel/testfiles/m3seq007.tlg         |   20 ++++++++++++++++++
 l3packages/xtemplate/xtemplate.dtx      |    5 +----
 15 files changed, 97 insertions(+), 13 deletions(-)

diff --git a/l3experimental/xgalley/xgalley.dtx b/l3experimental/xgalley/xgalley.dtx
index 37ec8d6..78c20b9 100644
--- a/l3experimental/xgalley/xgalley.dtx
+++ b/l3experimental/xgalley/xgalley.dtx
@@ -1418,26 +1418,20 @@
           }
       }
   }
-\seq_new:N \c_@@_parbreak_multi_seq
-\debug_suspend:
-\seq_gset_from_clist:Nn \c_@@_parbreak_multi_seq
+\seq_const_from_clist:Nn \c_@@_parbreak_multi_seq
   {
     club_penalties ,
     display_club_penalties ,
     display_widow_penalties ,
     widow_penalties ,
   }
-\debug_resume:
-\seq_new:N \c_@@_parbreak_single_seq
-\debug_suspend:
-\seq_gset_from_clist:Nn \c_@@_parbreak_single_seq
+\seq_const_from_clist:Nn \c_@@_parbreak_single_seq
   {
     parbreak_badness ,
     broken_penalty ,
     post_display_penalty ,
     pre_display_penalty ,
   }
-\debug_resume:
 %    \end{macrocode}
 % \end{variable}
 %    \begin{macrocode}
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 5990bd4..b688155 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -483,6 +483,15 @@
 %   \end{texnote}
 % \end{function}
 %
+% \begin{function}[added = 2017-11-28]
+%   {\seq_const_from_clist:Nn,  \seq_const_from_clist:cn}
+%   \begin{syntax}
+%     \cs{seq_const_from_clist:Nn} \meta{sequence} \Arg{comma-list}
+%   \end{syntax}
+%   Converts the data in the \meta{comma list} into a constant
+%   \meta{sequence}: the original \meta{comma list} is unchanged.
+% \end{function}
+%
 % \section{Additions to \pkg{l3skip}}
 %
 % \begin{function}{\skip_split_finite_else_action:nnNN}
@@ -2120,6 +2129,18 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\seq_const_from_clist:Nn, \seq_const_from_clist:cn}
+%   Almost identical to \cs{seq_set_from_clist:Nn}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \seq_const_from_clist:Nn #1#2
+  {
+    \tl_const:Nx #1
+      { \s_@@ \clist_map_function:nN {#2} \@@_wrap_item:n }
+  }
+\cs_generate_variant:Nn \seq_const_from_clist:Nn { c }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Additions to \pkg{l3skip}}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index d4d2e9c..a09b2c2 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5526,6 +5526,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index c2e08f9..90599c3 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5516,6 +5516,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index cdaf7a8..4f7fb30 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5516,6 +5516,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 16bcd69..449d547 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5514,6 +5514,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index a913d87..d0182b8 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5499,6 +5499,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index d4d2e9c..a09b2c2 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5526,6 +5526,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index c2e08f9..90599c3 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5516,6 +5516,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index cdaf7a8..4f7fb30 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5516,6 +5516,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 16bcd69..449d547 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5514,6 +5514,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index a913d87..d0182b8 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5499,6 +5499,8 @@ Defining \seq_gset_map:NNn on line ...
 Defining \__seq_set_map:NNNn on line ...
 Defining \seq_rand_item:N on line ...
 Defining \seq_rand_item:c on line ...
+Defining \seq_const_from_clist:Nn on line ...
+Defining \seq_const_from_clist:cn on line ...
 Defining \skip_split_finite_else_action:nnNN on line ...
 Defining \sys_if_rand_exist_p: on line ...
 Defining \sys_if_rand_exist:T on line ...
diff --git a/l3kernel/testfiles/m3seq007.lvt b/l3kernel/testfiles/m3seq007.lvt
index 681f372..35a4107 100644
--- a/l3kernel/testfiles/m3seq007.lvt
+++ b/l3kernel/testfiles/m3seq007.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2012 LaTeX3 Project
+% Copyright (C) 2012,2017 LaTeX3 Project
 %
 
 \documentclass{minimal}
@@ -59,6 +59,38 @@
     \test:f { \seq_use:Nn \l_tmpa_seq { ~and~ } }
   }
 
+\TEST { seq_set_from_clist:Nn }
+  {
+    \clist_set:Nn \l_tmpa_clist { a , , ~ {~b}~,{,},{{}} }
+    \seq_set_from_clist:NN \l_tmpa_seq \l_tmpa_clist
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_set_from_clist:cN { l_tmpb_seq } \l_tmpa_clist
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_set_from_clist:Nc \l_tmpa_seq { l_tmpa_clist }
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_set_from_clist:cc { l_tmpa_seq } { l_tmpa_clist }
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_set_from_clist:Nn \l_tmpa_seq { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_set_from_clist:cn { l_tmpa_seq } { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \l_tmpa_seq { | } }
+    \seq_gset_from_clist:NN \g_tmpa_seq \l_tmpa_clist
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_gset_from_clist:cN { g_tmpa_seq } \l_tmpa_clist
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_gset_from_clist:Nc \g_tmpa_seq { l_tmpa_clist }
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_gset_from_clist:cc { g_tmpa_seq } { l_tmpa_clist }
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_gset_from_clist:Nn \g_tmpa_seq { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_gset_from_clist:cn { g_tmpa_seq } { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \g_tmpa_seq { | } }
+    \seq_const_from_clist:Nn \c_A_seq { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \c_A_seq { | } }
+    \seq_const_from_clist:cn { c_B_seq } { a , , ~ {~b}~,{,},{{}} }
+    \test:x { \seq_use:Nn \c_B_seq { | } }
+  }
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \END
diff --git a/l3kernel/testfiles/m3seq007.tlg b/l3kernel/testfiles/m3seq007.tlg
index 7efc6e4..ae8fd9f 100644
--- a/l3kernel/testfiles/m3seq007.tlg
+++ b/l3kernel/testfiles/m3seq007.tlg
@@ -23,3 +23,23 @@ TEST 2: seq_use:Nn
 > a and b and c and d and e and f and \g  and h and i.
 > AAA and \g  and (x,y).
 ============================================================
+============================================================
+TEST 3: seq_set_from_clist:Nn
+============================================================
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+> a| b|,|{}.
+Defining \c_A_seq on line ...
+> a| b|,|{}.
+Defining \c_B_seq on line ...
+> a| b|,|{}.
+============================================================
diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index d574c3a..c62dae4 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -721,11 +721,8 @@
 %   used to parse the keytype correctly.  We suspend debugging to allow
 %   an assignment to a constant.
 %    \begin{macrocode}
-\seq_new:N \c_@@_keytypes_arg_seq
-\debug_suspend:
-\seq_gset_from_clist:Nn \c_@@_keytypes_arg_seq
+\seq_const_from_clist:Nn \c_@@_keytypes_arg_seq
   { choice , function , instance }
-\debug_resume:
 %    \end{macrocode}
 %  \end{variable}
 %





More information about the latex3-commits mailing list