diff options
Diffstat (limited to 'Master/texmf-dist/source')
44 files changed, 2196 insertions, 1567 deletions
diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index e3f49bc1bbd..8ab332e83dc 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -39,8 +39,8 @@ \RequirePackage{expl3} \def\ExplFileName{l3build} \def\ExplFileDescription{L3 Regression test suite} -\def\ExplFileDate{2015/08/18} -\def\ExplFileVersion{5866} +\def\ExplFileDate{2015/09/05} +\def\ExplFileVersion{5925} \documentclass[full]{l3doc} \renewcommand\partname{Part} \usepackage{multicol,needspace} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx index 6d0cae589b0..a304a9110c1 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx @@ -37,8 +37,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3sort}{Support package l3kernel too old} @@ -50,7 +50,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3sort.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3sort.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental sorting functions} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx index d48b641bb3b..e95fd602974 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx @@ -36,8 +36,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3flag}{Support package l3kernel too old} @@ -49,7 +49,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3flag.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3flag.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental flags} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx index 10bb159803f..81c2751ada7 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx @@ -36,8 +36,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3regex}{Support package l3kernel too old} @@ -49,7 +49,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3regex.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3regex.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental regular expressions} %</driver|package> %<*driver> @@ -3146,7 +3146,7 @@ \@@_show_push:n { ~ } #1 \__tl_build_end: - \__msg_show_variable:n { >~Compiled~regex~#2: \l_@@_internal_a_tl } + \__msg_show_wrap:n { >~Compiled~regex~#2: \l_@@_internal_a_tl } } % \end{macrocode} % \end{macro} @@ -5750,7 +5750,7 @@ { Character~code~`#1'~too~large~in~`\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ - `\iow_char:N\\x\{\int_to_hexadecimal:n{#1}\}'.~ + `\iow_char:N\\x\{\int_to_Hex:n{#1}\}'.~ The~character~code~#1~is~larger~than~ the~maximum~value~\int_use:N \c_max_char_int. } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-expl.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-expl.dtx index 58e6b1b7706..ffb0ebb92f0 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-expl.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-expl.dtx @@ -36,8 +36,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3str}{Support package l3kernel too old} @@ -49,7 +49,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3str-expl.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3str-expl.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental strings} \def\ExplFileName{l3str} %</driver|package> @@ -455,9 +455,17 @@ % \c_percent_str % } % For all of those strings, use \cs{cs_to_str:N} to get characters with -% the correct category code. +% the correct category code. The conditional for \cs{c_backslash_str} +% is needed as while this code is experimental others may also +% define the name (see \pkg{xpatch} for example). % \begin{macrocode} +%<*package> +\cs_if_exist:NF \c_backslash_str + { \str_const:Nx \c_backslash_str { \cs_to_str:N \\ } } +%</package> +%<*initex> \str_const:Nx \c_backslash_str { \cs_to_str:N \\ } +%</initex> \str_const:Nx \c_left_brace_str { \cs_to_str:N \{ } \str_const:Nx \c_right_brace_str { \cs_to_str:N \} } \str_const:Nx \c_hash_str { \cs_to_str:N \# } @@ -678,12 +686,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP, aux]{\@@_skip_c_zero:w} +% \begin{macro}[EXP, aux]{\@@_skip_exp_end:w} % \begin{macro}[EXP, aux] % {\@@_skip_loop:wNNNNNNNN, \@@_skip_end:w, \@@_skip_end:NNNNNNNN} % Removes |max(#1,0)| characters from the input stream, and then -% leaves \cs{c_zero}. This should be expanded using -% \cs{tex_romannumeral:D}. We remove characters $8$ at a time until +% leaves \cs{exp_end:}. This should be expanded using +% \cs{exp:w}. We remove characters $8$ at a time until % there are at most $8$ to remove. Then we do a dirty trick: the % \cs{if_case:w} construction leaves between $0$ and $8$ times the % \cs{or:} control sequence, and those \cs{or:} become arguments of @@ -692,10 +700,10 @@ % of \cs{@@_skip_end:NNNNNNNN} are the two \cs{or:}, and $6$ % characters from the input stream, exactly what we wanted to % remove. Then close the \cs{if_case:w} conditional with \cs{fi:}, and -% stop the initial expansion with \cs{c_zero} (see places where -% \cs{@@_skip_c_zero:w} is called). +% stop the initial expansion with \cs{exp_end:} (see places where +% \cs{@@_skip_exp_end:w} is called). % \begin{macrocode} -\cs_new:Npn \@@_skip_c_zero:w #1; +\cs_new:Npn \@@_skip_exp_end:w #1; { \if_int_compare:w #1 > \c_eight \exp_after:wN \@@_skip_loop:wNNNNNNNN @@ -706,13 +714,13 @@ #1 ; } \cs_new:Npn \@@_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9 - { \exp_after:wN \@@_skip_c_zero:w \int_use:N \__int_eval:w #1 - \c_eight ; } + { \exp_after:wN \@@_skip_exp_end:w \int_use:N \__int_eval:w #1 - \c_eight ; } \cs_new:Npn \@@_skip_end:w #1 ; { \exp_after:wN \@@_skip_end:NNNNNNNN \if_case:w #1 \exp_stop_f: \or: \or: \or: \or: \or: \or: \or: \or: } -\cs_new:Npn \@@_skip_end:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero } +\cs_new:Npn \@@_skip_end:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \exp_end: } % \end{macrocode} % \end{macro} % \end{macro} @@ -724,7 +732,7 @@ % \@@_collect_end:wn, \@@_collect_end:nnnnnnnnw % } % Collects |max(#1,0)| characters, and removes everything else until -% \cs{q_stop}. This is somewhat similar to \cs{@@_skip_c_zero:w}, but +% \cs{q_stop}. This is somewhat similar to \cs{@@_skip_exp_end:w}, but % accepts integer expression arguments. This time we can only grab % $7$ characters at a time. At the end, we use an \cs{if_case:w} % trick again, so that the $8$ first arguments of @@ -807,7 +815,7 @@ { \use_none_delimit_by_q_stop:w } { \exp_after:wN \use_i_delimit_by_q_stop:nw - \tex_romannumeral:D \exp_after:wN \@@_skip_c_zero:w + \exp:w \exp_after:wN \@@_skip_exp_end:w \int_use:N \__int_eval:w #1 + #2 ; } } @@ -816,7 +824,7 @@ { \use_none_delimit_by_q_stop:w } { \exp_after:wN \use_i_delimit_by_q_stop:nw - \tex_romannumeral:D \@@_skip_c_zero:w #1 ; { } + \exp:w \@@_skip_exp_end:w #1 ; { } } } } @@ -896,7 +904,7 @@ { \exp_after:wN \@@_collect_delimit_by_q_stop:w \int_use:N \__int_eval:w #2 - #1 \exp_after:wN ; - \tex_romannumeral:D \@@_skip_c_zero:w #1 ; + \exp:w \@@_skip_exp_end:w #1 ; } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index 24d50400ac3..e1298f9ca9d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str-format.dtx Copyright (C) 2012-2013 The LaTeX3 Project +%% File: l3str-format.dtx Copyright (C) 2012-2013,2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str-format.dtx 4745 2014-05-06 10:41:27Z joseph $ +\GetIdInfo$Id: l3str-format.dtx 5906 2015-09-02 13:17:05Z mittelba $ {L3 Experimental string formatting} %</driver|package> %<*driver> @@ -665,9 +665,9 @@ { { ? } { \@@_int:NwnnNNn \use:n } { d } { \@@_int:NwnnNNn \use:n } - { b } { \@@_int:NwnnNNn \int_to_binary:n } - { o } { \@@_int:NwnnNNn \int_to_octal:n } - { X } { \@@_int:NwnnNNn \int_to_hexadecimal:n } + { b } { \@@_int:NwnnNNn \int_to_bin:n } + { o } { \@@_int:NwnnNNn \int_to_oct:n } + { X } { \@@_int:NwnnNNn \int_to_Hex:n } } { \__msg_kernel_expandable_error:nnnn diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx index 69a198da208..e40e4fae79e 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3tl-analysis.dtx Copyright (C) 2011-2012 The LaTeX3 Project +%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3tl-analysis.dtx 4745 2014-05-06 10:41:27Z joseph $ +\GetIdInfo$Id: l3tl-analysis.dtx 5899 2015-08-31 21:49:59Z joseph $ {L3 Experimental token lists analysis} %</driver|package> %<*driver> @@ -798,31 +798,26 @@ % in the input stream, and call \cs{@@_b_normals:ww} % with its first argument decremented. % \begin{macrocode} -\group_begin: - \char_set_catcode_other:N A - \char_set_catcode_other:N B - \char_set_catcode_other:N C - \char_set_uccode:nn { `? } { `D } - \tl_to_uppercase:n - { - \cs_new:Npn \@@_b_char:Nww #1 - { - \if_meaning:w #1 \tex_undefined:D ? \else: - \if_catcode:w #1 \c_catcode_other_token C \else: - \if_catcode:w #1 \c_catcode_letter_token B \else: - \if_catcode:w #1 \c_math_toggle_token 3 \else: - \if_catcode:w #1 \c_alignment_token 4 \else: - \if_catcode:w #1 \c_math_superscript_token 7 \else: - \if_catcode:w #1 \c_math_subscript_token 8 \else: - \if_catcode:w #1 \c_space_token A \else: - 6 - \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: - \__int_value:w `#1 \s__tl - \exp_after:wN \@@_b_normals:ww - \int_use:N \__int_eval:w \c_minus_one + - } - } -\group_end: +\cs_new:Npx \@@_b_char:Nww #1 + { + \exp_not:N \if_meaning:w #1 \exp_not:N \tex_undefined:D + \token_to_str:N D \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_other_token + \token_to_str:N C \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_letter_token + \token_to_str:N B \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_toggle_token 3 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_alignment_token 4 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_superscript_token 7 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_subscript_token 8 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_space_token + \token_to_str:N A \exp_not:N \else: + 6 + \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } + \exp_not:N \__int_value:w `#1 \s__tl + \exp_not:N \exp_after:wN \exp_not:N \@@_b_normals:ww + \exp_not:N \int_use:N \exp_not:N \__int_eval:w \c_minus_one + + } % \end{macrocode} % \end{macro} % @@ -949,33 +944,39 @@ % \subsection{Showing the results} % % \begin{macro}{\tl_show_analysis:N, \tl_show_analysis:n} -% \begin{macro}[int]{\@@_show:N} +% \begin{macro}[int]{\@@_show:} % Add to \cs{@@:n} a third pass to display tokens to the terminal. +% If the token list variable is not defined, throw the same error +% as \cs{tl_show:N} by simply calling that function. % \begin{macrocode} \cs_new_protected:Npn \tl_show_analysis:N #1 { - \exp_args:No \@@:n {#1} - \@@_show:N #1 + \tl_if_exist:NTF #1 + { + \exp_args:No \@@:n {#1} + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { \token_to_str:N #1 } { \tl_if_empty:NTF #1 { } { ? } } { } { } + \@@_show: + } + { \tl_show:N #1 } } \cs_new_protected:Npn \tl_show_analysis:n #1 { \@@:n {#1} - \tl_set:Nn \l_@@_internal_tl {#1} - \@@_show:N \l_@@_internal_tl + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { } { \tl_if_empty:nTF {#1} { } { ? } } { } { } + \@@_show: } -\cs_new_protected:Npn \@@_show:N #1 +\cs_new_protected:Npn \@@_show: { \group_begin: - \use:x + \exp_args:NNx + \group_end: + \__msg_show_wrap:n { - \group_end: - \exp_not:n { \__msg_show_variable:Nnn #1 } - { tl-analysis } - { - \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl - \s__tl { ? \__prg_break: } \s__tl - \__prg_break_point: - } + \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl + \s__tl { ? \__prg_break: } \s__tl + \__prg_break_point: } } % \end{macrocode} @@ -1104,10 +1105,8 @@ % \begin{macrocode} \__msg_kernel_new:nnn { kernel } { show-tl-analysis } { - The~token~list~ - \str_if_eq:nnF {#1} { \l_@@_internal_tl } - { \token_to_str:N #1 ~ } - \tl_if_empty:NTF #1 + The~token~list~ \tl_if_empty:nF {#1} { #1 ~ } + \tl_if_empty:nTF {#2} { is~empty } { contains~the~tokens: } } diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 90441e87e97..ed9db8b5920 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -38,8 +38,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3galley}{Support package l3kernel too old} @@ -51,7 +51,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3galley.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3galley.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental galley code} %</driver|package> %<*driver> @@ -1146,7 +1146,7 @@ \cs_new_protected_nopar:Npn \galley_par: { \s__par_omit - \exp_after:wN \@@_par_auxi: \tex_romannumeral:D - `0 + \exp_after:wN \@@_par_auxi: \exp:w \exp_continue_f:w } \cs_new_protected:Npn \@@_par_auxi: { diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index b66626c6e91..69518ad2ae1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -36,8 +36,8 @@ %<*driver|generic|package> \def\ExplFileName{expl3} \def\ExplFileDescription{L3 programming layer} -\def\ExplFileDate{2015/07/30} -\def\ExplFileVersion{5724} +\def\ExplFileDate{2015/09/06} +\def\ExplFileVersion{5925} %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -915,7 +915,7 @@ % much more useful than compactness. % \item Use long, descriptive names for functions and variables, % and for auxiliary functions use the parent function name plus -% |aux|, |aux_i|, |aux_ii| and so on. +% |aux|, |auxi|, |auxii| and so on. % \item If in doubt, ask the team via the LaTeX-L list: someone will % soon get back to you! % \end{itemize} @@ -999,7 +999,7 @@ % \item \pdfTeX{} v1.30 or later. % \item \XeTeX{} v0.9994 or later. % \item \LuaTeX{} v0.40 or later. -% \item e(u)p\TeX{} v110825 or later. +% \item e-(u)p\TeX{} mid-2012 or later. % \end{itemize} % of which the first three engines are currently officially supported by % the team. @@ -1259,6 +1259,15 @@ \input{expl3-code.tex} % \end{macrocode} % +% A check that the bootstrap code did not abort loading: if it did, +% bail out silently here. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname tex\string _let:D\endcsname\relax + \expandafter\endinput +\fi +% \end{macrocode} +% % Deactivate writing module information to the log. % \begin{macrocode} \protected\def\GetIdInfoLog{} @@ -1687,6 +1696,15 @@ \input expl3-code.tex % % \end{macrocode} % +% A check that the bootstrap code did not abort loading: if it did, +% bail out silently here. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname tex\string _let:D\endcsname\relax + \expandafter\endinput +\fi +% \end{macrocode} +% % \begin{macro}{\__iow_wrap_set:Nx} % Without \LaTeXe{} there is no \cs{protected@edef} so the more risky % direct use of \cs{tl_set:Nx} is required. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 5e97b697fdf..63bde464f33 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3basics.dtx 5500 2015-01-27 14:37:04Z joseph $ +\GetIdInfo$Id: l3basics.dtx 5897 2015-08-28 09:06:29Z joseph $ {L3 Basic definitions} %</driver|package> %<*driver> @@ -699,7 +699,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2012-09-09]{\cs_show:N, \cs_show:c} +% \begin{function}[updated = 2015-08-03]{\cs_show:N, \cs_show:c} % \begin{syntax} % \cs{cs_show:N} \meta{control sequence} % \end{syntax} @@ -744,7 +744,7 @@ % after two expansions of \cs{use:c}. % % \begin{function}[EXP,added = 2012-11-10] -% {\cs_if_exist_use:N,\cs_if_exist_use:c} +% {\cs_if_exist_use:N, \cs_if_exist_use:c} % \begin{syntax} % \cs{cs_if_exist_use:N} \meta{control sequence} % \end{syntax} @@ -754,7 +754,7 @@ % \end{function} % % \begin{function}[TF,EXP, added = 2012-11-10] -% {\cs_if_exist_use:N,\cs_if_exist_use:c} +% {\cs_if_exist_use:N, \cs_if_exist_use:c} % \begin{syntax} % \cs{cs_if_exist_use:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} % \end{syntax} @@ -1155,7 +1155,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\if:w, \if_charcode:w,\if_catcode:w} +% \begin{function}[EXP]{\if:w, \if_charcode:w, \if_catcode:w} % \begin{syntax} % "\if:w" <token_1> <token_2> <true code> "\else:" <false code> "\fi:" \\ % "\if_catcode:w" <token_1> <token_2> <true code> "\else:" <false code> "\fi:" @@ -1222,6 +1222,23 @@ % \texttt{check-declarations} is active. % \end{function} % +% \begin{function}{\__chk_log:x} +% \begin{syntax} +% \cs{__chk_log:x} \Arg{message text} +% \end{syntax} +% If the \texttt{log-functions} option is active, this function writes +% the \meta{message text} to the log file using \cs{iow_log:x}. +% Otherwise, the \meta{message text} is ignored using \cs{use_none:n}. +% \end{function} +% +% \begin{function}{\__chk_suspend_log:, \__chk_resume_log:} +% \begin{syntax} +% \cs{__chk_suspend_log:} \ldots{} \cs{__chk_log:x} \ldots{} \cs{__chk_resume_log:} +% \end{syntax} +% Any \cs{__chk_log:x} command between \cs{__chk_suspend_log:} and +% \cs{__chk_resume_log:} is suppressed. These commands can be nested. +% \end{function} +% % \begin{function}[EXP]{\__cs_count_signature:N, \__cs_count_signature:c} % \begin{syntax} % \cs{__cs_count_signature:N} \meta{function} @@ -1361,24 +1378,35 @@ % \end{macro} % % \begin{macro}[EXP]{\exp_after:wN, \exp_not:N, \exp_not:n} -% The three |\exp_| functions are used in the \textsf{l3expan} module +% The five |\exp_| functions are used in the \textsf{l3expan} module % where they are described. % \begin{macrocode} \tex_let:D \exp_after:wN \tex_expandafter:D \tex_let:D \exp_not:N \tex_noexpand:D \tex_let:D \exp_not:n \etex_unexpanded:D +\tex_let:D \exp:w \tex_romannumeral:D +\tex_chardef:D \exp_end: = 0 ~ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\token_to_meaning:N, \token_to_str:N, \cs_meaning:N} + + +% \begin{macro}[EXP]{\token_to_meaning:N, \cs_meaning:N} % Examining a control sequence or token. % \begin{macrocode} \tex_let:D \token_to_meaning:N \tex_meaning:D -\tex_let:D \token_to_str:N \tex_string:D \tex_let:D \cs_meaning:N \tex_meaning:D % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\tl_to_str:n, \token_to_str:N} +% Making strings. +% \begin{macrocode} +\tex_let:D \tl_to_str:n \etex_detokenize:D +\tex_let:D \token_to_str:N \tex_string:D +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\scan_stop:, \group_begin:, \group_end:} % The next three are basic functions for which there also exist % versions that are safe inside alignments. These safe versions are @@ -1692,18 +1720,18 @@ % interface. % % \begin{macro}[EXP]{\prg_return_true:, \prg_return_false:} -% The idea here is that \cs{__int_to_roman:w} will expand fully any +% The idea here is that \cs{exp:w} will expand fully any % \cs{else:} and the \cs{fi:} that are waiting to be discarded, -% before reaching the \cs{c_zero} which will leave the expansion null. +% before reaching the \cs{exp_end:} 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 \__int_to_roman:w } + { \exp_after:wN \use_i:nn \exp:w } \cs_set_nopar:Npn \prg_return_false: - { \exp_after:wN \use_ii:nn \__int_to_roman:w} + { \exp_after:wN \use_ii:nn \exp:w} % \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 @@ -1813,7 +1841,7 @@ % defining function. The sixth is the parameters to use (possibly % empty), the seventh is the list of forms to define, the eighth is the % replacement text which we will augment when defining the forms. -% The use of \cs{etex_detokenize:D} makes the later loop more robust. +% The use of \cs{tl_to_str:n} makes the later loop more robust. % \begin{macrocode} \cs_set_protected:Npn \__prg_generate_conditional:nnNnnnnn #1#2#3#4#5#6#7#8 { @@ -1826,7 +1854,7 @@ { \exp_not:N \__prg_generate_conditional:nnnnnnw \exp_not:n { {#4} {#5} {#1} {#2} {#6} {#8} } - \etex_detokenize:D {#7} + \tl_to_str:n {#7} \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } @@ -1870,7 +1898,7 @@ % following arguments: 1: \texttt{set} or \texttt{new}, 2: empty or % \texttt{\_protected}, 3: function name 4: signature, 5: parameter % text (or empty), 6: replacement. Remember that the logic-returning -% functions expect two arguments to be present after \cs{c_zero}: +% functions expect two arguments to be present after \cs{exp_end:}: % notice the construction of the different variants relies on this, % and that the |TF| variant will be slightly faster than the |T| % version. The |p| form is only valid for expandable tests, we check @@ -1886,7 +1914,7 @@ \fi: { \exp_args:cc { cs_ #2 #3 :Npn } { #4 _p: #5 } #6 - { #7 \c_zero \c_true_bool \c_false_bool } + { #7 \exp_end: \c_true_bool \c_false_bool } } { \__msg_kernel_error:nnx { kernel } { protected-predicate } @@ -1897,24 +1925,24 @@ #1 \q_stop #2#3#4#5#6#7 { \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 T } #6 - { #7 \c_zero \use:n \use_none:n } + { #7 \exp_end: \use:n \use_none:n } } \cs_set_protected:Npn \__prg_generate_F_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 F } #6 - { #7 \c_zero { } } + { #7 \exp_end: { } } } \cs_set_protected:Npn \__prg_generate_TF_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6 - { #7 \c_zero } + { #7 \exp_end: } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\prg_set_eq_conditional:NNn,\prg_new_eq_conditional:NNn} +% \begin{macro}{\prg_set_eq_conditional:NNn, \prg_new_eq_conditional:NNn} % \begin{macro}[aux]{\__prg_set_eq_conditional:NNNn} % The setting-equal functions. Split both functions and feed % \Arg{name_1} \Arg{signature_1} \meta{boolean_1} @@ -1935,7 +1963,7 @@ \__cs_split_function:NN #2 \prg_do_nothing: \__cs_split_function:NN #3 \prg_do_nothing: \exp_not:N #1 - \etex_detokenize:D {#4} + \tl_to_str:n {#4} \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } @@ -2064,26 +2092,33 @@ % The character codes are different, thus the \cs{if:w} test is false, % and \TeX{} reads \cs{__cs_to_str:N} after turning the following % control sequence into a string; this auxiliary removes the escape -% character, and stops the expansion of the initial \cs{__int_to_roman:w}. +% character, and stops the expansion of the initial \cs{tex_romannumeral:D}. % The second case is that the escape character is not printable. Then % the \cs{if:w} test is unfinished after reading a the space from % \verb*|\token_to_str:N \ |, and the auxiliary \cs{__cs_to_str:w} % is expanded, feeding |-| as a second character for the test; % the test is false, and \TeX{} skips to \cs{fi:}, then performs -% \cs{token_to_str:N}, and stops the \cs{__int_to_roman:w} with \cs{c_zero}. +% \cs{token_to_str:N}, and stops the \cs{tex_romannumeral:D} with \cs{c_zero}. % The last case is that the escape character is itself a space. In this % case, the \cs{if:w} test is true, and the auxiliary \cs{__cs_to_str:w} % comes into play, inserting |-\__int_value:w|, which expands \cs{c_zero} -% to the character |0|. The initial \cs{__int_to_roman:w} then sees +% to the character |0|. The initial \cs{tex_romannumeral:D} then sees % |0|, which is not a terminated number, followed by the escape character, -% a space, which is removed, terminating the argument of -% \cs{__int_to_roman:w}. +% a space, which is removed, terminating the expansion of +% \cs{tex_romannumeral:D}. % In all three cases, \cs{cs_to_str:N} takes two expansion steps % to be fully expanded. % \begin{macrocode} \cs_set_nopar:Npn \cs_to_str:N { - \__int_to_roman:w +% \end{macrocode} +% We implement the expansion scheme using \cs{tex_romannumeral:D} +% terminating it with \cs{c_zero} rather than using \cs{exp:w} and +% \cs{exp_end:} as we normally do. The reason is that the code +% heavily depends on terminating the expansion with \cs{c_zero} so +% we make this dependency explicit. +% \begin{macrocode} + \tex_romannumeral:D \if:w \token_to_str:N \ \__cs_to_str:w \fi: \exp_after:wN \__cs_to_str:N \token_to_str:N } @@ -2107,9 +2142,9 @@ % for the boolean. For example, % |\__cs_split_function:NN \foo_bar:cnx \use_i:nnn| as input % becomes |\use_i:nnn {foo_bar} {cnx} \c_true_bool|. -% -% We can't use a literal |:| because it has the wrong catcode here, so -% it's transformed from |@| with \cs{tex_lowercase:D}. +% +% We cannot use |:| directly as it has the wrong category code so +% an |x|-type expansion is used to force the conversion. % % First ensure that we actually get a properly evaluated string by % expanding \cs{cs_to_str:N} twice. If the function contained a @@ -2122,25 +2157,22 @@ % auxiliary trims the trailing \cs{q_mark} from the function name if % present (that is, if the original function had no colon). % \begin{macrocode} -\group_begin: -\tex_lccode:D `\@ = `\: \scan_stop: -\tex_catcode:D `\@ = 12 ~ -\tex_lowercase:D +\cs_set:Npx \__cs_split_function:NN #1 { - \group_end: - \cs_set:Npn \__cs_split_function:NN #1 - { - \exp_after:wN \exp_after:wN - \exp_after:wN \__cs_split_function_auxi:w - \cs_to_str:N #1 \q_mark \c_true_bool - @ \q_mark \c_false_bool - \q_stop - } - \cs_set:Npn \__cs_split_function_auxi:w #1 @ #2 \q_mark #3#4 \q_stop #5 - { \__cs_split_function_auxii:w #5 #1 \q_mark \q_stop {#2} #3 } - \cs_set:Npn \__cs_split_function_auxii:w #1#2 \q_mark #3 \q_stop - { #1 {#2} } + \exp_not:N \exp_after:wN \exp_not:N \exp_after:wN + \exp_not:N \exp_after:wN \exp_not:N \__cs_split_function_auxi:w + \exp_not:N \cs_to_str:N #1 \exp_not:N \q_mark \c_true_bool + \token_to_str:N : \exp_not:N \q_mark \c_false_bool + \exp_not:N \q_stop } +\use:x + { + \cs_set:Npn \exp_not:N \__cs_split_function_auxi:w + ##1 \token_to_str:N : ##2 \exp_not:N \q_mark ##3##4 \exp_not:N \q_stop ##5 + } + { \__cs_split_function_auxii:w #5 #1 \q_mark \q_stop {#2} #3 } +\cs_set:Npn \__cs_split_function_auxii:w #1#2 \q_mark #3 \q_stop + { #1 {#2} } % \end{macrocode} % \end{macro} % \end{macro} @@ -2163,7 +2195,7 @@ % \tn{relax} token. A control sequence is said to be \emph{free} % (to be defined) if it does not already exist. % -% \begin{macro}[pTF, EXP]{\cs_if_exist:N,\cs_if_exist:c} +% \begin{macro}[pTF, EXP]{\cs_if_exist:N, \cs_if_exist:c} % Two versions for checking existence. For the |N| form we firstly % check for \cs{scan_stop:} and then if it is in the hash % table. There is no problem when inputting something like \cs{else:} @@ -2209,7 +2241,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF, EXP]{\cs_if_free:N,\cs_if_free:c} +% \begin{macro}[pTF, EXP]{\cs_if_free:N, \cs_if_free:c} % The logical reversal of the above. % \begin{macrocode} \prg_set_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF } @@ -2297,6 +2329,47 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\__chk_log:x, \__chk_suspend_log:, \__chk_resume_log:} +% This function is used to write some information to the \texttt{log} +% file in case the |log-function| option is set. Otherwise its +% argument is ignored. Using this function rather than directly using +% \cs{iow_log:x} allows for \cs{__chk_suspend_log:} which disables +% such messages until the matching \cs{__chk_resume_log:}. These two +% commands are used to improve the logging for complicated datatypes. +% They should come in pairs, which can be nested. The function +% \cs{exp_not:o} is defined in \pkg{l3expan} later on but +% \cs{__chk_suspend_log:} and \cs{__chk_resume_log:} are not used +% before that point. +% \begin{macrocode} +%<*initex> +\cs_set_protected_nopar:Npn \__chk_log:x { \use_none:n } +\cs_set_protected_nopar:Npn \__chk_suspend_log: { } +\cs_set_protected_nopar:Npn \__chk_resume_log: { } +%</initex> +%<*package> +\tex_ifodd:D \l@expl@log@functions@bool + \cs_set_protected_nopar:Npn \__chk_log:x { \iow_log:x } + \cs_set_protected_nopar:Npn \__chk_suspend_log: + { + \cs_set_protected_nopar:Npx \__chk_resume_log: + { + \cs_set_protected_nopar:Npn \__chk_resume_log: + { \exp_not:o { \__chk_resume_log: } } + \cs_set_protected_nopar:Npn \__chk_log:x + { \exp_not:o { \__chk_log:x } } + } + \cs_set_protected_nopar:Npn \__chk_log:x { \use_none:n } + } + \cs_set_protected_nopar:Npn \__chk_resume_log: { } +\else: + \cs_set_protected_nopar:Npn \__chk_log:x { \use_none:n } + \cs_set_protected_nopar:Npn \__chk_suspend_log: { } + \cs_set_protected_nopar:Npn \__chk_resume_log: { } +\fi: +%</package> +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int] % {\__msg_kernel_error:nnxx, \__msg_kernel_error:nnx, \__msg_kernel_error:nn} % If an internal error occurs before \LaTeX3 has loaded \pkg{l3msg} then @@ -2359,7 +2432,7 @@ \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } - \iow_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } + \__chk_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \fi: %</package> @@ -2866,17 +2939,16 @@ % \subsection{Diagnostic functions} % % \begin{macro}[int]{\__kernel_register_show:N, \__kernel_register_show:c} -% Check that the variable exists, then apply the \tn{showthe} primitive to -% the variable. The odd-looking \cs{use:n} gives a nicer output. +% Simply using the \tn{showthe} primitive does not allow for +% line-wrapping, so instead use \cs{__msg_show_variable:NNNnn} (defined +% in \pkg{l3msg}). This checks that the variable exists (using +% \cs{cs_if_exist:NTF}), then displays the third argument, namely +% |>~|\meta{variable}|=|\meta{value}. % \begin{macrocode} \cs_new_protected:Npn \__kernel_register_show:N #1 { - \cs_if_exist:NTF #1 - { \tex_showthe:D \use:n {#1} } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { > ~ \token_to_str:N #1 = \tex_the:D #1 } } \cs_new_protected_nopar:Npn \__kernel_register_show:c { \exp_args:Nc \__kernel_register_show:N } @@ -2884,39 +2956,20 @@ % \end{macro} % % \begin{macro}{\cs_show:N, \cs_show:c} -% \begin{macro}[aux, EXP]{\__cs_show:www} % Some control sequences have a very long name or meaning. Thus, % simply using \TeX{}'s primitive \tn{show} could lead to overlong -% lines. The output of this primitive is mimicked to some extent: a -% line-break is added after the first colon in the meaning (this is -% what \TeX{} does for macros and five |\...mark| primitives). Then -% the re-built string is given to \cs{iow_wrap:nnnN} for +% lines. The output of this primitive is mimicked to some extent, +% then the re-built string is given to \cs{iow_wrap:nnnN} for % line-wrapping. The \cs{cs_show:c} command converts its argument to % a control sequence within a group to avoid showing \tn{relax} for % undefined control sequences. % \begin{macrocode} -\group_begin: - \tex_lccode:D `? = `: \scan_stop: - \tex_catcode:D `? = 12 \scan_stop: -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \cs_show:N #1 - { - \__msg_show_variable:n - { - > ~ \token_to_str:N #1 = - \exp_after:wN \__cs_show:www \cs_meaning:N #1 - \use_none:nn ? \prg_do_nothing: - } - } - \cs_new:Npn \__cs_show:www #1 ? { #1 ? \\ } - } +\cs_new_protected:Npn \cs_show:N #1 + { \__msg_show_wrap:n { > ~ \token_to_str:N #1 = \cs_meaning:N #1 } } \cs_new_protected_nopar:Npn \cs_show:c { \group_begin: \exp_args:NNc \group_end: \cs_show:N } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Engine specific definitions} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index cf0903d6dec..9de367fc7ea 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -145,7 +145,7 @@ % \end{macro} % \end{macro} % \end{macro} -\GetIdInfo$Id: l3bootstrap.dtx 5721 2015-07-30 11:46:45Z bruno $ +\GetIdInfo$Id: l3bootstrap.dtx 5729 2015-07-31 05:56:12Z joseph $ {L3 Bootstrap code} %</driver|package> %<*driver> @@ -408,10 +408,11 @@ {% LaTeX3 requires the e-TeX primitives and \string\pdfstrcmp.\LineBreak \LineBreak - These are available in engine versions:\LineBreak - - pdfTeX 1.30\LineBreak - - XeTeX 0.9994\LineBreak - - LuaTeX 0.40\LineBreak + These are available in the engines\LineBreak + - pdfTeX v1.30\LineBreak + - XeTeX v0.9994\LineBreak + - LuaTeX v0.40\LineBreak + - e-(u)pTeX mid-2012\LineBreak or later.\LineBreak \LineBreak }% diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 3bfbeb053ec..6be9b6f8d57 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3box.dtx Copyright (C) 2005-2014 The LaTeX3 Project +%% File: l3box.dtx Copyright (C) 2005-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3box.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3box.dtx 5822 2015-08-09 16:41:04Z joseph $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -363,9 +363,6 @@ % \end{syntax} % Typesets the \meta{contents} into a horizontal box of natural % width and then includes this box in the current list for typesetting. -% \begin{texnote} -% This is the \TeX{} primitive \tn{hbox}. -% \end{texnote} % \end{function} % % \begin{function}{\hbox_to_wd:nn} @@ -663,7 +660,7 @@ % % \TestFiles{m3box001.lvt} % -% \begin{macro}{\box_new:N,\box_new:c} +% \begin{macro}{\box_new:N, \box_new:c} % Defining a new \meta{box} register: remember that box $255$ is not % generally available. % \begin{macrocode} @@ -762,9 +759,9 @@ % % \subsection{Measuring and setting box dimensions} % -% \begin{macro}{\box_ht:N,\box_ht:c} -% \begin{macro}{\box_dp:N,\box_dp:c} -% \begin{macro}{\box_wd:N,\box_wd:c} +% \begin{macro}{\box_ht:N, \box_ht:c} +% \begin{macro}{\box_dp:N, \box_dp:c} +% \begin{macro}{\box_wd:N, \box_wd:c} % \testfile* % Accessing the height, depth, and width of a \meta{box} register. % \begin{macrocode} @@ -814,8 +811,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\box_move_left:nn,\box_move_right:nn} -% \begin{macro}{\box_move_up:nn,\box_move_down:nn} +% \begin{macro}{\box_move_left:nn, \box_move_right:nn} +% \begin{macro}{\box_move_up:nn, \box_move_down:nn} % \testfile* % Move box material in different directions. % \begin{macrocode} @@ -848,9 +845,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[pTF]{\box_if_horizontal:N,\box_if_horizontal:c} +% \begin{macro}[pTF]{\box_if_horizontal:N, \box_if_horizontal:c} % \testfile* -% \begin{macro}[pTF]{\box_if_vertical:N,\box_if_vertical:c} +% \begin{macro}[pTF]{\box_if_vertical:N, \box_if_vertical:c} % \testfile* % \begin{macrocode} \prg_new_conditional:Npnn \box_if_horizontal:N #1 { p , T , F , TF } @@ -969,8 +966,8 @@ % \begin{macro}[aux]{\@@_show:NNnn} % The internal auxiliary to actually do the output uses a group to deal % with breadth and depth values. The \cs{use:n} here gives better output -% appearance. Setting \tn{tracingonline} is used to control what -% appears in the terminal. +% appearance. Setting \tn{tracingonline} and \tn{errorcontextlines} is +% used to control what appears in the terminal. % \begin{macrocode} \cs_new_protected:Npn \@@_show:NNnn #1#2#3#4 { @@ -978,6 +975,7 @@ \int_set:Nn \tex_showboxbreadth:D {#3} \int_set:Nn \tex_showboxdepth:D {#4} \int_set_eq:NN \tex_tracingonline:D #1 + \int_set_eq:NN \tex_errorcontextlines:D \c_minus_one \box_if_exist:NTF #2 { \tex_showbox:D \use:n {#2} } { @@ -995,12 +993,12 @@ % \testfile{m3box002.lvt} % Put a horizontal box directly into the input stream. % \begin{macrocode} -\cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: } +\cs_new_protected:Npn \hbox:n #1 { \tex_hbox:D \scan_stop: {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\hbox_set:Nn,\hbox_set:cn} -% \begin{macro}{\hbox_gset:Nn,\hbox_gset:cn} +% \begin{macro}{\hbox_set:Nn, \hbox_set:cn} +% \begin{macro}{\hbox_gset:Nn, \hbox_gset:cn} % \testfile* % \begin{macrocode} \cs_new_protected:Npn \hbox_set:Nn #1#2 @@ -1012,8 +1010,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\hbox_set_to_wd:Nnn,\hbox_set_to_wd:cnn} -% \begin{macro}{\hbox_gset_to_wd:Nnn,\hbox_gset_to_wd:cnn} +% \begin{macro}{\hbox_set_to_wd:Nnn, \hbox_set_to_wd:cnn} +% \begin{macro}{\hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn} % \testfile* % Storing material in a horizontal box with a specified width. % \begin{macrocode} @@ -1047,23 +1045,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\hbox_set_inline_begin:N, \hbox_set_inline_begin:c} -% \begin{macro}{\hbox_gset_inline_begin:N, \hbox_gset_inline_begin:c} -% \begin{macro}{\hbox_set_inline_end:,\hbox_gset_inline_end:} -% \testfile* -% Renamed September 2011. -% \begin{macrocode} -\cs_new_eq:NN \hbox_set_inline_begin:N \hbox_set:Nw -\cs_new_eq:NN \hbox_set_inline_begin:c \hbox_set:cw -\cs_new_eq:NN \hbox_set_inline_end: \hbox_set_end: -\cs_new_eq:NN \hbox_gset_inline_begin:N \hbox_gset:Nw -\cs_new_eq:NN \hbox_gset_inline_begin:c \hbox_gset:cw -\cs_new_eq:NN \hbox_gset_inline_end: \hbox_gset_end: -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\hbox_to_wd:nn} % \begin{macro}{\hbox_to_zero:n} % \testfile* @@ -1118,8 +1099,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\vbox_to_ht:nn,\vbox_to_zero:n} -% \begin{macro}{\vbox_to_ht:nn,\vbox_to_zero:n} +% \begin{macro}{\vbox_to_ht:nn, \vbox_to_zero:n} +% \begin{macro}{\vbox_to_ht:nn, \vbox_to_zero:n} % \testfile* % Put a vertical box directly into the input stream. % \begin{macrocode} @@ -1161,8 +1142,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\vbox_set_to_ht:Nnn,\vbox_set_to_ht:cnn} -% \begin{macro}{\vbox_gset_to_ht:Nnn,\vbox_gset_to_ht:cnn} +% \begin{macro}{\vbox_set_to_ht:Nnn, \vbox_set_to_ht:cnn} +% \begin{macro}{\vbox_gset_to_ht:Nnn, \vbox_gset_to_ht:cnn} % \testfile* % Storing material in a vertical box with a specified height. % \begin{macrocode} @@ -1203,25 +1184,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\vbox_set_inline_begin:N, \vbox_set_inline_begin:c} -% \begin{macro}{\vbox_gset_inline_begin:N, \vbox_gset_inline_begin:c} -% \begin{macro}{\vbox_set_inline_end:} -% \begin{macro}{\vbox_gset_inline_end:} -% \testfile* -% Renamed September 2011. -% \begin{macrocode} -\cs_new_eq:NN \vbox_set_inline_begin:N \vbox_set:Nw -\cs_new_eq:NN \vbox_set_inline_begin:c \vbox_set:cw -\cs_new_eq:NN \vbox_set_inline_end: \vbox_set_end: -\cs_new_eq:NN \vbox_gset_inline_begin:N \vbox_gset:Nw -\cs_new_eq:NN \vbox_gset_inline_begin:c \vbox_gset:cw -\cs_new_eq:NN \vbox_gset_inline_end: \vbox_gset_end: -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\vbox_unpack:N, \vbox_unpack:c} % \begin{macro}{\vbox_unpack_clear:N, \vbox_unpack_clear:c} % \testfile* diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 7f24c5b9e74..3b8cf3368c5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3candidates.dtx 5677 2015-07-22 14:47:23Z joseph $ +\GetIdInfo$Id: l3candidates.dtx 5911 2015-09-03 08:24:00Z joseph $ {L3 Experimental additions to l3kernel} %</driver|package> %<*driver> @@ -106,7 +106,7 @@ % % \section{Additions to \pkg{l3basics}} % -% \begin{function}[added = 2014-08-22]{\cs_log:N, \cs_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\cs_log:N, \cs_log:c} % \begin{syntax} % \cs{cs_log:N} \meta{control sequence} % \end{syntax} @@ -115,7 +115,8 @@ % terminal. % \end{function} % -% \begin{function}{\__kernel_register_log:N, \__kernel_register_log:c} +% \begin{function}[updated = 2015-08-03] +% {\__kernel_register_log:N, \__kernel_register_log:c} % \begin{syntax} % \cs{__kernel_register_log:N} \meta{register} % \end{syntax} @@ -497,7 +498,8 @@ % % \section{Additions to \pkg{l3fp}} % -% \begin{function}[added = 2014-08-22]{\fp_log:N, \fp_log:c, \fp_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07] +% {\fp_log:N, \fp_log:c, \fp_log:n} % \begin{syntax} % \cs{fp_log:N} \meta{fp~var} % \cs{fp_log:n} \Arg{floating point expression} @@ -508,14 +510,14 @@ % % \section{Additions to \pkg{l3int}} % -% \begin{function}[added = 2014-08-22]{\int_log:N, \int_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\int_log:N, \int_log:c} % \begin{syntax} % \cs{int_log:N} \meta{integer} % \end{syntax} % Writes the value of the \meta{integer} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\int_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\int_log:n} % \begin{syntax} % \cs{int_log:n} \Arg{integer expression} % \end{syntax} @@ -535,56 +537,53 @@ % % \section{Additions to \pkg{l3msg}} % -% \begin{function}[added = 2014-08-22]{\__msg_log:nnn} -% \begin{syntax} -% \cs{__msg_log:nnn} \Arg{module} \Arg{message} \Arg{arg one} -% \end{syntax} -% Writes the \meta{message} from \meta{module} in the log file without -% formatting. Used in messages which print complex variable contents -% completely. -% \end{function} -% -% \begin{function}[added = 2014-08-22]{\__msg_log_variable:Nnn} -% \begin{syntax} -% \cs{__msg_log_variable:Nnn} \meta{variable} \Arg{type} \Arg{formatted content} -% \end{syntax} -% Writes the \meta{formatted content} of the \meta{variable} of -% \meta{type} in the log file. The \meta{formatted content} will be -% processed as the first argument in a call to \cs{iow_wrap:nnnN}, -% hence |\\|, \verb*|\ | and other formatting sequences can be used. -% Once expanded and processed, the \meta{formatted content} must -% either be empty or contain |>|; everything until the first |>| will -% be removed. -% \end{function} -% -% \begin{function}[added = 2014-08-22]{\__msg_log_wrap:n} -% \begin{syntax} -% \cs{__msg_log_wrap:n} \Arg{formatted text} -% \end{syntax} -% Writes the \meta{formatted text} in the log file. After expansion, -% unless it is empty, the \meta{formatted text} must contain |>|, -% and the part of \meta{formatted text} before the first |>| is -% removed. Failure to do so causes low-level \TeX{} errors. -% \end{function} -% -% \begin{function}[added = 2014-08-22] -% {\__msg_log_value:n, \__msg_log_value:x} +% In very rare cases it may be necessary to produce errors in an +% expansion-only context. The functions in this section should only be +% used if there is no alternative approach using \cs{msg_error:nnnnnn} +% or other non-expandable commands from the previous section. Despite +% having a similar interface as non-expandable messages, expandable +% errors must be handled internally very differently from normal error +% messages, as none of the tools to print to the terminal or the log +% file are expandable. As a result, the message text and arguments are +% not expanded, and messages must be very short (with default settings, +% they are truncated after approximately 50 characters). It is +% advisable to ensure that the message is understandable even when +% truncated. Another particularity of expandable messages is that they +% cannot be redirected or turned off by the user. +% +% \begin{function}[EXP, added = 2015-08-06] +% { +% \msg_expandable_error:nnnnnn , +% \msg_expandable_error:nnnnn , +% \msg_expandable_error:nnnn , +% \msg_expandable_error:nnn , +% \msg_expandable_error:nn , +% \msg_expandable_error:nnffff , +% \msg_expandable_error:nnfff , +% \msg_expandable_error:nnff , +% \msg_expandable_error:nnf , +% } % \begin{syntax} -% \cs{__msg_log_value:n} \Arg{tokens} +% \cs{msg_expandable_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} -% Writes \verb*|> |\meta{tokens}|.| in the log file. +% Issues an \enquote{Undefined error} message from \TeX{} itself +% using the undefined control sequence \cs{::error} then prints +% \enquote{! \meta{module}: }\meta{error message}, which should be +% short. With default settings, anything beyond approximately $60$ +% characters long (or bytes in some engines) is cropped. A leading +% space might be removed as well. % \end{function} % % \section{Additions to \pkg{l3prg}} % -% \begin{function}[added = 2014-08-22]{\bool_log:N, \bool_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\bool_log:N, \bool_log:c} % \begin{syntax} % \cs{bool_log:N} \meta{boolean} % \end{syntax} % Writes the logical truth of the \meta{boolean} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\bool_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\bool_log:n} % \begin{syntax} % \cs{bool_log:n} \Arg{boolean expression} % \end{syntax} @@ -607,7 +606,7 @@ % \prop_map_tokens:Nn \l_my_prop { \str_if_eq:nnT { mykey } } % \end{verbatim} % will expand to the value corresponding to \texttt{mykey}: for each -% pair in \cs{l_my_prop} the function \cs{str_if_eq:nnT} receives +% pair in |\l_my_prop| the function \cs{str_if_eq:nnT} receives % \texttt{mykey}, the \meta{key} and the \meta{value} as its three % arguments. For that specific task, \cs{prop_item:Nn} is faster. % \end{function} @@ -695,14 +694,14 @@ % warning message of some sort. % \end{function} % -% \begin{function}[added = 2014-08-22]{\dim_log:N, \dim_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\dim_log:N, \dim_log:c} % \begin{syntax} % \cs{dim_log:N} \meta{dimension} % \end{syntax} % Writes the value of the \meta{dimension} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\dim_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\dim_log:n} % \begin{syntax} % \cs{dim_log:n} \Arg{dimension expression} % \end{syntax} @@ -710,14 +709,14 @@ % in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\skip_log:N, \skip_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\skip_log:N, \skip_log:c} % \begin{syntax} % \cs{skip_log:N} \meta{skip} % \end{syntax} % Writes the value of the \meta{skip} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\skip_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\skip_log:n} % \begin{syntax} % \cs{skip_log:n} \Arg{skip expression} % \end{syntax} @@ -725,14 +724,14 @@ % in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\muskip_log:N, \muskip_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\muskip_log:N, \muskip_log:c} % \begin{syntax} % \cs{muskip_log:N} \meta{muskip} % \end{syntax} % Writes the value of the \meta{muskip} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22]{\muskip_log:n} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\muskip_log:n} % \begin{syntax} % \cs{muskip_log:n} \Arg{muskip expression} % \end{syntax} @@ -784,7 +783,7 @@ % giving an \meta{integer denotation}. % \end{function} % -% \begin{function}[EXP]{\tl_expandable_uppercase:n,\tl_expandable_lowercase:n} +% \begin{function}[EXP]{\tl_expandable_uppercase:n, \tl_expandable_lowercase:n} % \begin{syntax} % \cs{tl_expandable_uppercase:n} \Arg{tokens} % \cs{tl_expandable_lowercase:n} \Arg{tokens} @@ -1017,7 +1016,7 @@ % argument. % \end{function} % -% \begin{function}[added = 2014-08-22]{\tl_log:N, \tl_log:c} +% \begin{function}[added = 2014-08-22, updated = 2015-08-01]{\tl_log:N, \tl_log:c} % \begin{syntax} % \cs{tl_log:N} \meta{tl~var} % \end{syntax} @@ -1035,52 +1034,29 @@ % % \section{Additions to \pkg{l3tokens}} % -% \begin{function}{\char_set_active:Npn, \char_set_active:Npx} -% \begin{syntax} -% \cs{char_set_active:Npn} \meta{char} \meta{parameters} \Arg{code} -% \end{syntax} -% Makes \meta{char} an active character to expand to \meta{code} as -% replacement text. -% Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, -% \emph{etc.}) will be replaced by those absorbed. The \meta{char} is -% made active within the current \TeX{} group level, and the definition -% is also local. -% \end{function} -% -% \begin{function}{\char_gset_active:Npn, \char_gset_active:Npx} -% \begin{syntax} -% \cs{char_gset_active:Npn} \meta{char} \meta{parameters} \Arg{code} -% \end{syntax} -% Makes \meta{char} an active character to expand to \meta{code} as -% replacement text. -% Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, -% \emph{etc.}) will be replaced by those absorbed. The \meta{char} is -% made active within the current \TeX{} group level, but the definition -% is global. This function is therefore suited to cases where an active -% character definition should be applied only in some context (where the -% \meta{char} is again made active). -% \end{function} -% -% \begin{function}{\char_set_active_eq:NN} +% \begin{function}[updated = 2015-09-01] +% {\char_set_active_eq:NN, \char_gset_active_eq:NN} % \begin{syntax} % \cs{char_set_active_eq:NN} \meta{char} \meta{function} % \end{syntax} -% Makes \meta{char} an active character equivalent in meaning to the -% \meta{function} (which may itself be an active character). The \meta{char} -% is made active within the current \TeX{} group level, and the definition -% is also local. +% Sets the behaviour of the \meta{char} in situations where it is +% active (category code $13$) to be equivalent to that of the +% \meta{function}. The category code of the \meta{char} is +% \emph{unchanged} by this process. The \meta{function} may itself +% be an active character. % \end{function} % -% \begin{function}{\char_gset_active_eq:NN} +% \begin{function}[added = 2015-09-02] +% {\char_set_active_eq:nN, \char_gset_active_eq:nN} % \begin{syntax} -% \cs{char_gset_active_eq:NN} \meta{char} \meta{function} +% \cs{char_set_active_eq:nN} \Arg{integer expression} \meta{function} % \end{syntax} -% Makes \meta{char} an active character equivalent in meaning to the -% \meta{function} (which may itself be an active character). The \meta{char} -% is made active within the current \TeX{} group level, but the definition -% is global. This function is therefore suited to cases where an active -% character definition should be applied only in some context (where the -% \meta{char} is again made active). +% Sets the behaviour of the \meta{char} which has character +% code as given by the \meta{integer expression} in situations +% where it is active (category code $13$) to be equivalent to that of the +% \meta{function}. The category code of the \meta{char} is +% \emph{unchanged} by this process. The \meta{function} may itself +% be an active character. % \end{function} % % \begin{function}[TF, updated = 2012-12-20]{\peek_N_type:} @@ -1120,43 +1096,24 @@ % \end{macrocode} % % \begin{macro}{\cs_log:N, \cs_log:c} -% The same as \cs{cs_show:N} and \cs{cs_show:c}, but using -% \cs{__msg_log_wrap:n} instead of \cs{__msg_show_variable:n}. -% \begin{macrocode} -\group_begin: - \tex_lccode:D `? = `: \scan_stop: - \tex_catcode:D `? = 12 \scan_stop: -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \cs_log:N #1 - { - \__msg_log_wrap:n - { - > ~ \token_to_str:N #1 = - \exp_after:wN \@@_show:www \cs_meaning:N #1 - \use_none:nn ? \prg_do_nothing: - } - } - } +% Use \cs{cs_show:N} or \cs{cs_show:c} after calling +% \cs{__msg_log_next:} to redirect their output to the log file only. +% Note that \cs{cs_log:c} is not just a variant of \cs{cs_log:N} as +% the csname should be turned to a control sequence within a group +% (see \cs{cs_show:c}). +% \begin{macrocode} +\cs_new_protected_nopar:Npn \cs_log:N + { \__msg_log_next: \cs_show:N } \cs_new_protected_nopar:Npn \cs_log:c - { \group_begin: \exp_args:NNc \group_end: \cs_log:N } + { \__msg_log_next: \cs_show:c } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\__kernel_register_log:N, \__kernel_register_log:c} -% Check that the variable exists, then write its name and value to the -% log file. +% Redirect the output of \cs{__kernel_register_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \__kernel_register_log:N #1 - { - \cs_if_exist:NTF #1 - { \__msg_log_value:x { \token_to_str:N #1 = \tex_the:D #1 } } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } - } +\cs_new_protected_nopar:Npn \__kernel_register_log:N + { \__msg_log_next: \__kernel_register_show:N } \cs_generate_variant:Nn \__kernel_register_log:N { c } % \end{macrocode} % \end{macro} @@ -1813,18 +1770,12 @@ % \end{macrocode} % % \begin{macro}{\clist_log:N, \clist_log:c, \clist_log:n} -% Same as \cs{clist_show:N} but using \cs{__msg_log_variable:Nnn}. +% Redirect output of \cs{clist_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \clist_log:N #1 - { - \__msg_log_variable:Nnn #1 { clist } - { \clist_map_function:NN #1 \__msg_show_item:n } - } -\cs_new_protected:Npn \clist_log:n #1 - { - \clist_set:Nn \l_@@_internal_clist {#1} - \clist_log:N \l_@@_internal_clist - } +\cs_new_protected_nopar:Npn \clist_log:N + { \__msg_log_next: \clist_show:N } +\cs_new_protected_nopar:Npn \clist_log:n + { \__msg_log_next: \clist_show:n } \cs_generate_variant:Nn \clist_log:N { c } % \end{macrocode} % \end{macro} @@ -2292,21 +2243,10 @@ % \subsection{Coffin diagnostics} % % \begin{macro}{\coffin_log_structure:N, \coffin_log_structure:c} -% Same as \cs{coffin_show_structure:N}, but using -% \cs{__msg_log_variable:Nnn}. +% Redirect output of \cs{coffin_show_structure:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \coffin_log_structure:N #1 - { - \@@_if_exist:NT #1 - { - \__msg_log_variable:Nnn #1 { coffins } - { - \prop_map_function:cN - { l_@@_poles_ \__int_value:w #1 _prop } - \__msg_show_item_unbraced:nn - } - } - } +\cs_new_protected_nopar:Npn \coffin_log_structure:N + { \__msg_log_next: \coffin_show_structure:N } \cs_generate_variant:Nn \coffin_log_structure:N { c } % \end{macrocode} % \end{macro} @@ -2411,68 +2351,38 @@ % \end{macro} % % \begin{macro}{\ior_log_streams:} -% \begin{macro}[aux]{\@@_log_streams:Nn} -% Same as \cs{ior_list_streams:}, but with \cs{__msg_log:nnn} and -% \cs{__msg_log_wrap:n}. +% Redirect output of \cs{ior_list_streams:} to the log. % \begin{macrocode} \cs_new_protected_nopar:Npn \ior_log_streams: - { \@@_log_streams:Nn \g_@@_streams_prop { input } } -\cs_new_protected:Npn \@@_log_streams:Nn #1#2 - { - \__msg_log:nnn { LaTeX / kernel } - { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } - {#2} - \__msg_log_wrap:n - { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } - } + { \__msg_log_next: \ior_list_streams: } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macrocode} %<@@=iow> % \end{macrocode} % % \begin{macro}{\iow_log_streams:} -% \begin{macro}[aux]{\@@_log_streams:Nn} -% Same as \cs{iow_list_streams:}, but with \cs{__msg_log:nnn} and -% \cs{__msg_log_wrap:n}. +% Redirect output of \cs{iow_list_streams:} to the log. % \begin{macrocode} \cs_new_protected_nopar:Npn \iow_log_streams: - { \@@_log_streams:Nn \g_@@_streams_prop { output } } -\cs_new_protected:Npn \@@_log_streams:Nn #1#2 - { - \__msg_log:nnn { LaTeX / kernel } - { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } - {#2} - \__msg_log_wrap:n - { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } - } + { \__msg_log_next: \iow_list_streams: } % \end{macrocode} % \end{macro} -% \end{macro} % -% \subsection{Additions to \pkg{l3fp}} +% \subsection{Additions to \pkg{l3fp-assign}} % % \begin{macrocode} %<@@=fp> % \end{macrocode} % % \begin{macro}{\fp_log:N, \fp_log:c, \fp_log:n} -% Same as \cs{fp_show:N} but using \cs{__msg_log_value:x} since we -% know that the result is short. +% Redirect output of \cs{fp_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \fp_log:N #1 - { - \fp_if_exist:NTF #1 - { \__msg_log_value:x { \token_to_str:N #1 = \fp_to_tl:N #1 } } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } - } -\cs_new_protected:Npn \fp_log:n #1 - { \__msg_log_value:x { \fp_to_tl:n {#1} } } +\cs_new_protected_nopar:Npn \fp_log:N + { \__msg_log_next: \fp_show:N } +\cs_new_protected_nopar:Npn \fp_log:n + { \__msg_log_next: \fp_show:n } \cs_generate_variant:Nn \fp_log:N { c } % \end{macrocode} % \end{macro} @@ -2480,18 +2390,22 @@ % \subsection{Additions to \pkg{l3int}} % % \begin{macro}{\int_log:N, \int_log:c} -% Simple copies. +% Redirect output of \cs{int_show:N} to the log. This is not just a +% copy of \cs{__kernel_register_log:N} because of subtleties +% involving \tn{currentgrouplevel} and \tn{currentgrouptype}. See +% \cs{int_show:N} for details. % \begin{macrocode} -\cs_new_eq:NN \int_log:N \__kernel_register_log:N -\cs_new_eq:NN \int_log:c \__kernel_register_log:c +\cs_new_protected_nopar:Npn \int_log:N + { \__msg_log_next: \int_show:N } +\cs_generate_variant:Nn \int_log:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\int_log:n} -% Use \cs{__msg_log_value:x}. +% Redirect output of \cs{int_show:n} to the log. % \begin{macrocode} -\cs_new_protected:Npn \int_log:n #1 - { \__msg_log_value:x { \int_eval:n {#1} } } +\cs_new_protected_nopar:Npn \int_log:n + { \__msg_log_next: \int_show:n } % \end{macrocode} % \end{macro} % @@ -2502,11 +2416,10 @@ % \end{macrocode} % % \begin{macro}{\keys_log:nn} -% See \cs{keys_show:nn} but using \cs{cs_log:c} instead of -% \cs{show:c}. +% Redirect output of \cs{keys_show:nn} to the log. % \begin{macrocode} -\cs_new_protected:Npn \keys_log:nn #1#2 - { \cs_log:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } } +\cs_new_protected_nopar:Npn \keys_log:nn + { \__msg_log_next: \keys_show:nn } % \end{macrocode} % \end{macro} % @@ -2516,60 +2429,52 @@ %<@@=msg> % \end{macrocode} % -% \begin{macro}[int]{\@@_log:nnn} -% Print the text of a message to the terminal without formatting: -% short cuts around \cs{iow_wrap:nnnN}. -% \begin{macrocode} -\cs_new_protected:Npn \@@_log:nnn #1#2#3 - { - \iow_wrap:nnnN - { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} { } { } { } } - { } { } \iow_log:n - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_log_variable:Nnn, \@@_log_wrap:n} -% \begin{macro}[aux]{\@@_log:n} -% This is a direct analogue of \cs{@@_show_variable:Nnn}, but writing -% to the log file instead of the terminal. It is important to pass to -% \cs{iow_wrap:nnnN} the whole text that will be written in the log, -% including the trailing period, as it would otherwise not be -% formatted correctly. Note that we detect the case where nothing -% would be shown, and add |>~| at the start: this is safe unless lines -% are less than $3$~characters long. +% \begin{macro}[EXP] +% { +% \msg_expandable_error:nnnnnn , +% \msg_expandable_error:nnnnn , +% \msg_expandable_error:nnnn , +% \msg_expandable_error:nnn , +% \msg_expandable_error:nn , +% \msg_expandable_error:nnffff , +% \msg_expandable_error:nnfff , +% \msg_expandable_error:nnff , +% \msg_expandable_error:nnf +% } +% \begin{macro}[aux]{\__msg_expandable_error_module:nn} +% Pass to an auxiliary the message to display and the module name % \begin{macrocode} -\cs_new_protected:Npn \@@_log_variable:Nnn #1#2#3 +\cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6 { - \cs_if_exist:NTF #1 - { - \@@_log:nnn { LaTeX / kernel } { show- #2 } {#1} - \@@_log_wrap:n {#3} - } + \exp_args:Nf \@@_expandable_error_module:nn { - \@@_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } + \exp_args:Nf \tl_to_str:n + { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } } + {#1} + } +\cs_new:Npn \msg_expandable_error:nnnnn #1#2#3#4#5 + { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } +\cs_new:Npn \msg_expandable_error:nnnn #1#2#3#4 + { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } } +\cs_new:Npn \msg_expandable_error:nnn #1#2#3 + { \msg_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } } +\cs_new:Npn \msg_expandable_error:nn #1#2 + { \msg_expandable_error:nnnnnn {#1} {#2} { } { } { } { } } +\cs_generate_variant:Nn \msg_expandable_error:nnnnnn { nnffff } +\cs_generate_variant:Nn \msg_expandable_error:nnnnn { nnfff } +\cs_generate_variant:Nn \msg_expandable_error:nnnn { nnff } +\cs_generate_variant:Nn \msg_expandable_error:nnn { nnf } +\cs_new:Npn \@@_expandable_error_module:nn #1#2 + { + \exp_after:wN \exp_after:wN + \exp_after:wN \use_none_delimit_by_q_stop:w + \use:n { \::error ! ~ #2 : ~ #1 } \q_stop } -\cs_new_protected:Npn \@@_log_wrap:n #1 - { \iow_wrap:nnnN { #1 . } { } { } \@@_log:n } -\cs_new_protected:Npn \@@_log:n #1 - { \iow_log:x { \tl_if_single:nT {#1} { > ~ } #1 } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_log_value:n, \@@_log_value:x} -% Write the tokens |#1| to the log file without line wrapping but with -% a formatting similar to what is done by the commands which show -% material to the terminal. -% \begin{macrocode} -\cs_new_protected:Npn \@@_log_value:n #1 - { \iow_log:n { >~ #1 . } } -\cs_generate_variant:Nn \@@_log_value:n { x } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3prg}} % % \begin{macrocode} @@ -2577,29 +2482,15 @@ % \end{macrocode} % % \begin{macro}{\bool_log:N, \bool_log:c, \bool_log:n} -% \begin{macro}[aux]{\@@_to_word:n} -% Writes in the log file the truth value of the boolean, as -% \texttt{true} or \texttt{false}. We use \cs{__msg_log_value:x}. +% Redirect output of \cs{bool_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \bool_log:N #1 - { - \bool_if_exist:NTF #1 - { - \__msg_log_value:x - { \token_to_str:N #1 = \@@_to_word:n {#1} } - } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } - } -\cs_new_protected:Npn \bool_log:n #1 - { \__msg_log_value:x { \@@_to_word:n {#1} } } -\cs_new:Npn \@@_to_word:n #1 { \bool_if:nTF {#1} { true } { false } } +\cs_new_protected_nopar:Npn \bool_log:N + { \__msg_log_next: \bool_show:N } +\cs_new_protected_nopar:Npn \bool_log:n + { \__msg_log_next: \bool_show:n } \cs_generate_variant:Nn \bool_log:N { c } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Additions to \pkg{l3prop}} % @@ -2637,13 +2528,10 @@ % \end{macro} % % \begin{macro}{\prop_log:N, \prop_log:c} -% Same as \cs{prop_show:N} but using \cs{__msg_log_variable:Nnn}. +% Redirect output of \cs{prop_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \prop_log:N #1 - { - \__msg_log_variable:Nnn #1 { prop } - { \prop_map_function:NN #1 \__msg_show_item:nn } - } +\cs_new_protected_nopar:Npn \prop_log:N + { \__msg_log_next: \prop_show:N } \cs_generate_variant:Nn \prop_log:N { c } % \end{macrocode} % \end{macro} @@ -2726,7 +2614,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\seq_set_map:NNn,\seq_gset_map:NNn} +% \begin{macro}{\seq_set_map:NNn, \seq_gset_map:NNn} % \begin{macro}[aux]{\@@_set_map:NNNn} % Very similar to \cs{seq_set_filter:NNn}. We could actually % merge the two within a single function, but it would have weird @@ -2747,13 +2635,10 @@ % \end{macro} % % \begin{macro}{\seq_log:N, \seq_log:c} -% Same as \cs{seq_show:N} but using \cs{__msg_show_variable:Nnn}. +% Redirect output of \cs{seq_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \seq_log:N #1 - { - \__msg_log_variable:Nnn #1 { seq } - { \seq_map_function:NN #1 \__msg_show_item:n } - } +\cs_new_protected_nopar:Npn \seq_log:N + { \__msg_log_next: \seq_show:N } \cs_generate_variant:Nn \seq_log:N { c } % \end{macrocode} % \end{macro} @@ -2789,32 +2674,32 @@ % \end{macro} % % \begin{macro}{\dim_log:N, \dim_log:c, \dim_log:n} -% Diagnostics. +% Diagnostics. Redirect output of \cs{dim_show:n} to the log. % \begin{macrocode} \cs_new_eq:NN \dim_log:N \__kernel_register_log:N \cs_new_eq:NN \dim_log:c \__kernel_register_log:c -\cs_new_protected:Npn \dim_log:n #1 - { \__msg_log_value:x { \dim_eval:n {#1} } } +\cs_new_protected_nopar:Npn \dim_log:n + { \__msg_log_next: \dim_show:n } % \end{macrocode} % \end{macro} % % \begin{macro}{\skip_log:N, \skip_log:c, \skip_log:n} -% Diagnostics. +% Diagnostics. Redirect output of \cs{skip_show:n} to the log. % \begin{macrocode} \cs_new_eq:NN \skip_log:N \__kernel_register_log:N \cs_new_eq:NN \skip_log:c \__kernel_register_log:c -\cs_new_protected:Npn \skip_log:n #1 - { \__msg_log_value:x { \skip_eval:n {#1} } } +\cs_new_protected_nopar:Npn \skip_log:n + { \__msg_log_next: \skip_show:n } % \end{macrocode} % \end{macro} % % \begin{macro}{\muskip_log:N, \muskip_log:c, \muskip_log:n} -% Diagnostics. +% Diagnostics. Redirect output of \cs{muskip_show:n} to the log. % \begin{macrocode} \cs_new_eq:NN \muskip_log:N \__kernel_register_log:N \cs_new_eq:NN \muskip_log:c \__kernel_register_log:c -\cs_new_protected:Npn \muskip_log:n #1 - { \__msg_log_value:x { \muskip_eval:n {#1} } } +\cs_new_protected_nopar:Npn \muskip_log:n + { \__msg_log_next: \muskip_show:n } % \end{macrocode} % \end{macro} % @@ -2840,7 +2725,7 @@ { \tl_if_empty:nTF {#1} { \prg_return_false: } - { \@@_if_empty_return:o { \tex_romannumeral:D -`0 #1 } } + { \@@_if_empty_return:o { \exp:w \exp_end_continue_f:w #1 } } } } % \end{macrocode} @@ -2854,7 +2739,7 @@ { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_act:NNNnn \@@_reverse_normal:nN \@@_reverse_group:nn @@ -2888,11 +2773,12 @@ % % \begin{macro}[EXP]{\tl_count_tokens:n} % \begin{macro}[EXP,aux]{\@@_act_count_normal:nN, -% \@@_act_count_group:nn,\@@_act_count_space:n} +% \@@_act_count_group:nn, \@@_act_count_space:n} % The token count is computed through an \cs{int_eval:n} construction. % Each \texttt{1+} is output to the \emph{left}, into the integer -% expression, and the sum is ended by the \cs{c_zero} inserted by -% \cs{@@_act_end:wn}. Somewhat a hack. +% expression, and the sum is ended by the \cs{exp_end:} inserted by +% \cs{@@_act_end:wn} (which is technically implemented as \cs{c_zero}). +% Somewhat a hack! % \begin{macrocode} \cs_new:Npn \tl_count_tokens:n #1 { @@ -2932,9 +2818,9 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}[EXP]{\tl_expandable_uppercase:n,\tl_expandable_lowercase:n} +% \begin{macro}[EXP]{\tl_expandable_uppercase:n, \tl_expandable_lowercase:n} % \begin{macro}[EXP,aux]{\@@_act_case_normal:nN, -% \@@_act_case_group:nn,\@@_act_case_space:n} +% \@@_act_case_group:nn, \@@_act_case_space:n} % The only difference between uppercasing and lowercasing is % the table of correspondence that is used. As for other % token list actions, we feed \cs{@@_act:NNNnn} three @@ -2945,14 +2831,14 @@ % tests, and converted if necessary to upper/lowercase, % before being output. For a group, we must perform the % conversion within the group (the \cs{exp_after:wN} trigger -% \tn{romannumeral}, which expands fully to give the +% \cs{exp:w}, which expands fully to give the % converted group), then output. % \begin{macrocode} \cs_new:Npn \tl_expandable_uppercase:n #1 { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_act_case_aux:nn { \c_@@_act_uppercase_tl } {#1} } } @@ -2960,7 +2846,7 @@ { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_act_case_aux:nn { \c_@@_act_lowercase_tl } {#1} } } @@ -2985,7 +2871,7 @@ \exp_after:wN \@@_act_output:n \exp_after:wN { \exp_after:wN - { \tex_romannumeral:D \@@_act_case_aux:nn {#1} {#2} } + { \exp:w \@@_act_case_aux:nn {#1} {#2} } } } % \end{macrocode} @@ -3150,7 +3036,7 @@ { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_change_case_aux:nnn {#1} {#2} {#3} } } @@ -3179,7 +3065,7 @@ % up for \texttt{f}-type expandability has two requirements: a marker % token after the main loop (see above) and a mechanism to \enquote{load} % and finalise the result. That is handled in the code below, which includes -% the necessary material to end the \tn{romannumeral} expansion. +% the necessary material to end the \cs{exp:w} expansion. % \begin{macrocode} \cs_new:Npn \@@_change_case_output:nwn #1#2 \@@_change_case_result:n #3 { #2 \@@_change_case_result:n { #3 #1 } } @@ -3187,7 +3073,7 @@ \cs_new:Npn \@@_change_case_end:wn #1 \@@_change_case_result:n #2 { \group_align_safe_end: - \c_zero + \exp_end: #2 } % \end{macrocode} @@ -3206,7 +3092,7 @@ { \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_change_case_aux:nnn {#3} {#4} {#1} } } @@ -3872,7 +3758,7 @@ { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_mixed_case_aux:nn {#1} {#2} } } @@ -3900,7 +3786,7 @@ { \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_mixed_case_aux:nn {#3} {#1} } } @@ -4404,27 +4290,19 @@ % \end{variable} % % \begin{macro}{\tl_log:N, \tl_log:c} -% Showing token list variables in the log file is done after checking -% that the variable is defined. +% Redirect output of \cs{tl_show:N} to the log. % \begin{macrocode} -\cs_new_protected:Npn \tl_log:N #1 - { - \tl_if_exist:NTF #1 - { \cs_log:N #1 } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } - } +\cs_new_protected_nopar:Npn \tl_log:N + { \__msg_log_next: \tl_show:N } \cs_generate_variant:Nn \tl_log:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\tl_log:n} -% The same as \cs{tl_show:n} but using \cs{__msg_log_wrap:n}. +% Redirect output of \cs{tl_show:n} to the log. % \begin{macrocode} -\cs_new_protected:Npn \tl_log:n #1 - { \__msg_log_wrap:n { > ~ \tl_to_str:n {#1} } } +\cs_new_protected_nopar:Npn \tl_log:n + { \__msg_log_next: \tl_show:n } % \end{macrocode} % \end{macro} % @@ -4434,33 +4312,33 @@ %<@@=char> % \end{macrocode} % -% \begin{macro}{\char_set_active:Npn,\char_set_active:Npx} -% \begin{macro}{\char_gset_active:Npn,\char_gset_active:Npx} -% \begin{macro}{\char_set_active_eq:NN,\char_gset_active_eq:NN} +% \begin{macro} +% {^^A +% \char_set_active_eq:NN, \char_gset_active_eq:NN, +% \char_set_active_eq:nN, \char_gset_active_eq:nN +% } +% Four simple functions with very similar definitions, so set up using +% an auxiliary. % \begin{macrocode} \group_begin: \char_set_catcode_active:N \^^@ - \cs_set:Npn \char_tmp:NN #1#2 + \cs_set_protected:Npn \@@_tmp:nN #1#2 { - \cs_new:Npn #1 ##1 + \cs_new_protected:cpn { #1 :nN } ##1 { - \char_set_catcode_active:n { `##1 } \group_begin: - \char_set_lccode:nn { `\^^@ } { `##1 } - \tl_to_lowercase:n { \group_end: #2 ^^@ } + \char_set_catcode_active:n { ##1 } + \char_set_lccode:nn { `\^^@ } { ##1 } + \tex_lowercase:D { \group_end: #2 ^^@ } } + \cs_new_protected:cpx { #1 :NN } ##1 + { \exp_not:c { #1 : nN } { `##1 } } } - \char_tmp:NN \char_set_active:Npn \cs_set:Npn - \char_tmp:NN \char_set_active:Npx \cs_set:Npx - \char_tmp:NN \char_gset_active:Npn \cs_gset:Npn - \char_tmp:NN \char_gset_active:Npx \cs_gset:Npx - \char_tmp:NN \char_set_active_eq:NN \cs_set_eq:NN - \char_tmp:NN \char_gset_active_eq:NN \cs_gset_eq:NN + \@@_tmp:nN { char_set_active_eq } \cs_set_eq:NN + \@@_tmp:nN { char_gset_active_eq } \cs_gset_eq:NN \group_end: % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macrocode} %<@@=peek> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index edd55416b41..51ff7dc3082 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -2,7 +2,7 @@ % %% File: l3clist.dtx Copyright (C) 2004-2011 Frank Mittelbach, %% The LaTeX3 project -%% (C) 2012-2014 The LaTeX3 Project +%% (C) 2012-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -39,7 +39,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3clist.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3clist.dtx 5901 2015-09-02 05:59:23Z joseph $ {L3 Comma separated lists} %</driver|package> %<*driver> @@ -80,7 +80,7 @@ % \clist_put_left:Nn \l_my_clist { ~ a ~ , ~ {b} ~ } % \clist_put_right:Nn \l_my_clist { ~ { c ~ } , d } % \end{verbatim} -% results in \cs{l_my_clist} containing |a,{b},{c~},d|. +% results in |\l_my_clist| containing |a,{b},{c~},d|. % Comma lists cannot contain empty items, thus % \begin{verbatim} % \clist_clear_new:N \l_my_clist @@ -425,7 +425,7 @@ % \begin{syntax} % \cs{clist_map_break:} % \end{syntax} -% Used to terminate a \cs{clist_map_\ldots} function before all +% Used to terminate a |\clist_map_...| function before all % entries in the \meta{comma list} have been processed. This will % normally take place within a conditional statement, for example % \begin{verbatim} @@ -438,7 +438,7 @@ % } % } % \end{verbatim} -% Use outside of a \cs{clist_map_\ldots} scenario will lead to low +% Use outside of a |\clist_map_...| scenario will lead to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the @@ -452,7 +452,7 @@ % \begin{syntax} % \cs{clist_map_break:n} \Arg{tokens} % \end{syntax} -% Used to terminate a \cs{clist_map_\ldots} function before all +% Used to terminate a |\clist_map_...| function before all % entries in the \meta{comma list} have been processed, inserting % the \meta{tokens} after the mapping has ended. This will % normally take place within a conditional statement, for example @@ -466,7 +466,7 @@ % } % } % \end{verbatim} -% Use outside of a \cs{clist_map_\ldots} scenario will lead to low +% Use outside of a |\clist_map_...| scenario will lead to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the @@ -601,7 +601,7 @@ % % \begin{function}[TF, added = 2012-05-14]{\clist_pop:NN, \clist_pop:cN} % \begin{syntax} -% \cs{clist_pop:NNTF} \meta{sequence} \meta{token list variable} \Arg{true code} \Arg{false code} +% \cs{clist_pop:NNTF} \meta{comma list} \meta{token list variable} \Arg{true code} \Arg{false code} % \end{syntax} % If the \meta{comma list} is empty, leaves the \meta{false code} in the % input stream. The value of the \meta{token list variable} is @@ -664,14 +664,14 @@ % % \section{Viewing comma lists} % -% \begin{function}[updated = 2012-09-09]{\clist_show:N, \clist_show:c} +% \begin{function}[updated = 2015-08-03]{\clist_show:N, \clist_show:c} % \begin{syntax} % \cs{clist_show:N} \meta{comma list} % \end{syntax} % Displays the entries in the \meta{comma list} in the terminal. % \end{function} % -% \begin{function}[updated = 2012-09-09]{\clist_show:n} +% \begin{function}[updated = 2013-08-03]{\clist_show:n} % \begin{syntax} % \cs{clist_show:n} \Arg{tokens} % \end{syntax} @@ -738,7 +738,7 @@ % % \subsection{Allocation and initialisation} % -% \begin{macro}{\clist_new:N,\clist_new:c} +% \begin{macro}{\clist_new:N, \clist_new:c} % \UnitTested % Internally, comma lists are just token lists. % \begin{macrocode} @@ -1813,20 +1813,24 @@ % % \begin{macro}{\clist_show:N, \clist_show:c} % \begin{macro}{\clist_show:n} -% Apply the general \cs{__msg_show_variable:Nnn}. In the case -% of an \texttt{n}-type comma-list, first store it -% in a scratch variable, then show that variable: -% The message takes care of omitting its name. +% Apply the general \cs{__msg_show_variable:NNNnn}. In the case +% of an \texttt{n}-type comma-list, we must do things by hand, +% using the same message \texttt{show-clist} as for an +% \texttt{N}-type comma-list but with an empty name (first +% argument). % \begin{macrocode} \cs_new_protected:Npn \clist_show:N #1 { - \__msg_show_variable:Nnn #1 { clist } + \__msg_show_variable:NNNnn #1 + \clist_if_exist:NTF \clist_if_empty:NTF { clist } { \clist_map_function:NN #1 \__msg_show_item:n } } \cs_new_protected:Npn \clist_show:n #1 { - \clist_set:Nn \l_@@_internal_clist {#1} - \clist_show:N \l_@@_internal_clist + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-clist } + { } { \clist_if_empty:nF {#1} { ? } } { } { } + \__msg_show_wrap:n + { \clist_map_function:nN {#1} \__msg_show_item:n } } \cs_generate_variant:Nn \clist_show:N { c } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index ac62507f29b..17cdb15379e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3coffins.dtx Copyright(C) 2010-2014 The LaTeX3 Project +%% File: l3coffins.dtx Copyright(C) 2010-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3coffins.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3coffins.dtx 5789 2015-08-06 02:32:11Z bruno $ {L3 Coffin code layer} %</driver|package> %<*driver> @@ -305,7 +305,7 @@ % both printed in the \meta{color} specified. % \end{function} % -% \begin{function}[updated = 2012-09-09] +% \begin{function}[updated = 2015-08-01] % {\coffin_show_structure:N, \coffin_show_structure:c} % \begin{syntax} % \cs{coffin_show_structure:N} \meta{coffin} @@ -524,12 +524,14 @@ \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 + \__chk_suspend_log: \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } \c_@@_corners_prop \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } \c_@@_poles_prop + \__chk_resume_log: } \cs_generate_variant:Nn \coffin_new:N { c } % \end{macrocode} @@ -767,7 +769,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_set_eq_structure:NN,\@@_gset_eq_structure:NN} +% \begin{macro}{\@@_set_eq_structure:NN, \@@_gset_eq_structure:NN} % Setting coffin structures equal simply means copying the property % list. % \begin{macrocode} @@ -790,7 +792,7 @@ % % \begin{macro} % {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn} -% \begin{macro}{\coffin_set_vertical_pole:Nnn,\coffin_set_vertical_pole:cnn} +% \begin{macro}{\coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn} % \begin{macro}{\@@_set_pole:Nnn, \@@_set_pole:Nnx} % Setting the pole of a coffin at the user/designer level requires a % bit more care. The idea here is to provide a reasonable interface to @@ -1674,7 +1676,12 @@ { \@@_if_exist:NT #1 { - \__msg_show_variable:Nnn #1 { coffins } + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-coffin } + { \token_to_str:N #1 } + { \dim_eval:n { \coffin_ht:N #1 } } + { \dim_eval:n { \coffin_dp:N #1 } } + { \dim_eval:n { \coffin_wd:N #1 } } + \__msg_show_wrap:n { \prop_map_function:cN { l_@@_poles_ \__int_value:w #1 _prop } @@ -1707,13 +1714,13 @@ LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~ but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong. } -\__msg_kernel_new:nnn { kernel } { show-coffins } +\__msg_kernel_new:nnn { kernel } { show-coffin } { - Size~of~coffin~\token_to_str:N #1 : \\ - > ~ ht~=~\dim_use:N \box_ht:N #1 \\ - > ~ dp~=~\dim_use:N \box_dp:N #1 \\ - > ~ wd~=~\dim_use:N \box_wd:N #1 \\ - Poles~of~coffin~\token_to_str:N #1 : + Size~of~coffin~#1 : \\ + > ~ ht~=~#2 \\ + > ~ dp~=~#3 \\ + > ~ wd~=~#4 \\ + Poles~of~coffin~#1 : } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index b781ba9d199..8c02dcb39fc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3doc.dtx Copyright (C) 1990-2014 The LaTeX3 project +%% File: l3doc.dtx Copyright (C) 1990-2015 The LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -75,7 +75,7 @@ Do not distribute a modified version of this file. % %<*driver|class> \RequirePackage{expl3,xparse,calc} -\GetIdInfo$Id: l3doc.dtx 5353 2014-08-23 01:23:51Z bruno $ +\GetIdInfo$Id: l3doc.dtx 5903 2015-09-02 06:03:07Z joseph $ {L3 Experimental documentation class} %</driver|class> % @@ -282,7 +282,7 @@ Do not distribute a modified version of this file. % \end{syntax} % These commands are provided to typeset control sequences. % |\cmd\foo| produces \enquote{\cmd\foo} and |\cs{foo}| produces the -% same (\enquote{\cs{foo}}). In general, \cs{cs} is more robust since +% same (\enquote{\texttt{\string\foo|}}). In general, \cs{cs} is more robust since % it doesn't rely on catcodes being \enquote{correct} and is therefore % recommended. % @@ -1102,7 +1102,6 @@ Do not distribute a modified version of this file. booktabs, color, colortbl, - fixltx2e, hologo, enumitem, pifont, @@ -1671,19 +1670,23 @@ Do not distribute a modified version of this file. % Allow |<...>| to be used as markup for |\meta{...}|. Clear various % variables. % \begin{macrocode} -\cs_new_protected:Npn \@@_function_init: - { - \coffin_clear:N \l_@@_descr_coffin - \box_gclear:N \g_@@_syntax_box - \coffin_clear:N \l_@@_syntax_coffin - \coffin_clear:N \l_@@_names_coffin - \bool_set_false:N \l_@@_macro_TF_bool - \bool_set_false:N \l_@@_macro_pTF_bool - \bool_set_false:N \l_@@_macro_EXP_bool - \bool_set_false:N \l_@@_macro_rEXP_bool - \bool_set_false:N \l_@@_no_label_bool - \char_set_active:Npn < ##1 > { \meta {##1} } +\group_begin: + \char_set_catcode_active:N \< + \cs_new_protected:Npn \@@_function_init: + { + \coffin_clear:N \l_@@_descr_coffin + \box_gclear:N \g_@@_syntax_box + \coffin_clear:N \l_@@_syntax_coffin + \coffin_clear:N \l_@@_names_coffin + \bool_set_false:N \l_@@_macro_TF_bool + \bool_set_false:N \l_@@_macro_pTF_bool + \bool_set_false:N \l_@@_macro_EXP_bool + \bool_set_false:N \l_@@_macro_rEXP_bool + \bool_set_false:N \l_@@_no_label_bool + \char_set_catcode_active:N \< + \cs_set_protected_nopar:Npn < ##1 > { \meta {##1} } } +\group_end: % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 7d708c411ac..65105c61736 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3expan.dtx Copyright (C) 1990-2014 The LaTeX3 project +%% File: l3expan.dtx Copyright (C) 1990-2015 The LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3expan.dtx 5472 2014-11-27 09:10:40Z joseph $ +\GetIdInfo$Id: l3expan.dtx 5897 2015-08-28 09:06:29Z joseph $ {L3 Argument expansion} %</driver|package> %<*driver> @@ -119,7 +119,7 @@ % \section{Methods for defining variants} % \label{sec:l3expan:variants-method} % -% \begin{function}[updated = 2013-07-09]{\cs_generate_variant:Nn} +% \begin{function}[updated = 2015-08-06]{\cs_generate_variant:Nn} % \begin{syntax} % \cs{cs_generate_variant:Nn} \meta{parent control sequence} \Arg{variant argument specifiers} % \end{syntax} @@ -137,13 +137,13 @@ % \cs_set:Npn \foo:Nn #1#2 { code here } % \cs_generate_variant:Nn \foo:Nn { c } % \end{verbatim} -% will create a new function \cs{foo:cn} which will expand its first +% will create a new function |\foo:cn| which will expand its first % argument into a control sequence name and pass the result to -% \cs{foo:Nn}. Similarly +% |\foo:Nn|. Similarly % \begin{verbatim} % \cs_generate_variant:Nn \foo:Nn { NV , cV } % \end{verbatim} -% would generate the functions \cs{foo:NV} and \cs{foo:cV} in the +% would generate the functions |\foo:NV| and |\foo:cV| in the % same way. The \cs{cs_generate_variant:Nn} function can only be % applied if the \meta{parent control sequence} is already defined. If % the \meta{parent control sequence} is protected then the new sequence @@ -172,7 +172,8 @@ % expansion. % \item % In general, unless in the last position, multi-token arguments -% |n|, |f|, and |o| will need special processing which is not fast. +% |n|, |f|, and |o| will need special processing when more than +% one argument is being expanded. This special processing is not fast. % Therefore it is best to use the optimized functions, namely % those that contain only |N|, |c|, |V|, and |v|, and, in the last % position, |o|, |f|, with possible trailing |N| or |n|, which are @@ -196,33 +197,37 @@ % specific expansion steps are needed, such as when using delimited % arguments, should the lower-level functions with |o| specifiers be employed. % -% The |f| type is so special that it deserves an example. Let's pretend -% we want to set the control sequence whose name is given by -% |b \l_tmpa_tl b| equal to the list of tokens |\aaa a|. Furthermore we -% want to store the execution of it in a -% \meta{tl~var}. In this example we assume |\l_tmpa_tl| contains -% the text string |lur|. The straightforward approach is +% The |f| type is so special that it deserves an example. It is +% typically used in contexts where only expandable commands are allowed. +% Then |x|-expansion cannot be used, and |f|-expansion provides an +% alternative that expands as much as can be done in such contexts. For +% instance, say that we want to evaluate the integer expression $3 + 4$ +% and pass the result $7$ as an argument to an expandable function +% |\example:n|. For this, one should define a variant using +% \cs{cs_generate_variant:Nn} |\example:n| |{| |f| |}|, then do % \begin{quote} -% |\tl_set:No \l_tmpb_tl { \tl_set:cn { b \l_tmpa_tl b } { \aaa a } }| +% |\example:f { \int_eval:n { 3 + 4 } }| % \end{quote} -% Unfortunately this only puts -% |\exp_args:Nc \tl_set:Nn {b \l_tmpa_tl b} { \aaa a }| into -% |\l_tmpb_tl| and not |\tl_set:Nn \blurb { \aaa a }| as we probably -% wanted. Using \cs{tl_set:Nx} is not an option as that will die -% horribly. Instead we can do a +% Note that |x|-expansion would also expand \cs{int_eval:n} fully to its +% result~$7$, but the variant |\example:x| cannot be expandable. Note +% also that |o|-expansion would not expand \cs{int_eval:n} fully to its +% result since that function requires several expansions. Besides the +% fact that |x|-expansion is protected rather than expandable, another +% difference between |f|-expansion and |x|-expansion is that +% |f|-expansion expands tokens from the beginning and stops as soon as a +% non-expandable token is encountered, while |x|-expansion continues +% expanding further tokens. Thus, for instance % \begin{quote} -% |\tl_set:Nf \l_tmpb_tl { \tl_set:cn { b \l_tmpa_tl b } { \aaa a } }| -% \end{quote} -% which puts the desired result in |\l_tmpb_tl|. It requires -% \cs{tl_set:Nf} to be defined as -% \begin{quote} -% |\cs_set_nopar:Npn \tl_set:Nf { \exp_args:NNf \tl_set:Nn }| +% |\example:f { \int_eval:n { 1 + 2 } , \int_eval:n { 3 + 4 } }| % \end{quote} +% will result in the call |\example:n { 3 , \int_eval:n { 3 + 4 } }| +% while using |\example:x| instead results in |\example:n { 3 , 7 }| +% at the cost of being protected. % If you use this type of expansion in conditional processing then % you should stick to using |TF| type functions only as it does not % try to finish any |\if... \fi:| itself! % -% If is important to not that both \texttt{f}- and \texttt{o}-type +% If is important to note that both \texttt{f}- and \texttt{o}-type % expansion are concerned with the expansion of tokens from left to % right in their arguments. In particular, \texttt{o}-type expansion % applies to the first \emph{token} in the argument it receives: it @@ -417,7 +422,7 @@ % \exp_args:Nooo, % } % \begin{syntax} -% \cs{exp_args:NNNo} \meta{token_1} \meta{token_2} \meta{token_3} \Arg{tokens} +% \cs{exp_args:NNoo} \meta{token_1} \meta{token_2} \Arg{token_3} \Arg{tokens} % \end{syntax} % These functions absorb four arguments and expand the second, third % and fourth as detailed by their argument specifier. The first @@ -426,8 +431,9 @@ % These functions need special (slower) processing. % \end{function} % -% \begin{function} +% \begin{function}[added = 2015-08-12] % { +% \exp_args:NNNx, % \exp_args:NNnx, % \exp_args:NNox, % \exp_args:Nnnx, @@ -477,7 +483,7 @@ % As an optimization, the last argument is unbraced by some % of those functions before expansion. This can cause problems % if the argument is empty: for instance, -% \cs{exp_last_unbraced:Nf} \cs{mypkg_foo:w} |{ }| \cs{q_stop} +% \cs{exp_last_unbraced:Nf} |\foo_bar:w| |{ }| \cs{q_stop} % leads to an infinite loop, as the quark is \texttt{f}-expanded. % \end{texnote} % \end{function} @@ -522,6 +528,7 @@ % \end{texnote} % \end{function} % +% % \section{Preventing expansion} % % Despite the fact that the following functions are all about preventing @@ -602,10 +609,10 @@ % % \begin{function}[updated = 2011-06-03, EXP]{\exp_stop_f:} % \begin{syntax} -% \cs{function:f} \meta{tokens} \cs{exp_stop_f:} \meta{more tokens} +% |\foo_bar:f| \{ \meta{tokens} \cs{exp_stop_f:} \meta{more tokens} \} % \end{syntax} % This function terminates an \texttt{f}-type expansion. Thus if -% a function |\function:f| starts an \texttt{f}-type expansion +% a function |\foo_bar:f| starts an \texttt{f}-type expansion % and all of \meta{tokens} are expandable \cs{exp_stop_f:} will % terminate the expansion of tokens even if \meta{more tokens} % are also expandable. The function itself is an implicit space @@ -613,6 +620,131 @@ % form, but when typeset it produces the underlying space (\verb*| |). % \end{function} % +% +% \section{Controlled expansion} +% +% The \pkg{expl3} language makes all efforts to hide the complexity of +% \TeX{} expansion from the programmer by providing concepts that +% evaluate/expand arguments of functions prior to calling the ``base'' +% functions. Thus, instead of using many \tn{expandafter} calls and +% other trickery it is usually a matter of choosing the right variant +% of a function to achieve a desired result. +% +% Of course, deep down \TeX{} is using expansion as always and there +% are cases where a programmer needs to control that expansion +% directly; typical situations are basic data manipulation tools. This +% section documents the functions for that level. You will find these +% commands used throughout the kernel code, but we hope that outside +% the kernel there will be little need to resort to them. Instead the +% argument manipulation methods document above should usually be sufficient. +% +% While \cs{exp_after:wN} expands one token (out of order) it is +% sometimes necessary to expand several tokens in one go. The next set +% of commands provide this functionality. Be aware that it is +% absolutely required that the programmer has full control over the +% tokens to be expanded, i.e., it is not possible to use these +% functions to expand unknown input as part of +% \meta{expandable-tokens} as that will break badly if unexpandable +% tokens are encountered in that place! +% +% \begin{function}[added=2015-08-23,EXP] +% { +% \exp:w , +% \exp_end: +% } +% \begin{syntax} +% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end:} \\ +% \end{syntax} +% Expands \meta{expandable-tokens} until reaching \cs{exp_end:} at +% which point expansion stops. +% The full expansion of \meta{expandable-tokens} has to be empty. +% If any token in \meta{expandable-tokens} or any token generated by +% expanding the tokens therein is not expandable the expansion will end +% prematurely and as a result \cs{exp_end:} will be misinterpreted +% later on.\footnotemark +% +% In typical use cases the \cs{exp_end:} will be hidden somewhere +% in the replacement text of \meta{expandable-tokens} rather than +% being on the same expansion level than \cs{exp:w}, e.g., you may +% see code such as +%\begin{verbatim} +% \exp:w \@@_case:NnTF #1 {#2} { } { } +%\end{verbatim} +% where somewhere during the expansion of |\@@_case:NnTF| the +% \cs{exp_end:} gets generated. +% \end{function} +% \footnotetext{Due to the implementation you might get the character +% in position 0 in the current font (typically ``\texttt`'') +% in the output without any error message!} +% +% \begin{function}[added=2015-08-23,EXP] +% { +% \exp:w , +% \exp_end_continue_f:w +% } +% \begin{syntax} +% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end_continue_f:w} \meta{further-tokens} +% \end{syntax} +% Expands \meta{expandable-tokens} until reaching \cs{exp_end_continue_f:w} at +% which point expansion continues as an f-type expansion expanding +% \meta{further-tokens} until an unexpandable token is encountered (or +% the f-type expansion is explicitly terminated by +% \cs{exp_stop_f:}). As with all f-type expansions a space ending +% the expansion will get removed. +% +% The full expansion of \meta{expandable-tokens} has to be empty. +% If any token in \meta{expandable-tokens} or any token generated by +% expanding the tokens therein is not expandable the expansion will end +% prematurely and as a result \cs{exp_end_continue_f:w} will be misinterpreted +% later on.\footnotemark +% +% +% In typical use cases \meta{expandable-tokens} contains no tokens at all, +% e.g., you will see code such as +%\begin{verbatim} +% \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } +%\end{verbatim} +% where the \cs{exp_after:wN} triggers an f-expansion of the tokens +% in |#2|. For technical reasons this has to happen using two tokens +% (if they would be hidden inside another command \cs{exp_after:wN} +% would only expand the command but not trigger any additional +% f-expansion). +% +% You might wonder why there are two different approaches available, +% after all the effect of +% \begin{quote} +% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end:} +% \end{quote} +% can be alternatively achieved through an f-type expansion by using +% \cs{exp_stop_f:}, i.e. +% \begin{quote} +% \cs{exp:w} \cs{exp_end_continue_f:w} \meta{expandable-tokens} \cs{exp_stop_f:} +% \end{quote} +% The reason is simply that the first approach is slightly faster +% (one less token to parse and less expansion internally) +% so in places where such performance really matters and where we +% want to explicitly stop the expansion at a defined point the first +% form is preferable. +% \end{function} +% \footnotetext{In this particular case you may get a character into +% the output as well as an error message.} +% +% \begin{function}[added=2015-08-23,EXP] +% { +% \exp:w , +% \exp_end_continue_f:nw +% } +% \begin{syntax} +% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end_continue_f:nw} \meta{further-tokens} +% \end{syntax} +% The difference to \cs{exp_end_continue_f:w} is that we first we pick +% up an argument which is then returned to the input stream. If +% \meta{further-tokens} starts with a brace group then the braces +% are removed. If on the other hand it starts with space tokens then +% these space tokens are removed while searching for the +% argument. Thus such space tokens will not terminate the f-type expansion. +% \end{function} +% % \section{Internal functions and variables} % % \begin{variable}{\l__exp_internal_tl} @@ -754,18 +886,17 @@ % \begin{macro}[int, EXP]{\::f} % \begin{macro}{\exp_stop_f:} % This function is used to expand a token list until the first -% unexpandable token is found. The underlying \tn{romannumeral} |-`0| -% expands everything in its way to find something terminating the -% number and thereby expands the function in front of it. This +% unexpandable token is found. This is achieved through \cs{exp:w} +% \cs{exp_end_continue_f:w} that +% expands everything in its way following it. This % scanning procedure is terminated once the expansion hits % something non-expandable or a space. We introduce \cs{exp_stop_f:} -% to mark such an end of expansion marker; in case the scanner hits -% a number, this number also terminates the scanning and is left -% untouched. In the example shown earlier the scanning was stopped +% to mark such an end of expansion marker. +% In the example shown earlier the scanning was stopped % once \TeX{} had fully expanded |\cs_set_eq:Nc \aaa { b \l_tmpa_tl b }| % into |\cs_set_eq:NN \aaa = \blurb| which then turned out to contain % the non-expandable token \cs{cs_set_eq:NN}. Since the expansion of -% \tn{romannumeral} |-`0| is \meta{null}, we wind up with a fully +% \cs{exp:w} \cs{exp_end_continue_f:w} is \meta{null}, we wind up with a fully % expanded list, only \TeX{} has not tried to execute any of the % non-expandable tokens. This is what differentiates this function % from the |x| argument type. @@ -773,7 +904,7 @@ \cs_new:Npn \::f #1 \::: #2#3 { \exp_after:wN \@@_arg_next:nnn - \exp_after:wN { \tex_romannumeral:D -`0 #3 } + \exp_after:wN { \exp:w \exp_end_continue_f:w #3 } {#1} {#2} } \use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ } @@ -798,20 +929,20 @@ % |tl|, |clist|, |int|, |skip|, |dim| and |muskip|. The |V| version % expects a single token whereas |v| like |c| creates a csname from % its argument given in braces and then evaluates it as if it was a -% |V|. The primitive \tn{romannumeral} sets off an expansion +% |V|. The \cs{exp:w} sets off an expansion % similar to an |f| type expansion, which we will terminate using -% \cs{c_zero}. The argument is returned in braces. +% \cs{exp_end:}. The argument is returned in braces. % \begin{macrocode} \cs_new:Npn \::V #1 \::: #2#3 { \exp_after:wN \@@_arg_next:nnn - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 } + \exp_after:wN { \exp:w \@@_eval_register:N #3 } {#1} {#2} } \cs_new:Npn \::v # 1\::: #2#3 { \exp_after:wN \@@_arg_next:nnn - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#3} } + \exp_after:wN { \exp:w \@@_eval_register:c {#3} } {#1} {#2} } % \end{macrocode} @@ -852,19 +983,20 @@ \fi: % \end{macrocode} % The next bit requires some explanation. The function must be -% initiated by the primitive \tn{romannumeral} and we want to -% terminate this expansion chain by inserting the \cs{c_zero} integer -% constant. However, we have to expand the register |#1| before we do +% initiated by \cs{exp:w} and we want to +% terminate this expansion chain by inserting the \cs{exp_end:} +% token. +% However, we have to expand the register |#1| before we do % that. If it is a \TeX{} register, we need to execute the sequence -% |\exp_after:wN \c_zero \tex_the:D #1| and if it is a macro we -% need to execute |\exp_after:wN \c_zero #1|. We therefore issue +% |\exp_after:wN \exp_end: \tex_the:D #1| and if it is a macro we +% need to execute |\exp_after:wN \exp_end: #1|. We therefore issue % the longer of the two sequences and if the register is a macro, we % remove the \cs{tex_the:D}. % \begin{macrocode} \else: \exp_after:wN \use_i_ii:nnn \fi: - \exp_after:wN \c_zero \tex_the:D #1 + \exp_after:wN \exp_end: \tex_the:D #1 } \cs_new:Npn \@@_eval_register:c #1 { \exp_after:wN \@@_eval_register:N \cs:w #1 \cs_end: } @@ -883,7 +1015,7 @@ \fi: \fi: \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2} - \c_zero + \exp_end: } % \end{macrocode} % \end{macro} @@ -936,25 +1068,25 @@ % \begin{macro}[EXP]{\exp_args:Nf, \exp_args:NV, \exp_args:Nv} % \begin{macrocode} \cs_new:Npn \exp_args:Nf #1#2 - { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D -`0 #2 } } + { \exp_after:wN #1 \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } } \cs_new:Npn \exp_args:Nv #1#2 { \exp_after:wN #1 \exp_after:wN - { \tex_romannumeral:D \@@_eval_register:c {#2} } + { \exp:w \@@_eval_register:c {#2} } } \cs_new:Npn \exp_args:NV #1#2 { \exp_after:wN #1 \exp_after:wN - { \tex_romannumeral:D \@@_eval_register:N #2 } + { \exp:w \@@_eval_register:N #2 } } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP] % { -% \exp_args:NNV,\exp_args:NNv,\exp_args:NNf, +% \exp_args:NNV, \exp_args:NNv, \exp_args:NNf, % \exp_args:NVV, -% \exp_args:Ncf,\exp_args:Nco +% \exp_args:Ncf, \exp_args:Nco % } % Some more hand-tuned function with three arguments. % If we forced that an |o| argument always has braces, @@ -965,19 +1097,19 @@ { \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN { \tex_romannumeral:D -`0 #3 } + \exp_after:wN { \exp:w \exp_end_continue_f:w #3 } } \cs_new:Npn \exp_args:NNv #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#3} } + \exp_after:wN { \exp:w \@@_eval_register:c {#3} } } \cs_new:Npn \exp_args:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 } + \exp_after:wN { \exp:w \@@_eval_register:N #3 } } \cs_new:Npn \exp_args:Nco #1#2#3 { @@ -989,14 +1121,14 @@ { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: - \exp_after:wN { \tex_romannumeral:D -`0 #3 } + \exp_after:wN { \exp:w \exp_end_continue_f:w #3 } } \cs_new:Npn \exp_args:NVV #1#2#3 { \exp_after:wN #1 - \exp_after:wN { \tex_romannumeral:D \exp_after:wN + \exp_after:wN { \exp:w \exp_after:wN \@@_eval_register:N \exp_after:wN #2 \exp_after:wN } - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 } + \exp_after:wN { \exp:w \@@_eval_register:N #3 } } % \end{macrocode} % \end{macro} @@ -1013,7 +1145,7 @@ \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #4 } + \exp_after:wN { \exp:w \@@_eval_register:N #4 } } \cs_new:Npn \exp_args:NcNc #1#2#3#4 { @@ -1054,14 +1186,14 @@ % % \begin{macro}[EXP] % { -% \exp_args:Nnc,\exp_args:Nfo,\exp_args:Nff,\exp_args:Nnf, -% \exp_args:Nno,\exp_args:NnV,\exp_args:Noo,\exp_args:Nof, +% \exp_args:Nnc, \exp_args:Nfo, \exp_args:Nff, \exp_args:Nnf, +% \exp_args:Nno, \exp_args:NnV, \exp_args:Noo, \exp_args:Nof, % \exp_args:Noc % } % \begin{macro} % { -% \exp_args:NNx,\exp_args:Ncx,\exp_args:Nnx, -% \exp_args:Nox,\exp_args:Nxo,\exp_args:Nxx, +% \exp_args:NNx, \exp_args:Ncx, \exp_args:Nnx, +% \exp_args:Nox, \exp_args:Nxo, \exp_args:Nxx, % } % Here are the actual function definitions, using the helper functions % above. @@ -1087,13 +1219,14 @@ % % \begin{macro}[EXP] % { -% \exp_args:NNno,\exp_args:NNoo, -% \exp_args:Nnnc,\exp_args:Nnno,\exp_args:Nooo, +% \exp_args:NNno, \exp_args:NNoo, +% \exp_args:Nnnc, \exp_args:Nnno, \exp_args:Nooo, % } % \begin{macro} % { -% \exp_args:NNnx,\exp_args:NNox,\exp_args:Nnnx,\exp_args:Nnox, -% \exp_args:Nccx,\exp_args:Ncnx,\exp_args:Noox, +% \exp_args:NNNx, +% \exp_args:NNnx, \exp_args:NNox, \exp_args:Nnnx, \exp_args:Nnox, +% \exp_args:Nccx, \exp_args:Ncnx, \exp_args:Noox, % } % \begin{macrocode} \cs_new_nopar:Npn \exp_args:NNno { \::N \::n \::o \::: } @@ -1101,6 +1234,7 @@ \cs_new_nopar:Npn \exp_args:Nnnc { \::n \::n \::c \::: } \cs_new_nopar:Npn \exp_args:Nnno { \::n \::n \::o \::: } \cs_new_nopar:Npn \exp_args:Nooo { \::o \::o \::o \::: } +\cs_new_protected_nopar:Npn \exp_args:NNNx { \::N \::N \::x \::: } \cs_new_protected_nopar:Npn \exp_args:NNnx { \::N \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:NNox { \::N \::o \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nnnx { \::n \::n \::x \::: } @@ -1127,19 +1261,19 @@ \cs_new:Npn \::f_unbraced \::: #1#2 { \exp_after:wN \@@_arg_last_unbraced:nn - \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1} + \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } {#1} } \cs_new:Npn \::o_unbraced \::: #1#2 { \exp_after:wN \@@_arg_last_unbraced:nn \exp_after:wN {#2} {#1} } \cs_new:Npn \::V_unbraced \::: #1#2 { \exp_after:wN \@@_arg_last_unbraced:nn - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #2 } {#1} + \exp_after:wN { \exp:w \@@_eval_register:N #2 } {#1} } \cs_new:Npn \::v_unbraced \::: #1#2 { \exp_after:wN \@@_arg_last_unbraced:nn - \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#2} } {#1} + \exp_after:wN { \exp:w \@@_eval_register:c {#2} } {#1} } \cs_new_protected:Npn \::x_unbraced \::: #1#2 { @@ -1173,25 +1307,25 @@ % general system is in place. % \begin{macrocode} \cs_new:Npn \exp_last_unbraced:NV #1#2 - { \exp_after:wN #1 \tex_romannumeral:D \@@_eval_register:N #2 } + { \exp_after:wN #1 \exp:w \@@_eval_register:N #2 } \cs_new:Npn \exp_last_unbraced:Nv #1#2 - { \exp_after:wN #1 \tex_romannumeral:D \@@_eval_register:c {#2} } + { \exp_after:wN #1 \exp:w \@@_eval_register:c {#2} } \cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } \cs_new:Npn \exp_last_unbraced:Nf #1#2 - { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } + { \exp_after:wN #1 \exp:w \exp_end_continue_f:w #2 } \cs_new:Npn \exp_last_unbraced:Nco #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 } \cs_new:Npn \exp_last_unbraced:NcV #1#2#3 { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: - \tex_romannumeral:D \@@_eval_register:N #3 + \exp:w \@@_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 - \tex_romannumeral:D \@@_eval_register:N #3 + \exp:w \@@_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 #3 } @@ -1200,7 +1334,7 @@ \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 - \tex_romannumeral:D \@@_eval_register:N #4 + \exp:w \@@_eval_register:N #4 } \cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } @@ -1255,16 +1389,16 @@ \cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} } \cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } \cs_new:Npn \exp_not:f #1 - { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D -`0 #1 } } + { \etex_unexpanded:D \exp_after:wN { \exp:w \exp_end_continue_f:w #1 } } \cs_new:Npn \exp_not:V #1 { \etex_unexpanded:D \exp_after:wN - { \tex_romannumeral:D \@@_eval_register:N #1 } + { \exp:w \@@_eval_register:N #1 } } \cs_new:Npn \exp_not:v #1 { \etex_unexpanded:D \exp_after:wN - { \tex_romannumeral:D \@@_eval_register:c {#1} } + { \exp:w \@@_eval_register:c {#1} } } % \end{macrocode} % \end{macro} @@ -1273,6 +1407,71 @@ % \end{macro} % \end{macro} % +% \subsection{Controlled expansion} +% +% \begin{macro}{\exp:w} +% \begin{macro}{\exp_end:} +% \begin{macro}{\exp_end_continue_f:w} +% \begin{macro}{\exp_end_continue_f:nw} +% +% To trigger a sequence of ``arbitrary'' many expansions we need a +% method to invoke \TeX's expansion mechanism in such a way that a) +% we are able to stop it in a controlled manner and b) that the +% result of what triggered the expansion in the first place is +% null, i.e., that we do not get any unwanted side effects. There +% aren't that many possibilities in \TeX{}; in fact the one +% explained below might well be the only one (as normally the +% result of expansion is not null). +% +% The trick here is to make use of the fact that +% \cs{tex_romannumeral:D} expands the tokens following it when +% looking for a number and that its expansion is null if that +% number turns out to be zero or negative. So we use that to start +% the expansion sequence. +% \begin{macrocode} +%\cs_new_eq:NN \exp:w \tex_romannumeral:D +% \end{macrocode} +% So to stop the expansion sequence in a controlled way all we need +% to provide is \cs{c_zero} as part of expanded tokens. As this is +% an integer constant it will immediately stop +% \cs{tex_romannumerl:D}'s search for a number. +% \begin{macrocode} +%\cs_new_eq:NN \exp_end: \c_zero +% \end{macrocode} +% (Note that according to our specification all tokens we expand +% initiated by \cs{exp:w} are supposed to be expandable (as well as +% their replacement text in the expansion) so we will not encounter +% a ``number'' that actually result in a roman numeral being +% generated. Or if we do then the programmer made a mistake.) +% +% If on the other hand we want to stop the initial expansion +% sequence but continue with an f-type expansion we provide the +% alphabetic constant |`^^@| that also represents |0| but this time +% \TeX's syntax for a \meta{number} will continue searching for an +% optional space (and it will continue expansion doing that) --- +% see \TeX{}book page~269 for details. +% \begin{macrocode} +\tex_catcode:D `\^^@=13 +\cs_new_protected:Npn \exp_end_continue_f:w {`^^@} +% \end{macrocode} +% If the above definition ever appears outside its proper context +% the active character |^^@| will be executed so we turn this into an +% error.\footnote{Need to get a real error message.} +% \begin{macrocode} +\cs_new:Npn ^^@{\expansionERROR} +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \exp_end_continue_f:nw #1 { `^^@ #1 } +\tex_catcode:D `\^^@=15 +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% % \subsection{Defining function variants} % % \begin{macrocode} @@ -1301,7 +1500,7 @@ \exp_after:wN #1 \exp_after:wN \@@_generate_variant:nnNN \exp_after:wN #1 - \etex_detokenize:D {#2} , \scan_stop: , \q_recursion_stop + \tl_to_str:n {#2} , \scan_stop: , \q_recursion_stop } % \end{macrocode} % \end{macro} @@ -1330,35 +1529,34 @@ % auxiliary, and |#3| is \cs{cs_new_protected_nopar:Npx}, otherwise it % is \cs{cs_new_nopar:Npx}. % \begin{macrocode} -\group_begin: - \tex_catcode:D `\M = 12 \scan_stop: - \tex_catcode:D `\A = 12 \scan_stop: - \tex_catcode:D `\P = 12 \scan_stop: - \tex_catcode:D `\R = 12 \scan_stop: -\tex_lowercase:D +\cs_new_protected:Npx \@@_generate_variant:N #1 { - \group_end: - \cs_new_protected:Npn \@@_generate_variant:N #1 - { - \exp_after:wN \if_meaning:w \exp_not:N #1 #1 - \cs_set_eq:NN \@@_tmp:w \cs_new_protected_nopar:Npx - \else: - \exp_after:wN \@@_generate_variant:ww - \token_to_meaning:N #1 MA \q_mark - \q_mark \cs_new_protected_nopar:Npx - PR - \q_mark \cs_new_nopar:Npx - \q_stop - \fi: - } - \cs_new_protected:Npn \@@_generate_variant:ww #1 MA #2 \q_mark - { \@@_generate_variant:wwNw #1 } - \cs_new_protected:Npn \@@_generate_variant:wwNw - #1 PR #2 \q_mark #3 #4 \q_stop - { - \cs_set_eq:NN \@@_tmp:w #3 - } + \exp_not:N \exp_after:wN \exp_not:N \if_meaning:w + \exp_not:N \exp_not:N #1 #1 + \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected_nopar:Npx + \exp_not:N \else: + \exp_not:N \exp_after:wN \exp_not:N \@@_generate_variant:ww + \exp_not:N \token_to_meaning:N #1 \tl_to_str:n { ma } + \exp_not:N \q_mark + \exp_not:N \q_mark \cs_new_protected_nopar:Npx + \tl_to_str:n { pr } + \exp_not:N \q_mark \cs_new_nopar:Npx + \exp_not:N \q_stop + \exp_not:N \fi: + } +\use:x + { + \cs_new_protected:Npn \exp_not:N \@@_generate_variant:ww + ##1 \tl_to_str:n { ma } ##2 \exp_not:N \q_mark } + { \@@_generate_variant:wwNw #1 } +\use:x + { + \cs_new_protected:Npn \exp_not:N \@@_generate_variant:wwNw + ##1 \tl_to_str:n { pr } ##2 \exp_not:N \q_mark + ##3 ##4 \exp_not:N \q_stop + } + { \cs_set_eq:NN \@@_tmp:w #3 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1617,11 +1815,10 @@ \group_end: } { - \iow_log:x + \__chk_log:x { Variant~\token_to_str:N #4~% - already~defined;~ not~ changing~ it~on~line~% - \tex_the:D \tex_inputlineno:D + already~defined;~ not~ changing~ it~ \msg_line_context: } } } @@ -1638,32 +1835,32 @@ % protected, and the next variant to be defined using that internal % variant should be protected. % \begin{macrocode} -\group_begin: - \tex_catcode:D `\X = 12 \scan_stop: - \tex_lccode:D `\N = `\N \scan_stop: -\tex_lowercase:D +\cs_new_protected:Npx \@@_generate_internal_variant:n #1 { - \group_end: - \cs_new_protected:Npn \@@_generate_internal_variant:n #1 - { - \@@_generate_internal_variant:wwnNwnn - #1 \q_mark - { \cs_set_eq:NN \@@_tmp:w \cs_new_protected_nopar:Npx } - \cs_new_protected_nopar:cpx - X \q_mark - { } - \cs_new_nopar:cpx - \q_stop - { exp_args:N #1 } - { \@@_generate_internal_variant_loop:n #1 { : \use_i:nn } } - } - \cs_new_protected:Npn \@@_generate_internal_variant:wwnNwnn - #1 X #2 \q_mark #3 #4 #5 \q_stop #6 #7 + \exp_not:N \@@_generate_internal_variant:wwnNwnn + #1 \exp_not:N \q_mark + { \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected_nopar:Npx } + \cs_new_protected_nopar:cpx + \token_to_str:N x \exp_not:N \q_mark + { } + \cs_new_nopar:cpx + \exp_not:N \q_stop + { exp_args:N #1 } { - #3 - \cs_if_free:cT {#6} { #4 {#6} {#7} } + \exp_not:N \@@_generate_internal_variant_loop:n #1 + { : \exp_not:N \use_i:nn } } } +\use:x + { + \cs_new_protected:Npn \exp_not:N \@@_generate_internal_variant:wwnNwnn + ##1 \token_to_str:N x ##2 \exp_not:N \q_mark + ##3 ##4 ##5 \exp_not:N \q_stop ##6 ##7 + } + { + #3 + \cs_if_free:cT {#6} { #4 {#6} {#7} } + } % \end{macrocode} % This command grabs char by char outputting |\::#1| (not expanded % further). We avoid tests by putting a trailing |: \use_i:nn|, which diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 8a5ab688d68..4dfb03bd13c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3file.dtx 5714 2015-07-30 00:51:47Z bruno $ +\GetIdInfo$Id: l3file.dtx 5786 2015-08-05 16:18:39Z bruno $ {L3 File and I/O operations} %</driver|package> %<*driver> @@ -136,7 +136,7 @@ % files. The assignment is local. % The \meta{path} is processed in the same way as a \meta{file name}, % \emph{i.e.}, with \texttt{x}-type expansion except active -% characters. Spaces are not allowed in the \meta{path}. +% characters. % \end{function} % % \begin{function}[updated = 2012-07-04]{\file_path_remove:n} @@ -147,7 +147,7 @@ % files. The assignment is local. % The \meta{path} is processed in the same way as a \meta{file name}, % \emph{i.e.}, with \texttt{x}-type expansion except active -% characters. Spaces are not allowed in the \meta{path}. +% characters. % \end{function} % % \begin{function}{\file_list:} @@ -234,7 +234,7 @@ % to other programmers. % \end{function} % -% \begin{function}[updated = 2012-09-09]{\ior_list_streams:, \iow_list_streams:} +% \begin{function}[updated = 2015-08-01]{\ior_list_streams:, \iow_list_streams:} % \begin{syntax} % \cs{ior_list_streams:} % \cs{iow_list_streams:} @@ -414,7 +414,7 @@ % % \subsection{Wrapping lines in output} % -% \begin{function}[added = 2012-06-28]{\iow_wrap:nnnN} +% \begin{function}[added = 2012-06-28, updated = 2015-08-05]{\iow_wrap:nnnN} % \begin{syntax} % \cs{iow_wrap:nnnN} \Arg{text} \Arg{run-on text} \Arg{set up} \meta{function} % \end{syntax} @@ -422,9 +422,11 @@ % characters per line. At the start of each line which is wrapped, % the \meta{run-on text} will be inserted. The line character count % targeted will be the value of \cs{l_iow_line_count_int} minus the -% number of characters in the \meta{run-on text}. The \meta{text} and -% \meta{run-on text} are exhaustively expanded by the function, with the -% following substitutions: +% number of characters in the \meta{run-on text} for all lines except +% the first, for which the target number of characters is simply +% \cs{l_iow_line_count_int} since there is no run-on text. The +% \meta{text} and \meta{run-on text} are exhaustively expanded by the +% function, with the following substitutions: % \begin{itemize} % \item |\\| may be used to force a new line, % \item \verb*|\ | may be used to represent a forced space @@ -1124,20 +1126,20 @@ % \begin{macro}{\ior_list_streams:} % \begin{macro}[aux]{\@@_list_streams:Nn} % Show the property lists, but with some \enquote{pretty printing}. -% See the \pkg{l3msg} module. If there are no open read streams, -% issue the message \texttt{show-no-stream}, and show an empty -% token list. If there are open read streams, format them with -% \cs{__msg_show_item_unbraced:nn}, and with the message -% \texttt{show-open-streams}. +% See the \pkg{l3msg} module. The first argument of the message is +% |ior| (as opposed to |iow|) and the second is empty if no read +% stream is open and non-empty (in fact a question mark) otherwise. +% The code of the message \texttt{show-streams} takes care of +% translating |ior|/|iow| to English. The list of streams is +% formatted using \cs{__msg_show_item_unbraced:nn}. % \begin{macrocode} \cs_new_protected_nopar:Npn \ior_list_streams: - { \@@_list_streams:Nn \g_@@_streams_prop { input } } + { \@@_list_streams:Nn \g_@@_streams_prop { ior } } \cs_new_protected:Npn \@@_list_streams:Nn #1#2 { - \__msg_term:nnn { LaTeX / kernel } - { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } - {#2} - \__msg_show_variable:n + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-streams } + {#2} { \prop_if_empty:NF #1 { ? } } { } { } + \__msg_show_wrap:n { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } % \end{macrocode} @@ -1357,7 +1359,7 @@ % Done as for input, but with a copy of the auxiliary so the name is correct. % \begin{macrocode} \cs_new_protected_nopar:Npn \iow_list_streams: - { \@@_list_streams:Nn \g_@@_streams_prop { output } } + { \@@_list_streams:Nn \g_@@_streams_prop { iow } } \cs_new_eq:NN \@@_list_streams:Nn \__ior_list_streams:Nn % \end{macrocode} % \end{macro} @@ -1407,7 +1409,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\iow_now:Nn,\iow_now:Nx,\iow_now:cn,\iow_now:cx} +% \begin{macro}{\iow_now:Nn, \iow_now:Nx, \iow_now:cn, \iow_now:cx} % This routine writes the second argument onto the output stream without % expansion. If this stream isn't open, the output goes to the terminal % instead. If the first argument is no output stream at all, we get an @@ -1653,19 +1655,17 @@ %</package> % \end{macrocode} % To warn users that \cs{iow_indent:n} only works in the first argument -% of \cs{iow_wrap:nnnN} reset \cs{iow_indent:n} to its error definition. -% This is a bit of a hack to measure the string length of the run on text -% without the \pkg{l3str} module (which is still experimental). This should -% be replaced once the string module is finalised with something a little -% cleaner. +% of \cs{iow_wrap:nnnN} reset \cs{iow_indent:n} to its error +% definition. Then store a newline character and the run-on text as a +% string in \cs{l_@@_newline_tl}, and set some variables. The first +% line's target count is equal to the length of the whole line. The +% value \cs{l_@@_target_count_int} is altered later on by +% \cs{@@_wrap_set_target:}. % \begin{macrocode} \cs_set_eq:NN \iow_indent:n \@@_indent_error:n \tl_set:Nx \l_@@_newline_tl { \iow_newline: #2 } \tl_set:Nx \l_@@_newline_tl { \tl_to_str:N \l_@@_newline_tl } - \tl_replace_all:Nnn \l_@@_newline_tl { ~ } { \c_space_tl } - \int_set:Nn \l_@@_target_count_int - { \l_iow_line_count_int - \tl_count:N \l_@@_newline_tl + \c_one } - \int_zero:N \l_@@_current_indentation_int + \int_set_eq:NN \l_@@_target_count_int \l_iow_line_count_int \tl_clear:N \l_@@_current_indentation_tl \int_zero:N \l_@@_current_line_int \tl_set:Nn \l_@@_current_line_tl { \use_none:n } @@ -1702,6 +1702,34 @@ % \end{macro} % \end{macro} % +% \begin{macro}[aux]{\@@_wrap_set_target:} +% This is called at the beginning of every line (both those forced by +% |\\| and those due to line-breaking). The initial call does +% nothing except redefine \cs{@@_wrap_set_target:} itself (within the +% group in which \cs{iow_wrap:nnnN} works). The next call (at the +% beginning of the second line) disables any later call and sets the +% \cs{l_@@_target_count_int} to the correct value, namely the +% \cs{l_iow_line_count_int} shortened by the length of the run-on +% text (the shift by~$1$ is due to the presence of \cs{iow_newline:} +% in \cs{l_@@_newline_tl}). +% This is a bit of a hack to measure the string length of the run on text +% without the \pkg{l3str} module (which is still experimental). This should +% be replaced once the string module is finalised with something a little +% cleaner. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_wrap_set_target: + { + \cs_set_protected_nopar:Npn \@@_wrap_set_target: + { + \cs_set_protected_nopar:Npn \@@_wrap_set_target: { } + \tl_replace_all:Nnn \l_@@_newline_tl { ~ } { \c_space_tl } + \int_set:Nn \l_@@_target_count_int + { \l_iow_line_count_int - \tl_count:N \l_@@_newline_tl + \c_one } + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[aux]{\@@_wrap_loop:w} % The loop grabs one word in the input, and checks whether it is % the special marker, or a normal word. @@ -1754,6 +1782,7 @@ } \cs_new_protected_nopar:Npn \@@_wrap_word_newline: { + \@@_wrap_set_target: \tl_put_right:Nx \l_@@_wrap_tl { \l_@@_current_line_tl \l_@@_newline_tl } \int_set:Nn \l_@@_current_line_int @@ -1797,6 +1826,7 @@ } \cs_new_protected_nopar:Npn \@@_wrap_newline: { + \@@_wrap_set_target: \tl_put_right:Nx \l_@@_wrap_tl { \l_@@_current_line_tl \l_@@_newline_tl } \int_zero:N \l_@@_current_line_int diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index cfab331e2a0..80d4f418671 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %% -%% File: l3fp-assign.dtx Copyright (C) 2011-2014 The LaTeX3 project +%% File: l3fp-assign.dtx Copyright (C) 2011-2015 The LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-assign.dtx 4712 2014-04-30 08:17:49Z joseph $ +\GetIdInfo$Id: l3fp-assign.dtx 5804 2015-08-08 05:05:02Z bruno $ {L3 Floating-point assignments} \begin{document} \DocInput{\jobname.dtx} @@ -181,21 +181,16 @@ % \subsection{Showing values} % % \begin{macro}{\fp_show:N, \fp_show:c, \fp_show:n} -% This shows the result of computing its argument. The -% \cs{__msg_show_variable:n} auxiliary expects its input in a slightly -% odd form, starting with |>~|, and displays the rest. +% This shows the result of computing its argument. The input of +% \cs{__msg_show_variable:NNNnn} must start with |>~| (or be empty). % \begin{macrocode} \cs_new_protected:Npn \fp_show:N #1 { - \fp_if_exist:NTF #1 - { \__msg_show_variable:n { > ~ \fp_to_tl:N #1 } } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } + \__msg_show_variable:NNNnn #1 \fp_if_exist:NTF ? { } + { > ~ \token_to_str:N #1 = \fp_to_tl:N #1 } } -\cs_new_protected:Npn \fp_show:n #1 - { \__msg_show_variable:n { > ~ \fp_to_tl:n {#1} } } +\cs_new_protected_nopar:Npn \fp_show:n + { \__msg_show_wrap:Nn \fp_to_tl:n } \cs_generate_variant:Nn \fp_show:N { c } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 54ebb1db580..aaa08b12204 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-aux.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3fp-aux.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point support functions} \documentclass[full]{l3doc} \begin{document} @@ -465,7 +465,7 @@ \else: \exp_after:wN \@@_exp_after_special:nNNw \fi: - { \tex_romannumeral:D -`0 #1 } + { \exp:w \exp_end_continue_f:w #1 } #2 } % \end{macrocode} @@ -734,7 +734,7 @@ \if_int_compare:w \__int_eval:w #1 > \c_sixteen tiny \else: - \tex_romannumeral:D \__int_eval:w #1 + \__int_to_roman:w \__int_eval:w #1 \fi: :Nnnnn \cs_end: @@ -1056,7 +1056,7 @@ } \cs_new:Npn \@@_expand_loop:nwnN #1#2 \s_@@_mark #3 #4 { - \exp_after:wN #4 \tex_romannumeral:D -`0 + \exp_after:wN #4 \exp:w \exp_end_continue_f:w #2 \s_@@_mark { #3 #1 } #4 } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 77b3d54320b..12af7c088a3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-convert.dtx 4712 2014-04-30 08:17:49Z joseph $ +\GetIdInfo$Id: l3fp-convert.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point conversion} \begin{document} \DocInput{\jobname.dtx} @@ -116,7 +116,7 @@ \cs_new_nopar:Npn \fp_to_scientific:n { \exp_after:wN \@@_to_scientific_dispatch:w - \tex_romannumeral:D -`0 \@@_parse:n + \exp:w \exp_end_continue_f:w \@@_parse:n } % \end{macrocode} % \end{macro} @@ -149,7 +149,7 @@ \group_end: \cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2 { - \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: \if_case:w #1 \exp_stop_f: \@@_case_return:nw { 0 } \or: \exp_after:wN \@@_to_scientific_normal:wnnnnn @@ -206,7 +206,7 @@ \cs_new_nopar:Npn \fp_to_decimal:n { \exp_after:wN \@@_to_decimal_dispatch:w - \tex_romannumeral:D -`0 \@@_parse:n + \exp:w \exp_end_continue_f:w \@@_parse:n } % \end{macrocode} % \end{macro} @@ -234,7 +234,7 @@ % \begin{macrocode} \cs_new:Npn \@@_to_decimal_dispatch:w \s_@@ \@@_chk:w #1#2 { - \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: \if_case:w #1 \exp_stop_f: \@@_case_return:nw { 0 } \or: \exp_after:wN \@@_to_decimal_normal:wnnnnn @@ -279,7 +279,7 @@ \exp_after:wN \@@_trim_zeros:w \exp_after:wN 0 \exp_after:wN . - \tex_romannumeral:D -`0 \prg_replicate:nn { - #2 } { 0 } + \exp:w \exp_end_continue_f:w \prg_replicate:nn { - #2 } { 0 } #3#4#5#6 ; } } @@ -307,7 +307,7 @@ \cs_new_nopar:Npn \fp_to_tl:n { \exp_after:wN \@@_to_tl_dispatch:w - \tex_romannumeral:D -`0 \@@_parse:n + \exp:w \exp_end_continue_f:w \@@_parse:n } % \end{macrocode} % \end{macro} @@ -321,7 +321,7 @@ % \begin{macrocode} \cs_new:Npn \@@_to_tl_dispatch:w \s_@@ \@@_chk:w #1#2 { - \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: \if_case:w #1 \exp_stop_f: \@@_case_return:nw { 0 } \or: \exp_after:wN \@@_to_tl_normal:nnnnn @@ -377,7 +377,7 @@ \cs_new_nopar:Npn \fp_to_int:n { \exp_after:wN \@@_to_int_dispatch:w - \tex_romannumeral:D -`0 \@@_parse:n + \exp:w \exp_end_continue_f:w \@@_parse:n } % \end{macrocode} % \end{macro} @@ -390,7 +390,7 @@ % \begin{macrocode} \cs_new:Npn \@@_to_int_dispatch:w #1; { - \exp_after:wN \@@_to_decimal_dispatch:w \tex_romannumeral:D -`0 + \exp_after:wN \@@_to_decimal_dispatch:w \exp:w \exp_end_continue_f:w \@@_round:Nwn \@@_round_to_nearest:NNN #1; { 0 } } % \end{macrocode} @@ -527,7 +527,8 @@ { \exp_not:N \exp_after:wN , \exp_not:N \exp_after:wN \c_space_tl - \exp_not:N \tex_romannumeral:D -`0 + \exp_not:N \exp:w + \exp_not:N \exp_end_continue_f:w \exp_not:N \@@_to_tl_dispatch:w #1 #2 ; } \exp_not:N \@@_array_to_clist_loop:Nw diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index ba6c3fc876e..c994fe3ce2c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-expo.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3fp-expo.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point exponential-related functions} \begin{document} \DocInput{\jobname.dtx} @@ -236,7 +236,7 @@ \cs_new:Npn \@@_ln_x_ii:wnnnn #1; #2#3#4#5 { \exp_after:wN \@@_ln_div_after:Nw - \cs:w c_@@_ln_ \tex_romannumeral:D #1 _fixed_tl \exp_after:wN \cs_end: + \cs:w c_@@_ln_ \__int_to_roman:w #1 _fixed_tl \exp_after:wN \cs_end: \__int_value:w \exp_after:wN \@@_ln_x_iv:wnnnnnnnn \int_use:N \__int_eval:w @@ -654,11 +654,11 @@ \exp_after:wN \@@_add_big_i_o:wNww \int_use:N \__int_eval:w \c_one - #4 ; 0 {1000}{0000}{0000}{0000} ; #5; - \tex_romannumeral:D + \exp:w \else: \if_int_compare:w #4 > \c_five % cf \c_@@_max_exponent_int \exp_after:wN \@@_exp_overflow: - \tex_romannumeral:D + \exp:w \else: \if_int_compare:w #4 < \c_zero \exp_after:wN \use_i:nn @@ -677,7 +677,7 @@ #5 {#4} #1 #2 0 - \tex_romannumeral:D + \exp:w \fi: \fi: \exp_after:wN \c_zero @@ -760,7 +760,7 @@ \cs_new:Npn \@@_exp_pos_large:NnnNwn #1#2#3 #4#5; #6 { \exp_after:wN \exp_after:wN - \cs:w @@_exp_large_\tex_romannumeral:D #6:wN \exp_after:wN \cs_end: + \cs:w @@_exp_large_ \__int_to_roman:w #6 :wN \exp_after:wN \cs_end: \exp_after:wN \c_@@_one_fixed_tl \exp_after:wN ; \__int_value:w #3 #4 \exp_stop_f: @@ -927,7 +927,7 @@ \@@_case_return_o:Nw \c_nan_fp \else: \exp_after:wN \@@_pow_neg:www - \tex_romannumeral:D -`0 \exp_after:wN \use:nn + \exp:w \exp_end_continue_f:w \exp_after:wN \use:nn \fi: { \if_meaning:w 1 #1 @@ -1169,7 +1169,7 @@ \or: \if_int_compare:w \__int_eval:w #1 / \c_two = \c_one \@@_invalid_operation_o:Nww ^ #3; #4; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \exp_after:wN \exp_after:wN \@@_use_none_until_s:w \fi: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 8173f9b62f0..08ef4a66bf7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-extended.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3fp-extended.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-points with extended precision} \begin{document} \DocInput{\jobname.dtx} @@ -652,7 +652,7 @@ { \exp_after:wN \@@_ep_to_fixed_auxi:www \int_use:N \__int_eval:w 1 0000 0000 + #2 \exp_after:wN ; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \prg_replicate:nn { \c_four - \int_max:nn {#1} { -32 } } { 0 } ; } \cs_new:Npn \@@_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7; diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 53986abf2c8..6730b126cb9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-logic.dtx 5680 2015-07-24 02:54:00Z bruno $ +\GetIdInfo$Id: l3fp-logic.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point conditionals} \begin{document} \DocInput{\jobname.dtx} @@ -109,7 +109,7 @@ \prg_new_conditional:Npnn \fp_compare:n #1 { p , T , F , TF } { \exp_after:wN \@@_compare_return:w - \tex_romannumeral:D -`0 \@@_parse:n {#1} + \exp:w \exp_end_continue_f:w \@@_parse:n {#1} } \cs_new:Npn \@@_compare_return:w \s_@@ \@@_chk:w #1#2; { @@ -134,7 +134,7 @@ { \if_int_compare:w \exp_after:wN \@@_compare_aux:wn - \tex_romannumeral:D -`0 \@@_parse:n {#1} {#3} + \exp:w \exp_end_continue_f:w \@@_parse:n {#1} {#3} = \__int_eval:w `#2 - `= \__int_eval_end: \prg_return_true: \else: @@ -144,7 +144,7 @@ \cs_new:Npn \@@_compare_aux:wn #1; #2 { \exp_after:wN \@@_compare_back:ww - \tex_romannumeral:D -`0 \@@_parse:n {#2} #1; + \exp:w \exp_end_continue_f:w \@@_parse:n {#2} #1; } % \end{macrocode} % \end{macro} @@ -473,10 +473,10 @@ \s_@@ \@@_chk:w { \@@_ternary_loop_break:w } ; \@@_ternary_break_point:n { \exp_after:wN \@@_ternary_auxi:NwwN } \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \@@_exp_after_array_f:w #3 \s_@@_stop \exp_after:wN @ - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_two \@@_parse_expand:w \else: @@ -484,7 +484,7 @@ { kernel } { fp-missing } { : } { ~for~?: } \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \@@_exp_after_array_f:w #3 \s_@@_stop \exp_after:wN #4 \exp_after:wN #1 @@ -508,7 +508,7 @@ { \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \@@_exp_after_array_f:w #2 \s_@@_stop #4 #1 } @@ -516,7 +516,7 @@ { \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \@@_exp_after_array_f:w #3 \s_@@_stop #4 #1 } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 7ce1c6367b1..2cd25ed4616 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-parse.dtx Copyright (C) 2011-2014 The LaTeX3 Project +%% File: l3fp-parse.dtx Copyright (C) 2011-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-parse.dtx 5383 2014-08-25 13:17:55Z bruno $ +\GetIdInfo$Id: l3fp-parse.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point expression parsing} \begin{document} \DocInput{\jobname.dtx} @@ -161,38 +161,38 @@ % already been found, and that we want to parse the next number. The % current status of the code may look as follows. % \begin{quote}\ttfamily -% \cs{exp_after:wN} \cs{add:ww} +% \cs{exp_after:wN} |\add:ww| % \cs{__int_value:w} 12345 \cs{exp_after:wN} ; \newline -% \cs{tex_romannumeral:D} |\operand:w| \meta{stuff} +% \cs{exp:w} |\operand:w| \meta{stuff} % \end{quote} % One step of expansion expands \cs{exp_after:wN}, which triggers the % primitive \cs{__int_value:w}, which reads the five digits we have % already found, |12345|. This integer is unfinished, causing the % second \cs{exp_after:wN} to expand, and to trigger the construction -% \cs{tex_romannumeral:D}, which expands |\operand:w|, defined to read +% \cs{exp:w}, which expands |\operand:w|, defined to read % what follows and make a number out of it, then leave \cs{c_zero}, the % number, and a semicolon in the input stream. Once |\operand:w| is % done expanding, we obtain essentially % \begin{quote}\ttfamily -% \cs{exp_after:wN} \cs{add:ww} \cs{__int_value:w} 12345 ; \newline -% \cs{tex_romannumeral:D} \cs{c_zero} 333444 ; +% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; \newline +% \cs{exp:w} \cs{c_zero} 333444 ; % \end{quote} % where in fact \cs{exp_after:wN} has already been expanded, % \cs{__int_value:w} has already seen |12345|, and -% \cs{tex_romannumeral:D} is still looking for a number. It finds +% \cs{exp:w} is still looking for a number. It finds % \cs{c_zero}, hence expands to nothing. Now, \cs{__int_value:w} sees % the \texttt{;}, which cannot be part of a number. The expansion % stops, and we are left with % \begin{quote}\ttfamily -% \cs{add:ww} 12345 ; 333444 ; +% |\add:ww| 12345 ; 333444 ; % \end{quote} % which can safely perform the addition by grabbing two arguments % delimited by~|;|. % % If we were to continue parsing the expression, then the following % number should also be cleaned up before the next use of a binary -% operation such as \cs{add:ww}. Just like \cs{__int_value:w} |12345| -% \cs{exp_after:wN}~|;| expanded what follows once, we need \cs{add:ww} +% operation such as |\add:ww|. Just like \cs{__int_value:w} |12345| +% \cs{exp_after:wN}~|;| expanded what follows once, we need |\add:ww| % to do the calculation, and in the process to expand the following % once. This is also true in our real application: all the functions of % the form \cs{@@_..._o:ww} expand what follows once. This comes at the @@ -311,7 +311,7 @@ % \begin{quote} % \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline % \cs{exp_after:wN} \meta{precedence} \newline -% \cs{tex_romannumeral:D} |-`0| \newline +% \cs{exp:w} \cs{exp_end_continue_f:w} \newline % ~~\cs{@@_parse_one:Nw} \meta{precedence} % \end{quote} % This expands \cs{@@_parse_one:Nw} \meta{precedence} completely, which @@ -354,9 +354,9 @@ % \begin{quote} % \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline % \cs{exp_after:wN} \meta{precedence} \newline -% \cs{tex_romannumeral:D} |-`0| \newline +% \cs{exp:w} \cs{exp_end_continue_f:w} \newline % |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} \newline -% \cs{tex_romannumeral:D} |-`0| \newline +% \cs{exp:w} \cs{exp_end_continue_f:w} \newline % |\__fp_parse_infix_|\meta{operator_2}|:N| \meta{precedence} % \end{quote} % where |\__fp_|\meta{operator}|_o:ww| computes \meta{number} @@ -545,7 +545,7 @@ % % \begin{macro}[rEXP, aux]{\@@_parse_operand:Nw} % \begin{syntax} -% \cs{tex_romannumeral:D} \cs{@@_parse_operand:Nw} \meta{precedence} \cs{@@_parse_expand:w} +% \cs{exp:w} \cs{@@_parse_operand:Nw} \meta{precedence} \cs{@@_parse_expand:w} % \end{syntax} % Reads the \enquote{\ttfamily\ldots{}}, performing every computation % with a precedence higher than \meta{precedence}, then expands to @@ -597,14 +597,14 @@ % % \begin{macro}[aux, rEXP]{\@@_parse_expand:w} % \begin{syntax} -% \cs{tex_romannumeral:D} \cs{@@_parse_expand:w} \meta{tokens} +% \cs{exp:w} \cs{@@_parse_expand:w} \meta{tokens} % \end{syntax} -% This function must always come within a \tn{romannumeral} expansion. +% This function must always come within a \cs{exp:w} expansion. % The \meta{tokens} should be the part of the expression that we have % not yet read. This requires in particular closing all conditionals % properly before expanding. % \begin{macrocode} -\cs_new:Npn \@@_parse_expand:w #1 { -`0 #1 } +\cs_new:Npn \@@_parse_expand:w #1 { \exp_end_continue_f:w #1 } % \end{macrocode} % \end{macro} % @@ -652,7 +652,8 @@ % \@@_parse_digits_iv:N , % \@@_parse_digits_iii:N , % \@@_parse_digits_ii:N , -% \@@_parse_digits_i:N +% \@@_parse_digits_i:N , +% \@@_parse_digits_:N % } % These functions must be called within an \cs{__int_value:w} or % \cs{__int_eval:w} construction. The first token which follows must @@ -676,7 +677,7 @@ \cs_new:cpn { @@_parse_digits_ #1 :N } ##1 { \if_int_compare:w \c_nine < 1 \token_to_str:N ##1 \exp_stop_f: - \token_to_str:N ##1 \exp_after:wN #2 \tex_romannumeral:D + \token_to_str:N ##1 \exp_after:wN #2 \exp:w \else: \@@_parse_return_semicolon:w #3 ##1 \fi: @@ -698,19 +699,22 @@ % % \begin{macro}[aux, EXP]{\@@_parse_one:Nw} % This function finds one number, and packs the symbol which follows -% in an \cs{infix_} csname. |#1|~is the previous \meta{precedence}, +% in an |\..._infix_...| csname. |#1|~is the previous \meta{precedence}, % and |#2|~the first token of the operand. We distinguish four cases: % |#2|~is equal to \cs{scan_stop:} in meaning, |#2|~is a different % control sequence, |#2|~is a digit, and |#2|~is something else (this -% last case will be split further. Despite the earlier +% last case will be split further). Despite the earlier % \texttt{f}-expansion, |#2|~may still be expandable if it was -% protected by \cs{exp_not:N}, as happens with the \LaTeXe{} command -% \tn{protect}. Testing if |#2|~is a control sequence thus includes -% \cs{exp_not:N}. +% protected by \cs{exp_not:N}, as may happen with the \LaTeXe{} command +% \tn{protect}. Using a well placed \cs{reverse_if:N}, this case is +% sent to \cs{@@_parse_one_fp:NN} which deals with it robustly. % \begin{macrocode} \cs_new:Npn \@@_parse_one:Nw #1 #2 { \if_catcode:w \scan_stop: \exp_not:N #2 + \exp_after:wN \if_meaning:w \exp_not:N #2 #2 \else: + \exp_after:wN \reverse_if:N + \fi: \if_meaning:w \scan_stop: #2 \exp_after:wN \exp_after:wN \exp_after:wN \@@_parse_one_fp:NN @@ -756,26 +760,50 @@ % defining |\__fp_exp_after_|\meta{type}|_f:nw|. In all cases, we % make sure that the second argument of \cs{@@_parse_infix:NN} is % correctly expanded. +% A special case only enabled in \LaTeXe{} is that if \tn{protect} is +% encountered then the error message mentions the control sequence +% which follows it rather than \tn{protect} itself. The test for +% \LaTeXe{} uses \tn{@unexpandable@protect} rather than \tn{protect} +% because \tn{protect} is often \cs{scan_stop:} hence \enquote{does +% not exist}. % \begin{macrocode} \cs_new:Npn \@@_parse_one_fp:NN #1#2 { \cs:w @@_exp_after \@@_type_from_scan:N #2 _f:nw \cs_end: { \exp_after:wN \@@_parse_infix:NN - \exp_after:wN #1 \tex_romannumeral:D \@@_parse_expand:w + \exp_after:wN #1 \exp:w \@@_parse_expand:w } #2 } \cs_new:Npn \@@_exp_after_mark_f:nw #1 { \__msg_kernel_expandable_error:nn { kernel } { fp-early-end } - \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1 + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w #1 } \cs_new:cpn { @@_exp_after_?_f:nw } #1#2 { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2} - \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1 + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w #1 } +%<*package> +\group_begin: + \char_set_catcode_letter:N \@ + \cs_if_exist:NT \@unexpandable@protect + { + \cs_gset:cpn { @@_exp_after_?_f:nw } #1#2 + { + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w #1 + \str_if_eq:nnTF {#2} { \protect } + { + \cs_if_eq:NNTF #2 \@unexpandable@protect { \use_i:nn } { \use:n } + { \__msg_kernel_expandable_error:nnn { kernel } { fp-robust-cmd } } + } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2} } + } + } +\group_end: +%</package> % \end{macrocode} % \end{macro} % @@ -808,12 +836,12 @@ { \exp_after:wN \@@_parse_infix_after_operand:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \@@_parse_one_register_aux:Nw \exp_after:wN #2 \__int_value:w \exp_after:wN \@@_parse_exponent:N - \tex_romannumeral:D \@@_parse_expand:w + \exp:w \@@_parse_expand:w } \group_begin: \char_set_catcode_other:N \P @@ -827,7 +855,7 @@ { \exp_after:wN \use:nn \exp_after:wN \@@_parse_one_register_auxii:wwwNw - \exp_after:wN { \tex_the:D \exp_not:N #1 } + \exp_after:wN { \tex_the:D #1 } ; \@@_parse_one_register_dim:ww PT ; \@@_parse_one_register_mu:www . PT ; \@@_parse_one_register_int:www @@ -862,7 +890,7 @@ { \exp_after:wN \@@_parse_infix_after_operand:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \@@_sanitize:wN \int_use:N \__int_eval:w \c_zero \@@_parse_trim_zeros:N } @@ -885,8 +913,8 @@ \exp_after:wN \@@_parse_word:Nw \exp_after:wN #1 \exp_after:wN #2 - \tex_romannumeral:D \exp_after:wN \@@_parse_letters:N - \tex_romannumeral:D + \exp:w \exp_after:wN \@@_parse_letters:N + \exp:w \else: \exp_after:wN \@@_parse_prefix:NNN \exp_after:wN #1 @@ -895,7 +923,7 @@ @@_parse_prefix_ \token_to_str:N #2 :Nw \exp_after:wN \cs_end: - \tex_romannumeral:D + \exp:w \fi: \@@_parse_expand:w } @@ -919,14 +947,14 @@ { \__msg_kernel_expandable_error:nnn { kernel } { unknown-fp-word } {#2} - \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w \@@_parse_infix:NN } #1 } \cs_new:Npn \@@_parse_letters:N #1 { - -`0 + \exp_end_continue_f:w \if_int_compare:w \if_catcode:w \scan_stop: \exp_not:N #1 \c_zero @@ -937,8 +965,8 @@ \fi: = \c_three \exp_after:wN #1 - \tex_romannumeral:D \exp_after:wN \@@_parse_letters:N - \tex_romannumeral:D + \exp:w \exp_after:wN \@@_parse_letters:N + \exp:w \else: \@@_parse_return_semicolon:w #1 \fi: @@ -974,7 +1002,7 @@ { \__msg_kernel_expandable_error:nnn { kernel } { fp-missing-number } {#1} - \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w \@@_parse_infix:NN #3 #1 } { @@ -1009,11 +1037,11 @@ { \if:w 0 \exp_not:N #1 \exp_after:wN \@@_parse_trim_zeros:N - \tex_romannumeral:D + \exp:w \else: \if:w . \exp_not:N #1 \exp_after:wN \@@_parse_strim_zeros:N - \tex_romannumeral:D + \exp:w \else: \@@_parse_trim_end:w #1 \fi: @@ -1048,7 +1076,7 @@ { \if:w 0 \exp_not:N #1 - \c_one - \exp_after:wN \@@_parse_strim_zeros:N \tex_romannumeral:D + \exp_after:wN \@@_parse_strim_zeros:N \exp:w \else: \@@_parse_strim_end:w #1 \fi: @@ -1103,7 +1131,7 @@ \exp_after:wN \@@_parse_small_leading:wwNN \__int_value:w 1 \exp_after:wN \@@_parse_digits_vii:N - \tex_romannumeral:D \@@_parse_expand:w + \exp:w \@@_parse_expand:w } % \end{macrocode} % \end{macro} @@ -1133,7 +1161,7 @@ \exp_after:wN \@@_parse_small_trailing:wwNN \__int_value:w 1 \exp_after:wN \@@_parse_digits_vi:N - \tex_romannumeral:D + \exp:w \else: 0000 0000 \@@_parse_exponent:Nw #4 \fi: @@ -1161,7 +1189,7 @@ \token_to_str:N #4 \exp_after:wN \@@_parse_small_round:NN \exp_after:wN #4 - \tex_romannumeral:D + \exp:w \else: 0 \@@_parse_exponent:Nw #4 \fi: @@ -1227,7 +1255,7 @@ \exp_after:wN \@@_parse_large_leading:wwNN \__int_value:w 1 \token_to_str:N #1 \exp_after:wN \@@_parse_digits_vii:N - \tex_romannumeral:D \@@_parse_expand:w + \exp:w \@@_parse_expand:w } % \end{macrocode} % \end{macro} @@ -1256,17 +1284,17 @@ \exp_after:wN \@@_parse_large_trailing:wwNN \__int_value:w 1 \token_to_str:N #4 \exp_after:wN \@@_parse_digits_vi:N - \tex_romannumeral:D + \exp:w \else: \if:w . \exp_not:N #4 \exp_after:wN \@@_parse_small_leading:wwNN \__int_value:w 1 \cs:w @@_parse_digits_ - \tex_romannumeral:D #3 + \__int_to_roman:w #3 :N \exp_after:wN \cs_end: - \tex_romannumeral:D + \exp:w \else: #2 \exp_after:wN \@@_parse_pack_trailing:NNNNNNww @@ -1306,7 +1334,7 @@ \int_use:N \__int_eval:w 1 #1 \token_to_str:N #4 \exp_after:wN \@@_parse_large_round:NN \exp_after:wN #4 - \tex_romannumeral:D + \exp:w \else: \exp_after:wN \@@_parse_pack_trailing:NNNNNNww \int_use:N \__int_eval:w \c_seven - #3 \exp_stop_f: @@ -1316,10 +1344,10 @@ \__int_value:w 1 \cs:w @@_parse_digits_ - \tex_romannumeral:D #3 + \__int_to_roman:w #3 :N \exp_after:wN \cs_end: - \tex_romannumeral:D + \exp:w \else: #2 0 \@@_parse_exponent:Nw #4 \fi: @@ -1347,10 +1375,10 @@ + \c_one \if:w 0 \token_to_str:N #1 \exp_after:wN \@@_parse_round_loop:N - \tex_romannumeral:D + \exp:w \else: \exp_after:wN \@@_parse_round_up:N - \tex_romannumeral:D + \exp:w \fi: \else: \@@_parse_return_semicolon:w \c_zero #1 @@ -1362,7 +1390,7 @@ \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \c_one \exp_after:wN \@@_parse_round_up:N - \tex_romannumeral:D + \exp:w \else: \@@_parse_return_semicolon:w \c_one #1 \fi: @@ -1413,7 +1441,7 @@ \exp_after:wN \@@_parse_round_after:wN \int_use:N \__int_eval:w \c_zero * \__int_eval:w \c_zero \exp_after:wN \@@_parse_round_loop:N - \tex_romannumeral:D + \exp:w \else: \@@_parse_exponent:Nw #2 \fi: @@ -1465,7 +1493,7 @@ \if:w . \exp_not:N #2 \exp_after:wN \@@_parse_small_round:NN \exp_after:wN #1 - \tex_romannumeral:D + \exp:w \else: \@@_parse_exponent:Nw #2 \fi: @@ -1479,7 +1507,7 @@ \if:w . \exp_not:N #3 + \c_zero * \__int_eval:w \c_zero \exp_after:wN \@@_parse_round_loop:N - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN ; \exp_after:wN \c_zero @@ -1548,7 +1576,7 @@ { \if:w e \exp_not:N #1 \exp_after:wN \@@_parse_exponent_aux:N - \tex_romannumeral:D + \exp:w \else: 0 \@@_parse_return_semicolon:w #1 \fi: @@ -1574,7 +1602,7 @@ { \if:w + \if:w - \exp_not:N #1 + \fi: \token_to_str:N #1 \exp_after:wN \@@_parse_exponent_sign:N - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN \@@_parse_exponent_body:N \exp_after:wN #1 @@ -1592,13 +1620,13 @@ \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: \token_to_str:N #1 \exp_after:wN \@@_parse_exponent_digits:N - \tex_romannumeral:D + \exp:w \else: \@@_parse_exponent_keep:NTF #1 { \@@_parse_return_semicolon:w #1 } { \exp_after:wN ; - \tex_romannumeral:D + \exp:w } \fi: \@@_parse_expand:w @@ -1619,7 +1647,7 @@ \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: \token_to_str:N #1 \exp_after:wN \@@_parse_exponent_digits:N - \tex_romannumeral:D + \exp:w \else: \@@_parse_return_semicolon:w #1 \fi: @@ -1697,12 +1725,12 @@ % after the calculation, |#4| is the operand, and |#5| is a % |\__fp_parse_infix_...:N| function. We feed the data~|#2|, and the % argument~|#4|, to the function~|#3|, which expands -% \cs{tex_romannumeral:D} thus the \texttt{infix} function~|#5|. +% \cs{exp:w} thus the \texttt{infix} function~|#5|. % \begin{macrocode} \cs_new:Npn \@@_parse_apply_unary:NNNwN #1#2#3#4@#5 { #3 #2 #4 @ - \tex_romannumeral:D -`0 #5 #1 + \exp:w \exp_end_continue_f:w #5 #1 } % \end{macrocode} % \end{macro} @@ -1722,7 +1750,7 @@ \exp_after:wN ##1 \exp_after:wN #4 \exp_after:wN #3 - \tex_romannumeral:D + \exp:w \if_int_compare:w #2 < ##1 \@@_parse_operand:Nw ##1 \else: @@ -1748,7 +1776,7 @@ { \exp_after:wN \@@_parse_infix_after_operand:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \@@_sanitize:wN \int_use:N \__int_eval:w \c_zero \@@_parse_strim_zeros:N } @@ -1774,7 +1802,7 @@ { \exp_after:wN \@@_parse_lparen_after:NwN \exp_after:wN #1 - \tex_romannumeral:D + \exp:w \if_int_compare:w #1 = \c_sixteen \@@_parse_operand:Nw \c_one \else: @@ -1789,7 +1817,7 @@ \@@_exp_after_array_f:w #2 \s_@@_stop \exp_after:wN \@@_parse_infix:NN \exp_after:wN #1 - \tex_romannumeral:D \@@_parse_expand:w + \exp:w \@@_parse_expand:w } { \__msg_kernel_expandable_error:nnn @@ -1816,7 +1844,7 @@ \cs_set_protected:Npn \@@_tmp:w #1 #2 { \cs_new_nopar:cpn { @@_parse_word_#1:N } - { \exp_after:wN #2 \tex_romannumeral:D -`0 \@@_parse_infix:NN } + { \exp_after:wN #2 \exp:w \exp_end_continue_f:w \@@_parse_infix:NN } } \@@_tmp:w { inf } \c_inf_fp \@@_tmp:w { nan } \c_nan_fp @@ -1871,7 +1899,7 @@ \exp_after:wN \@@_from_dim_test:ww \exp_after:wN 0 \exp_after:wN , \__int_value:w \__dim_eval:w 1 #1 \exp_after:wN ; - \tex_romannumeral:D -`0 \@@_parse_infix:NN + \exp:w \exp_end_continue_f:w \@@_parse_infix:NN } } % \end{macrocode} @@ -1895,7 +1923,7 @@ \exp_after:wN #3 \exp_after:wN #2 \cs:w @@_#1_o:w \exp_after:wN \cs_end: - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_fifteen \@@_parse_expand:w } \cs_new:Npn \@@_parse_function:NNN #1#2#3 @@ -1904,7 +1932,7 @@ \exp_after:wN #3 \exp_after:wN #2 \exp_after:wN #1 - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w } % \end{macrocode} @@ -2037,7 +2065,7 @@ % % \begin{macro}[int, EXP]{\@@_parse:n} % \begin{macro}[aux, EXP]{\@@_parse_after:ww} -% Start a \tn{romannumeral} expansion so that \cs{@@_parse:n} expands +% Start an \cs{exp:w} expansion so that \cs{@@_parse:n} expands % in two steps. The \cs{@@_parse_operand:Nw} function will perform % computations until reaching an operation with precedence % \cs{c_minus_one} or less, namely, the end of the expression. The @@ -2045,13 +2073,13 @@ % parsed version of an infix operator, and \cs{@@_parse_infix_end:N} % has infinitely negative precedence. Finally, clean up a % (well-defined) set of extra tokens and stop the initial expansion -% with \cs{c_zero}. +% with \cs{exp_end:}. % \begin{macrocode} \cs_new:Npn \@@_parse:n #1 { - \tex_romannumeral:D + \exp:w \exp_after:wN \@@_parse_after:ww - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_minus_one \@@_parse_expand:w #1 \s_@@_mark \@@_parse_infix_end:N @@ -2059,7 +2087,7 @@ } \cs_new:Npn \@@_parse_after:ww #1@ \@@_parse_infix_end:N \s_@@_stop - { \c_zero #1 } + { \exp_end: #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -2069,18 +2097,18 @@ % The \cs{@@_parse_operand} % This is just a shorthand which sets up both \cs{@@_parse_continue} % and \cs{@@_parse_one} with the same precedence. Note the -% trailing \cs{tex_romannumeral:D}. This function should be +% trailing \cs{exp:w}. This function should be % used with much care. % \begin{macrocode} \cs_new:Npn \@@_parse_operand:Nw #1 { - -`0 + \exp_end_continue_f:w \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \@@_parse_one:Nw \exp_after:wN #1 - \tex_romannumeral:D + \exp:w } \cs_new:Npn \@@_parse_continue:NwN #1 #2 @ #3 { #3 #1 #2 @ } % \end{macrocode} @@ -2096,8 +2124,8 @@ { \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #1 - \tex_romannumeral:D -`0 \cs:w @@_#3_o:ww \cs_end: #2 #4 - \tex_romannumeral:D -`0 #5 #1 + \exp:w \exp_end_continue_f:w \cs:w @@_#3_o:ww \cs_end: #2 #4 + \exp:w \exp_end_continue_f:w #5 #1 } % \end{macrocode} % \end{macro} @@ -2155,7 +2183,7 @@ \else: \exp_after:wN #1 \exp_after:wN #2 - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \fi: } \group_end: @@ -2196,7 +2224,7 @@ \__msg_kernel_expandable_error:nnn { kernel } { fp-extra } { ) } \exp_after:wN \@@_parse_infix:NN \exp_after:wN #1 - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN @ \exp_after:wN \use_none:n @@ -2220,10 +2248,10 @@ \else: \if_int_compare:w #1 = \c_one \exp_after:wN \@@_parse_infix_comma:w - \tex_romannumeral:D + \exp:w \else: \exp_after:wN \@@_parse_infix_comma_gobble:w - \tex_romannumeral:D + \exp:w \fi: \@@_parse_operand:Nw \c_one \exp_after:wN \@@_parse_expand:w @@ -2250,7 +2278,7 @@ % } % \begin{macro}[aux, EXP]+\@@_parse_infix_^:N+ As described in the % \enquote{work plan}, each infix operator has an associated -% \cs{infix} function, a computing function, and precedence, given as +% |\..._infix_...| function, a computing function, and precedence, given as % arguments to \cs{@@_tmp:w}. Using the general mechanism for % arithmetic operations. The power operation must be associative in % the opposite order from all others. For this, we use two distinct @@ -2277,7 +2305,7 @@ \exp_after:wN @ \exp_after:wN \@@_parse_apply_binary:NwNwN \exp_after:wN #2 - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw #4 \exp_after:wN \@@_parse_expand:w \else: @@ -2326,7 +2354,7 @@ \if_int_compare:w #1 < \c_ten \exp_after:wN @ \exp_after:wN \@@_parse_apply_juxtapose:NwwN - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_ten \exp_after:wN \@@_parse_expand:w \else: @@ -2381,7 +2409,7 @@ \if:w | \exp_not:N #2 \exp_after:wN \@@_parse_infix_|:N \exp_after:wN #1 - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN \@@_parse_infix_or:N \exp_after:wN #1 @@ -2393,7 +2421,7 @@ \if:w & \exp_not:N #2 \exp_after:wN \@@_parse_infix_&:N \exp_after:wN #1 - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN \@@_parse_infix_and:N \exp_after:wN #1 @@ -2416,7 +2444,7 @@ \if_int_compare:w #1 < \c_three \exp_after:wN @ \exp_after:wN \@@_ternary:NwwN - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_three \exp_after:wN \@@_parse_expand:w \else: @@ -2432,7 +2460,7 @@ { kernel } { fp-missing } { ? } { ~for~?: } \exp_after:wN @ \exp_after:wN \@@_ternary_auxii:NwwN - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_two \exp_after:wN \@@_parse_expand:w \else: @@ -2527,7 +2555,7 @@ \exp_after:wN #3 \exp_after:wN #4 \exp_after:wN #5 - \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w + \exp:w \exp_after:wN \@@_parse_expand:w } \cs_new:Npn \@@_parse_compare_end:NNNNw #1#2#3#4#5 \fi: { @@ -2539,7 +2567,7 @@ \exp_after:wN #2 \exp_after:wN #3 \exp_after:wN #4 - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_seven \@@_parse_expand:w #5 } \cs_new:Npn \@@_parse_apply_compare:NwNNNNNwN @@ -2567,15 +2595,15 @@ \exp_after:wN \@@_parse_continue_compare:NNwNN \exp_after:wN #1 \exp_after:wN #2 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \@@_exp_after_o:w #3; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \else: \exp_after:wN \@@_parse_continue:NwN \exp_after:wN #2 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN #1 - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \fi: #4 #2 } @@ -2596,7 +2624,7 @@ { \exp_after:wN \@@_function_apply:nw \exp_after:wN #1 - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w } % \end{macrocode} @@ -2632,7 +2660,7 @@ \exp_after:wN #2 \__int_value:w #3 \exp_after:wN ; \exp_after:wN } - \tex_romannumeral:D + \exp:w \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w } \cs_new:Npn #2 #4 {#5} @@ -2715,6 +2743,13 @@ { Unexpected~comma:~extra~arguments~ignored. } \__msg_kernel_new:nnn { kernel } { fp-num-args } { #1~expects~between~#2~and~#3~arguments. } +%<*package> +\cs_if_exist:cT { @unexpandable@protect } + { + \__msg_kernel_new:nnn { kernel } { fp-robust-cmd } + { Robust~command~#1 invalid~in~fp~expression! } + } +%</package> % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index a277f1b8952..844e229fa1a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-round.dtx Copyright(C) 2011-2012,2014 The LaTeX3 Project +%% File: l3fp-round.dtx Copyright(C) 2011-2012,2014,2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-round.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3fp-round.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point rounding} \begin{document} \DocInput{\jobname.dtx} @@ -129,6 +129,9 @@ % \begin{macro}[aux, rEXP] % { % \@@_round_to_nearest:NNN, +% \@@_round_to_nearest_ninf:NNN, +% \@@_round_to_nearest_zero:NNN, +% \@@_round_to_nearest_pinf:NNN, % \@@_round_to_ninf:NNN, % \@@_round_to_zero:NNN, % \@@_round_to_pinf:NNN @@ -160,9 +163,13 @@ % than~$5$, round down. If it is exactly $5$, then round such that % \meta{digit_1} plus the result is even. In other words, round up if % \meta{digit_1} is odd. +% +% The \enquote{round to nearest} mode has three variants, which differ +% in how ties are rounded: down towards $-\infty$, truncated towards $0$, +% or up towards $+\infty$. % \begin{macrocode} \cs_new:Npn \@@_round_return_one: - { \exp_after:wN \c_one \tex_romannumeral:D } + { \exp_after:wN \c_one \exp:w } \cs_new:Npn \@@_round_to_ninf:NNN #1 #2 #3 { \if_meaning:w 2 #1 @@ -195,6 +202,39 @@ \fi: \c_zero } +\cs_new:Npn \@@_round_to_nearest_ninf:NNN #1 #2 #3 + { + \if_int_compare:w #3 > \c_five + \@@_round_return_one: + \else: + \if_meaning:w 5 #3 + \if_meaning:w 2 #1 + \@@_round_return_one: + \fi: + \fi: + \fi: + \c_zero + } +\cs_new:Npn \@@_round_to_nearest_zero:NNN #1 #2 #3 + { + \if_int_compare:w #3 > \c_five + \@@_round_return_one: + \fi: + \c_zero + } +\cs_new:Npn \@@_round_to_nearest_pinf:NNN #1 #2 #3 + { + \if_int_compare:w #3 > \c_five + \@@_round_return_one: + \else: + \if_meaning:w 5 #3 + \if_meaning:w 0 #1 + \@@_round_return_one: + \fi: + \fi: + \fi: + \c_zero + } \cs_new_eq:NN \@@_round:NNN \@@_round_to_nearest:NNN % \end{macrocode} % \end{macro} @@ -259,6 +299,9 @@ % \begin{macro}[aux, EXP] % { % \@@_round_to_nearest_neg:NNN, +% \@@_round_to_nearest_ninf_neg:NNN, +% \@@_round_to_nearest_zero_neg:NNN, +% \@@_round_to_nearest_pinf_neg:NNN, % \@@_round_to_ninf_neg:NNN, % \@@_round_to_zero_neg:NNN, % \@@_round_to_pinf_neg:NNN @@ -279,15 +322,7 @@ % It turns out that this negative \enquote{round to nearest} % is identical to the positive one. And this is the default mode. % \begin{macrocode} -\cs_new:Npn \@@_round_to_ninf_neg:NNN #1 #2 #3 - { - \if_meaning:w 0 #1 - \if_int_compare:w #3 > \c_zero - \@@_round_return_one: - \fi: - \fi: - \c_zero - } +\cs_new_eq:NN \@@_round_to_ninf_neg:NNN \@@_round_to_pinf:NNN \cs_new:Npn \@@_round_to_zero_neg:NNN #1 #2 #3 { \if_int_compare:w #3 > \c_zero @@ -295,16 +330,17 @@ \fi: \c_zero } -\cs_new:Npn \@@_round_to_pinf_neg:NNN #1 #2 #3 +\cs_new_eq:NN \@@_round_to_pinf_neg:NNN \@@_round_to_ninf:NNN +\cs_new_eq:NN \@@_round_to_nearest_neg:NNN \@@_round_to_nearest:NNN +\cs_new_eq:NN \@@_round_to_nearest_ninf_neg:NNN \@@_round_to_nearest_pinf:NNN +\cs_new:Npn \@@_round_to_nearest_zero_neg:NNN #1 #2 #3 { - \if_meaning:w 2 #1 - \if_int_compare:w #3 > \c_zero - \@@_round_return_one: - \fi: + \if_int_compare:w #3 > \c_four + \@@_round_return_one: \fi: \c_zero } -\cs_new_eq:NN \@@_round_to_nearest_neg:NNN \@@_round_to_nearest:NNN +\cs_new_eq:NN \@@_round_to_nearest_pinf_neg:NNN \@@_round_to_nearest_ninf:NNN \cs_new_eq:NN \@@_round_neg:NNN \@@_round_to_nearest_neg:NNN % \end{macrocode} % \end{macro} @@ -315,20 +351,57 @@ % ^^A todo: This macro is intermingled with l3fp-parse. % ^^A todo: Add explanations. % \begin{macro}[aux,EXP]{\@@_round_o:Nw} -% This function expects one or two arguments. +% The |trunc|, |ceil| and |floor| functions expect one or two +% arguments (the second is $0$ by default), and the |round| function +% also accepts a third argument (\texttt{nan} by default), which +% will change |#1| from \cs{@@_round_to_nearest:NNN} to one of its +% analogues. % \begin{macrocode} \cs_new:Npn \@@_round_o:Nw #1#2 @ { \if_case:w \__int_eval:w \@@_array_count:n {#2} - \c_one \__int_eval_end: - \@@_round:Nwn #1 #2 {0} \tex_romannumeral:D - \or: \@@_round:Nww #1 #2 \tex_romannumeral:D - \else: - \@@_error:nffn { num-args } - { \@@_round_name_from_cs:N #1 () } { 1 } { 2 } - \exp_after:wN \c_nan_fp \tex_romannumeral:D + \@@_round:Nwn #1 #2 {0} \exp:w + \or: \@@_round:Nww #1 #2 \exp:w + \else: \@@_round:Nwww #1 #2 @ \exp:w \fi: - -`0 + \exp_end_continue_f:w + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_round:Nwww} +% Having three arguments is only allowed for |round|, not |trunc|, +% |ceil|, |floor|, so check for that case. If all is well, construct +% one of \cs{@@_round_to_nearest:NNN}, \cs{@@_round_to_nearest_zero:NNN}, +% \cs{@@_round_to_nearest_ninf:NNN}, \cs{@@_round_to_nearest_pinf:NNN} +% and act accordingly. +% \begin{macrocode} +\cs_new:Npn \@@_round:Nwww #1#2 ; #3 ; \s_@@ \@@_chk:w #4#5#6 ; #7 @ + { + \cs_if_eq:NNTF #1 \@@_round_to_nearest:NNN + { + \tl_if_empty:nTF {#7} + { + \exp_args:Nc \@@_round:Nww + { + @@_round_to_nearest + \if_meaning:w 0 #4 _zero \else: + \if_case:w #5 \exp_stop_f: _pinf \or: \else: _ninf \fi: \fi: + :NNN + } + #2 ; #3 ; + } + { + \@@_error:nnnn { num-args } { round () } { 1 } { 3 } + \exp_after:wN \c_nan_fp + } + } + { + \@@_error:nffn { num-args } + { \@@_round_name_from_cs:N #1 () } { 1 } { 2 } + \exp_after:wN \c_nan_fp + } } % \end{macrocode} % \end{macro} @@ -421,7 +494,7 @@ } \cs_new:Npn \@@_round_normal_end:wwNnn #1;#2;#3#4#5 { - \exp_after:wN \@@_exp_after_o:w \tex_romannumeral:D -`0 + \exp_after:wN \@@_exp_after_o:w \exp:w \exp_end_continue_f:w \@@_sanitize:Nw #3 #4 ; #1 ; } \cs_new:Npn \@@_round_special:NwwNnn #1#2;#3;#4#5#6 @@ -439,7 +512,7 @@ } \cs_new:Npn \@@_round_special_aux:Nw #1#2; { - \exp_after:wN \@@_exp_after_o:w \tex_romannumeral:D -`0 + \exp_after:wN \@@_exp_after_o:w \exp:w \exp_end_continue_f:w \@@_sanitize:Nw #1#2; {1000}{0000}{0000}{0000}; } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 98917baea7d..d40149175ef 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-trig.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3fp-trig.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Floating-point trigonometric functions} \begin{document} \DocInput{\jobname.dtx} @@ -403,7 +403,7 @@ \exp_after:wN \@@_pack_twice_four:wNNNNNNNN \exp_after:wN \@@_trigd_large_auxi:nnnnwNNNN \exp_after:wN ; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \prg_replicate:nn { \int_max:nn { 22 - #1 } { 0 } } { 0 } #2#3#4#5#6#7 0000 0000 0000 ! } @@ -1068,12 +1068,12 @@ \if_case:w \__int_eval:w \@@_array_count:n {#5} - \c_one \__int_eval_end: \exp_after:wN #1 \exp_after:wN #4 \c_one_fp #5 - \tex_romannumeral:D - \or: #2 #4 #5 \tex_romannumeral:D + \exp:w + \or: #2 #4 #5 \exp:w \else: \__msg_kernel_expandable_error:nnnnn { kernel } { fp-num-args } { #3() } { 1 } { 2 } - \exp_after:wN \c_nan_fp \tex_romannumeral:D + \exp_after:wN \c_nan_fp \exp:w \fi: \exp_after:wN \c_zero } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 11904a346c9..1fcd1749003 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp.dtx Copyright (C) 2011-2014 The LaTeX3 Project +%% File: l3fp.dtx Copyright (C) 2011-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3fp.dtx 5652 2015-07-09 13:11:22Z joseph $ +\GetIdInfo$Id: l3fp.dtx 5890 2015-08-25 07:47:22Z joseph $ {L3 Floating points} %</driver|package> %<*driver> @@ -114,11 +114,13 @@ % $\operatorname{asech} x$, $\operatorname{acsch} x$. % \item Extrema: $\max(x,y,\ldots)$, $\min(x,y,\ldots)$, % $\operatorname{abs}(x)$. -% \item Rounding functions: $\operatorname{round}(x,n)$ rounds to -% closest value (with ties rounding to even values), +% \item Rounding functions ($n=0$ by default, $t=\nan$ by default): % $\operatorname{trunc}(x,n)$ rounds towards zero, % $\operatorname{floor}(x,n)$ rounds towards~$-\infty$, -% $\operatorname{ceil}(x,n)$ rounds towards~$+\infty$. And +% $\operatorname{ceil}(x,n)$ rounds towards~$+\infty$, +% $\operatorname{round}(x,n,t)$ rounds to the closest value, with +% ties rounded to an even value by default, towards zero if $t=0$, +% towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$. And % \emph{(not yet)} modulo, and \enquote{quantize}. % \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). % \item Dimensions, automatically expressed in points, \emph{e.g.}, @@ -312,7 +314,8 @@ % \end{quote} % The leading \meta{digit} is non-zero except in the case of $\pm 0$. % The values $\pm\infty$ and~\nan{} trigger an \enquote{invalid -% operation} exception. +% operation} exception. The entire representation is in the form of +% a string (tokens of category code~$12$), \emph{including} the |e|. % \end{function} % % \begin{function}[EXP, updated = 2012-07-08, tested = m3fp-convert003] @@ -677,7 +680,7 @@ % % \section{Viewing floating points} % -% \begin{function}[added = 2012-05-08, updated = 2012-08-14, +% \begin{function}[added = 2012-05-08, updated = 2015-08-07, % tested = m3fp002]{\fp_show:N, \fp_show:c, \fp_show:n} % \begin{syntax} % \cs{fp_show:N} \meta{fp~var} @@ -940,24 +943,30 @@ % \end{function} % % \begin{function}^^A -% [tested = {m3fp-round001, m3fp-round002}, added = 2013-12-14] +% [tested = {m3fp-round001, m3fp-round002}, added = 2013-12-14, updated = 2015-08-08] % {round, trunc, ceil, floor} % \begin{syntax} % \cs{fp_eval:n} \{ |round| |(| \meta{fpexpr} |)| \} % \cs{fp_eval:n} \{ |round| |(| \meta{fpexpr_1} , \meta{fpexpr_2} |)| \} +% \cs{fp_eval:n} \{ |round| |(| \meta{fpexpr_1} , \meta{fpexpr_2} , \meta{fpexpr_3} |)| \} % \end{syntax} -% Evaluates $\meta{fpexpr_1}=x$ and $\meta{fpexpr_2}=n$, then rounds +% Only |round| accepts a third argument. +% Evaluates $\meta{fpexpr_1}=x$ and $\meta{fpexpr_2}=n$ and $\meta{fpexpr_3}=t$ then rounds % $x$~to $n$~places. If $n$~is an integer, this rounds~$x$ to a % multiple of~$10^{-n}$; if $n=+\infty$, this always yields~$x$; if % $n=-\infty$, this yields one of $\pm 0$, $\pm\infty$, or~\nan{}; if % $n$~is neither $\pm\infty$ nor an integer, then an \enquote{invalid % operation} exception is raised. When \meta{fpexpr_2} is omitted, % $n=0$, \emph{i.e.}, \meta{fpexpr_1} is rounded to an integer. The -% rounding direction depends on the function: +% rounding direction depends on the function. % \begin{itemize} -% \item |round| yields the multiple of~$10^{-n}$ closest to~$x$, and -% if $x$~is half-way between two such multiples, the even multiple -% is chosen (\enquote{ties to even}); +% \item |round| yields the multiple of~$10^{-n}$ closest to~$x$, +% with ties ($x$ half-way between two such multiples) rounded +% as follows. If $t$ is \texttt{nan} or not given the even +% multiple is chosen (\enquote{ties to even}), if $t=\pm 0$ the +% multiple closest to $0$ is chosen (\enquote{ties to zero}), +% if $t$ is positive/negative the multiple closest to $\infty$/$-\infty$ is chosen +% (\enquote{ties towards positive/negative infinity}). % \item |floor|, or the deprecated |round-|, yields the largest % multiple of~$10^{-n}$ smaller or equal to~$x$ (\enquote{round % towards negative infinity}); diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 7ea0628b831..ad438e06a72 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3int.dtx 5659 2015-07-14 18:58:00Z joseph $ +\GetIdInfo$Id: l3int.dtx 5885 2015-08-24 13:29:14Z mittelba $ {L3 Integers} %</driver|package> %<*driver> @@ -142,7 +142,8 @@ % Evaluates the two \meta{integer expressions} as described earlier, % then divides the first value by the second, and rounds the result % towards zero. Note that division using |/| -% rounds the result. The result is left in the input stream as an +% rounds to the closest integer instead. +% The result is left in the input stream as an % \meta{integer denotation} after two expansions. % \end{function} % @@ -780,7 +781,7 @@ % Displays the value of the \meta{integer} on the terminal. % \end{function} % -% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\int_show:n} +% \begin{function}[added = 2011-11-22, updated = 2015-08-07]{\int_show:n} % \begin{syntax} % \cs{int_show:n} \Arg{integer expression} % \end{syntax} @@ -1230,10 +1231,10 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\int_set_eq:NN,\int_set_eq:cN, \int_set_eq:Nc,\int_set_eq:cc} +% \begin{macro}{\int_set_eq:NN, \int_set_eq:cN, \int_set_eq:Nc, \int_set_eq:cc} % \UnitTested % \begin{macro} -% {\int_gset_eq:NN,\int_gset_eq:cN, \int_gset_eq:Nc,\int_gset_eq:cc} +% {\int_gset_eq:NN, \int_gset_eq:cN, \int_gset_eq:Nc, \int_gset_eq:cc} % \UnitTested % Setting equal means using one integer inside the set function of % another. @@ -1546,22 +1547,22 @@ % \begin{macrocode} \cs_new:Npn \int_case:nnTF #1 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } } \cs_new:Npn \int_case:nnT #1#2#3 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} {#3} { } } \cs_new:Npn \int_case:nnF #1#2 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} { } } \cs_new:Npn \int_case:nn #1#2 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} { } { } } \cs_new:Npn \@@_case:nnTF #1#2#3#4 @@ -1907,7 +1908,7 @@ % \begin{macro}{\int_to_base:nn, \int_to_Base:nn} % \UnitTested % \begin{macro}[aux]{\@@_to_base:nn, \@@_to_Base:nn, -% \@@_to_base:nnN,\@@_to_Base:nnN,\@@_to_base:nnnN,\@@_to_Base:nnnN} +% \@@_to_base:nnN, \@@_to_Base:nnN, \@@_to_base:nnnN, \@@_to_Base:nnnN} % \begin{macro}[aux]{\@@_to_letter:n, \@@_to_Letter:n} % \UnitTested % Converting from base ten (|#1|) to a second base (|#2|) starts with @@ -2326,22 +2327,34 @@ % % \subsection{Viewing integer} % -% \begin{macro}{\int_show:N,\int_show:c} +% \begin{macro}{\int_show:N, \int_show:c} % \UnitTested +% This is very similar to other registers done using +% \cs{__kernel_register_show:N}, but differs because the variable +% |#1| may be \tn{currentgrouplevel} or \tn{currentgrouptype}, in +% which case the value must be expanded in the current scope rather +% than when processing \cs{iow_wrap:nnnN}. % \begin{macrocode} -\cs_new_eq:NN \int_show:N \__kernel_register_show:N -\cs_new_eq:NN \int_show:c \__kernel_register_show:c +\cs_new_protected:Npn \int_show:N #1 + { + \use:x + { + \exp_not:n + { \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } } + { > ~ \token_to_str:N #1 = \tex_the:D #1 } + } + } +\cs_generate_variant:Nn \int_show:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\int_show:n} % \UnitTested % We don't use the \TeX{} primitive \tn{showthe} to show integer -% expressions: this gives a more unified output, since the closing -% brace is read by the integer expression in all cases. +% expressions: this gives a more unified output. % \begin{macrocode} -\cs_new_protected:Npn \int_show:n #1 - { \etex_showtokens:D \exp_after:wN { \int_use:N \@@_eval:w #1 } } +\cs_new_protected_nopar:Npn \int_show:n + { \__msg_show_wrap:Nn \int_eval:n } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index d8745a856f5..d29b7134957 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3keys.dtx 5684 2015-07-26 07:23:48Z joseph $ +\GetIdInfo$Id: l3keys.dtx 5869 2015-08-20 01:19:17Z bruno $ {L3 Key-value interfaces} %</driver|package> %<*driver> @@ -134,7 +134,7 @@ % \l_mymodule_tmp_tl .code:n = code % } % \end{verbatim} -% will create a key called \cs{l_mymodule_tmp_tl}, and not one called +% will create a key called |\l_mymodule_tmp_tl|, and not one called % \texttt{key}. % % \section{Creating keys} @@ -778,12 +778,12 @@ % itself is not defined. % \end{function} % -% \begin{function}{\keys_show:nn} +% \begin{function}[updated = 2015-08-09]{\keys_show:nn} % \begin{syntax} % \cs{keys_show:nn} \Arg{module} \Arg{key} % \end{syntax} -% Shows the function which is used to actually implement a -% \meta{key} for a \meta{module}. +% Shows the information associated to the \meta{key} for a \meta{module}, +% including the function which is used to actually implement it. % \end{function} % % \section{Low-level interface for parsing key--val lists} @@ -1314,9 +1314,9 @@ % |\cs_set_protected:cpn| not |\cs_new_protected:cpn| here. For the % same reason, to avoid issues if the key has been undefined in the % current scope but exists at a higher level, we do not use \cs{prop_new:c} -% but rather \cs{prop_set_eq:cN}. The use of \cs{__chk_if_free_cs:c} -% ensures that when logging of all new functions is active, keys -% still show up (as we are not using \cs{..._new}). +% but rather \cs{prop_set_eq:cN}. The function \cs{__chk_log:x} only +% writes to the log file if logging all new functions is active: without +% it keys would not show up (as we are not using \cs{..._new}). % \begin{macrocode} \cs_new_protected:Npn \@@_ensure_exist:n #1 { @@ -1326,7 +1326,7 @@ } \cs_if_exist:cF { \c_@@_code_root_tl #1 } { - \__chk_if_free_cs:c { \c_@@_code_root_tl #1 } + \__chk_log:x { Defining~key~#1~ \msg_line_context: } \cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 { } } } @@ -1413,7 +1413,7 @@ \cs_new_protected_nopar:Npn \@@_choice_make_aux:N #1 { \@@_cmd_set:nn { \l_keys_path_tl } { #1 {##1} } - \prop_put:cnn { \c__keys_info_root_tl \l_keys_path_tl } { choice } + \prop_put:cnn { \c_@@_info_root_tl \l_keys_path_tl } { choice } { true } \@@_cmd_set:nn { \l_keys_path_tl / unknown } { @@ -2278,12 +2278,46 @@ % \end{macro} % % \begin{macro}{\keys_show:nn} -% Showing a key is just a question of using the correct name. +% \begin{macro}[aux]{\@@_show:NN} +% To show a key, test for its existence to issue the correct message +% (same message, but with a |t| or |f| argument, then build the +% control sequences which contain the code and other information +% about the key, call an intermediate auxiliary which constructs the +% code that will be displayed to the terminal, and finally conclude +% with \cs{__msg_show_wrap:n}. % \begin{macrocode} \cs_new_protected:Npn \keys_show:nn #1#2 - { \cs_show:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } } + { + \keys_if_exist:nnTF {#1} {#2} + { + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key } + { \tl_to_str:n { #1 / #2 } } { t } { } { } + \exp_args:Ncc \@@_show:NN + { \c_@@_code_root_tl \tl_to_str:n { #1 / #2 } } + { \c_@@_info_root_tl \tl_to_str:n { #1 / #2 } } + } + { + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key } + { \tl_to_str:n { #1 / #2 } } { f } { } { } + \__msg_show_wrap:n { } + } + } +\cs_new_protected:Npn \@@_show:NN #1#2 + { + \use:x + { + \__msg_show_wrap:n + { + \exp_not:N \__msg_show_item_unbraced:nn { code } + { \token_get_replacement_spec:N #1 } + \exp_not:n + { \prop_map_function:NN #2 \__msg_show_item_unbraced:nn } + } + } + } % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Messages} % @@ -2316,7 +2350,7 @@ \__msg_kernel_new:nnnn { kernel } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { - The~module~'#2'~does~not~have~a~key~called~#1'.\\ + The~module~'#2'~does~not~have~a~key~called~'#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \__msg_kernel_new:nnnn { kernel } { nested-choice-key } @@ -2346,10 +2380,10 @@ this~property~is~not~defined. } \__msg_kernel_new:nnnn { kernel } { value-forbidden } - { The~key~'#1'~does~not~taken~a~value. } + { The~key~'#1'~does~not~take~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ - LaTeX~will~ignore~the~given~value~'#2'. + The~value~'#2'~was~present:~the~key~will~be~ignored. } \__msg_kernel_new:nnnn { kernel } { value-required } { The~key~'#1'~requires~a~value. } @@ -2357,6 +2391,13 @@ The~key~'#1'~must~have~a~value.\\ No~value~was~present:~the~key~will~be~ignored. } +\__msg_kernel_new:nnn { kernel } { show-key } + { + The~key~#1~ + \str_if_eq:nnTF {#2} { t } + { has~the~properties: } + { is~undefined. } + } % \end{macrocode} % % \subsection{Deprecated functions} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index c644a10cec6..601d5cf0564 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3msg.dtx 5537 2015-02-26 21:25:23Z joseph $ +\GetIdInfo$Id: l3msg.dtx 5891 2015-08-25 08:00:59Z mittelba $ {L3 Messages} %</driver|package> %<*driver> @@ -708,40 +708,68 @@ % % The following functions are used in several kernel modules. % -% \begin{function} +% \begin{function}[added = 2015-08-05]{\__msg_log_next:} +% \begin{syntax} +% \cs{__msg_log_next:} \meta{show-command} +% \end{syntax} +% Causes the next \meta{show-command} to send its output to the log +% file instead of the terminal. This allows for instance +% \cs{cs_log:N} to be defined as \cs{__msg_log_next:} \cs{cs_show:N}. +% The effect of this command lasts until the next use of +% \cs{__msg_show_wrap:Nn} or \cs{__msg_show_wrap:n} or +% \cs{__msg_show_variable:NNNnn}, in other words until the next time +% the \eTeX{} primitive \tn{showtokens} would have been used for +% showing to the terminal or until the next +% \texttt{variable-not-defined} error. +% \end{function} +% +% \begin{function}[added = 2015-08-05] % { -% \__msg_term:nnnnnn, -% \__msg_term:nnnnnV, -% \__msg_term:nnnnn, -% \__msg_term:nnn , -% \__msg_term:nn +% \__msg_show_pre:nnnnnn, +% \__msg_show_pre:nnxxxx, +% \__msg_show_pre:nnnnnV % } % \begin{syntax} -% \cs{__msg_term:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_show_pre:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \end{syntax} +% Prints the \meta{message} from \meta{module} in the terminal (or +% log file if \cs{__msg_log_next:} was issued) without formatting. +% Used in messages which print complex variable contents completely. +% \end{function} +% +% \begin{function}[added = 2015-08-04]{\__msg_show_variable:NNNnn} +% \begin{syntax} +% \cs{__msg_show_variable:NNNnn} \meta{variable} \meta{if-exist} \meta{if-empty} \Arg{msg} \Arg{formatted content} % \end{syntax} -% Prints the \meta{message} from \meta{module} in the terminal without -% formatting. Used in messages which print complex variable contents -% completely. +% If the \meta{variable} does not exist according to \meta{if-exist} +% (typically \cs{cs_if_exist:NTF}) then throw an error and do nothing +% more. Otherwise, if \meta{msg} is not empty, display the message +% |LaTeX/kernel/show-|\meta{msg} with \cs{token_to_str:N} +% \meta{variable} as a first argument, and a second argument that is +% |?| or empty depending on the result of \meta{if-empty} (typically +% \cs{tl_if_empty:NTF}) on the \meta{variable}. Then display the +% \meta{formatted content} by giving it as an argument to +% \cs{__msg_show_wrap:n}. % \end{function} % -% \begin{function}[updated = 2012-09-09]{\__msg_show_variable:Nnn} +% \begin{function}[added = 2015-08-03, updated = 2015-08-07]{\__msg_show_wrap:Nn} % \begin{syntax} -% \cs{__msg_show_variable:Nnn} \meta{variable} \Arg{type} \Arg{formatted content} +% \cs{__msg_show_wrap:Nn} \meta{function} \Arg{expression} % \end{syntax} -% Displays the \meta{formatted content} of the \meta{variable} of -% \meta{type} in the terminal. The \meta{formatted content} will be -% processed as the first argument in a call to \cs{iow_wrap:nnnN}, -% hence |\\|, \verb*|\ | and other formatting sequences can be used. -% Once expanded and processed, the \meta{formatted content} must -% either be empty or contain |>|; everything until the first |>| will -% be removed. +% Shows or logs the \meta{expression} (turned into a string), an +% equal sign, and the result of applying the \meta{function} to the +% \Arg{expression}. For instance, if the \meta{function} is +% \cs{int_eval:n} and the \meta{expression} is |1+2| then this will +% log |> 1+2=3.| The case where the \meta{function} is +% \cs{tl_to_str:n} is special: then the string representation of the +% \meta{expression} is only logged once. % \end{function} % -% \begin{function}[updated = 2012-09-09]{\__msg_show_variable:n} +% \begin{function}[added = 2015-08-03]{\__msg_show_wrap:n} % \begin{syntax} -% \cs{__msg_show_variable:n} \Arg{formatted text} +% \cs{__msg_show_wrap:n} \Arg{formatted text} % \end{syntax} -% Shows the \meta{formatted text} on the terminal. After expansion, +% Shows or logs the \meta{formatted text}. After expansion, % unless it is empty, the \meta{formatted text} must contain |>|, % and the part of \meta{formatted text} before the first |>| is % removed. Failure to do so causes low-level \TeX{} errors. @@ -753,8 +781,9 @@ % \cs{__msg_show_item:n} \meta{item} % \cs{__msg_show_item:nn} \meta{item-key} \meta{item-value} % \end{syntax} -% Auxiliary functions used within the argument of -% \cs{__msg_show_variable:Nnn} to format variable items correctly for +% Auxiliary functions used within the last argument of +% \cs{__msg_show_variable:NNNnn} or \cs{__msg_show_wrap:n} +% to format variable items correctly for % display. The \cs{__msg_show_item:n} version is used for simple lists, % the \cs{__msg_show_item:nn} and \cs{__msg_show_item_unbraced:nn} versions % for key--value like data structures. @@ -831,7 +860,7 @@ } } %<*package> -\tex_ifodd:D \l@expl@log@functions@bool +\if_bool:N \l@expl@log@functions@bool \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} @@ -839,7 +868,7 @@ \@@_kernel_error:nnxx { kernel } { message-already-defined } {#1} {#2} } - \iow_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } + \__chk_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \fi: %</package> @@ -847,7 +876,7 @@ % \end{macro} % % \begin{macro}{\msg_new:nnnn, \msg_new:nnn} -% \begin{macro}{\msg_gset:nnnn,\msg_gset: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. @@ -1924,30 +1953,36 @@ % \begin{macrocode} \@@_kernel_new:nnn { kernel } { show-clist } { - The~comma~list~ - \str_if_eq:nnF {#1} { \l__clist_internal_clist } { \token_to_str:N #1~} - \clist_if_empty:NTF #1 + The~comma~list~ \tl_if_empty:nF {#1} { #1 ~ } + \tl_if_empty:nTF {#2} { is~empty } { contains~the~items~(without~outer~braces): } } \@@_kernel_new:nnn { kernel } { show-prop } { - The~property~list~\token_to_str:N #1~ - \prop_if_empty:NTF #1 + The~property~list~#1~ + \tl_if_empty:nTF {#2} { is~empty } { contains~the~pairs~(without~outer~braces): } } \@@_kernel_new:nnn { kernel } { show-seq } { - The~sequence~\token_to_str:N #1~ - \seq_if_empty:NTF #1 + The~sequence~#1~ + \tl_if_empty:nTF {#2} { is~empty } { contains~the~items~(without~outer~braces): } } -\@@_kernel_new:nnn { kernel } { show-no-stream } - { No~ #1 ~streams~are~open } -\@@_kernel_new:nnn { kernel } { show-open-streams } - { The~following~ #1 ~streams~are~in~use: } +\@@_kernel_new:nnn { kernel } { show-streams } + { + \tl_if_empty:nTF {#2} { No~ } { The~following~ } + \str_case:nn {#1} + { + { ior } { input ~ } + { iow } { output ~ } + } + streams~are~ + \tl_if_empty:nTF {#2} { open } { in~use: } + } % \end{macrocode} % % \subsection{Expandable errors} @@ -1968,9 +2003,9 @@ % 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 +% dropping everything else until \cs{q_stop}. The \cs{exp_end:} prevents % losing braces around the user-inserted text if any, and stops the -% expansion of \tn{romannumeral}. +% expansion of \cs{exp:w}. % \begin{macrocode} \group_begin: \char_set_catcode_math_superscript:N \^ @@ -1984,11 +2019,11 @@ { \exp_not:n { - \tex_romannumeral:D + \exp:w \exp_after:wN \exp_after:wN \exp_after:wN \@@_expandable_error:w \exp_after:wN \exp_after:wN - \exp_after:wN \c_zero + \exp_after:wN \exp_end: } \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^ } @@ -2049,96 +2084,177 @@ % Functions defined in this section are used for diagnostic functions % in \pkg{l3clist}, \pkg{l3file}, \pkg{l3prop}, \pkg{l3seq}, \pkg{xtemplate} % -% \begin{macro}[int] -% {\@@_term:nnnnnn, \@@_term:nnnnnV} -% \begin{macro}[int]{\@@_term:nnnnn} -% \begin{macro}[int]{\@@_term:nnn} -% \begin{macro}[int]{\@@_term:nn} -% Print the text of a message to the terminal without formatting: -% short cuts around \cs{iow_wrap:nnnN}. +% \begin{variable}{\g_@@_log_next_bool} +% \begin{macro}[int]{\@@_log_next:} +% \begin{macrocode} +\bool_new:N \g_@@_log_next_bool +\cs_new_protected_nopar:Npn \@@_log_next: + { \bool_gset_true:N \g_@@_log_next_bool } +% \end{macrocode} +% \end{macro} +% \end{variable} +% +% \begin{macro}[int]{\@@_show_pre:nnnnnn, \@@_show_pre:nnxxxx, \@@_show_pre:nnnnnV} +% \begin{macro}[aux]{\@@_show_pre_aux:n} +% Print the text of a message to the terminal or log file without +% formatting: short cuts around \cs{iow_wrap:nnnN}. The choice of +% terminal or log file is done by \cs{@@_show_pre_aux:n}. % \begin{macrocode} -\cs_new_protected:Npn \@@_term:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_show_pre:nnnnnn #1#2#3#4#5#6 { - \iow_wrap:nnnN - { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - { } { } \iow_term:n + \exp_args:Nx \iow_wrap:nnnN + { + \exp_not:c { \c_@@_text_prefix_tl #1 / #2 } + { \tl_to_str:n {#3} } + { \tl_to_str:n {#4} } + { \tl_to_str:n {#5} } + { \tl_to_str:n {#6} } + } + { } { } \@@_show_pre_aux:n } -\cs_generate_variant:Nn \@@_term:nnnnnn { nnnnnV } -\cs_new_protected:Npn \@@_term:nnnnn #1#2#3#4#5 - { \@@_term:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \@@_term:nnn #1#2#3 - { \@@_term:nnnnnn {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \@@_term:nn #1#2 - { \@@_term:nnnnnn {#1} {#2} { } { } { } { } } +\cs_new_protected:Npn \@@_show_pre:nnxxxx #1#2#3#4#5#6 + { + \use:x + { \exp_not:n { \@@_show_pre:nnnnnn {#1} {#2} } {#3} {#4} {#5} {#6} } + } +\cs_generate_variant:Nn \@@_show_pre:nnnnnn { nnnnnV } +\cs_new_protected_nopar:Npn \@@_show_pre_aux:n + { \bool_if:NTF \g_@@_log_next_bool { \iow_log:n } { \iow_term:n } } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}[int]{\@@_show_variable:Nnn} -% \begin{macro}[int]{\@@_show_variable:n} -% \begin{macro}[aux]{\@@_show_variable_aux:n} -% \begin{macro}[aux, EXP]{\@@_show_variable_aux:w} -% The arguments of \cs{@@_show_variable:Nnn} are +% \begin{macro}[int]{\@@_show_variable:NNNnn} +% The arguments of \cs{@@_show_variable:NNNnn} are % \begin{itemize} -% \item The \meta{variable} to be shown. -% \item The type of the variable. -% \item A mapping of the form \cs{seq_map_function:NN} \meta{variable} -% \cs{@@_show_item:n}, which produces the formatted string. +% \item The \meta{variable} to be shown as |#1|. +% \item An \meta{if-exist} conditional |#2| with \texttt{NTF} +% signature. +% \item An \meta{if-empty} conditional |#3| or other function with +% \texttt{NTF} signature (sometimes \cs{use_ii:nnn}). +% \item The \meta{message} |#4| to use. +% \item A construction |#5| which produces the formatted string +% eventually passed to the \tn{showtokens} primitive. Typically +% this is a mapping of the form \cs{seq_map_function:NN} +% \meta{variable} \cs{@@_show_item:n}. % \end{itemize} -% As for \cs{__kernel_register_show:N}, check that the variable is -% defined. If it is, output the introductory message, then show the -% contents |#3| using \cs{@@_show_variable:n}. This wraps the -% contents (with leading \verb*|> |) to a fixed number of characters -% per line. The expansion of |#3| may either be empty or start with -% \verb*|> |. A leading |>|, if present, is removed using a -% \texttt{w}-type auxiliary, as well as a space following it (via -% \texttt{f}-expansion). Note that we cannot remove the space as a -% delimiter for the \texttt{w}-type auxiliary, because a line-break -% may be taken there, and the space would then disappear. Finally, -% the resulting token list \cs{l_@@_internal_tl} is displayed to the -% terminal, with an odd \cs{exp_after:wN} which expands the closing -% brace to improve the output slightly. -% The calls to \cs{__iow_with:Nnn} ensure that the \tn{newlinechar} is -% set to~$10$ so that the \cs{iow_newline:} inserted by the -% line-wrapping code are correctly recognized by \TeX{}, and that -% \tn{errorcontextlines} is $-1$ to avoid printing irrelevant context. +% If \meta{if-exist} \meta{variable} is \texttt{false}, throw an +% error and remember to reset \cs{g_@@_log_next_bool}, which is +% otherwise reset by \cs{@@_show_wrap:n}. If \meta{message} is not +% empty, output the message |LaTeX/kernel/show-|\meta{message} with +% as its arguments the \meta{variable}, and either an empty second +% argument or |?| depending on the result of \meta{if-empty} +% \meta{variable}. Afterwards, show the contents of |#5| using +% \cs{@@_show_wrap:n} or \cs{@@_log_wrap:n}. % \begin{macrocode} -\cs_new_protected:Npn \@@_show_variable:Nnn #1#2#3 +\cs_new_protected:Npn \@@_show_variable:NNNnn #1#2#3#4#5 { - \cs_if_exist:NTF #1 + #2 #1 { - \@@_term:nnn { LaTeX / kernel } { show- #2 } {#1} - \@@_show_variable:n {#3} + \tl_if_empty:nF {#4} + { + \@@_show_pre:nnxxxx { LaTeX / kernel } { show- #4 } + { \token_to_str:N #1 } { #3 #1 { } { ? } } { } { } + } + \@@_show_wrap:n {#5} } { \@@_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } + \bool_gset_false:N \g_@@_log_next_bool } } -\cs_new_protected:Npn \@@_show_variable:n #1 - { \iow_wrap:nnnN {#1} { } { } \@@_show_variable_aux:n } -\cs_new_protected:Npn \@@_show_variable_aux:n #1 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_show_wrap:Nn} +% A short-hand used for \cs{int_show:n} and many other functions that +% passes to \cs{@@_show_wrap:n} the result of applying |#1| (a +% function such as \cs{int_eval:n}) to the expression |#2|. The +% leading |>~| is needed by \cs{@@_show_wrap:n}. The use of +% \texttt{x}-expansion ensures that |#1| is expanded in the scope in which the +% show command is called, rather than in the group created by +% \cs{iow_wrap:nnnN}. This is only important for expressions +% involving the \tn{currentgrouplevel} or \tn{currentgrouptype}. +% This does not lead to double expansion because the +% \texttt{x}-expansion of |#1| |{#2}| is a string in all cases where +% \cs{@@_show_wrap:Nn} is used. +% \begin{macrocode} +\cs_new_protected:Npn \@@_show_wrap:Nn #1#2 + { \exp_args:Nx \@@_show_wrap:n { > ~ \tl_to_str:n {#2} = #1 {#2} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_show_wrap:n} +% \begin{macro}[aux]{\@@_show_wrap_aux:n} +% \begin{macro}[aux, EXP]{\@@_show_wrap_aux:w} +% The argument of \cs{@@_show_wrap:n} is line-wrapped using +% \cs{iow_wrap:nnnN}. Everything before the first~|>| in the wrapped +% text is removed, as well as an optional space following it (because +% of \texttt{f}-expansion). In order for line-wrapping to give the +% correct result, the first~|>| must in fact appear at the beginning +% of a line and be followed by a space (or a line-break), so in +% practice, the argument of \cs{@@_show_wrap:n} begins with |>~| or +% |\\>~|. +% +% The line-wrapped text is then either sent to the log file through +% \cs{iow_log:x}, or shown in the terminal using the +% \eTeX{} primitive \tn{showtokens} after removing a leading |>~| and +% trailing dot since those are added automatically by +% \tn{showtokens}. The trailing dot was included in the first place +% because its presence can affect line-wrapping. Note that the space +% after |>| is removed through \texttt{f}-expansion rather than by +% using an argument delimited by |>~| because the space may have been +% replaced by a line-break when line-wrapping. +% +% A special case is that if the line-wrapped text is a single dot (in +% other words if the argument of \cs{@@_show_wrap:n} +% \texttt{x}-expands to nothing) then no |>~| should be removed. +% This makes it unnecessary to check explicitly for emptyness when +% using for instance \cs{seq_map_function:NN} \meta{seq~var} +% \cs{@@_show_item:n} as the argument of \cs{@@_show_wrap:n}. +% +% Finally, the token list \cs{l_@@_internal_tl} containing the result +% of all these manipulations is displayed to the terminal using +% \cs{etex_showtokens:D} and odd \cs{exp_after:wN} which expand the +% closing brace to improve the output slightly. The calls to +% \cs{__iow_with:Nnn} ensure that the \tn{newlinechar} is set to~$10$ +% so that the \cs{iow_newline:} inserted by the line-wrapping code +% are correctly recognized by \TeX{}, and that \tn{errorcontextlines} +% is $-1$ to avoid printing irrelevant context. +% +% Note also that \cs{g_@@_log_next_bool} is only reset if that is +% necessary. This allows the user of an interactive prompt to insert +% tokens as a response to \eTeX{}'s \tn{showtokens}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_show_wrap:n #1 + { \iow_wrap:nnnN { #1 . } { } { } \@@_show_wrap_aux:n } +\cs_new_protected:Npn \@@_show_wrap_aux:n #1 { - \tl_if_empty:nTF {#1} + \tl_if_single:nTF {#1} { \tl_clear:N \l_@@_internal_tl } - { \tl_set:Nf \l_@@_internal_tl { \@@_show_variable_aux:w #1 } } - \__iow_with:Nnn \tex_newlinechar:D { 10 } + { \tl_set:Nf \l_@@_internal_tl { \@@_show_wrap_aux:w #1 \q_stop } } + \bool_if:NTF \g_@@_log_next_bool + { + \iow_log:x { > ~ \l_@@_internal_tl . } + \bool_gset_false:N \g_@@_log_next_bool + } { - \__iow_with:Nnn \tex_errorcontextlines:D \c_minus_one + \__iow_with:Nnn \tex_newlinechar:D { 10 } { - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \l_@@_internal_tl } + \__iow_with:Nnn \tex_errorcontextlines:D \c_minus_one + { + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \l_@@_internal_tl } + } } } } -\cs_new:Npn \@@_show_variable_aux:w #1 > { } +\cs_new:Npn \@@_show_wrap_aux:w #1 > #2 . \q_stop {#2} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}[int,EXP]{\@@_show_item:n} % \begin{macro}[int,EXP]{\@@_show_item:nn} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 0f942069d30..71c9f1513ff 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3names.dtx 5705 2015-07-28 21:31:02Z joseph $ +\GetIdInfo$Id: l3names.dtx 5848 2015-08-17 05:27:13Z joseph $ {L3 Namespace for primitives} %</driver|package> %<*driver> @@ -568,7 +568,7 @@ % are not related to PDF output. These ones related to PDF output or only % work in PDF mode. % \begin{macrocode} - \__kernel_primitive:NN \pdfannot \pdttex_pdfannot:D + \__kernel_primitive:NN \pdfannot \pdftex_pdfannot:D \__kernel_primitive:NN \pdfcatalog \pdftex_pdfcatalog:D \__kernel_primitive:NN \pdfcompresslevel \pdftex_pdfcompresslevel:D \__kernel_primitive:NN \pdfcolorstack \pdftex_pdfcolorstack:D diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 278950c0205..d87e58b27af 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3prg.dtx 5722 2015-07-30 12:54:33Z bruno $ +\GetIdInfo$Id: l3prg.dtx 5891 2015-08-25 08:00:59Z mittelba $ {L3 Control structures} %</driver|package> %<*driver> @@ -308,14 +308,14 @@ % based on this result. % \end{function} % -% \begin{function}[added = 2012-02-09]{\bool_show:N, \bool_show:c} +% \begin{function}[added = 2012-02-09, updated = 2015-08-01]{\bool_show:N, \bool_show:c} % \begin{syntax} % \cs{bool_show:N} \meta{boolean} % \end{syntax} % Displays the logical truth of the \meta{boolean} on the terminal. % \end{function} % -% \begin{function}[added = 2012-02-09, updated = 2012-07-08]{\bool_show:n} +% \begin{function}[added = 2012-02-09, updated = 2015-08-07]{\bool_show:n} % \begin{syntax} % \cs{bool_show:n} \Arg{boolean expression} % \end{syntax} @@ -607,40 +607,6 @@ % within the same function. % \end{function} % -% \begin{function}[updated = 2011-09-06]{\scan_align_safe_stop:} -% \begin{syntax} -% \cs{scan_align_safe_stop:} -% \end{syntax} -% Stops \TeX{}'s scanner looking for expandable control sequences at -% the beginning of an alignment cell. This function is required, for -% example, to obtain the expected output when testing \cs{mode_if_math:TF} -% at the start of a math array cell: placing -% \cs{scan_align_safe_stop:} before \cs{mode_if_math:TF} will give the -% correct result. This function does not destroy any kerning if used in -% other locations, but \emph{does} render functions non-expandable. -% \begin{texnote} -% This is a protected version of \cs{prg_do_nothing:}, which therefore -% stops \TeX{}'s scanner in the circumstances described without producing -% any affect on the output. -% \end{texnote} -% \end{function} -% -% \begin{function}[EXP]{\__prg_variable_get_scope:N} -% \begin{syntax} -% \cs{__prg_variable_get_scope:N} \meta{variable} -% \end{syntax} -% Returns the scope (\texttt{g} for global, blank otherwise) for the -% \meta{variable}. -% \end{function} -% -% \begin{function}[EXP]{\__prg_variable_get_type:N} -% \begin{syntax} -% \cs{__prg_variable_get_type:N} \meta{variable} -% \end{syntax} -% Returns the type of \meta{variable} (\texttt{tl}, \texttt{int}, -% \emph{etc.}) -% \end{function} -% % \begin{function}[EXP]{\__prg_break_point:Nn} % \begin{syntax} % \cs{__prg_break_point:Nn} \cs{\meta{type}_map_break:} \meta{tokens} @@ -708,10 +674,9 @@ % \begin{macro}{\if_bool:N} % \begin{macro}{\if_predicate:w} % Those two primitive \TeX{} conditionals are synonyms. -% They should not be used outside the kernel code. % \begin{macrocode} -\tex_let:D \if_bool:N \tex_ifodd:D -\tex_let:D \if_predicate:w \tex_ifodd:D +\cs_new_eq:NN \if_bool:N \tex_ifodd:D +\cs_new_eq:NN \if_predicate:w \tex_ifodd:D % \end{macrocode} % \end{macro} % \end{macro} @@ -809,8 +774,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\bool_set:Nn,\bool_set:cn} -% \begin{macro}{\bool_gset:Nn,\bool_gset:cn} +% \begin{macro}{\bool_set:Nn, \bool_set:cn} +% \begin{macro}{\bool_gset:Nn, \bool_gset:cn} % This function evaluates a boolean expression and assigns the first % argument the meaning \cs{c_true_bool} or \cs{c_false_bool}. % \begin{macrocode} @@ -828,7 +793,7 @@ % code complements similar material in \pkg{l3tl}. % \begin{macrocode} %<*package> -\tex_ifodd:D \l@expl@check@declarations@bool +\if_bool:N \l@expl@check@declarations@bool \cs_set_protected:Npn \bool_set_true:N #1 { \__chk_if_exist_var:N #1 @@ -869,7 +834,7 @@ \__chk_if_exist_var:N #1 \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } -\tex_fi:D +\fi: %</package> % \end{macrocode} % @@ -894,31 +859,23 @@ % \end{macro} % % \begin{macro}{\bool_show:N, \bool_show:c, \bool_show:n} +% \begin{macro}[aux]{\@@_to_str:n} % Show the truth value of the boolean, as \texttt{true} or -% \texttt{false}. We use \cs{__msg_show_variable:n} to get a better -% output; this function requires its argument to start with |>~|. +% \texttt{false}. % \begin{macrocode} \cs_new_protected:Npn \bool_show:N #1 { - \bool_if_exist:NTF #1 - { - \__msg_show_variable:n - { > \token_to_str:N #1 = \bool_if:NTF #1 { true } { false } } - } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } - } -\cs_new_protected:Npn \bool_show:n #1 - { - \bool_if:nTF {#1} - { \__msg_show_variable:n { > ~ true } } - { \__msg_show_variable:n { > ~ false } } + \__msg_show_variable:NNNnn #1 \bool_if_exist:NTF ? { } + { > ~ \token_to_str:N #1 = \@@_to_str:n {#1} } } +\cs_new_protected_nopar:Npn \bool_show:n + { \__msg_show_wrap:Nn \@@_to_str:n } +\cs_new:Npn \@@_to_str:n #1 + { \bool_if:nTF {#1} { true } { false } } \cs_generate_variant:Nn \bool_show:N { c } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{variable}{\l_tmpa_bool, \l_tmpb_bool, \g_tmpa_bool, \g_tmpb_bool} % A few booleans just if you need them. @@ -1307,9 +1264,9 @@ % % \subsection{Logical loops} % -% \begin{macro}{\bool_while_do:Nn,\bool_while_do:cn} +% \begin{macro}{\bool_while_do:Nn, \bool_while_do:cn} % \UnitTested -% \begin{macro}{\bool_until_do:Nn,\bool_until_do:cn} +% \begin{macro}{\bool_until_do:Nn, \bool_until_do:cn} % \UnitTested % A |while| loop where the boolean is tested before executing the % statement. The \enquote{while} version executes the code as long as the @@ -1326,9 +1283,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\bool_do_while:Nn,\bool_do_while:cn} +% \begin{macro}{\bool_do_while:Nn, \bool_do_while:cn} % \UnitTested -% \begin{macro}{\bool_do_until:Nn,\bool_do_until:cn} +% \begin{macro}{\bool_do_until:Nn, \bool_do_until:cn} % \UnitTested % A |do-while| loop where the body is performed at least once and the % boolean is tested after executing the body. Otherwise identical to @@ -1435,7 +1392,7 @@ % to avoid the last function to insert say, $100$ copies of the original % argument just to gobble them again we define separate functions to % be inserted first. These functions also close the expansion of -% \cs{__int_to_roman:w}, which ensures that \cs{prg_replicate:nn} only +% \cs{exp:w}, which ensures that \cs{prg_replicate:nn} only % requires two steps of expansion. % % This function has one flaw though: Since it constantly passes down @@ -1445,14 +1402,14 @@ % necessary, it is possible to write \cs{prg_replicate:nn} |{1000}| % |{| \cs{prg_replicate:nn} |{1000}| \Arg{code}~|}|. An % alternative approach is to create a string of |m|'s with -% \cs{__int_to_roman:w} which can be done with just four macros but that +% \cs{exp:w} which can be done with just four macros but that % method has its own problems since it can exhaust the string % pool. Also, it is considerably slower than what we use here so the % few extra csnames are well spent I would say. % \begin{macrocode} \cs_new:Npn \prg_replicate:nn #1 { - \__int_to_roman:w + \exp:w \exp_after:wN \@@_replicate_first:N \__int_value:w \__int_eval:w #1 \__int_eval_end: \cs_end: @@ -1492,19 +1449,19 @@ % \begin{macrocode} \cs_new:cpn { @@_replicate_first_-:n } #1 { - \c_zero + \exp_end: \__msg_kernel_expandable_error:nn { kernel } { negative-replication } } -\cs_new:cpn { @@_replicate_first_0:n } #1 { \c_zero } -\cs_new:cpn { @@_replicate_first_1:n } #1 { \c_zero #1 } -\cs_new:cpn { @@_replicate_first_2:n } #1 { \c_zero #1#1 } -\cs_new:cpn { @@_replicate_first_3:n } #1 { \c_zero #1#1#1 } -\cs_new:cpn { @@_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } -\cs_new:cpn { @@_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } -\cs_new:cpn { @@_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } -\cs_new:cpn { @@_replicate_first_7:n } #1 { \c_zero #1#1#1#1#1#1#1 } -\cs_new:cpn { @@_replicate_first_8:n } #1 { \c_zero #1#1#1#1#1#1#1#1 } -\cs_new:cpn { @@_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_0:n } #1 { \exp_end: } +\cs_new:cpn { @@_replicate_first_1:n } #1 { \exp_end: #1 } +\cs_new:cpn { @@_replicate_first_2:n } #1 { \exp_end: #1#1 } +\cs_new:cpn { @@_replicate_first_3:n } #1 { \exp_end: #1#1#1 } +\cs_new:cpn { @@_replicate_first_4:n } #1 { \exp_end: #1#1#1#1 } +\cs_new:cpn { @@_replicate_first_5:n } #1 { \exp_end: #1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_6:n } #1 { \exp_end: #1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_7:n } #1 { \exp_end: #1#1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_8:n } #1 { \exp_end: #1#1#1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_9:n } #1 { \exp_end: #1#1#1#1#1#1#1#1#1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1519,7 +1476,7 @@ % For testing vertical mode. Strikes me here on the bus with David, % that as long as we are just talking about returning true and % false states, we can just use the primitive conditionals for this -% and gobbling the \cs{c_zero} in the input stream. However this +% and gobbling the \cs{exp_end:} in the input stream. However this % requires knowledge of the implementation so we keep things nice % and clean and use the return statements. % \begin{macrocode} @@ -1549,8 +1506,7 @@ % \begin{macro}[pTF]{\mode_if_math:} % \UnitTested % For testing math mode. At the beginning of an alignment cell, -% the programmer should insert \cs{scan_align_safe_stop:} before -% the test. +% this should be used only inside a non-expandable function. % \begin{macrocode} \prg_new_conditional:Npnn \mode_if_math: { p , T , F , TF } { \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi: } @@ -1587,104 +1543,10 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\scan_align_safe_stop:} -% When \TeX{} is in the beginning of an align cell (right after the -% \tn{cr} or |&|) it is in a somewhat strange mode as it is looking -% ahead to find an \tn{omit} or \tn{noalign} and hasn't looked at the -% preamble yet. Thus an \tn{ifmmode} test at the start of an array -% cell (where math mode is introduced by the preamble, not in the cell -% itself) will always fail unless we stop \TeX{} from scanning ahead. -% With \eTeX{}'s first version, this required inserting -% \cs{scan_stop:}, but not in all cases (see below). This is no -% longer needed with a newer \eTeX{}, since protected macros are not -% expanded anymore at the beginning of an alignment cell. We can thus -% use an empty protected macro to stop \TeX{}. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \scan_align_safe_stop: { } -% \end{macrocode} -% Let us now explain the earlier version. We don't want to insert -% a \cs{scan_stop:} every time as that will -% destroy kerning between letters\footnote{Unless we enforce an extra -% pass with an appropriate value of \tn{pretolerance}.} -% Unfortunately there is no way to detect if we're in the beginning of -% an alignment cell as they have different characteristics depending -% on column number, \emph{etc.} However we \emph{can} detect if we're in an -% alignment cell by checking the current group type and we can also -% check if the previous node was a character or ligature. What is done -% here is that \cs{scan_stop:} is only inserted if an only -% if a)~we're in the outer part of an alignment cell and b)~the last node -% \emph{wasn't} a char node or a ligature node. Thus an older definition -% here was -% \begin{verbatim} -% \cs_new_nopar:Npn \scan_align_safe_stop: -% { -% \int_compare:nNnT \etex_currentgrouptype:D = \c_six -% { -% \int_compare:nNnF \etex_lastnodetype:D = \c_zero -% { -% \int_compare:nNnF \etex_lastnodetype:D = \c_seven -% { \scan_stop: } -% } -% } -% } -% \end{verbatim} -% However, this is not truly expandable, as there are places where the -% \cs{scan_stop:} ends up in the result. -% \end{macro} -% % \begin{macrocode} %<@@=prg> % \end{macrocode} % -% \begin{macro}[int]{\@@_variable_get_scope:N} -% \begin{macro}[aux]{\@@_variable_get_scope:w} -% \begin{macro}[int]{\@@_variable_get_type:N} -% \begin{macro}[aux]{\@@_variable_get_type:w} -% Expandable functions to find the type of a variable, and to -% return \texttt{g} if the variable is global. The trick for -% \cs{@@_variable_get_scope:N} is the same as that in -% \cs{__cs_split_function:NN}, but it can be simplified as the -% requirements here are less complex. -% \begin{macrocode} -\group_begin: - \tex_lccode:D `* = `g \scan_stop: - \tex_catcode:D `* = \c_twelve -\tl_to_lowercase:n - { - \group_end: - \cs_new:Npn \@@_variable_get_scope:N #1 - { - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_variable_get_scope:w - \cs_to_str:N #1 \exp_stop_f: \q_stop - } - \cs_new:Npn \@@_variable_get_scope:w #1#2 \q_stop - { \token_if_eq_meaning:NNT * #1 { g } } - } -\group_begin: - \tex_lccode:D `* = `_ \scan_stop: - \tex_catcode:D `* = \c_twelve -\tl_to_lowercase:n - { - \group_end: - \cs_new:Npn \@@_variable_get_type:N #1 - { - \exp_after:wN \@@_variable_get_type:w - \token_to_str:N #1 * a \q_stop - } - \cs_new:Npn \@@_variable_get_type:w #1 * #2#3 \q_stop - { - \token_if_eq_meaning:NNTF a #2 - {#1} - { \@@_variable_get_type:w #2#3 \q_stop } - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{variable}{\g_@@_map_int} % A nesting counter for mapping. % \begin{macrocode} @@ -1706,6 +1568,15 @@ % \end{macro} % \end{macro} % +% \subsection{Deprecated functions} +% +% \begin{macro}[int]{\scan_align_safe_stop:} +% Deprecated 2015-08-01 for removal after 2016-12-31. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \scan_align_safe_stop: { } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index e8d253233ad..9a1ca2a7251 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3prop.dtx Copyright (C) 1990-2014 The LaTeX3 Project +%% File: l3prop.dtx Copyright (C) 1990-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3prop.dtx 5354 2014-08-23 01:35:39Z bruno $ +\GetIdInfo$Id: l3prop.dtx 5777 2015-08-05 02:32:21Z bruno $ {L3 Property lists} %</driver|package> %<*driver> @@ -419,7 +419,7 @@ % % \section{Viewing property lists} % -% \begin{function}[updated = 2012-09-09]{\prop_show:N, \prop_show:c} +% \begin{function}[updated = 2015-08-01]{\prop_show:N, \prop_show:c} % \begin{syntax} % \cs{prop_show:N} \meta{property list} % \end{syntax} @@ -943,7 +943,7 @@ % \prop_if_in:Nn, \prop_if_in:NV, \prop_if_in:No, % \prop_if_in:cn, \prop_if_in:cV, \prop_if_in:co % } -% \begin{macro}[aux,EXP]{\@@_if_in:nwwn,\@@_if_in:N} +% \begin{macro}[aux,EXP]{\@@_if_in:nwwn, \@@_if_in:N} % Testing expandably if a key is in a property list % requires to go through the key--value pairs one by one. % This is rather slow, and a faster test would be @@ -1112,13 +1112,14 @@ % \subsection{Viewing property lists} % % \begin{macro}[tested = m3show001]{\prop_show:N, \prop_show:c} -% Apply the general \cs{__msg_show_variable:Nnn}. Contrarily +% Apply the general \cs{__msg_show_variable:NNNnn}. Contrarily % to sequences and comma lists, we use \cs{__msg_show_item:nn} % to format both the key and the value for each pair. % \begin{macrocode} \cs_new_protected:Npn \prop_show:N #1 { - \__msg_show_variable:Nnn #1 { prop } + \__msg_show_variable:NNNnn #1 + \prop_if_exist:NTF \prop_if_empty:NTF { prop } { \prop_map_function:NN #1 \__msg_show_item:nn } } \cs_generate_variant:Nn \prop_show:N { c } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 4841664f938..32d2fc4540e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3quark.dtx 5659 2015-07-14 18:58:00Z joseph $ +\GetIdInfo$Id: l3quark.dtx 5855 2015-08-17 17:22:56Z mittelba $ {L3 Quarks} %</driver|package> %<*driver> @@ -277,11 +277,6 @@ % Using quarks to define such functions simplifies their logic and ensures % robustness in many cases. % -% \iffalse -% \begin{macrocode} -%<*exampleonly> -% \end{macrocode} -% \fi % % Here's the definition of |\my_map_dbl:nn|. % First of all, define the function that will do the processing based on the @@ -291,39 +286,34 @@ % delimiters according to the type of recursion (here a pair of % \cs{q_recursion_tail}), concluding with \cs{q_recursion_stop}. % These quarks are used to mark the end of the token list being operated upon. -% \begin{macrocode} -\cs_new:Npn \my_map_dbl:nn #1#2 - { - \cs_set:Npn \__my_map_dbl_fn:nn ##1 ##2 {#2} - \__my_map_dbl:nn #1 \q_recursion_tail \q_recursion_tail - \q_recursion_stop - } -% \end{macrocode} +%\begin{verbatim} +% \cs_new:Npn \my_map_dbl:nn #1#2 +% { +% \cs_set:Npn \__my_map_dbl_fn:nn ##1 ##2 {#2} +% \__my_map_dbl:nn #1 \q_recursion_tail \q_recursion_tail +% \q_recursion_stop +% } +%\end{verbatim} % % The definition of the internal recursion function follows. % First check if either of the input tokens are the termination quarks. % Then, if not, apply the inline function to the two arguments. -% \begin{macrocode} -\cs_new:Nn \__my_map_dbl:nn - { - \quark_if_recursion_tail_stop:n {#1} - \quark_if_recursion_tail_stop:n {#2} - \__my_map_dbl_fn:nn {#1} {#2} -% \end{macrocode} +%\begin{verbatim} +% \cs_new:Nn \__my_map_dbl:nn +% { +% \quark_if_recursion_tail_stop:n {#1} +% \quark_if_recursion_tail_stop:n {#2} +% \__my_map_dbl_fn:nn {#1} {#2} +%\end{verbatim} % Finally, recurse: -% \begin{macrocode} - \__my_map_dbl:nn - } -% \end{macrocode} +%\begin{verbatim} +% \__my_map_dbl:nn +% } +%\end{verbatim} % Note that contrarily to \LaTeX3 built-in mapping functions, this % mapping function cannot be nested, since the second map will overwrite % the definition of |\__my_map_dbl_fn:nn|. % -% \iffalse -% \begin{macrocode} -%</exampleonly> -% \end{macrocode} -% \fi % % \section{Internal quark functions} % @@ -418,7 +408,7 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\q_recursion_tail,\q_recursion_stop} +% \begin{variable}{\q_recursion_tail, \q_recursion_stop} % Quarks for ending recursions. Only ever used there! % \cs{q_recursion_tail} is appended to whatever list structure we are % doing recursion on, meaning it is added as a proper list item with @@ -461,10 +451,10 @@ % \end{macro} % % \begin{macro} -% {\quark_if_recursion_tail_stop:n,\quark_if_recursion_tail_stop:o} +% {\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} +% {\quark_if_recursion_tail_stop_do:nn, \quark_if_recursion_tail_stop_do:on} % \UnitTested % \begin{macro}[aux]{\@@_if_recursion_tail:w} % See \cs{quark_if_nil:nTF} for the details. Expanding diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 7b81df583c8..cce3edcd256 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3seq.dtx 5681 2015-07-24 03:01:31Z bruno $ +\GetIdInfo$Id: l3seq.dtx 5777 2015-08-05 02:32:21Z bruno $ {L3 Sequences and stacks} %</driver|package> %<*driver> @@ -853,7 +853,7 @@ % % \section{Viewing sequences} % -% \begin{function}[updated = 2012-09-09]{\seq_show:N, \seq_show:c} +% \begin{function}[updated = 2015-08-01]{\seq_show:N, \seq_show:c} % \begin{syntax} % \cs{seq_show:N} \meta{sequence} % \end{syntax} @@ -961,7 +961,7 @@ % % \subsection{Allocation and initialisation} % -% \begin{macro}{\seq_new:N,\seq_new:c} +% \begin{macro}{\seq_new:N, \seq_new:c} % \UnitTested % Sequences are initialized to \cs{c_empty_seq}. % \begin{macrocode} @@ -1818,8 +1818,8 @@ % % \begin{macro} % { -% \seq_map_variable:NNn,\seq_map_variable:Ncn, -% \seq_map_variable:cNn,\seq_map_variable:ccn +% \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, @@ -1994,11 +1994,12 @@ % % \begin{macro}{\seq_show:N, \seq_show:c} % \UnitTested -% Apply the general \cs{__msg_show_variable:Nnn}. +% Apply the general \cs{__msg_show_variable:NNNnn}. % \begin{macrocode} \cs_new_protected:Npn \seq_show:N #1 { - \__msg_show_variable:Nnn #1 { seq } + \__msg_show_variable:NNNnn #1 + \seq_if_exist:NTF \seq_if_empty:NTF { seq } { \seq_map_function:NN #1 \__msg_show_item:n } } \cs_generate_variant:Nn \seq_show:N { c } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index fb622798ea6..e329b9bd45e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3skip.dtx 5659 2015-07-14 18:58:00Z joseph $ +\GetIdInfo$Id: l3skip.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Dimensions and skips} %</driver|package> %<*driver> @@ -529,7 +529,7 @@ % Displays the value of the \meta{dimension} on the terminal. % \end{function} % -% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\dim_show:n} +% \begin{function}[added = 2011-11-22, updated = 2015-08-07]{\dim_show:n} % \begin{syntax} % \cs{dim_show:n} \Arg{dimension expression} % \end{syntax} @@ -718,7 +718,7 @@ % Displays the value of the \meta{skip} on the terminal. % \end{function} % -% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\skip_show:n} +% \begin{function}[added = 2011-11-22, updated = 2015-08-07]{\skip_show:n} % \begin{syntax} % \cs{skip_show:n} \Arg{skip expression} % \end{syntax} @@ -914,7 +914,7 @@ % Displays the value of the \meta{muskip} on the terminal. % \end{function} % -% \begin{function}[added = 2011-11-22, updated = 2012-05-27]{\muskip_show:n} +% \begin{function}[added = 2011-11-22, updated = 2015-08-07]{\muskip_show:n} % \begin{syntax} % \cs{muskip_show:n} \Arg{muskip expression} % \end{syntax} @@ -1014,7 +1014,7 @@ % % \subsection{Creating and initialising \texttt{dim} variables} % -% \begin{macro}{\dim_new:N,\dim_new:c} +% \begin{macro}{\dim_new:N, \dim_new:c} % Allocating \meta{dim} registers \ldots % \begin{macrocode} %<*package> @@ -1091,9 +1091,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\dim_set_eq:NN,\dim_set_eq:cN, \dim_set_eq:Nc,\dim_set_eq:cc} +% \begin{macro}{\dim_set_eq:NN, \dim_set_eq:cN, \dim_set_eq:Nc, \dim_set_eq:cc} % \begin{macro} -% {\dim_gset_eq:NN,\dim_gset_eq:cN, \dim_gset_eq:Nc,\dim_gset_eq:cc} +% {\dim_gset_eq:NN, \dim_gset_eq:cN, \dim_gset_eq:Nc, \dim_gset_eq:cc} % All straightforward. % \begin{macrocode} \cs_new_protected:Npn \dim_set_eq:NN #1#2 { #1 = #2 } @@ -1234,7 +1234,7 @@ } \cs_new:Npn \@@_compare:w #1 \__prg_compare_error: { - \exp_after:wN \if_false: \tex_romannumeral:D -`0 + \exp_after:wN \if_false: \exp:w \exp_end_continue_f:w \@@_compare:wNN #1 ? { = \@@_compare_end:w \else: } \q_stop } \exp_args:Nno \use:nn @@ -1278,22 +1278,22 @@ % \begin{macrocode} \cs_new:Npn \dim_case:nnTF #1 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } } \cs_new:Npn \dim_case:nnT #1#2#3 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} {#3} { } } \cs_new:Npn \dim_case:nnF #1#2 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { } } \cs_new:Npn \dim_case:nn #1#2 { - \tex_romannumeral:D + \exp:w \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { } { } } \cs_new:Npn \@@_case:nnTF #1#2#3#4 @@ -1493,11 +1493,10 @@ % % \begin{macro}{\dim_show:n} % Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show -% dimension expressions: this gives a more unified output, since the -% closing brace is read by the dimension expression in all cases. +% dimension expressions: this gives a more unified output. % \begin{macrocode} -\cs_new_protected:Npn \dim_show:n #1 - { \etex_showtokens:D \exp_after:wN { \dim_use:N \@@_eval:w #1 } } +\cs_new_protected_nopar:Npn \dim_show:n + { \__msg_show_wrap:Nn \dim_eval:n } % \end{macrocode} % \end{macro} % @@ -1528,7 +1527,7 @@ % % \subsection{Creating and initialising \texttt{skip} variables} % -% \begin{macro}{\skip_new:N,\skip_new:c} +% \begin{macro}{\skip_new:N, \skip_new:c} % Allocation of a new internal registers. % \begin{macrocode} %<*package> @@ -1606,9 +1605,9 @@ % \end{macro} % % \begin{macro} -% {\skip_set_eq:NN,\skip_set_eq:cN, \skip_set_eq:Nc,\skip_set_eq:cc} +% {\skip_set_eq:NN, \skip_set_eq:cN, \skip_set_eq:Nc, \skip_set_eq:cc} % \begin{macro} -% {\skip_gset_eq:NN,\skip_gset_eq:cN, \skip_gset_eq:Nc,\skip_gset_eq:cc} +% {\skip_gset_eq:NN, \skip_gset_eq:cN, \skip_gset_eq:Nc, \skip_gset_eq:cc} % All straightforward. % \begin{macrocode} \cs_new_protected:Npn \skip_set_eq:NN #1#2 { #1 = #2 } @@ -1735,11 +1734,10 @@ % % \begin{macro}{\skip_show:n} % Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show -% skip expressions: this gives a more unified output, since the -% closing brace is read by the skip expression in all cases. +% skip expressions: this gives a more unified output. % \begin{macrocode} -\cs_new_protected:Npn \skip_show:n #1 - { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_glueexpr:D #1 } } +\cs_new_protected_nopar:Npn \skip_show:n + { \__msg_show_wrap:Nn \skip_eval:n } % \end{macrocode} % \end{macro} % @@ -1859,8 +1857,8 @@ % } % \begin{macro} % { -% \muskip_gset_eq:NN,\muskip_gset_eq:cN, -% \muskip_gset_eq:Nc,\muskip_gset_eq:cc +% \muskip_gset_eq:NN, \muskip_gset_eq:cN, +% \muskip_gset_eq:Nc, \muskip_gset_eq:cc % } % All straightforward. % \begin{macrocode} @@ -1926,11 +1924,10 @@ % % \begin{macro}{\muskip_show:n} % Diagnostics. We don't use the \TeX{} primitive \tn{showthe} to show -% muskip expressions: this gives a more unified output, since the -% closing brace is read by the muskip expression in all cases. +% muskip expressions: this gives a more unified output. % \begin{macrocode} -\cs_new_protected:Npn \muskip_show:n #1 - { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_muexpr:D #1 } } +\cs_new_protected_nopar:Npn \muskip_show:n + { \__msg_show_wrap:Nn \muskip_eval:n } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 6638b63aa11..e0787af4833 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3str.dtx 5659 2015-07-14 18:58:00Z joseph $ +\GetIdInfo$Id: l3str.dtx 5920 2015-09-05 07:55:06Z joseph $ {L3 Strings} %</driver|package> %<*driver> @@ -91,7 +91,7 @@ % % \section{The first character from a string} % -% \begin{function}[added = 2011-08-10, EXP]{\str_head:n,\str_tail:n} +% \begin{function}[added = 2011-08-10, EXP]{\str_head:n, \str_tail:n} % \begin{syntax} % \cs{str_head:n} \Arg{token list} % \cs{str_tail:n} \Arg{token list} @@ -246,12 +246,12 @@ % \textsc{utf-8}). Full \textsc{utf-8} support is available with both % \XeTeX{} and \LuaTeX{}, subject only to the fact that \XeTeX{} in % particular has issues with characters of code above hexadecimal -% $0\mathrm{xFFF}$ when interacting with \cs{tl_to_str:n}. +% $0\mathrm{xFFFF}$ when interacting with \cs{tl_to_str:n}. % \end{texnote} % \end{function} % -% \begin{function}[rEXP, added = 2014-06-19, updated = 2015-03-01] -% {\str_fold_case:n} +% \begin{function}[rEXP, added = 2014-06-19, updated = 2015-09-04] +% {\str_fold_case:n, \str_fold_case:V} % \begin{syntax} % \cs{str_fold_case:n} \Arg{tokens} % \end{syntax} @@ -290,7 +290,7 @@ % \textsc{utf-8}). Full \textsc{utf-8} support is available with both % \XeTeX{} and \LuaTeX{}, subject only to the fact that \XeTeX{} in % particular has issues with characters of code above hexadecimal -% $0\mathrm{xFFF}$ when interacting with \cs{tl_to_str:n}. +% $0\mathrm{xFFFF}$ when interacting with \cs{tl_to_str:n}. % \end{texnote} % \end{function} % @@ -485,22 +485,22 @@ % \begin{macrocode} \cs_new:Npn \str_case:nn #1#2 { - \tex_romannumeral:D + \exp:w \@@_case:nnTF {#1} {#2} { } { } } \cs_new:Npn \str_case:nnT #1#2#3 { - \tex_romannumeral:D + \exp:w \@@_case:nnTF {#1} {#2} {#3} { } } \cs_new:Npn \str_case:nnF #1#2 { - \tex_romannumeral:D + \exp:w \@@_case:nnTF {#1} {#2} { } } \cs_new:Npn \str_case:nnTF #1#2 { - \tex_romannumeral:D + \exp:w \@@_case:nnTF {#1} {#2} } \cs_new:Npn \@@_case:nnTF #1#2#3#4 @@ -517,22 +517,22 @@ } \cs_new:Npn \str_case_x:nn #1#2 { - \tex_romannumeral:D + \exp:w \@@_case_x:nnTF {#1} {#2} { } { } } \cs_new:Npn \str_case_x:nnT #1#2#3 { - \tex_romannumeral:D + \exp:w \@@_case_x:nnTF {#1} {#2} {#3} { } } \cs_new:Npn \str_case_x:nnF #1#2 { - \tex_romannumeral:D + \exp:w \@@_case_x:nnTF {#1} {#2} { } } \cs_new:Npn \str_case_x:nnTF #1#2 { - \tex_romannumeral:D + \exp:w \@@_case_x:nnTF {#1} {#2} } \cs_new:Npn \@@_case_x:nnTF #1#2#3#4 @@ -554,7 +554,7 @@ % % \begin{macro}[EXP] % { -% \str_fold_case:n, +% \str_fold_case:n, \str_fold_case:V, % \str_lower_case:n, \str_lower_case:f, % \str_upper_case:n, \str_upper_case:f % } @@ -574,6 +574,7 @@ \cs_new:Npn \str_fold_case:n #1 { \__str_change_case:nn {#1} { fold } } \cs_new:Npn \str_lower_case:n #1 { \__str_change_case:nn {#1} { lower } } \cs_new:Npn \str_upper_case:n #1 { \__str_change_case:nn {#1} { upper } } +\cs_generate_variant:Nn \str_fold_case:n { V } \cs_generate_variant:Nn \str_lower_case:n { f } \cs_generate_variant:Nn \str_upper_case:n { f } \cs_new:Npn \__str_change_case:nn #1 @@ -629,4 +630,4 @@ % % \end{implementation} % -% \PrintIndex
\ No newline at end of file +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 30347d12150..59d0b161e94 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3tl.dtx 5659 2015-07-14 18:58:00Z joseph $ +\GetIdInfo$Id: l3tl.dtx 5908 2015-09-02 14:50:27Z joseph $ {L3 Token lists} %</driver|package> %<*driver> @@ -323,7 +323,15 @@ % % \section{Reassigning token list category codes} % -% \begin{function}[updated = 2011-12-18] +% These functions allow the rescanning of tokens: re-apply \TeX{}'s +% tokenization process to apply category codes different from those +% in force when the tokens were absorbed. Whilst this functionality is +% supported, it is often preferable to find alternative approaches +% to achieving outcomes rather than rescanning tokens (for example +% construction of token lists token-by-token with intervening category +% code changes). +% +% \begin{function}[updated = 2015-08-11] % { % \tl_set_rescan:Nnn, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, % \tl_set_rescan:cnn, \tl_set_rescan:cno, \tl_set_rescan:cnx, @@ -333,29 +341,60 @@ % \begin{syntax} % \cs{tl_set_rescan:Nnn} \meta{tl~var} \Arg{setup} \Arg{tokens} % \end{syntax} -% Sets \meta{tl~var} to contain \meta{tokens}, -% applying the category code r\'{e}gime specified in the -% \meta{setup} before carrying out the assignment. This allows the -% \meta{tl~var} to contain material with category codes -% other than those that apply when \meta{tokens} are absorbed. -% Trailing spaces at the end of the \meta{tokens} are discarded -% in the rescanning process. The \meta{setup} is not limited to -% changes of category code but may contain any valid input, for -% example assignment of the expansion of active tokens. -% See also \cs{tl_rescan:nn}. +% Sets \meta{tl~var} to contain \meta{tokens}, applying the category +% code r\'{e}gime specified in the \meta{setup} before carrying out +% the assignment. (Category codes applied to tokens not explicitly covered +% by the \meta{setup} will be those in force at the point of use of +% \cs{tl_set_rescan:Nnn}.) +% This allows the \meta{tl~var} to contain material +% with category codes other than those that apply when \meta{tokens} +% are absorbed. The \meta{setup} is run within a group and may +% contain any valid input, although only changes in category codes +% are relevant. See also \cs{tl_rescan:nn}. +% \begin{texnote} +% The \meta{tokens} are first turned into a string (using +% \cs{tl_to_str:n}). If the string contains one or more characters +% with character code \tn{newlinechar} (set equal to +% \tn{endlinechar} unless that is equal to $32$, before the user +% \meta{setup}), then it is split into lines at these characters, +% then read as if reading multiple lines from a file, ignoring +% spaces (catcode $10$) at the beginning and spaces and tabs +% (character code $32$ or $9$) at the end of every line. +% Otherwise, spaces (and tabs) are retained at both ends of the +% single-line string, as if it appeared in the middle of a line +% read from a file. Only the case of a single line is supported in +% \LuaTeX{} because of a bug in this engine. +% \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-12-18]{\tl_rescan:nn} +% \begin{function}[updated = 2015-08-11]{\tl_rescan:nn} % \begin{syntax} % \cs{tl_rescan:nn} \Arg{setup} \Arg{tokens} % \end{syntax} -% Rescans \meta{tokens} applying the category code r\'{e}gime specified -% in the \meta{setup}, and leaves the resulting tokens in the input -% stream. Trailing spaces at the end of the \meta{tokens} are discarded -% in the rescanning process. The \meta{setup} is not limited to -% changes of category code but may contain any valid input, for -% example assignment of the expansion of active tokens. -% See also \cs{tl_set_rescan:Nnn}. +% Rescans \meta{tokens} applying the category code r\'{e}gime +% specified in the \meta{setup}, and leaves the resulting tokens in +% the input stream. (Category codes applied to tokens not explicitly covered +% by the \meta{setup} will be those in force at the point of use of +% \cs{tl_rescan:nn}.) +% The \meta{setup} is run within a group and may +% contain any valid input, although only changes in category codes +% are relevant. See also \cs{tl_set_rescan:Nnn}, which is more +% robust than using \cs{tl_set:Nn} in the \meta{tokens} argument of +% \cs{tl_rescan:nn}. +% \begin{texnote} +% The \meta{tokens} are first turned into a string (using +% \cs{tl_to_str:n}). If the string contains one or more characters +% with character code \tn{newlinechar} (set equal to +% \tn{endlinechar} unless that is equal to $32$, before the user +% \meta{setup}), then it is split into lines at these characters, +% then read as if reading multiple lines from a file, ignoring +% spaces (catcode $10$) at the beginning and spaces and tabs +% (character code $32$ or $9$) at the end of every line. +% Otherwise, spaces (and tabs) are retained at both ends of the +% single-line string, as if it appeared in the middle of a line +% read from a file. Only the case of a single line is supported in +% \LuaTeX{} because of a bug in this engine. +% \end{texnote} % \end{function} % % \section{Reassigning token list character codes} @@ -424,8 +463,8 @@ % \begin{function}[EXP,pTF] % {\tl_if_eq:NN, \tl_if_eq:Nc, \tl_if_eq:cN, \tl_if_eq:cc} % \begin{syntax} -% \cs{tl_if_eq_p:NN} \Arg{tl~var_1} \Arg{tl~var_2} -% \cs{tl_if_eq:NNTF} \Arg{tl~var_1} \Arg{tl~var_2} \Arg{true code} \Arg{false code} +% \cs{tl_if_eq_p:NN} \meta{tl~var_1} \meta{tl~var_2} +% \cs{tl_if_eq:NNTF} \meta{tl~var_1} \meta{tl~var_2} \Arg{true code} \Arg{false code} % \end{syntax} % Compares the content of two \meta{token list variables} and % is logically \texttt{true} if the two contain the same list of @@ -441,7 +480,7 @@ % % \begin{function}[TF]{\tl_if_eq:nn} % \begin{syntax} -% \cs{tl_if_eq:nnTF} \meta{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code} +% \cs{tl_if_eq:nnTF} \Arg{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if \meta{token list_1} and \meta{token list_2} contain the % same list of tokens, both in respect of character codes and category @@ -998,7 +1037,7 @@ % % \section{Viewing token lists} % -% \begin{function}[updated = 2012-09-09]{\tl_show:N, \tl_show:c} +% \begin{function}[updated = 2015-08-01]{\tl_show:N, \tl_show:c} % \begin{syntax} % \cs{tl_show:N} \meta{tl~var} % \end{syntax} @@ -1009,7 +1048,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2012-09-09]{\tl_show:n} +% \begin{function}[updated = 2015-08-07]{\tl_show:n} % \begin{syntax} % \cs{tl_show:n} \meta{token list} % \end{syntax} @@ -1189,7 +1228,7 @@ \prg_new_eq_conditional:NNn \tl_if_exist:c \cs_if_exist:c { TF , T , F , p } % \end{macrocode} % \end{macro} -%% +% % \subsection{Constant token lists} % % \begin{variable}{\c_empty_tl} @@ -1358,7 +1397,7 @@ \tex_ifodd:D \l@expl@check@declarations@bool \cs_set_protected:Npn \__cs_tmp:w #1 { - \if_meaning:w ? #1 + \if_meaning:w \q_recursion_tail #1 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: \use:x @@ -1382,7 +1421,7 @@ \tl_put_right:No \tl_put_right:Nx \tl_gput_right:Nn \tl_gput_right:NV \tl_gput_right:No \tl_gput_right:Nx - ? \q_recursion_stop + \q_recursion_tail \q_recursion_stop %</package> % \end{macrocode} % The two \texttt{set_eq} functions are done by hand as the internals there @@ -1430,9 +1469,9 @@ % % \begin{variable}{\c_@@_rescan_marker_tl} % The rescanning code needs a special token list containing the same -% character with two different category codes. This is set up here, -% while the detail is described below. Note that we are sure that the -% colon has category letter at this stage. +% character (chosen here to be a colon) with two different category +% codes: it cannot appear in the tokens being rescanned since all +% colons have the same category code. % \begin{macrocode} \tl_const:Nx \c_@@_rescan_marker_tl { : \token_to_str:N : } % \end{macrocode} @@ -1449,25 +1488,35 @@ % \tl_gset_rescan:cnn, \tl_gset_rescan:cno, \tl_gset_rescan:cnx % } % \begin{macro}{\tl_rescan:nn} -% \begin{macro}[aux]{\@@_set_rescan:NNnn} -% \begin{macro}[aux]{\@@_rescan:w} -% The idea here is to deal cleanly with the problem that -% \tn{scantokens} treats the argument as a file, and without -% the correct settings a \TeX{} error occurs: +% \begin{macro}[aux]{\@@_set_rescan:NNnn, \@@_set_rescan_multi:n} +% \begin{macro}[aux, EXP]{\@@_rescan:w} +% These functions use a common auxiliary. After some initial setup +% explained below, and the user setup |#3| (followed by +% \cs{scan_stop:} to be safe), the tokens are rescanned by +% \cs{@@_set_rescan:n} and stored into \cs{l_@@_internal_a_tl}, then +% passed to |#1#2| outside the group after expansion. The auxiliary +% \cs{@@_set_rescan:n} is defined later: in the simplest case, this +% auxiliary calls \cs{@@_set_rescan_multi:n}, whose code is included +% here to help understand the approach. +% +% One difficulty when rescanning is that \tn{scantokens} treats the +% argument as a file, and without the correct settings a \TeX{} error +% occurs: % \begin{verbatim} % ! File ended while scanning definition of ... % \end{verbatim} -% When expanding a token list this can be handled using \cs{exp_not:N} -% but this fails if the token list is not being expanded. So instead -% a delimited argument is used with an end marker which cannot appear -% within the token list which is scanned: two `|:|' symbols with different -% category codes. The rescanned token list cannot contain the end marker, -% because all `|:|' present in the token list are read with the same category -% code. As every character with charcode \tn{newlinechar} is replaced -% by the \tn{endlinechar}, and an extra \tn{endlinechar} is -% added at the end, we need to set both of those to $-1$, -% \enquote{unprintable}. -% To be safe, the \meta{setup} |#3| is followed by \cs{scan_stop:}. +% The standard solution is to use an \texttt{x}-expanding assignment +% and set \tn{everyeof} to \cs{exp_not:N} to suppress the error at +% the end of the file. Since the rescanned tokens should not be +% expanded, they will be taken as a delimited argument of an +% auxiliary which wraps them in \cs{exp_not:n} (in fact +% \cs{exp_not:o}, as there is a \cs{prg_do_nothing:} to avoid losing +% braces). The delimiter cannot appear within the rescanned token +% list because it contains twice the same character, with different +% catcodes. +% +% The difference between single-line and multiple-line files +% complicates the story, as explained below. % \begin{macrocode} \cs_new_protected_nopar:Npn \tl_set_rescan:Nnn { \@@_set_rescan:NNnn \tl_set:Nn } @@ -1479,26 +1528,27 @@ { \group_begin: \exp_args:No \etex_everyeof:D { \c_@@_rescan_marker_tl \exp_not:N } - \tex_endlinechar:D \c_minus_one - \tex_newlinechar:D \c_minus_one + \int_compare:nNnT \tex_endlinechar:D = { 32 } + { \tex_endlinechar:D \c_minus_one } + \tex_newlinechar:D \tex_endlinechar:D #3 \scan_stop: - \use:x - { - \group_end: - #1 \exp_not:N #2 - { - \exp_after:wN \@@_rescan:w - \exp_after:wN \prg_do_nothing: - \etex_scantokens:D {#4} - } - } + \exp_args:No \@@_set_rescan:n { \tl_to_str:n {#4} } + \exp_args:NNNo + \group_end: + #1 #2 \l_@@_internal_a_tl } -\use:x +\cs_new_protected:Npn \@@_set_rescan_multi:n #1 { - \cs_new:Npn \exp_not:N \@@_rescan:w ##1 - \c_@@_rescan_marker_tl - { \exp_not:N \exp_not:o { ##1 } } + \tl_set:Nx \l_@@_internal_a_tl + { + \exp_after:wN \@@_rescan:w + \exp_after:wN \prg_do_nothing: + \etex_scantokens:D {#1} + } } +\exp_args:Nno \use:nn + { \cs_new:Npn \@@_rescan:w #1 } \c_@@_rescan_marker_tl + { \exp_not:o {#1} } \cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno , Nnx } \cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno , cnx } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nnx } @@ -1510,6 +1560,130 @@ % \end{macro} % \end{macro} % +% \begin{macro}[aux]{\@@_set_rescan:n, \@@_set_rescan:NnTF} +% \begin{macro}[aux]{\@@_set_rescan_single:nn, \@@_set_rescan_single_aux:nn} +% This function calls \cs{@@_set_rescan_multiple:n} or +% \cs{@@_set_rescan_single:nn} |{ ' }| depending on whether its +% argument is a single-line fragment of code/data or is made of +% multiple lines by testing for the presence of a \tn{newlinechar} +% character. If \tn{newlinechar} is out of range, the argument is +% assumed to be a single line. +% +% The case of multiple lines is a straightforward application of +% \tn{scantokens} as described above. The only subtlety is that +% \tn{newlinechar} should be equal to \tn{endlinechar} because +% \tn{newlinechar} characters become new lines and then become +% \tn{endlinechar} characters when writing to an abstract file and +% reading back. This equality is ensured by setting \tn{newlinechar} +% equal to \tn{endlinechar}. Prior to this, \tn{endlinechar} is set +% to $-1$ if it was $32$ (in particular true after \cs{ExplSyntaxOn}) +% to avoid unreasonable line-breaks at every space for instance in +% error messages triggered by the user setup. Another side effect of +% reading back from the file is that spaces (catcode $10$) are +% ignored at the beginning of lines, and spaces and tabs (character +% code $32$ and $9$) are ignored at the end of lines. +% +% For a single line, no \tn{endlinechar} should be added, so it will +% be set to $-1$, and spaces should not be removed. +% +% Trailing spaces and tabs are a difficult matter, as \TeX{} removes +% these at a very low level. The only way to preserve them is to +% rescan not the argument but the argument followed by a character +% with a reasonable category code. Here, $11$ (letter), $12$ (other) +% and $13$ (active) are accepted, as these are suitable for +% delimiting an argument, and it is very unlikely that none of the +% ASCII characters are in one of these categories. To avoid +% selecting one particular character to put at the end, whose +% category code may have been modified, there is a loop through +% characters from |'| (ASCII $39$) to |~| (ASCII $127$). The choice +% of starting point was made because this is the start of a very long +% range of characters whose standard category is letter or other, +% thus minimizing the number of steps needed by the loop (most often +% just a single one). Once a valid character is found, run some code +% very similar to \cs{@@_set_rescan_multi:n}, except that +% \cs{@@_rescan:w} must be redefined to also remove the additional +% character (with the appropriate catcode). Getting the delimiter +% with the right catcode requires using \tn{scantokens} inside an +% \texttt{x}-expansion, hence using the previous definition of +% \cs{@@_rescan:w} as well. The odd \cs{exp_not:N} \cs{use:n} +% ensures that the trailing \cs{exp_not:N} in \tn{everyeof} does +% not prevent the expansion of \cs{c_@@_rescan_marker_tl}, but +% rather of a closing brace (this does nothing). +% If no valid character is found, similar code is ran, +% and the only difference is that trailing spaces are not preserved +% (bear in mind that this only happens if no character between $39$ +% and $127$ has catcode letter, other or active). +% +% There is also some work to preserve leading spaces: test whether +% the first character (given by \cs{str_head:n}, with an extra space +% to circumvent a limitation of \texttt{f}-expansion) has catcode +% $10$ and add what \TeX{} would add in the middle of a line for any +% sequence of such characters: a single space with catcode $10$ and +% character code $32$. +% \begin{macrocode} +\group_begin: + \tex_catcode:D `\^^@ = 12 \scan_stop: + \cs_new_protected:Npn \@@_set_rescan:n #1 + { + \int_compare:nNnTF \tex_newlinechar:D < \c_zero + { \use_ii:nn } + { + \char_set_lccode:nn { 0 } { \tex_newlinechar:D } + \tl_to_lowercase:n { \@@_set_rescan:NnTF ^^@ } {#1} + } + { \@@_set_rescan_multi:n } + { \@@_set_rescan_single:nn { ' } } + {#1} + } + \cs_new_protected:Npn \@@_set_rescan:NnTF #1#2 + { \tl_if_in:nnTF {#2} {#1} } + \cs_new_protected:Npn \@@_set_rescan_single:nn #1 + { + \int_compare:nNnTF + { \char_value_catcode:n { `#1 } / \c_three } = \c_four + { \@@_set_rescan_single_aux:nn {#1} } + { + \int_compare:nNnTF { `#1 } < { `\~ } + { + \char_set_lccode:nn { 0 } { `#1 + 1 } + \tl_to_lowercase:n { \@@_set_rescan_single:nn { ^^@ } } + } + { \@@_set_rescan_single_aux:nn { } } + } + } + \cs_new_protected:Npn \@@_set_rescan_single_aux:nn #1#2 + { + \tex_endlinechar:D \c_minus_one + \use:x + { + \exp_not:N \use:n + { + \exp_not:n { \cs_set:Npn \@@_rescan:w ##1 } + \exp_after:wN \@@_rescan:w + \exp_after:wN \prg_do_nothing: + \etex_scantokens:D {#1} + } + \c_@@_rescan_marker_tl + } + { \exp_not:o {##1} } + \tl_set:Nx \l_@@_internal_a_tl + { + \int_compare:nNnT + { + \char_value_catcode:n + { \exp_last_unbraced:Nf ` \str_head:n {#2} ~ } + } + = \c_ten { ~ } + \exp_after:wN \@@_rescan:w + \exp_after:wN \prg_do_nothing: + \etex_scantokens:D { #2 #1 } + } + } +\group_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Reassigning token list character codes} % % \begin{macro}{\tl_to_lowercase:n} @@ -1760,7 +1934,7 @@ % % \subsection{Token list conditionals} % -% \begin{macro}[pTF]{\tl_if_blank:n,\tl_if_blank:V,\tl_if_blank:o} +% \begin{macro}[pTF]{\tl_if_blank:n, \tl_if_blank:V, \tl_if_blank:o} % \begin{macro}[aux]{\@@_if_blank_p:NNw} % \TeX{} skips spaces when reading a non-delimited arguments. Thus, % a \meta{token list} is blank if and only if \cs{use_none:n} @@ -1784,7 +1958,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[pTF]{\tl_if_empty:N,\tl_if_empty:c} +% \begin{macro}[pTF]{\tl_if_empty:N, \tl_if_empty:c} % These functions check whether the token list in the argument is % empty and execute the proper code from their argument(s). % \begin{macrocode} @@ -1803,7 +1977,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF]{\tl_if_empty:n,\tl_if_empty:V} +% \begin{macro}[pTF]{\tl_if_empty:n, \tl_if_empty:V} % Convert the argument to a string: this will be empty if and only if % the argument is. Then |\if_meaning:w \q_nil ... \q_nil| is % \texttt{true} if and only if the string |...| is empty. @@ -1842,13 +2016,13 @@ % The test for emptiness is based on \cs{tl_if_empty:n(TF)}, but % the expansion is hard-coded for efficiency, as this auxiliary % function is used in many places. -% Note that this works because \cs{tl_to_str:n} expands tokens +% Note that this works because \cs{etex_detokenize:D} expands tokens % that follow until reading a catcode $1$ (begin-group) token. % \begin{macrocode} \cs_new:Npn \@@_if_empty_return:o #1 { \exp_after:wN \if_meaning:w \exp_after:wN \q_nil - \tl_to_str:n \exp_after:wN {#1} \q_nil + \etex_detokenize:D \exp_after:wN {#1} \q_nil \prg_return_true: \else: \prg_return_false: @@ -2006,22 +2180,22 @@ % \begin{macrocode} \cs_new:Npn \tl_case:Nn #1#2 { - \tex_romannumeral:D + \exp:w \@@_case:NnTF #1 {#2} { } { } } \cs_new:Npn \tl_case:NnT #1#2#3 { - \tex_romannumeral:D + \exp:w \@@_case:NnTF #1 {#2} {#3} { } } \cs_new:Npn \tl_case:NnF #1#2#3 { - \tex_romannumeral:D + \exp:w \@@_case:NnTF #1 {#2} { } {#3} } \cs_new:Npn \tl_case:NnTF #1#2 { - \tex_romannumeral:D + \exp:w \@@_case:NnTF #1 {#2} } \cs_new:Npn \@@_case:NnTF #1#2#3#4 @@ -2153,10 +2327,7 @@ % \subsection{Using token lists} % % \begin{macro}{\tl_to_str:n} -% Another name for a primitive. -% \begin{macrocode} -\cs_new_eq:NN \tl_to_str:n \etex_detokenize:D -% \end{macrocode} +% Another name for a primitive: defined in \pkg{l3basics}. % \end{macro} % % \begin{macro}{\tl_to_str:N, \tl_to_str:c} @@ -2332,7 +2503,7 @@ % % \subsection{Token by token changes} % -% \begin{variable}{\q_@@_act_mark,\q_@@_act_stop} +% \begin{variable}{\q_@@_act_mark, \q_@@_act_stop} % The \cs{tl_act} functions may be applied to any token list. % Hence, we use two private quarks, to allow any token, even quarks, % in the token list.^^A in particular critical for future \::e. @@ -2349,7 +2520,7 @@ % \begin{macro}[EXP,aux]{\@@_act_space:wwnNNN} % \begin{macro}[EXP,aux]{\@@_act_end:w} % To help control the expansion, \cs{@@_act:NNNnn} should always -% be proceeded by \tn{romannumeral} and ends by producing \cs{c_zero} +% be proceeded by \cs{exp:w} and ends by producing \cs{exp_end:} % once the result has been obtained. Then loop over tokens, % groups, and spaces in |#5|. The marker \cs{q_@@_act_mark} % is used both to avoid losing outer braces and to detect the @@ -2367,8 +2538,8 @@ % In the loop, we check how the token list begins and act % accordingly. In the \enquote{normal} case, we may have % reached \cs{q_@@_act_mark}, the end of the list. Then -% leave \cs{c_zero} and the result in the input stream, -% to terminate the expansion of \tn{romannumeral}. +% leave \cs{exp_end:} and the result in the input stream, +% to terminate the expansion of \cs{exp:w}. % Otherwise, apply the relevant function to the % \enquote{arguments}, |#3| % and to the head of the token list. Then repeat the loop. @@ -2397,7 +2568,7 @@ {#3} #4 } \cs_new:Npn \@@_act_end:wn #1 \@@_act_result:n #2 - { \group_align_safe_end: \c_zero #2 } + { \group_align_safe_end: \exp_end: #2 } \cs_new:Npn \@@_act_group:nwnNNN #1 #2 \q_@@_act_stop #3#4#5 { #5 {#3} {#1} @@ -2445,7 +2616,7 @@ { \etex_unexpanded:D \exp_after:wN { - \tex_romannumeral:D + \exp:w \@@_act:NNNnn \@@_reverse_normal:nN \@@_reverse_group_preserve:nn @@ -2750,20 +2921,20 @@ % |\if_false: { \fi: ... }| construction) both to hide potential % alignment tab characters from \TeX{} in a table, and to allow for % removing what remains of the token list after its first space. The -% \cs{tex_romannumeral:D} and \cs{c_zero} ensure that the result of a +% \cs{exp:w} and \cs{exp_end:} ensure that the result of a % single step of expansion directly yields a balanced token list (no % trailing closing brace). % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_is_space:n #1 { p , T , F , TF } { - \tex_romannumeral:D \if_false: { \fi: + \exp:w \if_false: { \fi: \@@_if_head_is_space:w ? #1 ? ~ } } \cs_new:Npn \@@_if_head_is_space:w #1 ~ { \tl_if_empty:oTF { \use_none:n #1 } - { \exp_after:wN \c_zero \exp_after:wN \prg_return_true: } - { \exp_after:wN \c_zero \exp_after:wN \prg_return_false: } + { \exp_after:wN \exp_end: \exp_after:wN \prg_return_true: } + { \exp_after:wN \exp_end: \exp_after:wN \prg_return_false: } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } % \end{macrocode} @@ -2811,30 +2982,26 @@ % % \begin{macro}{\tl_show:N, \tl_show:c} % Showing token list variables is done after checking that the -% variable is defined (see \cs{__kernel_register_show:N}. +% variable is defined (see \cs{__kernel_register_show:N}). % \begin{macrocode} \cs_new_protected:Npn \tl_show:N #1 { - \tl_if_exist:NTF #1 - { \cs_show:N #1 } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } + \__msg_show_variable:NNNnn #1 \tl_if_exist:NTF ? { } + { > ~ \token_to_str:N #1 = \tl_to_str:N #1 } } \cs_generate_variant:Nn \tl_show:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\tl_show:n} -% The \cs{__msg_show_variable:n} internal function performs -% line-wrapping, removes a leading \verb*|> |, then shows the result +% The \cs{__msg_show_wrap:n} internal function performs +% line-wrapping and shows the result % using the \cs{etex_showtokens:D} primitive. Since \cs{tl_to_str:n} % is expanded within the line-wrapping code, the escape character is % always a backslash. % \begin{macrocode} \cs_new_protected:Npn \tl_show:n #1 - { \__msg_show_variable:n { > ~ \tl_to_str:n {#1} } } + { \__msg_show_wrap:n { > ~ \tl_to_str:n {#1} } } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index cd310c06d3a..586097d48a8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3token.dtx Copyright (C) 2005-2014 The LaTeX3 Project +%% File: l3token.dtx Copyright (C) 2005-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3token.dtx 5422 2014-09-15 10:44:23Z joseph $ +\GetIdInfo$Id: l3token.dtx 5893 2015-08-26 16:16:52Z mittelba $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -98,11 +98,11 @@ % and what it looks like. % % For instance, \cs{if:w}, \cs{if_charcode:w}, and \cs{tex_if:D} are -% three for the same internal operation of \TeX{}, namely the primitive +% three names for the same internal operation of \TeX{}, namely the primitive % testing the next two characters for equality of their character code. % They behave identically in many situations. However, \TeX{} % distinguishes them when searching for a delimited argument. Namely, the -% example function \cs{show_until_if:w} defined below will take everything +% example function |\show_until_if:w| defined below will take everything % until \cs{if:w} as an argument, despite the presence of other copies of % \cs{if:w} under different names. % \begin{verbatim} @@ -112,7 +112,7 @@ % % \section{Character tokens} % -% \begin{function} +% \begin{function}[updated = 2015-08-09] % { % \char_set_catcode_escape:N , % \char_set_catcode_group_begin:N , @@ -140,10 +140,15 @@ % \begin{verbatim} % \char_set_catcode_other:N \% % \end{verbatim} -% The assignment is local. +% The assignment is local. These commands update +% \cs{l_char_special_seq} as appropriate by adding or removing the +% \meta{character}, and in package mode they also update +% \tn{dospecials} (plain \TeX{} and \LaTeXe{}) and \cs{@sanitize} +% (\LaTeXe{} only). The \cs{char_set_catcode_active:N} command +% also adds the active character to \cs{l_char_active_seq}. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2015-08-09] % { % \char_set_catcode_escape:n , % \char_set_catcode_group_begin:n , @@ -169,9 +174,14 @@ % code as given by the \meta{integer expression}. This version can be % used to set up characters which cannot otherwise be given % (\emph{cf.}~the \texttt{N}-type variants). The assignment is local. +% These commands update \cs{l_char_special_seq} as appropriate by +% adding or removing the \meta{character}, and in package mode they +% also update \tn{dospecials} (plain \TeX{} and \LaTeXe{}) and +% \cs{@sanitize} (\LaTeXe{} only). The \cs{char_set_catcode_active:n} +% command also adds the active character to \cs{l_char_active_seq}. % \end{function} % -% \begin{function}{\char_set_catcode:nn} +% \begin{function}[updated = 2015-08-09]{\char_set_catcode:nn} % \begin{syntax} % \cs{char_set_catcode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -182,6 +192,12 @@ % The setting applies within the current \TeX{} group. In general, the % symbolic functions \cs{char_set_catcode_\meta{type}} should be preferred, % but there are cases where these lower-level functions may be useful. +% This command updates \cs{l_char_special_seq} as appropriate by +% adding or removing the \meta{character}, and in package mode it +% also updates \tn{dospecials} (plain \TeX{} and \LaTeXe{}) and +% \cs{@sanitize} (\LaTeXe{} only). +% If the category code is $13$ (active), the active character is +% added to \cs{l_char_active_seq}. % \end{function} % % \begin{function}[EXP]{\char_value_catcode:n} @@ -202,7 +218,7 @@ % terminal. % \end{function} % -% \begin{function}{\char_set_lccode:nn} +% \begin{function}[updated = 2015-08-06]{\char_set_lccode:nn} % \begin{syntax} % \cs{char_set_lcode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -239,7 +255,7 @@ % terminal. % \end{function} % -% \begin{function}{\char_set_uccode:nn} +% \begin{function}[updated = 2015-08-06]{\char_set_uccode:nn} % \begin{syntax} % \cs{char_set_uccode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -276,7 +292,7 @@ % terminal. % \end{function} % -% \begin{function}{\char_set_mathcode:nn} +% \begin{function}[updated = 2015-08-06]{\char_set_mathcode:nn} % \begin{syntax} % \cs{char_set_mathcode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -305,7 +321,7 @@ % terminal. % \end{function} % -% \begin{function}{\char_set_sfcode:nn} +% \begin{function}[updated = 2015-08-06]{\char_set_sfcode:nn} % \begin{syntax} % \cs{char_set_sfcode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -334,14 +350,17 @@ % terminal. % \end{function} % -% \begin{variable}[added = 2012-01-23]{\l_char_active_seq} -% Used to track which tokens will require special handling at the document -% level as they are of category \meta{active} (catcode~$13$). Each entry in +% \begin{variable}[added = 2012-01-23, updated = 2015-08-09]{\l_char_active_seq} +% Used to track which tokens may require special handling at the document +% level as they are (or have been at some point) +% of category \meta{active} (catcode~$13$). Each entry in % the sequence consists of a single active character. Active tokens should be % added to the sequence when they are defined for general document use. +% This sequence is automatically updated by \cs{char_set_catcode:nn} and +% more specific functions. % \end{variable} % -% \begin{variable}[added = 2012-01-23]{\l_char_special_seq} +% \begin{variable}[added = 2012-01-23, updated = 2015-08-09]{\l_char_special_seq} % Used to track which tokens will require special handling when working with % verbatim-like material at the document level as they are not of categories % \meta{letter} (catcode~$11$) or \meta{other} (catcode~$12$). Each entry in @@ -349,6 +368,8 @@ % backslash or |\{| for an opening brace.^^A \} % Escaped tokens should be added to the sequence when they are defined for % general document use. +% This sequence is automatically updated by \cs{char_set_catcode:nn} and +% more specific functions. % \end{variable} % % \section{Generic tokens} @@ -963,7 +984,7 @@ % \end{macrocode} % % \begin{macrocode} -%<@@=token> +%<@@=char> % \end{macrocode} % % \subsection{Character tokens} @@ -971,18 +992,137 @@ % \begin{macro}{\char_set_catcode:nn} % \begin{macro}{\char_value_catcode:n} % \begin{macro}{\char_show_value_catcode:n} -% Category code changes. +% \begin{macro}[aux] +% { +% \@@_set_catcode:Nn, +% \@@_set_catcode:NnNNN, +% \@@_set_catcode:NNN, +% } +% Category code changes. Besides setting the catcode using +% \cs{tex_catcode:D}, this function keeps up to date the sequences +% \cs{l_char_active_seq}, \cs{l_char_special_seq}, and in package +% mode \tn{dospecials} (for plain \TeX{} and \LaTeXe{}) and +% \tn{@sanitize} (\LaTeXe{} only) as well. The first list contains +% active characters, and the other three contain a single-character +% control sequence. These are constructed from the given character +% code |#1| using the \tn{lowercase} primitive. In package mode +% there are difficulties because |\+| and the active |^^L| are +% \tn{outer} macros. This pushes us to only construct the +% single-character control sequence and the active character with +% character code |#1| if they are necessary for the update. As a +% start, construct an \enquote{other} (catcode~$12$) with character +% code |#1|. The second part of the \texttt{:Nn} auxiliary takes +% care of \cs{l_char_active_seq}: if the new catcode is $13$ +% (active), then the active character is constructed through +% \tn{lowercase} and added to the sequence unless it is already in +% there. The first part is more intricate and distinguishes the +% case where the original catcode is special (different from letter +% or other, since for \eTeX{}'s \tn{numexpr}, $11/2=12/2=6$) or not. +% If it the catcode was special, the single-character control +% sequence may need to be removed from the token lists and sequence, +% otherwise it may need to be added to the lists. +% +% The addition or removal is done by the \texttt{:NnNNN} auxiliary, +% which performs the catcode assignment (note here that the arguments +% of \cs{char_set_catcode:nn} are each evaluated exactly once), then +% tests whether the new catcode is special or not. If that changed +% compared to the previous catcode, then some work is needed: pass to +% the \texttt{:NNN} auxiliary the single-character control sequence, +% a function acting on token lists, and a function acting on +% sequences. Defining this auxiliary is tricky: the odd +% \texttt{f}-expansion expands the two \cs{tl_if_exist:NT} before the +% definition is performed, and the macro parameter token |#| (we are +% not yet doing a definition) stops the \texttt{f}-expansion. +% In \LaTeXe{}, \cs{@sanitize} differs from \cs{dospecials} in that +% it should not list begin-group and end-group character tokens. +% For this, patch \cs{@@_set_catcode:Nn} by copying its code +% using its \texttt{o}-expansion with arguments |#1| and |#2| +% (braces are needed because each argument is literally two tokens, +% a macro parameter character and a digit), and appending to it some +% code that removes the single-character control sequence from +% \cs{@sanitize} if the (new) catcode is $1$ or $2$. % \begin{macrocode} +\group_begin: +\tex_catcode:D `@ = \c_eleven +\tex_catcode:D \c_zero = \c_twelve \cs_new_protected:Npn \char_set_catcode:nn #1#2 - { \tex_catcode:D #1 = \__int_eval:w #2 \__int_eval_end: } + { + \group_begin: + \char_set_lccode:nn { 0 } {#1} + \tl_to_lowercase:n + { \group_end: \@@_set_catcode:Nn ^^@ } {#2} + } +\tex_catcode:D \c_zero = \c_thirteen +\cs_new_protected:Npn \@@_set_catcode:Nn #1#2 + { + \int_compare:nNnTF { \tex_catcode:D `#1 / \c_two } = \c_six + { + \@@_set_catcode:NnNNN #1 {#2} \int_compare:nNnF + \tl_put_right:Nn \seq_put_right:Nn + } + { + \@@_set_catcode:NnNNN #1 {#2} \int_compare:nNnT + \tl_remove_all:Nn \seq_remove_all:Nn + } + \int_compare:nNnT { \tex_catcode:D `#1 } = \c_thirteen + { + \group_begin: + \char_set_lccode:nn { 0 } { `#1 } + \tl_to_lowercase:n + { + \group_end: + \seq_if_in:NnF \l_char_active_seq { ^^@ } + { \seq_put_right:Nn \l_char_active_seq { ^^@ } } + } + } + } +\cs_new_protected:Npn \@@_set_catcode:NnNNN #1#2#3#4#5 + { + \tex_catcode:D `#1 = \__int_eval:w #2 \__int_eval_end: + #3 { \tex_catcode:D `#1 / \c_two } = \c_six + { + \group_begin: \exp_args:NNc \group_end: + \@@_set_catcode:NNN {#1} #4 #5 + } + } +\exp_args:Nnf \use:n + { \cs_new_protected:Npn \@@_set_catcode:NNN #1#2#3 } + { +%<*package> + \tl_if_exist:NT \dospecials + { + \tl_if_exist:NT \@sanitize { #2 \@sanitize { \@makeother #1 } } + #2 \dospecials { \do #1 } + } +%</package> + #3 \l_char_special_seq {#1} + } +%<*package> +\tl_if_exist:NT \@sanitize + { + \exp_args:Nno \use:n + { \cs_gset_protected:Npn \@@_set_catcode:Nn #1#2 } + { + \@@_set_catcode:Nn {#1} {#2} + \int_compare:nNnT { \tex_catcode:D `#1 / \c_two } = \c_one + { + \group_begin: \exp_args:NNNx \group_end: + \tl_remove_all:Nn \@sanitize + { \exp_not:N \@makeother \exp_not:c {#1} } + } + } + } +%</package> \cs_new:Npn \char_value_catcode:n #1 { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_catcode:n #1 - { \int_show:n { \char_value_catcode:n {#1} } } + { \__msg_show_wrap:n { > ~ \char_value_catcode:n {#1} } } +\group_end: % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro} % { @@ -1109,29 +1249,41 @@ % Pretty repetitive, but necessary! % \begin{macrocode} \cs_new_protected:Npn \char_set_mathcode:nn #1#2 - { \tex_mathcode:D #1 = \__int_eval:w #2 \__int_eval_end: } + { + \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: + = \__int_eval:w #2 \__int_eval_end: + } \cs_new:Npn \char_value_mathcode:n #1 { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_mathcode:n #1 - { \int_show:n { \char_value_mathcode:n {#1} } } + { \__msg_show_wrap:n { > ~ \char_value_mathcode:n {#1} } } \cs_new_protected:Npn \char_set_lccode:nn #1#2 - { \tex_lccode:D #1 = \__int_eval:w #2 \__int_eval_end: } + { + \tex_lccode:D \__int_eval:w #1 \__int_eval_end: + = \__int_eval:w #2 \__int_eval_end: + } \cs_new:Npn \char_value_lccode:n #1 { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_lccode:n #1 - { \int_show:n { \char_value_lccode:n {#1} } } + { \__msg_show_wrap:n { > ~ \char_value_lccode:n {#1} } } \cs_new_protected:Npn \char_set_uccode:nn #1#2 - { \tex_uccode:D #1 = \__int_eval:w #2 \__int_eval_end: } + { + \tex_uccode:D \__int_eval:w #1 \__int_eval_end: + = \__int_eval:w #2 \__int_eval_end: + } \cs_new:Npn \char_value_uccode:n #1 { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_uccode:n #1 - { \int_show:n { \char_value_uccode:n {#1} } } + { \__msg_show_wrap:n { > ~ \char_value_uccode:n {#1} } } \cs_new_protected:Npn \char_set_sfcode:nn #1#2 - { \tex_sfcode:D #1 = \__int_eval:w #2 \__int_eval_end: } + { + \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: + = \__int_eval:w #2 \__int_eval_end: + } \cs_new:Npn \char_value_sfcode:n #1 { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_sfcode:n #1 - { \int_show:n { \char_value_sfcode:n {#1} } } + { \__msg_show_wrap:n { > ~ \char_value_sfcode:n {#1} } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1146,8 +1298,46 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\l_char_active_seq, \l_char_special_seq} +% Two sequences for dealing with special characters. They must be defined +% before \cs{char_set_catcode:nn} can be used. The first is characters +% which may be active, and contains the active characters themselves to +% allow easy redefinition. The second longer list is for \enquote{special} +% characters more generally, and these are escaped so that for example +% bulk code assignments can be carried out. In both cases, the order is +% by \textsc{ascii} character code (as is done in for example +% \cs{ExplSyntaxOn}). The only complication is dealing with |_|, which +% requires the use of \cs{use:n} \emph{and} \cs{use:nn}. +% \begin{macrocode} +\seq_new:N \l_char_special_seq +\seq_set_split:Nnn \l_char_special_seq { } + { \ \" \# \$ \% \& \\ \^ \_ \{ \} \~ } +\seq_new:N \l_char_active_seq +\use:n + { + \group_begin: + \char_set_catcode_active:N \" + \char_set_catcode_active:N \$ + \char_set_catcode_active:N \& + \char_set_catcode_active:N \^ + \char_set_catcode_active:N \_ + \char_set_catcode_active:N \~ + \use:nn + { + \group_end: + \seq_set_split:Nnn \l_char_active_seq { } + } + } + { { " $ & ^ _ ~ } } %$ +% \end{macrocode} +% \end{variable} +% % \subsection{Generic tokens} % +% \begin{macrocode} +%<@@=token> +% \end{macrocode} +% % \begin{macro}{\token_to_meaning:N, \token_to_meaning:c} % \begin{macro}{\token_to_str:N, \token_to_str:c} % These are all defined in \pkg{l3basics}, as they are needed @@ -1214,39 +1404,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_char_active_seq, \l_char_special_seq} -% Two sequences for dealing with special characters. The first is characters -% which may be active, and contains the active characters themselves to -% allow easy redefinition. The second longer list is for \enquote{special} -% characters more generally, and these are escaped so that for example -% bulk code assignments can be carried out. In both cases, the order is -% by \textsc{ascii} character code (as is done in for example -% \cs{ExplSyntaxOn}). The only complication is dealing with |_|, which -% requires the use of \cs{use:n} \emph{and} \cs{use:nn}. -% \begin{macrocode} -\seq_new:N \l_char_active_seq -\use:n - { - \group_begin: - \char_set_catcode_active:N \" - \char_set_catcode_active:N \$ - \char_set_catcode_active:N \& - \char_set_catcode_active:N \^ - \char_set_catcode_active:N \_ - \char_set_catcode_active:N \~ - \use:nn - { - \group_end: - \seq_set_split:Nnn \l_char_active_seq { } - } - } - { { " $ & ^ _ ~ } } %$ -\seq_new:N \l_char_special_seq -\seq_set_split:Nnn \l_char_special_seq { } - { \ \" \# \$ \% \& \\ \^ \_ \{ \} \~ } -% \end{macrocode} -% \end{variable} -% % \subsection{Token conditionals} % % \begin{macro}[pTF]{\token_if_group_begin:N} @@ -2090,14 +2247,14 @@ % \cs{token_if_eq_meaning:NNTF} because \cs{l_peek_token} may be an % outer macro (coming from non-\LaTeX3 packages). Spaces are removed % using a side-effect of \texttt{f}-expansion: -% |\tex_romannumeral:D -`0| removes one space. +% |\exp:w \exp_end_continue_f:w| removes one space. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_ignore_spaces_execute_branches: { \if_meaning:w \l_peek_token \c_space_token \exp_after:wN \peek_after:Nw \exp_after:wN \@@_ignore_spaces_execute_branches: - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \else: \exp_after:wN \@@_execute_branches: \fi: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3unicode-data.dtx b/Master/texmf-dist/source/latex/l3kernel/l3unicode-data.dtx index 66c786a88e6..79fbc2783e6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3unicode-data.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3unicode-data.dtx @@ -38,7 +38,7 @@ % plain \TeX{}, set up in generic mode. %<*driver|script> \input expl3-generic\relax -\GetIdInfo$Id: l3unicode-data.dtx 5676 2015-07-20 06:48:31Z joseph $ +\GetIdInfo$Id: l3unicode-data.dtx 5897 2015-08-28 09:06:29Z joseph $ {L3 Case data script} %</driver|script> % @@ -299,14 +299,11 @@ } } } -\group_begin: -\char_set_lccode:nn { `\* } { `\: } -\tex_lowercase:D +\use:x { - \group_end: - \cs_new_protected:Npn \__unicode_parse_line_auxi:w #1 * + \cs_new_protected:Npn \exp_not:N \__unicode_parse_line_auxi:w + ##1 \token_to_str:N : ~ ##2 , ~ ##3 ~ ##4 \scan_stop: } - ~ #2 , ~ #3 ~ #4 \scan_stop: { \tl_set:Nn \l__unicode_tmp_tl { #2 , ~ #3 } } \clist_map_inline:nn { UnicodeData , SpecialCasing , CaseFolding } diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 2924b08d1ba..8cea3b578f7 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -37,8 +37,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{l3keys2e}{Support package l3kernel too old} @@ -50,7 +50,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3keys2e.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: l3keys2e.dtx 5925 2015-09-06 09:25:46Z joseph $ {LaTeX2e option processing using LaTeX3 keys} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 45d8088dbb7..55d8aec5d41 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -41,8 +41,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{xparse}{Support package l3kernel too old} @@ -54,7 +54,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: xparse.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: xparse.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental document command parser} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 09c46d3be52..9651fe12771 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -41,8 +41,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2015/07/28] -%<package>\@ifpackagelater{expl3}{2015/07/28} +\RequirePackage{expl3}[2015/09/06] +%<package>\@ifpackagelater{expl3}{2015/09/06} %<package> {} %<package> {% %<package> \PackageError{xtemplate}{Support package l3kernel too old} @@ -54,7 +54,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: xtemplate.dtx 5700 2015-07-28 19:26:39Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 5925 2015-09-06 09:25:46Z joseph $ {L3 Experimental prototype document functions} %</driver|package> %<*driver> @@ -230,14 +230,15 @@ % agree with the object type declaration. The interface itself is % defined by the \meta{key list}, which is itself a key--value list % taking a specialized format: -% -% \begin{syntax} +% \begin{quotation} +% \obeylines +% \noindent % \meta{key1}~":"~\meta{key type1}~"," % \meta{key2}~":"~\meta{key type2}~"," % \meta{key3}~":"~\meta{key type3}~"="~\meta{default3}~"," % \meta{key4}~":"~\meta{key type4}~"="~\meta{default4}~"," % \ldots -% \end{syntax} +% \end{quotation} % Each \meta{key} name should consist of \textsc{ascii} characters, % with the exception of |,|, |=| and \verb*| |. The recommended form % for key names is to use lower case letters, with dashes to separate @@ -315,13 +316,15 @@ % between each \meta{key} of the template interface with an % underlying\meta{variable}. % -% \begin{syntax} +% \begin{quotation} +% \obeylines +% \noindent % \meta{key1}~"="~\meta{variable1}, % \meta{key2}~"="~\meta{variable2}, % \meta{key3}~"="~global~\meta{variable3}, % \meta{key4}~"="~global~\meta{variable4}, % \ldots -% \end{syntax} +% \end{quotation} % With the exception of the choice, code and function key types, % the \meta{variable} here should be the name of an existing % \LaTeX3 register. As illustrated, the key word \enquote{global} @@ -2522,10 +2525,10 @@ } \cs_new_protected_nopar:Npn \@@_show:Nnnn #1#2#3#4 { - \__msg_term:nnnnn { xtemplate } + \__msg_show_pre:nnnnnn { xtemplate } { \prop_if_empty:NTF #1 { show-no-attribute } { show-attribute } } - {#2} {#3} {#4} - \__msg_show_variable:n + {#2} {#3} {#4} { } + \__msg_show_wrap:n { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } % \end{macrocode} @@ -2543,16 +2546,17 @@ \@@_recover_values:n { #1 / #2 / #3 } \prop_if_empty:NTF \l_@@_values_prop { - \__msg_term:nnnnn { xtemplate } { show-no-values } - {#1} {#2} {#3} - \__msg_show_variable:n { } + \__msg_show_pre:nnnnnn { xtemplate } { show-no-values } + {#1} {#2} {#3} { } + \__msg_show_wrap:n { } } { - \prop_pop:NnN \l_@@_values_prop { from~template } + \prop_pop:NnNF \l_@@_values_prop { from~template } \l_@@_tmp_tl - \__msg_term:nnnnnV { xtemplate } { show-values } + { \tl_clear:N \l_@@_tmp_tl } + \__msg_show_pre:nnnnnV { xtemplate } { show-values } {#1} {#2} {#3} \l_@@_tmp_tl - \__msg_show_variable:n + \__msg_show_wrap:n { \prop_map_function:NN \l_@@_values_prop \__msg_show_item_unbraced:nn @@ -2768,7 +2772,7 @@ The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ \tl_if_empty:nF {#2} { (from~collection~'#2')~ } of~object~type~'#1'~ - \str_if_eq:nnF { \q_no_value } {#4} { (from~template~'#4')~ } + \tl_if_empty:nF {#4} { (from~template~'#4')~ } has~values: } % \end{macrocode} |