diff options
51 files changed, 2646 insertions, 1969 deletions
diff --git a/Master/texmf-dist/doc/latex/expl3/expl3.pdf b/Master/texmf-dist/doc/latex/expl3/expl3.pdf Binary files differindex 6ae7f5f29d1..04e0fe9197c 100644 --- a/Master/texmf-dist/doc/latex/expl3/expl3.pdf +++ b/Master/texmf-dist/doc/latex/expl3/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/expl3/l3calc.pdf b/Master/texmf-dist/doc/latex/expl3/l3calc.pdf Binary files differindex f70c06bc799..279e452e653 100644 --- a/Master/texmf-dist/doc/latex/expl3/l3calc.pdf +++ b/Master/texmf-dist/doc/latex/expl3/l3calc.pdf diff --git a/Master/texmf-dist/doc/latex/expl3/source3.pdf b/Master/texmf-dist/doc/latex/expl3/source3.pdf Binary files differindex 91801d0783b..349f745fd50 100644 --- a/Master/texmf-dist/doc/latex/expl3/source3.pdf +++ b/Master/texmf-dist/doc/latex/expl3/source3.pdf diff --git a/Master/texmf-dist/doc/latex/expl3/source3body.tex b/Master/texmf-dist/doc/latex/expl3/source3body.tex index 9700fc44dbf..419069c2759 100644 --- a/Master/texmf-dist/doc/latex/expl3/source3body.tex +++ b/Master/texmf-dist/doc/latex/expl3/source3body.tex @@ -372,7 +372,7 @@ note}' section: \DocInput{l3clist.dtx} \DocInput{l3prop.dtx} -\DocInput{l3font.dtx} +%\DocInput{l3font.dtx} \DocInput{l3box.dtx} \DocInput{l3io.dtx} diff --git a/Master/texmf-dist/source/latex/expl3/expl3.dtx b/Master/texmf-dist/source/latex/expl3/expl3.dtx index 6535553a72a..0ff399f6404 100644 --- a/Master/texmf-dist/source/latex/expl3/expl3.dtx +++ b/Master/texmf-dist/source/latex/expl3/expl3.dtx @@ -37,7 +37,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: expl3.dtx 2156 2011-02-17 15:40:23Z will $ +\GetIdInfo$Id: expl3.dtx 2222 2011-04-09 12:47:12Z will $ {L3 Experimental code bundle wrapper}% %\iffalse %<*driver> @@ -298,6 +298,13 @@ % \item[g] variables whose value should only be set globally; % \item[l] variables whose value should only be set locally. %\end{arg-description} +% +% Separate functions are provided to assign data to local and global +% variables; for example, "\tl_set:Nn" and "\tl_gset:Nn" respectively +% set the value of a local or global `token list' variable. +% Note that it is a poor \TeX\ practise to intermix local and global +% assignments to a variable; otherwise you risk exhausting the save stack. +% \unskip\footnote{See the \TeX book, p.\,301, for further information.} % % The \m{type} will be in the list of available % \emph{data-types};\footnote{Of course, if a totally new data type is @@ -928,7 +935,7 @@ l3file, l3fp, l3luatex, - l3font +% l3font } \RequirePackage{calc} % \end{macrocode} @@ -948,8 +955,58 @@ } } % \end{macrocode} -% +% +%\begin{macro}{\_tl_check_exists:N} +% When used as a package, there is an option to be picky and to +% check definitions exist. +% These redefinitions are delayed until here so that all the necessary +% definitions are in place. +% \begin{macrocode} +\tex_ifodd:D \@l@expl@check@declarations@bool \scan_stop: + \cs_set_protected:Npn \_tl_check_exists:N #1 + { + \cs_if_exist:NF #1 + { + \msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N #1 } + } + } + \cs_set_protected:Npn \tl_set:Nn #1#2 + { + \_tl_check_exists:N #1 + \cs_set_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_set:Nx #1#2 + { + \_tl_check_exists:N #1 + \cs_set_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_gset:Nn #1#2 + { + \_tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_gset:Nx #1#2 + { + \_tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_set_eq:NN #1#2 + { + \_tl_check_exists:N #1 + \_tl_check_exists:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_set_protected:Npn \tl_gset_eq:NN #1#2 + { + \_tl_check_exists:N #1 + \_tl_check_exists:N #2 + \cs_gset_eq:NN #1 #2 + } +\tex_fi:D %</package> +% \end{macrocode} +%\end{macro} % % \end{implementation} % diff --git a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx b/Master/texmf-dist/source/latex/expl3/l3alloc.dtx index 509a7f9ae15..c095e913a82 100644 --- a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3alloc.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver> %\fi -\GetIdInfo$Id: l3alloc.dtx 2153 2011-02-16 10:37:45Z will $ +\GetIdInfo$Id: l3alloc.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental register allocation}% %\iffalse %<*driver> @@ -258,11 +258,6 @@ %</initex> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3basics.dtx b/Master/texmf-dist/source/latex/expl3/l3basics.dtx index f6c5cebd626..527146b66d7 100644 --- a/Master/texmf-dist/source/latex/expl3/l3basics.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3basics.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3basics.dtx 2158 2011-02-26 12:37:22Z mittelba $ +\GetIdInfo$Id: l3basics.dtx 2246 2011-04-23 08:01:25Z joseph $ {L3 Experimental basic definitions} %\iffalse %<*driver> @@ -1745,30 +1745,22 @@ % % \begin{macro}{\prg_return_true:} % \begin{macro}{\prg_return_false:} -% These break statements put \TeX\ in a \m{true} or \m{false} state. -% The idea is that the expansion of |\tex_romannumeral:D \c_zero| is -% \m{null} so we set off a |\tex_romannumeral:D|. It will on its -% way expand any |\else:| or |\fi:| that are waiting to be discarded -% anyway before finally arriving at the |\c_zero| we will place -% right after the conditional. After this expansion has terminated, -% we issue either |\if_true:| or |\if_false:| to put \TeX\ in the -% correct state. -% \begin{macrocode} -\cs_set:Npn \prg_return_true: { \exp_after:wN\if_true:\tex_romannumeral:D } -\cs_set:Npn \prg_return_false: {\exp_after:wN\if_false:\tex_romannumeral:D } -% \end{macrocode} -% An extended state space could instead utilize |\tex_ifcase:D|: -% \begin{verbatim} -% \cs_set:Npn \prg_return_true: { -% \exp_after:wN\tex_ifcase:D \exp_after:wN \c_zero \tex_romannumeral:D -% } -% \cs_set:Npn \prg_return_false: { -% \exp_after:wN\tex_ifcase:D \exp_after:wN \c_one \tex_romannumeral:D -% } -% \cs_set:Npn \prg_return_error: { -% \exp_after:wN\tex_ifcase:D \exp_after:wN \c_two \tex_romannumeral:D -% } -% \end{verbatim} +% The idea here is that \cs{tex_romanumeral:D} will expand fully any +% \cs{tex_else:D} and the \cs{tex_fi:D} that are waiting to be discarded, +% before reaching the \cs{c_zero} which will leave the expansion null. +% The code can then leave either the first or second argument in the +% input stream. This means that all of the branching code has to contain +% at least two tokens: see how the logical tests are actually implemented +% to see this. +% \begin{macrocode} +\cs_set_nopar:Npn \prg_return_true: + { \exp_after:wN \use_i:nn \tex_romannumeral:D } +\cs_set_nopar:Npn \prg_return_false: + { \exp_after:wN \use_ii:nn \tex_romannumeral:D } +% \end{macrocode} +% An extended state space could be implemented by including a more +% elaborate function in place of \cs{use_i:nn}/\cs{use_ii:nn}. Provided +% two arguments are absorbed then the code will work. % \end{macro} % \end{macro} % @@ -1904,67 +1896,91 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\prg_generate_p_form_parm:Nnnnn, +% \begin{macro}[aux] +% { +% \prg_generate_p_form_parm:Nnnnn, % \prg_generate_TF_form_parm:Nnnnn, % \prg_generate_T_form_parm:Nnnnn, % \prg_generate_F_form_parm:Nnnnn % } -% How to generate the various forms. The "parm" types here takes the +% How to generate the various forms. The |parm| types here takes the % following arguments: 1: how to define (an N-type), 2: name, 3: -% signature, 4: parameter text (or empty), 5: replacement. +% signature, 4: parameter text (or empty), 5: replacement. Remember that +% the logic-returning functions expect two arguments to be present after +% \cs{c_zero}: notice the construction of the different variants +% relies on this, and that the |TF| variant will be slightly faster +% than the |T| version. % \begin{macrocode} -\cs_set:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc #1 {#2_p:#3}#4{#5 \c_zero - \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: +\cs_set_protected:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 _p: #3 } #4 + { + #5 \c_zero + \c_true_bool \c_false_bool + } } -} -\cs_set:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3TF}#4{#5 \c_zero - \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: +\cs_set_protected:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 T } #4 + { + #5 \c_zero + \use:n \use_none:n + } } -} -\cs_set:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3T}#4{#5 \c_zero - \else:\exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 F } #4 + { + #5 \c_zero + { } + } } -} -\cs_set:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3F}#4{#5 \c_zero - \exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 TF } #4 + { #5 \c_zero } } -} % \end{macrocode} % \end{macro} -% -% \begin{macro}[aux]{\prg_generate_p_form_count:Nnnnn, +% \begin{macro}[aux] +% { +% \prg_generate_p_form_count:Nnnnn, % \prg_generate_TF_form_count:Nnnnn, % \prg_generate_T_form_count:Nnnnn, % \prg_generate_F_form_count:Nnnnn % } -% How to generate the various forms. The "count" types here use a -% number to insert the correct parameter text, otherwise like the -% "parm" functions above. +% The |count| form is similar, but of course requires a number rather +% than a primitive argument specification. % \begin{macrocode} -\cs_set:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2_p:#3} #1 {#4}{#5 \c_zero - \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: +\cs_set_protected:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4} + { + #5 \c_zero + \c_true_bool \c_false_bool + } } -} -\cs_set:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3TF} #1 {#4}{#5 \c_zero - \exp_after:wN\use_i:nn\else:\exp_after:wN\use_ii:nn\fi: +\cs_set_protected:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 T } #1 {#4} + { + #5 \c_zero + \use:n \use_none:n + } } -} -\cs_set:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3T} #1 {#4}{#5 \c_zero - \else:\exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 F } #1 {#4} + { + #5 \c_zero + { } + } } -} -\cs_set:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3F} #1 {#4}{#5 \c_zero - \exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 TF } #1 {#4} + { #5 \c_zero } } -} % \end{macrocode} % \end{macro} % @@ -2021,44 +2037,58 @@ % % \begin{macro}{\cs_to_str:N} % \begin{macro}[aux]{\cs_to_str_aux:w} -% This converts a control sequence into the character string of its -% name, removing the leading escape character. This turns out to be -% a non-trivial matter as there a different cases: -% \begin{itemize} +% This converts a control sequence into the character string of its +% name, removing the leading escape character. This turns out to be +% a non-trivial matter as there a different cases: +% \begin{itemize} % \item The usual case of a printable escape character; % \item the case of a non-printable escape characters, e.g., when % the value of |\tex_escapechar:D| is negative; % \item when the escape character is a space. -% \end{itemize} -% The route chosen is this: If |\token_to_str:N \a| produces a -% non-space escape char, then this will produce two tokens. If the -% escape char is non-printable, only one token is produced. If the -% escape char is a space, then a space token plus one token -% character token is produced. If we augment the result of this -% expansion with the letters |ax| we get the following three -% scenarios (with \meta{X} being a printable non-space escape -% character): -% \begin{itemize} -% \item \meta{X}"aax" -% \item "aax" -% \item " aax" -% \end{itemize} -% In the second and third case, putting an auxiliary function in front -% reading undelimited arguments will treat them the same, removing the -% space token for us automatically. Therefore, if we test the second -% and third argument of what such a function reads, in case 1 we will -% get true and in cases 2 and 3 we will get false. If we choose to -% optimize for the usual case of a printable escape char, we can do it -% like this (again getting TeX to remove the leading space for us): -% \begin{macrocode} -\cs_set_nopar:Npn \cs_to_str:N { - \if:w \exp_after:wN \cs_str_aux:w\token_to_str:N \a ax\q_stop - \else: - \exp_after:wN \exp_after:wN\exp_after:wN \use_ii:nn - \fi: - \exp_after:wN \use_none:n \token_to_str:N -} -\cs_set:Npn \cs_str_aux:w #1#2#3#4\q_stop{#2#3} +% \end{itemize} +% One approach to solve this is to test how many tokens result from +% |\token_to_str:N \a|. If there are two tokens, then the escape +% character is printable, while if it is non-printable then only +% one is present. +% +% However, there is an additional complication: the control +% sequence itself may start with a space. Clearly that should \emph{not} be +% lost in the process of converting to a string. So the approach adopted is +% a little more intricate still. When the escape character is printable, +% \verb*|\token_to_str:N \ | yields the escape character itself and a space. +% The escape sequence will terminate the expansion started by +% \cs{tex_romannumeral:D}, which is a negative number and so will not +% gobble the escape character even if it's a number. The \cs{tex_if:D} +% test will then be \texttt{false}, and the na\"ive approach of gobbling +% the first character of the \cs{token_to_str:N} version of the control +% sequence will work, even if the first character is a space. +% The second case is that the escape character is itself a space. In this +% case, the escape character space is consumed terminating the first +% \cs{tex_romannumeral:D}, and \cs{cs_to_str_aux:w} is expanded. This +% inserts a space, making the \cs{tex_if:D} test \texttt{true}. The +% second \cs{tex_romannumeral:D} will then execute the \cs{token_to_str:N}, +% with the escape-character space being consumed by the +% \cs{tex_romannumeral:D}, and thus leaving the control sequence name in the +% input stream. The final case is where the escape character is not printable. +% The flow here starts with the \verb*|\token_to_str:N \ | giving just a +% space, which terminates the first \cs{tex_romannumeral:D} but leaves no +% token for the \cs{tex_if:D} test. This means that the \cs{tex_romannumeral:D} +% is executed before the test is finished. The result is that the +% \cs{tex_fi:D}, expanded before the \cs{tex_if:D} is finished, becomes +% \cs{tex_relax:D} \cs{tex_fi:D}, and the \cs{tex_relax:D} is then used in +% the \cs{tex_if:D} test. +% In this case, \cs{token_to_str:N} is therefore used with no gobbling at +% all, which is exactly what is needed in this case. +% \begin{macrocode} +\cs_set:Npn \cs_to_str:N + { + \tex_if:D \tex_romannumeral:D - `0 \token_to_str:N \ % + \cs_to_str_aux:w + \tex_fi:D + \exp_after:wN \use_none:n \token_to_str:N + } +\cs_set_nopar:Npn \cs_to_str_aux:w #1 \use_none:n + { ~ \tex_romannumeral:D - `0 \tex_fi:D } % \end{macrocode} % \end{macro} % \end{macro} @@ -3151,11 +3181,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % diff --git a/Master/texmf-dist/source/latex/expl3/l3box.dtx b/Master/texmf-dist/source/latex/expl3/l3box.dtx index fbf531008d2..4ee8af4cf5f 100644 --- a/Master/texmf-dist/source/latex/expl3/l3box.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3box.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3box.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3box.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Box module} %\iffalse %<*driver> @@ -1029,11 +1029,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3calc.dtx b/Master/texmf-dist/source/latex/expl3/l3calc.dtx index 0e525ab5704..4d477acf7be 100644 --- a/Master/texmf-dist/source/latex/expl3/l3calc.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3calc.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3calc.dtx 1776 2010-02-07 21:51:23Z joseph $ +\GetIdInfo$Id: l3calc.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental calc module} %\iffalse %<*driver> @@ -1158,11 +1158,6 @@ % \end{macro} % \end{macro} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx index 842adff6471..d7217f8eb97 100644 --- a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx @@ -37,7 +37,7 @@ %</driver|package> %\fi \errorcontextlines=999 -\GetIdInfo$Id: l3candidates.dtx 2179 2011-03-06 09:06:18Z mittelba $ +\GetIdInfo$Id: l3candidates.dtx 2233 2011-04-14 06:32:45Z joseph $ {L3 Experimental 'extras' module} %\iffalse %<*driver> @@ -251,14 +251,16 @@ % \begin{macrocode} \group_begin: \char_make_active:N \^^@ -\cs_set:Npn \char_tmp:NN { - \cs_gnew:Npn #1 ##1 { - \char_make_active:n {`##1} - \group_begin: - \tex_lccode:D `\^^@ `##1 - \tex_lowercase:D{\group_end: #2 ^^@} +\cs_set:Npn \char_tmp:NN #1#2 + { + \cs_new:Npn #1 ##1 + { + \char_make_active:n { `##1 } + \group_begin: + \tex_lccode:D `\^^@ `##1 + \tex_lowercase:D { \group_end: #2 ^^@ } + } } -} \char_tmp:NN \char_active_set:Npn \cs_set:Npn \char_tmp:NN \char_active_set:Npx \cs_set:Npx \char_tmp:NN \char_active_gset:Npn \cs_gset:Npn @@ -303,15 +305,6 @@ % \end{macrocode} % % -% \begin{macro}{\seq_get_length:NN} -% \begin{macrocode} -\cs_new:Nn \seq_get_length:NN { - \int_zero:N #1 - \seq_map_inline:Nn #2 { \int_incr:N #1} -} -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} \cs_new:Nn \seq_mapthread_function:NNN { \seq_get_length:NN \l_tmpa_int #1 @@ -409,9 +402,19 @@ % \end{macrocode} % \end{macro} % -%\begin{macro}{\clist_length:N} -%\begin{macro}{\clist_length:c} -%\begin{macro}{\clist_length:n} +% \begin{macro}{\seq_length:N} +% \begin{macrocode} +\cs_new:Nn \seq_length:N { + \tex_number:D \etex_numexpr:D + 0 + \seq_map_function:NN #1 \tl_elt_count_aux:n + \scan_stop: +} +\cs_generate_variant:Nn \seq_length:N { c } +% \end{macrocode} +% \end{macro} +% +%\begin{macro}{\clist_length:N,\clist_length:c,\clist_length:n} % Counting the elements in a comma-list is straight-forward, using the % same approach as for other lists of tokens. % \begin{macrocode} @@ -430,12 +433,8 @@ } % \end{macrocode} %\end{macro} -%\end{macro} -%\end{macro} % -%\begin{macro}{\clist_item:Nn} -%\begin{macro}{\clist_item:cn} -%\begin{macro}{\clist_item:nn} +%\begin{macro}{\clist_item:Nn,\clist_item:cn,\clist_item:nn} %\begin{macro}[aux]{\clist_element_aux:nw} % Recovering an item from a list is indexed from \( 0 \), with negative % numbers meaning ``from the end of the list''. So the first test @@ -471,20 +470,60 @@ % \end{macrocode} %\end{macro} %\end{macro} -%\end{macro} -%\end{macro} % % +% \begin{macro}{\seq_map_expandable:NN} +% Expandable form of "\seq_map_function:NN". % \begin{macrocode} -%</initex|package> +\cs_new:Npn \seq_map_expandable:NN #1#2 { + \exp_last_unbraced:NNo \seq_map_exp_aux:Nw #2 #1 + \seq_elt:w \q_recursion_tail \seq_elt_end: + \q_recursion_stop +} +\cs_new:Npn \seq_map_exp_aux:Nw #1 \seq_elt:w #2 \seq_elt_end: { + \quark_if_recursion_tail_stop:n {#2} + #1 {#2} + \seq_map_exp_aux:Nw #1 +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\seq_item:Nn,\seq_item:cn} +% \begin{macrocode} +\cs_new:Npn \seq_item:Nn #1#2 { + \int_compare:nNnTF {#2} < { 0 } + { + \exp_args:Nfo + \seq_item_aux:nn { \int_eval:n {\seq_length:N #1 + #2} } {#1} + } + { + \exp_args:Nno \seq_item_aux:nn {#2} {#1} + } +} +\cs_generate_variant:Nn \seq_item:Nn { c } +\cs_new:Npn \seq_item_aux:nn #1#2 { + \seq_item_aux:nw {#1} #2 + \seq_elt:w \q_recursion_tail \seq_elt_end: + \q_recursion_stop +} +\cs_new:Npn \seq_item_aux:nw #1 \seq_elt:w #2 \seq_elt_end: { + \int_compare:nNnTF {#1} = { 0 } + { \use_i_delimit_by_q_recursion_stop:nw {#2} } + { + \quark_if_recursion_tail_stop:n {#2} + \exp_args:Nf \seq_item_aux:nw { \int_eval:n { #1 - 1 } } + } +} % \end{macrocode} +% \end{macro} +%% % % \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> +%</initex|package> % \end{macrocode} % +% % \end{implementation} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3chk.dtx b/Master/texmf-dist/source/latex/expl3/l3chk.dtx index ad016f91c91..9153433d4a5 100644 --- a/Master/texmf-dist/source/latex/expl3/l3chk.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3chk.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3chk.dtx 1362 2009-05-28 20:19:21Z joseph $ +\GetIdInfo$Id: l3chk.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental check module} %\iffalse %<*driver> @@ -380,12 +380,6 @@ % \end{macro} % % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3clist.dtx b/Master/texmf-dist/source/latex/expl3/l3clist.dtx index bfec9e082b6..612bddb82cc 100644 --- a/Master/texmf-dist/source/latex/expl3/l3clist.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3clist.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3clist.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3clist.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental comma separated lists} %\iffalse %<*driver> @@ -1126,12 +1126,6 @@ %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -%\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3doc.dtx b/Master/texmf-dist/source/latex/expl3/l3doc.dtx index b374d8c5942..9ea04f3260a 100644 --- a/Master/texmf-dist/source/latex/expl3/l3doc.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3doc.dtx @@ -77,7 +77,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2180 2011-03-06 10:38:35Z will $ +\GetIdInfo$Id: l3doc.dtx 2228 2011-04-10 08:37:13Z joseph $ {L3 Experimental documentation class} %</driver|class> % @@ -85,6 +85,7 @@ Do not distribute a modified version of this file. \ProvidesFile{\filename.\filenameext} [\filedate\space v\fileversion\space\filedescription] \documentclass{l3doc} +\usepackage{framed} \begin{document} \DocInput{l3doc.dtx} \end{document} @@ -269,6 +270,8 @@ Do not distribute a modified version of this file. % \DescribeEnv{syntax} % Two heavily-used environments are defined to describe the syntax % of \textsf{expl3} functions and variables. +% \begin{framed} +% \vspace{-\baselineskip} % \begin{verbatim} % \begin{function}{ list_of , functions } % \begin{syntax} @@ -277,22 +280,49 @@ Do not distribute a modified version of this file. % <description> % \end{function} % \end{verbatim} -% +% \vspace{-2\baselineskip} +% \hrulefill % \begin{function}{ list_of , functions } % \begin{syntax} % "\foo_bar:" \Arg{meta} <test1> % \end{syntax} % <description> % \end{function} +% \end{framed} +% +% Function environments take an optional argument to indicate whether the function(s) it +% describes are expandable or defined in conditional forms. Use "EXP", "TF", or "pTF" +% for this; note that "pTF" implies "EXP" since predicates must always be expandable. +% As an example: +% \begin{framed} +% \vspace{-\baselineskip} +% \begin{verbatim} +% \begin{function}[pTF]{ \cs_if_exist:N } +% \begin{syntax} +% "\cs_if_exist_p:N" <cs> +% \end{syntax} +% <description> +% \end{function} +% \end{verbatim} +% \vspace{-2\baselineskip} +% \hrulefill +% \begin{function}[pTF]{ \cs_if_exist:N } +% \begin{syntax} +% "\cs_if_exist_p:N" <cs> +% \end{syntax} +% <description> +% \end{function} +% \end{framed} % -% Functions may be suffixed by an optional flag or two to indicate whether it is -% expandable or defined in conditional forms. Use "/" to separate the function name -% from the flag(s) and then add any of "(EXP)", "(TF)", or "(pTF)" for this. -% Note that "(pTF)" implies "(EXP)" since predicates must always be expandable. +% Note that the list of functions used to use "|" as a separator instead, +% and this syntax is still supported. % -% Note that the list of functions used to use "|" as a separator instead, and this syntax is still supported. +% In the old syntax, individual functions could be suffixed by an optional flag or +% two to indicate the same information given in the optional argument. +% This is still supported; use "/" to separate the function name +% from the flag(s) and then add any of "(EXP)", "(TF)", or "(pTF)". % -% \DescribeEnv{function} +% \DescribeEnv{variable} % If you are documenting a variable instead of a function, use the "variable" environment instead; it behaves identically to the "function" environment above. % % \subsection{Describing functions in the implementation} @@ -300,7 +330,7 @@ Do not distribute a modified version of this file. % \DescribeEnv{macro} % The well-used environment from \LaTeXe\ for marking up the implementation % of macros/functions remains the \env{macro} environment. -% One change in \pkg{l3doc}: it now accepts comma-separated lists +% Some changes in \pkg{l3doc}: it now accepts comma-separated lists % of functions, to avoid a very large number of consecutive "\end{macro}" % statements. % \begin{verbatim} @@ -316,23 +346,36 @@ Do not distribute a modified version of this file. % environment. In this case, write "\begin[aux]{macro}" and it will be % marked as such; its margin call-out will be printed in grey. % +% Similarly, an internal package function still requires documentation +% but usually will not be documented for users to see; these can be marked +% as such with "\begin[internal]{macro}". +% % For documenting \pkg{expl3}-type conditionals, you may also pass this % environment a "TF" option (and omit it from the function name) to denote that % the function is provided with "T", "F", and "TF" suffixes. % A similar "pTF" option will print both "TF" and "_p" predicate forms. % -% \DescribeMacro{\testfile} +% +% \DescribeMacro{\TestFiles} +% \cs{TestFiles}\marg{list of files} is used to indicate which test files +% are used for the current code; they will be printed in the documentation. +% +% \DescribeMacro{\UnitTested} % Within a "macro" environment, it is a good idea to mark whether a unit test has -% been created for the commands it defines. This is indicated by writing \cs{testfile}\marg{filename} +% been created for the commands it defines. This is indicated by writing \cs{UnitTested} % anywhere within "\begin{macro}" \dots "\end{macro}". -% The first time a test file is referred to its filename will be printed in the documentation; -% subsequent referals will be noted by \textsf{l3doc} but not printed. % % If the class option "checktest" is enabled, then it is an \emph{error} to have a % "macro" environment without a \cs{testfile} file. This is intended for large packages such % as \pkg{expl3} that should have absolutely comprehensive tests suites and whose authors % may not always be as sharp at adding new tests with new code as they should be. % +% \DescribeMacro{\TestMissing} +% If a function is missing a test, this may be flagged by writing (as many times as needed) +% \cs{TestMissing}\marg{explanation of test required}. +% These missing tests will be summarised in the listing printed at the end of the +% compilation run. +% % \DescribeEnv{variable} % When documenting variable definitions, use the "variable" environment instead. % It will, here, behave identically to the "macro" environment, except that if the class @@ -500,7 +543,7 @@ Do not distribute a modified version of this file. % \begin{macrocode} \LoadClass{article} \RequirePackage{doc} -\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore} +\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes} % \end{macrocode} % % \begin{macrocode} @@ -518,11 +561,23 @@ Do not distribute a modified version of this file. \let\doc@verbatim\verbatim \let\enddoc@verbatim\endverbatim \let\doc@@verbatim\@verbatim +\expandafter\let\csname doc@verbatim*\expandafter\endcsname + \csname verbatim*\endcsname +\expandafter\let\csname enddoc@verbatim*\expandafter\endcsname + \csname endverbatim*\endcsname +\expandafter\let\csname doc@@verbatim*\expandafter\endcsname + \csname @verbatim*\endcsname \RequirePackage{verbatim} \AtBeginDocument{% \let\verbatim\doc@verbatim \let\endverbatim\enddoc@verbatim \let\@verbatim\doc@@verbatim + \expandafter\let\csname verbatim*\expandafter\endcsname + \csname doc@verbatim*\endcsname + \expandafter\let\csname endverbatim*\expandafter\endcsname + \csname enddoc@verbatim*\endcsname + \expandafter\let\csname @verbatim*\expandafter\endcsname + \csname doc@@verbatim*\endcsname } % \end{macrocode} % @@ -715,12 +770,21 @@ Do not distribute a modified version of this file. % allow |<...>| to be used as markup for |\meta{...}|. % Ignore spaces and sanitize with catcodes before reading argument. % \begin{macrocode} -\group_begin: \char_make_active:N \< -\cs_new_nopar:Npn \function { +\DeclareDocumentCommand \function { O{} } { + \phantomsection + + \bool_gset_false:N \l_doc_meta_TF_bool + \bool_gset_false:N \l_doc_meta_pTF_bool + \bool_gset_false:N \l_doc_meta_EXP_bool + + \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} } + \KV_parse_space_removal_sanitize:n {#1} + \char_make_active:N \< \cs_set_eq:NN < \doc_open_meta:n + \group_begin: \MakePrivateLetters \char_make_other:N \| @@ -731,10 +795,24 @@ Do not distribute a modified version of this file. \char_make_ignore:N \^^I \function_aux:n } -\group_end: +\char_make_other:N \< \cs_set_eq:NN \variabledoc \function % \end{macrocode} % +% \begin{macrocode} +\cs_set:Nn \doc_meta_opt_TF: { + \bool_gset_true:N \l_doc_meta_TF_bool +} +\cs_set:Nn \doc_meta_opt_EXP: { + \bool_gset_true:N \l_doc_meta_EXP_bool +} +\cs_set:Nn \doc_meta_opt_pTF: { + \bool_gset_true:N \l_doc_meta_pTF_bool + \bool_gset_true:N \l_doc_meta_TF_bool + \bool_gset_true:N \l_doc_meta_EXP_bool +} +% \end{macrocode} +% % \begin{macro}{\function_aux:n} % \begin{arguments} % \item Vertical bar--separated list of functions with optional metadata; @@ -800,26 +878,22 @@ Do not distribute a modified version of this file. % \begin{macrocode} \cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop { - \tl_if_in:nnTF {#2} { (TF) } { + \tl_if_in:nnT {#2} { (TF) } { \bool_gset_true:N \l_doc_meta_TF_bool - }{ - \bool_gset_false:N \l_doc_meta_TF_bool } - \tl_if_in:nnTF {#2} { (EXP) } { + + \tl_if_in:nnT {#2} { (EXP) } { \bool_gset_true:N \l_doc_meta_EXP_bool - }{ - \bool_gset_false:N \l_doc_meta_EXP_bool } - \tl_if_in:nnTF {#2} { (pTF) } { + + \tl_if_in:nnT {#2} { (pTF) } { \bool_gset_true:N \l_doc_meta_TF_bool \bool_gset_true:N \l_doc_meta_pTF_bool \bool_gset_true:N \l_doc_meta_EXP_bool - \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil } - }{ - \bool_gset_false:N \l_doc_meta_pTF_bool } \bool_if:NT \l_doc_meta_pTF_bool { + \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil } \doc_special_main_index:o { \l_doc_pTF_name_tl } \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:N \l_doc_pTF_name_tl } } @@ -965,6 +1039,7 @@ Do not distribute a modified version of this file. { \int_incr:N \g_doc_nested_macro_int } \bool_set_false:N \l_doc_macro_aux_bool + \bool_set_false:N \l_doc_macro_internal_bool \bool_set_false:N \l_doc_macro_TF_bool \bool_set_false:N \l_doc_macro_pTF_bool \bool_set_false:N \l_doc_macro_var_bool @@ -995,26 +1070,33 @@ Do not distribute a modified version of this file. \bool_if:NTF \l_doc_macro_pTF_bool { \clist_map_inline:nn {#1} - { - \exp_args:Nf \doc_macro_single - { \doc_predicate_from_base:w ##1 \q_nil } - } + { + \tl_if_blank:nF {##1} + { + \exp_args:Nf \doc_macro_single + { \doc_predicate_from_base:w ##1 \q_nil } + } + } \bool_set_true:N \l_doc_macro_TF_bool - \clist_map_inline:nn {#1} { \doc_macro_single {##1} } + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } \bool_set_false:N \l_doc_macro_TF_bool } { - \clist_map_inline:nn {#1} { \doc_macro_single {##1} } + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } } } % \end{macrocode} % % \begin{macrocode} +\bool_new:N \l_doc_macro_internal_bool \bool_new:N \l_doc_macro_aux_bool \bool_new:N \l_doc_macro_TF_bool \bool_new:N \l_doc_macro_pTF_bool \bool_new:N \l_doc_macro_var_bool \cs_set_nopar:Npn \doc_macro_opt_aux: { \bool_set_true:N \l_doc_macro_aux_bool } +\cs_set_nopar:Npn \doc_macro_opt_internal: { \bool_set_true:N \l_doc_macro_internal_bool } \cs_set_nopar:Npn \doc_macro_opt_TF: { \bool_set_true:N \l_doc_macro_TF_bool } \cs_set_nopar:Npn \doc_macro_opt_pTF: { \bool_set_true:N \l_doc_macro_pTF_bool } \cs_set_nopar:Npn \doc_macro_opt_var: { \bool_set_true:N \l_doc_macro_var_bool } @@ -1278,6 +1360,7 @@ Do not distribute a modified version of this file. } \bool_if:nT { !\l_doc_macro_aux_bool && + !\l_doc_macro_internal_bool && \int_compare_p:n {\g_doc_nested_macro_int<1} } { @@ -1922,6 +2005,16 @@ page_precedence "rnaA" % Test. % \end{function} % +% \begin{function}[EXP]{\fffoo:N} +% Test. +% \end{function} +% \begin{function}[TF]{\ffffoo:N} +% Test. +% \end{function} +% \begin{function}[pTF]{\ffoo:N} +% Test. +% \end{function} +% % \begin{function}{ \bar / (EXP) | \bar: / (EXP) | \bar:x / (EXP) | } % \begin{syntax} % "\example_foo:N" <arg1> @@ -1945,6 +2038,10 @@ page_precedence "rnaA" % Testing. % \end{macro} % +% \begin{macro}[internal]{ \foo_if:d } +% Testing. +% \end{macro} +% % \bigskip\bigskip % % \begin{macro}{\aaaa_bbbb_cccc_dddd_eeee_ffff_gggg_hhhh} diff --git a/Master/texmf-dist/source/latex/expl3/l3expan.dtx b/Master/texmf-dist/source/latex/expl3/l3expan.dtx index ca4c7d5acb9..9055ca588df 100644 --- a/Master/texmf-dist/source/latex/expl3/l3expan.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3expan.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3expan.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3expan.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Argument Expansion module} %\iffalse %<*driver> @@ -1257,12 +1257,6 @@ %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3file.dtx b/Master/texmf-dist/source/latex/expl3/l3file.dtx index 8d672b074c4..63c21100ba8 100644 --- a/Master/texmf-dist/source/latex/expl3/l3file.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3file.dtx @@ -1,5 +1,7 @@ -% \iffalse -%% File: l3file.dtx Copyright (C) 2009-2010 LaTeX3 project +% \iffalse meta-comment +% +%% File: l3file.dtx Copyright (C) 2009-2011 by +%% The LaTeX3 Project <latex-team@latex-project.org> %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -8,7 +10,7 @@ %% %% http://www.latex-project.org/lppl.txt %% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% This file is part of the "expl3 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. @@ -28,327 +30,389 @@ %% 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. +%% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -%% % %<*driver|package> \RequirePackage{l3names} +\GetIdInfo$Id: l3file.dtx 2242 2011-04-21 08:07:24Z joseph $ + {The LaTeX3 kernel: file operations} %</driver|package> -%\fi -\GetIdInfo$Id: l3file.dtx 1853 2010-03-21 09:11:08Z joseph $ - {L3 Experimental file loading} -%\iffalse %<*driver> -%\fi -\ProvidesFile{\filename.\filenameext} - [\filedate\space v\fileversion\space\filedescription] -%\iffalse \documentclass[full]{l3doc} +\usepackage{csquotes} \begin{document} - \DocInput{l3file.dtx} + \DocInput{\jobname.dtx} \end{document} %</driver> % \fi % -% \title{The \textsf{l3file} package\thanks{This file -% has version number \fileversion, last -% revised \filedate.}\\ -% File Loading} -% \author{\Team} -% \date{\filedate} +% \GetFileInfo{\jobname.sty} +% +% \title{^^A +% \fileinfo +% \thanks{This file describes v\fileversion, last revised \filedate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \filedate} +% % \maketitle % % \begin{documentation} -% -% \section{Loading files} % % In contrast to the \pkg{l3io} module, which deals with the lowest % level of file management, the \pkg{l3file} module provides a higher % level interface for handling file contents. This involves providing % convenient wrappers around many of the functions in \pkg{l3io} % to make them more generally accessible. +% +% It is important to remember that \TeX{} will attempt to locate files using +% both the operating system path and entries in the \TeX{} file database (most +% \TeX{} systems use such a database). Thus the \enquote{current path} for +% \TeX{} is somewhat broader than that for other programs. +% +% \begin{variable}{\g_file_current_name_tl} +% Contains the name of the current \LaTeX{} file. This variable +% should not be modified: it is intended for information only. It +% will be equal to \cs{c_job_name_tl} at the start of a \LaTeX{} +% run and will be modified each time a file is read using +% \cs{file_input:n}. +% \end{variable} +% +% \begin{function}[TF]{\file_if_exist:n} +% \begin{syntax} +% \cs{file_if_exist:nTF} \Arg{file name} \Arg{true code} \Arg{false code} +% \end{syntax} +% Searches for \meta{file name} using the current \TeX{} search +% path and the additional paths controlled by +% \cs{file_path_include:n}). The branching versions then leave +% either \meta{true code} or \meta{false code} in the input stream, +% as appropriate to the truth of the test and the variant of the +% function chosen. +% \begin{texnote} +% The \meta{file name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% The expansion occurs when \TeX{} searches for the file. +% \end{texnote} +% \end{function} +% +% \begin{function}{\file_add_path:nN} +% \begin{syntax} +% \cs{file_add_path:nN} \Arg{file name} \meta{tl var} +% \end{syntax} +% Searches for \meta{file name} in the path as detailed for +% \cs{file_if_exist:nTF}, and if found sets the \meta{tl var} the +% fully-qualified name of the file, \emph{i.e}.~the path and file name. +% If the file is not found then the \meta{tl var} will be empty. +% \begin{texnote} +% The \meta{file name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% The expansion occurs when \TeX{} searches for the file. +% \end{texnote} +% \end{function} +% +% \begin{function}{\file_input:n} +% \begin{syntax} +% \cs{file_input:n} \Arg{file name} +% \end{syntax} +% Searches for \meta{file name} in the path as detailed for +% \cs{file_if_exist:nTF}, and if found reads in the file as +% additional \LaTeX{} source. All files read are recorded +% for information and the file name stack is updated by this +% function. +% \begin{texnote} +% The \meta{file name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% The expansion occurs when \TeX{} searches for the file. +% \end{texnote} +% \end{function} +% +% \begin{function}{\file_path_include:n} +% \begin{syntax} +% \cs{file_path_include:n} \Arg{path} +% \end{syntax} +% Adds \meta{path} to the list of those used to search for files +% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The +% assignment is local. +% \end{function} +% +% \begin{function}{\file_path_remove:n} +% \begin{syntax} +% \cs{file_path_remove:n} \Arg{path} +% \end{syntax} +% Removes \meta{path} from the list of those used to search for files +% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The +% assignment is local. +% \end{function} +% +% \begin{function}{\file_list:} +% \begin{syntax} +% \cs{file_list:} +% \end{syntax} +% This function will list all files loaded using \cs{file_input:n} +% in the log file. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} % -% It is important to remember that \TeX\ will attempt to locate -% files using both the operating system path and entries in the -% \TeX\ file database (most \TeX\ systems use such a database). Thus -% the `current path' for \TeX\ is somewhat broader than that for other -% programs. +% \section{Internal file functions} % -%\begin{variable}{ \g_file_current_name_tl } -% Contains the name of the current LaTeX file. This variable -% should not be modified: it is intended for information only. It -% will be equal to \cs{c_job_name_tl} at the start of a \LaTeX\ -% run and will be modified each time a file is read using -% \cs{file_input:n}. -%\end{variable} -% -%\begin{function}{ -% \file_if_exist:n / (TF) | -% \file_if_exist:V / (TF) -%} -% \begin{syntax} -% \cs{file_if_exist:nTF} \Arg{file name} \Arg{true code} \Arg{false code} -% \end{syntax} -% Searches for \meta{file name} using the current \TeX\ search -% path and the additional paths controlled by -% \cs{file_path_include:n}). The branching versions then leave -% either \meta{true code} or \meta{false code} in the input stream, -% as appropriate to the truth of the test and the variant of the -% function chosen. -%\end{function} -% -%\begin{function}{ -% \file_input:n | -% \file_input:V -%} -% \begin{syntax} -% \cs{file_input:n} \Arg{file name} -% \end{syntax} -% Searches for \meta{file name} in the path as detailed for -% \cs{file_if_exist:nTF}, and if found reads in the file as -% additional \LaTeX\ source. All files read are recorded -% for information and the file name stack is updated by this -% function. -%\end{function} -% -%\begin{function}{ \file_path_include:n } -% \begin{syntax} -% \cs{file_path_include:n} \Arg{path} -% \end{syntax} -% Adds \meta{path} to the list of those used to search for files -% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The -% assignment is local. -%\end{function} -% -%\begin{function}{ \file_path_remove:n } -% \begin{syntax} -% \cs{file_path_remove:n} \Arg{path} -% \end{syntax} -% Removes \meta{path} from the list of those used to search for files -% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The -% assignment is local. -%\end{function} -% -%\begin{function}{ \file_list: } -% \begin{syntax} -% \cs{file_list:} -% \end{syntax} -% This function will list all files loaded using \cs{file_input:n} -% in the log file. -%\end{function} +% \begin{function}{\g_file_stack_seq} +% Stores the stack of nested files loaded using \cs{file_input:n}. This +% is needed to restore the appropriate file name to +% \cs{g_file_current_name_tl} at the end of each file. +% \end{function} % -% \end{documentation} +% \begin{function}{\g_file_record_seq} +% Stores the name of every file loaded using \cs{file_input:n}. In +% contrast to \cs{g_file_stack_seq}, no items are ever removed from this +% sequence. +% \end{function} % -% \begin{implementation} +% \begin{function}{\l_file_name_tl} +% Used to return the full name of a file for internal use. +% \end{function} +% +% \begin{function}{\l_file_search_path_seq} +% The sequence of file paths to search when loading a file. +% \end{function} +% +% \begin{function}{\l_file_search_path_saved_seq} +% When loaded on top of \LaTeXe{}, there is a need to save the search +% path so that \cs{input@path} can be used as appropriate. +% \end{function} % -% \section{\pkg{l3file} implementation} +% \section{File operation implementation} +% +% \TestFiles{m3file001} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} % -% The usual lead-off. % \begin{macrocode} %<*package> \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: %</package> -%<*initex|package> % \end{macrocode} % -%\begin{macro}{\g_file_current_name_tl} -%\begin{macro}{\g_file_stack_seq} +% \begin{macro}{\g_file_current_name_tl} % The name of the current file should be available at all times. % \begin{macrocode} \tl_new:N \g_file_current_name_tl -\seq_new:N \g_file_stack_seq % \end{macrocode} -% % For the format the file name needs to be picked up at the start of the -% file. In package mode the current file name is collected from LaTeX2e. +% file. In package mode the current file name is collected from \LaTeXe{}. % \begin{macrocode} -%</initex|package> %<*initex> -\toks_put_right:Nn \tex_everyjob:D { - \tl_gset:Nx \g_file_current_name_tl { \tex_jobname:D } -} +\tex_everyjob:D \exp_after:wN + { + \tex_the:D \tex_everyjob:D + \tl_gset:Nx \g_file_current_name_tl { \tex_jobname:D } + } %</initex> %<*package> \tl_gset_eq:NN \g_file_current_name_tl \@currname %</package> -%<*initex|package> % \end{macrocode} -%\end{macro} -%\end{macro} +% \end{macro} +% +% \begin{macro}[int]{\g_file_stack_seq} +% The input list of files is stored as a sequence stack. +% \begin{macrocode} +\seq_new:N \g_file_stack_seq +% \end{macrocode} +% \end{macro} % -%\begin{macro}{\g_file_record_seq} -% The total list of files used is recorded separately from the -% stack. +% \begin{macro}[int]{\g_file_record_seq} +% The total list of files used is recorded separately from the current file +% stack, as nothing is ever popped from this list. % \begin{macrocode} \seq_new:N \g_file_record_seq % \end{macrocode} -% % The current file name should be included in the file list! % \begin{macrocode} -%</initex|package> %<*initex> -\toks_put_right:Nn \tex_everyjob:D { - \seq_gput_right:NV \g_file_record_seq \g_file_current_name_tl -} +\tex_everyjob:D \exp_after:wN + { + \tex_the:D \tex_everyjob:D + \seq_gput_right:NV \g_file_record_seq \g_file_current_name_tl + } %</initex> -%<*initex|package> % \end{macrocode} -%\end{macro} +% \end{macro} +% +% \begin{macro}[int]{\l_file_name_tl} +% Used to return the fully-qualified name of a file. +% \begin{macrocode} +\tl_new:N \l_file_name_tl +% \end{macrocode} +% \end{macro} % -%\begin{macro}{\l_file_search_path_seq} +% \begin{macro}[int]{\l_file_search_path_seq} % The current search path. % \begin{macrocode} \seq_new:N \l_file_search_path_seq % \end{macrocode} -%\end{macro} +% \end{macro} % -%\begin{macro}{\l_file_search_path_saved_seq} +% \begin{macro}[int]{\l_file_search_path_saved_seq} % The current search path has to be saved for package use. % \begin{macrocode} -%</initex|package> %<*package> \seq_new:N \l_file_search_path_saved_seq %</package> -%<*initex|package> % \end{macrocode} -%\end{macro} -% -%\begin{macro}{\l_file_name_tl} -%\begin{macro}{\g_file_test_stream} -%\begin{macro}[TF]{\file_if_exist:n} -%\begin{macro}[TF]{\file_if_exist:V} -%\begin{macro}[aux]{\file_if_exist_aux:n} -% Checking if a file exists takes place in two parts. First, look on -% the TeX path, then look on the LaTeX path. The -% token list \cs{l_file_name_tl} is used as a marker for finding -% the file, and is also needed by \cs{file_input:n}. +% \end{macro} +% +% \begin{macro}{\file_add_path:nN} +% \begin{macro}[aux]{\g_file_test_stream} +% \begin{macro}[aux]{\file_add_path_search:nN} +% The way to test if a file exists is to try to open it: if it does not +% exist then \TeX{} will report end-of-file. For files which are in the +% current directory, this is straight-forward. For other locations, a +% search has to be made looking at each potential path in turn. The first +% location is of course treated as the correct one. If nothing is found, +% |#2| is returned empty. % \begin{macrocode} -\tl_new:N \l_file_name_tl -\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } { - \ior_open:Nn \g_file_test_stream {#1} - \ior_if_eof:NTF \g_file_test_stream - { \file_if_exist_path_aux:n {#1} } - { - \ior_close:N \g_file_test_stream - \tl_set:Nn \l_file_name_tl {#1} - \prg_return_true: - } -} -\cs_new_protected_nopar:Npn \file_if_exist_path_aux:n #1 { - \tl_clear:N \l_file_name_tl -%</initex|package> +\cs_new_protected_nopar:Npn \file_add_path:nN #1#2 + { + \ior_open:Nn \g_file_test_stream {#1} + \ior_if_eof:NTF \g_file_test_stream + { \file_add_path_search:nN {#1} #2 } + { + \ior_close:N \g_file_test_stream + \tl_set:Nx #2 {#1} + } + } +\cs_new_protected_nopar:Npn \file_add_path_search:nN #1#2 + { + \tl_clear:N #2 %<*package> - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l_file_search_path_saved_seq - \l_file_search_path_seq - \clist_map_inline:Nn \input@path - { \seq_put_right:Nn \l_file_search_path_seq {##1} } - } + \cs_if_exist:NT \input@path + { + \seq_set_eq:NN \l_file_search_path_saved_seq \l_file_search_path_seq + \clist_map_inline:Nn \input@path + { \seq_put_right:Nn \l_file_search_path_seq {##1} } + } %</package> -%<*initex|package> - \seq_map_inline:Nn \l_file_search_path_seq - { - \ior_open:Nn \g_file_test_stream { ##1 #1 } - \ior_if_eof:NF \g_file_test_stream - { - \tl_set:Nn \l_file_name_tl { ##1 #1 } - \seq_map_break: - } - } -%</initex|package> + \seq_map_inline:Nn \l_file_search_path_seq + { + \ior_open:Nn \g_file_test_stream { ##1 #1 } + \ior_if_eof:NF \g_file_test_stream + { + \tl_set:Nx #2 { ##1 #1 } + \seq_map_break: + } + } %<*package> - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l_file_search_path_seq - \l_file_search_path_saved_seq - } + \cs_if_exist:NT \input@path + { \seq_set_eq:NN \l_file_search_path_seq \l_file_search_path_saved_seq } %</package> -%<*initex|package> - \ior_close:N \g_file_test_stream - \tl_if_empty:NTF \l_file_name_tl - { \prg_return_false: } - { \prg_return_true: } -} -\cs_generate_variant:Nn \file_if_exist:nT { V } -\cs_generate_variant:Nn \file_if_exist:nF { V } -\cs_generate_variant:Nn \file_if_exist:nTF { V } + \ior_close:N \g_file_test_stream + } % \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -% -%\begin{macro}{\file_input:n} -%\begin{macro}{\file_input:V} -% Most of the work is done by the file test above. +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[TF]{\file_if_exist:n} +% The test for the existence of a file is a wrapper around the function to +% add a path to a file. If the file was found, the path will contain something, +% whereas if the file was not located then the return value will be empty. % \begin{macrocode} -\cs_new_protected_nopar:Npn \file_input:n #1 { - \file_if_exist:nT {#1} - { -%</initex|package> +\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NTF \l_file_name_tl + { \prg_return_false: } + { \prg_return_true: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\file_input:n} +% Loading a file is done in a safe way, checking first that the file +% exists and loading only if it does. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \file_input:n #1 + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NF \l_file_name_tl + { +%<*initex> + \seq_gput_right:Nx \g_file_record_seq {#1} +%</initex> %<*package> - \@addtofilelist {#1} + \@addtofilelist {#1} %</package> -%<*initex|package> - \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl - \tl_gset:Nn \g_file_current_name_tl {#1} - \tex_expandafter:D \tex_input:D \l_file_name_tl ~ - \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl - } -} -\cs_generate_variant:Nn \file_input:n { V } + \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl + \tl_gset:Nn \g_file_current_name_tl {#1} + \tex_expandafter:D \tex_input:D \l_file_name_tl ~ + \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl + } + } % \end{macrocode} -%\end{macro} -%\end{macro} +% \end{macro} % -%\begin{macro}{\file_path_include:n} -%\begin{macro}{\file_path_remove:n} +% \begin{macro}{\file_path_include:n} +% \begin{macro}{\file_path_remove:n} % Wrapper functions to manage the search path. % \begin{macrocode} -\cs_new_protected_nopar:Npn \file_path_include:n #1 { - \seq_put_right:Nn \l_file_search_path_seq {#1} - \seq_remove_duplicates:N \l_file_search_path_seq -} -\cs_new_protected_nopar:Npn \file_path_remove:n #1 { - \seq_remove_element:Nn \l_file_search_path_seq {#1} -} +\cs_new_protected_nopar:Npn \file_path_include:n #1 + { + \seq_if_in:NnF \l_file_search_path_seq {#1} + { \seq_put_right:Nn \l_file_search_path_seq {#1} } + } +\cs_new_protected_nopar:Npn \file_path_remove:n #1 + { \seq_remove_all:Nn \l_file_search_path_seq {#1} } % \end{macrocode} -%\end{macro} -%\end{macro} +% \end{macro} +% \end{macro} % -%\begin{macro}{\file_list:} -%\begin{macro}[aux]{\file_list_aux:n} +% \begin{macro}{\file_list:} % A function to list all files used to the log. % \begin{macrocode} -\cs_new_protected_nopar:Npn \file_list: { - \seq_remove_duplicates:N \g_file_record_seq - \iow_log:n { *~File~List~* } - \seq_map_function:NN \g_file_record_seq \file_list_aux:n - \iow_log:n { ************* } -} -\cs_new_protected_nopar:Npn \file_list_aux:n #1 { \iow_log:n {#1} } +\cs_new_protected_nopar:Npn \file_list: + { + \seq_remove_duplicates:N \g_file_record_seq + \iow_log:n { *~File~List~* } + \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} } + \iow_log:n { ************* } + } % \end{macrocode} -%\end{macro} -%\end{macro} +% \end{macro} % % When used as a package, there is a need to hold onto the standard % file list as well as the new one here. % \begin{macrocode} -%</initex|package> %<*package> -\AtBeginDocument{ - \clist_map_inline:Nn \@filelist - { \seq_put_right:Nn \g_file_record_seq {#1} } -} +\AtBeginDocument + { + \clist_map_inline:Nn \@filelist + { \seq_put_right:Nn \g_file_record_seq {#1} } + } %</package> % \end{macrocode} % +% \begin{macrocode} +%</initex|package> +% \end{macrocode} +% % \end{implementation} -% -% \PrintIndex +% +% \PrintIndex
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/expl3/l3font.dtx b/Master/texmf-dist/source/latex/expl3/l3font.dtx index 0098dab3314..2999b41ef4a 100644 --- a/Master/texmf-dist/source/latex/expl3/l3font.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3font.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3font.dtx 2175 2011-03-03 12:16:46Z will $ +\GetIdInfo$Id: l3font.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Font Loading} %\iffalse %<*driver> @@ -66,21 +66,39 @@ % Functions are provided to load font faces and extract various % properties from them. % -% Some features within are specific \XeTeX\ and \LuaTeX; such functions +% Some features within are specific to \XeTeX\ and \LuaTeX; such functions % will be explicitly noted. % % This module is currently a work in progress as we incorporate \LaTeXe's -% font loading into \pkg{expl3}. The successor to the NFSS will provide +% font loading into \pkg{expl3}. The successor to the NFSS +% (tentatively denoted "xfss") +% will provide % (backwards compatible) user-level functions for font selection. % +% \section{Naming and scope} +% +% The "l3font" module largely provides commands for selecting and working +% with typefaces selected at specific sizes. +% (Many fonts have different shapes intended for use at different physical +% sizes.) +% We call a font at some size a "fontface" which is the function prefix +% used for these commands and also should be the variable suffix for +% denoting variables of this type. +% +% We reserve for future use the module name and variable type "font" for +% higher-level font selection commands, such as for font families which have +% linked bold, italic, etc., shapes with automatically-chosen optical sizes. +% (I.e., what is currently provided in \LaTeXe\ by the NFSS.) +% % % \section{Functions} % % -% \begin{function}{\font_set:Nnn,\font_gset:Nnn, -% \font_set:cnn,\font_gset:cnn} +% \begin{function}{\fontface_set:Nnn,\fontface_gset:Nnn, +% \fontface_set:cnn,\fontface_gset:cnn} % \begin{syntax} -% "\font_set:Nnn" <font cs> \Arg{font name} \Arg{font size} +% "\fontface_set:Nnn" <font cs> \Arg{font name} \Arg{font size} +% "\fontface_set:Nnn \l_tenrm_fontface {cmr10} {10pt}" % \end{syntax} % Defines <cs> as a command to select the font defined by <font name> % at the <font size>. If the <font size> is empty, the font will be loaded @@ -88,23 +106,23 @@ % For fonts without a typical design size, this will usually be 10\,pt. % \end{function} % -% \begin{function}{\font_set_eq:NN,\font_gset_eq:NN} +% \begin{function}{\fontface_set_eq:NN,\fontface_gset_eq:NN} % \begin{syntax} -% "\font_set_eq:NN" <font cs1> <font cs2> +% "\fontface_set_eq:NN" <font cs1> <font cs2> % \end{syntax} % Copies <font cs2> into <font cs1>. % \end{function} % -% \begin{function}{\font_set_to_current:N,\font_gset_to_current:N} +% \begin{function}{\fontface_set_to_current:N,\fontface_gset_to_current:N} % \begin{syntax} -% "\font_set_to_current:N" <font cs> +% "\fontface_set_to_current:N" <font cs> % \end{syntax} % Sets <font cs> to the font that is currently selected. % \end{function} % -% \begin{function}{\font_if_null_p:N /(EXP) | \font_if_null:N / (TF)(EXP)} +% \begin{function}{ \fontface_if_null:N / (pTF) } % \begin{syntax} -% "\font_if_null:NTF" <font cs> \Arg{true} \Arg{false} +% "\fontface_if_null:NTF" <font cs> \Arg{true} \Arg{false} % \end{syntax} % Conditional to switch whether the control sequence is the `null font'. % \end{function} @@ -117,7 +135,7 @@ % \emph{Not available in pdf\TeX.} % In LuaTeX or XeTeX, the error when a font is selected but does not exist % can be toggled with these two commands. The non-existance of a font can -% then be tested with the "\font_if_null_p:N" conditional. +% then be tested with the "\fontface_if_null_p:N" conditional. % \end{function} % % @@ -138,55 +156,59 @@ %<*initex|package> % \end{macrocode} % +% \TestFiles{m3font001.lvt} % -% \begin{macro}{\font_set:Nnn,\font_gset:Nnn,\font_set:cnn,\font_gset:cnn} +% \begin{macro}{\fontface_set:Nnn,\fontface_gset:Nnn, +% \fontface_set:cnn,\fontface_gset:cnn} +% \UnitTested % \begin{arguments} % \item csname \item fontname \item size (dimension) % \end{arguments} % Note that the fontname needs to be escaped appropriately in "xetex" % or "luatex". -% \testfile{m3font001.lvt} % \begin{macrocode} -\cs_new_protected:Npn \font_set:Nnn #1#2#3 { \tex_font:D #1 = #2 ~at~ #3 \scan_stop: } +\cs_new_protected:Npn \fontface_set:Nnn #1#2#3 { + \tex_font:D #1 = #2 ~at~ #3 \scan_stop: +} % \end{macrocode} % % \begin{macrocode} -\cs_new_protected:Npn \font_gset:Nnn #1#2#3 { +\cs_new_protected:Npn \fontface_gset:Nnn #1#2#3 { \tex_global:D \tex_font:D #1 = #2 ~at~ #3 \scan_stop: } % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn \font_set:Nnn {c} -\cs_generate_variant:Nn \font_gset:Nnn {c} +\cs_generate_variant:Nn \fontface_set:Nnn {c} +\cs_generate_variant:Nn \fontface_gset:Nnn {c} % \end{macrocode} % \end{macro} % % -% \begin{macro}{\font_set_eq:NN} -% \testfile* +% \begin{macro}{\fontface_set_eq:NN} +% \UnitTested % \begin{macrocode} -\cs_set_eq:NN \font_set_eq:NN \tex_let:D -\cs_set_protected:Npn \font_gset_eq:NN { \tex_global:D \tex_let:D } +\cs_set_eq:NN \fontface_set_eq:NN \tex_let:D +\cs_set_protected:Npn \fontface_gset_eq:NN { \tex_global:D \tex_let:D } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\font_set_to_current:N,\font_gset_to_current:N} -% \testfile* +% \begin{macro}{\fontface_set_to_current:N,\fontface_gset_to_current:N} +% \UnitTested % \begin{macrocode} -\cs_set:Npn \font_set_to_current:N #1 { - \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D +\cs_set:Npn \fontface_set_to_current:N #1 { + \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D } -\cs_set:Npn \font_gset_to_current:N #1 { - \tex_global:D \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D +\cs_set:Npn \fontface_gset_to_current:N #1 { + \tex_global:D \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D } % \end{macrocode} % \end{macro} % % % \begin{macro}{\font_suppress_not_found_error:,\font_enable_not_found_error:} -% \testfile* ^^A THIS IS A BIG LIE! NOT TESTED, BUT OH WELL +% \UnitTested ^^A THIS IS A BIG LIE! NOT TESTED, BUT OH WELL % \begin{macrocode} \luatex_if_engine:TF { @@ -218,12 +240,10 @@ % \end{macro} % % -% \begin{macro}{\font_if_null_p:N} -% \testfile* -% \begin{macro}[TF]{\font_if_null:N} -% \testfile* +% \begin{macro}[pTF]{\fontface_if_null:N} +% \UnitTested % \begin{macrocode} -\prg_new_conditional:Nnn \font_if_null:N {p,TF,T,F} { +\prg_new_conditional:Nnn \fontface_if_null:N {p,TF,T,F} { \if_meaning:w #1 \tex_nullfont:D \prg_return_true: \else: @@ -232,18 +252,11 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macrocode} %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3fp.dtx b/Master/texmf-dist/source/latex/expl3/l3fp.dtx index 6232374336a..8e592fe9a88 100644 --- a/Master/texmf-dist/source/latex/expl3/l3fp.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3fp.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3fp.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3fp.dtx 2201 2011-03-19 17:16:13Z joseph $ {L3 Experimental floating-point operations} %\iffalse %<*driver> @@ -616,11 +616,13 @@ % \begin{syntax} % \cs{fp_pow:Nn} \meta{floating point} \Arg{value} % \end{syntax} -% Raises the \meta{floating point} to the given \meta{value}, which -% should be a positive real number or a negative integer. -% Mathematically invalid operations such as \( 0^{0} \) will give -% set the \meta{floating point} to to \cs{c_undefined_fp}. The -% assignment is local. +% Raises the \meta{floating point} to the given \meta{value}. If the +% \meta{floating point} is negative, then the \meta{value} should be +% either a positive real number or a negative integer. If the +% \meta{floating point} is positive, then the \meta{value} may be any +% real value. Mathematically invalid operations such as \( 0^{0} \) +% will give set the \meta{floating point} to to \cs{c_undefined_fp}. +% The assignment is local. %\end{function} % %\begin{function}{ @@ -630,11 +632,13 @@ % \begin{syntax} % \cs{fp_gpow:Nn} \meta{floating point} \Arg{value} % \end{syntax} -% Raises the \meta{floating point} to the given \meta{value}, which -% should be a positive real number or a negative integer. -% Mathematically invalid operations such as \( 0^{0} \) will give -% set the \meta{floating point} to to \cs{c_undefined_fp}. The -% assignment is global. +% Raises the \meta{floating point} to the given \meta{value}. If the +% \meta{floating point} is negative, then the \meta{value} should be +% either a positive real number or a negative integer. If the +% \meta{floating point} is positive, then the \meta{value} may be any +% real value. Mathematically invalid operations such as \( 0^{0} \) +% will give set the \meta{floating point} to to \cs{c_undefined_fp}. +% The assignment is global. %\end{function} % %\subsection{Exponential and logarithm functions} diff --git a/Master/texmf-dist/source/latex/expl3/l3int.dtx b/Master/texmf-dist/source/latex/expl3/l3int.dtx index fac6c0245f3..4bb794a4b82 100644 --- a/Master/texmf-dist/source/latex/expl3/l3int.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3int.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3int.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3int.dtx 2229 2011-04-11 17:37:05Z joseph $ {L3 Experimental Integer module} %\iffalse %<*driver> @@ -2261,7 +2261,8 @@ } { \chk_if_free_cs:N #1 - \tex_global:D \tex_mathchardef:D #1 = \int_eval:n {#2} + \tex_global:D \tex_mathchardef:D #1 = + \etex_numexpr:D #2 \scan_stop: } } { @@ -2444,12 +2445,6 @@ %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3keyval.dtx b/Master/texmf-dist/source/latex/expl3/l3keyval.dtx index 54a89df8955..e9bd88f9852 100644 --- a/Master/texmf-dist/source/latex/expl3/l3keyval.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3keyval.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3keyval.dtx 1890 2010-04-11 03:37:15Z will $ +\GetIdInfo$Id: l3keyval.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental keyval processing} %\iffalse %<*driver> @@ -824,11 +824,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3precom.dtx b/Master/texmf-dist/source/latex/expl3/l3precom.dtx index 5ee345dc70c..8d238b8b01f 100644 --- a/Master/texmf-dist/source/latex/expl3/l3precom.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3precom.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3precom.dtx 1793 2010-02-09 20:36:19Z joseph $ +\GetIdInfo$Id: l3precom.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental precompilation module} %\iffalse %<*driver> @@ -428,12 +428,6 @@ % \end{macro} % % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3prg.dtx b/Master/texmf-dist/source/latex/expl3/l3prg.dtx index ad629cd6450..b9dcafa7f09 100644 --- a/Master/texmf-dist/source/latex/expl3/l3prg.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3prg.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3prg.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3prg.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental control structures} %\iffalse %<*driver> @@ -1958,11 +1958,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3prop.dtx b/Master/texmf-dist/source/latex/expl3/l3prop.dtx index 13e938e8477..bd287f2e569 100644 --- a/Master/texmf-dist/source/latex/expl3/l3prop.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3prop.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3prop.dtx 2087 2010-11-23 18:21:44Z joseph $ +\GetIdInfo$Id: l3prop.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Property Lists} %\iffalse %<*driver> @@ -858,12 +858,6 @@ %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -%\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3quark.dtx b/Master/texmf-dist/source/latex/expl3/l3quark.dtx index eb1c092e172..26372d5209e 100644 --- a/Master/texmf-dist/source/latex/expl3/l3quark.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3quark.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3quark.dtx 2172 2011-03-03 10:56:49Z will $ +\GetIdInfo$Id: l3quark.dtx 2234 2011-04-14 19:58:43Z joseph $ {L3 Experimental Quark Commands} %\iffalse %<*driver> @@ -288,65 +288,92 @@ \quark_new:N\q_recursion_stop % \end{macrocode} % \end{variable} -% -% \begin{macro}{\quark_if_recursion_tail_stop:n, -% \quark_if_recursion_tail_stop:N, -% \quark_if_recursion_tail_stop:o} +% +% \begin{macro}{\quark_if_recursion_tail_stop:N} % \UnitTested -% When doing recursions it is easy to spend a lot of time testing if -% we found the end marker. To avoid this, we use a recursion end -% marker every time we do this kind of task. Also, if the recursion -% end marker is found, we wrap things up and finish. -% \begin{macrocode} -\cs_new:Npn \quark_if_recursion_tail_stop:n #1 { - \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: -} -\cs_new:Npn \quark_if_recursion_tail_stop:N #1 { - \if_meaning:w#1\q_recursion_tail - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: -} -\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n {o} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\quark_if_recursion_tail_stop_do:nn, -% \quark_if_recursion_tail_stop_do:Nn, -% \quark_if_recursion_tail_stop_do:on} +% \begin{macro}{\quark_if_recursion_tail_stop_do:Nn} % \UnitTested -% These functions are variants of the above that -% inserts tokens into the input stream after a -% recursion process is finalised. +% When doing recursions, it is easy to spend a lot of time testing if the +% end marker has been found. To avoid this, a dedicated end marker is used +% each time a recursion is set up. Thus if the marker is found everything +% can be wrapper up and finished off. The simple case is when the test +% can guarantee that only a single token is being tested. In this case, +% there is just a dedicated copy of the standard quark test. Both a gobbling +% version and one inserting end code are provided. % \begin{macrocode} -\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 { - \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail - \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw - \else: - \exp_after:wN\use_none:n - \fi: - {#2} -} -\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 { - \if_meaning:w #1\q_recursion_tail - \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw - \else: - \exp_after:wN\use_none:n - \fi: - {#2} -} -\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn {on} +\cs_new:Npn \quark_if_recursion_tail_stop:N #1 + { + \tex_ifx:D #1 \q_recursion_tail + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \tex_fi:D + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 + { + \tex_ifx:D #1 \q_recursion_tail + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \tex_else:D + \exp_after:wN \use_none:n + \tex_fi:D + {#2} + } % \end{macrocode} % \end{macro} -% +% \end{macro} +% +% \begin{macro} +% {\quark_if_recursion_tail_stop:n,\quark_if_recursion_tail_stop:o} +% \UnitTested +% \begin{macro} +% {\quark_if_recursion_tail_stop_do:nn,\quark_if_recursion_tail_stop_do:on} +% \UnitTested % \begin{macro}[aux]{\quark_if_recursion_tail_aux:w} +% The same idea applies when testing multiple tokens, but here a little more +% care is needed. It is possible that |#1| might be something like +% |{{{a}}}| or |{ab\iffalse}\fi|, which will therefore need to be tested +% in a detokenized manner. The way that this is done is using +% \cs{tex_ifcat:D}, with the idea being that this test will be \texttt{true} +% provided the auxiliary function returns nothing at all. If the auxiliary +% returns anything, it will be detokenized and so the test will be both +% \texttt{false} and safe. % \begin{macrocode} -\cs_new:Npn \quark_if_recursion_tail_aux:w #1#2 \q_stop \q_recursion_tail {#1} +\cs_new:Npn \quark_if_recursion_tail_stop:n #1 + { + \tex_ifcat:D + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \tex_fi:D + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 + { + \tex_ifcat:D + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \tex_else:D + \exp_after:wN \use_none:n + \tex_fi:D + {#2} + } +\cs_new:Npn \quark_if_recursion_tail_aux:w + #1 \q_recursion_tail #2 \q_recursion_stop #3 \q_stop + { #1 #2 } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}[pTF]{\quark_if_no_value:N,\quark_if_no_value:n} % \UnitTested @@ -407,12 +434,6 @@ % % % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3seq.dtx b/Master/texmf-dist/source/latex/expl3/l3seq.dtx index f9d6f82e283..6e5c536616d 100644 --- a/Master/texmf-dist/source/latex/expl3/l3seq.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3seq.dtx @@ -1,5 +1,7 @@ -% \iffalse -%% File: l3seq.dtx Copyright (C) 1990-2010 LaTeX3 project +% \iffalse meta-comment +% +%% File: l3seq.dtx Copyright (C) 1990-2011 by +%% The LaTeX3 Project <latex-team@latex-project.org> %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -8,7 +10,7 @@ %% %% http://www.latex-project.org/lppl.txt %% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% This file is part of the "expl3 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. @@ -28,413 +30,607 @@ %% 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. +%% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- % %<*driver|package> \RequirePackage{l3names} +\GetIdInfo$Id: l3seq.dtx 2245 2011-04-21 19:45:31Z joseph $ + {The LaTeX3 kernel: sequences and stacks} %</driver|package> -%\fi -\GetIdInfo$Id: l3seq.dtx 1879 2010-03-29 17:48:38Z mittelba $ - {L3 Experimental sequences and stacks} -%\iffalse %<*driver> -%\fi -\ProvidesFile{\filename.\filenameext} - [\filedate\space v\fileversion\space\filedescription] -%\iffalse \documentclass[full]{l3doc} +\usepackage{csquotes} \begin{document} -\DocInput{\filename.\filenameext} + \DocInput{\jobname.dtx} \end{document} %</driver> % \fi % +% \GetFileInfo{\jobname.sty} +% +% \title{^^A +% \fileinfo +% \thanks{This file describes v\fileversion, last revised \filedate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \filedate} % -% \title{The \textsf{l3seq} package\thanks{This file -% has version number \fileversion, last -% revised \filedate.}\\ -% Sequences} -% \author{\Team} -% \date{\filedate} % \maketitle % % \begin{documentation} % -% \LaTeX3 implements a data type called `sequences'. These are special -% token lists that can be accessed via special function on the `left'. -% Appending tokens is possible at both ends. Appended token lists can be -% accessed only as a union. The token lists that form the individual -% items of a sequence might contain any tokens except two internal -% functions that are used to structure sequences (see section internal -% functions below). It is also possible to map functions on such -% sequences so that they are executed for every item on the sequence. -% -% All functions that return items from a sequence in some \m{tl var.}~assume -% that the \m{tl var.}~is local. See remarks below if you need a global -% returned value. -% -% The defined functions are not orthogonal in the sense that every -% possible variation possible is actually available. If you need a new -% variant use the expansion functions described in the package -% \texttt{l3expan} to build it. -% -% Adding items to the left of a sequence can currently be done with -% either something like "\seq_put_left:Nn" or with a ``stack'' function -% like "\seq_push:Nn" which has the same effect. Maybe one should -% therefore remove the ``left'' functions totally. -% -% \section{Functions for creating/initialising sequences} -% -% \begin{function}{ \seq_new:N | -% \seq_new:c } -% \begin{syntax} -% "\seq_new:N" <sequence> -% \end{syntax} -% Defines <sequence> to be a variable of type "seq". -% \end{function} -% -% \begin{function}{ \seq_clear:N | -% \seq_clear:c | -% \seq_gclear:N | -% \seq_gclear:c } -% \begin{syntax} -% "\seq_clear:N" <sequence> -% \end{syntax} -% These functions locally or globally clear <sequence>. -% \end{function} -% -% \begin{function}{ \seq_clear_new:N | -% \seq_clear_new:c | -% \seq_gclear_new:N | -% \seq_gclear_new:c } -% \begin{syntax} -% "\seq_clear_new:N" <sequence> -% \end{syntax} -% These functions locally or globally clear <sequence> if it exists or -% otherwise allocates it. -% \end{function} -% -% \begin{function}{ \seq_set_eq:NN | -% \seq_set_eq:cN | -% \seq_set_eq:Nc | -% \seq_set_eq:cc } -% \begin{syntax} -% "\seq_set_eq:NN" <seq1> <seq2> -% \end{syntax} -% Function that locally makes <seq1> identical to <seq2>. -% \end{function} -% -% \begin{function}{ \seq_gset_eq:NN | -% \seq_gset_eq:cN | -% \seq_gset_eq:Nc | -% \seq_gset_eq:cc } -% \begin{syntax} -% "\seq_gset_eq:NN" <seq1> <seq2> -% \end{syntax} -% Function that globally makes <seq1> identical to <seq2>. -% \end{function} -% -% \begin{function}{% -% \seq_concat:NNN | -% \seq_concat:ccc | -% \seq_gconcat:NNN | -% \seq_gconcat:ccc | -% } -% \begin{syntax} -% "\seq_concat:NNN" <seq1> <seq2> <seq3> -% "\seq_gconcat:NNN" <seq1> <seq2> <seq3> -% \end{syntax} -% Function that conatenates <seq2> and <seq3> and locally or globally assigns the -% result to <seq1>. -% \end{function} -% -% \section{Adding data to sequences} -% -% \begin{function}{% -% \seq_put_left:Nn | -% \seq_put_left:NV | -% \seq_put_left:No | -% \seq_put_left:Nx | -% \seq_put_left:cn | -% \seq_put_left:cV | -% \seq_put_left:co | +% \LaTeX3 implements a \enquote{sequence} data type, which contain +% an ordered list of entries which may contain any \meta{balanced text}. +% It is possible to map functions to sequences such that the function +% is applied to every item in the sequence. +% +% Sequences are also used to implement stack functions in \LaTeX3. This +% is achieved using a number of dedicated stack functions. +% +% \section{Creating and initialising sequences} +% +% \begin{function}{\seq_new:N, \seq_new:c} +% \begin{syntax} +% \cs{seq_new:N} \meta{sequence} +% \end{syntax} +% Creates a new \meta{sequence} or raises an error if the name is +% already taken. The declaration is global. The \meta{sequence} will +% initially contain no items. +% \end{function} +% +% \begin{function}{\seq_clear:N, \seq_clear:c} +% \begin{syntax} +% \cs{seq_clear:N} \meta{sequence} +% \end{syntax} +% Clears all items from the \meta{sequence} within the scope of +% the current \TeX{} group. +% \end{function} +% +% \begin{function}{\seq_gclear:N, \seq_gclear:c} +% \begin{syntax} +% \cs{seq_gclear:N} \meta{sequence} +% \end{syntax} +% Clears all entries from the \meta{sequence} globally. +% \end{function} +% +% \begin{function}{\seq_clear_new:N, \seq_clear_new:c} +% \begin{syntax} +% \cs{seq_clear_new:N} \meta{sequence} +% \end{syntax} +% If the \meta{sequence} already exists, clears it within the scope +% of the current \TeX{} group. If the \meta{sequence} is not defined, +% it will be created (using \cs{seq_new:N}). Thus the sequence is +% guaranteed to be available and clear within the current \TeX{} +% group. The \meta{sequence} will exist globally, but the content +% outside of the current \TeX{} group is not specified. +% \end{function} +% +% \begin{function}{\seq_gclear_new:N, \seq_gclear_new:c} +% \begin{syntax} +% \cs{seq_gclear_new:N} \meta{sequence} +% \end{syntax} +% If the \meta{sequence} already exists, clears it globally. If the +% \meta{sequence} is not defined, it will be created (using +% \cs{seq_new:N}). Thus the sequence is guaranteed to be available +% and globally clear. +% \end{function} +% +% \begin{function} +% {\seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc} +% \begin{syntax} +% \cs{seq_set_eq:NN} \meta{sequence1} \meta{sequence2} +% \end{syntax} +% Sets the content of \meta{sequence1} equal to that of +% \meta{sequence2}. This assignment is restricted to the current +% \TeX{} group level. +% \end{function} +% +% \begin{function} +% {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc} +% \begin{syntax} +% \cs{seq_gset_eq:NN} \meta{sequence1} \meta{sequence2} +% \end{syntax} +% Sets the content of \meta{sequence1} equal to that of +% \meta{sequence2}. This assignment is global and so is not +% limited by the current \TeX{} group level. +% \end{function} +% +% \begin{function}{\seq_concat:NNN, \seq_concat:ccc} +% \begin{syntax} +% \cs{seq_concat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3} +% \end{syntax} +% Concatenates the content of \meta{sequence2} and \meta{sequence3} +% together and saves the result in \meta{sequence1}. The items in +% \meta{sequence2} will be placed at the left side of the new sequence. +% This operation is local to the current \TeX{} group and will +% remove any existing content in \meta{sequence1}. +% \end{function} +% +% \begin{function}{\seq_gconcat:NNN, \seq_gconcat:ccc} +% \begin{syntax} +% \cs{seq_gconcat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3} +% \end{syntax} +% Concatenates the content of \meta{sequence2} and \meta{sequence3} +% together and saves the result in \meta{sequence1}. The items in +% \meta{sequence2} will be placed at the left side of the new sequence. +% This operation is global and will remove any existing content in +% \meta{sequence1}. +% \end{function} +% +% \section{Appending data to sequences} +% +% \begin{function}{ +% \seq_put_left:Nn, \seq_put_left:NV, \seq_put_left:Nv, +% \seq_put_left:No, \seq_put_left:Nx, +% \seq_put_left:cn, \seq_put_left:cV, \seq_put_left:cv, +% \seq_put_left:co, \seq_put_left:cx % } -% \begin{syntax} -% "\seq_put_left:Nn" <sequence> <token list> -% \end{syntax} -% Locally appends <token list> as a single item to the left -% of <sequence>. <token list> might get expanded before -% appending according to the variant. -% \end{function} -% -% \begin{function}{% -% \seq_put_right:Nn | -% \seq_put_right:NV | -% \seq_put_right:No | -% \seq_put_right:Nx | -% \seq_put_right:cn | -% \seq_put_right:cV | -% \seq_put_right:co | +% \begin{syntax} +% \cs{seq_put_left:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Appends the \meta{item} to the left of the \meta{sequence}. +% The assignment is restricted to the current \TeX{} group. +% \end{function} +% +% \begin{function}{ +% \seq_gput_left:Nn, \seq_gput_left:NV, \seq_gput_left:Nv, +% \seq_gput_left:No, \seq_gput_left:Nx, +% \seq_gput_left:cn, \seq_gput_left:cV, \seq_gput_left:cv, +% \seq_gput_left:co, \seq_gput_left:cx % } -% \begin{syntax} -% "\seq_put_right:Nn" <sequence> <token list> -% \end{syntax} -% Locally appends <token list> as a single item to the right -% of <sequence>. <token list> might get expanded before -% appending according to the variant. -% \end{function} -% -% \begin{function}{% -% \seq_gput_left:Nn | -% \seq_gput_left:NV | -% \seq_gput_left:No | -% \seq_gput_left:Nx | -% \seq_gput_left:cn | -% \seq_gput_left:cV | -% \seq_gput_left:co | +% \begin{syntax} +% \cs{seq_gput_left:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Appends the \meta{item} to the left of the \meta{sequence}. +% The assignment is global. +% \end{function} +% +% \begin{function}{ +% \seq_put_right:Nn, \seq_put_right:NV, \seq_put_right:Nv, +% \seq_put_right:No, \seq_put_right:Nx, +% \seq_put_right:cn, \seq_put_right:cV, \seq_put_right:cv, +% \seq_put_right:co, \seq_put_right:cx % } -% \begin{syntax} -% "\seq_gput_left:Nn" <sequence> <token list> -% \end{syntax} -% Globally appends <token list> as a single item to the left -% of <sequence>. -% \end{function} -% -% \begin{function}{% -% \seq_gput_right:Nn | -% \seq_gput_right:NV | -% \seq_gput_right:No | -% \seq_gput_right:Nx | -% \seq_gput_right:cn | -% \seq_gput_right:cV | -% \seq_gput_right:co | +% \begin{syntax} +% \cs{seq_put_right:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Appends the \meta{item} to the right of the \meta{sequence}. +% The assignment is restricted to the current \TeX{} group. +% \end{function} +% +% \begin{function}{ +% \seq_gput_right:Nn, \seq_gput_right:NV, \seq_gput_right:Nv, +% \seq_gput_right:No, \seq_gput_right:Nx, +% \seq_gput_right:cn, \seq_gput_right:cV, \seq_gput_right:cv, +% \seq_gput_right:co, \seq_gput_right:cx % } -% \begin{syntax} -% "\seq_gput_right:Nn" <sequence> <token list> -% \end{syntax} -% Globally appends <token list> as a single item to the right -% of <sequence>. +% \begin{syntax} +% \cs{seq_gput_right:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Appends the \meta{item} to the right of the \meta{sequence}. +% The assignment is global. % \end{function} % +% \section{Recovering items from sequences} +% +% Items can be recovered from either the left or the right of sequences. +% For implementation reasons, the actions at the left of the sequence are +% faster than those acting on the right. These functions all assign the +% recovered material locally, \emph{i.e.}~setting the +% \meta{token list variable} used with \cs{tl_set:Nn} and \emph{never} +% \cs{tl_gset:Nn}. +% +% \begin{function}{\seq_get_left:NN, \seq_get_left:cN} +% \begin{syntax} +% \cs{seq_get_left:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Stores the left-most item from a \meta{sequence} in the +% \meta{token list variable} without removing it from the +% \meta{sequence}. The \meta{token list variable} is assigned locally. +% If \meta{sequence} is empty an error will be raised. +% \end{function} % -% \section{Working with sequences} +% \begin{function}{\seq_get_right:NN, \seq_get_right:cN} +% \begin{syntax} +% \cs{seq_get_right:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Stores the right-most item from a \meta{sequence} in the +% \meta{token list variable} without removing it from the +% \meta{sequence}. The \meta{token list variable} is assigned locally. +% If \meta{sequence} is empty an error will be raised. +% \end{function} % -% \begin{function}{% -% \seq_get:NN | -% \seq_get:cN | -% } -% \begin{syntax} -% "\seq_get:NN" <sequence> <tl var.> -% \end{syntax} -% Functions that locally assign the left-most item of <sequence> to the -% token list variable <tl var.>. Item is not removed from <sequence>! If you -% need a global return value you need to code something like this: -% \begin{quote} -% "\seq_get:NN" <sequence> "\l_tmpa_tl" \\ -% "\tl_gset_eq:NN" <global tl var.> "\l_tmpa_tl" -% \end{quote} -% But if this kind of construction is used often enough a separate -% function should be provided. -% \end{function} -% -% -% \begin{function}{\seq_map_variable:NNn | -% \seq_map_variable:cNn -% } -% \begin{syntax} -% "\seq_map_variable:NNn" <sequence> <tl var.> \Arg{code using tl var.} -% \end{syntax} -% Every element in <sequence> is assigned to <tl var.> and then <code -% using tl var.> is executed. The operation is not expandable which means -% that it can't be used within write operations etc. However, this -% function can be nested which the others can't. -% \end{function} -% -% \begin{function}{ \seq_map_function:NN | -% \seq_map_function:cN } -% \begin{syntax} -% "\seq_map_function:NN" <sequence> <function> -% \end{syntax} -% This function applies <function> (which must be a function with one -% argument) to every item of <sequence>. <function> is not executed -% within a sub-group so that side effects can be achieved locally. The -% operation is not expandable which means that it can't be used within -% write operations etc. -% -% In the current implementation the next functions are more efficient and -% should be preferred. -% \end{function} -% -% \begin{function}{\seq_map_inline:Nn | -% \seq_map_inline:cn -% } -% \begin{syntax} -% "\seq_map_inline:Nn" <sequence> \Arg{inline function} -% \end{syntax} -% Applies <inline function> (which should be the direct coding for a -% function with one argument (i.e.\ use "#1" as the place holder for -% this argument)) to every item of <sequence>. <inline function> is not -% executed within a sub-group so that side effects can be achieved locally. -% The operation is not expandable which means that it can't be used -% within write operations etc. -% \end{function} -% -% \begin{function}{ \seq_map_break: | \seq_map_break:n } -% These functions are used to break out of a mapping function at the point -% of execution. (Please do not put `|\q_stop|' inside a <seq> that uses -% these functions.) -% \end{function} -% -% \begin{function}{ \seq_show:N | -% \seq_show:c } -% \begin{syntax} -% "\seq_show:N" <sequence> -% \end{syntax} -% Function that pauses the compilation and displays <seq> in the terminal -% output and in the log file. (Usually used for diagnostic purposes.) -% \end{function} -% -% \begin{function}{ \seq_display:N | -% \seq_display:c } -% \begin{syntax} -% "\seq_display:N" <sequence> -% \end{syntax} -% As with "\seq_show:N" but pretty prints the output one line per element. -% \end{function} -% -% \begin{function}{ \seq_remove_duplicates:N | -% \seq_gremove_duplicates:N } -% \begin{syntax} -% "\seq_gremove_duplicates:N" <seq> -% \end{syntax} -% Function that removes any duplicate entries in <seq>. -% \end{function} -% -% \section{Predicates and conditionals} -% -% \begin{function}{ \seq_if_empty_p:N / (EXP) | -% \seq_if_empty_p:c / (EXP) } -% \begin{syntax} -% "\seq_if_empty_p:N" <sequence> -% \end{syntax} -% This predicate returns `true' if <sequence> is `empty' i.e., doesn't -% contain any items. Note that this is `false' even if the <sequence> only -% contains a single empty item. -% \end{function} -% -% \begin{function}{ \seq_if_empty:N / (TF) | -% \seq_if_empty:c / (TF) } -% \begin{syntax} -% "\seq_if_empty:NTF" <sequence> \Arg{true code} \Arg{false code} -% \end{syntax} -% Set of conditionals that test whether or not a particular <sequence> -% is empty and if so executes either <true code> or <false code>. -% \end{function} -% -% \begin{function}{ \seq_if_in:Nn / (TF) | -% \seq_if_in:NV / (TF) | -% \seq_if_in:cn / (TF) | -% \seq_if_in:cV / (TF) | -% \seq_if_in:co / (TF) | -% \seq_if_in:cx / (TF) } -% \begin{syntax} -% "\seq_if_in:NnTF" <sequence> \Arg{item} \Arg{true code} \Arg{false code} -% \end{syntax} -% Functions that test if <item> is in <sequence>. Depending on the result -% either <true code> or <false code> is executed. -% \end{function} -% -% \section{Internal functions} -% -% \begin{function}{\seq_if_empty_err:N} -% \begin{syntax} -% "\seq_if_empty_err:N" <sequence> -% \end{syntax} -% Signals an \LaTeX3 error if <sequence> is empty. -% \end{function} -% -% \begin{function}{\seq_pop_aux:nnNN} -% \begin{syntax} -% "\seq_pop_aux:nnNN" <assign1> <assign2> <sequence> <tl var.> -% \end{syntax} -% Function that assigns the left-most item of <sequence> to <tl var.> using -% <assign1> and assigns the tail to <sequence> using <assign2>. This -% function could be used to implement a global return function. -% \end{function} -% -% \begin{function}{% -% \seq_get_aux:w | -% \seq_pop_aux:w | -% \seq_put_aux:Nnn | -% \seq_put_aux:w | +% \begin{function}{\seq_pop_left:NN, \seq_pop_left:cN} +% \begin{syntax} +% \cs{seq_pop_left:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the left-most item from a \meta{sequence} into the +% \meta{token list variable}, \emph{i.e}.~removes the item from the +% sequence and stores it in the \meta{token list variable}. +% Both of the variables are assigned locally. If \meta{sequence} is +% empty an error will be raised. +% \end{function} +% +% \begin{function}{\seq_gpop_left:NN, \seq_gpop_left:cN} +% \begin{syntax} +% \cs{seq_gpop_left:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the left-most item from a \meta{sequence} into the +% \meta{token list variable}, \emph{i.e}.~removes the item from the +% sequence and stores it in the \meta{token list variable}. +% The \meta{sequence} is modified globally, while the assignment of +% the \meta{token list variable} is local. +% If \meta{sequence} is empty an error will be raised. +% \end{function} +% +% \begin{function}{\seq_pop_right:NN, \seq_pop_right:cN} +% \begin{syntax} +% \cs{seq_pop_right:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the right-most item from a \meta{sequence} into the +% \meta{token list variable}, \emph{i.e}.~removes the item from the +% sequence and storesitin in the \meta{token list variable}. +% Both of the variables are assigned locally. If \meta{sequence} is +% empty an error will be raised. +% \end{function} +% +% \begin{function}{\seq_gpop_right:NN, \seq_gpop_right:cN} +% \begin{syntax} +% \cs{seq_gpop_right:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the right-most item from a \meta{sequence} into the +% \meta{token list variable}, \emph{i.e}.~removes the item from the +% sequence and stores it in the \meta{token list variable}. +% The \meta{sequence} is modified globally, while the assignment of +% the \meta{token list variable} is local. +% If \meta{sequence} is empty an error will be raised. +% \end{function} +% +% \section{Modifying sequences} +% +% While sequences are normally used as ordered lists, it may be +% necessary to modify the content. The functions here may be used +% to update sequences, while retaining the order of the unaffected +% entries. +% +% \begin{function}{\seq_remove_duplicates:N, \seq_remove_duplicates:c} +% \begin{syntax} +% \cs{seq_remove_duplicates:N} \meta{sequence} +% \end{syntax} +% Removes duplicate items from the \meta{sequence}, leaving +% left most copy of each item in the \meta{sequence}. The \meta{item} +% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. +% The removal is local to the current \TeX{} group. +% \begin{texnote} +% This function iterates through every item in the \meta{sequence} and +% does a comparison with the \meta{items} already checked. It is therefore +% relatively slow with large sequences. +% \end{texnote} +% \end{function} +% +% \begin{function}{\seq_gremove_duplicates:N, \seq_gremove_duplicates:c} +% \begin{syntax} +% \cs{seq_gremove_duplicates:N} \meta{sequence} +% \end{syntax} +% Removes duplicate items from the \meta{sequence}, leaving +% left most copy of each item in the \meta{sequence}. The \meta{item} +% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. +% The removal is applied globally. +% \begin{texnote} +% This function iterates through every item in the \meta{sequence} and +% does a comparison with the \meta{items} already checked. It is therefore +% relatively slow with large sequences. +% \end{texnote} +% \end{function} +% +% \begin{function}{\seq_remove_all:Nn, \seq_remove_all:cn} +% \begin{syntax} +% \cs{seq_remove_all:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Removes every occurrence of \meta{item} from the \meta{sequence}. +% The \meta{item} comparison takes place on a token basis, as for +% \cs{tl_if_eq:nn(TF)}. The removal is local to the current \TeX{} group. +% \end{function} +% +% \begin{function}{\seq_gremove_all:Nn, \seq_gremove_all:cn} +% \begin{syntax} +% \cs{seq_gremove_all:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Removes each occurrence of \meta{item} from the \meta{sequence}. +% The \meta{item} comparison takes place on a token basis, as for +% \cs{tl_if_eq:nn(TF)}. The removal is applied globally. +% \end{function} +% +% \subsection{Sequence conditionals} +% +% \begin{function}[EXP,pTF]{\seq_if_empty:N, \seq_if_empty:c} +% \begin{syntax} +% \cs{seq_if_empty_p:N} \meta{sequence} +% \cs{seq_if_empty:NTF} \meta{sequence} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the \meta{sequence} is empty (containing no items). The +% branching versions then leave either \meta{true code} or +% \meta{false code} in the input stream, as appropriate to the truth of +% the test and the variant of the function chosen. The logical truth of +% the test is left in the input stream by the predicate version. +% \end{function} +% +% \begin{function}[TF]{ +% \seq_if_in:Nn, \seq_if_in:NV, \seq_if_in:Nv, \seq_if_in:No, \seq_if_in:Nx, +% \seq_if_in:cn, \seq_if_in:cV, \seq_if_in:cv, \seq_if_in:co, \seq_if_in:cx % } -% Functions used to implement put and get operations. They are not for -% meant for direct use. -% \end{function} -% -% \begin{function}{ \seq_elt:w | -% \seq_elt_end: } -% Functions (usually used as constants) that separates items within a -% sequence. They might get special meaning during mapping operations and -% are not supposed to show up as tokens within an item appended to a -% sequence. -% \end{function} -% -% \section{Functions for `Sequence Stacks'} -% -% Special sequences in \LaTeX3 are `stacks' with their usual operations -% of `push', `pop', and `top'. They are internally implemented as -% sequences and share some of the functions (like "\seq_new:N" etc.) -% -% \begin{function}{% -% \seq_push:Nn | -% \seq_push:NV | -% \seq_push:No | -% \seq_push:cn | -% \seq_gpush:Nn | -% \seq_gpush:NV | -% \seq_gpush:No | -% \seq_gpush:Nv | -% \seq_gpush:cn | +% \begin{syntax} +% \cs{seq_if_in:NnTF} \meta{sequence} \Arg{item} +% ~~\Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the \meta{item} is present in the \meta{sequence}. +% Either the \meta{true code} or \meta{false code} is left in the input +% stream, as appropriate to the truth of the test and the variant of the +% function +% chosen. +% \end{function} +% +% \section{Mapping to sequences} +% +% \begin{function}[EXP]{\seq_map_function:NN, \seq_map_function:cN} +% \begin{syntax} +% \cs{seq_map_function:NN} \meta{sequence} \meta{function} +% \end{syntax} +% Applies \meta{function} to every \meta{item} stored in the +% \meta{sequence}. The \meta{function} will receive one argument for +% each iteration. The \meta{items} are returned from left to right. +% The function \cs{seq_map_inline:Nn} is in general more efficient +% than \cs{seq_map_function:NN}. +% One mapping may be nested inside another. +% \end{function} +% +% \begin{function}{\seq_map_inline:Nn, \seq_map_inline:cn} +% \begin{syntax} +% \cs{seq_map_inline:Nn} \meta{sequence} \Arg{inline function} +% \end{syntax} +% Applies \meta{inline function} to every \meta{item} stored +% within the \meta{sequence}. The \meta{inline function} should +% consist of code which will receive the \meta{item} as |#1|. +% One in line mapping can be nested inside another. The \meta{items} +% are returned from left to right. +% \end{function} +% +% \begin{function}{ +% \seq_map_variable:NNn, \seq_map_variable:Ncn, +% \seq_map_variable:cNn, \seq_map_variable:ccn % } -% \begin{syntax} -% "\seq_push:Nn" <stack> \Arg{token list} -% \end{syntax} -% Locally or globally pushes <token list> as a single item onto the -% <stack>. -% \end{function} -% -% \begin{function}{% -% \seq_pop:NN | -% \seq_pop:cN | -% \seq_gpop:NN | -% \seq_gpop:cN | +% \begin{syntax} +% \cs{seq_map_variable:Nn} \meta{sequence} +% ~~\meta{tl~var.} \Arg{function using tl~var.} +% \end{syntax} +% Stores each entry in the \meta{sequence} in turn in the +% \meta{tl~var.}\ and applies the \meta{function using tl~var.} +% The \meta{function} will usually consist of code making use of +% the \meta{tl~var.}, but this is not enforced. One variable +% mapping can be nested inside another. The \meta{items} +% are returned from left to right. One variable mapping may be +% nested inside another. +% \end{function} +% +% \begin{function}[EXP]{\seq_map_break:} +% \begin{syntax} +% \cs{seq_map_break:} +% \end{syntax} +% Used to terminate a \cs{seq_map_\ldots} function before all +% entries in the \meta{sequence} have been processed. This will +% normally take place within a conditional statement, for example +% \begin{verbatim} +% \seq_map_inline:Nn \l_my_seq +% { +% \str_if_eq:nnTF { #1 } { bingo } +% { \seq_map_break: } +% { +% % Do something useful +% } +% } +% \end{verbatim} +% Use outside of a \cs{seq_map_\ldots} scenario will lead low +% level \TeX{} errors. +% \begin{texnote} +% When the mapping is broken, additional tokens may be inserted by the +% internal macro \cs{seq_break_point:n} before further items are taken +% from the input stream. This will depend on the design of the mapping +% function. +% \end{texnote} +% \end{function} +% +% \begin{function}[EXP]{\seq_map_break:n} +% \begin{syntax} +% \cs{seq_map_break:n} \Arg{tokens} +% \end{syntax} +% Used to terminate a \cs{seq_map_\ldots} function before all +% entries in the \meta{sequence} have been processed, inserting +% the \meta{tokens} after the mapping has ended. This will +% normally take place within a conditional statement, for example +% \begin{verbatim} +% \seq_map_inline:Nn \l_my_seq +% { +% \str_if_eq:nnTF { #1 } { bingo } +% { \seq_map_break:n { <tokens> } } +% { +% % Do something useful +% } +% } +% \end{verbatim} +% Use outside of a \cs{seq_map_\ldots} scenario will lead low +% level \TeX{} errors. +% \begin{texnote} +% When the mapping is broken, additional tokens may be inserted by the +% internal macro \cs{seq_break_point:n} before the \meta{tokens} are +% inserted into the input stream. +% This will depend on the design of the mapping function. +% \end{texnote} +% \end{function} +% +% \subsection{Sequences as stacks} +% +% Sequences can be used as stacks, where data is pushed to and popped +% from the top of the sequence. (The left of a sequence is the top, for +% performance reasons.) The stack functions for sequences are not +% intended to be mixed with the general ordered data functions detailed +% in the previous section: a sequence should either be used as an +% ordered data type or as a stack, but not in both ways. +% +% \begin{function}{\seq_get:NN, \seq_get:cN} +% \begin{syntax} +% \cs{seq_get:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Reads the top item from a \meta{sequence} into the +% \meta{token list variable} without removing it from the +% \meta{sequence}. The \meta{token list variable} is assigned locally. +% If \meta{sequence} is empty an error will be raised. +% \end{function} +% +% \begin{function}{\seq_pop:NN, \seq_pop:cN} +% \begin{syntax} +% \cs{seq_pop:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the top item from a \meta{sequence} into the +% \meta{token list variable}. Both of the variables are assigned +% locally. If \meta{sequence} is empty an error will be raised. +% \end{function} +% +% \begin{function}{\seq_gpop:NN, \seq_gpop:cN} +% \begin{syntax} +% \cs{seq_gpop:NN} \meta{sequence} \meta{token list variable} +% \end{syntax} +% Pops the top item from a \meta{sequence} into the +% \meta{token list variable}. The \meta{sequence} is modified globally, +% while the \meta{token list variable} is assigned locally. If +% \meta{sequence} is empty the marker an error will be raised. +% \end{function} +% +% \begin{function}{ +% \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx, +% \seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx % } -% \begin{syntax} -% "\seq_pop:NN" <stack> <tl var.> -% \end{syntax} -% Functions that assign the top item of <stack> to <tl var.> -% and removes it from <stack>! +% \begin{syntax} +% \cs{seq_push:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Adds the \Arg{item} to the top of the \meta{sequence}. +% The assignment is restricted to the current \TeX{} group. % \end{function} % -% \begin{function}{% -% \seq_top:NN | -% \seq_top:cN | +% \begin{function}{ +% \seq_gpush:Nn, \seq_gpush:NV, \seq_gpush:Nv, \seq_gpush:No, \seq_gpush:Nx, +% \seq_gpush:cn, \seq_gpush:cV, \seq_gpush:cv, \seq_gpush:co, \seq_gpush:cx % } -% \begin{syntax} -% "\seq_top:NN" <stack> <tl var.> -% \end{syntax} -% Functions that locally assign the top item of <stack> to the <tl var.>. -% Item is \emph{not} removed from <stack>! +% \begin{syntax} +% \cs{seq_gpush:Nn} \meta{sequence} \Arg{item} +% \end{syntax} +% Pushes the \meta{item} onto the end of the top of the +% \meta{sequence}. The assignment is global. +% \end{function} +% +% \section{Viewing sequences} +% +% \begin{function}{\seq_show:N, \seq_show:c} +% \begin{syntax} +% \cs{seq_show:N} \meta{sequence} +% \end{syntax} +% Displays the entries in the \meta{sequence} in the terminal. % \end{function} % % \end{documentation} % % \begin{implementation} % -% \section{\pkg{l3seq} implementation} +% \section{Internal sequence functions} +% +% \begin{function}{\seq_if_empty_err_break:N} +% \begin{syntax} +% \cs{seq_if_empty_err_break:N} \meta{sequence} +% \end{syntax} +% Tests if the \meta{sequence} is empty, and if so issues an error +% message before skipping over any tokens up to \cs{seq_break_point:n}. +% This function is used to avoid more serious errors which would +% otherwise occur if some internal functions were applied to an +% empty \meta{sequence}. +% \end{function} +% +% \begin{function}[EXP]{\seq_item:n} +% \begin{syntax} +% \cs{seq_item:n} \meta{item} +% \end{syntax} +% The internal token used to begin each sequence entry. If expanded +% outside of a mapping or manipulation function, an error will be +% raised. The definition should always be set globally. +% \end{function} +% +% \begin{function}{\seq_push_item_def:n, \seq_push_item_def:x} +% \begin{syntax} +% \cs{seq_push_item_def:n} \Arg{code} +% \end{syntax} +% Saves the definition of \cs{seq_item:n} and redefines it to +% accept one parameter and expand to \meta{code}. This function +% should always be balanced by use of \cs{seq_pop_item_def:}. +% \end{function} +% +% \begin{function}{\seq_pop_item_def:} +% \begin{syntax} +% \cs{seq_pop_item_def:} +% \end{syntax} +% Restores the definition of \cs{seq_item:n} most recently saved by +% \cs{seq_push_item_def:n}. This function should always be used in +% a balanced pair with \cs{seq_push_item_def:n}. +% \end{function} +% +% \begin{function}[EXP]{\seq_break:} +% \begin{syntax} +% \cs{seq_break:} +% \end{syntax} +% Used to terminate sequence functions by gobbling all tokens +% up to \cs{seq_break_point:n}. This function is a copy of +% \cs{seq_map_break:}, but is used in situations which are +% not mappings. +% \end{function} +% +% \begin{function}[EXP]{\seq_break:n} +% \begin{syntax} +% \cs{seq_break:n} \Arg{tokens} +% \end{syntax} +% Used to terminate sequence functions by gobbling all tokens +% up to \cs{seq_break_point:n}, then inserting the \meta{tokens} +% before continuing reading the input stream. This function is a copy +% of \cs{seq_map_break:n}, but is used in situations which are +% not mappings. +% \end{function} +% +% \begin{function}[EXP]{\seq_break_point:n} +% \begin{syntax} +% \cs{seq_break_point:n} \meta{tokens} +% \end{syntax} +% Used to mark the end of a recursion or mapping: the functions +% \cs{seq_map_break:} and \cs{seq_map_break:n} use this to break out +% of the loop. After the loop ends the \meta{tokens} are inserted into +% the input stream. This occurs even if the the break functions are +% \emph{not} applied: \cs{seq_break_point:n} is functionally-equivalent +% in these cases to \cs{use:n}. +% \end{function} +% +% \section{Sequence implementation} +% +% \TestFiles{m3seq002,m3seq003} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} % % \begin{macrocode} %<*package> @@ -444,40 +640,53 @@ %</package> % \end{macrocode} % -% A sequence is a control sequence whose top-level expansion is of the -% form `|\seq_elt:w| \m{text$\sb1$} |\seq_elt_end:| \ldots{} -% |\seq_elt:w| \meta{text$\sb{n}$} \ldots'. We use explicit delimiters -% instead of braces around \m{text} to allow efficient searching for -% an item in the sequence. -% -% \begin{macro}{\seq_elt:w} -% \begin{macro}{\seq_elt_end:} -% We allocate the delimiters and make them errors if executed. +% A sequence is a control sequence whose top-level expansion is of +% the form \enquote{\cs{seq_item:n} \marg{item$_1$} +% \ldots \cs{seq_item:n} \marg{item$_n$}}. An earlier implementation +% used the structure \enquote{\cs{seq_elt:w} \meta{item$_1$} +% \cs{seq_elt_end:} \ldots \cs{seq_elt:w} \meta{item$_n$} +% \cs{seq_elt_end:}}. This allows rapid searching using a delimited +% function, but is not suitable for items containing |{|, |}| and |#| +% tokens, and which also leads to the loss of surrounding braces +% around items. +% +% \begin{macro}[int]{\seq_item:n} +% The delimiter is always defined, but when used incorrectly simply +% removes its argument and hits an undefined control sequence to +% raise an error. % \begin{macrocode} -%<*initex|package> -\cs_new:Npn \seq_elt:w {\ERROR} -\cs_new:Npn \seq_elt_end: {\ERROR} +\cs_new:Npn \seq_item:n + { + \seq_use_error: + \use_none:n + } % \end{macrocode} % \end{macro} +% +% \begin{macro}[aux]{\l_seq_tmpa_tl, \l_seq_tmpb_tl} +% Scratch space for various internal uses. +% \begin{macrocode} +\tl_new:N \l_seq_tmpa_tl +\tl_new:N \l_seq_tmpb_tl +% \end{macrocode} % \end{macro} % -% \subsection{Allocating and initialisation} +% \subsection{Allocation and initialisation} % -% \begin{macro}{\seq_new:N} -% \begin{macro}{\seq_new:c} -% Sequences are implemented using token lists. +% \begin{macro}{\seq_new:N,\seq_new:c} +% \UnitTested +% Internally, sequences are just token lists. % \begin{macrocode} \cs_new_eq:NN \seq_new:N \tl_new:N \cs_new_eq:NN \seq_new:c \tl_new:c % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\seq_clear:N} -% \begin{macro}{\seq_clear:c} -% \begin{macro}{\seq_gclear:N} -% \begin{macro}{\seq_gclear:c} -% Clearing a sequence is the same as clearing a token list. +% \begin{macro}{\seq_clear:N, \seq_clear:c} +% \UnitTested +% \begin{macro}{\seq_gclear:N, \seq_gclear:c} +% \UnitTested +% Clearing sequences is just the same as clearing token lists. % \begin{macrocode} \cs_new_eq:NN \seq_clear:N \tl_clear:N \cs_new_eq:NN \seq_clear:c \tl_clear:c @@ -486,14 +695,12 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\seq_clear_new:N} -% \begin{macro}{\seq_clear_new:c} -% \begin{macro}{\seq_gclear_new:N} -% \begin{macro}{\seq_gclear_new:c} -% Clearing a sequence is the same as clearing a token list. +% \begin{macro}{\seq_clear_new:N, \seq_clear_new:c} +% \UnitTested +% \begin{macro}{\seq_gclear_new:N, \seq_gclear_new:c} +% \UnitTested +% Once again a simply copy from the token list functions. % \begin{macrocode} \cs_new_eq:NN \seq_clear_new:N \tl_clear_new:N \cs_new_eq:NN \seq_clear_new:c \tl_clear_new:c @@ -502,499 +709,683 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\seq_set_eq:NN} -% \begin{macro}{\seq_set_eq:Nc} -% \begin{macro}{\seq_set_eq:cN} -% \begin{macro}{\seq_set_eq:cc} -% We can set one "seq" equal to another. -% \begin{macrocode} -\cs_new_eq:NN \seq_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \seq_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \seq_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \seq_set_eq:cc \cs_set_eq:cc +% +% \begin{macro}{\seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc} +% \UnitTested +% \begin{macro} +% {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc} +% \UnitTested +% Once again, these are simply copies from the token list functions. +% \begin{macrocode} +\cs_new_eq:NN \seq_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \seq_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \seq_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \seq_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \seq_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\seq_gset_eq:NN} -% \begin{macro}{\seq_gset_eq:cN} -% \begin{macro}{\seq_gset_eq:Nc} -% \begin{macro}{\seq_gset_eq:cc} -% And of course globally which seems to be needed far more -% often.\footnote{To save a bit of space these functions could be made -% identical to those from the tl or clist module.} +% \begin{macro}{\seq_concat:NNN, \seq_concat:ccc} +% \UnitTested +% \begin{macro}{\seq_gconcat:NNN, \seq_gconcat:ccc} +% \UnitTested +% Concatenating sequences is easy. % \begin{macrocode} -\cs_new_eq:NN \seq_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \seq_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \seq_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \seq_gset_eq:cc \cs_gset_eq:cc +\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 + { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 + { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_generate_variant:Nn \seq_concat:NNN { ccc } +\cs_generate_variant:Nn \seq_gconcat:NNN { ccc } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\seq_concat:NNN,\seq_concat:ccc} -% |\seq_concat:NNN| \m{seq~1} \m{seq~2} \m{seq~3} will locally -% assign \m{seq~1} the concatenation of \m{seq~2} and \m{seq~3}. +% \subsection{Appending data to either end} +% +% \begin{macro}{ +% \seq_put_left:Nn, \seq_put_left:NV, \seq_put_left:Nv, +% \seq_put_left:No, \seq_put_left:Nx, +% \seq_put_left:cn, \seq_put_left:cV, \seq_put_left:cv, +% \seq_put_left:co, \seq_put_left:cx +% } +% \UnitTested +% \begin{macro}{ +% \seq_put_right:Nn, \seq_put_right:NV, \seq_put_right:Nv, +% \seq_put_right:No, \seq_put_right:Nx, +% \seq_put_right:cn, \seq_put_right:cV, \seq_put_right:cv, +% \seq_put_right:co, \seq_put_right:cx +% } +% \UnitTested +% The code here is just a wrapper for adding to token lists. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 { - \tl_set:Nx #1 { \exp_not:V #2 \exp_not:V #3 } -} -\cs_generate_variant:Nn \seq_concat:NNN {ccc} +\cs_new_protected:Npn \seq_put_left:Nn #1#2 + { \tl_put_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_put_right:Nn #1#2 + { \tl_put_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\seq_gconcat:NNN,\seq_gconcat:ccc} -% |\seq_gconcat:NNN| \m{seq~1} \m{seq~2} \m{seq~3} will globally -% assign \m{seq~1} the concatenation of \m{seq~2} and \m{seq~3}. +% \begin{macro}{ +% \seq_gput_left:Nn, \seq_gput_left:NV, \seq_gput_left:Nv, +% \seq_gput_left:No, \seq_gput_left:Nx, +% \seq_gput_left:cn, \seq_gput_left:cV, \seq_gput_left:cv, +% \seq_gput_left:co, \seq_gput_left:cx +% } +% \begin{macro}{ +% \seq_gput_right:Nn, \seq_gput_right:NV, \seq_gput_right:Nv, +% \seq_gput_right:No, \seq_gput_right:Nx, +% \seq_gput_right:cn, \seq_gput_right:cV,\seq_gput_right:cv, +% \seq_gput_right:co, \seq_gput_right:cx +% } +% The same for global addition. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 { - \tl_gset:Nx #1 { \exp_not:V #2 \exp_not:V #3 } -} -\cs_generate_variant:Nn \seq_gconcat:NNN {ccc} +\cs_new_protected:Npn \seq_gput_left:Nn #1#2 + { \tl_gput_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_gput_right:Nn #1#2 + { \tl_gput_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx } % \end{macrocode} % \end{macro} +% \end{macro} % -% \subsection{Predicates and conditionals} +% \subsection{Breaking sequence functions} % -% \begin{macro}{\seq_if_empty_p:N,\seq_if_empty_p:c} -% \begin{macro}[TF]{\seq_if_empty:N,\seq_if_empty:c} -% A predicate which evaluates to |\c_true_bool| iff the sequence is empty. +% \begin{macro}[int]{\seq_break:} +% \begin{macro}[int]{\seq_break:n} +% To break a function, the special token \cs{seq_break_point:n} is +% used to find the end of the code. Any ending code is then inserted +% before the return value of \cs{seq_map_break:n} is inserted. % \begin{macrocode} -\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N {p,TF,T,F} -\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c {p,TF,T,F} +\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2} +\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 } % \end{macrocode} % \end{macro} % \end{macro} % -% -% \begin{macro}{\seq_if_empty_err:N} -% Signals an error if the sequence is empty. +% \begin{macro}{\seq_map_break:} +% \UnitTested +% \begin{macro}{\seq_map_break:n} +% \UnitTested +% Semantically-logical copies of the break functions for use inside +% mappings. % \begin{macrocode} -\cs_new_nopar:Npn \seq_if_empty_err:N #1 { - \if_meaning:w #1 \c_empty_tl +\cs_new_eq:NN \seq_map_break: \seq_break: +\cs_new_eq:NN \seq_map_break:n \seq_break:n % \end{macrocode} -% As I said before, I don't think we need to provide checks for this -% kind of error, since it is a severe internal macro package error -% that can not be produced by the user directly. Can it? So the -% next line of code should be probably removed. -% (Will: I have no idea what this comment means.) +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\seq_break_point:n} +% Normally, the marker token will not be executed, but if it is then +% the end code is simply inserted. % \begin{macrocode} - \tl_clear:N \l_kernel_testa_tl % catch prefixes - \msg_kernel_bug:x {Empty~sequence~`\token_to_str:N#1'} - \fi: -} +\cs_new_eq:NN \seq_break_point:n \use:n % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\seq_if_in:Nn,\seq_if_in:NV,\seq_if_in:cn, -% \seq_if_in:cV,\seq_if_in:co,\seq_if_in:cx} -% |\seq_if_in:NnTF| \m{seq}\m{item} \m{true~case} \m{false~case} -% will check whether \m{item} is in \m{seq} and then either execute -% the \m{true~case} or the \m{false~case}. \m{true~case} and -% \m{false~case} may contain incomplete |\if_charcode:w| -% statements. -% -% Note that |##2| in the definition below for "\seq_tmp:w" contains -% exactly one token which we can compare with |\q_no_value|. +% \begin{macro}[int]{\seq_if_empty_err_break:N} +% A function to check that sequences really have some content. This +% is optimised for speed, hence the direct primitive use. % \begin{macrocode} -\prg_new_protected_conditional:Nnn \seq_if_in:Nn {TF,T,F} { - \cs_set:Npn \seq_tmp:w ##1 \seq_elt:w #2 \seq_elt_end: ##2##3 \q_stop { - \if_meaning:w \q_no_value ##2 - \prg_return_false: \else: \prg_return_true: \fi: +\cs_new_protected_nopar:Npn \seq_if_empty_err_break:N #1 + { + \tex_ifx:D #1 \c_empty_tl + \msg_kernel_bug:x { Empty~sequence~\token_to_str:N #1 } + \exp_after:wN \seq_break: + \tex_fi:D } - \exp_after:wN \seq_tmp:w #1 \seq_elt:w #2 \seq_elt_end: \q_no_value \q_stop -} -% \end{macrocode} -% \begin{macrocode} -\cs_generate_variant:Nn \seq_if_in:NnTF { NV, cV, co, c, cx} -\cs_generate_variant:Nn \seq_if_in:NnT { NV, cV, co, c, cx} -\cs_generate_variant:Nn \seq_if_in:NnF { NV, cV, co, c, cx} % \end{macrocode} % \end{macro} % -% \subsection{Getting data out} +% \subsection{Mapping to sequences} % -% \begin{macro}{\seq_get:NN} -% \begin{macro}{\seq_get:cN} -% \begin{macro}{\seq_get_aux:w} -% |\seq_get:NN |\meta{sequence}\meta{cmd} defines \meta{cmd} to be the -% left-most element of \meta{sequence}. +% \begin{macro}{\seq_map_function:NN, \seq_map_function:cN} +% \UnitTested +% \begin{macro}[aux]{\seq_map_function_aux:NNn} +% The idea here is to apply the code of |#2| to each item in the +% sequence without altering the definition of \cs{seq_item:n}. This +% is done as by noting that every odd token in the sequence must be +% \cs{seq_item:n}, which can be gobbled by \cs{use_none:n}. At the end of +% the loop, |#2| is instead |? \seq_map_break:|, which therefore breaks the +% loop without needing to do a (relatively-expensive) quark test. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_get:NN #1 { - \seq_if_empty_err:N #1 - \exp_after:wN \seq_get_aux:w #1 \q_stop -} -\cs_new_protected:Npn \seq_get_aux:w \seq_elt:w #1 \seq_elt_end: #2 \q_stop #3 { - \tl_set:Nn #3 {#1} -} -\cs_generate_variant:Nn \seq_get:NN {c} +\cs_new:Npn \seq_map_function:NN #1#2 + { + \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 + { ? \seq_map_break: } { } + \seq_break_point:n { } + } +\cs_new:Npn \seq_map_function_aux:NNn #1#2#3 + { + \use_none:n #2 + #1 {#3} + \seq_map_function_aux:NNn #1 + } +\cs_generate_variant:Nn \seq_map_function:NN { c } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}{\seq_pop_aux:nnNN} -% \begin{macro}{\seq_pop_aux:w} -% |\seq_pop_aux:nnNN| \meta{def$\sb1$} \meta{def$\sb2$} \meta{sequence} -% \meta{cmd} assigns the left_most element of \meta{sequence} to -% \meta{cmd} using \meta{def$\sb2$}, and assigns the tail of -% \meta{sequence} to \meta{sequence} using \meta{def$\sb1$}. +% \begin{macro}[aux]{\g_seq_nesting_depth_int} +% A counter to keep track of nested functions. % \begin{macrocode} -\cs_new_protected:Npn \seq_pop_aux:nnNN #1#2#3 { - \seq_if_empty_err:N #3 - \exp_after:wN \seq_pop_aux:w #3 \q_stop #1#2#3 -} -\cs_new_protected:Npn \seq_pop_aux:w - \seq_elt:w #1 \seq_elt_end: #2\q_stop #3#4#5#6 { - #3 #5 {#2} - #4 #6 {#1} -} +\int_new:N \g_seq_nesting_depth_int % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\seq_show:N} -% \begin{macro}{\seq_show:c} +% \begin{macro}[int]{\seq_push_item_def:n, \seq_push_item_def:x} +% \begin{macro}[aux]{\seq_push_item_def_aux:} +% \begin{macro}[int]{\seq_pop_item_def:} +% The definition of \cs{seq_item:n} needs to be saved and restored at +% various points within the mapping and manipulation code. That is handled +% here: as always, this approach uses global assignments. % \begin{macrocode} -\cs_new_eq:NN \seq_show:N \tl_show:N -\cs_new_eq:NN \seq_show:c \tl_show:c +\cs_new_protected:Npn \seq_push_item_def:n + { + \seq_push_item_def_aux: + \cs_gset:Npn \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def:x + { + \seq_push_item_def_aux: + \cs_gset:Npx \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def_aux: + { + \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + \seq_item:n + \int_gincr:N \g_seq_nesting_depth_int + } +\cs_new_protected_nopar:Npn \seq_pop_item_def: + { + \int_gdecr:N \g_seq_nesting_depth_int + \cs_gset_eq:Nc \seq_item:n + { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}{\seq_display:N} -% \begin{macro}{\seq_display:c} +% \begin{macro}{\seq_map_inline:Nn, \seq_map_inline:cn} +% \UnitTested +% The idea here is that \cs{seq_item:n} is already \enquote{applied} to +% each item in a sequence, and so an in-line mapping is just a case of +% redefining \cs{seq_item:n}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_display:N #1 { - \iow_term:x { Sequence~\token_to_str:N #1~contains~ - the~elements~(without~outer~braces): } - \toks_clear:N \l_tmpa_toks - \seq_map_inline:Nn #1 { - \toks_if_empty:NF \l_tmpa_toks { - \toks_put_right:Nx \l_tmpa_toks {^^J>~} - } - \toks_put_right:Nx \l_tmpa_toks { - \c_space_tl \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} - } +\cs_new_protected:Npn \seq_map_inline:Nn #1#2 + { + \seq_push_item_def:n {#2} + #1 + \seq_break_point:n { \seq_pop_item_def: } } - \toks_show:N \l_tmpa_toks -} -\cs_generate_variant:Nn \seq_display:N {c} +\cs_generate_variant:Nn \seq_map_inline:Nn { c } % \end{macrocode} % \end{macro} +% +% \begin{macro}{ +% \seq_map_variable:NNn,\seq_map_variable:Ncn, +% \seq_map_variable:cNn,\seq_map_variable:ccn +% } +% \UnitTested +% This is just a specialised version of the in-line mapping function, +% using an \texttt{x}-type expansion for the code set up so that the +% number of |#| tokens required is as expected. +% \begin{macrocode} +\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 + { + \seq_push_item_def:x + { + \tl_set:Nn \exp_not:N #2 {##1} + \exp_not:n {#3} + } + #1 + \seq_break_point:n { \seq_pop_item_def: } + } +\cs_generate_variant:Nn \seq_map_variable:NNn { Nc } +\cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } +% \end{macrocode} % \end{macro} % +% \subsection{Sequence stacks} % -% \subsection{Putting data in} +% The same functions as for sequences, but with the correct naming. % -% \begin{macro}{\seq_put_aux:Nnn} -% \begin{macro}{\seq_put_aux:w} -% |\seq_put_aux:Nnn| \meta{sequence} \meta{left} \meta{right} adds the -% elements specified by \meta{left} to the left of \meta{sequence}, and -% those specified by \meta{right} to the right. +% \begin{macro}{ +% \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx, +% \seq_push:cn, \seq_push:cV, \seq_push:cV, \seq_push:co, \seq_push:cx +% } +% \UnitTested +% \begin{macro}{ +% \seq_gpush:Nn, \seq_gpush:NV, \seq_gpush:Nv, \seq_gpush:No, \seq_gpush:Nx, +% \seq_gpush:cn, \seq_gpush:cV, \seq_gpush:cv, \seq_gpush:co, \seq_gpush:cx +% } +% \UnitTested +% Pushing to a sequence is the same as adding on the left. % \begin{macrocode} -\cs_new_protected:Npn \seq_put_aux:Nnn #1 { - \exp_after:wN \seq_put_aux:w #1 \q_stop #1 -} -\cs_new_protected:Npn \seq_put_aux:w #1\q_stop #2#3#4 { \tl_set:Nn #2 {#3#1#4} } +\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn +\cs_new_eq:NN \seq_push:NV \seq_put_left:NV +\cs_new_eq:NN \seq_push:Nv \seq_put_left:Nv +\cs_new_eq:NN \seq_push:No \seq_put_left:No +\cs_new_eq:NN \seq_push:Nx \seq_put_left:Nx +\cs_new_eq:NN \seq_push:cn \seq_put_left:cn +\cs_new_eq:NN \seq_push:cV \seq_put_left:cV +\cs_new_eq:NN \seq_push:cv \seq_put_left:cv +\cs_new_eq:NN \seq_push:co \seq_put_left:co +\cs_new_eq:NN \seq_push:cx \seq_put_left:cx +\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn +\cs_new_eq:NN \seq_gpush:NV \seq_gput_left:NV +\cs_new_eq:NN \seq_gpush:Nv \seq_gput_left:Nv +\cs_new_eq:NN \seq_gpush:No \seq_gput_left:No +\cs_new_eq:NN \seq_gpush:Nx \seq_gput_left:Nx +\cs_new_eq:NN \seq_gpush:cn \seq_gput_left:cn +\cs_new_eq:NN \seq_gpush:cV \seq_gput_left:cV +\cs_new_eq:NN \seq_gpush:cv \seq_gput_left:cv +\cs_new_eq:NN \seq_gpush:co \seq_gput_left:co +\cs_new_eq:NN \seq_gpush:cx \seq_gput_left:cx % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\seq_put_left:Nn} -% \begin{macro}{\seq_put_left:NV} -% \begin{macro}{\seq_put_left:No} -% \begin{macro}{\seq_put_left:Nx} -% \begin{macro}{\seq_put_left:cn} -% \begin{macro}{\seq_put_left:cV} -% \begin{macro}{\seq_put_left:co} -% \begin{macro}{\seq_put_right:Nn} -% \begin{macro}{\seq_put_right:No} -% \begin{macro}{\seq_put_right:NV} -% \begin{macro}{\seq_put_right:Nx} -% \begin{macro}{\seq_put_right:cn} -% \begin{macro}{\seq_put_right:cV} -% \begin{macro}{\seq_put_right:co} -% Here are the usual operations for adding to the left and right. -% \begin{macrocode} -\cs_new_protected:Npn \seq_put_left:Nn #1#2 { - \seq_put_aux:Nnn #1 {\seq_elt:w #2\seq_elt_end:} {} -} -% \end{macrocode} -% We can't put in a |\prg_do_nothing:| instead of |{}| above since this argument -% is passed literally (and we would end up with many |\prg_do_nothing:|s inside -% the sequences). -% \begin{macrocode} -\cs_generate_variant:Nn \seq_put_left:Nn {NV,No,Nx,c,cV,co} -% \end{macrocode} +% \begin{macro}{\seq_get_left:NN, \seq_get_left:cN} +% \UnitTested +% \begin{macro}[aux]{\seq_get_left_aux:Nw} +% Getting an item from the left of a sequence is pretty easy: just +% trim off the first item after removing the \cs{seq_item:n} at +% the start. % \begin{macrocode} -\cs_new_protected:Npn \seq_put_right:Nn #1#2{ - \seq_put_aux:Nnn #1{}{\seq_elt:w #2\seq_elt_end:}} -% \end{macrocode} -% \begin{macrocode} -\cs_generate_variant:Nn \seq_put_right:Nn {NV,No,Nx,c,cV,co} +\cs_new_protected_nopar:Npn \seq_get_left:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_get_left_aux:Nw \seq_item:n #1#2 \q_stop #3 + { \tl_set:Nn #3 {#1} } +\cs_generate_variant:Nn \seq_get_left:NN { c } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +% +% \begin{macro}{\seq_pop_left:NN, \seq_pop_left:cN} +% \UnitTested +% \begin{macro}{\seq_gpop_left:NN, \seq_gpop_left:cN} +% \UnitTested +% \begin{macro}[aux]{\seq_pop_left_aux:NNN} +% \begin{macro}[aux]{\seq_pop_left_aux:Nw} +% The approach to popping an item is pretty similar to that to get +% an item, with the only difference being that the sequence itself has +% to be redefined. This makes it more sensible to use an auxiliary +% function for the local and global cases. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \seq_pop_left:NN + { \seq_pop_left_aux:NNN \tl_set:Nn } +\cs_new_protected_nopar:Npn \seq_gpop_left:NN + { \seq_pop_left_aux:NNN \tl_gset:Nn } +\cs_new_protected_nopar:Npn \seq_pop_left_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \exp_after:wN \seq_pop_left_aux:Nw #2 \q_stop #1#2#3 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_pop_left_aux:Nw \seq_item:n #1#2 \q_stop #3#4#5 + { + #3 #4 {#2} + \tl_set:Nn #5 {#1} + } +\cs_generate_variant:Nn \seq_pop_left:NN { c } +\cs_generate_variant:Nn \seq_gpop_left:NN { c } +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\seq_gput_left:Nn} -% \begin{macro}{\seq_gput_left:NV} -% \begin{macro}{\seq_gput_left:No} -% \begin{macro}{\seq_gput_left:Nx} -% \begin{macro}{\seq_gput_left:cn} -% \begin{macro}{\seq_gput_left:cV} -% \begin{macro}{\seq_gput_left:co} -% \begin{macro}{\seq_gput_right:Nn} -% \begin{macro}{\seq_gput_right:NV} -% \begin{macro}{\seq_gput_right:No} -% \begin{macro}{\seq_gput_right:Nx} -% \begin{macro}{\seq_gput_right:cn} -% \begin{macro}{\seq_gput_right:cV} -% \begin{macro}{\seq_gput_right:co} -% \begin{macrocode} -\cs_new_protected:Npn \seq_gput_left:Nn { -%<*check> - \pref_global_chk: -%</check> -%<*!check> - \pref_global:D -%</!check> - \seq_put_left:Nn -} -% \end{macrocode} +% \begin{macro}{\seq_get_right:NN, \seq_get_right:cN} +% \UnitTested +% \begin{macro}[aux]{\seq_get_right_aux:NN} +% \begin{macro}[aux]{\seq_get_right_loop:nn} +% The idea here is to remove the very first \cs{seq_item:n} from the +% sequence, leaving a token list starting with the first braced entry. +% Two arguments at a time are then grabbed: apart from the right-hand end of +% the sequence, this will be a brace group followed by \cs{seq_item:n}. The +% set up code means that these all disappear. At the end of the sequence, +% the assignment is placed in front of the very last entry in the sequence, +% before a tidying-up step takes place to remove the loop and reset the +% meaning of \cs{seq_item:n}. % \begin{macrocode} -\cs_new_protected:Npn \seq_gput_right:Nn { -%<*check> - \pref_global_chk: -%</check> -%<*!check> - \pref_global:D -%</!check> - \seq_put_right:Nn +\cs_new_protected_nopar:Npn \seq_get_right:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \seq_get_right_aux:NN #1#2 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2 + { + \seq_push_item_def:n { } + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #1 + { \tl_set:Nn #2 } + { } + { + \seq_pop_item_def: + \seq_break: + } } +\cs_new:Npn \seq_get_right_loop:nn #1#2 + { + #2 {#1} + \seq_get_right_loop:nn + } +\cs_generate_variant:Nn \seq_get_right:NN { c } % \end{macrocode} -% \begin{macrocode} -\cs_generate_variant:Nn \seq_gput_left:Nn {NV,No,Nx,c,cV,co} -% \end{macrocode} -% \begin{macrocode} -\cs_generate_variant:Nn \seq_gput_right:Nn {NV,No,Nx,c,cV,co} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% \subsection{Mapping} % -% \begin{macro}{\seq_map_variable:NNn} -% \begin{macro}{\seq_map_variable:cNn} -% \begin{macro}[aux]{\seq_map_variable_aux:Nnw} -% Nothing spectacular here. +% \begin{macro}{\seq_pop_right:NN, \seq_pop_right:cN} +% \UnitTested +% \begin{macro}{\seq_gpop_right:NN, \seq_gpop_right:cN} +% \UnitTested +% \begin{macro}[aux]{\seq_get_right_aux:NNN, \seq_get_right_aux_ii:NNN} +% The approach to popping from the right is a bit more involved, but does +% use some of the same ideas as getting from the right. What is needed is a +% \enquote{flexible length} way to set a token list variable. This is supplied +% by the |{ \tex_iffalse:D } \tex_fi:D| \ldots |\tex_iffalse:D { \tex_fi:D }| +% construct. Using an \texttt{x}-type expansion and a \enquote{non-expanding} +% definition for \cs{seq_item:n}, the left-most $n - 1$ entries in a +% sequence of $n$ items will be stored back in the sequence. That needs +% a loop of unknown length, hence using the strange \cs{tex_iffalse:D} +% way of including brackets. When the last item of the sequence is reached, +% the closing bracket for the assignment is inserted, and |\tl_set:Nn #3| +% is inserted in front of the final entry. This therefore does the pop +% assignment, then a final loop clears up the code. % \begin{macrocode} -\cs_new_protected:Npn \seq_map_variable_aux:Nnw #1#2 \seq_elt:w #3 \seq_elt_end: { - \tl_set:Nn #1 {#3} - \quark_if_nil:NT #1 \seq_map_break: - #2 - \seq_map_variable_aux:Nnw #1{#2} -} -\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 { - \tl_set:Nn #2 {\seq_map_variable_aux:Nnw #2{#3}} - \exp_after:wN #2 #1 \seq_elt:w \q_nil\seq_elt_end: \q_stop -} -\cs_generate_variant:Nn \seq_map_variable:NNn {c} +\cs_new_protected_nopar:Npn \seq_pop_right:NN + { \seq_pop_right_aux:NNN \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gpop_right:NN + { \seq_pop_right_aux:NNN \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_pop_right_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \seq_pop_right_aux_ii:NNN #1 #2 #3 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3 + { + \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } } + #1 #2 { \tex_iffalse:D } \tex_fi:D + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #2 + { + \tex_iffalse:D { \tex_fi:D } + \tl_set:Nn #3 + } + { } + { + \seq_pop_item_def: + \seq_break: + } + } +\cs_generate_variant:Nn \seq_pop_right:NN { c } +\cs_generate_variant:Nn \seq_gpop_right:NN { c } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\seq_map_break:} -% \begin{macro}{\seq_map_break:n} -% Terminate a mapping function at the point of execution. The latter -% takes an argument to be executed after cleaning up the map. +% \begin{macro}{\seq_get:NN, \seq_get:cN} +% \UnitTested +% \begin{macro}{\seq_pop:NN, \seq_pop:cN} +% \UnitTested +% \begin{macro}{\seq_gpop:NN, \seq_gpop:cN} +% \UnitTested +% In most cases, getting items from the stack does not need to specify +% that this is from the left. So alias are provided. % \begin{macrocode} -\cs_new_eq:NN \seq_map_break: \use_none_delimit_by_q_stop:w -\cs_new_eq:NN \seq_map_break:n \use_i_delimit_by_q_stop:nw +\cs_new_eq:NN \seq_get:NN \seq_get_left:NN +\cs_new_eq:NN \seq_get:cN \seq_get_left:cN +\cs_new_eq:NN \seq_pop:NN \seq_pop_left:NN +\cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN +\cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN +\cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% +% \subsection{Sequence conditionals} % -% \begin{macro}{\seq_map_function:NN} -% \begin{macro}{\seq_map_function:cN} -% |\seq_map_function:NN| \meta{sequence} \meta{cmd} applies \meta{cmd} to each -% element of \meta{sequence}, from left to right. Since we don't have -% braces, this implementation is not very efficient. It might be -% better to say that \meta{cmd} must be a function with one argument -% that is delimited by |\seq_elt_end:|. +% \begin{macro}[pTF]{\seq_if_empty:N, \seq_if_empty:c} +% \UnitTested +% Simple copies from the token list variable material. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_map_function:NN #1#2 { - \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2{##1}} - #1 \use_none:n \q_stop - \cs_set_eq:NN \seq_elt:w \ERROR -} -\cs_generate_variant:Nn \seq_map_function:NN {c} +\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N + { p , T , F , TF } +\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c + { p , T , F , TF } % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\seq_map_inline:Nn} -% \begin{macro}{\seq_map_inline:cn} -% When no braces are used, this version of mapping seems more -% natural. +% \begin{macro}[TF]{ +% \seq_if_in:Nn, \seq_if_in:NV, \seq_if_in:Nv, \seq_if_in:No, \seq_if_in:Nx, +% \seq_if_in:cn, \seq_if_in:cV, \seq_if_in:cv, \seq_if_in:co, \seq_if_in:cx +% } +% \UnitTested +% \begin{macro}[aux]{\seq_if_in_aux:} +% The approach here is to define \cs{seq_item:n} to compare its +% argument with the test sequence. If the two items are equal, the +% mapping is terminated and \cs{prg_return_true:} is inserted. On the +% other hand, if there is no match then the loop will break returning +% \cs{prg_return_false:}. In either case, \cs{seq_break_point:n} +% ensures that the group ends before the logical value is returned. +% Everything is inside a group so that \cs{seq_item:n} is preserved +% in nested situations. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_map_inline:Nn #1#2 { - \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2} - #1 \use_none:n \q_stop - \cs_set_eq:NN \seq_elt:w \ERROR -} -\cs_generate_variant:Nn \seq_map_inline:Nn {c} +\prg_new_protected_conditional:Npnn \seq_if_in:Nn #1#2 + { T , F , TF } + { + \group_begin: + \tl_set:Nn \l_seq_tmpa_tl {#2} + \cs_set_protected:Npn \seq_item:n ##1 + { + \tl_set:Nn \l_seq_tmpb_tl {##1} + \tex_ifx:D \l_seq_tmpa_tl \l_seq_tmpb_tl + \exp_after:wN \seq_if_in_aux: + \tex_fi:D + } + #1 + \seq_break:n { \prg_return_false: } + \seq_break_point:n { \group_end: } + } +\cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } +\cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnT { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnF { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnTF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnTF { c , cV , cv , co , cx } % \end{macrocode} % \end{macro} % \end{macro} % -% \subsection{Manipulation} +% \subsection{Modifying sequences} % -% \begin{macro}[aux]{\l_clist_remove_clist} -% A common scratch space for the removal routines. +% \begin{macro}[aux]{\l_seq_remove_seq} +% An internal sequence for the removal routines. % \begin{macrocode} \seq_new:N \l_seq_remove_seq % \end{macrocode} -% \end{macro} +% \end{macro} % -% \begin{macro}[aux]{\seq_remove_duplicates_aux:NN} -% \begin{macro}[aux]{\seq_remove_duplicates_aux:n} -% \begin{macro}{\seq_remove_duplicates:N} -% \begin{macro}{\seq_gremove_duplicates:N} -% Copied from "\clist_remove_duplicates". +% \begin{macro}{\seq_remove_duplicates:N, \seq_remove_duplicates:c} +% \UnitTested +% \begin{macro}{\seq_gremove_duplicates:N, \seq_gremove_duplicates:c} +% \UnitTested +% \begin{macro}[aux]{\seq_remove_duplicates_aux:NN} +% Removing duplicates means making a new list then copying it. % \begin{macrocode} -\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 { - \seq_clear:N \l_seq_remove_seq - \seq_map_function:NN #2 \seq_remove_duplicates_aux:n - #1 #2 \l_seq_remove_seq -} -\cs_new_protected:Npn \seq_remove_duplicates_aux:n #1 { - \seq_if_in:NnF \l_seq_remove_seq {#1} { - \seq_put_right:Nn \l_seq_remove_seq {#1} +\cs_new_protected:Npn \seq_remove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_set_eq:NN } +\cs_new_protected:Npn \seq_gremove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_gset_eq:NN } +\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 + { + \seq_clear:N \l_seq_remove_seq + \seq_map_inline:Nn #2 + { + \seq_if_in:NnF \l_seq_remove_seq {##1} + { \seq_put_right:Nn \l_seq_remove_seq {##1} } + } + #1 #2 \l_seq_remove_seq } -} -% \end{macrocode} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_remove_duplicates:N { - \seq_remove_duplicates_aux:NN \seq_set_eq:NN -} -\cs_new_protected_nopar:Npn \seq_gremove_duplicates:N { - \seq_remove_duplicates_aux:NN \seq_gset_eq:NN -} +\cs_generate_variant:Nn \seq_remove_duplicates:N { c } +\cs_generate_variant:Nn \seq_gremove_duplicates:N { c } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Sequence stacks} -% -% \begin{macro}{\seq_push:Nn} -% \begin{macro}{\seq_push:NV} -% \begin{macro}{\seq_push:No} -% \begin{macro}{\seq_push:cn} -% \begin{macro}{\seq_pop:NN} -% \begin{macro}{\seq_pop:cN} -% Since sequences can be used as stacks, we ought to have both -% `push' and `pop'. In most cases they are nothing more then new -% names for old functions. -% \begin{macrocode} -\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn -\cs_new_eq:NN \seq_push:NV \seq_put_left:NV -\cs_new_eq:NN \seq_push:No \seq_put_left:No -\cs_new_eq:NN \seq_push:cn \seq_put_left:cn -\cs_new_protected_nopar:Npn \seq_pop:NN { \seq_pop_aux:nnNN \tl_set:Nn \tl_set:Nn } -\cs_generate_variant:Nn \seq_pop:NN {c} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\seq_gpush:Nn} -% \begin{macro}{\seq_gpush:NV} -% \begin{macro}{\seq_gpush:No} -% \begin{macro}{\seq_gpush:cn} -% \begin{macro}{\seq_gpush:Nv} -% \begin{macro}{\seq_gpop:NN} -% \begin{macro}{\seq_gpop:cN} -% I don't agree with Denys that one needs only local stacks, -% actually I believe that one will probably need the functions -% here more often. In case of |\seq_gpop:NN| the value is -% nevertheless returned locally. +% \begin{macro}{\seq_remove_all:Nn, \seq_remove_all:cn} +% \UnitTested +% \begin{macro}{\seq_gremove_all:Nn, \seq_gremove_all:cn} +% \UnitTested +% \begin{macro}[aux]{\seq_remove_all_aux:NNn} +% The idea of the code here is to avoid a relatively expensive addition of +% items one at a time to an intermediate sequence. +% The approach taken is therefore similar to +% that in \cs{seq_pop_right_aux_ii:NNN}, using a \enquote{flexible} +% \texttt{x}-type expansion to do most of the work. As \cs{tl_if_eq:nnT} +% is not expandable, a two-part strategy is needed. First, the +% \texttt{x}-type expansion uses \cs{str_if_eq:nnT} to find potential +% matches. If one is found, the expansion is halted and the necessary +% set up takes place to use the \cs{tl_if_eq:NNT} test. The \texttt{x}-type +% is started again, including all of the items copied already. This will +% happen repeatedly until the entire sequence has been scanned. The code +% is set up to avoid needing and intermediate scratch list: the lead-off +% \texttt{x}-type expansion (|#1 #2 {#2}|) will ensure that nothing is +% lost. % \begin{macrocode} -\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn -\cs_new_protected_nopar:Npn \seq_gpop:NN { \seq_pop_aux:nnNN \tl_gset:Nn \tl_set:Nn } -\cs_generate_variant:Nn \seq_gpush:Nn {NV,No,c,Nv} -\cs_generate_variant:Nn \seq_gpop:NN {c} +\cs_new_protected:Npn \seq_remove_all:Nn + { \seq_remove_all_aux:NNn \tl_set:Nx } +\cs_new_protected:Npn \seq_gremove_all:Nn + { \seq_remove_all_aux:NNn \tl_gset:Nx } +\cs_new_protected:Npn \seq_remove_all_aux:NNn #1#2#3 + { + \seq_push_item_def:n + { + \str_if_eq:nnT {##1} {#3} + { + \tex_iffalse:D { \tex_fi:D } + \tl_set:Nn \l_seq_tmpb_tl {##1} + #1 #2 + { \tex_iffalse:D } \tex_fi:D + \exp_not:o {#2} + \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl + { \use_none:nn } + } + \exp_not:n { \seq_item:n {##1} } + } + \tl_set:Nn \l_seq_tmpa_tl {#3} + #1 #2 {#2} + \seq_pop_item_def: + } +\cs_generate_variant:Nn \seq_remove_all:Nn { c } +\cs_generate_variant:Nn \seq_gremove_all:Nn { c } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% +% \section{Viewing sequences} +% +% \begin{macro}[aux]{\l_seq_show_tl} +% Used to store the material for display. +% \begin{macrocode} +\tl_new:N \l_seq_show_tl +% \end{macrocode} % \end{macro} +% +% \begin{macro}{\seq_show:N, \seq_show:c} +% \UnitTested +% \begin{macro}[aux]{\seq_show_aux:n} +% \begin{macro}[aux]{\seq_show_aux:w} +% The aim of the mapping here is to create a token list containing the +% formatted sequence. The very first item needs the new line and \verb*|> | +% removing, which is achieved using a \texttt{w}-type auxiliary. To avoid +% a low-level \TeX{} error if there is an empty sequence, a simple test is +% used to keep the output \enquote{clean}. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \seq_show:N #1 + { + \seq_if_empty:NTF #1 + { + \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty } + \tl_show:n { } + } + { + \iow_term:x + { + Sequence~\token_to_str:N #1 \c_space_tl + contains~the~items~(without~outer~braces): + } + \tl_set:Nx \l_seq_show_tl + { \seq_map_function:NN #1 \seq_show_aux:n } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \seq_show_aux:w \l_seq_show_tl } + } + } +\cs_new:Npn \seq_show_aux:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl + \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + } +\cs_new:Npn \seq_show_aux:w #1 > ~ { } +\cs_generate_variant:Nn \seq_show:N { c } +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\seq_top:NN} -% \begin{macro}{\seq_top:cN} -% Looking at the top element of the stack without removing it is -% done with this operation. +% \subsection{Depreciated interfaces} +% +% A few functions which are no longer documented: these were moved +% here on or before 2011-04-20, and will be removed entirely by +% 2011-07-20. +% +% \begin{macro}{\seq_top:NN, \seq_top:cN} +% These are old stack functions. % \begin{macrocode} -\cs_new_eq:NN \seq_top:NN \seq_get:NN -\cs_new_eq:NN \seq_top:cN \seq_get:cN +\cs_new_eq:NN \seq_top:NN \seq_get_left:NN +\cs_new_eq:NN \seq_top:cN \seq_get_left:cN % \end{macrocode} % \end{macro} -% \end{macro} -% % +% \begin{macro}{\seq_display:N, \seq_display:c} +% An older name for \cs{seq_show:N}. % \begin{macrocode} -%</initex|package> +\cs_new_eq:NN \seq_display:N \seq_show:N +\cs_new_eq:NN \seq_display:c \seq_show:c % \end{macrocode} +% \end{macro} % -% Show token usage: % \begin{macrocode} -%<*showmemory> -%\showMemUsage -%</showmemory> +%</initex|package> % \end{macrocode} % % \end{implementation} -% \PrintIndex % -% \endinput +% \PrintIndex
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/expl3/l3tl.dtx b/Master/texmf-dist/source/latex/expl3/l3tl.dtx index fe6ecd271f1..487578939f1 100644 --- a/Master/texmf-dist/source/latex/expl3/l3tl.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3tl.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3tl.dtx 2184 2011-03-07 18:07:12Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Token Lists} %\iffalse %<*driver> @@ -828,13 +828,13 @@ % \end{macrocode} % Otherwise any variable type is allowed. % \begin{macrocode} - \cs_gset_nopar:Npn #1{#2} + \tl_gset:Nn #1 {#2} } \cs_generate_variant:Nn \tl_new:Nn {cn} \cs_new_protected:Npn \tl_new:Nx #1#2{ \chk_if_free_cs:N #1 %<check> \chk_var_or_const:N #1 - \cs_gset_nopar:Npx #1{#2} + \tl_gset:Nx #1 {#2} } \cs_new_protected_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}} \cs_new_protected_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}} @@ -2134,137 +2134,7 @@ % \end{macro} % \end{macro} % \end{macro} -% -%\begin{macro}{\_tl_check_exists:N} -% When used as a package, there is an option to be picky and to -% check definitions exist. The message text for this is created later, -% as the mechanism is not yet in place. -% \begin{macrocode} -%<*package> -\tex_ifodd:D \@l@expl@check@declarations@bool \scan_stop: - \cs_set_protected:Npn \_tl_check_exists:N #1 - { - \cs_if_exist:NF #1 - { - \msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N #1 } - } - } - \cs_set_protected:Npn \tl_set:Nn #1#2 - { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_set:Nx #1#2 - { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 {#2} - } - \cs_set_protected:Npn \tl_gset:Nn #1#2 - { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_gset:Nx #1#2 - { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 {#2} - } - \cs_set_protected:Npn \tl_set_eq:NN #1#2 - { - \_tl_check_exists:N #1 - \_tl_check_exists:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_gset_eq:NN #1#2 - { - \_tl_check_exists:N #1 - \_tl_check_exists:N #2 - \cs_gset_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_put_right:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_put_right:NV #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } - } - \cs_set_protected:Npn \tl_put_right:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} } - } - \cs_set_protected:Npn \tl_put_right:No #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } - } - \cs_set_protected:Npn \tl_put_right:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } - } - \cs_set_protected:Npn \tl_gput_right:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_gput_right:NV #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } - } - \cs_set_protected:Npn \tl_gput_right:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} } - } - \cs_set_protected:Npn \tl_gput_right:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 #2 } - } - \cs_set_protected:Npn \tl_put_left:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:NV #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:No #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:NV #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { #2 \exp_not:o #1 } - } -\tex_fi:D -%</package> -% \end{macrocode} -%\end{macro} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3token.dtx b/Master/texmf-dist/source/latex/expl3/l3token.dtx index 9482c3865a0..b214b84b771 100644 --- a/Master/texmf-dist/source/latex/expl3/l3token.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3token.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3token.dtx 2151 2011-02-16 06:58:12Z will $ +\GetIdInfo$Id: l3token.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental token investigation and manipulation} %\iffalse %<*driver> @@ -1877,11 +1877,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3toks.dtx b/Master/texmf-dist/source/latex/expl3/l3toks.dtx index 6b8e47df71c..1937da4752f 100644 --- a/Master/texmf-dist/source/latex/expl3/l3toks.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3toks.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3toks.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3toks.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Token Registers} %\iffalse %<*driver> @@ -799,12 +799,6 @@ %</initex|package> % \end{macrocode} % -% Show token usage: -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/expl3/l3xref.dtx b/Master/texmf-dist/source/latex/expl3/l3xref.dtx index 5c84cce4d55..00245b085bb 100644 --- a/Master/texmf-dist/source/latex/expl3/l3xref.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3xref.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package|testfile> %\fi -\GetIdInfo$Id: l3xref.dtx 2151 2011-02-16 06:58:12Z will $ +\GetIdInfo$Id: l3xref.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental cross referencing} %\iffalse %<*testfile> @@ -315,11 +315,6 @@ %</initex|package> % \end{macrocode} % -% \begin{macrocode} -%<*showmemory> -\showMemUsage -%</showmemory> -% \end{macrocode} % % \section{\pkg{l3xref} test file} % diff --git a/Master/texmf-dist/tex/latex/expl3/expl3.sty b/Master/texmf-dist/tex/latex/expl3/expl3.sty index cec0003dbd8..d9ade26fef4 100644 --- a/Master/texmf-dist/tex/latex/expl3/expl3.sty +++ b/Master/texmf-dist/tex/latex/expl3/expl3.sty @@ -49,7 +49,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: expl3.dtx 2156 2011-02-17 15:40:23Z will $ +\GetIdInfo$Id: expl3.dtx 2222 2011-04-09 12:47:12Z will $ {L3 Experimental code bundle wrapper}% \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -89,7 +89,6 @@ l3file, l3fp, l3luatex, - l3font } \RequirePackage{calc} \bool_if:nT { \@l@expl@check@declarations@bool } { @@ -105,6 +104,48 @@ LaTeX~will~create~the~variable~and~continue. } } +\tex_ifodd:D \@l@expl@check@declarations@bool \scan_stop: + \cs_set_protected:Npn \_tl_check_exists:N #1 + { + \cs_if_exist:NF #1 + { + \msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N #1 } + } + } + \cs_set_protected:Npn \tl_set:Nn #1#2 + { + \_tl_check_exists:N #1 + \cs_set_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_set:Nx #1#2 + { + \_tl_check_exists:N #1 + \cs_set_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_gset:Nn #1#2 + { + \_tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_gset:Nx #1#2 + { + \_tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_set_eq:NN #1#2 + { + \_tl_check_exists:N #1 + \_tl_check_exists:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_set_protected:Npn \tl_gset_eq:NN #1#2 + { + \_tl_check_exists:N #1 + \_tl_check_exists:N #2 + \cs_gset_eq:NN #1 #2 + } +\tex_fi:D %% %% %% End of file `expl3.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3basics.sty b/Master/texmf-dist/tex/latex/expl3/l3basics.sty index 8afc6cdeb81..f5a32767b56 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3basics.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3basics.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2158 2011-02-26 12:37:22Z mittelba $ +\GetIdInfo$Id: l3basics.dtx 2246 2011-04-23 08:01:25Z joseph $ {L3 Experimental basic definitions} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -174,8 +174,10 @@ \cs_set:Npn \use_none:nnnnnnnn #1#2#3#4#5#6#7#8{} \cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9{} \cs_set:Npn \exp_args:Nc #1#2{\exp_after:wN#1\cs:w#2\cs_end:} -\cs_set:Npn \prg_return_true: { \exp_after:wN\if_true:\tex_romannumeral:D } -\cs_set:Npn \prg_return_false: {\exp_after:wN\if_false:\tex_romannumeral:D } +\cs_set_nopar:Npn \prg_return_true: + { \exp_after:wN \use_i:nn \tex_romannumeral:D } +\cs_set_nopar:Npn \prg_return_false: + { \exp_after:wN \use_ii:nn \tex_romannumeral:D } \cs_set_protected:Npn \prg_set_conditional:Npnn #1{ \prg_get_parm_aux:nw{ \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn @@ -246,46 +248,64 @@ \use:c{prg_generate_#3_form_#1:Nnnnn} #2 \prg_generate_conditional_aux:nnw{#1}{#2} } -\cs_set:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc #1 {#2_p:#3}#4{#5 \c_zero - \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: +\cs_set_protected:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 _p: #3 } #4 + { + #5 \c_zero + \c_true_bool \c_false_bool + } } -} -\cs_set:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3TF}#4{#5 \c_zero - \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: +\cs_set_protected:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 T } #4 + { + #5 \c_zero + \use:n \use_none:n + } } -} -\cs_set:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3T}#4{#5 \c_zero - \else:\exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 F } #4 + { + #5 \c_zero + { } + } } -} -\cs_set:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5{ - \exp_args:Nc#1 {#2:#3F}#4{#5 \c_zero - \exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 TF } #4 + { #5 \c_zero } } -} -\cs_set:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2_p:#3} #1 {#4}{#5 \c_zero - \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: +\cs_set_protected:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4} + { + #5 \c_zero + \c_true_bool \c_false_bool + } } -} -\cs_set:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3TF} #1 {#4}{#5 \c_zero - \exp_after:wN\use_i:nn\else:\exp_after:wN\use_ii:nn\fi: +\cs_set_protected:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 T } #1 {#4} + { + #5 \c_zero + \use:n \use_none:n + } } -} -\cs_set:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3T} #1 {#4}{#5 \c_zero - \else:\exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 F } #1 {#4} + { + #5 \c_zero + { } + } } -} -\cs_set:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5{ - \cs_generate_from_arg_count:cNnn {#2:#3F} #1 {#4}{#5 \c_zero - \exp_after:wN\use_none:nn\fi:\use:n +\cs_set_protected:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 TF } #1 {#4} + { #5 \c_zero } } -} \cs_set:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 { \prg_set_eq_conditional_aux:NNNw #1#2#3#4,?,\q_recursion_stop } @@ -306,14 +326,15 @@ \cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 {#1:#2F} \tex_chardef:D \c_true_bool = 1~ \tex_chardef:D \c_false_bool = 0~ -\cs_set_nopar:Npn \cs_to_str:N { - \if:w \exp_after:wN \cs_str_aux:w\token_to_str:N \a ax\q_stop - \else: - \exp_after:wN \exp_after:wN\exp_after:wN \use_ii:nn - \fi: - \exp_after:wN \use_none:n \token_to_str:N -} -\cs_set:Npn \cs_str_aux:w #1#2#3#4\q_stop{#2#3} +\cs_set:Npn \cs_to_str:N + { + \tex_if:D \tex_romannumeral:D - `0 \token_to_str:N \ % + \cs_to_str_aux:w + \tex_fi:D + \exp_after:wN \use_none:n \token_to_str:N + } +\cs_set_nopar:Npn \cs_to_str_aux:w #1 \use_none:n + { ~ \tex_romannumeral:D - `0 \tex_fi:D } \group_begin: \tex_lccode:D `\@ = `\: \scan_stop: \tex_catcode:D `\@ = 12~ diff --git a/Master/texmf-dist/tex/latex/expl3/l3box.sty b/Master/texmf-dist/tex/latex/expl3/l3box.sty index 7b06929a060..f96675fe755 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3box.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3box.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3box.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Box module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3calc.sty b/Master/texmf-dist/tex/latex/expl3/l3calc.sty index e77f86aca93..c880a0c091d 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3calc.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3calc.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3calc.dtx 1776 2010-02-07 21:51:23Z joseph $ +\GetIdInfo$Id: l3calc.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental calc module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3chk.sty b/Master/texmf-dist/tex/latex/expl3/l3chk.sty index b059aa3167e..1cb606b8618 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3chk.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3chk.sty @@ -49,7 +49,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: l3chk.dtx 1362 2009-05-28 20:19:21Z joseph $ +\GetIdInfo$Id: l3chk.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental check module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3clist.sty b/Master/texmf-dist/tex/latex/expl3/l3clist.sty index abbf7133cea..e7afede66af 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3clist.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3clist.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3clist.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental comma separated lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3doc.cls b/Master/texmf-dist/tex/latex/expl3/l3doc.cls index e79e3fbee21..279bb170083 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3doc.cls +++ b/Master/texmf-dist/tex/latex/expl3/l3doc.cls @@ -53,7 +53,7 @@ \let \filedateOld \filedate \let \fileversionOld \fileversion \let \filedescriptionOld \filedescription -\GetIdInfo$Id: l3doc.dtx 2180 2011-03-06 10:38:35Z will $ +\GetIdInfo$Id: l3doc.dtx 2228 2011-04-10 08:37:13Z joseph $ {L3 Experimental documentation class} \ProvidesExplClass {\filename}{\filedate}{\fileversion}{\filedescription} @@ -94,7 +94,7 @@ \ProcessOptions \LoadClass{article} \RequirePackage{doc} -\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore} +\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes} \bool_if:NT \g_doc_lmodern_bool { \RequirePackage[T1]{fontenc} \RequirePackage{lmodern} @@ -103,11 +103,23 @@ \let\doc@verbatim\verbatim \let\enddoc@verbatim\endverbatim \let\doc@@verbatim\@verbatim +\expandafter\let\csname doc@verbatim*\expandafter\endcsname + \csname verbatim*\endcsname +\expandafter\let\csname enddoc@verbatim*\expandafter\endcsname + \csname endverbatim*\endcsname +\expandafter\let\csname doc@@verbatim*\expandafter\endcsname + \csname @verbatim*\endcsname \RequirePackage{verbatim} \AtBeginDocument{% \let\verbatim\doc@verbatim \let\endverbatim\enddoc@verbatim \let\@verbatim\doc@@verbatim + \expandafter\let\csname verbatim*\expandafter\endcsname + \csname doc@verbatim*\endcsname + \expandafter\let\csname endverbatim*\expandafter\endcsname + \csname enddoc@verbatim*\endcsname + \expandafter\let\csname @verbatim*\expandafter\endcsname + \csname doc@@verbatim*\endcsname } \cs_set_nopar:Npn \MakePrivateLetters { \char_make_letter:N \@ @@ -200,12 +212,21 @@ }{ \endenumerate } -\group_begin: \char_make_active:N \< -\cs_new_nopar:Npn \function { +\DeclareDocumentCommand \function { O{} } { + \phantomsection + + \bool_gset_false:N \l_doc_meta_TF_bool + \bool_gset_false:N \l_doc_meta_pTF_bool + \bool_gset_false:N \l_doc_meta_EXP_bool + + \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} } + \KV_parse_space_removal_sanitize:n {#1} + \char_make_active:N \< \cs_set_eq:NN < \doc_open_meta:n + \group_begin: \MakePrivateLetters \char_make_other:N \| @@ -216,8 +237,19 @@ \char_make_ignore:N \^^I \function_aux:n } -\group_end: +\char_make_other:N \< \cs_set_eq:NN \variabledoc \function +\cs_set:Nn \doc_meta_opt_TF: { + \bool_gset_true:N \l_doc_meta_TF_bool +} +\cs_set:Nn \doc_meta_opt_EXP: { + \bool_gset_true:N \l_doc_meta_EXP_bool +} +\cs_set:Nn \doc_meta_opt_pTF: { + \bool_gset_true:N \l_doc_meta_pTF_bool + \bool_gset_true:N \l_doc_meta_TF_bool + \bool_gset_true:N \l_doc_meta_EXP_bool +} \group_begin: \char_make_other:N \| \cs_gset_nopar:Npn \function_aux:n #1 { @@ -248,26 +280,22 @@ \bool_new:N \l_doc_meta_EXP_bool \cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop { - \tl_if_in:nnTF {#2} { (TF) } { + \tl_if_in:nnT {#2} { (TF) } { \bool_gset_true:N \l_doc_meta_TF_bool - }{ - \bool_gset_false:N \l_doc_meta_TF_bool } - \tl_if_in:nnTF {#2} { (EXP) } { + + \tl_if_in:nnT {#2} { (EXP) } { \bool_gset_true:N \l_doc_meta_EXP_bool - }{ - \bool_gset_false:N \l_doc_meta_EXP_bool } - \tl_if_in:nnTF {#2} { (pTF) } { + + \tl_if_in:nnT {#2} { (pTF) } { \bool_gset_true:N \l_doc_meta_TF_bool \bool_gset_true:N \l_doc_meta_pTF_bool \bool_gset_true:N \l_doc_meta_EXP_bool - \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil } - }{ - \bool_gset_false:N \l_doc_meta_pTF_bool } \bool_if:NT \l_doc_meta_pTF_bool { + \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil } \doc_special_main_index:o { \l_doc_pTF_name_tl } \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:N \l_doc_pTF_name_tl } } @@ -360,6 +388,7 @@ { \int_incr:N \g_doc_nested_macro_int } \bool_set_false:N \l_doc_macro_aux_bool + \bool_set_false:N \l_doc_macro_internal_bool \bool_set_false:N \l_doc_macro_TF_bool \bool_set_false:N \l_doc_macro_pTF_bool \bool_set_false:N \l_doc_macro_var_bool @@ -387,23 +416,30 @@ \bool_if:NTF \l_doc_macro_pTF_bool { \clist_map_inline:nn {#1} - { - \exp_args:Nf \doc_macro_single - { \doc_predicate_from_base:w ##1 \q_nil } - } + { + \tl_if_blank:nF {##1} + { + \exp_args:Nf \doc_macro_single + { \doc_predicate_from_base:w ##1 \q_nil } + } + } \bool_set_true:N \l_doc_macro_TF_bool - \clist_map_inline:nn {#1} { \doc_macro_single {##1} } + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } \bool_set_false:N \l_doc_macro_TF_bool } { - \clist_map_inline:nn {#1} { \doc_macro_single {##1} } + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } } } +\bool_new:N \l_doc_macro_internal_bool \bool_new:N \l_doc_macro_aux_bool \bool_new:N \l_doc_macro_TF_bool \bool_new:N \l_doc_macro_pTF_bool \bool_new:N \l_doc_macro_var_bool \cs_set_nopar:Npn \doc_macro_opt_aux: { \bool_set_true:N \l_doc_macro_aux_bool } +\cs_set_nopar:Npn \doc_macro_opt_internal: { \bool_set_true:N \l_doc_macro_internal_bool } \cs_set_nopar:Npn \doc_macro_opt_TF: { \bool_set_true:N \l_doc_macro_TF_bool } \cs_set_nopar:Npn \doc_macro_opt_pTF: { \bool_set_true:N \l_doc_macro_pTF_bool } \cs_set_nopar:Npn \doc_macro_opt_var: { \bool_set_true:N \l_doc_macro_var_bool } @@ -606,6 +642,7 @@ } \bool_if:nT { !\l_doc_macro_aux_bool && + !\l_doc_macro_internal_bool && \int_compare_p:n {\g_doc_nested_macro_int<1} } { diff --git a/Master/texmf-dist/tex/latex/expl3/l3expan.sty b/Master/texmf-dist/tex/latex/expl3/l3expan.sty index 7f52c7a22be..583e20f8513 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3expan.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3expan.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3expan.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Argument Expansion module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3file.sty b/Master/texmf-dist/tex/latex/expl3/l3file.sty index b120352243b..d651ce408d5 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3file.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3file.sty @@ -15,7 +15,8 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3file.dtx Copyright (C) 2009-2010 LaTeX3 project +%% File: l3file.dtx Copyright (C) 2009-2011 by +%% The LaTeX3 Project <latex-team@latex-project.org> %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -24,7 +25,7 @@ %% %% http://www.latex-project.org/lppl.txt %% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% This file is part of the "expl3 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. @@ -44,93 +45,92 @@ %% 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. +%% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -%% \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 1853 2010-03-21 09:11:08Z joseph $ - {L3 Experimental file loading} +\GetIdInfo$Id: l3file.dtx 2242 2011-04-21 08:07:24Z joseph $ + {The LaTeX3 kernel: file operations} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: \tl_new:N \g_file_current_name_tl -\seq_new:N \g_file_stack_seq \tl_gset_eq:NN \g_file_current_name_tl \@currname +\seq_new:N \g_file_stack_seq \seq_new:N \g_file_record_seq +\tl_new:N \l_file_name_tl \seq_new:N \l_file_search_path_seq \seq_new:N \l_file_search_path_saved_seq -\tl_new:N \l_file_name_tl -\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } { - \ior_open:Nn \g_file_test_stream {#1} - \ior_if_eof:NTF \g_file_test_stream - { \file_if_exist_path_aux:n {#1} } - { - \ior_close:N \g_file_test_stream - \tl_set:Nn \l_file_name_tl {#1} - \prg_return_true: - } -} -\cs_new_protected_nopar:Npn \file_if_exist_path_aux:n #1 { - \tl_clear:N \l_file_name_tl - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l_file_search_path_saved_seq - \l_file_search_path_seq - \clist_map_inline:Nn \input@path - { \seq_put_right:Nn \l_file_search_path_seq {##1} } - } - \seq_map_inline:Nn \l_file_search_path_seq - { - \ior_open:Nn \g_file_test_stream { ##1 #1 } - \ior_if_eof:NF \g_file_test_stream - { - \tl_set:Nn \l_file_name_tl { ##1 #1 } - \seq_map_break: - } - } - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l_file_search_path_seq - \l_file_search_path_saved_seq - } - \ior_close:N \g_file_test_stream - \tl_if_empty:NTF \l_file_name_tl - { \prg_return_false: } - { \prg_return_true: } -} -\cs_generate_variant:Nn \file_if_exist:nT { V } -\cs_generate_variant:Nn \file_if_exist:nF { V } -\cs_generate_variant:Nn \file_if_exist:nTF { V } -\cs_new_protected_nopar:Npn \file_input:n #1 { - \file_if_exist:nT {#1} - { - \@addtofilelist {#1} - \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl - \tl_gset:Nn \g_file_current_name_tl {#1} - \tex_expandafter:D \tex_input:D \l_file_name_tl ~ - \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl - } -} -\cs_generate_variant:Nn \file_input:n { V } -\cs_new_protected_nopar:Npn \file_path_include:n #1 { - \seq_put_right:Nn \l_file_search_path_seq {#1} - \seq_remove_duplicates:N \l_file_search_path_seq -} -\cs_new_protected_nopar:Npn \file_path_remove:n #1 { - \seq_remove_element:Nn \l_file_search_path_seq {#1} -} -\cs_new_protected_nopar:Npn \file_list: { - \seq_remove_duplicates:N \g_file_record_seq - \iow_log:n { *~File~List~* } - \seq_map_function:NN \g_file_record_seq \file_list_aux:n - \iow_log:n { ************* } -} -\cs_new_protected_nopar:Npn \file_list_aux:n #1 { \iow_log:n {#1} } -\AtBeginDocument{ - \clist_map_inline:Nn \@filelist - { \seq_put_right:Nn \g_file_record_seq {#1} } -} +\cs_new_protected_nopar:Npn \file_add_path:nN #1#2 + { + \ior_open:Nn \g_file_test_stream {#1} + \ior_if_eof:NTF \g_file_test_stream + { \file_add_path_search:nN {#1} #2 } + { + \ior_close:N \g_file_test_stream + \tl_set:Nx #2 {#1} + } + } +\cs_new_protected_nopar:Npn \file_add_path_search:nN #1#2 + { + \tl_clear:N #2 + \cs_if_exist:NT \input@path + { + \seq_set_eq:NN \l_file_search_path_saved_seq \l_file_search_path_seq + \clist_map_inline:Nn \input@path + { \seq_put_right:Nn \l_file_search_path_seq {##1} } + } + \seq_map_inline:Nn \l_file_search_path_seq + { + \ior_open:Nn \g_file_test_stream { ##1 #1 } + \ior_if_eof:NF \g_file_test_stream + { + \tl_set:Nx #2 { ##1 #1 } + \seq_map_break: + } + } + \cs_if_exist:NT \input@path + { \seq_set_eq:NN \l_file_search_path_seq \l_file_search_path_saved_seq } + \ior_close:N \g_file_test_stream + } +\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NTF \l_file_name_tl + { \prg_return_false: } + { \prg_return_true: } + } +\cs_new_protected_nopar:Npn \file_input:n #1 + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NF \l_file_name_tl + { + \@addtofilelist {#1} + \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl + \tl_gset:Nn \g_file_current_name_tl {#1} + \tex_expandafter:D \tex_input:D \l_file_name_tl ~ + \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl + } + } +\cs_new_protected_nopar:Npn \file_path_include:n #1 + { + \seq_if_in:NnF \l_file_search_path_seq {#1} + { \seq_put_right:Nn \l_file_search_path_seq {#1} } + } +\cs_new_protected_nopar:Npn \file_path_remove:n #1 + { \seq_remove_all:Nn \l_file_search_path_seq {#1} } +\cs_new_protected_nopar:Npn \file_list: + { + \seq_remove_duplicates:N \g_file_record_seq + \iow_log:n { *~File~List~* } + \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} } + \iow_log:n { ************* } + } +\AtBeginDocument + { + \clist_map_inline:Nn \@filelist + { \seq_put_right:Nn \g_file_record_seq {#1} } + } %% %% %% End of file `l3file.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3font.sty b/Master/texmf-dist/tex/latex/expl3/l3font.sty index 78a6f23ec48..81e9661ba75 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3font.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3font.sty @@ -48,24 +48,26 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3font.dtx 2175 2011-03-03 12:16:46Z will $ +\GetIdInfo$Id: l3font.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Font Loading} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: -\cs_new_protected:Npn \font_set:Nnn #1#2#3 { \tex_font:D #1 = #2 ~at~ #3 \scan_stop: } -\cs_new_protected:Npn \font_gset:Nnn #1#2#3 { +\cs_new_protected:Npn \fontface_set:Nnn #1#2#3 { + \tex_font:D #1 = #2 ~at~ #3 \scan_stop: +} +\cs_new_protected:Npn \fontface_gset:Nnn #1#2#3 { \tex_global:D \tex_font:D #1 = #2 ~at~ #3 \scan_stop: } -\cs_generate_variant:Nn \font_set:Nnn {c} -\cs_generate_variant:Nn \font_gset:Nnn {c} -\cs_set_eq:NN \font_set_eq:NN \tex_let:D -\cs_set_protected:Npn \font_gset_eq:NN { \tex_global:D \tex_let:D } -\cs_set:Npn \font_set_to_current:N #1 { - \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D +\cs_generate_variant:Nn \fontface_set:Nnn {c} +\cs_generate_variant:Nn \fontface_gset:Nnn {c} +\cs_set_eq:NN \fontface_set_eq:NN \tex_let:D +\cs_set_protected:Npn \fontface_gset_eq:NN { \tex_global:D \tex_let:D } +\cs_set:Npn \fontface_set_to_current:N #1 { + \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D } -\cs_set:Npn \font_gset_to_current:N #1 { - \tex_global:D \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D +\cs_set:Npn \fontface_gset_to_current:N #1 { + \tex_global:D \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D } \luatex_if_engine:TF { @@ -93,7 +95,7 @@ \msg_kernel_new:nnn {l3font} {cmd-pdftex-unavail} { The~ command~ `\exp_not:n{#1}'~ is~ not~ available~ for~ the~ pdfTeX~ format. } -\prg_new_conditional:Nnn \font_if_null:N {p,TF,T,F} { +\prg_new_conditional:Nnn \fontface_if_null:N {p,TF,T,F} { \if_meaning:w #1 \tex_nullfont:D \prg_return_true: \else: diff --git a/Master/texmf-dist/tex/latex/expl3/l3fp.sty b/Master/texmf-dist/tex/latex/expl3/l3fp.sty index 4ce67fbb7d9..9c042acad1b 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3fp.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3fp.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3fp.dtx 2201 2011-03-19 17:16:13Z joseph $ {L3 Experimental floating-point operations} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3int.sty b/Master/texmf-dist/tex/latex/expl3/l3int.sty index 97db73b44cd..9a6a034b355 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3int.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3int.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3int.dtx 2229 2011-04-11 17:37:05Z joseph $ {L3 Experimental Integer module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -664,7 +664,8 @@ } { \chk_if_free_cs:N #1 - \tex_global:D \tex_mathchardef:D #1 = \int_eval:n {#2} + \tex_global:D \tex_mathchardef:D #1 = + \etex_numexpr:D #2 \scan_stop: } } { diff --git a/Master/texmf-dist/tex/latex/expl3/l3keyval.sty b/Master/texmf-dist/tex/latex/expl3/l3keyval.sty index ad42ce146ee..6bf05f0c409 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3keyval.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3keyval.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3keyval.dtx 1890 2010-04-11 03:37:15Z will $ +\GetIdInfo$Id: l3keyval.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental keyval processing} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3precom.sty b/Master/texmf-dist/tex/latex/expl3/l3precom.sty index 61cfe7c2a07..0fc29e1d11c 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3precom.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3precom.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3precom.dtx 1793 2010-02-09 20:36:19Z joseph $ +\GetIdInfo$Id: l3precom.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental precompilation module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index 5e18591892b..d61832b0500 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2178 2011-03-06 09:03:44Z mittelba $ +\GetIdInfo$Id: l3prg.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental control structures} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3prop.sty b/Master/texmf-dist/tex/latex/expl3/l3prop.sty index 4180388ee03..f688dd0c651 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prop.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prop.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2087 2010-11-23 18:21:44Z joseph $ +\GetIdInfo$Id: l3prop.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Property Lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3quark.sty b/Master/texmf-dist/tex/latex/expl3/l3quark.sty index 65935330d67..da25c0a0f3c 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3quark.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3quark.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 2172 2011-03-03 10:56:49Z will $ +\GetIdInfo$Id: l3quark.dtx 2234 2011-04-14 19:58:43Z joseph $ {L3 Experimental Quark Commands} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -61,37 +61,55 @@ \quark_new:N\q_mark \quark_new:N\q_recursion_tail \quark_new:N\q_recursion_stop -\cs_new:Npn \quark_if_recursion_tail_stop:n #1 { - \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: -} -\cs_new:Npn \quark_if_recursion_tail_stop:N #1 { - \if_meaning:w#1\q_recursion_tail - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: -} -\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n {o} -\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 { - \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail - \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw - \else: - \exp_after:wN\use_none:n - \fi: - {#2} -} -\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 { - \if_meaning:w #1\q_recursion_tail - \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw - \else: - \exp_after:wN\use_none:n - \fi: - {#2} -} -\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn {on} -\cs_new:Npn \quark_if_recursion_tail_aux:w #1#2 \q_stop \q_recursion_tail {#1} +\cs_new:Npn \quark_if_recursion_tail_stop:N #1 + { + \tex_ifx:D #1 \q_recursion_tail + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \tex_fi:D + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 + { + \tex_ifx:D #1 \q_recursion_tail + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \tex_else:D + \exp_after:wN \use_none:n + \tex_fi:D + {#2} + } +\cs_new:Npn \quark_if_recursion_tail_stop:n #1 + { + \tex_ifcat:D + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \tex_fi:D + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 + { + \tex_ifcat:D + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \tex_else:D + \exp_after:wN \use_none:n + \tex_fi:D + {#2} + } +\cs_new:Npn \quark_if_recursion_tail_aux:w + #1 \q_recursion_tail #2 \q_recursion_stop #3 \q_stop + { #1 #2 } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o } \prg_new_conditional:Nnn \quark_if_no_value:N {p,TF,T,F} { \if_meaning:w \q_no_value #1 \prg_return_true: \else: \prg_return_false: \fi: diff --git a/Master/texmf-dist/tex/latex/expl3/l3seq.sty b/Master/texmf-dist/tex/latex/expl3/l3seq.sty index 2ccbaf7c977..b43fdbae470 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3seq.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3seq.sty @@ -15,7 +15,8 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3seq.dtx Copyright (C) 1990-2010 LaTeX3 project +%% File: l3seq.dtx Copyright (C) 1990-2011 by +%% The LaTeX3 Project <latex-team@latex-project.org> %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -24,7 +25,7 @@ %% %% http://www.latex-project.org/lppl.txt %% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% This file is part of the "expl3 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. @@ -44,17 +45,22 @@ %% 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. +%% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 1879 2010-03-29 17:48:38Z mittelba $ - {L3 Experimental sequences and stacks} +\GetIdInfo$Id: l3seq.dtx 2245 2011-04-21 19:45:31Z joseph $ + {The LaTeX3 kernel: sequences and stacks} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: -\cs_new:Npn \seq_elt:w {\ERROR} -\cs_new:Npn \seq_elt_end: {\ERROR} +\cs_new:Npn \seq_item:n + { + \seq_use_error: + \use_none:n + } +\tl_new:N \l_seq_tmpa_tl +\tl_new:N \l_seq_tmpb_tl \cs_new_eq:NN \seq_new:N \tl_new:N \cs_new_eq:NN \seq_new:c \tl_new:c \cs_new_eq:NN \seq_clear:N \tl_clear:N @@ -65,149 +71,308 @@ \cs_new_eq:NN \seq_clear_new:c \tl_clear_new:c \cs_new_eq:NN \seq_gclear_new:N \tl_gclear_new:N \cs_new_eq:NN \seq_gclear_new:c \tl_gclear_new:c -\cs_new_eq:NN \seq_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \seq_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \seq_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \seq_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \seq_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \seq_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \seq_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \seq_gset_eq:cc \cs_gset_eq:cc -\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 { - \tl_set:Nx #1 { \exp_not:V #2 \exp_not:V #3 } -} -\cs_generate_variant:Nn \seq_concat:NNN {ccc} -\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 { - \tl_gset:Nx #1 { \exp_not:V #2 \exp_not:V #3 } -} -\cs_generate_variant:Nn \seq_gconcat:NNN {ccc} -\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N {p,TF,T,F} -\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c {p,TF,T,F} -\cs_new_nopar:Npn \seq_if_empty_err:N #1 { - \if_meaning:w #1 \c_empty_tl - \tl_clear:N \l_kernel_testa_tl % catch prefixes - \msg_kernel_bug:x {Empty~sequence~`\token_to_str:N#1'} - \fi: -} -\prg_new_protected_conditional:Nnn \seq_if_in:Nn {TF,T,F} { - \cs_set:Npn \seq_tmp:w ##1 \seq_elt:w #2 \seq_elt_end: ##2##3 \q_stop { - \if_meaning:w \q_no_value ##2 - \prg_return_false: \else: \prg_return_true: \fi: +\cs_new_eq:NN \seq_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \seq_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \seq_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \seq_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \seq_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc +\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 + { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 + { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_generate_variant:Nn \seq_concat:NNN { ccc } +\cs_generate_variant:Nn \seq_gconcat:NNN { ccc } +\cs_new_protected:Npn \seq_put_left:Nn #1#2 + { \tl_put_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_put_right:Nn #1#2 + { \tl_put_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } +\cs_new_protected:Npn \seq_gput_left:Nn #1#2 + { \tl_gput_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_gput_right:Nn #1#2 + { \tl_gput_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx } +\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2} +\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 } +\cs_new_eq:NN \seq_map_break: \seq_break: +\cs_new_eq:NN \seq_map_break:n \seq_break:n +\cs_new_eq:NN \seq_break_point:n \use:n +\cs_new_protected_nopar:Npn \seq_if_empty_err_break:N #1 + { + \tex_ifx:D #1 \c_empty_tl + \msg_kernel_bug:x { Empty~sequence~\token_to_str:N #1 } + \exp_after:wN \seq_break: + \tex_fi:D } - \exp_after:wN \seq_tmp:w #1 \seq_elt:w #2 \seq_elt_end: \q_no_value \q_stop -} -\cs_generate_variant:Nn \seq_if_in:NnTF { NV, cV, co, c, cx} -\cs_generate_variant:Nn \seq_if_in:NnT { NV, cV, co, c, cx} -\cs_generate_variant:Nn \seq_if_in:NnF { NV, cV, co, c, cx} -\cs_new_protected_nopar:Npn \seq_get:NN #1 { - \seq_if_empty_err:N #1 - \exp_after:wN \seq_get_aux:w #1 \q_stop -} -\cs_new_protected:Npn \seq_get_aux:w \seq_elt:w #1 \seq_elt_end: #2 \q_stop #3 { - \tl_set:Nn #3 {#1} -} -\cs_generate_variant:Nn \seq_get:NN {c} -\cs_new_protected:Npn \seq_pop_aux:nnNN #1#2#3 { - \seq_if_empty_err:N #3 - \exp_after:wN \seq_pop_aux:w #3 \q_stop #1#2#3 -} -\cs_new_protected:Npn \seq_pop_aux:w - \seq_elt:w #1 \seq_elt_end: #2\q_stop #3#4#5#6 { - #3 #5 {#2} - #4 #6 {#1} -} -\cs_new_eq:NN \seq_show:N \tl_show:N -\cs_new_eq:NN \seq_show:c \tl_show:c -\cs_new_protected_nopar:Npn \seq_display:N #1 { - \iow_term:x { Sequence~\token_to_str:N #1~contains~ - the~elements~(without~outer~braces): } - \toks_clear:N \l_tmpa_toks - \seq_map_inline:Nn #1 { - \toks_if_empty:NF \l_tmpa_toks { - \toks_put_right:Nx \l_tmpa_toks {^^J>~} - } - \toks_put_right:Nx \l_tmpa_toks { - \c_space_tl \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} - } - } - \toks_show:N \l_tmpa_toks -} -\cs_generate_variant:Nn \seq_display:N {c} -\cs_new_protected:Npn \seq_put_aux:Nnn #1 { - \exp_after:wN \seq_put_aux:w #1 \q_stop #1 -} -\cs_new_protected:Npn \seq_put_aux:w #1\q_stop #2#3#4 { \tl_set:Nn #2 {#3#1#4} } -\cs_new_protected:Npn \seq_put_left:Nn #1#2 { - \seq_put_aux:Nnn #1 {\seq_elt:w #2\seq_elt_end:} {} -} -\cs_generate_variant:Nn \seq_put_left:Nn {NV,No,Nx,c,cV,co} -\cs_new_protected:Npn \seq_put_right:Nn #1#2{ - \seq_put_aux:Nnn #1{}{\seq_elt:w #2\seq_elt_end:}} -\cs_generate_variant:Nn \seq_put_right:Nn {NV,No,Nx,c,cV,co} -\cs_new_protected:Npn \seq_gput_left:Nn { - \pref_global:D - \seq_put_left:Nn -} -\cs_new_protected:Npn \seq_gput_right:Nn { - \pref_global:D - \seq_put_right:Nn -} -\cs_generate_variant:Nn \seq_gput_left:Nn {NV,No,Nx,c,cV,co} -\cs_generate_variant:Nn \seq_gput_right:Nn {NV,No,Nx,c,cV,co} -\cs_new_protected:Npn \seq_map_variable_aux:Nnw #1#2 \seq_elt:w #3 \seq_elt_end: { - \tl_set:Nn #1 {#3} - \quark_if_nil:NT #1 \seq_map_break: - #2 - \seq_map_variable_aux:Nnw #1{#2} -} -\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 { - \tl_set:Nn #2 {\seq_map_variable_aux:Nnw #2{#3}} - \exp_after:wN #2 #1 \seq_elt:w \q_nil\seq_elt_end: \q_stop -} -\cs_generate_variant:Nn \seq_map_variable:NNn {c} -\cs_new_eq:NN \seq_map_break: \use_none_delimit_by_q_stop:w -\cs_new_eq:NN \seq_map_break:n \use_i_delimit_by_q_stop:nw -\cs_new_protected_nopar:Npn \seq_map_function:NN #1#2 { - \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2{##1}} - #1 \use_none:n \q_stop - \cs_set_eq:NN \seq_elt:w \ERROR -} -\cs_generate_variant:Nn \seq_map_function:NN {c} -\cs_new_protected_nopar:Npn \seq_map_inline:Nn #1#2 { - \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2} - #1 \use_none:n \q_stop - \cs_set_eq:NN \seq_elt:w \ERROR +\cs_new:Npn \seq_map_function:NN #1#2 + { + \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 + { ? \seq_map_break: } { } + \seq_break_point:n { } + } +\cs_new:Npn \seq_map_function_aux:NNn #1#2#3 + { + \use_none:n #2 + #1 {#3} + \seq_map_function_aux:NNn #1 + } +\cs_generate_variant:Nn \seq_map_function:NN { c } +\int_new:N \g_seq_nesting_depth_int +\cs_new_protected:Npn \seq_push_item_def:n + { + \seq_push_item_def_aux: + \cs_gset:Npn \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def:x + { + \seq_push_item_def_aux: + \cs_gset:Npx \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def_aux: + { + \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + \seq_item:n + \int_gincr:N \g_seq_nesting_depth_int + } +\cs_new_protected_nopar:Npn \seq_pop_item_def: + { + \int_gdecr:N \g_seq_nesting_depth_int + \cs_gset_eq:Nc \seq_item:n + { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + } +\cs_new_protected:Npn \seq_map_inline:Nn #1#2 + { + \seq_push_item_def:n {#2} + #1 + \seq_break_point:n { \seq_pop_item_def: } + } +\cs_generate_variant:Nn \seq_map_inline:Nn { c } +\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 + { + \seq_push_item_def:x + { + \tl_set:Nn \exp_not:N #2 {##1} + \exp_not:n {#3} + } + #1 + \seq_break_point:n { \seq_pop_item_def: } + } +\cs_generate_variant:Nn \seq_map_variable:NNn { Nc } +\cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } +\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn +\cs_new_eq:NN \seq_push:NV \seq_put_left:NV +\cs_new_eq:NN \seq_push:Nv \seq_put_left:Nv +\cs_new_eq:NN \seq_push:No \seq_put_left:No +\cs_new_eq:NN \seq_push:Nx \seq_put_left:Nx +\cs_new_eq:NN \seq_push:cn \seq_put_left:cn +\cs_new_eq:NN \seq_push:cV \seq_put_left:cV +\cs_new_eq:NN \seq_push:cv \seq_put_left:cv +\cs_new_eq:NN \seq_push:co \seq_put_left:co +\cs_new_eq:NN \seq_push:cx \seq_put_left:cx +\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn +\cs_new_eq:NN \seq_gpush:NV \seq_gput_left:NV +\cs_new_eq:NN \seq_gpush:Nv \seq_gput_left:Nv +\cs_new_eq:NN \seq_gpush:No \seq_gput_left:No +\cs_new_eq:NN \seq_gpush:Nx \seq_gput_left:Nx +\cs_new_eq:NN \seq_gpush:cn \seq_gput_left:cn +\cs_new_eq:NN \seq_gpush:cV \seq_gput_left:cV +\cs_new_eq:NN \seq_gpush:cv \seq_gput_left:cv +\cs_new_eq:NN \seq_gpush:co \seq_gput_left:co +\cs_new_eq:NN \seq_gpush:cx \seq_gput_left:cx +\cs_new_protected_nopar:Npn \seq_get_left:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_get_left_aux:Nw \seq_item:n #1#2 \q_stop #3 + { \tl_set:Nn #3 {#1} } +\cs_generate_variant:Nn \seq_get_left:NN { c } +\cs_new_protected_nopar:Npn \seq_pop_left:NN + { \seq_pop_left_aux:NNN \tl_set:Nn } +\cs_new_protected_nopar:Npn \seq_gpop_left:NN + { \seq_pop_left_aux:NNN \tl_gset:Nn } +\cs_new_protected_nopar:Npn \seq_pop_left_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \exp_after:wN \seq_pop_left_aux:Nw #2 \q_stop #1#2#3 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_pop_left_aux:Nw \seq_item:n #1#2 \q_stop #3#4#5 + { + #3 #4 {#2} + \tl_set:Nn #5 {#1} + } +\cs_generate_variant:Nn \seq_pop_left:NN { c } +\cs_generate_variant:Nn \seq_gpop_left:NN { c } +\cs_new_protected_nopar:Npn \seq_get_right:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \seq_get_right_aux:NN #1#2 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2 + { + \seq_push_item_def:n { } + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #1 + { \tl_set:Nn #2 } + { } + { + \seq_pop_item_def: + \seq_break: + } } -\cs_generate_variant:Nn \seq_map_inline:Nn {c} +\cs_new:Npn \seq_get_right_loop:nn #1#2 + { + #2 {#1} + \seq_get_right_loop:nn + } +\cs_generate_variant:Nn \seq_get_right:NN { c } +\cs_new_protected_nopar:Npn \seq_pop_right:NN + { \seq_pop_right_aux:NNN \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gpop_right:NN + { \seq_pop_right_aux:NNN \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_pop_right_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \seq_pop_right_aux_ii:NNN #1 #2 #3 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3 + { + \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } } + #1 #2 { \tex_iffalse:D } \tex_fi:D + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #2 + { + \tex_iffalse:D { \tex_fi:D } + \tl_set:Nn #3 + } + { } + { + \seq_pop_item_def: + \seq_break: + } + } +\cs_generate_variant:Nn \seq_pop_right:NN { c } +\cs_generate_variant:Nn \seq_gpop_right:NN { c } +\cs_new_eq:NN \seq_get:NN \seq_get_left:NN +\cs_new_eq:NN \seq_get:cN \seq_get_left:cN +\cs_new_eq:NN \seq_pop:NN \seq_pop_left:NN +\cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN +\cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN +\cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN +\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N + { p , T , F , TF } +\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c + { p , T , F , TF } +\prg_new_protected_conditional:Npnn \seq_if_in:Nn #1#2 + { T , F , TF } + { + \group_begin: + \tl_set:Nn \l_seq_tmpa_tl {#2} + \cs_set_protected:Npn \seq_item:n ##1 + { + \tl_set:Nn \l_seq_tmpb_tl {##1} + \tex_ifx:D \l_seq_tmpa_tl \l_seq_tmpb_tl + \exp_after:wN \seq_if_in_aux: + \tex_fi:D + } + #1 + \seq_break:n { \prg_return_false: } + \seq_break_point:n { \group_end: } + } +\cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } +\cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnT { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnF { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnTF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnTF { c , cV , cv , co , cx } \seq_new:N \l_seq_remove_seq -\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 { - \seq_clear:N \l_seq_remove_seq - \seq_map_function:NN #2 \seq_remove_duplicates_aux:n - #1 #2 \l_seq_remove_seq -} -\cs_new_protected:Npn \seq_remove_duplicates_aux:n #1 { - \seq_if_in:NnF \l_seq_remove_seq {#1} { - \seq_put_right:Nn \l_seq_remove_seq {#1} +\cs_new_protected:Npn \seq_remove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_set_eq:NN } +\cs_new_protected:Npn \seq_gremove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_gset_eq:NN } +\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 + { + \seq_clear:N \l_seq_remove_seq + \seq_map_inline:Nn #2 + { + \seq_if_in:NnF \l_seq_remove_seq {##1} + { \seq_put_right:Nn \l_seq_remove_seq {##1} } + } + #1 #2 \l_seq_remove_seq } -} -\cs_new_protected_nopar:Npn \seq_remove_duplicates:N { - \seq_remove_duplicates_aux:NN \seq_set_eq:NN -} -\cs_new_protected_nopar:Npn \seq_gremove_duplicates:N { - \seq_remove_duplicates_aux:NN \seq_gset_eq:NN -} -\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn -\cs_new_eq:NN \seq_push:NV \seq_put_left:NV -\cs_new_eq:NN \seq_push:No \seq_put_left:No -\cs_new_eq:NN \seq_push:cn \seq_put_left:cn -\cs_new_protected_nopar:Npn \seq_pop:NN { \seq_pop_aux:nnNN \tl_set:Nn \tl_set:Nn } -\cs_generate_variant:Nn \seq_pop:NN {c} -\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn -\cs_new_protected_nopar:Npn \seq_gpop:NN { \seq_pop_aux:nnNN \tl_gset:Nn \tl_set:Nn } -\cs_generate_variant:Nn \seq_gpush:Nn {NV,No,c,Nv} -\cs_generate_variant:Nn \seq_gpop:NN {c} -\cs_new_eq:NN \seq_top:NN \seq_get:NN -\cs_new_eq:NN \seq_top:cN \seq_get:cN +\cs_generate_variant:Nn \seq_remove_duplicates:N { c } +\cs_generate_variant:Nn \seq_gremove_duplicates:N { c } +\cs_new_protected:Npn \seq_remove_all:Nn + { \seq_remove_all_aux:NNn \tl_set:Nx } +\cs_new_protected:Npn \seq_gremove_all:Nn + { \seq_remove_all_aux:NNn \tl_gset:Nx } +\cs_new_protected:Npn \seq_remove_all_aux:NNn #1#2#3 + { + \seq_push_item_def:n + { + \str_if_eq:nnT {##1} {#3} + { + \tex_iffalse:D { \tex_fi:D } + \tl_set:Nn \l_seq_tmpb_tl {##1} + #1 #2 + { \tex_iffalse:D } \tex_fi:D + \exp_not:o {#2} + \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl + { \use_none:nn } + } + \exp_not:n { \seq_item:n {##1} } + } + \tl_set:Nn \l_seq_tmpa_tl {#3} + #1 #2 {#2} + \seq_pop_item_def: + } +\cs_generate_variant:Nn \seq_remove_all:Nn { c } +\cs_generate_variant:Nn \seq_gremove_all:Nn { c } +\tl_new:N \l_seq_show_tl +\cs_new_protected_nopar:Npn \seq_show:N #1 + { + \seq_if_empty:NTF #1 + { + \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty } + \tl_show:n { } + } + { + \iow_term:x + { + Sequence~\token_to_str:N #1 \c_space_tl + contains~the~items~(without~outer~braces): + } + \tl_set:Nx \l_seq_show_tl + { \seq_map_function:NN #1 \seq_show_aux:n } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \seq_show_aux:w \l_seq_show_tl } + } + } +\cs_new:Npn \seq_show_aux:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl + \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + } +\cs_new:Npn \seq_show_aux:w #1 > ~ { } +\cs_generate_variant:Nn \seq_show:N { c } +\cs_new_eq:NN \seq_top:NN \seq_get_left:NN +\cs_new_eq:NN \seq_top:cN \seq_get_left:cN +\cs_new_eq:NN \seq_display:N \seq_show:N +\cs_new_eq:NN \seq_display:c \seq_show:c %% %% %% End of file `l3seq.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3tl.sty b/Master/texmf-dist/tex/latex/expl3/l3tl.sty index cacec3e0fdf..29bba61d462 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3tl.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3tl.sty @@ -48,19 +48,19 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2184 2011-03-07 18:07:12Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Token Lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: \cs_new_protected:Npn \tl_new:Nn #1#2{ \chk_if_free_cs:N #1 - \cs_gset_nopar:Npn #1{#2} + \tl_gset:Nn #1 {#2} } \cs_generate_variant:Nn \tl_new:Nn {cn} \cs_new_protected:Npn \tl_new:Nx #1#2{ \chk_if_free_cs:N #1 - \cs_gset_nopar:Npx #1{#2} + \tl_gset:Nx #1 {#2} } \cs_new_protected_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}} \cs_new_protected_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}} @@ -553,120 +553,6 @@ \tl_head:w #1 \q_stop \exp_not:N #2 \prg_return_true: \else: \prg_return_false: \fi: } -\tex_ifodd:D \@l@expl@check@declarations@bool \scan_stop: - \cs_set_protected:Npn \_tl_check_exists:N #1 - { - \cs_if_exist:NF #1 - { - \msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N #1 } - } - } - \cs_set_protected:Npn \tl_set:Nn #1#2 - { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_set:Nx #1#2 - { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 {#2} - } - \cs_set_protected:Npn \tl_gset:Nn #1#2 - { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_gset:Nx #1#2 - { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 {#2} - } - \cs_set_protected:Npn \tl_set_eq:NN #1#2 - { - \_tl_check_exists:N #1 - \_tl_check_exists:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_gset_eq:NN #1#2 - { - \_tl_check_exists:N #1 - \_tl_check_exists:N #2 - \cs_gset_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_put_right:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_put_right:NV #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } - } - \cs_set_protected:Npn \tl_put_right:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} } - } - \cs_set_protected:Npn \tl_put_right:No #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } - } - \cs_set_protected:Npn \tl_put_right:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } - } - \cs_set_protected:Npn \tl_gput_right:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } - } - \cs_set_protected:Npn \tl_gput_right:NV #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } - } - \cs_set_protected:Npn \tl_gput_right:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} } - } - \cs_set_protected:Npn \tl_gput_right:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:o #1 #2 } - } - \cs_set_protected:Npn \tl_put_left:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:NV #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:No #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_put_left:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nn #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:NV #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nv #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 } - } - \cs_set_protected:Npn \tl_gput_left:Nx #1#2 { - \_tl_check_exists:N #1 - \cs_gset_nopar:Npx #1 { #2 \exp_not:o #1 } - } -\tex_fi:D %% %% %% End of file `l3tl.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3token.sty b/Master/texmf-dist/tex/latex/expl3/l3token.sty index 4fa8cc3f704..9013497ff87 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3token.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3token.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2151 2011-02-16 06:58:12Z will $ +\GetIdInfo$Id: l3token.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental token investigation and manipulation} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3toks.sty b/Master/texmf-dist/tex/latex/expl3/l3toks.sty index 23c8f1fd9dd..23abea78be8 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3toks.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3toks.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3toks.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3toks.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental Token Registers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3xref.sty b/Master/texmf-dist/tex/latex/expl3/l3xref.sty index 44e5bc5e554..99ed3f83b47 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3xref.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3xref.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3xref.dtx 2151 2011-02-16 06:58:12Z will $ +\GetIdInfo$Id: l3xref.dtx 2223 2011-04-09 12:57:14Z will $ {L3 Experimental cross referencing} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 01b99ab4e36..2017992566c 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -570,6 +570,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`); 'osa', "die 'skipping, relies on endfloat.cfg and non-unique filenames'", 'osmanian', "die 'skipping, no good license info'", 'ot2cyr', "die 'skipping, nonfree font support", + 'otfinst', "die 'skipping, python script, perhaps stale", 'otibet', "&MAKEflatten", 'oxford', "die 'skipping, nosell license'", 'pageno', "die 'skipping, nosell license'", |