summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-01-29 22:34:57 +0000
committerKarl Berry <karl@freefriends.org>2017-01-29 22:34:57 +0000
commitfabbcd2656be5dca3e1986ddcc8c827a23e9aedf (patch)
tree4f669dff01da1c31477e1e876fc878cddd5c06ab /Master/texmf-dist/source/latex/l3experimental
parentebc35af4250051fed5186c59ba4eaff9949142e2 (diff)
l3 (29jan17)
git-svn-id: svn://tug.org/texlive/trunk@43088 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental')
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx618
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins28
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx55
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx59
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx55
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx53
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins28
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx59
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx55
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx82
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins28
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx69
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx54
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins28
14 files changed, 717 insertions, 554 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
index e94691c1f4e..f3f31911d5c 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
@@ -1,44 +1,30 @@
% \iffalse
%
%% File l3sort.dtx (C) Copyright 2012,2014-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
+%
+% 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
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/11/21]
-%<package>\@ifpackagelater{expl3}{2016/11/21}
+\RequirePackage{expl3}[2017/01/28]
+%<package>\@ifpackagelater{expl3}{2017/01/28}
%<package> {}
%<package> {%
%<package> \PackageError{l3sort}{Support package l3kernel too old}
@@ -50,7 +36,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3sort.dtx 6760 2016-11-21 20:35:31Z joseph $
+\GetIdInfo$Id: l3sort.dtx 6829 2017-01-28 08:52:51Z joseph $
{L3 Experimental sorting functions}
%</driver|package>
%<*driver>
@@ -82,6 +68,7 @@
% \maketitle
%
% \begin{documentation}
+% ^^A todo: ask list about ltplain, mkpattern.tex, GFnotation.tex, texinfo.tex, lollipop-plain, etex-mac.tex,
%
% \section{\pkg{l3sort} documentation}
%
@@ -114,10 +101,11 @@
% inefficient way).
%
% \begin{texnote}
-% Internally, the code from \pkg{l3sort} stores items in \tn{toks}.
-% Thus, the \meta{comparison code} should not alter the
-% contents of any \tn{toks}, nor assume that they hold a
-% given value.
+% Internally, the code from \pkg{l3sort} stores items in \tn{toks}
+% registers allocated locally. Thus, the \meta{comparison code}
+% should not call \tn{newtoks} or other commands that allocate new
+% \tn{toks} registers. On the other hand, altering the value of a
+% previously allocated \tn{toks} register is not a problem.
% \end{texnote}
%
% \begin{function}{\seq_sort:Nn, \seq_gsort:Nn}
@@ -189,26 +177,25 @@
%
% \subsection{Variables}
%
-% \begin{variable}{\c_@@_max_length_int}
-% The maximum length of a sequence which will not overflow
-% the available registers depends on which engine is in use.
-% For $2^{N}$ registers, it is $3\cdot 2^{N-2}$: for that number
-% of items, at the last step the block size will be $2^{N-1}$,
-% and the two blocks to merge will be of sizes $2^{N-1}$ and
-% $2^{N-2}$ respectively. When merging, one of the blocks must
-% be copied to temporary registers; here, the smallest block,
-% of size $2^{N-2}$, will fill up exactly the $2^{N-2}$ free
-% registers, totalling $2^{N-1}+2^{N-2}+2^{N-2}=2^{N}$ registers.
-% \begin{macrocode}
-\int_const:Nn \c_@@_max_length_int
- { \sys_if_engine_luatex:TF { 49152 } { 24576 } }
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{\l_@@_length_int}
-% Length of the sequence which is being sorted.
+% \begin{variable}
+% {
+% \l_@@_length_int, \l_@@_min_int, \l_@@_top_int, \l_@@_max_int,
+% \l_@@_true_max_int
+% }
+% The sequence has \cs{l_@@_length_int} items and is stored from
+% \cs{l_@@_min_int} to $\cs{l_@@_top_int}-1$. While reading the
+% sequence in memory, we check that \cs{l_@@_top_int} remains at most
+% \cs{l_@@_max_int}, precomputed by \cs{@@_compute_range:}. That
+% bound is such that the merge sort will only use \tn{toks} registers
+% less than \cs{l_@@_true_max_int}, namely those that have not been
+% allocated for use in other code: the user's comparison code could
+% alter these.
% \begin{macrocode}
\int_new:N \l_@@_length_int
+\int_new:N \l_@@_min_int
+\int_new:N \l_@@_top_int
+\int_new:N \l_@@_max_int
+\int_new:N \l_@@_true_max_int
% \end{macrocode}
% \end{variable}
%
@@ -254,34 +241,168 @@
% \end{variable}
% \end{variable}
%
+% \subsection{Finding available \tn{toks} registers}
+%
+% \begin{macro}[int]{\@@_shrink_range:}
+% \begin{macro}[aux]{\@@_shrink_range_loop:}
+% After \cs{@@_compute_range:} (defined below) determines that
+% \tn{toks} registers between \cs{l_@@_min_int} (included) and
+% \cs{l_@@_true_max_int} (excluded) have not yet been assigned,
+% \cs{@@_shrink_range:} computes \cs{l_@@_max_int} to reflect the need
+% for a buffer when merging blocks in the merge sort. Given
+% $2^{n}\leq A\leq 2^{n}+2^{n-1}$ registers we can sort $\lfloor
+% A/2\rfloor+2^{n-2}$ items while if we have $2^{n}+2^{n-1}\leq A\leq
+% 2^{n+1}$ registers we can sort $A-2^{n-1}$ items. We first find out
+% a power $2^{n}$ such that $2^{n}\leq A\leq 2^{n+1}$ by repeatedly
+% halving \cs{l_@@_block_int}, starting at $2^{15}$ or $2^{14}$ namely
+% half the total number of registers, then we use the formulas and set
+% \cs{l_@@_max_int}.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_shrink_range:
+ {
+ \int_set:Nn \l_@@_A_int
+ { \l_@@_true_max_int - \l_@@_min_int + \c_one }
+ \int_set:Nn \l_@@_block_int { \c_max_register_int / \c_two }
+ \@@_shrink_range_loop:
+ \int_set:Nn \l_@@_max_int
+ {
+ \int_compare:nNnTF
+ { \l_@@_block_int * \c_three / \c_two } > \l_@@_A_int
+ {
+ \l_@@_min_int
+ + ( \l_@@_A_int - \c_one ) / \c_two
+ + \l_@@_block_int / \c_four
+ - \c_one
+ }
+ { \l_@@_true_max_int - \l_@@_block_int / \c_two }
+ }
+ }
+\cs_new_protected:Npn \@@_shrink_range_loop:
+ {
+ \if_int_compare:w \l_@@_A_int < \l_@@_block_int
+ \tex_divide:D \l_@@_block_int \c_two
+ \exp_after:wN \@@_shrink_range_loop:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}[int]{\@@_compute_range:, \@@_redefine_compute_range:}
+% \begin{variable}{\c_@@_max_length_int}
+% First find out what \tn{toks} have not yet been assigned. There are
+% many cases. In \LaTeXe{} with no package, available \tn{toks} range
+% from $\tn{count}15+1$ to \cs{c_max_register_int} included (this was
+% not altered despite the 2015 changes). When \tn{loctoks} is
+% defined, namely in plain (e)\TeX{}, or when the package \pkg{etex}
+% is loaded in \LaTeXe{}, redefine \cs{@@_compute_range:} to use the
+% range $\tn{count}265$ to $\tn{count}275-1$. The \pkg{elocalloc}
+% package also defines \tn{loctoks} but uses yet another number for
+% the upper bound, namely \cs{e@alloc@top} (minus one). We must check
+% for \tn{loctoks} every time a sorting function is called, as
+% \pkg{etex} or \pkg{elocalloc} could be loaded.
+%
+% In Con\TeX{}t MkIV the range is from
+% $|\c_syst_last_allocated_toks|+1$ to \cs{c_max_register_int}, and in
+% MkII it is from $|\lastallocatedtoks|+1$ to \cs{c_max_register_int}.
+% In all these cases, call \cs{@@_shrink_range:}. The \LaTeX3 format
+% mode is easiest: no \tn{toks} are ever allocated so available
+% \tn{toks} range from $0$ to \cs{c_max_register_int} and we
+% precompute the result of \cs{@@_shrink_range:}.
+% \begin{macrocode}
+%<*package>
+\cs_new_protected:Npn \@@_compute_range:
+ {
+ \int_set:Nn \l_@@_min_int { \tex_count:D 15 + \c_one }
+ \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one }
+ \@@_shrink_range:
+ \if_meaning:w \loctoks \tex_undefined:D \else:
+ \if_meaning:w \loctoks \scan_stop: \else:
+ \@@_redefine_compute_range:
+ \@@_compute_range:
+ \fi:
+ \fi:
+ }
+\cs_new_protected:Npn \@@_redefine_compute_range:
+ {
+ \cs_if_exist:cTF { ver@elocalloc.sty }
+ {
+ \cs_gset_protected:Npn \@@_compute_range:
+ {
+ \int_set:Nn \l_@@_min_int { \tex_count:D 265 }
+ \int_set_eq:NN \l_@@_true_max_int \e@alloc@top
+ \@@_shrink_range:
+ }
+ }
+ {
+ \cs_gset_protected:Npn \@@_compute_range:
+ {
+ \int_set:Nn \l_@@_min_int { \tex_count:D 265 }
+ \int_set:Nn \l_@@_true_max_int { \tex_count:D 275 }
+ \@@_shrink_range:
+ }
+ }
+ }
+\cs_if_exist:NT \loctoks { \@@_redefine_compute_range: }
+\tl_map_inline:nn { \lastallocatedtoks \c_syst_last_allocated_toks }
+ {
+ \cs_if_exist:NT #1
+ {
+ \cs_gset_protected:Npn \@@_compute_range:
+ {
+ \int_set:Nn \l_@@_min_int { #1 + \c_one }
+ \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one }
+ \@@_shrink_range:
+ }
+ }
+ }
+%</package>
+%<*initex>
+\int_const:Nn \c_@@_max_length_int
+ { ( \c_max_register_int + 1 ) * 3 / 4 }
+\cs_new_protected:Npn \@@_compute_range:
+ {
+ \int_set_eq:NN \l_@@_min_int \c_zero
+ \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one }
+ \int_set_eq:NN \l_@@_max_int \c_@@_max_length_int
+ }
+%</initex>
+% \end{macrocode}
+% \end{variable}
+% \end{macro}
+%
% \subsection{Protected user commands}
%
% \begin{macro}[int]{\@@_main:NNNnNn}
-% Sorting happens in three steps. First store items
-% in \tn{toks} registers ranging from $0$ to the length
-% of the list, while checking that the list is not too
+% Sorting happens in three steps. First store items in \tn{toks}
+% registers ranging from \cs{l_@@_min_int} to $\cs{l_@@_top_int}-1$,
+% while checking that the list is not too
% long. If we reach the maximum length, all further
% items are entirely ignored after raising an error.
% Secondly, sort the array of \tn{toks} registers,
-% using the user-defined sorting function, |#5|.
+% using the user-defined sorting function, |#6|.
% Finally, unpack the \tn{toks} registers (now sorted)
% into a variable of the right type, by \texttt{x}-expanding
-% the code in |#3|, specific to each type of list.
+% the code in |#4|, specific to each type of list.
% \begin{macrocode}
\cs_new_protected:Npn \@@_main:NNNnNn #1#2#3#4#5#6
{
\group_begin:
- \l_@@_length_int \c_zero
+%<package> \@@_disable_toksdef:
+ \@@_compute_range:
+ \int_set_eq:NN \l_@@_top_int \l_@@_min_int
#2 #5
{
- \if_int_compare:w \l_@@_length_int = \c_@@_max_length_int
+ \if_int_compare:w \l_@@_top_int = \l_@@_max_int
\@@_too_long_error:NNw #3 #5
\fi:
- \tex_toks:D \l_@@_length_int {##1}
- \tex_advance:D \l_@@_length_int \c_one
+ \tex_toks:D \l_@@_top_int {##1}
+ \tex_advance:D \l_@@_top_int \c_one
}
- \cs_set:Npn \sort_compare:nn ##1 ##2 { #6 }
- \l_@@_block_int \c_one
+ \int_set:Nn \l_@@_length_int
+ { \l_@@_top_int - \l_@@_min_int }
+ \cs_set:Npn \@@_compare:nn ##1 ##2 { #6 }
+ \int_set_eq:NN \l_@@_block_int \c_one
\@@_level:
\use:x
{
@@ -307,14 +428,14 @@
\cs_new_protected:Npn \seq_sort:Nn
{
\@@_main:NNNnNn \tl_set:Nn
- \seq_map_inline:Nn \seq_map_break:
- { \s__seq \@@_toks:NNw \exp_not:N \__seq_item:n 0 ; }
+ \seq_map_inline:Nn \seq_map_break:n
+ { \s__seq \@@_toks:NN \exp_not:N \__seq_item:n }
}
\cs_new_protected:Npn \seq_gsort:Nn
{
\@@_main:NNNnNn \tl_gset:Nn
- \seq_map_inline:Nn \seq_map_break:
- { \s__seq \@@_toks:NNw \exp_not:N \__seq_item:n 0 ; }
+ \seq_map_inline:Nn \seq_map_break:n
+ { \s__seq \@@_toks:NN \exp_not:N \__seq_item:n }
}
% \end{macrocode}
% \end{macro}
@@ -324,19 +445,19 @@
% the scope of the assignment. Mapping through the token
% list is done with \cs{tl_map_inline:Nn}, and producing
% the token list is very similar to sequences, removing
-% \cs{seq_item:Nn}.
+% \cs{__seq_item:n}.
% \begin{macrocode}
\cs_new_protected:Npn \tl_sort:Nn
{
\@@_main:NNNnNn \tl_set:Nn
- \tl_map_inline:Nn \tl_map_break:
- { \@@_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \tl_map_inline:Nn \tl_map_break:n
+ { \@@_toks:NN \prg_do_nothing: \prg_do_nothing: }
}
\cs_new_protected:Npn \tl_gsort:Nn
{
\@@_main:NNNnNn \tl_gset:Nn
- \tl_map_inline:Nn \tl_map_break:
- { \@@_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \tl_map_inline:Nn \tl_map_break:n
+ { \@@_toks:NN \prg_do_nothing: \prg_do_nothing: }
}
% \end{macrocode}
% \end{macro}
@@ -350,7 +471,7 @@
% for sequences and token lists. The first comma must be removed.
% An item must be wrapped in an extra set of braces if it contains
% either the space or the comma characters. This is taken care of
-% by \cs{clist_wrap_item:n}, but \cs{@@_toks:NNw} would simply
+% by \cs{clist_wrap_item:n}, but \cs{@@_toks:NN} would simply
% feed \cs{tex_the:D} \cs{tex_toks:D} \meta{number} as an
% argument to that function; hence we need to expand this argument
% once to unpack the register.
@@ -364,10 +485,10 @@
\clist_if_empty:NF #2
{
\@@_main:NNNnNn #1
- \clist_map_inline:Nn \clist_map_break:
+ \clist_map_inline:Nn \clist_map_break:n
{
\exp_last_unbraced:Nf \use_none:n
- { \@@_toks:NNw \exp_args:No \__clist_wrap_item:n 0 ; }
+ { \@@_toks:NN \exp_args:No \__clist_wrap_item:n }
}
#2 {#3}
}
@@ -376,10 +497,10 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_toks:NNw}
-% Unpack the various \tn{toks} registers, from $0$ to the length
-% of the list. The functions |#1| and |#2| allow us to treat the
-% three data structures in a unified way:
+% \begin{macro}{\@@_toks:NN, \@@_toks:NNw}
+% Unpack the various \tn{toks} registers, from \cs{l_@@_min_int} to
+% $\cs{l_@@_top_int}-1$. The functions |#1| and |#2| allow us to treat
+% the three data structures in a unified way:
% \begin{itemize}
% \item for sequences, they are \cs{exp_not:N} \cs{__seq_item:n},
% expanding to the \cs{__seq_item:n} separator, as expected;
@@ -391,9 +512,11 @@
% braces.
% \end{itemize}
% \begin{macrocode}
+\cs_new:Npn \@@_toks:NN #1#2
+ { \@@_toks:NNw #1 #2 \l_@@_min_int ; }
\cs_new:Npn \@@_toks:NNw #1#2#3 ;
{
- \if_int_compare:w #3 < \l_@@_length_int
+ \if_int_compare:w #3 < \l_@@_top_int
#1 #2 { \tex_the:D \tex_toks:D #3 }
\exp_after:wN \@@_toks:NNw \exp_after:wN #1 \exp_after:wN #2
\__int_value:w \__int_eval:w #3 + \c_one \exp_after:wN ;
@@ -402,7 +525,7 @@
% \end{macrocode}
% \end{macro}
%
-% \subsection{Sorting itself}
+% \subsection{Merge sort}
%
% \begin{macro}[int]{\@@_level:}
% This function is called once blocks of size \cs{l_@@_block_int}
@@ -414,9 +537,9 @@
\cs_new_protected:Npn \@@_level:
{
\if_int_compare:w \l_@@_block_int < \l_@@_length_int
- \l_@@_end_int \c_zero
+ \l_@@_end_int \l_@@_min_int
\@@_merge_blocks:
- \tex_multiply:D \l_@@_block_int \c_two
+ \tex_advance:D \l_@@_block_int \l_@@_block_int
\exp_after:wN \@@_level:
\fi:
}
@@ -427,14 +550,14 @@
% This function is called to merge a pair of blocks, starting at
% the last value of \cs{l_@@_end_int} (end-point of the previous
% pair of blocks). If shifting by one block to the right we reach
-% the end of the list, then this pass has ended: this end of the
-% list is sorted already. Store the result of that shift in $A$,
+% the end of the list, then this pass has ended: the end of the
+% list is sorted already. Otherwise, store the result of that shift in $A$,
% which will index the first block starting from the top end.
-% Then locate the end-point (maximum) of the upper block: shift
-% \texttt{end} upwards by one more block, checking that we don't
-% go beyond the length of the list. Copy this upper block of \tn{toks}
+% Then locate the end-point (maximum) of the second block: shift
+% \texttt{end} upwards by one more block, but keeping it
+% $\leq\texttt{top}$. Copy this upper block of \tn{toks}
% registers in registers above \texttt{length}, indexed by $C$:
-% this is covered by \cs{sort_copy_block:}. Once this is done we
+% this is covered by \cs{@@_copy_block:}. Once this is done we
% are ready to do the actual merger using \cs{@@_merge_blocks_aux:},
% after shifting $A$, $B$ and $C$ so that they point to the largest
% index in their respective ranges rather than pointing just beyond
@@ -445,33 +568,33 @@
{
\l_@@_begin_int \l_@@_end_int
\tex_advance:D \l_@@_end_int \l_@@_block_int
- \if_int_compare:w \__int_eval:w \l_@@_end_int < \l_@@_length_int
+ \if_int_compare:w \l_@@_end_int < \l_@@_top_int
\l_@@_A_int \l_@@_end_int
\tex_advance:D \l_@@_end_int \l_@@_block_int
- \if_int_compare:w \l_@@_end_int > \l_@@_length_int
- \l_@@_end_int \l_@@_length_int
+ \if_int_compare:w \l_@@_end_int > \l_@@_top_int
+ \l_@@_end_int \l_@@_top_int
\fi:
\l_@@_B_int \l_@@_A_int
- \l_@@_C_int \l_@@_length_int
- \sort_copy_block:
- \tex_advance:D \l_@@_A_int \c_minus_one
- \tex_advance:D \l_@@_B_int \c_minus_one
- \tex_advance:D \l_@@_C_int \c_minus_one
- \@@_merge_blocks_aux:
+ \l_@@_C_int \l_@@_top_int
+ \@@_copy_block:
+ \tex_advance:D \l_@@_A_int - \c_one
+ \tex_advance:D \l_@@_B_int - \c_one
+ \tex_advance:D \l_@@_C_int - \c_one
+ \exp_after:wN \@@_merge_blocks_aux:
\exp_after:wN \@@_merge_blocks:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\sort_copy_block:}
+% \begin{macro}[int]{\@@_copy_block:}
% We wish to store a copy of the \enquote{upper} block of
% \tn{toks} registers, ranging between the initial value of
% \cs{l_@@_B_int} (included) and \cs{l_@@_end_int}
% (excluded) into a new range starting at the initial value
-% of \cs{l_@@_C_int}, namely \cs{l_@@_length_int}.
+% of \cs{l_@@_C_int}, namely \cs{l_@@_top_int}.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_copy_block:
+\cs_new_protected:Npn \@@_copy_block:
{
\tex_toks:D \l_@@_C_int \tex_toks:D \l_@@_B_int
\tex_advance:D \l_@@_C_int \c_one
@@ -479,7 +602,7 @@
\if_int_compare:w \l_@@_B_int = \l_@@_end_int
\use_i:nn
\fi:
- \sort_copy_block:
+ \@@_copy_block:
}
% \end{macrocode}
% \end{macro}
@@ -487,7 +610,7 @@
% \begin{macro}[aux]{\@@_merge_blocks_aux:}
% At this stage, the first block starts at \cs{l_@@_begin_int},
% and ends at \cs{l_@@_A_int}, and the second block starts at
-% \cs{l_@@_length_int} and ends at \cs{l_@@_C_int}. The result
+% \cs{l_@@_top_int} and ends at \cs{l_@@_C_int}. The result
% of the merger is stored at positions indexed by \cs{l_@@_B_int},
% which starts at $\cs{l_@@_end_int}-1$ and decreases down to
% \cs{l_@@_begin_int}, covering the full range of the two blocks.
@@ -500,39 +623,72 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_merge_blocks_aux:
{
- \exp_after:wN \sort_compare:nn \exp_after:wN
+ \exp_after:wN \@@_compare:nn \exp_after:wN
{ \tex_the:D \tex_toks:D \exp_after:wN \l_@@_A_int \exp_after:wN }
\exp_after:wN { \tex_the:D \tex_toks:D \l_@@_C_int }
+ \prg_do_nothing:
+ \@@_return_mark:N
+ \@@_return_mark:N
+ \@@_return_none_error:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\sort_ordered:, \sort_reversed:}
+% \begin{macro}[aux]{\@@_return_mark:N}
+% \begin{macro}[aux]{\@@_return_none_error:, \@@_return_two_error:w}
+% The marker removes one token. Each comparison should call
+% \cs{sort_ordered:} or \cs{sort_reversed:} exactly
+% once. If neither is called, \cs{@@_return_none_error:} is called.
+% \begin{macrocode}
+\cs_new_protected:Npn \sort_ordered: #1 \@@_return_mark:N
+ { #1 \@@_return_mark:N \@@_return_two_error:w \@@_ordered: }
+\cs_new_protected:Npn \sort_reversed: #1 \@@_return_mark:N
+ { #1 \@@_return_mark:N \@@_return_two_error:w \@@_return_reversed: }
+\cs_new_protected:Npn \@@_return_mark:N #1 { }
+\cs_new_protected:Npn \@@_return_none_error:
+ {
+ \__msg_kernel_error:nnxx { sort } { return-none }
+ { \tex_the:D \tex_toks:D \l_@@_A_int }
+ { \tex_the:D \tex_toks:D \l_@@_C_int }
+ \@@_ordered:
}
+\cs_new_protected:Npn \@@_return_two_error:w
+ #1 \@@_return_none_error:
+ { \__msg_kernel_error:nn { sort } { return-two } }
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}[aux]{\sort_ordered:}
+% \begin{macro}[aux]{\@@_ordered:}
% If the comparison function returns \texttt{ordered},
-% then the second argument fed to \cs{sort_compare:nn}
+% then the second argument fed to \cs{@@_compare:nn}
% should remain to the right of the other one. Since
% we build the merger starting from the right, we copy
% that \tn{toks} register into the allotted range, then
% shift the pointers $B$ and $C$, and go on to do one
% more step in the merger, unless the second block has
% been exhausted: then the remainder of the first block
-% is already in the correct register and we are done
+% is already in the correct registers and we are done
% with merging those two blocks.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_ordered:
+\cs_new_protected:Npn \@@_ordered:
{
\tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int
- \tex_advance:D \l_@@_B_int \c_minus_one
- \tex_advance:D \l_@@_C_int \c_minus_one
- \if_int_compare:w \l_@@_C_int < \l_@@_length_int
+ \tex_advance:D \l_@@_B_int - \c_one
+ \tex_advance:D \l_@@_C_int - \c_one
+ \if_int_compare:w \l_@@_C_int < \l_@@_top_int
\use_i:nn
\fi:
\@@_merge_blocks_aux:
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}[aux]{\sort_reversed:}
+% \begin{macro}[aux]{\@@_return_reversed:}
% If the comparison function returns \texttt{reversed},
% then the next item to add to the merger is the first
% argument, contents of the \tn{toks} register $A$.
@@ -540,14 +696,14 @@
% go for one more step for the merger, unless the left
% block was exhausted ($A$ goes below the threshold).
% In that case, all remaining \tn{toks} registers in
-% the second block, indexed by $C$, should be copied
-% to the merger (see \cs{@@_merge_blocks_end:}).
+% the second block, indexed by $C$, are copied
+% to the merger by \cs{@@_merge_blocks_end:}.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_reversed:
+\cs_new_protected:Npn \@@_return_reversed:
{
\tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_A_int
- \tex_advance:D \l_@@_B_int \c_minus_one
- \tex_advance:D \l_@@_A_int \c_minus_one
+ \tex_advance:D \l_@@_B_int - \c_one
+ \tex_advance:D \l_@@_A_int - \c_one
\if_int_compare:w \l_@@_A_int < \l_@@_begin_int
\@@_merge_blocks_end: \use_i:nn
\fi:
@@ -561,13 +717,13 @@
% in the block indexed by $C$ to the merger indexed by $B$.
% The end can equally be detected by checking when $B$ reaches
% the threshold \texttt{begin}, or when $C$ reaches
-% \texttt{length}.
+% \texttt{top}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_merge_blocks_end:
{
\tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int
- \tex_advance:D \l_@@_B_int \c_minus_one
- \tex_advance:D \l_@@_C_int \c_minus_one
+ \tex_advance:D \l_@@_B_int - \c_one
+ \tex_advance:D \l_@@_C_int - \c_one
\if_int_compare:w \l_@@_B_int < \l_@@_begin_int
\use_i:nn
\fi:
@@ -586,8 +742,8 @@
%
% A prototypical version of expandable quicksort is as follows. If the
% argument has no item, return nothing, otherwise partition, using the
-% first item as a pivot (argument |#4| of |\__sort:nnNnn|). The
-% arguments of |\__sort:nnNnn| are 1.~items less than |#4|, 2.~items
+% first item as a pivot (argument |#4| of \cs{@@:nnNnn}). The
+% arguments of \cs{@@:nnNnn} are 1.~items less than |#4|, 2.~items
% greater or equal to |#4|, 3.~comparison, 4.~pivot, 5.~next item to
% test. If |#5| is the tail of the list, call \cs{tl_sort:nN} on |#1|
% and on |#2|, placing |#4| in between; |\use:ff| expands the parts to
@@ -617,41 +773,41 @@
% There are quite a few optimizations available here: the code below is
% less legible, but more than twice as fast.
%
-% In the simple version of the code, |\__sort:nnNnn| is called
+% In the simple version of the code, \cs{@@:nnNnn} is called
% \(O(n\ln n)\) times on average (the number of comparisons required by
% the quicksort algorithm). Hence most of our focus will be on
% optimizing that function.
%
% The first speed up is to avoid testing for the end of the list at
-% every call to |\__sort:nnNnn|. For this, the list is prepared by
+% every call to \cs{@@:nnNnn}. For this, the list is prepared by
% changing each \meta{item} of the original token list into
% \meta{command} \Arg{item}, just like sequences are stored. We arrange
% things such that the \meta{command} is the \meta{conditional} provided
% by the user: the loop over the \meta{prepared tokens} then looks like
% \begin{quote}
% \ttfamily
-% \cs{cs_new:Npn}~|\__sort_loop:wNn|~\ldots{}~|#6#7|\\
+% \cs{cs_new:Npn}~\cs{@@_loop:wNn}~\ldots{}~|#6#7|\\
% ~~|{|\\
% ~~~~|#6|~\Arg{pivot}~|{#7}|~\meta{loop big}~\meta{loop small}\\
% ~~~~~~\meta{extra arguments}\\
% ~~|}|\\
-% |\__sort_loop:wNn|~\ldots{}~\meta{prepared tokens}\\
+% \cs{@@_loop:wNn}~\ldots{}~\meta{prepared tokens}\\
% ~~\meta{end-loop}~|{}|~|\q_stop|
% \end{quote}
% In this example, which matches the structure of
-% \cs{__sort_quick_split_i:NnnnnNn} and a few other functions below, the
-% |\__sort_loop:wNn| auxiliary normally receives the user's
+% \cs{@@_quick_split_i:NnnnnNn} and a few other functions below, the
+% \cs{@@_loop:wNn} auxiliary normally receives the user's
% \meta{conditional} as~|#6| and an \meta{item} as~|#7|. This is
% compared to the \meta{pivot} (the argument~|#5|, not shown here), and
% the \meta{conditional} leaves the \meta{loop big} or \meta{loop small}
-% auxiliary, which both have the same form as |\__sort_loop:wNn|,
+% auxiliary, which both have the same form as \cs{@@_loop:wNn},
% receiving the next pair \meta{conditional} \Arg{item} as |#6|
% and~|#7|. At the end, |#6| is the \meta{end-loop} function, which
% terminates the loop.
%
% The second speed up is to minimize the duplicated tokens between the
% \texttt{true} and \texttt{false} branches of the conditional. For
-% this, we introduce two versions of |\__sort:nnNnn|, which receive
+% this, we introduce two versions of \cs{@@:nnNnn}, which receive
% the new item as~|#1| and place it either into the list~|#2| of items
% less than the pivot~|#4| or into the list~|#3| of items greater or
% equal to the pivot.
@@ -667,7 +823,7 @@
% {#6} {#2} { #3 {#1} } {#4}
% }
% \end{verbatim}
-% Note that the two functions have the form of |\__sort_loop:wNn| above,
+% Note that the two functions have the form of \cs{@@_loop:wNn} above,
% receiving as~|#5| the conditional or a function to end the loop. In
% fact, the lists~|#2| and~|#3| must be made of pairs \meta{conditional}
% \Arg{item}, so we have to replace~|{#6}| above by |{|~|#5|~|{#6}|~|}|,
@@ -675,14 +831,14 @@
% all argument numbers are shifted compared to this code.
%
% The third speed up is to avoid |\use:ff| using a continuation-passing
-% style: \cs{__sort_quick_split:NnNn} expects a list followed by
+% style: \cs{@@_quick_split:NnNn} expects a list followed by
% \cs{q_mark} \Arg{code}, and expands to \meta{code} \meta{sorted list}.
% Sorting the two parts of the list around the pivot is done with
% \begin{quote}
% \ttfamily
-% \cs{__sort_quick_split:NnNn} |#2| \ldots{} \cs{q_mark}\\
+% \cs{@@_quick_split:NnNn} |#2| \ldots{} \cs{q_mark}\\
% ~~|{|\\
-% ~~~~\cs{__sort_quick_split:NnNn} |#1| \ldots{} \cs{q_mark} \Arg{code}\\
+% ~~~~\cs{@@_quick_split:NnNn} |#1| \ldots{} \cs{q_mark} \Arg{code}\\
% ~~~~\Arg{pivot}\\
% ~~|}|
% \end{quote}
@@ -692,10 +848,10 @@
%
% The fourth speed up is avoid the recursive call to \cs{tl_sort:nN}
% with an empty first argument. For this, we introduce functions
-% similar to the |\__sort_i:nnnnNn| of the last example, but aware of
+% similar to the \cs{@@_i:nnnnNn} of the last example, but aware of
% whether the list of \meta{conditional} \Arg{item} read so far that are
% less than the pivot, and the list of those greater or equal, are empty
-% or not: see \cs{__sort_quick_split:NnNn} and functions defined below.
+% or not: see \cs{@@_quick_split:NnNn} and functions defined below.
% Knowing whether the lists are empty or not is useless if we do not use
% distinct ending codes as appropriate. The splitting auxiliaries
% communicate to the \meta{end-loop} function (that is initially placed
@@ -724,9 +880,9 @@
% \begin{macro}[EXP]{\tl_sort:nN}
% \begin{macro}[aux, EXP]
% {
-% \__sort_quick_prepare:Nnnn,
-% \__sort_quick_prepare_end:NNNnw,
-% \__sort_quick_cleanup:w
+% \@@_quick_prepare:Nnnn,
+% \@@_quick_prepare_end:NNNnw,
+% \@@_quick_cleanup:w
% }
% The code within the \cs{exp_not:f} sorts the list, leaving in most
% cases a leading \cs{exp_not:f}, which stops the expansion, letting
@@ -738,7 +894,7 @@
% item as~|#3|, and the item after that as~|#4|. The loop ends
% when~|#4| contains \cs{__prg_break_point:}, then the
% \texttt{prepare_end} auxiliary finds the prepared token list
-% as~|#4|. The scene is then set up for \cs{__sort_quick_split:NnNn},
+% as~|#4|. The scene is then set up for \cs{@@_quick_split:NnNn},
% which will sort the prepared list and perform the post action placed
% after \cs{q_mark}, namely removing the trailing \cs{s__stop} and
% \cs{q_stop} and leaving \cs{exp_stop_f:} to stop
@@ -750,36 +906,36 @@
{
\tl_if_blank:nF {#1}
{
- \__sort_quick_prepare:Nnnn #2 { } { }
+ \@@_quick_prepare:Nnnn #2 { } { }
#1
- { \__prg_break_point: \__sort_quick_prepare_end:NNNnw }
+ { \__prg_break_point: \@@_quick_prepare_end:NNNnw }
\q_stop
}
}
}
-\cs_new:Npn \__sort_quick_prepare:Nnnn #1#2#3#4
+\cs_new:Npn \@@_quick_prepare:Nnnn #1#2#3#4
{
\__prg_break: #4 \__prg_break_point:
- \__sort_quick_prepare:Nnnn #1 { #2 #3 } { #1 {#4} }
+ \@@_quick_prepare:Nnnn #1 { #2 #3 } { #1 {#4} }
}
-\cs_new:Npn \__sort_quick_prepare_end:NNNnw #1#2#3#4#5 \q_stop
+\cs_new:Npn \@@_quick_prepare_end:NNNnw #1#2#3#4#5 \q_stop
{
- \__sort_quick_split:NnNn #4 \__sort_quick_end:nnTFNn { }
- \q_mark { \__sort_quick_cleanup:w \exp_stop_f: }
+ \@@_quick_split:NnNn #4 \@@_quick_end:nnTFNn { }
+ \q_mark { \@@_quick_cleanup:w \exp_stop_f: }
\s__stop \q_stop
}
-\cs_new:Npn \__sort_quick_cleanup:w #1 \s__stop \q_stop {#1}
+\cs_new:Npn \@@_quick_cleanup:w #1 \s__stop \q_stop {#1}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}[EXP, aux]
% {
-% \__sort_quick_split:NnNn,
-% \__sort_quick_only_i:NnnnnNn,
-% \__sort_quick_only_ii:NnnnnNn,
-% \__sort_quick_split_i:NnnnnNn,
-% \__sort_quick_split_ii:NnnnnNn
+% \@@_quick_split:NnNn,
+% \@@_quick_only_i:NnnnnNn,
+% \@@_quick_only_ii:NnnnnNn,
+% \@@_quick_split_i:NnnnnNn,
+% \@@_quick_split_ii:NnnnnNn
% }
% The \texttt{only_i}, \texttt{only_ii}, \texttt{split_i} and
% \texttt{split_ii} auxiliaries receive a useless first argument, the
@@ -788,7 +944,7 @@
% items~|#4|, the pivot~|#5|, a \meta{function}~|#6|, and an
% item~|#7|. The \meta{function} is the user's \meta{conditional}
% except at the end of the list where it is
-% \cs{__sort_quick_end:nnTFNn}. The comparison is applied to the
+% \cs{@@_quick_end:nnTFNn}. The comparison is applied to the
% \meta{pivot} and the \meta{item}, and calls the \texttt{only_i} or
% \texttt{split_i} auxiliaries if the \meta{item} is smaller, and the
% \texttt{only_ii} or \texttt{split_ii} auxiliaries otherwise. In
@@ -802,34 +958,34 @@
% argument is always the user's \meta{conditional} rather than an
% ending function.
% \begin{macrocode}
-\cs_new:Npn \__sort_quick_split:NnNn #1#2#3#4
+\cs_new:Npn \@@_quick_split:NnNn #1#2#3#4
{
- #3 {#2} {#4} \__sort_quick_only_ii:NnnnnNn \__sort_quick_only_i:NnnnnNn
- \__sort_quick_single_end:nnnwnw
+ #3 {#2} {#4} \@@_quick_only_ii:NnnnnNn \@@_quick_only_i:NnnnnNn
+ \@@_quick_single_end:nnnwnw
{ #3 {#4} } { } { } {#2}
}
-\cs_new:Npn \__sort_quick_only_i:NnnnnNn #1#2#3#4#5#6#7
+\cs_new:Npn \@@_quick_only_i:NnnnnNn #1#2#3#4#5#6#7
{
- #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn \__sort_quick_only_i:NnnnnNn
- \__sort_quick_only_i_end:nnnwnw
+ #6 {#5} {#7} \@@_quick_split_ii:NnnnnNn \@@_quick_only_i:NnnnnNn
+ \@@_quick_only_i_end:nnnwnw
{ #6 {#7} } { #3 #2 } { } {#5}
}
-\cs_new:Npn \__sort_quick_only_ii:NnnnnNn #1#2#3#4#5#6#7
+\cs_new:Npn \@@_quick_only_ii:NnnnnNn #1#2#3#4#5#6#7
{
- #6 {#5} {#7} \__sort_quick_only_ii:NnnnnNn \__sort_quick_split_i:NnnnnNn
- \__sort_quick_only_ii_end:nnnwnw
+ #6 {#5} {#7} \@@_quick_only_ii:NnnnnNn \@@_quick_split_i:NnnnnNn
+ \@@_quick_only_ii_end:nnnwnw
{ #6 {#7} } { } { #4 #2 } {#5}
}
-\cs_new:Npn \__sort_quick_split_i:NnnnnNn #1#2#3#4#5#6#7
+\cs_new:Npn \@@_quick_split_i:NnnnnNn #1#2#3#4#5#6#7
{
- #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn \__sort_quick_split_i:NnnnnNn
- \__sort_quick_split_end:nnnwnw
+ #6 {#5} {#7} \@@_quick_split_ii:NnnnnNn \@@_quick_split_i:NnnnnNn
+ \@@_quick_split_end:nnnwnw
{ #6 {#7} } { #3 #2 } {#4} {#5}
}
-\cs_new:Npn \__sort_quick_split_ii:NnnnnNn #1#2#3#4#5#6#7
+\cs_new:Npn \@@_quick_split_ii:NnnnnNn #1#2#3#4#5#6#7
{
- #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn \__sort_quick_split_i:NnnnnNn
- \__sort_quick_split_end:nnnwnw
+ #6 {#5} {#7} \@@_quick_split_ii:NnnnnNn \@@_quick_split_i:NnnnnNn
+ \@@_quick_split_end:nnnwnw
{ #6 {#7} } {#3} { #4 #2 } {#5}
}
% \end{macrocode}
@@ -837,13 +993,13 @@
%
% \begin{macro}[EXP, aux]
% {
-% \__sort_quick_end:nnTFNn,
-% \__sort_quick_single_end:nnnwnw,
-% \__sort_quick_only_i_end:nnnwnw,
-% \__sort_quick_only_ii_end:nnnwnw,
-% \__sort_quick_split_end:nnnwnw,
+% \@@_quick_end:nnTFNn,
+% \@@_quick_single_end:nnnwnw,
+% \@@_quick_only_i_end:nnnwnw,
+% \@@_quick_only_ii_end:nnnwnw,
+% \@@_quick_split_end:nnnwnw,
% }
-% The \cs{__sort_quick_end:nnTFNn} appears instead of the user's
+% The \cs{@@_quick_end:nnTFNn} appears instead of the user's
% conditional, and receives as its arguments the pivot~|#1|, a fake
% item~|#2|, a \texttt{true} and a \texttt{false} branches |#3|
% and~|#4|, followed by an ending function~|#5| (one of the four
@@ -864,28 +1020,28 @@
% the pivot are sorted, then items less than the pivot, and the
% continuations are done in such a way to place the pivot in between.
% \begin{macrocode}
-\cs_new:Npn \__sort_quick_end:nnTFNn #1#2#3#4#5#6 {#5}
-\cs_new:Npn \__sort_quick_single_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
+\cs_new:Npn \@@_quick_end:nnTFNn #1#2#3#4#5#6 {#5}
+\cs_new:Npn \@@_quick_single_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
{ #5 {#3} #6 \q_stop }
-\cs_new:Npn \__sort_quick_only_i_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
+\cs_new:Npn \@@_quick_only_i_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
{
- \__sort_quick_split:NnNn #1
- \__sort_quick_end:nnTFNn { } \q_mark {#5}
+ \@@_quick_split:NnNn #1
+ \@@_quick_end:nnTFNn { } \q_mark {#5}
{#3}
#6 \q_stop
}
-\cs_new:Npn \__sort_quick_only_ii_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
+\cs_new:Npn \@@_quick_only_ii_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
{
- \__sort_quick_split:NnNn #2
- \__sort_quick_end:nnTFNn { } \q_mark { #5 {#3} }
+ \@@_quick_split:NnNn #2
+ \@@_quick_end:nnTFNn { } \q_mark { #5 {#3} }
#6 \q_stop
}
-\cs_new:Npn \__sort_quick_split_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
+\cs_new:Npn \@@_quick_split_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop
{
- \__sort_quick_split:NnNn #2 \__sort_quick_end:nnTFNn { } \q_mark
+ \@@_quick_split:NnNn #2 \@@_quick_end:nnTFNn { } \q_mark
{
- \__sort_quick_split:NnNn #1
- \__sort_quick_end:nnTFNn { } \q_mark {#5}
+ \@@_quick_split:NnNn #1
+ \@@_quick_end:nnTFNn { } \q_mark {#5}
{#3}
}
#6 \q_stop
@@ -895,7 +1051,50 @@
%
% \subsection{Messages}
%
-% \begin{macro}{\@@_too_long_error:NNw}
+% \begin{macro}[aux]{\@@_error:}
+% Bailing out of the sorting code is a bit tricky. It may not be safe
+% to use a delimited argument, so instead we redefine many
+% \pkg{l3sort} commands to be trivial, with \cs{@@_level:} getting rid
+% of the final assignment. This error recovery won't work in a group.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_error:
+ {
+ \cs_set_eq:NN \@@_merge_blocks_aux: \prg_do_nothing:
+ \cs_set_eq:NN \@@_merge_blocks: \prg_do_nothing:
+ \cs_set_protected:Npn \@@_level: \use:x ##1 { \group_end: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[aux]{\@@_disable_toksdef:, \@@_disabled_toksdef:n}
+% While sorting, \tn{toksdef} is locally disabled to prevent users
+% from using \tn{newtoks} or similar commands in their comparison
+% code: the \tn{toks} registers that would be assigned are in use by
+% \pkg{l3sort}. In format mode, none of this is needed since there is
+% no \tn{toks} allocator.
+% \begin{macrocode}
+%<*package>
+\cs_new_protected:Npn \@@_disable_toksdef:
+ { \cs_set_eq:NN \toksdef \@@_disabled_toksdef:n }
+\cs_new_protected:Npn \@@_disabled_toksdef:n #1
+ {
+ \__msg_kernel_error:nnx { sort } { toksdef }
+ { \token_to_str:N #1 }
+ \@@_error:
+ \tex_toksdef:D #1
+ }
+\__msg_kernel_new:nnnn { sort } { toksdef }
+ { Allocation~of~\iow_char:N\\toks~registers~impossible~while~sorting. }
+ {
+ The~comparison~code~used~for~sorting~a~list~has~attempted~to~
+ define~#1~as~a~new~\iow_char:N\\toks~register~using~\iow_char:N\\newtoks~
+ or~a~similar~command.~The~list~will~not~be~sorted.
+ }
+%</package>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[aux]{\@@_too_long_error:NNw}
% When there are too many items in a sequence, this is an error, and
% we clean up properly the mapping over items in the list: break using
% the type-specific breaking function |#1|.
@@ -903,20 +1102,43 @@
\cs_new_protected:Npn \@@_too_long_error:NNw #1#2 \fi:
{
\fi:
- \__msg_kernel_error:nnx { sort } { too-large } { \token_to_str:N #2 }
- #1
+ \__msg_kernel_error:nnxxx { sort } { too-large }
+ { \token_to_str:N #2 }
+ { \int_eval:n { \l_@@_true_max_int - \l_@@_min_int } }
+ { \int_eval:n { \l_@@_top_int - \l_@@_min_int } }
+ #1 \@@_error:
}
\__msg_kernel_new:nnnn { sort } { too-large }
{ The~list~#1~is~too~long~to~be~sorted~by~TeX. }
{
- TeX~has~\int_eval:n { \c_max_register_int + 1 }~registers~available:~
- this~only~allows~to~sorts~with~up~to~\int_use:N \c_@@_max_length_int
- \ items.~All~extra~items~will~be~ignored.
+ TeX~has~#2~toks~registers~still~available:~
+ this~only~allows~to~sort~with~up~to~#3~
+ items.~All~extra~items~will~be~deleted.
}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
+\__msg_kernel_new:nnnn { sort } { return-none }
+ { The~comparison~code~did~not~return. }
+ {
+ When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~
+ did~not~call~
+ \iow_char:N\\sort_ordered: ~nor~
+ \iow_char:N\\sort_reversed: .~
+ Exactly~one~of~these~should~be~called.
+ }
+\__msg_kernel_new:nnnn { sort } { return-two }
+ { The~comparison~code~returned~multiple~times. }
+ {
+ When~sorting~a~list,~the~code~to~compare~items~called~
+ \iow_char:N\\sort_ordered: ~or~
+ \iow_char:N\\sort_reversed: ~multiple~times.~
+ Exactly~one~of~these~should~be~called.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
%</initex|package>
% \end{macrocode}
%
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
index db6f7f2b5d0..b6165791b96 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File l3sort.ins Copyright (C) 2012 The LaTeX3 Project
+File l3sort.ins Copyright (C) 2012,2106 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
@@ -12,7 +12,18 @@ of this license is in the file
This file is part of the "l3experimental bundle" (The Work in LPPL)
and all files in that bundle must be distributed together.
-The released version of this bundle is available from CTAN.
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+ https://github.com/latex3/latex3
+
+for those people who are interested.
+
+-----------------------------------------------------------------------
+
+Any modification of this file should ensure that the copyright and
+license information is placed in the derived files.
\fi
@@ -21,12 +32,17 @@ The released version of this bundle is available from CTAN.
\preamble
-EXPERIMENTAL CODE
+Copyright (C) 2012-2016 The LaTeX3 Project
-Do not distribute this file without also distributing the
-source files specified above.
+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:
-Do not distribute a modified version of this file.
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3experimental bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
\endpreamble
% stop docstrip adding \endinput
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
index e3890c04222..4fc1e4ad543 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
@@ -1,43 +1,30 @@
% \iffalse meta-comment
%
%% File: l3flag.dtx Copyright (C) 2011-2012,2014-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/11/21]
-%<package>\@ifpackagelater{expl3}{2016/11/21}
+\RequirePackage{expl3}[2017/01/28]
+%<package>\@ifpackagelater{expl3}{2017/01/28}
%<package> {}
%<package> {%
%<package> \PackageError{l3flag}{Support package l3kernel too old}
@@ -49,7 +36,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3flag.dtx 6760 2016-11-21 20:35:31Z joseph $
+\GetIdInfo$Id: l3flag.dtx 6829 2017-01-28 08:52:51Z joseph $
{L3 Experimental flags}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
index c70b9f7c558..18b0be30f7e 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
@@ -1,43 +1,30 @@
% \iffalse meta-comment
%
%% File: l3regex.dtx Copyright (C) 2011-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/11/21]
-%<package>\@ifpackagelater{expl3}{2016/11/21}
+\RequirePackage{expl3}[2017/01/28]
+%<package>\@ifpackagelater{expl3}{2017/01/28}
%<package> {}
%<package> {%
%<package> \PackageError{l3regex}{Support package l3kernel too old}
@@ -49,7 +36,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3regex.dtx 6760 2016-11-21 20:35:31Z joseph $
+\GetIdInfo$Id: l3regex.dtx 6829 2017-01-28 08:52:51Z joseph $
{L3 Experimental regular expressions}
%</driver|package>
%<*driver>
@@ -3812,7 +3799,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_group_submatches:nNN #1#2#3
{
- \if_int_compare:w #1 > \c_minus_one
+ \if_int_compare:w #1 > - \c_one
\@@_toks_put_left:Nx #2 { \@@_action_submatch:n { #1 < } }
\@@_toks_put_left:Nx #3 { \@@_action_submatch:n { #1 > } }
\fi:
@@ -5578,7 +5565,7 @@
}
\prop_map_inline:Nn \l_@@_success_submatches_prop
{
- \if_int_compare:w ##1 \c_minus_one
+ \if_int_compare:w ##1 - \c_one
\exp_after:wN \@@_extract_e:wn \__int_value:w
\else:
\exp_after:wN \@@_extract_b:wn \__int_value:w
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
index 2412dead14b..7e43d73d790 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
@@ -1,41 +1,28 @@
% \iffalse meta-comment
%
%% File: l3str-convert.dtx Copyright (C) 2013-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str-convert.dtx 6699 2016-09-07 16:03:15Z bruno $
+\GetIdInfo$Id: l3str-convert.dtx 6805 2016-12-28 22:15:52Z joseph $
{L3 Experimental string encoding conversions}
%</driver|package>
%<*driver>
@@ -1949,14 +1936,14 @@
% step: use the quotient of |#1| by $64$, and |#1| as arguments for
% the looping auxiliary, and output the continuation byte
% corresponding to the remainder $|#2|-64|#1|+128$. The bizarre
-% construction |\c_minus_one + \c_zero *| removes the spurious initial
+% construction |- \c_one + \c_zero *| removes the spurious initial
% continuation byte (better methods welcome).
% \begin{macrocode}
\cs_new_protected:cpn { @@_convert_encode_utf8: }
{ \@@_convert_gmap_internal:N \@@_encode_utf_viii_char:n }
\cs_new:Npn \@@_encode_utf_viii_char:n #1
{
- \@@_encode_utf_viii_loop:wwnnw #1 ; \c_minus_one + \c_zero * ;
+ \@@_encode_utf_viii_loop:wwnnw #1 ; - \c_one + \c_zero * ;
{ 128 } { \c_zero }
{ 32 } { 192 }
{ 16 } { 224 }
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx
index 309c57a0f2e..c8dd27cd1e4 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx
@@ -1,41 +1,28 @@
% \iffalse meta-comment
%
-%% File: l3str-format.dtx Copyright (C) 2012-2013,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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX3 Project.
-%%
-%% -----------------------------------------------------------------------
+%% File: l3str-format.dtx Copyright (C) 2012-2013,2015,2016 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str-format.dtx 6589 2016-06-13 11:11:55Z joseph $
+\GetIdInfo$Id: l3str-format.dtx 6805 2016-12-28 22:15:52Z joseph $
{L3 Experimental string formatting}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
index e69aafec338..524d98947e3 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File l3str.ins Copyright (C) 2011, 2013, 2015 The LaTeX3 Project
+File l3str.ins Copyright (C) 2011,2013,2015,2016 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
@@ -12,7 +12,18 @@ of this license is in the file
This file is part of the "l3experimental bundle" (The Work in LPPL)
and all files in that bundle must be distributed together.
-The released version of this bundle is available from CTAN.
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+ https://github.com/latex3/latex3
+
+for those people who are interested.
+
+-----------------------------------------------------------------------
+
+Any modification of this file should ensure that the copyright and
+license information is placed in the derived files.
\fi
@@ -21,12 +32,17 @@ The released version of this bundle is available from CTAN.
\preamble
-EXPERIMENTAL CODE
+Copyright (C) 2011-2016 The LaTeX3 Project
-Do not distribute this file without also distributing the
-source files specified above.
+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:
-Do not distribute a modified version of this file.
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3experimental bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
\endpreamble
% stop docstrip adding \endinput
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
index 838da42e278..340125f1313 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
@@ -1,41 +1,28 @@
% \iffalse meta-comment
%
%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015,2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3tl-analysis.dtx 6589 2016-06-13 11:11:55Z joseph $
+\GetIdInfo$Id: l3tl-analysis.dtx 6805 2016-12-28 22:15:52Z joseph $
{L3 Experimental token lists analysis}
%</driver|package>
%<*driver>
@@ -412,7 +399,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_setup:n #1
{
- \int_set_eq:NN \tex_escapechar:D \c_minus_one
+ \int_set:Nn \tex_escapechar:D { - \c_one }
\exp_after:wN \@@_disable_loop:N
\tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: }
\__prg_break_point:
@@ -520,7 +507,7 @@
\c_one
\else:
\if_catcode:w \exp_not:N \l_@@_token \c_group_end_token
- \c_minus_one
+ - \c_one
\else:
\c_two
\fi:
@@ -670,7 +657,7 @@
= \l_@@_normal_int sp plus \l_@@_type_int sp \scan_stop:
\int_incr:N \l_@@_index_int
\int_zero:N \l_@@_normal_int
- \if_int_compare:w \l_@@_nesting_int = \c_minus_one
+ \if_int_compare:w \l_@@_nesting_int = - \c_one
\cs_set_eq:NN \@@_a_loop:w \scan_stop:
\fi:
}
@@ -815,7 +802,7 @@
\exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: }
\exp_not:N \__int_value:w `#1 \s__tl
\exp_not:N \exp_after:wN \exp_not:N \@@_b_normals:ww
- \exp_not:N \__int_value:w \exp_not:N \__int_eval:w \c_minus_one +
+ \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - \c_one +
}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
index 5dbea913085..7b566c75df3 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
@@ -1,43 +1,30 @@
% \iffalse meta-comment
%
%% File: l3tl-build.dtx Copyright (C) 2011-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/11/21]
-%<package>\@ifpackagelater{expl3}{2016/11/21}
+\RequirePackage{expl3}[2017/01/28]
+%<package>\@ifpackagelater{expl3}{2017/01/28}
%<package> {}
%<package> {%
%<package> \PackageError{l3tl-build}{Support package l3kernel too old}
@@ -49,7 +36,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3tl-build.dtx 6760 2016-11-21 20:35:31Z joseph $
+\GetIdInfo$Id: l3tl-build.dtx 6829 2017-01-28 08:52:51Z joseph $
{L3 Experimental token list construction}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
index 8efec4fc252..116912675d2 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
@@ -1,42 +1,28 @@
% \iffalse meta-comment
%
-%% File: xcoffins.dtx Copyright(C) 2010-2012,2014 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
+%% File: xcoffins.dtx Copyright(C) 2010-2012,2014,2016,2017 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: xcoffins.dtx 4728 2014-05-04 13:25:37Z joseph $
+\GetIdInfo$Id: xcoffins.dtx 6833 2017-01-28 20:01:31Z joseph $
{L3 Experimental design-level coffins}
%</driver|package>
%<*driver>
@@ -715,20 +701,20 @@
% \begin{macrocode}
\keys_define:nn { coffin }
{
- coffin1-hpole .tl_set:N = \l_@@_A_hpole_tl ,
- coffin1-hpole .value_required: ,
- coffin1-vpole .tl_set:N = \l_@@_A_vpole_tl ,
- coffin1-vpole .value_required: ,
- coffin2-hpole .tl_set:N = \l_@@_B_hpole_tl ,
- coffin2-hpole .value_required: ,
- coffin2-vpole .tl_set:N = \l_@@_B_vpole_tl ,
- coffin2-vpole .value_required: ,
- grow-bounding-box .bool_set:N = \l_@@_bound_box_grow_bool ,
- grow-bounding-box .default:n = true ,
- hoffset .dim_set:N = \l_@@_hoffset_dim ,
- hoffset .value_required: ,
- voffset .dim_set:N = \l_@@_voffset_dim ,
- voffset .value_required:
+ coffin1-hpole .tl_set:N = \l_@@_A_hpole_tl ,
+ coffin1-hpole .value_required:n = true ,
+ coffin1-vpole .tl_set:N = \l_@@_A_vpole_tl ,
+ coffin1-vpole .value_required:n = true ,
+ coffin2-hpole .tl_set:N = \l_@@_B_hpole_tl ,
+ coffin2-hpole .value_required:n = true ,
+ coffin2-vpole .tl_set:N = \l_@@_B_vpole_tl ,
+ coffin2-vpole .value_required:n = true ,
+ grow-bounding-box .bool_set:N = \l_@@_bound_box_grow_bool ,
+ grow-bounding-box .default:n = true ,
+ hoffset .dim_set:N = \l_@@_hoffset_dim ,
+ hoffset .value_required:n = true ,
+ voffset .dim_set:N = \l_@@_voffset_dim ,
+ voffset .value_required:n = true
}
\keys_set:nn { coffin }
{
diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
index f4289cf66fc..c3791a3ebd6 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File xcoffins.ins Copyright (C) 2010,2011 The LaTeX3 Project
+File xcoffins.ins Copyright (C) 2010,2011,2016 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
@@ -12,7 +12,18 @@ of this license is in the file
This file is part of the "l3experimental bundle" (The Work in LPPL)
and all files in that bundle must be distributed together.
-The released version of this bundle is available from CTAN.
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+ https://github.com/latex3/latex3
+
+for those people who are interested.
+
+-----------------------------------------------------------------------
+
+Any modification of this file should ensure that the copyright and
+license information is placed in the derived files.
\fi
@@ -21,12 +32,17 @@ The released version of this bundle is available from CTAN.
\preamble
-EXPERIMENTAL CODE
+Copyright (C) 2010-2016 The LaTeX3 Project
-Do not distribute this file without also distributing the
-source files specified above.
+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:
-Do not distribute a modified version of this file.
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3experimental bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
\endpreamble
% stop docstrip adding \endinput
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
index e96b5b65cdd..ae956e6e333 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
@@ -2,44 +2,30 @@
%
%% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach
%% (C) 2010-2016 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
+%
+% 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
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/11/21]
-%<package>\@ifpackagelater{expl3}{2016/11/21}
+\RequirePackage{expl3}[2017/01/28]
+%<package>\@ifpackagelater{expl3}{2017/01/28}
%<package> {}
%<package> {%
%<package> \PackageError{l3galley}{Support package l3kernel too old}
@@ -51,7 +37,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3galley.dtx 6760 2016-11-21 20:35:31Z joseph $
+\GetIdInfo$Id: l3galley.dtx 6829 2017-01-28 08:52:51Z joseph $
{L3 Experimental galley code}
%</driver|package>
%<*driver>
@@ -1949,11 +1935,8 @@
{
\seq_gset_eq:Nc \g_@@_tmpa_seq { g_@@_cutout_ #1 _seq }
\seq_gset_eq:Nc \g_@@_tmpb_seq { l_@@_parshape_ #1 _indent_seq }
- \tl_set:Nx \l_@@_tmp_tl
- {
- \seq_item:Nn \g_@@_tmpb_seq
- { \seq_count:N \g_@@_tmpb_seq }
- }
+ \seq_get_right:NNF \g_@@_tmpb_seq \l_@@_tmp_tl
+ { \tl_clear:N \l_@@_tmp_tl }
\tl_if_empty:NT \l_@@_tmp_tl
{ \tl_set:Nn \l_@@_tmp_tl { 0pt } }
\int_set:Nn \l_@@_tmp_int
@@ -1978,8 +1961,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_parshape_set_cutouts:N #1
{
- \tl_set:Nx \l_@@_tmp_tl
- { \seq_item:Nn #1 { \seq_count:N #1 } }
+ \seq_get_right:NNF #1 \l_@@_tmp_tl
+ { \tl_clear:N \l_@@_tmp_tl }
\tl_if_empty:NT \l_@@_tmp_tl
{ \tl_set:Nn \l_@@_tmp_tl { 0pt } }
\prg_replicate:nn { \int_abs:n \l_@@_tmp_int }
@@ -2540,7 +2523,7 @@
{
\mode_if_vertical:T
{
- \int_compare:nNnT \@dbltopnum = \c_minus_one
+ \int_compare:nNnT \@dbltopnum = { - \c_one }
{
\dim_compare:nNnT \tex_pagetotal:D < \topskip
{ \tex_hbox:D { } }
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
index 23d50b46d5f..d86baef3497 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
@@ -1,43 +1,29 @@
% \iffalse
%
%% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach
-%% (C) 2010-2012,2014 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
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3experimental bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
+%% (C) 2010-2012,2014,2106 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
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: xgalley.dtx 5375 2014-08-25 10:17:29Z joseph $
+\GetIdInfo$Id: xgalley.dtx 6805 2016-12-28 22:15:52Z joseph $
{L3 Experimental galley}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
index d29df2ffb2f..1d10cd47277 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File xgalley.ins Copyright (C) 2010-2012 The LaTeX3 Project
+File xgalley.ins Copyright (C) 2010-2012,2016 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
@@ -12,7 +12,18 @@ of this license is in the file
This file is part of the "l3experimental bundle" (The Work in LPPL)
and all files in that bundle must be distributed together.
-The released version of this bundle is available from CTAN.
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+ https://github.com/latex3/latex3
+
+for those people who are interested.
+
+-----------------------------------------------------------------------
+
+Any modification of this file should ensure that the copyright and
+license information is placed in the derived files.
\fi
@@ -21,12 +32,17 @@ The released version of this bundle is available from CTAN.
\preamble
-EXPERIMENTAL CODE
+Copyright (C) 2010-2016 The LaTeX3 Project
-Do not distribute this file without also distributing the
-source files specified above.
+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:
-Do not distribute a modified version of this file.
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3experimental bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
\endpreamble
% stop docstrip adding \endinput