summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/gtl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-29 22:07:42 +0000
committerKarl Berry <karl@freefriends.org>2017-11-29 22:07:42 +0000
commit0f19ceba963f665b720cec005bdee42329654fa4 (patch)
tree5467890313d8b51b728382a51ee0ab28fc6c7bb0 /Master/texmf-dist/source/generic/gtl
parentcd3505f88f11b375a6fcc7b4d112edc9db836914 (diff)
gtl (29nov17)
git-svn-id: svn://tug.org/texlive/trunk@45942 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic/gtl')
-rw-r--r--Master/texmf-dist/source/generic/gtl/gtl.dtx91
1 files changed, 65 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/generic/gtl/gtl.dtx b/Master/texmf-dist/source/generic/gtl/gtl.dtx
index f197c8ad13c..0a3ff19aac8 100644
--- a/Master/texmf-dist/source/generic/gtl/gtl.dtx
+++ b/Master/texmf-dist/source/generic/gtl/gtl.dtx
@@ -1,13 +1,17 @@
% \iffalse
-%% File: gtl.dtx Copyright (C) 2013,2015 Bruno Le Floch
+%% File: gtl.dtx Copyright (C) 2013,2015,2017 Bruno Le Floch
%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3c of this
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
%%
-%% http://www.latex-project.org/lppl.txt
+%% This work has the LPPL maintenance status 'maintained'
+%% and the current maintainer is Bruno Le Floch.
%%
+%% This work consists of the files gtl.dtx and gtl.ins and
+%% derived file gtl.sty.
%% -----------------------------------------------------------------------
%
%<*driver>
@@ -23,9 +27,9 @@
%
% \title{The \textsf{gtl} package: \\
% manipulate unbalanced lists of tokens\thanks{This
-% file has version number 0.2, last revised 2015/09/29.}}
+% file has version number 0.3, last revised 2017/11/29.}}
% \author{Bruno Le Floch}
-% \date{2015/09/29}
+% \date{2017/11/29}
%
% \maketitle
% \tableofcontents
@@ -127,7 +131,7 @@
% }
% \cs_new_protected:Npn \__gtldoc_more:Nw #1 #2 \q_recursion_stop
% { ^^A grab one more line and restart the loop
-% \ior_get_str:NN \g__gtldoc_ior \l__gtldoc_internal_tl
+% \ior_str_get:NN \g__gtldoc_ior \l__gtldoc_internal_tl
% \exp_after:wN #1 \l__gtldoc_internal_tl
% \q_recursion_tail \q_recursion_stop
% }
@@ -299,14 +303,14 @@
% \gtldoc_get_fn:n { gtl.dtx }
% \gtldoc_get_tests:n
% {
-% ../../testfiles/gtl000.lvt ,
-% ../../testfiles/gtl001.lvt ,
-% ../../testfiles/gtl002.lvt ,
-% ../../testfiles/gtl003.lvt ,
-% ../../testfiles/gtl004.lvt ,
-% ../../testfiles/gtl005.lvt ,
-% ../../testfiles/gtl006.lvt ,
-% ../../testfiles/gtl007.lvt
+% ../../latextests/testfiles/gtl000.lvt ,
+% ../../latextests/testfiles/gtl001.lvt ,
+% ../../latextests/testfiles/gtl002.lvt ,
+% ../../latextests/testfiles/gtl003.lvt ,
+% ../../latextests/testfiles/gtl004.lvt ,
+% ../../latextests/testfiles/gtl005.lvt ,
+% ../../latextests/testfiles/gtl006.lvt ,
+% ../../plaintests/testfiles/gtl007.lvt
% }
% \group_begin:
% \seq_set_eq:NN \l__gtldoc_internal_seq \l__gtldoc_fn_seq
@@ -488,6 +492,16 @@
% the \meta{cs} is followed by \cs{q_no_value}.
% \end{function}
%
+% \begin{function}[EXP, TF]{\gtl_head_do:NN}
+% \begin{syntax}
+% \cs{gtl_head_do:NNTF} \meta{gtl~var} \meta{cs} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% If the \meta{gtl~var} is empty, leaves the \meta{false code} in the
+% input stream. Otherwise leaves the \meta{control sequence}
+% followed by the first token in \meta{gtl~var} and the \meta{true
+% code}.
+% \end{function}
+%
% \begin{function}{\gtl_get_left:NN}
% \begin{syntax}
% \cs{gtl_get_left:NN} \meta{gtl~var_1} \meta{gtl~var_2}
@@ -755,7 +769,7 @@
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input expl3-generic.tex
\else
- \RequirePackage{expl3}[2015/09/11]
+ \RequirePackage{expl3}[2017/11/14]
\fi
\ExplSyntaxOn
\cs_if_exist:NTF \ProvidesExplPackage
@@ -777,7 +791,7 @@
}
\@@_tmp:w
}
- {gtl} {2015/09/29} {0.2} {Manipulate unbalanced lists of tokens}
+ {gtl} {2017/11/29} {0.3} {Manipulate unbalanced lists of tokens}
% \end{macrocode}
%
% \subsection{Helpers}
@@ -1446,6 +1460,31 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP, TF]{\gtl_head_do:NN}
+% Test for emptyness then use \cs{gtl_head_do:NN}, placing the
+% \meta{true code} or \meta{false code} as appropriate.
+% \begin{macrocode}
+\cs_new:Npn \gtl_head_do:NNT #1#2#3
+ {
+ \gtl_if_empty:NTF #1
+ { }
+ { \gtl_head_do:NN #1 #2 #3 }
+ }
+\cs_new:Npn \gtl_head_do:NNF #1#2#3
+ {
+ \gtl_if_empty:NTF #1
+ {#3}
+ { \gtl_head_do:NN #1 #2 }
+ }
+\cs_new:Npn \gtl_head_do:NNTF #1#2#3#4
+ {
+ \gtl_if_empty:NTF #1
+ {#4}
+ { \gtl_head_do:NN #1 #2 #3 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\gtl_get_left:NN}
% \begin{macrocode}
\cs_new_protected:Npn \gtl_get_left:NN #1#2
@@ -1775,10 +1814,10 @@
{
\quark_if_nil:nTF {#1}
{ \@@_tl_count_test:w }
- { + \c_one \@@_tl_count_loop:n }
+ { + 1 \@@_tl_count_loop:n }
}
\cs_new:Npn \@@_tl_count_test:w #1 \q_stop
- { \tl_if_empty:nF {#1} { + \c_one \@@_tl_count_loop:n #1 \q_stop } }
+ { \tl_if_empty:nF {#1} { + 1 \@@_tl_count_loop:n #1 \q_stop } }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1816,14 +1855,14 @@
\cs_new:Npn \@@_count_tokens:w \s_@@ #1#2#3
{
\int_eval:n
- { \c_minus_one \@@_count_auxi:nw #1 {#2} #3 \q_nil \q_stop }
+ { -1 \@@_count_auxi:nw #1 {#2} #3 \q_nil \q_stop }
}
\cs_new:Npn \@@_count_auxi:nw #1
{
\quark_if_nil:nTF {#1}
{ \@@_count_auxii:w }
{
- + \c_one
+ + 1
\@@_count_auxiii:n {#1}
\@@_count_auxi:nw
}
@@ -1832,7 +1871,7 @@
{
\tl_if_empty:nF {#1}
{
- + \c_two
+ + 2
\@@_count_auxi:nw #1 \q_stop
}
}
@@ -1842,11 +1881,11 @@
{
\tl_if_head_is_group:nTF {#1}
{
- + \c_two
+ + 2
\exp_args:No \@@_count_auxiii:n { \use:n #1 }
}
{
- + \c_one
+ + 1
\tl_if_head_is_N_type:nTF {#1}
{ \exp_args:No \@@_count_auxiii:n { \use_none:n #1 } }
{ \exp_args:Nf \@@_count_auxiii:n {#1} }