diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 6337bf9c86f..6b66f76f239 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3basics.dtx Copyright (C) 1990-2016 The LaTeX3 project +%% File: l3basics.dtx Copyright (C) 1990-2017 The LaTeX3 project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3basics.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3basics.dtx 6929 2017-02-14 15:53:00Z bruno $ {L3 Basic definitions} %</driver|package> %<*driver> @@ -686,7 +686,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2015-08-03]{\cs_show:N, \cs_show:c} +% \begin{function}[updated = 2017-02-14]{\cs_show:N, \cs_show:c} % \begin{syntax} % \cs{cs_show:N} \meta{control sequence} % \end{syntax} @@ -698,6 +698,15 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2017-02-14]{\cs_log:N, \cs_log:c} +% \begin{syntax} +% \cs{cs_log:N} \meta{control sequence} +% \end{syntax} +% Writes the definition of the \meta{control sequence} in the log +% file. See also \cs{cs_show:N} which displays the result in the +% terminal. +% \end{function} +% % \subsection{Converting to and from control sequences} % % \begin{function}[EXP]{\use:c} @@ -1040,7 +1049,7 @@ % \cs{cs_if_eq:NNTF} \Arg{cs_1} \Arg{cs_2} \Arg{true code} \Arg{false code} % \end{syntax} % Compares the definition of two \meta{control sequences} and -% is logically \texttt{true} the same, \emph{i.e.}~if they have exactly +% is logically \texttt{true} if they are the same, \emph{i.e.}~if they have exactly % the same definition when examined with \cs{cs_show:N}. % \end{function} % @@ -1256,6 +1265,15 @@ % such that internal parts of the mechanism are not visible. % \end{function} % +% \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} +% Used to write the contents of a \TeX{} register to the log file in a +% form similar to \cs{__kernel_register_show:N}. +% \end{function} +% % \begin{function}[EXP]{\__prg_case_end:nw} % \begin{syntax} % \cs{__prg_case_end:nw} \Arg{code} \meta{tokens} \cs{q_mark} \Arg{true code} \cs{q_mark} \Arg{false code} \cs{q_stop} @@ -2897,38 +2915,77 @@ % \subsection{Diagnostic functions} % % \begin{macro}[int]{\__kernel_register_show:N, \__kernel_register_show:c} +% \begin{macro}[aux]{\__kernel_register_show_aux:n} % 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}. +% |>~|\meta{variable}|=|\meta{value}. We expand the value before-hand +% as otherwise some integers (such as \tn{currentgrouplevel} or +% \tn{currentgrouptype}) altered by the line-wrapping code would show +% wrong values. % \begin{macrocode} \cs_new_protected:Npn \__kernel_register_show:N #1 + { \exp_args:No \__kernel_register_show_aux:nN { \tex_the:D #1 } #1 } +\cs_new_protected:Npn \__kernel_register_show_aux:nN #1#2 { - \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } - { > ~ \token_to_str:N #1 = \tex_the:D #1 } + \__msg_show_variable:NNNnn #2 \cs_if_exist:NTF ? { } + { > ~ \token_to_str:N #2 = #1 } } \cs_new_protected:Npn \__kernel_register_show:c { \exp_args:Nc \__kernel_register_show:N } % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\__kernel_register_log:N, \__kernel_register_log:c} +% Redirect the output of \cs{__kernel_register_show:N} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \__kernel_register_log:N + { \__msg_log_next: \__kernel_register_show:N } +\cs_new_protected:Npn \__kernel_register_log:c + { \exp_args:Nc \__kernel_register_log:N } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\cs_show:N, \cs_show:c} % 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, % 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. +% line-wrapping. We must expand the meaning before passing it to the +% wrapping code as otherwise we would wrongly see the definitions that +% are in place there. To get correct escape characters, set the +% \tn{escapechar} in a group; this also localizes the assignment +% performed by \texttt{x}-expansion. The \cs{cs_show:c} command also +% converts its argument to a control sequence within a group to avoid +% showing \tn{relax} for undefined control sequences. % \begin{macrocode} \cs_new_protected:Npn \cs_show:N #1 - { \__msg_show_wrap:n { > ~ \token_to_str:N #1 = \cs_meaning:N #1 } } + { + \group_begin: + \int_set:Nn \tex_escapechar:D { `\\ } + \exp_args:NNx + \group_end: + \__msg_show_wrap:n { > ~ \token_to_str:N #1 = \cs_meaning:N #1 } + } \cs_new_protected:Npn \cs_show:c { \group_begin: \exp_args:NNc \group_end: \cs_show:N } % \end{macrocode} % \end{macro} % +% \begin{macro}{\cs_log:N, \cs_log:c} +% 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:Npn \cs_log:N { \__msg_log_next: \cs_show:N } +\cs_new_protected:Npn \cs_log:c { \__msg_log_next: \cs_show:c } +% \end{macrocode} +% \end{macro} +% % \subsection{Doing nothing functions} % % \begin{macro}[EXP]{\prg_do_nothing:} |