summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx681
1 files changed, 646 insertions, 35 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index f722c6f0a1d..38558ff9325 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 5232 2014-07-18 19:32:54Z joseph $
+\GetIdInfo$Id: l3candidates.dtx 5366 2014-08-24 21:35:03Z bruno $
{L3 Experimental additions to l3kernel}
%</driver|package>
%<*driver>
@@ -97,13 +97,32 @@
% mailing list. This way it becomes easier to coordinate any updates necessary without a issues
% for the users of your package.
% \item Discussing and understanding use cases for a particular addition or concept also helps to
-% ensure that we provide the right interfaces in the final version so please give us feedback
+% ensure that we provide the right interfaces in the final version so please give us feedback
% if you consider a certain candidate function useful (or not).
% \end{itemize}
% We only add functions in this space if we consider them being serious candidates for a final inclusion
% into the kernel. However, real use sometimes leads to better ideas, so functions from this module are
% \textbf{not necessarily stable} and we may have to adjust them!
%
+% \section{Additions to \pkg{l3basics}}
+%
+% \begin{function}[added = 2014-08-22]{\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}
+%
+% \begin{function}{\__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}
+%
% \section{Additions to \pkg{l3box}}
%
% \subsection{Affine transformations}
@@ -142,7 +161,7 @@
% The updated \meta{box} will be an hbox, irrespective of the nature
% of the \meta{box} before the resizing is applied. A negative size will
% cause the material in the \meta{box} to be reversed in direction, but the
-% reference point of the \meta{box} will be unchanged.
+% reference point of the \meta{box} will be unchanged.
% Thus negative $y$-sizes will result in a box with depth dependent on the
% height of the original box and height dependent on the depth of the original.
% The resizing applies within the current \TeX{} group level.
@@ -176,7 +195,7 @@
% The updated \meta{box} will be an hbox, irrespective of the nature
% of the \meta{box} before the resizing is applied. A negative size will
% cause the material in the \meta{box} to be reversed in direction, but the
-% reference point of the \meta{box} will be unchanged.
+% reference point of the \meta{box} will be unchanged.
% Thus negative $y$-sizes will result in a box a depth dependent on the
% height of the original box a height dependent on the depth.
% The resizing applies within the current \TeX{} group level.
@@ -309,6 +328,24 @@
% correctly.
% \end{variable}
%
+% \section{Additions to \pkg{l3clist}}
+%
+% \begin{function}[added = 2014-08-22]{\clist_log:N, \clist_log:c}
+% \begin{syntax}
+% \cs{clist_log:N} \meta{comma list}
+% \end{syntax}
+% Writes the entries in the \meta{comma list} in the log file. See
+% also \cs{clist_show:N} which displays the result in the terminal.
+% \end{function}
+%
+% \begin{function}[added = 2014-08-22]{\clist_log:n}
+% \begin{syntax}
+% \cs{clist_log:n} \Arg{tokens}
+% \end{syntax}
+% Writes the entries in the comma list in the log file. See also
+% \cs{clist_show:n} which displays the result in the terminal.
+% \end{function}
+%
% \section{Additions to \pkg{l3coffins}}
%
% \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn}
@@ -338,6 +375,18 @@
% respectively. The two scale factors should be given as real numbers.
% \end{function}
%
+% \begin{function}[added = 2014-08-22]
+% {\coffin_log_structure:N, \coffin_log_structure:c}
+% \begin{syntax}
+% \cs{coffin_log_structure:N} \meta{coffin}
+% \end{syntax}
+% This function writes the structural information about the
+% \meta{coffin} in the log file. The width, height and depth of the
+% typeset material are given, along with the location of all of the
+% poles of the coffin. See also \cs{coffin_show_structure:N} which
+% displays the result in the terminal.
+% \end{function}
+%
% \section{Additions to \pkg{l3file}}
%
% \begin{function}[TF, added = 2014-07-02]{\file_if_exist_input:n}
@@ -348,7 +397,7 @@
% Searches for \meta{file name} using the current \TeX{} search
% path and the additional paths controlled by
% \cs{file_path_include:n}). If found, inserts the \meta{true code} then
-% reads in the file as additional \LaTeX{} source as described for
+% reads in the file as additional \LaTeX{} source as described for
% \cs{file_input:n}. Note that \cs{file_if_exist_input:n} does not raise
% an error if the file is not found, in contrast to \cs{file_input:n}.
% \end{function}
@@ -436,6 +485,113 @@
% \end{texnote}
% \end{function}
%
+% \begin{function}[added = 2014-08-22]
+% {\ior_log_streams:, \iow_log_streams:}
+% \begin{syntax}
+% \cs{ior_log_streams:}
+% \cs{iow_log_streams:}
+% \end{syntax}
+% Writes in the log file a list of the file names associated with each
+% open stream: intended for tracking down problems.
+% \end{function}
+%
+% \section{Additions to \pkg{l3fp}}
+%
+% \begin{function}[added = 2014-08-22]{\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}
+% \end{syntax}
+% Evaluates the \meta{floating point expression} and writes the
+% result in the log file.
+% \end{function}
+%
+% \section{Additions to \pkg{l3int}}
+%
+% \begin{function}[added = 2014-08-22]{\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{syntax}
+% \cs{int_log:n} \Arg{integer expression}
+% \end{syntax}
+% Writes the result of evaluating the \meta{integer expression}
+% in the log file.
+% \end{function}
+%
+% \section{Additions to \pkg{l3keys}}
+%
+% \begin{function}[added = 2014-08-22]{\keys_log:nn}
+% \begin{syntax}
+% \cs{keys_log:nn} \Arg{module} \Arg{key}
+% \end{syntax}
+% Writes in the log file the function which is used to actually
+% implement a \meta{key} for a \meta{module}.
+% \end{function}
+%
+% \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}
+% \begin{syntax}
+% \cs{__msg_log_value:n} \Arg{tokens}
+% \end{syntax}
+% Writes \verb*|> |\meta{tokens}|.| in the log file.
+% \end{function}
+%
+% \section{Additions to \pkg{l3prg}}
+%
+% \begin{function}[added = 2014-08-22]{\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{syntax}
+% \cs{bool_log:n} \Arg{boolean expression}
+% \end{syntax}
+% Writes the logical truth of the \meta{boolean expression} in the log
+% file.
+% \end{function}
+%
% \section{Additions to \pkg{l3prop}}
%
% \begin{function}[rEXP]
@@ -456,6 +612,13 @@
% arguments. For that specific task, \cs{prop_item:Nn} is faster.
% \end{function}
%
+% \begin{function}[added = 2014-08-12]{\prop_log:N, \prop_log:c}
+% \begin{syntax}
+% \cs{prop_log:N} \meta{property list}
+% \end{syntax}
+% Writes the entries in the \meta{property list} in the log file.
+% \end{function}
+%
% \section{Additions to \pkg{l3seq}}
%
% \begin{function}[rEXP]
@@ -509,6 +672,13 @@
% \end{texnote}
% \end{function}
%
+% \begin{function}[added = 2014-08-12]{\seq_log:N, \seq_log:c}
+% \begin{syntax}
+% \cs{seq_log:N} \meta{sequence}
+% \end{syntax}
+% Writes the entries in the \meta{sequence} in the log file.
+% \end{function}
+%
% \section{Additions to \pkg{l3skip}}
%
% \begin{function}{\skip_split_finite_else_action:nnNN}
@@ -525,6 +695,51 @@
% warning message of some sort.
% \end{function}
%
+% \begin{function}[added = 2014-08-22]{\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{syntax}
+% \cs{dim_log:n} \Arg{dimension expression}
+% \end{syntax}
+% Writes the result of evaluating the \meta{dimension expression}
+% in the log file.
+% \end{function}
+%
+% \begin{function}[added = 2014-08-22]{\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{syntax}
+% \cs{skip_log:n} \Arg{skip expression}
+% \end{syntax}
+% Writes the result of evaluating the \meta{skip expression}
+% in the log file.
+% \end{function}
+%
+% \begin{function}[added = 2014-08-22]{\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{syntax}
+% \cs{muskip_log:n} \Arg{muskip expression}
+% \end{syntax}
+% Writes the result of evaluating the \meta{muskip expression}
+% in the log file.
+% \end{function}
+%
% \section{Additions to \pkg{l3tl}}
%
% \begin{function}[EXP,pTF]{\tl_if_single_token:n}
@@ -620,7 +835,7 @@
% \begin{verbatim}
% SOME~TEXT~{$y = mx + c$}~WITH~{Protection}
% \end{verbatim}
-%
+%
% `Mixed' case conversion may be regarded informally as converting the first
% character of the \meta{tokens} to upper case and the rest to lower case.
% However, the process is more complex than this as there are some cases
@@ -640,7 +855,7 @@
% describe this as `title case', but that in English title case applies
% on a word-by-word basis. The `mixed' case implemented here is a lower
% level concept needed for both `title' and `sentence' casing of text.)
-%
+%
% As is generally true for \pkg{expl3}, these functions are designed to
% work with engine-native input only. As such, when used with \pdfTeX{}
% \emph{only} the characters \texttt{a}--\texttt{zA}--\texttt{Z} are
@@ -652,7 +867,7 @@
% interpret the input to a case change but not generate the correct output
% (for example in the mapping i to I-dot in Turkish): in these cases the
% input is left unchanged.
-%
+%
% Context-sensitive mappings are enabled: language-dependent cases are
% discussed below. The \enquote{final sigma} rule for Greek letters is
% enabled and active for all inputs. It is implemented here in a modified
@@ -660,7 +875,7 @@
% performance and expandability. Thus a capital sigma will map to a
% final-sigma if it is followed by a space or one of the characters: ^^A{[(
% |!'),.:;?]}|. (Feedback on this area is very welcome.)
-%
+%
% Language-sensitive conversions are enabled using the \meta{language}
% argument, and follow Unicode Consortium guidelines. Currently, the
% languages recognised for special handling are as follows.
@@ -683,7 +898,7 @@
% retains two separate letters, thus this transformation \emph{is}
% available using \pdfTeX{}.
% \end{itemize}
-%
+%
% Creating additional context-sensitive mappings requires knowledge
% of the underlying mapping implementation used here. The team are happy
% to add these to the kernel where they are well-documented
@@ -716,6 +931,22 @@
% argument.
% \end{function}
%
+% \begin{function}[added = 2014-08-22]{\tl_log:N, \tl_log:c}
+% \begin{syntax}
+% \cs{tl_log:N} \meta{tl~var}
+% \end{syntax}
+% Writes the content of the \meta{tl~var} in the log file. See also
+% \cs{tl_show:N} which displays the result in the terminal.
+% \end{function}
+%
+% \begin{function}[added = 2014-08-22]{\tl_log:n}
+% \begin{syntax}
+% \cs{tl_log:n} \meta{token list}
+% \end{syntax}
+% Writes the \meta{token list} in the log file. See also
+% \cs{tl_show:n} which displays the result in the terminal.
+% \end{function}
+%
% \section{Additions to \pkg{l3tokens}}
%
% \begin{function}{\char_set_active:Npn, \char_set_active:Npx}
@@ -796,6 +1027,54 @@
%<*initex|package>
% \end{macrocode}
%
+% \subsection{Additions to \pkg{l3basics}}
+%
+% \begin{macrocode}
+%<@@=cs>
+% \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:
+ }
+ }
+ }
+\cs_new_protected_nopar:Npn \cs_log:c
+ { \group_begin: \exp_args:NNc \group_end: \cs_log:N }
+% \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.
+% \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_generate_variant:Nn \__kernel_register_log:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3box}}
%
% \begin{macrocode}
@@ -1359,7 +1638,10 @@
\dim_compare:nNnTF { \box_ht:N \l_@@_internal_box } > {#5}
{
\hbox_set:Nn \l_@@_internal_box
- { \box_move_up:nn \c_zero_dim { \box_use:N \l_@@_internal_box } }
+ {
+ \box_move_up:nn \c_zero_dim
+ { \box_use:N \l_@@_internal_box }
+ }
\box_set_ht:Nn \l_@@_internal_box
{ \box_ht:N \l_@@_internal_box - (#5) }
}
@@ -1407,7 +1689,10 @@
\dim_compare:nNnTF {#5} > \c_zero_dim
{
\hbox_set:Nn \l_@@_internal_box
- { \box_move_up:nn \c_zero_dim { \box_use:N \l_@@_internal_box } }
+ {
+ \box_move_up:nn \c_zero_dim
+ { \box_use:N \l_@@_internal_box }
+ }
\box_set_ht:Nn \l_@@_internal_box
{
#5
@@ -1429,6 +1714,29 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{Additions to \pkg{l3clist}}
+%
+% \begin{macrocode}
+%<@@=clist>
+% \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}.
+% \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_generate_variant:Nn \clist_log:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3coffins}}
%
% \begin{macrocode}
@@ -1889,6 +2197,28 @@
% \end{macro}
% \end{macro}
%
+% \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}.
+% \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_generate_variant:Nn \coffin_log_structure:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3file}}
%
% \begin{macrocode}
@@ -1909,7 +2239,7 @@
\file_if_exist:nT {#1}
{
#2
- \@@_input:V \l_@@_internal_name_tl
+ \@@_input:V \l_@@_internal_name_tl
}
}
\cs_new_protected:Npn \file_if_exist_input:nF #1
@@ -1922,7 +2252,7 @@
\file_if_exist:nTF {#1}
{
#2
- \@@_input:V \l_@@_internal_name_tl
+ \@@_input:V \l_@@_internal_name_tl
}
}
% \end{macrocode}
@@ -1988,6 +2318,197 @@
% \end{macro}
% \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}.
+% \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 }
+ }
+% \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}.
+% \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 }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Additions to \pkg{l3fp}}
+%
+% \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.
+% \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_generate_variant:Nn \fp_log:N { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Additions to \pkg{l3int}}
+%
+% \begin{macro}{\int_log:N, \int_log:c}
+% Simple copies.
+% \begin{macrocode}
+\cs_new_eq:NN \int_log:N \__kernel_register_log:N
+\cs_new_eq:NN \int_log:c \__kernel_register_log:c
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\int_log:n}
+% Use \cs{__msg_log_value:x}.
+% \begin{macrocode}
+\cs_new_protected:Npn \int_log:n #1
+ { \__msg_log_value:x { \int_eval:n {#1} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Additions to \pkg{l3keys}}
+%
+% \begin{macrocode}
+%<@@=keys>
+% \end{macrocode}
+%
+% \begin{macro}{\keys_log:nn}
+% See \cs{keys_show:nn} but using \cs{cs_log:c} instead of
+% \cs{show:c}.
+% \begin{macrocode}
+\cs_new_protected:Npn \keys_log:nn #1#2
+ { \cs_log:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Additions to \pkg{l3msg}}
+%
+% \begin{macrocode}
+%<@@=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{macrocode}
+\cs_new_protected:Npn \@@_log_variable:Nnn #1#2#3
+ {
+ \cs_if_exist:NTF #1
+ {
+ \@@_log:nnn { LaTeX / kernel } { show- #2 } {#1}
+ \@@_log_wrap:n {#3}
+ }
+ {
+ \@@_kernel_error:nnx { kernel } { variable-not-defined }
+ { \token_to_str:N #1 }
+ }
+ }
+\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}
+%<@@=bool>
+% \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}.
+% \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_generate_variant:Nn \bool_log:N { c }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3prop}}
%
% \begin{macrocode}
@@ -2023,6 +2544,18 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\prop_log:N, \prop_log:c}
+% Same as \cs{prop_show:N} but using \cs{__msg_log_variable:Nnn}.
+% \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_generate_variant:Nn \prop_log:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3seq}}
%
% \begin{macrocode}
@@ -2039,7 +2572,7 @@
% \@@_mapthread_function:wNN, \@@_mapthread_function:wNw,
% \@@_mapthread_function:Nnnwnn
% }
-% The idea here is to first expand both sequences, adding the
+% The idea is to first expand both sequences, adding the
% usual |{ ? \__prg_break: } { }| to the end of each one. This is
% most conveniently done in two steps using an auxiliary function.
% The mapping then throws away the first tokens of |#2| and |#5|,
@@ -2121,6 +2654,18 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\seq_log:N, \seq_log:c}
+% Same as \cs{seq_show:N} but using \cs{__msg_show_variable:Nnn}.
+% \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_generate_variant:Nn \seq_log:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3skip}}
%
% \begin{macrocode}
@@ -2151,6 +2696,36 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\dim_log:N, \dim_log:c, \dim_log:n}
+% Diagnostics.
+% \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} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\skip_log:N, \skip_log:c, \skip_log:n}
+% Diagnostics.
+% \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} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\muskip_log:N, \muskip_log:c, \muskip_log:n}
+% Diagnostics.
+% \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} } }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3tl}}
%
% \begin{macrocode}
@@ -2158,17 +2733,23 @@
% \end{macrocode}
%
% \begin{macro}[EXP,pTF]{\tl_if_single_token:n}
-% There are four cases: empty token list, token list starting with
-% a normal token, with a brace group, or with a space token.
-% If the token list starts with a normal token, remove it
-% and check for emptiness. Otherwise, compare with a single
-% space, only case where we have a single token.
+% There are four cases: empty token list, token list starting with a
+% normal token, with a brace group, or with a space token. If the
+% token list starts with a normal token, remove it and check for
+% emptiness. For the next case, an empty token list is not a single
+% token. Finally, we have a non-empty token list starting with a
+% space or a brace group. Applying \texttt{f}-expansion yields an
+% empty result if and only if the token list is a single space.
% \begin{macrocode}
\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF }
{
\tl_if_head_is_N_type:nTF {#1}
- { \__str_if_eq_x_return:nn { \exp_not:o { \use_none:n #1 } } { } }
- { \__str_if_eq_x_return:nn { \exp_not:n {#1} } { ~ } }
+ { \@@_if_empty_return:o { \use_none:n #1 } }
+ {
+ \tl_if_empty:nTF {#1}
+ { \prg_return_false: }
+ { \@@_if_empty_return:o { \tex_romannumeral:D -`0 #1 } }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -2310,7 +2891,10 @@
\cs_new:Npn \@@_act_case_group:nn #1 #2
{
\exp_after:wN \@@_act_output:n \exp_after:wN
- { \exp_after:wN { \tex_romannumeral:D \@@_act_case_aux:nn {#1} {#2} } }
+ {
+ \exp_after:wN
+ { \tex_romannumeral:D \@@_act_case_aux:nn {#1} {#2} }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -2436,14 +3020,14 @@
% in \cs{@@_act:NNNnn}. Thus the idea is to use a loop which is will grab
% the entire token list plus a quark: the latter is used as an end marker and
% to avoid any brace stripping. Depending on the nature of the first item
-% in the grabbed argument, it can eithsrprocessed as a single token,
+% in the grabbed argument, it can either processed as a single token,
% treated as a group or treated as a space (the latter requires special
% treatment). In contrast to \cs{@@_act:NNNnn}, there is no need for this
% process to be \texttt{f}-type expandable: things are done using only
% \texttt{x}-type requirements. Also, for \enquote{normal} tokens there is
% a bit more work to do here: to allow selection of case matches using
% character code, it's important that control sequences are filtered out
-% before doing the lookup.
+% before doing the lookup.
% \begin{macrocode}
\cs_new:Npn \@@_change_case:nnn #1#2#3
{
@@ -2497,7 +3081,7 @@
\cs_new:Npn \__tl_change_case_char:NNNNNNNNn #1#2#3#4#5#6#7#8#9
{
\exp_args:NNv \str_case:nnF #8
- { c_@@_ #9 _ #6 _ #7 _tl }
+ { c_@@_ #9 _ #6 _X_ #7 _tl }
{ \exp_not:N #8 }
}
% \end{macrocode}
@@ -2526,13 +3110,13 @@
% a small number of chars. As this may have to be extended over time to other
% cases, the easiest handling is offered by using the numerical values for
% these chars.
-% \begin{macrocode}
+% \begin{macrocode}
\cs_new:Npn \@@_change_case_lower_sigma:Nw #1#2 \q_recursion_stop
{
\token_if_cs:NTF #1
{ \c_@@_std_sigma_tl }
{
- \exp_after:wN \@@_change_case_lower_sigma_loop:Nw
+ \exp_after:wN \@@_change_case_lower_sigma_loop:Nw
\exp_after:wN #1 \c_@@_after_final_sigma_clist
, \q_recursion_tail , \q_recursion_stop
}
@@ -2609,12 +3193,14 @@
#1 {#2}
{
\exp_after:wN \@@_mixed_case_skip:Nwn \exp_after:wN #1
- \c__tl_mixed_skip_clist , \q_recursion_tail , \q_recursion_stop
+ \c__tl_mixed_skip_clist , \q_recursion_tail ,
+ \q_recursion_stop
{
\exp_args:NNV \str_case:nnF #1 \c_@@_mixed_exceptions_tl
{
\exp_after:wN \@@_change_case_char:NNNNNNNNn
- \int_use:N \__int_eval:w 1000000 + `#1 \__int_eval_end:
+ \int_use:N
+ \__int_eval:w 1000000 + `#1 \__int_eval_end:
#1 { upper }
}
}
@@ -2767,7 +3353,7 @@
}
% \end{macrocode}
% Grab the next char and see if it is one of the accents used in Lithuanian:
-% if it is, add the dot-above char into the output.
+% if it is, add the dot-above char into the output.
% \begin{macrocode}
\cs_new:Npn \@@_change_case_lower_lt:Nw #1#2 \q_recursion_stop
{
@@ -2788,7 +3374,7 @@
% The test required here is for a dot-above char after an I, J or I-ogonek.
% If there is one, it's removed using \cs{use_i:nn} (which preserves the
% loop and discards the char).
-% \begin{macrocode}
+% \begin{macrocode}
\cs_new:Npn \@@_change_case_upper_lt:Nnn #1#2#3
{
#3
@@ -2796,7 +3382,7 @@
{
\tl_if_head_is_N_type_p:n {#2}
&&
- (
+ (
\int_compare_p:nNn { `#1 } = { "0069 }
|| \int_compare_p:nNn { `#1 } = { "006A }
|| \int_compare_p:nNn { `#1 } = { "012F }
@@ -2851,6 +3437,31 @@
% \end{macro}
% \end{macro}
%
+% \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.
+% \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_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}.
+% \begin{macrocode}
+\cs_new_protected:Npn \tl_log:n #1
+ { \__msg_log_wrap:n { > ~ \tl_to_str:n {#1} } }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3tokens}}
%
% \begin{macrocode}
@@ -2954,9 +3565,9 @@
\cs_new_protected_nopar:Npn \peek_N_type:TF
{ \@@_token_generic:NNTF \@@_execute_branches_N_type: \scan_stop: }
\cs_new_protected_nopar:Npn \peek_N_type:T
- { \@@_token_generic:NNT \@@_execute_branches_N_type: \scan_stop: }
+ { \@@_token_generic:NNT \@@_execute_branches_N_type: \scan_stop: }
\cs_new_protected_nopar:Npn \peek_N_type:F
- { \@@_token_generic:NNF \@@_execute_branches_N_type: \scan_stop: }
+ { \@@_token_generic:NNF \@@_execute_branches_N_type: \scan_stop: }
% \end{macrocode}
% \end{macro}
% \end{macro}