diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2012-10-06 09:34:54 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2012-10-06 09:34:54 +0000 |
commit | 11eb9a3891b7dd3261bf06e2421e6ae87aba4153 (patch) | |
tree | 0a1ec8718e0c0ac641c4e7630e2278a438d9b11a /Master/texmf-dist/source/latex | |
parent | a9a23194b1cababcf9c24e48937a726cb465813a (diff) |
l3kernel update
git-svn-id: svn://tug.org/texlive/trunk@27898 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
22 files changed, 413 insertions, 454 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 527411ab125..ccb816a9bf5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -49,8 +49,8 @@ %<*driver|package> \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/09/05} -\def\ExplFileVersion{4205} +\def\ExplFileDate{2012/09/29} +\def\ExplFileVersion{4249} %</driver|package> %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins deleted file mode 100644 index 0df5abf9424..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3.ins +++ /dev/null @@ -1,92 +0,0 @@ -\iffalse meta-comment - -File l3.ins Copyright (C) 2011,2012 The LaTeX3 Project - -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3kernel bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - -The released version of this bundle is available from CTAN. - -\fi - -\let\jobname\relax -\input l3docstrip.dtx -\askforoverwritefalse - -\preamble - -EXPERIMENTAL CODE - -Do not distribute this file without also distributing the -source files specified above. - -Do not distribute a modified version of this file. - -\endpreamble -% stop docstrip adding \endinput -\postamble -\endpostamble - -\keepsilent - -% ===== PACKAGE ONLY ====== -\generate{\file{expl3.sty} {\from{expl3.dtx} {package}}} -% ======================== -\generate{\file{l3bootstrap.sty} {\from{l3bootstrap.dtx}{package}}} -\generate{\file{l3names.sty} {\from{l3names.dtx} {package}}} -\generate{\file{l3basics.sty} {\from{l3basics.dtx} {package}}} -\generate{\file{l3expan.sty} {\from{l3expan.dtx} {package}}} -\generate{\file{l3tl.sty} {\from{l3tl.dtx} {package}}} -\generate{\file{l3seq.sty} {\from{l3seq.dtx} {package}}} -\generate{\file{l3int.sty} {\from{l3int.dtx} {package}}} -\generate{\file{l3quark.sty} {\from{l3quark.dtx} {package}}} -\generate{\file{l3prg.sty} {\from{l3prg.dtx} {package}}} -\generate{\file{l3clist.sty} {\from{l3clist.dtx} {package}}} -\generate{\file{l3token.sty} {\from{l3token.dtx} {package}}} -\generate{\file{l3prop.sty} {\from{l3prop.dtx} {package}}} -\generate{\file{l3msg.sty} {\from{l3msg.dtx} {package}}} -\generate{\file{l3file.sty} {\from{l3file.dtx} {package}}} -\generate{\file{l3skip.sty} {\from{l3skip.dtx} {package}}} -\generate{\file{l3keys.sty} {\from{l3keys.dtx} {package}}} -\generate - {% - \file{l3fp.sty} - {% - \from{l3fp.dtx} {package} - \from{l3fp-aux.dtx} {package} - \from{l3fp-traps.dtx} {package} - \from{l3fp-round.dtx} {package} - \from{l3fp-parse.dtx} {package} - \from{l3fp-logic.dtx} {package} - \from{l3fp-basics.dtx} {package} - \from{l3fp-extended.dtx}{package} - \from{l3fp-expo.dtx} {package} - \from{l3fp-trig.dtx} {package} - \from{l3fp-convert.dtx} {package} - \from{l3fp-assign.dtx} {package} - \from{l3fp-old.dtx} {package} - }% - } -\generate{\file{l3box.sty} {\from{l3box.dtx} {package}}} -\generate{\file{l3coffins.sty} {\from{l3coffins.dtx} {package}}} -\generate{\file{l3color.sty} {\from{l3color.dtx} {package}}} -\generate{\file{l3luatex.sty} {\from{l3luatex.dtx} {package}}} -\generate{\file{l3candidates.sty}{\from{l3candidates.dtx} {package}}} - -\generate{\file{l3doc.cls} {\from{l3doc.dtx} {class}}} -\generate{\file{l3doc.ist} {\from{l3doc.dtx} {docist}}} - -\generate{\file{l3dvips.def} {\from{l3drivers.dtx}{package,dvips} }} -\generate{\file{l3pdfmode.def} {\from{l3drivers.dtx}{package,pdfmode} }} -\generate{\file{l3xdvipdfmx.def} {\from{l3drivers.dtx}{package,xdvipdfmx}}} - -\generate{\file{l3docstrip.tex}{\from{l3docstrip.dtx}{program}}} - -\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index ac429fd8883..d38807ba1f6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3basics.dtx 4144 2012-08-27 19:37:16Z bruno $ +\GetIdInfo$Id: l3basics.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Basic definitions} %</driver|package> %<*driver> @@ -677,14 +677,15 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-12-22]{\cs_show:N, \cs_show:c} +% \begin{function}[updated = 2012-09-09]{\cs_show:N, \cs_show:c} % \begin{syntax} % \cs{cs_show:N} \meta{control sequence} % \end{syntax} % Displays the definition of the \meta{control sequence} on the % terminal. % \begin{texnote} -% This is the \TeX{} primitive \tn{show}. +% This is similar to the \TeX{} primitive \tn{show}, wrapped to a +% fixed number of characters per line. % \end{texnote} % \end{function} % @@ -1299,7 +1300,7 @@ % % \begin{function}{\__kernel_register_show:N, \__kernel_register_show:c} % \begin{syntax} -% \cs{\__kernel_register_show:N} \meta{register} +% \cs{__kernel_register_show:N} \meta{register} % \end{syntax} % Used to show the contents of a \TeX{} register at the terminal, formatted % such that internal parts of the mechanism are not visible. @@ -1410,16 +1411,13 @@ % \end{macro} % % \begin{macro}[EXP]{\token_to_meaning:N, \token_to_str:N, \cs_meaning:N} -% \begin{macro}{\cs_show: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 -\tex_let:D \cs_show:N \tex_show:D % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\scan_stop:, \group_begin:, \group_end:} % The next three are basic functions for which there also exist @@ -1458,17 +1456,12 @@ % \end{macro} % % \begin{macro}[EXP]{\token_to_meaning:c, \token_to_str:c, \cs_meaning:c} -% \begin{macro}{\cs_show:c} % A small number of variants defined by hand. % Some of the necessary functions % (\cs{use_i:nn}, \cs{use_ii:nn}, and \cs{exp_args:NNc}) are not % defined at that point yet, but will be defined before those variants % are used. The \cs{cs_meaning:c} command must check for an undefined -% control sequence to avoid defining it mistakenly. The -% \cs{cs_show:c} command is \enquote{protected} because its action is -% not expandable. Also, the conversion of its argument to a control -% sequence is done within a group to avoid showing \tn{relax} for -% undefined control sequences. +% control sequence to avoid defining it mistakenly. % \begin{macrocode} \tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N } \tex_long:D \tex_def:D \cs_meaning:c #1 @@ -1482,11 +1475,8 @@ { \tl_to_str:n {undefined} } } \tex_let:D \token_to_meaning:c = \cs_meaning:c -\etex_protected:D \tex_def:D \cs_show:c - { \group_begin: \exp_args:NNc \group_end: \cs_show:N } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Defining some constants} % @@ -2891,7 +2881,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Diagnostic wrapper functions} +% \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 @@ -2911,6 +2901,41 @@ % \end{macrocode} % \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 +% 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_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} % % \begin{macro}[pTF, EXP] diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index e5c2ab164f4..12da7598665 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -1865,10 +1865,14 @@ } \cs_new_protected:Npn \@@_find_corner_maxima_aux:nn #1#2 { - \dim_set_min:Nn \l_@@_left_corner_dim {#1} - \dim_set_max:Nn \l_@@_right_corner_dim {#1} - \dim_set_min:Nn \l_@@_bottom_corner_dim {#2} - \dim_set_max:Nn \l_@@_top_corner_dim {#2} + \dim_set:Nn \l_@@_left_corner_dim + { \dim_min:nn { \l_@@_left_corner_dim } {#1} } + \dim_set:Nn \l_@@_right_corner_dim + { \dim_max:nn { \l_@@_right_corner_dim } {#1} } + \dim_set:Nn \l_@@_bottom_corner_dim + { \dim_min:nn { \l_@@_bottom_corner_dim } {#2} } + \dim_set:Nn \l_@@_top_corner_dim + { \dim_max:nn { \l_@@_top_corner_dim } {#2} } } % \end{macrocode} % \end{macro} @@ -1887,7 +1891,10 @@ { \@@_find_bounding_shift_aux:nn ##2 } } \cs_new_protected:Npn \@@_find_bounding_shift_aux:nn #1#2 - { \dim_set_min:Nn \l_@@_bounding_shift_dim {#1} } + { + \dim_set:Nn \l_@@_bounding_shift_dim + { \dim_min:nn { \l_@@_bounding_shift_dim } {#1} } + } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 948976f4110..0f76f18b72b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3clist.dtx 4102 2012-08-15 16:08:27Z bruno $ +\GetIdInfo$Id: l3clist.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Comma separated lists} %</driver|package> %<*driver> @@ -516,14 +516,14 @@ % % \section{Viewing comma lists} % -% \begin{function}{\clist_show:N, \clist_show:c} +% \begin{function}[updated = 2012-09-09]{\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}{\clist_show:n} +% \begin{function}[updated = 2012-09-09]{\clist_show:n} % \begin{syntax} % \cs{clist_show:n} \Arg{tokens} % \end{syntax} @@ -1357,14 +1357,14 @@ % % \begin{macro}{\clist_show:N, \clist_show:c} % \begin{macro}{\clist_show:n} -% Apply the general \cs{__msg_show_variable:Nnx}. In the case +% 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. % \begin{macrocode} \cs_new_protected:Npn \clist_show:N #1 { - \__msg_show_variable:Nnx #1 { clist } + \__msg_show_variable:Nnn #1 { clist } { \clist_map_function:NN #1 \__msg_show_item:n } } \cs_new_protected:Npn \clist_show:n #1 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 1c7f4836804..e6369d38bb5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3coffins.dtx 4092 2012-08-14 14:04:41Z bruno $ +\GetIdInfo$Id: l3coffins.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Coffin code layer} %</driver|package> %<*driver> @@ -304,7 +304,7 @@ % both printed in the \meta{colour} specified. % \end{function} % -% \begin{function}[updated = 2012-01-01] +% \begin{function}[updated = 2012-09-09] % {\coffin_show_structure:N, \coffin_show_structure:c} % \begin{syntax} % \cs{coffin_show_structure:N} \meta{coffin} @@ -1676,7 +1676,7 @@ { \@@_if_exist:NT #1 { - \__msg_show_variable:Nnx #1 { coffins } + \__msg_show_variable:Nnn #1 { coffins } { \prop_map_function:cN { l_@@_poles_ \__int_value:w #1 _prop } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index bea9cf251ce..1a77c975255 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. %</driver|class> % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 4130 2012-08-20 21:30:22Z joseph $ +\GetIdInfo$Id: l3doc.dtx 4230 2012-09-24 21:44:28Z joseph $ {L3 Experimental documentation class} %</driver|class> % @@ -2061,6 +2061,7 @@ Do not distribute a modified version of this file. \clist_map_inline:nn {#1} { \clist_put_right:Nn \g_docinput_clist {##1} + \tl_gclear:N \g_@@_module_name_tl \MakePercentIgnore \input{##1} \MakePercentComment @@ -2078,6 +2079,7 @@ Do not distribute a modified version of this file. \clist_map_inline:Nn \g_docinput_clist { \MakePercentIgnore + \tl_gclear:N \g_@@_module_name_tl \input{##1} \MakePercentComment } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 623ae7c4fa9..df61cb4b0e4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -53,6 +53,9 @@ %</gobble> \def\filename{docstrip.dtx} \documentclass[full]{l3doc} + \ExplSyntaxOn + \cs_set_eq:NN \__codedoc_replace_at_at:N \use_none:n + \ExplSyntaxOff \begin{document} \DocInput{\jobname.dtx} \end{document} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 5011c868715..c9e689f06ca 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3file.dtx 4101 2012-08-15 16:05:33Z bruno $ +\GetIdInfo$Id: l3file.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 File and I/O operations} %</driver|package> %<*driver> @@ -218,7 +218,7 @@ % to other programmers. % \end{function} % -% \begin{function}{\ior_list_streams:, \iow_list_streams:} +% \begin{function}[updated = 2012-09-09]{\ior_list_streams:, \iow_list_streams:} % \begin{syntax} % \cs{ior_list_streams:} % \cs{iow_list_streams:} @@ -313,7 +313,7 @@ % (\emph{cf.}~\cs{iow_shipout_x:Nn}). % \end{function} % -% \begin{function}{\iow_shipout_x:Nn, \iow_shipout_x:Nx} +% \begin{function}[updated = 2012-09-08]{\iow_shipout_x:Nn, \iow_shipout_x:Nx} % \begin{syntax} % \cs{iow_shipout_x:Nn} \meta{stream} \Arg{tokens} % \end{syntax} @@ -324,7 +324,7 @@ % these functions suitable for including material finalised during % the page building process (such as the page number integer). % \begin{texnote} -% \cs{iow_shipout_x:Nn} is the \TeX{} primitive \tn{write} renamed. +% This is a wrapper around the \TeX{} primitive \tn{write}. % \end{texnote} % \end{function} % @@ -1075,7 +1075,7 @@ \__msg_term:nnn { LaTeX / kernel } { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } {#2} - \__msg_show_variable:x + \__msg_show_variable:n { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } % \end{macrocode} @@ -1336,9 +1336,11 @@ % \subsubsection{Deferred writing} % % \begin{macro}{\iow_shipout_x:Nn, \iow_shipout_x:Nx} -% First the easy part, this is the primitive. +% First the easy part, this is the primitive, which expects its +% argument to be braced. % \begin{macrocode} -\cs_new_eq:NN \iow_shipout_x:Nn \tex_write:D +\cs_new_protected:Npn \iow_shipout_x:Nn #1#2 + { \tex_write:D #1 {#2} } \cs_generate_variant:Nn \iow_shipout_x:Nn { Nx } % \end{macrocode} % \end{macro} @@ -1347,7 +1349,7 @@ % With \eTeX{} available deferred writing without expansion is easy. % \begin{macrocode} \cs_new_protected:Npn \iow_shipout:Nn #1#2 - { \iow_shipout_x:Nn #1 { \exp_not:n {#2} } } + { \tex_write:D #1 { \exp_not:n {#2} } } \cs_generate_variant:Nn \iow_shipout:Nn { Nx } % \end{macrocode} % \end{macro} @@ -1364,7 +1366,7 @@ % need to be doubled. % \begin{macrocode} \cs_new_protected:Npn \iow_now:Nn #1#2 - { \tex_immediate:D \iow_shipout_x:Nn #1 { \exp_not:n {#2} } } + { \tex_immediate:D \tex_write:D #1 { \exp_not:n {#2} } } \cs_generate_variant:Nn \iow_now:Nn { Nx } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins deleted file mode 100644 index 76fe0ee3e76..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3format.ins +++ /dev/null @@ -1,92 +0,0 @@ -\iffalse meta-comment - -File l3format.ins Copyright (C) 2011,2012 The LaTeX3 Project - -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3kernel bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - -The released version of this bundle is available from CTAN. - -\fi - -\let\jobname\relax -\input l3docstrip.dtx -\askforoverwritefalse - -\preamble - -EXPERIMENTAL CODE - -Do not distribute this file without also distributing the -source files specified above. - -Do not distribute a modified version of this file. - -\endpreamble -% stop docstrip adding \endinput -\postamble -\endpostamble - -\keepsilent - -\generate - { - \file{l3format.ltx} - { - \from{l3bootstrap.dtx} {initex} - \from{l3names.dtx} {initex} - \from{l3basics.dtx} {initex} - \from{l3expan.dtx} {initex} - \from{l3tl.dtx} {initex} - \from{l3seq.dtx} {initex} - % ===== ===FORMAT ONLY ========= - \from{l3alloc.dtx} {initex} - % ============================== - \from{l3int.dtx} {initex} - \from{l3quark.dtx} {initex} - \from{l3prg.dtx} {initex} - \from{l3clist.dtx} {initex} - \from{l3token.dtx} {initex} - \from{l3prop.dtx} {initex} - \from{l3msg.dtx} {initex} - \from{l3file.dtx} {initex} - \from{l3skip.dtx} {initex} - \from{l3keys.dtx} {initex} - \from{l3fp.dtx} {initex} - \from{l3fp-aux.dtx} {initex} - \from{l3fp-traps.dtx} {initex} - \from{l3fp-round.dtx} {initex} - \from{l3fp-parse.dtx} {initex} - \from{l3fp-logic.dtx} {initex} - \from{l3fp-basics.dtx} {initex} - \from{l3fp-extended.dtx}{initex} - \from{l3fp-expo.dtx} {initex} - \from{l3fp-trig.dtx} {initex} - \from{l3fp-convert.dtx} {initex} - \from{l3fp-assign.dtx} {initex} - \from{l3fp-old.dtx} {initex} - \from{l3box.dtx} {initex} - \from{l3coffins.dtx} {initex} - \from{l3color.dtx} {initex} - \from{l3luatex.dtx} {initex} - \from{l3candidates.dtx} {initex} - % ======== FORMAT ONLY ========= - \from{l3final.dtx} {initex} - % ============================== - } - } - -\generate{\file{l3dvips.ltx} {\from{l3drivers.dtx}{initex,dvips} }} -\generate{\file{l3pdfmode.ltx} {\from{l3drivers.dtx}{initex,pdfmode} }} -\generate{\file{l3xdvipdfmx.ltx}{\from{l3drivers.dtx}{initex,xdvipdfmx}}} - -\generate{\file{l3docstrip.tex}{\from{l3docstrip.dtx}{program}}} - -\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index 142a3c5afac..c207d30abf5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-assign.dtx 4129 2012-08-20 20:38:28Z mittelba $ +\GetIdInfo$Id: l3fp-assign.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Floating-point assignments} \documentclass[full]{l3doc} \begin{document} @@ -183,20 +183,20 @@ % % \begin{macro}{\fp_show:N, \fp_show:c, \fp_show:n} % This shows the result of computing its argument. The -% \cs{__msg_show_variable:x} auxiliary expects its input in a slightly odd -% form, starting with |>|, and displays the rest. +% \cs{__msg_show_variable:n} auxiliary expects its input in a slightly +% odd form, starting with |>~|, and displays the rest. % \begin{macrocode} \cs_new_protected:Npn \fp_show:N #1 { \fp_if_exist:NTF #1 - { \__msg_show_variable:x { > \fp_to_tl:N #1 } } + { \__msg_show_variable:n { > ~ \fp_to_tl:N #1 } } { \__msg_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } \cs_new_protected:Npn \fp_show:n #1 - { \__msg_show_variable:x { > \fp_to_tl:n {#1} } } + { \__msg_show_variable:n { > ~ \fp_to_tl:n {#1} } } \cs_generate_variant:Nn \fp_show:N { c } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 52fda439459..7bb9f89a507 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> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-convert.dtx 4180 2012-08-31 16:44:34Z bruno $ +\GetIdInfo$Id: l3fp-convert.dtx 4234 2012-09-26 09:43:31Z bruno $ {L3 Floating-point conversion} \documentclass[full]{l3doc} \begin{document} @@ -473,6 +473,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\fp_max:nn, \fp_min:nn} +% Similar to \cs{fp_abs:n}, for consistency with \cs{int_max:nn}, \emph{etc.} +% \begin{macrocode} +\cs_new:Npn \fp_max:nn #1#2 + { \fp_to_decimal:n { max ( \@@_parse:n {#1} , \@@_parse:n {#2} ) } } +\cs_new:Npn \fp_min:nn #1#2 + { \fp_to_decimal:n { min ( \@@_parse:n {#1} , \@@_parse:n {#2} ) } } +% \end{macrocode} +% \end{macro} +% % \subsection{Convert an array of floating points to a comma list} % % \begin{macro}[int, EXP]{\@@_array_to_clist:n} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 5cf7c0ccf91..6eff317f94c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp.dtx 4151 2012-08-28 11:51:52Z bruno $ +\GetIdInfo$Id: l3fp.dtx 4234 2012-09-26 09:43:31Z bruno $ {L3 Floating points} %</driver|package> %<*driver> @@ -981,7 +981,19 @@ % \cs{fp_eval:n} and leaves the absolute value of the result in the % input stream. This function does not raise any exception beyond % those raised when evaluating its argument. Within floating point -% expressios, |abs()| can be used. +% expressions, |abs()| can be used. +% \end{function} +% +% \begin{function}[EXP, added = 2012-09-26, tested = m3fp-convert003] +% {\fp_max:nn, \fp_min:nn} +% \begin{syntax} +% \cs{fp_max:nn} \Arg{fp expression 1} \Arg{fp expression 2} +% \end{syntax} +% Evaluates the \meta{floating point expressions} as described for +% \cs{fp_eval:n} and leaves the resulting larger (\texttt{max}) or smaller +% (\texttt{min}) value in the input stream. This function does not raise any +% exception beyond those raised when evaluating its argument. Within +% floating point expressions, |max()| and |min()| can be used. % \end{function} % % \section{Disclaimer and roadmap} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 7a176c93588..e67616a2f7d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3int.dtx 4121 2012-08-17 01:36:30Z bruno $ +\GetIdInfo$Id: l3int.dtx 4237 2012-09-26 10:18:58Z bruno $ {L3 Integers} %</driver|package> %<*driver> @@ -93,7 +93,7 @@ % \tl_new:N \l_my_tl % \tl_set:Nn \l_my_tl { 5 } % \int_new:N \l_my_int -% \int\set:Nn \l_my_int { 4 } +% \int_set:Nn \l_my_int { 4 } % \int_eval:n { \l_my_tl + \l_my_int * 3 - ( 3 + 4 * 5 ) } % \end{verbatim} % both evaluate to \( -6 \). The \Arg{integer expression} may @@ -105,7 +105,7 @@ % suitable termination if used in a \TeX{}-style integer assignment. % \end{function} % -% \begin{function}[EXP]{\int_abs:n} +% \begin{function}[EXP, updated = 2012-09-26]{\int_abs:n} % \begin{syntax} % \cs{int_abs:n} \Arg{integer expression} % \end{syntax} @@ -115,7 +115,7 @@ % expansions. % \end{function} % -% \begin{function}[EXP]{\int_div_round:nn} +% \begin{function}[EXP, updated = 2012-09-26]{\int_div_round:nn} % \begin{syntax} % \cs{int_div_round:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -138,7 +138,7 @@ % \meta{integer denotation} after two expansions. % \end{function} % -% \begin{function}[EXP]{\int_max:nn, \int_min:nn} +% \begin{function}[EXP, updated = 2012-09-26]{\int_max:nn, \int_min:nn} % \begin{syntax} % \cs{int_max:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \cs{int_min:nn} \Arg{intexpr_1} \Arg{intexpr_2} @@ -149,7 +149,7 @@ % expansions. % \end{function} % -% \begin{function}[EXP]{\int_mod:nn} +% \begin{function}[EXP, updated = 2012-09-26]{\int_mod:nn} % \begin{syntax} % \cs{int_mod:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} @@ -941,48 +941,56 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\int_max:nn} +% \begin{macro}[EXP]{\int_abs:n} +% \begin{macro}[aux, EXP]{\@@_abs:N} % \UnitTested -% \begin{macro}{\int_min:nn} +% \begin{macro}[EXP]{\int_max:nn} +% \begin{macro}[EXP]{\int_min:nn} +% \begin{macro}[aux, EXP]{\@@_maxmin:wwN} % \UnitTested -% \begin{macro}{\int_abs:n} % \UnitTested -% Functions for $\min$, $\max$, and absolute value. +% Functions for $\min$, $\max$, and absolute value with only one +% evaluation. The absolute value is obtained by removing a leading +% sign if any. All three functions expand in two steps. % \begin{macrocode} \cs_new:Npn \int_abs:n #1 { - \@@_value:w - \if_int_compare:w \@@_eval:w #1 < \c_zero - - - \fi: - \@@_eval:w #1 \@@_eval_end: + \@@_value:w \exp_after:wN \@@_abs:N + \int_use:N \@@_eval:w #1 \@@_eval_end: + \exp_stop_f: } -\cs_new:Npn \int_max:nn #1#2 +\cs_new:Npn \@@_abs:N #1 + { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } +\cs_set:Npn \int_max:nn #1#2 { - \@@_value:w \@@_eval:w - \if_int_compare:w - \@@_eval:w #1 > \@@_eval:w #2 \@@_eval_end: - #1 - \else: - #2 - \fi: - \@@_eval_end: + \@@_value:w \exp_after:wN \@@_maxmin:wwN + \int_use:N \@@_eval:w #1 \exp_after:wN ; + \int_use:N \@@_eval:w #2 ; + > + \exp_stop_f: } -\cs_new:Npn \int_min:nn #1#2 +\cs_set:Npn \int_min:nn #1#2 { - \@@_value:w \@@_eval:w - \if_int_compare:w - \@@_eval:w #1 < \@@_eval:w #2 \@@_eval_end: - #1 - \else: - #2 - \fi: - \@@_eval_end: + \@@_value:w \exp_after:wN \@@_maxmin:wwN + \int_use:N \@@_eval:w #1 \exp_after:wN ; + \int_use:N \@@_eval:w #2 ; + < + \exp_stop_f: + } +\cs_new:Npn \@@_maxmin:wwN #1 ; #2 ; #3 + { + \if_int_compare:w #1 #3 #2 ~ + #1 + \else: + #2 + \fi: } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}[EXP]{\int_div_truncate:nn} % \UnitTested @@ -991,6 +999,7 @@ % \begin{macro}[EXP]{\int_mod:nn} % \UnitTested % \begin{macro}[aux, EXP]{\@@_div_truncate:NwNw} +% \begin{macro}[aux, EXP]{\@@_mod:ww} % As \cs{@@_eval:w} rounds the result of a division we also provide a % version that truncates the result. We use an auxiliary to make sure % numerator and denominator are only evaluated once: this comes in @@ -1028,21 +1037,26 @@ % \end{macrocode} % For the sake of completeness: % \begin{macrocode} -\cs_new:Npn \int_div_round:nn #1#2 { \int_eval:n { ( #1 ) / ( #2 ) } } +\cs_new:Npn \int_div_round:nn #1#2 + { \@@_value:w \@@_eval:w ( #1 ) / ( #2 ) \@@_eval_end: } % \end{macrocode} % Finally there's the modulus operation. % \begin{macrocode} \cs_new:Npn \int_mod:nn #1#2 { - \@@_value:w \@@_eval:w - #1 - \int_div_truncate:nn {#1} {#2} * ( #2 ) + \@@_value:w \@@_eval:w \exp_after:wN \@@_mod:ww + \@@_value:w \@@_eval:w #1 \exp_after:wN ; + \@@_value:w \@@_eval:w #2 ; \@@_eval_end: } +\cs_new:Npn \@@_mod:ww #1; #2; + { #1 - ( \@@_div_truncate:NwNw #1 ; #2 ; ) * #2 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Creating and initialising integers} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index dea8b1923a9..c24027b488a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3keys.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3keys.dtx 4248 2012-09-29 19:55:27Z joseph $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> @@ -786,7 +786,7 @@ \tl_replace_all:Nnn \l_@@_sanitise_tl { , } { 9 } \tl_clear:N \l_@@_parse_tl \exp_after:wN \@@_parse_elt:w \exp_after:wN - \q_no_value \l_@@_sanitise_tl 9 \q_nil 9 + \q_nil \l_@@_sanitise_tl 9 \q_recursion_tail 9 \q_recursion_stop \exp_after:wN \group_end: \l_@@_parse_tl } @@ -795,22 +795,20 @@ % \end{macro} % % \begin{macro}{\@@_parse_elt:w} -% Each item to be parsed will have \cs{q_no_value} added to the front. +% Each item to be parsed will have \cs{q_nil} added to the front. % Hence the blank test here can always be used to find a totally % empty argument. If this is the case, the system loops round. If there -% is something to parse, there is a check for the \cs{q_nil} marker -% and if not a hand-off. +% is something to parse, there is a check for the end of the input before +% handing off. % \begin{macrocode} \cs_new_protected:Npn \@@_parse_elt:w #1 , { \tl_if_blank:oTF { \use_none:n #1 } - { \@@_parse_elt:w \q_no_value } + { \@@_parse_elt:w \q_nil } { - \quark_if_nil:oF { \use_ii:nn #1 } - { - \@@_split_key_value:w #1 = = \q_stop - \@@_parse_elt:w \q_no_value - } + \quark_if_recursion_tail_stop:o { \use_ii:nn #1 } + \@@_split_key_value:w #1 = = \q_stop + \@@_parse_elt:w \q_nil } } % \end{macrocode} @@ -829,7 +827,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_split_key_value:w #1 = #2 \q_stop { - \@@_split_key:w #1 \q_stop + \@@_split_key:n {#1} \str_if_eq:nnTF {#2} { = } { \tl_put_right:Nx \l_@@_parse_tl @@ -851,18 +849,28 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_split_key:w} -% The aim here is to remove spaces and also exactly one set of braces. -% There is also a quark to remove, hence the \cs{use_none:n} appearing before -% application of \cs{tl_trim_spaces:n}. +% \begin{macro}{\@@_split_key:n} +% \begin{macro}[aux]{\@@_split_key:w} +% There are two possible cases here. The first case is that |#1| is +% surrounded by braces, in which case the |\use_none:nnn #1 \q_nil \q_nil| +% will yield \cs{q_nil}. There, we can remove the leading \cs{q_nil}, the +% braces and any spaces around the outside with \cs{use_ii:nnn}. On the +% other hand, if there are no braces then the second branch removes the +% leading \cs{q_nil} and any surrounding spaces. (This code does not have +% to cover the case with no key, as that's already taken out above.) % \begin{macrocode} -\cs_new_protected:Npn \@@_split_key:w #1 \q_stop +\cs_new_protected:Npn \@@_split_key:n #1 { - \tl_set:Nx \l_@@_key_tl - { \exp_after:wN \tl_trim_spaces:n \exp_after:wN { \use_none:n #1 } } + \str_if_eq_x:nnTF + { \exp_not:N \q_nil } { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } + { \tl_set:Nx \l_@@_key_tl { \exp_not:o { \use_ii:nnn #1 \q_nil } } } + { \@@_split_key:w #1 \q_stop } } +\cs_new_protected:Npn \@@_split_key:w \q_nil #1 \q_stop + { \tl_set:Nx \l_@@_key_tl { \tl_trim_spaces:n {#1} } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_split_value:w} % Here the value has to be separated from the equals signs and the diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index a1e30326917..3d72db5db51 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3msg.dtx 4147 2012-08-28 10:27:33Z bruno $ +\GetIdInfo$Id: l3msg.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Messages} %</driver|package> %<*driver> @@ -723,37 +723,37 @@ % completely. % \end{function} % -% \begin{function}[updated = 2012-08-14] -% {\__msg_show_variable:Nnn, \__msg_show_variable:Nnx} +% \begin{function}[updated = 2012-09-09]{\__msg_show_variable:Nnn} % \begin{syntax} % \cs{__msg_show_variable:Nnn} \meta{variable} \Arg{type} \Arg{formatted content} % \end{syntax} -% Displays the \meta{formatted content} of the \meta{variable} of \meta{type} -% in the terminal. The \meta{formatted content} will typically be generated -% by \texttt{x}-type expansion using the \cs{__msg_show_variable:Nnx} variant: -% the nature of the formatting is dependent on the calling module. -% The \meta{formatted content} must be a string, either empty or -% containing |>|; everything until the first |>| will be removed. +% 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. % \end{function} % -% \begin{function}{\__msg_show_variable:n, \__msg_show_variable:x} +% \begin{function}[updated = 2012-09-09]{\__msg_show_variable:n} % \begin{syntax} -% \cs{__msg_show_variable:n} \Arg{formatted string} +% \cs{__msg_show_variable:n} \Arg{formatted text} % \end{syntax} -% Shows the \meta{formatted string} on the terminal. After expansion, -% unless it is empty, the \meta{formatted string} must contain |>|, -% and the part of \meta{formatted string} before the first |>| is +% Shows the \meta{formatted text} on the terminal. 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} +% \begin{function}[updated = 2012-09-09] % {\__msg_show_item:n, \__msg_show_item:nn, \__msg_show_item_unbraced:nn} % \begin{syntax} % \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:Nnx} to format variable items correctly for +% \cs{__msg_show_variable:Nnn} 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. @@ -2038,57 +2038,59 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_show_variable:Nnn, \@@_show_variable:Nnx} -% \begin{macro}[int]{\@@_show_variable:n, \@@_show_variable:x} -% \begin{macro}[aux,EXP]{\@@_show_variable:w} -% The arguments of \cs{@@_show_variable:Nnx} are +% \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{itemize} % \item The \meta{variable} to be shown. -% \item The \texttt{TF} emptiness conditional for that type of variables. % \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. % \end{itemize} -% We remove a new line and \verb*|> | from the first item using -% a \texttt{w}-type auxiliary, and the fact that \texttt{f}-expansion -% removes a space. To avoid a low-level \TeX{} error if there is -% an empty argument, a simple test is used to keep the output -% \enquote{clean}. The odd \cs{exp_after:wN} which expands the closing -% brace improves the output slightly. +% 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. % \begin{macrocode} \cs_new_protected:Npn \@@_show_variable:Nnn #1#2#3 { \cs_if_exist:NTF #1 { \@@_term:nnn { LaTeX / kernel } { show- #2 } {#1} - \@@_show_variable:x { \tl_to_str:n {#3} } + \@@_show_variable:n {#3} } { \@@_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } -\cs_generate_variant:Nn \@@_show_variable:Nnn { Nnx } \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 { - \tl_set:Nn \l_@@_internal_tl {#1} - \tl_if_empty:NTF \l_@@_internal_tl - { \etex_showtokens:D \exp_after:wN { } } - { - \exp_args:Nf \etex_showtokens:D - { - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_show_variable:w - \exp_after:wN \l_@@_internal_tl - } - } + \tl_if_empty:nTF {#1} + { \tl_clear:N \l_@@_internal_tl } + { \tl_set:Nf \l_@@_internal_tl { \@@_show_variable_aux:w #1 } } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \l_@@_internal_tl } } -\cs_generate_variant:Nn \@@_show_variable:n { x } -\cs_new:Npn \@@_show_variable:w #1 > { } +\cs_new:Npn \@@_show_variable_aux:w #1 > { } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[int,EXP]{\@@_show_item:n} % \begin{macro}[int,EXP]{\@@_show_item:nn} @@ -2098,17 +2100,17 @@ % \begin{macrocode} \cs_new:Npn \@@_show_item:n #1 { - \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } + \\ > \ \ \{ \tl_to_str:n {#1} \} } \cs_new:Npn \@@_show_item:nn #1#2 { - \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \exp_not:n {#2} } + \\ > \ \ \{ \tl_to_str:n {#1} \} + \ \ => \ \ \{ \tl_to_str:n {#2} \} } \cs_new:Npn \@@_show_item_unbraced:nn #1#2 { - \iow_newline: > \c_space_tl \c_space_tl \exp_not:n {#1} - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} + \\ > \ \ \tl_to_str:n {#1} + \ \ => \ \ \tl_to_str:n {#2} } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index a77f3103063..228c317ead3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -35,7 +35,7 @@ % %<*package> \RequirePackage{l3bootstrap}[2012/07/15] -\GetIdInfo$Id: l3names.dtx 3990 2012-07-16 07:46:03Z joseph $ +\GetIdInfo$Id: l3names.dtx 4230 2012-09-24 21:44:28Z joseph $ {L3 Namespace for primitives} %</package> %<*driver> @@ -603,7 +603,7 @@ % \begin{macrocode} \tex_endgroup:D % \end{macrocode} -% +% % \LaTeXe{} will have moved a few primitives, so these are sorted out. % \begin{macrocode} %<*package> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 0c81f7f9951..c7fcb2a2790 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3prg.dtx 4114 2012-08-16 01:57:02Z bruno $ +\GetIdInfo$Id: l3prg.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Control structures} %</driver|package> %<*driver> @@ -835,8 +835,8 @@ % % \begin{macro}{\bool_show:N, \bool_show:c, \bool_show: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}. We use \cs{__msg_show_variable:n} to get a better +% output; this function requires its argument to start with |>~|. % \begin{macrocode} \cs_new_protected:Npn \bool_show:N #1 { @@ -850,8 +850,8 @@ \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:n { > ~ true } } + { \__msg_show_variable:n { > ~ false } } } \cs_generate_variant:Nn \bool_show:N { c } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 81db3df7b8b..d8bec5ee50d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3prop.dtx 4190 2012-09-03 00:23:31Z bruno $ +\GetIdInfo$Id: l3prop.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Property lists} %</driver|package> %<*driver> @@ -401,7 +401,7 @@ % % \section{Viewing property lists} % -% \begin{function}{\prop_show:N, \prop_show:c} +% \begin{function}[updated = 2012-09-09]{\prop_show:N, \prop_show:c} % \begin{syntax} % \cs{prop_show:N} \meta{property list} % \end{syntax} @@ -1026,13 +1026,13 @@ % \subsection{Viewing property lists} % % \begin{macro}[tested = m3show001]{\prop_show:N, \prop_show:c} -% Apply the general \cs{__msg_show_variable:Nnx}. Contrarily +% Apply the general \cs{__msg_show_variable:Nnn}. 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:Nnx #1 { prop } + \__msg_show_variable:Nnn #1 { 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/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 596d6b832cd..1a3d34eeaac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3seq.dtx 4092 2012-08-14 14:04:41Z bruno $ +\GetIdInfo$Id: l3seq.dtx 4212 2012-09-09 12:24:04Z bruno $ {L3 Sequences and stacks} %</driver|package> %<*driver> @@ -651,7 +651,7 @@ % % \section{Viewing sequences} % -% \begin{function}{\seq_show:N, \seq_show:c} +% \begin{function}[updated = 2012-09-09]{\seq_show:N, \seq_show:c} % \begin{syntax} % \cs{seq_show:N} \meta{sequence} % \end{syntax} @@ -1551,11 +1551,11 @@ % % \begin{macro}{\seq_show:N, \seq_show:c} % \UnitTested -% Apply the general \cs{__msg_show_variable:Nnx}. +% Apply the general \cs{__msg_show_variable:Nnn}. % \begin{macrocode} \cs_new_protected:Npn \seq_show:N #1 { - \__msg_show_variable:Nnx #1 { seq } + \__msg_show_variable:Nnn #1 { 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 911fe7571f0..24fd5bf3fe8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3skip.dtx 4121 2012-08-17 01:36:30Z bruno $ +\GetIdInfo$Id: l3skip.dtx 4235 2012-09-26 09:48:18Z bruno $ {L3 Dimensions and skips} %</driver|package> %<*driver> @@ -156,26 +156,6 @@ % \meta{dimension_2}. % \end{function} % -% \begin{function}[updated = 2012-02-06] -% {\dim_set_max:Nn, \dim_set_max:cn, \dim_gset_max:Nn, \dim_gset_max:cn} -% \begin{syntax} -% \cs{dim_set_max:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Compares the current value of the \meta{dimension} with that of the -% \meta{dimension expression}, and sets the \meta{dimension} to the -% larger of these two value. -% \end{function} -% -% \begin{function}[updated = 2012-02-06] -% {\dim_set_min:Nn, \dim_set_min:cn, \dim_gset_min:Nn, \dim_gset_min:cn} -% \begin{syntax} -% \cs{dim_set_min:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Compares the current value of the \meta{dimension} with that of the -% \meta{dimension expression}, and sets the \meta{dimension} to the -% smaller of these two value. -% \end{function} -% % \begin{function}[updated = 2011-10-22] % {\dim_sub:Nn, \dim_sub:cn, \dim_gsub:Nn, \dim_gsub:cn} % \begin{syntax} @@ -187,15 +167,26 @@ % % \section{Utilities for dimension calculations} % -% \begin{function}[updated = 2011-10-22, EXP]{\dim_abs:n} +% \begin{function}[updated = 2012-09-26, EXP]{\dim_abs:n} % \begin{syntax} % \cs{dim_abs:n} \Arg{dimexpr} % \end{syntax} % Converts the \meta{dimexpr} to its absolute value, leaving the result -% in the input stream as an \meta{dimension denotation}. +% in the input stream as a \meta{dimension denotation}. +% \end{function} +% +% \begin{function}[added = 2012-09-09, updated = 2012-09-26, EXP] +% {\dim_max:nn, \dim_min:nn} +% \begin{syntax} +% \cs{dim_max:nn} \Arg{dimexpr_1} \Arg{dimexpr_2} +% \cs{dim_min:nn} \Arg{dimexpr_1} \Arg{dimexpr_2} +% \end{syntax} +% Evaluates the two \meta{dimension expressions} and leaves either the +% maximum or minimum value in the input stream as appropriate, as a +% \meta{dimension denotation}. % \end{function} % -% \begin{function}[updated = 2011-10-22, EXP]{\dim_ratio:nn} +% \begin{function}[updated = 2011-10-22, rEXP]{\dim_ratio:nn} % \begin{syntax} % \cs{dim_ratio:nn} \Arg{dimexpr_1} \Arg{dimexpr_2} % \end{syntax} @@ -1039,35 +1030,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\dim_set_max:Nn, \dim_set_max:cn} -% \begin{macro}{\dim_set_min:Nn, \dim_set_min:cn} -% \begin{macro}{\dim_gset_max:Nn, \dim_gset_max:cn} -% \begin{macro}{\dim_gset_min:Nn, \dim_gset_min:cn} -% \begin{macro}[aux]{\@@_set_max:NNNn} -% Setting maximum and minimum values is simply a case of so build-in -% comparison. This only applies to dimensions as skips are not ordered. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \dim_set_max:Nn - { \@@_set_max:NNNn < \dim_set:Nn } -\cs_new_protected_nopar:Npn \dim_gset_max:Nn - { \@@_set_max:NNNn < \dim_gset:Nn } -\cs_new_protected_nopar:Npn \dim_set_min:Nn - { \@@_set_max:NNNn > \dim_set:Nn } -\cs_new_protected_nopar:Npn \dim_gset_min:Nn - { \@@_set_max:NNNn > \dim_gset:Nn } -\cs_new_protected:Npn \@@_set_max:NNNn #1#2#3#4 - { \dim_compare:nNnT {#3} #1 {#4} { #2 #3 {#4} } } -\cs_generate_variant:Nn \dim_set_max:Nn { c } -\cs_generate_variant:Nn \dim_gset_max:Nn { c } -\cs_generate_variant:Nn \dim_set_min:Nn { c } -\cs_generate_variant:Nn \dim_gset_min:Nn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\dim_add:Nn, \dim_add:cn} % \begin{macro}{\dim_gadd:Nn, \dim_gadd:cn} % \begin{macro}{\dim_sub:Nn, \dim_sub:cn} @@ -1092,23 +1054,54 @@ % % \subsection{Utilities for dimension calculations} % -% \begin{macro}{\dim_abs:n} -% Similar to the \cs{int_abs:n} function, but here an additional -% \meta{dimexpr} is needed as \TeX{} won't simply tidy up an additional -% |-| for us. +% \begin{macro}[EXP]{\dim_abs:n} +% \begin{macro}[aux, EXP]{\@@_abs:N} +% \UnitTested +% \begin{macro}[EXP]{\dim_max:nn} +% \begin{macro}[EXP]{\dim_min:nn} +% \begin{macro}[aux, EXP]{\@@_maxmin:wwN} +% \UnitTested +% \UnitTested +% Functions for $\min$, $\max$, and absolute value with only one evaluation. +% The absolute value is evaluated by removing a leading~|-| if present. % \begin{macrocode} \cs_new:Npn \dim_abs:n #1 { - \dim_use:N - \@@_eval:w - \if_dim:w \@@_eval:w #1 < \c_zero_dim - - - \fi: - \@@_eval:w #1 \@@_eval_end: + \exp_after:wN \@@_abs:N + \dim_use:N \@@_eval:w #1 \@@_eval_end: + } +\cs_new:Npn \@@_abs:N #1 + { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } +\cs_set:Npn \dim_max:nn #1#2 + { + \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN + \dim_use:N \@@_eval:w #1 \exp_after:wN ; + \dim_use:N \@@_eval:w #2 ; + > \@@_eval_end: } +\cs_set:Npn \dim_min:nn #1#2 + { + \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN + \dim_use:N \@@_eval:w #1 \exp_after:wN ; + \dim_use:N \@@_eval:w #2 ; + < + \@@_eval_end: + } +\cs_new:Npn \@@_maxmin:wwN #1 ; #2 ; #3 + { + \if_dim:w #1 #3 #2 ~ + #1 + \else: + #2 + \fi: + } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\dim_ratio:nn} % \begin{macro}[aux]{\@@_ratio:n} @@ -1884,6 +1877,34 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\dim_set_max:Nn, \dim_set_max:cn} +% \begin{macro}{\dim_set_min:Nn, \dim_set_min:cn} +% \begin{macro}{\dim_gset_max:Nn, \dim_gset_max:cn} +% \begin{macro}{\dim_gset_min:Nn, \dim_gset_min:cn} +% \begin{macro}[aux]{\@@_set_max:NNNn} +% Deprecated on 2012-09-09 for removal after 2012-12-31. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \dim_set_max:Nn + { \@@_set_max:NNNn < \dim_set:Nn } +\cs_new_protected_nopar:Npn \dim_gset_max:Nn + { \@@_set_max:NNNn < \dim_gset:Nn } +\cs_new_protected_nopar:Npn \dim_set_min:Nn + { \@@_set_max:NNNn > \dim_set:Nn } +\cs_new_protected_nopar:Npn \dim_gset_min:Nn + { \@@_set_max:NNNn > \dim_gset:Nn } +\cs_new_protected:Npn \@@_set_max:NNNn #1#2#3#4 + { \dim_compare:nNnT {#3} #1 {#4} { #2 #3 {#4} } } +\cs_generate_variant:Nn \dim_set_max:Nn { c } +\cs_generate_variant:Nn \dim_gset_max:Nn { c } +\cs_generate_variant:Nn \dim_set_min:Nn { c } +\cs_generate_variant:Nn \dim_gset_min:Nn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index b4ae4118b33..b48cbcd1854 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3tl.dtx 4201 2012-09-05 08:00:54Z joseph $ +\GetIdInfo$Id: l3tl.dtx 4244 2012-09-28 22:46:36Z bruno $ {L3 Token lists} %</driver|package> %<*driver> @@ -352,35 +352,31 @@ % % \section{Reassigning token list character codes} % -% \begin{function}{\tl_to_lowercase:n} +% \begin{function}[updated = 2012-09-08]{\tl_to_lowercase:n} % \begin{syntax} % \cs{tl_to_lowercase:n} \Arg{tokens} % \end{syntax} -% Works through all of the \meta{tokens}, replacing each character +% Works through all of the \meta{tokens}, replacing each character token % with the lower case equivalent as defined by \cs{char_set_lccode:nn}. % Characters with no defined lower case character code are left % unchanged. This process does not alter the category code assigned % to the \meta{tokens}. % \begin{texnote} -% This is the \TeX{} primitive \tn{lowercase} renamed. As a result, -% its argument \emph{must} be given within braces, and this function -% takes place on execution and not on expansion. +% This is a wrapper around the \TeX{} primitive \tn{lowercase}. % \end{texnote} % \end{function} % -% \begin{function}{\tl_to_uppercase:n} +% \begin{function}[updated = 2012-09-08]{\tl_to_uppercase:n} % \begin{syntax} % \cs{tl_to_uppercase:n} \Arg{tokens} % \end{syntax} -% Works through all of the \meta{tokens}, replacing each character +% Works through all of the \meta{tokens}, replacing each character token % with the upper case equivalent as defined by \cs{char_set_uccode:nn}. -% Characters with no defined lower case character code are left +% Characters with no defined upper case character code are left % unchanged. This process does not alter the category code assigned % to the \meta{tokens}. % \begin{texnote} -% This is the \TeX{} primitive \tn{uppercase} renamed. As a result, -% its argument \emph{must} be given within braces, and this function -% takes place on execution and not on expansion. +% This is a wrapper around the \TeX{} primitive \tn{uppercase}. % \end{texnote} % \end{function} % @@ -784,7 +780,7 @@ % Functions which deal with either only the very first item (balanced % text or single normal token) in a token list, or the remaining tokens. % -% \begin{function}[updated = 2012-02-08, EXP] +% \begin{function}[updated = 2012-09-09, EXP] % {\tl_head:N, \tl_head:n, \tl_head:V, \tl_head:v, \tl_head:f} % \begin{syntax} % \cs{tl_head:n} \Arg{token list} @@ -809,8 +805,7 @@ % \end{verbatim} % yields \verb*| ab|. % A blank \meta{token list} (see \cs{tl_if_blank:nTF}) will result in -% \cs{tl_head:n} leaving nothing in the input stream. The \meta{token list} -% should not contain the marker \cs{q_stop}. +% \cs{tl_head:n} leaving nothing in the input stream. % \begin{texnote} % The result is returned within \cs{exp_not:n}, which means that the token % list will not expand further when appearing in an \texttt{x}-type @@ -960,24 +955,25 @@ % % \section{Viewing token lists} % -% \begin{function}{\tl_show:N, \tl_show:c} +% \begin{function}[updated = 2012-09-09]{\tl_show:N, \tl_show:c} % \begin{syntax} % \cs{tl_show:N} \meta{tl~var} % \end{syntax} % Displays the content of the \meta{tl~var} on the terminal. % \begin{texnote} -% \cs{tl_show:N} is the \TeX{} primitive \tn{show}. +% This is similar to the \TeX{} primitive \tn{show}, wrapped to a +% fixed number of characters per line. % \end{texnote} % \end{function} % -% \begin{function}{\tl_show:n} +% \begin{function}[updated = 2012-09-09]{\tl_show:n} % \begin{syntax} % \cs{tl_show:n} \meta{token list} % \end{syntax} % Displays the \meta{token list} on the terminal. % \begin{texnote} -% \cs{tl_show:n} is the \eTeX{} primitive \tn{showtokens}. -% Hence its argument \emph{must} be given within braces. +% This is similar to the \eTeX{} primitive \tn{showtokens}, wrapped +% to a fixed number of characters per line. % \end{texnote} % \end{function} % @@ -1428,10 +1424,13 @@ % % \begin{macro}{\tl_to_lowercase:n} % \begin{macro}{\tl_to_uppercase:n} -% Just some names for a few primitives. +% Just some names for a few primitives: we take care or wrapping the +% argument in braces. % \begin{macrocode} -\cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D -\cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D +\cs_new_protected:Npn \tl_to_lowercase:n #1 + { \tex_lowercase:D {#1} } +\cs_new_protected:Npn \tl_to_uppercase:n #1 + { \tex_uppercase:D {#1} } % \end{macrocode} % \end{macro} % \end{macro} @@ -1696,15 +1695,15 @@ % \end{macro} % % \begin{macro}[TF]{\tl_if_eq:nn} -% \begin{variable}{\l_tl_internal_a_tl, \l_tl_internal_b_tl} +% \begin{variable}{\l_@@_internal_a_tl, \l_@@_internal_b_tl} % A simple store and compare routine. % \begin{macrocode} \prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } { \group_begin: - \tl_set:Nn \l_tl_internal_a_tl {#1} - \tl_set:Nn \l_tl_internal_b_tl {#2} - \if_meaning:w \l_tl_internal_a_tl \l_tl_internal_b_tl + \tl_set:Nn \l_@@_internal_a_tl {#1} + \tl_set:Nn \l_@@_internal_b_tl {#2} + \if_meaning:w \l_@@_internal_a_tl \l_@@_internal_b_tl \group_end: \prg_return_true: \else: @@ -1712,8 +1711,8 @@ \prg_return_false: \fi: } -\tl_new:N \l_tl_internal_a_tl -\tl_new:N \l_tl_internal_b_tl +\tl_new:N \l_@@_internal_a_tl +\tl_new:N \l_@@_internal_b_tl % \end{macrocode} % \end{variable} % \end{macro} @@ -2224,18 +2223,42 @@ % % \subsection{The first token from a token list} % -% \begin{macro}{\tl_head:w} % \begin{macro}{\tl_head:N, \tl_head:n, \tl_head:V, \tl_head:v, \tl_head:f} +% \begin{macro}[aux]{\@@_head_i:nw, \@@_head_ii:nw} +% \begin{macro}{\tl_head:w} % \begin{macro}{\tl_tail:N, \tl_tail:n, \tl_tail:V, \tl_tail:v, \tl_tail:f} % Finding the head of a token list expandably will always strip braces, which % is fine as this is consistent with for example mapping to a list. The -% empty brace groups in \cs{tl_head:n} ensure that a blank argument gives an -% empty result. The result is returned within the \tn{unexpanded} primitive. +% empty brace groups in \cs{tl_head:n} ensure that a blank argument gives an +% empty result. The result is returned within the \tn{unexpanded} primitive. +% The approach here is to use \cs{if_false:} to allow us to use |}| as +% the closing delimiter: this is the only safe choice, as any other token +% would not be able to parse it's own code. Using a marker, we can see if +% what we are grabbing is exactly the marker, or there is anything else to +% deal with. Is there is, there is a loop. If not, tidy up and leave the +% item in the output stream. More detail in +% \url{http://tex.stackexchange.com/a/70168}. % \begin{macrocode} -\cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new:Npn \tl_head:n #1 - { \etex_unexpanded:D \exp_after:wN { \tl_head:w #1 { } \q_stop } } + { + \etex_unexpanded:D + \if_false: { \fi: \@@_head_i:nw #1 { } \q_stop } + } +\cs_new:Npn \@@_head_i:nw #1#2 \q_stop + { \exp_after:wN \@@_head_ii:nw \exp_after:wN { \if_false: } \fi: {#1} } +\cs_new:Npn \@@_head_ii:nw #1 + { + \exp_after:wN \if_meaning:w \exp_after:wN \q_nil + \tl_to_str:n \exp_after:wN { \use_none:n #1 } \q_nil + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + {#1} + { \if_false: { \fi: \@@_head_i:nw #1 } } + } \cs_generate_variant:Nn \tl_head:n { V , v , f } +\cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new_nopar:Npn \tl_head:N { \exp_args:No \tl_head:n } % \end{macrocode} % To corrected leave the tail of a token list, it's important \emph{not} to @@ -2266,6 +2289,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\str_head:n, \str_tail:n} % \begin{macro}[aux]{\__str_head:w} @@ -2514,18 +2538,31 @@ % \subsection{Viewing token lists} % % \begin{macro}{\tl_show:N, \tl_show:c} -% Showing token list variables is done directly: at the moment do not -% worry if they are defined. +% Showing token list variables is done after checking that the +% variable is defined (see \cs{__kernel_register_show:N}. % \begin{macrocode} -\cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } +\cs_new_protected:Npn \tl_show:N #1 + { + \cs_if_exist:NTF #1 + { \cs_show:N #1 } + { + \__msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } \cs_generate_variant:Nn \tl_show:N { c } % \end{macrocode} %\end{macro} % % \begin{macro}{\tl_show:n} -% For literal token lists, life is easy. -% \begin{macrocode} -\cs_new_eq:NN \tl_show:n \etex_showtokens:D +% The \cs{__msg_show_variable:n} internal function performs +% line-wrapping, removes a leading \verb*|> |, then 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} } } % \end{macrocode} %\end{macro} % |