diff options
author | Karl Berry <karl@freefriends.org> | 2018-12-13 22:53:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-12-13 22:53:27 +0000 |
commit | bbbf3700086ea2f861b6594ea23e37f29d3f9dc1 (patch) | |
tree | 051ec6913956e3f2a6563878941ccebd9645b401 /Master/texmf-dist/source | |
parent | 301b93fafda199abb5c1eaf8b18cb1d1d0345a68 (diff) |
l3kernel (13dec18)
git-svn-id: svn://tug.org/texlive/trunk@49405 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
52 files changed, 295 insertions, 268 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index cdbd6f91563..7500ea3a794 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2018-12-11}% +\def\ExplFileDate{2018-12-12}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index fb1a9a0ace3..72adae80423 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 6b7748a87f1..92ef56b2497 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 90590af4838..2959353c2a6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -138,7 +138,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 07c4cd51336..b0c545ffe8d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 823af73f16b..0fdfe1ea798 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % @@ -1236,79 +1236,6 @@ % \meta{shell command}. % \end{function} % -% \begin{function}[EXP, added = 2017-02-17, updated = 2017-07-15] -% {\tl_range:Nnn, \tl_range:nnn} -% \begin{syntax} -% \cs{tl_range:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} -% \cs{tl_range:nnn} \Arg{token list} \Arg{start index} \Arg{end index} -% \end{syntax} -% Leaves in the input stream the items from the \meta{start index} to the -% \meta{end index} inclusive. Spaces and braces are preserved between -% the items returned (but never at either end of the list). -% -% Here \meta{start index} and \meta{end index} should be integer denotations. -% For describing in detail the functions' behavior, let $m$ and $n$ be the start -% and end index respectively. If either is $0$, the result is empty. A positive -% index means `start counting from the left end', a negative index means -% `start counting from the right end'. Let $l$ be the count of the token list. -% -% The \emph{actual start point} is determined as $M=m$ if~$m>0$ and as $M=l+m+1$ -% if~$m<0$. Similarly the \emph{actual end point} is $N=n$ if~$n>0$ and $N=l+n+1$ -% if~$n<0$. If $M>N$, the result is empty. Otherwise it consists of all items from -% position $M$ to position $N$ inclusive; for the purpose of this rule, we can -% imagine that the token list extends at infinity on either side, with void items -% at positions $s$ for $s\le0$ or $s>l$. - -% Spaces in between items in the actual range are preserved. Spaces at either end -% of the token list will be removed anyway (think to the token list being passed to -% |\tl_trim_spaces:n| to begin with. -% -% Thus, with $l=7$ as in the examples below, all of the following are equivalent -% and result in the whole token list -% \begin{verbatim} -% \tl_range:nnn { abcd~{e{}}fg } { 1 } { 7 } -% \tl_range:nnn { abcd~{e{}}fg } { 1 } { 12 } -% \tl_range:nnn { abcd~{e{}}fg } { -7 } { 7 } -% \tl_range:nnn { abcd~{e{}}fg } { -12 } { 7 } -% \end{verbatim} -% Here are some more interesting examples. The calls -% \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { -3 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { -3 } } -% \end{verbatim} -% are all equivalent and will print |bcd{e{}}| on the terminal; similarly -% \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { -3 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { -3 } } -% \end{verbatim} -% are all equivalent and will print |bcd {e{}}| on the -% terminal (note the space in the middle). To the contrary, -% \begin{verbatim} -% \tl_range:nnn { abcd~{e{}}f } { 2 } { 4 } -% \end{verbatim} -% will discard the space after `d`. -% -% If we want to get the items from the third to the last, the call -% is |\tl_range:nnn { <tl> } { 3 } { -1 }|. Similarly, for discarding -% the last item, we can do |\tl_range:nnn { <tl> } { 1 } { -2 }|. -% -% The behavior of \cs{tl_range:Nnn} is exactly the same, acting on the -% contents of the tl variable. -% -% For improved performance, see \cs{tl_range_braced:nnn} and -% \cs{tl_range_unbraced:nnn}. -% \begin{texnote} -% The result is returned within the \tn{unexpanded} -% primitive (\cs{exp_not:n}), which means that the \meta{item} -% does not expand further when appearing in an \texttt{x}-type -% argument expansion. -% \end{texnote} -% \end{function} -% % \begin{function}[EXP, added = 2017-07-15] % { % \tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn, @@ -5020,34 +4947,15 @@ % % \subsubsection{Other additions to \pkg{l3tl}} % -% Some preliminary code is needed for the \cs{tl_range:nnn} family of functions. -% -% \begin{macro}{\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} % \begin{macro}{\tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn} % \begin{macro} % {\tl_range_unbraced:Nnn, \tl_range_unbraced:cnn, \tl_range_unbraced:nnn} % \begin{macro} % { -% \@@_range:Nnnn, \@@_range:nnnNn, \@@_range:nnNn, \@@_range_skip:w, % \@@_range_braced:w, \@@_range_collect_braced:w, % \@@_range_unbraced:w, \@@_range_collect_unbraced:w, -% \@@_range:w, \@@_range_skip_spaces:n, \@@_range_collect:nn, -% \@@_range_collect:ff, \@@_range_collect_space:nw, -% \@@_range_collect_N:nN, \@@_range_collect_group:nN, % } -% To avoid checking for the end of the token list at every step, start -% by counting the number $l$ of items and \enquote{normalizing} the -% bounds, namely clamping them to the interval $[0,l]$ and dealing -% with negative indices. More precisely, \cs{@@_range_items:nnNn} -% receives the number of items to skip at the beginning of the token -% list, the index of the last item to keep, a function among -% \cs{@@_range:w}, \cs{@@_range_braced:w}, \cs{@@_range_unbraced:w}, -% and the token list itself. If nothing should be kept, leave |{}|: -% this stops the \texttt{f}-expansion of \cs{tl_head:f} and that -% function produces an empty result. Otherwise, repeatedly call -% \cs{@@_range_skip:w} to delete |#1| items from the input stream (the -% extra brace group avoids an off-by-one shift). For the braced -% version \cs{@@_range_braced:w} sets up +% For the braced version \cs{@@_range_braced:w} sets up % \cs{@@_range_collect_braced:w} which stores items one by one in an % argument after the semicolon. The unbraced version is almost % identical. The version preserving braces and spaces starts by @@ -5056,15 +4964,8 @@ % |{| \Arg{collected} \meta{tokens} |}|, whose head is the collected % tokens and whose tail is what remains of the original token list. % This form makes it easier to move tokens to the \meta{collected} -% tokens. Depending on the first token of the tail, either just move -% it (if it is a space) or also decrement the number of items left to -% find. Eventually, the result is a brace group followed by the rest -% of the token list, and \cs{tl_head:f} cleans up and gives the result -% in \cs{exp_not:n}. -% \begin{macrocode} -\cs_new:Npn \tl_range:Nnn { \exp_args:No \tl_range:nnn } -\cs_generate_variant:Nn \tl_range:Nnn { c } -\cs_new:Npn \tl_range:nnn { \@@_range:Nnnn \@@_range:w } +% tokens. +% \begin{macrocode} \cs_new:Npn \tl_range_braced:Nnn { \exp_args:No \tl_range_braced:nnn } \cs_generate_variant:Nn \tl_range_braced:Nnn { c } \cs_new:Npn \tl_range_braced:nnn { \@@_range:Nnnn \@@_range_braced:w } @@ -5073,44 +4974,6 @@ \cs_generate_variant:Nn \tl_range_unbraced:Nnn { c } \cs_new:Npn \tl_range_unbraced:nnn { \@@_range:Nnnn \@@_range_unbraced:w } -\cs_new:Npn \@@_range:Nnnn #1#2#3#4 - { - \tl_head:f - { - \exp_args:Nf \@@_range:nnnNn - { \tl_count:n {#2} } {#3} {#4} #1 {#2} - } - } -\cs_new:Npn \@@_range:nnnNn #1#2#3 - { - \exp_args:Nff \@@_range:nnNn - { - \exp_args:Nf \@@_range_normalize:nn - { \int_eval:n { #2 - 1 } } {#1} - } - { - \exp_args:Nf \@@_range_normalize:nn - { \int_eval:n {#3} } {#1} - } - } -\cs_new:Npn \@@_range:nnNn #1#2#3#4 - { - \if_int_compare:w #2 > #1 \exp_stop_f: \else: - \exp_after:wN { \exp_after:wN } - \fi: - \exp_after:wN #3 - \int_value:w \int_eval:n { #2 - #1 } \exp_after:wN ; - \exp_after:wN { \exp:w \@@_range_skip:w #1 ; { } #4 } - } -\cs_new:Npn \@@_range_skip:w #1 ; #2 - { - \if_int_compare:w #1 > 0 \exp_stop_f: - \exp_after:wN \@@_range_skip:w - \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; - \else: - \exp_after:wN \exp_end: - \fi: - } \cs_new:Npn \@@_range_braced:w #1 ; #2 { \@@_range_collect_braced:w #1 ; { } #2 } \cs_new:Npn \@@_range_unbraced:w #1 ; #2 @@ -5131,78 +4994,10 @@ \fi: { #2 #3 } } -\cs_new:Npn \@@_range:w #1 ; #2 - { - \exp_args:Nf \@@_range_collect:nn - { \@@_range_skip_spaces:n {#2} } {#1} - } -\cs_new:Npn \@@_range_skip_spaces:n #1 - { - \tl_if_head_is_space:nTF {#1} - { \exp_args:Nf \@@_range_skip_spaces:n {#1} } - { { } #1 } - } -\cs_new:Npn \@@_range_collect:nn #1#2 - { - \int_compare:nNnTF {#2} = 0 - {#1} - { - \exp_args:No \tl_if_head_is_space:nTF { \use_none:n #1 } - { - \exp_args:Nf \@@_range_collect:nn - { \@@_range_collect_space:nw #1 } - {#2} - } - { - \@@_range_collect:ff - { - \exp_args:No \tl_if_head_is_N_type:nTF { \use_none:n #1 } - { \@@_range_collect_N:nN } - { \@@_range_collect_group:nn } - #1 - } - { \int_eval:n { #2 - 1 } } - } - } - } -\cs_new:Npn \@@_range_collect_space:nw #1 ~ { { #1 ~ } } -\cs_new:Npn \@@_range_collect_N:nN #1#2 { { #1 #2 } } -\cs_new:Npn \@@_range_collect_group:nn #1#2 { { #1 {#2} } } -\cs_generate_variant:Nn \@@_range_collect:nn { ff } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% -% \begin{macro}[EXP]{\@@_range_normalize:nn} -% This function converts an \meta{index} argument into an explicit -% position in the token list (a result of $0$ denoting \enquote{out of -% bounds}). Expects two explicit integer arguments: the \meta{index} -% |#1| and the string count~|#2|. If |#1| is negative, replace it by -% $|#1| + |#2| + 1$, then limit to the range $[0, |#2|]$. -% \begin{macrocode} -\cs_new:Npn \@@_range_normalize:nn #1#2 - { - \int_eval:n - { - \if_int_compare:w #1 < 0 \exp_stop_f: - \if_int_compare:w #1 < -#2 \exp_stop_f: - 0 - \else: - #1 + #2 + 1 - \fi: - \else: - \if_int_compare:w #1 < #2 \exp_stop_f: - #1 - \else: - #2 - \fi: - \fi: - } - } -% \end{macrocode} -% \end{macro} % % \subsection{Additions to \pkg{l3token}} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index fe042967193..eee5474874b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 1895f573ba4..b3f37081ae8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx index 140fb2c6c87..4cda24b3d25 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index 05f4b3c9815..55a03cc9a40 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 868d8ad8818..2be7fcfed3a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -77,7 +77,7 @@ and all files in that bundle must be distributed together. % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % \maketitle % \tableofcontents % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 395a6697ff2..8c87b691642 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index e0ede7b82a9..535714e56a8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % @@ -554,23 +554,23 @@ %<*package> \ProvidesExplFile %<*dvipdfmx> - {l3dvidpfmx.def}{2018-12-11}{} + {l3dvidpfmx.def}{2018-12-12}{} {L3 Experimental driver: dvipdfmx} %</dvipdfmx> %<*dvips> - {l3dvips.def}{2018-12-11}{} + {l3dvips.def}{2018-12-12}{} {L3 Experimental driver: dvips} %</dvips> %<*dvisvgm> - {l3dvisvgm.def}{2018-12-11}{} + {l3dvisvgm.def}{2018-12-12}{} {L3 Experimental driver: dvisvgm} %</dvisvgm> %<*pdfmode> - {l3pdfmode.def}{2018-12-11}{} + {l3pdfmode.def}{2018-12-12}{} {L3 Experimental driver: PDF mode} %</pdfmode> %<*xdvipdfmx> - {l3xdvidpfmx.def}{2018-12-11}{} + {l3xdvidpfmx.def}{2018-12-12}{} {L3 Experimental driver: xdvipdfmx} %</xdvipdfmx> %</package> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 5e2d3991c5f..d4c07c4b0a3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 09ef15f0bb2..23f34a1e95f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % @@ -797,11 +797,22 @@ % third-party package \pkg{morewrites}), this macro is saved here % under a private name. The complicated code ensures that % \cs{@@_new:N} is not \tn{outer} despite plain \TeX{}'s \tn{newread} -% being \tn{outer}. +% being \tn{outer}. For \ConTeXt{}, we have to deal with the fact +% that \tn{newread} works like our own: it actually checks before +% altering definition. % \begin{macrocode} %<*package> \exp_args:NNf \cs_new_protected:Npn \@@_new:N { \exp_args:NNc \exp_after:wN \exp_stop_f: { newread } } +\cs_if_exist:NT \normalend + { + \cs_new_eq:NN \@@_new_aux:N \@@_new:N + \cs_set_protected:Npn \@@_new:N #1 + { + \cs_undefine:N #1 + \@@_new_aux:N #1 + } + } %</package> % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index cfe54bd8fac..3a404d6d7ba 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index dfc37c8ed03..1bb1b81f236 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index ac7b4c93278..43aaaa02329 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index e3598793265..224c41de621 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index fb6d5781e6f..44bb46bca49 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 79155d00959..ea329ab40de 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 59a4861e7c7..d5a523371e9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 612535e796b..1c70b959b3a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 57778d40dde..21365b45ea0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 231513d2bce..3c13e3be6d8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index 8c60a0dfe50..038f222028b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index fc18f1d74d1..6a3ad894c99 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index 8f572357cda..287adb037cf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 16549bce3f2..ede5b7c1caf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 868d539d143..77472f65103 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx index ff5d46dbab6..2a3daa476a1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 040758ca77f..f9d75e4c7b6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index 6063dc88f36..a67f7b74ad2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx index 2f23ebdc9c6..75d2ac887a8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index d259543b635..eef25a90f88 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 376a96c4249..e99e293795a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % @@ -333,7 +333,9 @@ local byte = string.byte local floor = math.floor local format = string.format local gsub = string.gsub -local kpse_find = kpse.find_file +if not resolvers then + local kpse_find = kpse.find_file +end local lfs_attr = lfs.attributes local md5_sum = md5.sum local open = io.open @@ -345,6 +347,13 @@ local write = tex.write local utf8_char = unicode.utf8.char % \end{macrocode} % +% Deal with Con\TeX{}t: doesn't use |kpse| library. +% \begin{macrocode} +if resolvers then + kpse_find = resolvers.findfile +end +% \end{macrocode} +% % \begin{macro}[int]{escapehex} % An internal auxiliary to convert a string to the matching hex escape. % This works on a byte basis: extension to handled UTF-8 input is diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 19dc4b9b99e..482ddf423c9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index a70b741950c..500b4c7ecb7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index 9bdae0370dc..b98ff93d266 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 0fb0fc0c7a0..2f098c37d15 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 760ce546c94..c70c0c18966 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 241829050fb..3507d524eb8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index 5bd28e1cd13..c3812e26443 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 210aeb5973d..8e4d7b58b0e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 469558a0065..5e4098eb367 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 47e0b866cf8..bb2d6f966e5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 88dabd950b2..0eb50ae3775 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index aa899b1ea44..3aa20856ee2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index 1cc0ecad91a..b81545a05da 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index fab5c69b28a..b85b98a9222 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % @@ -1026,6 +1026,79 @@ % \end{texnote} % \end{function} % +% \begin{function}[EXP, added = 2017-02-17, updated = 2017-07-15] +% {\tl_range:Nnn, \tl_range:nnn} +% \begin{syntax} +% \cs{tl_range:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} +% \cs{tl_range:nnn} \Arg{token list} \Arg{start index} \Arg{end index} +% \end{syntax} +% Leaves in the input stream the items from the \meta{start index} to the +% \meta{end index} inclusive. Spaces and braces are preserved between +% the items returned (but never at either end of the list). +% +% Here \meta{start index} and \meta{end index} should be integer denotations. +% For describing in detail the functions' behavior, let $m$ and $n$ be the start +% and end index respectively. If either is $0$, the result is empty. A positive +% index means `start counting from the left end', a negative index means +% `start counting from the right end'. Let $l$ be the count of the token list. +% +% The \emph{actual start point} is determined as $M=m$ if~$m>0$ and as $M=l+m+1$ +% if~$m<0$. Similarly the \emph{actual end point} is $N=n$ if~$n>0$ and $N=l+n+1$ +% if~$n<0$. If $M>N$, the result is empty. Otherwise it consists of all items from +% position $M$ to position $N$ inclusive; for the purpose of this rule, we can +% imagine that the token list extends at infinity on either side, with void items +% at positions $s$ for $s\le0$ or $s>l$. +% +% Spaces in between items in the actual range are preserved. Spaces at either end +% of the token list will be removed anyway (think to the token list being passed to +% |\tl_trim_spaces:n| to begin with. +% +% Thus, with $l=7$ as in the examples below, all of the following are equivalent +% and result in the whole token list +% \begin{verbatim} +% \tl_range:nnn { abcd~{e{}}fg } { 1 } { 7 } +% \tl_range:nnn { abcd~{e{}}fg } { 1 } { 12 } +% \tl_range:nnn { abcd~{e{}}fg } { -7 } { 7 } +% \tl_range:nnn { abcd~{e{}}fg } { -12 } { 7 } +% \end{verbatim} +% Here are some more interesting examples. The calls +% \begin{verbatim} +% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { -3 } } +% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { -3 } } +% \end{verbatim} +% are all equivalent and will print |bcd{e{}}| on the terminal; similarly +% \begin{verbatim} +% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { -3 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { -3 } } +% \end{verbatim} +% are all equivalent and will print |bcd {e{}}| on the +% terminal (note the space in the middle). To the contrary, +% \begin{verbatim} +% \tl_range:nnn { abcd~{e{}}f } { 2 } { 4 } +% \end{verbatim} +% will discard the space after `d`. +% +% If we want to get the items from the third to the last, the call +% is |\tl_range:nnn { <tl> } { 3 } { -1 }|. Similarly, for discarding +% the last item, we can do |\tl_range:nnn { <tl> } { 1 } { -2 }|. +% +% The behavior of \cs{tl_range:Nnn} is exactly the same, acting on the +% contents of the tl variable. +% +% For improved performance, see \cs{tl_range_braced:nnn} and +% \cs{tl_range_unbraced:nnn}. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{item} +% does not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% % \section{Viewing token lists} % % \begin{function}[updated = 2015-08-01]{\tl_show:N, \tl_show:c} @@ -2994,6 +3067,145 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} +% \begin{macro} +% { +% \@@_range:Nnnn, \@@_range:nnnNn, \@@_range:nnNn, \@@_range_skip:w, +% \@@_range:w, \@@_range_skip_spaces:n, \@@_range_collect:nn, +% \@@_range_collect:ff, \@@_range_collect_space:nw, +% \@@_range_collect_N:nN, \@@_range_collect_group:nN, +% } +% To avoid checking for the end of the token list at every step, start +% by counting the number $l$ of items and \enquote{normalizing} the +% bounds, namely clamping them to the interval $[0,l]$ and dealing +% with negative indices. More precisely, \cs{@@_range_items:nnNn} +% receives the number of items to skip at the beginning of the token +% list, the index of the last item to keep, a function which is either +% \cs{@@_range:w} or the token list itself. If nothing should be kept, +% leave |{}|: this stops the \texttt{f}-expansion of \cs{tl_head:f} and that +% function produces an empty result. Otherwise, repeatedly call +% \cs{@@_range_skip:w} to delete |#1| items from the input stream (the +% extra brace group avoids an off-by-one shift). For the braced +% version \cs{@@_range_braced:w} sets up +% \cs{@@_range_collect_braced:w} which stores items one by one in an +% argument after the semicolon. Depending on the first token of the tail, +% either just move it (if it is a space) or also decrement the number of +% items left to find. Eventually, the result is a brace group followed by +% the rest of the token list, and \cs{tl_head:f} cleans up and gives the +% result in \cs{exp_not:n}. +% \begin{macrocode} +\cs_new:Npn \tl_range:Nnn { \exp_args:No \tl_range:nnn } +\cs_generate_variant:Nn \tl_range:Nnn { c } +\cs_new:Npn \tl_range:nnn { \@@_range:Nnnn \@@_range:w } +\cs_new:Npn \@@_range:Nnnn #1#2#3#4 + { + \tl_head:f + { + \exp_args:Nf \@@_range:nnnNn + { \tl_count:n {#2} } {#3} {#4} #1 {#2} + } + } +\cs_new:Npn \@@_range:nnnNn #1#2#3 + { + \exp_args:Nff \@@_range:nnNn + { + \exp_args:Nf \@@_range_normalize:nn + { \int_eval:n { #2 - 1 } } {#1} + } + { + \exp_args:Nf \@@_range_normalize:nn + { \int_eval:n {#3} } {#1} + } + } +\cs_new:Npn \@@_range:nnNn #1#2#3#4 + { + \if_int_compare:w #2 > #1 \exp_stop_f: \else: + \exp_after:wN { \exp_after:wN } + \fi: + \exp_after:wN #3 + \int_value:w \int_eval:n { #2 - #1 } \exp_after:wN ; + \exp_after:wN { \exp:w \@@_range_skip:w #1 ; { } #4 } + } +\cs_new:Npn \@@_range_skip:w #1 ; #2 + { + \if_int_compare:w #1 > 0 \exp_stop_f: + \exp_after:wN \@@_range_skip:w + \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; + \else: + \exp_after:wN \exp_end: + \fi: + } +\cs_new:Npn \@@_range:w #1 ; #2 + { + \exp_args:Nf \@@_range_collect:nn + { \@@_range_skip_spaces:n {#2} } {#1} + } +\cs_new:Npn \@@_range_skip_spaces:n #1 + { + \tl_if_head_is_space:nTF {#1} + { \exp_args:Nf \@@_range_skip_spaces:n {#1} } + { { } #1 } + } +\cs_new:Npn \@@_range_collect:nn #1#2 + { + \int_compare:nNnTF {#2} = 0 + {#1} + { + \exp_args:No \tl_if_head_is_space:nTF { \use_none:n #1 } + { + \exp_args:Nf \@@_range_collect:nn + { \@@_range_collect_space:nw #1 } + {#2} + } + { + \@@_range_collect:ff + { + \exp_args:No \tl_if_head_is_N_type:nTF { \use_none:n #1 } + { \@@_range_collect_N:nN } + { \@@_range_collect_group:nn } + #1 + } + { \int_eval:n { #2 - 1 } } + } + } + } +\cs_new:Npn \@@_range_collect_space:nw #1 ~ { { #1 ~ } } +\cs_new:Npn \@@_range_collect_N:nN #1#2 { { #1 #2 } } +\cs_new:Npn \@@_range_collect_group:nn #1#2 { { #1 {#2} } } +\cs_generate_variant:Nn \@@_range_collect:nn { ff } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_range_normalize:nn} +% This function converts an \meta{index} argument into an explicit +% position in the token list (a result of $0$ denoting \enquote{out of +% bounds}). Expects two explicit integer arguments: the \meta{index} +% |#1| and the string count~|#2|. If |#1| is negative, replace it by +% $|#1| + |#2| + 1$, then limit to the range $[0, |#2|]$. +% \begin{macrocode} +\cs_new:Npn \@@_range_normalize:nn #1#2 + { + \int_eval:n + { + \if_int_compare:w #1 < 0 \exp_stop_f: + \if_int_compare:w #1 < -#2 \exp_stop_f: + 0 + \else: + #1 + #2 + 1 + \fi: + \else: + \if_int_compare:w #1 < #2 \exp_stop_f: + #1 + \else: + #2 + \fi: + \fi: + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Viewing token lists} % % \begin{macro}{\tl_show:N, \tl_show:c, \tl_log:N, \tl_log:c, \@@_show:NN} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index c9ffbf3bb03..312d4546dac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx index d9dcd72c228..9506e49fbd0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-11} +% \date{Released 2018-12-12} % % \maketitle % |