diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-18 23:12:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-18 23:12:56 +0000 |
commit | eae5d19d439ded67f5535d315a8983939733b548 (patch) | |
tree | 4a9013282bd26875540c662fbde8bd49b28b6f51 /Master/texmf-dist/source/latex | |
parent | 9e6c3db576f3908b80eb70d378aca43a22c043b1 (diff) |
l3kernel 2607 (17aug11)
git-svn-id: svn://tug.org/texlive/trunk@23596 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3.ins | 68 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3box.dtx | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 10 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3format.ins | 72 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 150 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3io.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 14 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3keyval.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | 67 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 80 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 95 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3token.dtx | 51 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3toks.dtx | 4 |
15 files changed, 494 insertions, 143 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 48ef3aa0a54..6de2ed0c0d2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -37,8 +37,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/08/13} -\def\ExplFileVersion{2564} +\def\ExplFileDate{2011/08/17} +\def\ExplFileVersion{2607} %</driver|package> %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins new file mode 100644 index 00000000000..9b28c54f15e --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -0,0 +1,68 @@ +\iffalse meta-comment + +File l3.ins Copyright (C) 2011 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "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. + +\fi + +\input docstrip.tex +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +% ===== PACKAGE ONLY ====== +\generate{\file{expl3.sty} {\from{expl3.dtx} {package}}} +% ======================== +\generate{\file{l3bootstrap.sty}{\from{l3bootstrap.dtx}{package}}} +\generate{\file{l3names.sty} {\from{l3names.dtx} {package}}} +\generate{\file{l3basics.sty} {\from{l3basics.dtx} {package}}} +\generate{\file{l3expan.sty} {\from{l3expan.dtx} {package}}} +\generate{\file{l3tl.sty} {\from{l3tl.dtx} {package}}} +\generate{\file{l3seq.sty} {\from{l3seq.dtx} {package}}} +\generate{\file{l3int.sty} {\from{l3int.dtx} {package}}} +\generate{\file{l3quark.sty} {\from{l3quark.dtx} {package}}} +\generate{\file{l3prg.sty} {\from{l3prg.dtx} {package}}} +\generate{\file{l3clist.sty} {\from{l3clist.dtx} {package}}} +\generate{\file{l3token.sty} {\from{l3token.dtx} {package}}} +\generate{\file{l3prop.sty} {\from{l3prop.dtx} {package}}} +\generate{\file{l3msg.sty} {\from{l3msg.dtx} {package}}} +\generate{\file{l3io.sty} {\from{l3io.dtx} {package}}} +\generate{\file{l3file.sty} {\from{l3file.dtx} {package}}} +\generate{\file{l3skip.sty} {\from{l3skip.dtx} {package}}} +\generate{\file{l3box.sty} {\from{l3box.dtx} {package}}} +\generate{\file{l3keyval.sty} {\from{l3keyval.dtx} {package}}} +\generate{\file{l3keys.sty} {\from{l3keys.dtx} {package}}} +\generate{\file{l3fp.sty} {\from{l3fp.dtx} {package}}} +\generate{\file{l3luatex.sty} {\from{l3luatex.dtx} {package}}} + +\generate{\file{l3doc.cls} {\from{l3doc.dtx} {class}}} +\generate{\file{l3doc.ist} {\from{l3doc.dtx} {docist}}} + +\generate{\file{l3toks.sty} {\from{l3toks.dtx} {package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 85313ce8791..c2fb953d45b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2526 2011-08-09 08:58:42Z joseph $ +\GetIdInfo$Id: l3box.dtx 2595 2011-08-16 00:58:34Z bruno $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -528,7 +528,7 @@ % % \begin{function}{\vbox_to_ht:nn} % \begin{syntax} -% \cs{vbox_to_ht:n} \Arg{contents} \Arg{dimexpr} +% \cs{vbox_to_ht:nn} \Arg{dimexpr} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} into a vertical box of height % \meta{dimexpr} and then includes this box in the current list for diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index e3dd82e210e..ed8f421b259 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2540 2011-08-10 23:39:33Z bruno $ +\GetIdInfo$Id: l3doc.dtx 2601 2011-08-16 23:20:27Z bruno $ {L3 Experimental documentation class} %</driver|class> % @@ -955,8 +955,8 @@ Do not distribute a modified version of this file. $\star$ } \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } - \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\@backslashchar} {} + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {} \bool_if:NT \g_doc_full_bool { \exp_args:Nf\label{doc/function/\g_doc_macro_tl#3#2} } @@ -1146,8 +1146,8 @@ Do not distribute a modified version of this file. \bool_if:NF \l_doc_macro_aux_bool { \tl_gset:Nx \l_doc_macro_tl { \tl_to_str:n {#1} } - \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\@backslashchar} {} + \exp_args:NNf \tl_greplace_all:Nnn \l_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_greplace_all:Nnn \l_doc_macro_tl {\@backslashchar} {} } \use:x { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins new file mode 100644 index 00000000000..562695271fa --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3format.ins @@ -0,0 +1,72 @@ +\iffalse meta-comment + +File l3format.ins Copyright (C) 2011 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "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. + +\fi + +\input docstrip.tex +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate + { + \file{l3format.ltx} + { + \from{l3bootstrap.dtx}{initex} + \from{l3names.dtx} {initex} + \from{l3basics.dtx} {initex} + \from{l3expan.dtx} {initex} + \from{l3tl.dtx} {initex} + \from{l3seq.dtx} {initex} + % ===== FORMAT ONLY ====== + \from{l3alloc.dtx} {initex} + % ======================== + \from{l3int.dtx} {initex} + \from{l3quark.dtx} {initex} + \from{l3prg.dtx} {initex} + \from{l3clist.dtx} {initex} + \from{l3token.dtx} {initex} + \from{l3prop.dtx} {initex} + \from{l3msg.dtx} {initex} + \from{l3io.dtx} {initex} + \from{l3file.dtx} {initex} + \from{l3skip.dtx} {initex} + \from{l3box.dtx} {initex} + \from{l3keyval.dtx} {initex} + \from{l3keys.dtx} {initex} + \from{l3fp.dtx} {initex} + \from{l3luatex.dtx} {initex} + % ===== FORMAT ONLY ====== + \from{l3final.dtx} {initex} + % ======================== + } + } + +\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 89695862b2f..0719e0e86df 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2551 2011-08-11 22:40:53Z bruno $ +\GetIdInfo$Id: l3int.dtx 2600 2011-08-16 22:31:24Z bruno $ {L3 Experimental integers} %</driver|package> %<*driver> @@ -631,16 +631,6 @@ % with category code $11$ (letter). % \end{function} % -% \begin{function}[EXP]{\int_to_symbol:n} -% \begin{syntax} -% \cs{int_to_symbol:n} \Arg{integer expression} -% \end{syntax} -% Calculates the value of the \meta{integer expression} and places -% the symbol representation of the result in the input stream. The -% list of symbols used is equivalent to \LaTeXe{}'s \cs{@fnsymbol} -% set. -% \end{function} -% % \section{Converting from other formats to integers} % % \begin{function}[EXP]{\int_from_alph:n} @@ -1613,89 +1603,95 @@ % % \begin{macro}{\int_to_base:nn} % \UnitTested -% \begin{macro}[aux]{\int_to_base_aux:nnn} +% \begin{macro}[aux]{\int_to_base_aux_i:nn, +% \int_to_base_aux_ii:nnN,\int_to_base_aux_iii:nnnN} % \begin{macro}[int]{\int_to_letter:n} % \UnitTested % Converting from base ten (|#1|) to a second base (|#2|) starts with -% a simple sign check. As the input is base $10$ \TeX{} can then -% do the actual work with the sign itself. +% computing |#1|: if it is a complicated calculation, we shouldn't +% perform it twice. Then check the sign, store it, either \texttt{-} +% or \cs{c_empty_tl}, and feed the absolute value to the next auxiliary +% function. % \begin{macrocode} -\cs_new:Npn \int_to_base:nn #1#2 +\cs_new:Npn \int_to_base:nn #1 + { \exp_args:Nf \int_to_base_aux_i:nn { \int_eval:n {#1} } } +\cs_new:Npn \int_to_base_aux_i:nn #1#2 { \int_compare:nNnTF {#1} < \c_zero - { - - - \exp_args:Nnf \int_to_base_aux:nnn - { } { \int_eval:n { 0 - ( #1 ) } } {#2} - } - { - \exp_args:Nnf \int_to_base_aux:nnn - { } { \int_eval:n {#1} } {#2} - } -} + { \exp_args:No \int_to_base_aux_ii:nnN { \use_none:n #1 } {#2} - } + { \int_to_base_aux_ii:nnN {#1} {#2} \c_empty_tl } + } % \end{macrocode} % Here, the idea is to provide a recursive system to deal with the -% input. The output is build up as argument |#1|, which is why it -% starts off empty in the above. At each pass, the value in |#2| is -% checked to see if it is less than the new base (|#3|). If it is -% the it is converted directly and the rest of the output is added in. +% input. The output is built up after the end of the function. +% At each pass, the value in |#1| is checked to see if it is less +% than the new base (|#2|). If it is, then it is converted directly, +% putting the sign back in front. % On the other hand, if the value to convert is greater than or equal % to the new base then the modulus and remainder values are found. The -% modulus is converted to a symbol and the remainder is carried forward -% to the next round. +% modulus is converted to a symbol and put on the right, +% and the remainder is carried forward to the next round. % \begin{macrocode} -\cs_new:Npn \int_to_base_aux:nnn #1#2#3 { - \int_compare:nNnTF {#2} < {#3} - { - \int_to_letter:n {#2} - #1 - } - { - \exp_args:Nff \int_to_base_aux:nnn - { - \int_to_letter:n { \int_mod:nn {#2} {#3} } - #1 - } - { \int_div_truncate:nn {#2} {#3} } - {#3} - } +\cs_new:Npn \int_to_base_aux_ii:nnN #1#2#3 + { + \int_compare:nNnTF {#1} < {#2} + { \exp_last_unbraced:Nf #3 { \int_to_letter:n {#1} } } + { + \exp_args:Nf \int_to_base_aux_iii:nnnN + { \int_to_letter:n { \int_mod:nn {#1} {#2} } } + {#1} + {#2} + #3 + } + } +\cs_new:Npn \int_to_base_aux_iii:nnnN #1#2#3#4 + { + \exp_args:Nf \int_to_base_aux_ii:nnN + { \int_div_truncate:nn {#2} {#3} } + {#3} + #4 + #1 } % \end{macrocode} % Convert to a letter only if necessary, otherwise simply return the -% value unchanged. +% value unchanged. It would be cleaner to use \cs{prg_case_int:nnn}, +% but in our case, the cases are contiguous, so it is forty times faster +% to use the \cs{if_case:w} primitive. The first \cs{exp_after:wN} +% expands the conditional, jumping to the correct case, the second one +% expands after the resulting character to close the conditional. % \begin{macrocode} \cs_new:Npn \int_to_letter:n #1 { - \prg_case_int:nnn { #1 - 9 } - { - { 1 } { A } - { 2 } { B } - { 3 } { C } - { 4 } { D } - { 5 } { E } - { 6 } { F } - { 7 } { G } - { 8 } { H } - { 9 } { I } - { 10 } { J } - { 11 } { K } - { 12 } { L } - { 13 } { M } - { 14 } { N } - { 15 } { O } - { 16 } { P } - { 17 } { Q } - { 18 } { R } - { 19 } { S } - { 20 } { T } - { 21 } { U } - { 22 } { V } - { 23 } { W } - { 24 } { X } - { 25 } { Y } - { 26 } { Z } - } - {#1} + \exp_after:wN \exp_after:wN + \if_case:w \int_eval:w #1 - \c_ten \int_eval_end: + A + \or: B + \or: C + \or: D + \or: E + \or: F + \or: G + \or: H + \or: I + \or: J + \or: K + \or: L + \or: M + \or: N + \or: O + \or: P + \or: Q + \or: R + \or: S + \or: T + \or: U + \or: V + \or: W + \or: X + \or: Y + \or: Z + \else: #1 + \fi: } % \end{macrocode} %\end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx index bf71c3df878..7b6879ba613 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3io.dtx 2595 2011-08-16 00:58:34Z bruno $ {L3 Experimental input-output operations} %</driver|package> %<*driver> @@ -498,10 +498,10 @@ %<*initex> \alloc_setup_type:nnn { ior } \c_zero \c_sixteen \cs_new_protected_nopar:Npn \ior_raw_new:N #1 - { \alloc_reg:NnNN g { ior } \tex_chardef:D #1 } + { \alloc_reg:nNN { ior } \tex_chardef:D #1 } \alloc_setup_type:nnn { iow } \c_zero \c_sixteen \cs_new_protected_nopar:Npn \iow_raw_new:N #1 - { \alloc_reg:NnNN g { iow } \tex_chardef:D #1 } + { \alloc_reg:nNN { iow } \tex_chardef:D #1 } %</initex> %<*package> \cs_set_eq:NN \iow_raw_new:N \newwrite diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index cbc1fb62a7d..df988bea954 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3keys.dtx 2568 2011-08-14 05:03:32Z bruno $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> @@ -269,7 +269,7 @@ % \meta{key} .fp_set:N = \meta{floating point} % \end{syntax} % Defines \meta{key} to set \meta{floating point} to \meta{value} -% (which must a integer expression). If the variable does not exist, +% (which must a floating point number). If the variable does not exist, % it will be created at the point that the key is set up. The % \meta{integer} will be assigned locally. % \end{function} @@ -279,7 +279,7 @@ % \meta{key} .fp_gset:N = \meta{floating point} % \end{syntax} % Defines \meta{key} to set \meta{floating-point} to \meta{value} -% (which must a integer expression). If the variable does not exist, +% (which must a floating point number). If the variable does not exist, % it will be created at the point that the key is set up. The % \meta{integer} will be assigned globally. % \end{function} @@ -301,7 +301,7 @@ % \meta{key} .int_set:N = \meta{integer} % \end{syntax} % Defines \meta{key} to set \meta{integer} to \meta{value} (which -% must a integer expression). If the variable does not exist, it +% must be an integer expression). If the variable does not exist, it % will be created at the point that the key is set up. The % \meta{integer} will be assigned locally. % \end{function} @@ -311,7 +311,7 @@ % \meta{key} .int_gset:N = \meta{integer} % \end{syntax} % Defines \meta{key} to set \meta{integer} to \meta{value} (which -% must a integer expression). If the variable does not exist, it +% must be an integer expression). If the variable does not exist, it % will be created at the point that the key is set up. The % \meta{integer} will be assigned globally. % \end{function} @@ -331,7 +331,7 @@ % \meta{key} .skip_set:N = \meta{skip} % \end{syntax} % Defines \meta{key} to set \meta{skip} to \meta{value} (which -% must a skip expression). If the variable does not exist, it +% must be a skip expression). If the variable does not exist, it % will be created at the point that the key is set up. The % \meta{skip} will be assigned locally. % \end{function} @@ -341,7 +341,7 @@ % \meta{key} .skip_gset:N = \meta{skip} % \end{syntax} % Defines \meta{key} to set \meta{skip} to \meta{value} (which -% must a skip expression). If the variable does not exist, it +% must be a skip expression). If the variable does not exist, it % will be created at the point that the key is set up. The % \meta{skip} will be assigned globally. % \end{function} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keyval.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keyval.dtx index 999ae7e5b08..01adb3a033a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keyval.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keyval.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3keyval.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3keyval.dtx 2601 2011-08-16 23:20:27Z bruno $ {L3 Experimental key-value parsing} %</driver|package> %<*driver> @@ -203,8 +203,8 @@ \group_begin: \tl_clear:N \l_keyval_sanitise_tl \tl_set:Nn \l_keyval_sanitise_tl {#1} - \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { = } { 8 } - \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { , } { 9 } + \tl_replace_all:Nnn \l_keyval_sanitise_tl { = } { 8 } + \tl_replace_all:Nnn \l_keyval_sanitise_tl { , } { 9 } \tl_clear:N \l_keyval_parse_tl \exp_after:wN \keyval_parse_elt:w \exp_after:wN \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 7e23d67b838..635c1a0a827 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2551 2011-08-11 22:40:53Z bruno $ +\GetIdInfo$Id: l3msg.dtx 2601 2011-08-16 23:20:27Z bruno $ {L3 Experimental messages} %</driver|package> %<*driver> @@ -624,6 +624,12 @@ % Issues an \enquote{Undefined error} message from \TeX{} itself, % and prints the \meta{error message}. The \meta{error message} % must be short: it is cropped at the end of one line. +% \begin{texnote} +% This function expands to an empty token list after two steps. +% Tokens inserted in response to \TeX{}'s prompt are read with +% the current category code setting, and inserted just after +% the place where the error message was issued. +% \end{texnote} % \end{function} % % \end{documentation} @@ -666,6 +672,7 @@ % \end{variable} % % \begin{macro}{\msg_new:nnnn, \msg_new:nnn} +% \begin{macro}{\msg_gset:nnnn,\msg_gset:nnn} % \begin{macro}{\msg_set:nnnn, \msg_set:nnn} % Setting a message simply means saving the appropriate text % into two functions. A sanity check first. @@ -677,7 +684,7 @@ \msg_kernel_error:nn { msg } { message-already-defined } {#1} {#2} } - \msg_set:nnnn {#1} {#2} + \msg_gset:nnnn {#1} {#2} } \cs_new_protected:Npn \msg_new:nnn #1#2#3 { \msg_new:nnnn {#1} {#2} {#3} { } } @@ -690,9 +697,19 @@ } \cs_new_protected:Npn \msg_set:nnn #1#2#3 { \msg_set:nnnn {#1} {#2} {#3} { } } +\cs_new_protected:Npn \msg_gset:nnnn #1#2#3#4 + { + \cs_gset:cpn { \c_msg_text_prefix_tl #1 / #2 } + ##1##2##3##4 {#3} + \cs_gset:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + ##1##2##3##4 {#4} + } +\cs_new_protected:Npn \msg_gset:nnn #1#2#3 + { \msg_gset:nnnn {#1} {#2} {#3} { } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Messages: support functions and text} % @@ -863,8 +880,8 @@ % which is turned into a blank space. % \begin{macrocode} \group_begin: % { - \char_set_lccode:w `\} = `\ \scan_stop: - \char_set_lccode:w `\& = `\! \scan_stop: + \char_set_lccode:nn {`\}} {`\ } + \char_set_lccode:nn {`\&} {`\!} \char_set_catcode_active:N \& \tl_to_lowercase:n { @@ -1574,18 +1591,46 @@ % \subsection{Expandable errors} % % \begin{macro}{\msg_expandable_error:n} -% +% In expansion only context, we cannot use the normal means of +% reporting errors. Instead, we feed \TeX{} an undefined control +% sequence, \cs{LaTeX3 error:}. It is thus interrupted, and shows +% the context, which thanks to the odd-looking \cs{use:n} is +% \begin{verbatim} +% <argument> \LaTeX3 error: +% The error message. +% \end{verbatim} +% In other words, \TeX{} is processing the argument of \cs{use:n}, +% which is \cs{LaTeX3 error:} \meta{error message}. +% Then \cs{msg_expandable_error_aux:w} cleans up. In fact, there +% is an extra subtlety: if the user inserts tokens for error recovery, +% they should be kept. Thus we also use an odd space character +% (with category code $7$) and keep tokens until that space character, +% dropping everything else until \cs{q_stop}. The \cs{c_zero} prevents +% losing braces around the user-inserted text if any, and stops the +% expansion of \cs{tex_romannumeral:D}. % \begin{macrocode} \group_begin: -\cs_new:Npx \msg_expandable_error:n #1 +\char_set_catcode_math_superscript:N \^ +\char_set_lccode:nn {`^} {`\ } +\char_set_lccode:nn {`L} {`L} +\char_set_lccode:nn {`T} {`T} +\char_set_lccode:nn {`X} {`X} +\tl_to_lowercase:n { - \exp_not:n + \cs_new:Npx \msg_expandable_error:n #1 { - \exp_after:wN \exp_after:wN - \exp_after:wN \use_none_delimit_by_q_stop:w + \exp_not:n + { + \tex_romannumeral:D + \exp_after:wN \exp_after:wN + \exp_after:wN \msg_expandable_error_aux:w + \exp_after:wN \exp_after:wN + \exp_after:wN \c_zero + } + \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } + \exp_not:N \q_stop } - \exp_not:N \use:n { \exp_not:c { LaTeX3 ~ error : } #1 } - \exp_not:N \q_stop + \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 \q_stop { #1 } } \group_end: % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 386b98b32dd..b63d2e5721b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2553 2011-08-11 23:55:20Z bruno $ +\GetIdInfo$Id: l3prg.dtx 2601 2011-08-16 23:20:27Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -2035,8 +2035,8 @@ % As we have restructured the structured variables, these are no % longer needed. % \begin{macrocode} -\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 { \deprectiated } -\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 { \deprectiated } +\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 { \deprecated } +\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 { \deprecated } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 0babc835ec9..10692dcf430 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2556 2011-08-12 14:00:43Z bruno $ +\GetIdInfo$Id: l3seq.dtx 2586 2011-08-15 03:59:12Z bruno $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> @@ -722,6 +722,21 @@ % according to the variant chosen. % \end{function} % +% \begin{function} +% {\seq_set_split:Nnn,\seq_gset_split:Nnn} +% \begin{syntax} +% \cs{seq_set_split:Nnn} \meta{sequence} +% ~~\Arg{delimiter} \Arg{token list} +% \end{syntax} +% This function splits the \meta{token list} into \meta{items} +% separated by \meta{delimiter}, ignoring all explicit space +% characters from both sides of each \meta{item}, then removing +% one set of outer braces if any. The result is assigned to +% \meta{sequence}, locally or globally according to the function +% chosen. The \meta{delimiter} may not contain |{|, |}| or |#| +% (assuming \TeX{}'s normal category code r\'egime). +% \end{function} +% % \section{Internal sequence functions} % % \begin{function}{\seq_if_empty_err_break:N} @@ -1816,6 +1831,69 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\seq_set_split:Nnn,\seq_gset_split:Nnn} +% \begin{macro}[aux]{\seq_set_split_aux:NNnn} +% \begin{macro}[aux] +% { +% \seq_set_split_aux_i:w, \seq_set_split_aux_ii:w, +% \seq_set_split_aux_end: +% } +% The goal is to split a given token list at a marker, +% strip spaces from each item, and remove one set of +% outer braces if after removing leading and trailing +% spaces the item is enclosed within braces. After +% \cs{tl_replace_all:Nnn}, the token list \cs{l_seq_tmpa_tl} +% is a repetition of the pattern +% \cs{seq_set_split_aux_i:w} \cs{prg_do_nothing:} +% \meta{item with spaces} \cs{seq_set_split_aux_end:}. +% Then, \texttt{x}-expansion causes \cs{seq_set_split_aux_i:w} +% to trim spaces, and leaves its result as +% \cs{seq_set_split_aux_ii:w} \meta{trimmed item} +% \cs{seq_set_split_aux_end:}. This is then converted +% to the \pkg{l3seq} internal structure by another +% \texttt{x}-expansion. In the first step, we insert +% \cs{prg_do_nothing:} to avoid losing braces too early: +% that would cause space trimming to act within those +% lost braces. The second step is solely there to strip +% braces which are outermost after space trimming. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \seq_set_split:Nnn + { \seq_set_split_aux:NNnn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_split:Nnn + { \seq_set_split_aux:NNnn \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 + { + \tl_if_empty:nTF {#4} + { #1 #2 { } } + { + \tl_set:Nn \l_seq_tmpa_tl + { + \seq_set_split_aux_i:w \prg_do_nothing: + #4 + \seq_set_split_aux_end: + } + \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } + { + \seq_set_split_aux_end: + \seq_set_split_aux_i:w \prg_do_nothing: + } + \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } + #1 #2 { \l_seq_tmpa_tl } + } + } +\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: + { + \exp_not:N \seq_set_split_aux_ii:w + \exp_args:No \tl_trim_spaces:n {#1} + \exp_not:N \seq_set_split_aux_end: + } +\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: + { \exp_not:n { \seq_item:n {#1} } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated interfaces} % % A few functions which are no longer documented: these were moved diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 3db13f9b400..f596eb1a263 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2563 2011-08-13 12:23:59Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2566 2011-08-13 22:04:42Z bruno $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -786,25 +786,31 @@ % \begin{syntax} % \cs{tl_trim_spaces:n} \meta{token list} % \end{syntax} -% Removes any leading and trailing spaces from the \meta{token list} -% and leaves the result in the input stream. This process requires -% two expansions. +% Removes any leading and trailing explicit space characters +% from the \meta{token list} and leaves the result in the input +% stream. This process requires two expansions. +% \begin{texnote} +% The result is return within the \cs{etex_unexpanded:D} +% primitive (\cs{exp_not:n}), which means that the token +% list will not expand further when appearing in an x-type +% argument expansion. +% \end{texnote} % \end{function} % % \begin{function}{\tl_trim_spaces:N, \tl_trim_spaces:c} % \begin{syntax} % \cs{tl_trim_spaces:N} \meta{tl~var} % \end{syntax} -% Removes any leading and trailing spaces from the content of the -% \meta{tl~var} within the current \TeX{} group. +% Removes any leading and trailing explicit space characters +% from the content of the \meta{tl~var} within the current \TeX{} group. % \end{function} % % \begin{function}{\tl_gtrim_spaces:N, \tl_gtrim_spaces:c} % \begin{syntax} % \cs{tl_gtrim_spaces:N} \meta{tl~var} % \end{syntax} -% Removes any leading and trailing spaces from the content of the -% \meta{tl~var} globally. +% Removes any leading and trailing explicit space characters +% from the content of the \meta{tl~var} globally. % \end{function} % % \section{The first token from a token list} @@ -2017,39 +2023,76 @@ % \tl_trim_spaces:N, \tl_trim_spaces:c, % \tl_gtrim_spaces:N, \tl_gtrim_spaces:c % } -% \begin{macro}[aux]{\tl_trim_spaces_exp:n} -% \begin{macro}[aux]{\tl_trim_spaces_aux_i:w} -% \begin{macro}[aux]{\tl_trim_spaces_aux_ii:w} -% Trimming spaces from around the input uses the idea of a sufficiently -% odd token to allow for a delimited argument to do this. Here, the -% standard approach [a |Q| with category code 3 (math toggle)] is used. +% \begin{macro}[aux] +% { +% \tl_trim_spaces_aux_i:w, \tl_trim_spaces_aux_ii:w +% \tl_trim_spaces_aux_iii:w, \tl_trim_spaces_aux_iv:w +% } +% Trimming spaces from around the input is done using delimited +% arguments and quarks, and to get spaces at odd places in the +% definitions, we nest those in \cs{tl_tmp:w}, which then receives +% a single space as its argument: |#1| is \verb*+ +. +% Removing leading spaces is done with \cs{tl_trim_spaces_aux_i:w}, +% which loops until \cs{q_mark}\verb*+ + matches the end of the token +% list: then |##1| is the token list and |##3| is +% \cs{tl_trim_spaces_aux_ii:w}. This hands the relevant tokens to the +% loop \cs{tl_trim_spaces_aux_iii:w}, responsible for trimming +% trailing spaces. The end is reached when \verb*+ + \cs{q_nil} +% matches the one present in the definition of \cs{tl_trim_spacs:n}. +% Then \cs{tl_trim_spaces_aux_iv:w} puts the token list into a group, +% as the argument of the initial \cs{etex_unexpanded:D}. % The \cs{etex_unexpanded:D} here is used so that space trimming will % behave correctly within an \texttt{x}-type expansion. % \begin{macrocode} -\cs_new:Npn \tl_trim_spaces:n #1 +\cs_set:Npn \tl_tmp:w #1 { - \etex_unexpanded:D \exp_after:wN \exp_after:wN \exp_after:wN - { \tl_trim_spaces_exp:n {#1} } + \cs_new:Npn \tl_trim_spaces:n ##1 + { + \etex_unexpanded:D + \tl_trim_spaces_aux_i:w + \q_mark + ##1 + \q_nil + \q_mark #1 { } + \q_mark \tl_trim_spaces_aux_ii:w + \tl_trim_spaces_aux_iii:w + #1 \q_nil + \tl_trim_spaces_aux_iv:w + \q_stop + } + \cs_new:Npn \tl_trim_spaces_aux_i:w ##1 \q_mark #1 ##2 \q_mark ##3 + { + ##3 + \tl_trim_spaces_aux_i:w + \q_mark + ##2 + \q_mark #1 {##1} + } + \cs_new:Npn \tl_trim_spaces_aux_ii:w ##1 \q_mark \q_mark ##2 + { + \tl_trim_spaces_aux_iii:w + ##2 + } + \cs_new:Npn \tl_trim_spaces_aux_iii:w ##1 #1 \q_nil ##2 + { + ##2 + ##1 \q_nil + \tl_trim_spaces_aux_iii:w + } + \cs_new:Npn \tl_trim_spaces_aux_iv:w ##1 \q_nil ##2 \q_stop + { \exp_after:wN { \use_none:n ##1 } } } +\tl_tmp:w { ~ } \cs_new_protected:Npn \tl_trim_spaces:N #1 { \tl_set:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_gtrim_spaces:N #1 { \tl_gset:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } -\group_begin: - \tex_catcode:D `\Q = 3 \scan_stop: - \cs_new:Npn \tl_trim_spaces_exp:n #1 - { \tex_romannumeral:D - `0 \tl_trim_spaces_aux_i:w \exp_not:N #1 Q ~ Q } - \cs_new:Npn \tl_trim_spaces_aux_i:w #1 ~ Q { \tl_trim_spaces_aux_ii:w #1 Q } - \cs_new:Npn \tl_trim_spaces_aux_ii:w #1 Q #2 {#1} -\group_end: \cs_generate_variant:Nn \tl_trim_spaces:N { c } \cs_generate_variant:Nn \tl_gtrim_spaces:N { c } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{The first token from a token list} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 153ca92f7e0..3aeca13b29d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2491 2011-07-02 11:49:37Z joseph $ +\GetIdInfo$Id: l3token.dtx 2579 2011-08-14 16:22:30Z bruno $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -1098,6 +1098,25 @@ % definition is global. % \end{function} % +% \begin{function}[TF]{\peek_N_type:} +% \begin{syntax} +% \cs{peek_N_type:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the next \meta{token} in the input stream can be safely +% grabbed as an \texttt{N}-type argument. The test will be \meta{false} +% if the next \meta{token} is either an explicit or implicit +% begin-group or end-group token (with any character code), or +% an explicit or implicit space character (with character code $32$ +% and category code $10$), and \meta{true} in all other cases. +% Note that a \meta{true} result ensures that the next \meta{token} is +% a valid \texttt{N}-type argument. However, if the next \meta{token} +% is for instance \cs{c_space_token}, the test will take the +% \meta{false} branch, even though the next \meta{token} is in fact +% a valid \texttt{N}-type argument. The \meta{token} will be left +% in the input stream after the \meta{true code} or \meta{false code} +% (as appropriate to the result of the test). +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -2283,6 +2302,36 @@ % \end{macro} % \end{macro} % +% \begin{macro}[TF]{\peek_N_type:} +% \begin{macro}{\peek_execute_branches_N_type:} +% The next token is normal if it is neither a begin-group token, +% nor an end-group token, nor a charcode-$32$ space token. +% Note that implicit begin-group tokens, end-group tokens, and +% spaces are also recognized as non-\texttt{N}-type. +% Here, there is no \meta{search token}, so we feed a dummy +% \cs{scan_stop:} to the \cs{peek_token_generic::NN} functions. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \peek_execute_branches_N_type: + { + \bool_if:nTF + { + \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token || + \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token || + \token_if_eq_meaning_p:NN \l_peek_token \c_space_token + } + { \peek_false:w } + { \peek_true:w } + } +\cs_new_protected_nopar:Npn \peek_N_type:TF + { \peek_token_generic:NNTF \peek_execute_branches_N_type: \scan_stop: } +\cs_new_protected_nopar:Npn \peek_N_type:T + { \peek_token_generic:NNT \peek_execute_branches_N_type: \scan_stop: } +\cs_new_protected_nopar:Npn \peek_N_type:F + { \peek_token_generic:NNF \peek_execute_branches_N_type: \scan_stop: } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated functions} % % Deprecated on 2011-05-27, for removal by 2011-08-31. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx b/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx index 62824848afc..2b5d5cd0880 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3toks.dtx 2478 2011-06-19 21:34:23Z joseph $ +\GetIdInfo$Id: l3toks.dtx 2601 2011-08-16 23:20:27Z bruno $ {L3 Experimental token registers} %</driver|package> %<*driver> @@ -67,7 +67,7 @@ % % \begin{documentation} % -% \textbf{THIS ENTIRE MODULE IS DEPRECIATED: DO NOT USE \cs{TOKS_\ldots} +% \textbf{THIS ENTIRE MODULE IS DEPRECATED: DO NOT USE \cs{TOKS_\ldots} % FUNCTIONS} % % \end{documentation} |