diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-23 21:54:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-23 21:54:14 +0000 |
commit | 87d871a3d83784d48b71fa3712b9f525bfc710d2 (patch) | |
tree | f12f9ffdc697b5af9ee14c06874ec0e2f72c9f94 /Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | |
parent | ccc63194ce7813106830c8a8755c54d89de831b4 (diff) |
l3 (22feb18)
git-svn-id: svn://tug.org/texlive/trunk@46720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | 460 |
1 files changed, 235 insertions, 225 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index cff05458c4d..7b2b8bb3948 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-2017 The LaTeX3 project +%% File: l3basics.dtx Copyright (C) 1990-2018 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 @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/12/16} +% \date{Released 2018/02/21} % % \maketitle % @@ -737,6 +737,7 @@ % \cs{cs_if_exist_use:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} % \end{syntax} % Tests whether the \meta{control sequence} is currently defined +% according to the conditional \cs{cs_if_exist:NTF} % (whether as a function or another control sequence type), and if it % is inserts the \meta{control sequence} into the input stream followed % by the \meta{true code}. Otherwise the \meta{false code} is used. @@ -1051,8 +1052,8 @@ % \end{syntax} % Tests whether the \meta{control sequence} is currently defined % (whether as a function or another control sequence type). Any -% valid definition of \meta{control sequence} evaluates as -% \texttt{true}. +% definition of \meta{control sequence} other than \tn{relax} +% evaluates as \texttt{true}. % \end{function} % % \begin{function}[EXP,pTF]{\cs_if_free:N, \cs_if_free:c} @@ -1212,9 +1213,9 @@ % normally (spaces, characters with category other). % \end{function} % -% \begin{function}{\__debug:TF} +% \begin{function}{\__kernel_debug:TF} % \begin{syntax} -% \cs{__debug:TF} \Arg{true code} \Arg{false code} +% \cs{__kernel_debug:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Runs the \meta{true code} if debugging is enabled, namely only in % \LaTeXe{} package mode with one of the options @@ -1224,18 +1225,18 @@ % conditional. % \end{function} % -% \begin{function}{\__debug_chk_cs_exist:N, \__debug_chk_cs_exist:c} +% \begin{function}{\__kernel_chk_cs_exist:N, \__kernel_chk_cs_exist:c} % \begin{syntax} -% \cs{__debug_chk_cs_exist:N} \meta{cs} +% \cs{__kernel_chk_cs_exist:N} \meta{cs} % \end{syntax} % This function is only created if debugging is enabled. It checks % that \meta{cs} exists according to the criteria for % \cs{cs_if_exist_p:N}, and if not raises a kernel-level error. % \end{function} % -% \begin{function}{\__debug_chk_expr:nNnN} +% \begin{function}{\__kernel_chk_expr:nNnN} % \begin{syntax} -% \cs{__debug_chk_expr:nNnN} \Arg{expr} \meta{eval} \Arg{convert} \meta{caller} +% \cs{__kernel_chk_expr:nNnN} \Arg{expr} \meta{eval} \Arg{convert} \meta{caller} % \end{syntax} % This function is only created if debugging is enabled. By default % it is equivalent to \cs{use_i:nnnn}. When expression checking is @@ -1250,18 +1251,18 @@ % purposes. % \end{function} % -% \begin{function}{\__debug_chk_var_exist:N} +% \begin{function}{\__kernel_chk_var_exist:N} % \begin{syntax} -% \cs{__debug_chk_var_exist:N} \meta{var} +% \cs{__kernel_chk_var_exist:N} \meta{var} % \end{syntax} % This function is only created if debugging is enabled. It checks % that \meta{var} is defined according to the criteria for % \cs{cs_if_exist_p:N}, and if not raises a kernel-level error. % \end{function} % -% \begin{function}{\__debug_chk_var_scope:NN} +% \begin{function}{\__kernel_chk_var_scope:NN} % \begin{syntax} -% \cs{__debug_chk_var_scope:NN} \meta{scope} \meta{var} +% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var} % \end{syntax} % Checks the \meta{var} has the correct \meta{scope}, and if not % raises a kernel-level error. This function is only created if @@ -1276,19 +1277,19 @@ % different scopes a kernel error will result. % \end{function} % -% \begin{function}{\__debug_chk_var_local:N, \__debug_chk_var_global:N} +% \begin{function}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} % \begin{syntax} -% \cs{__debug_chk_var_local:N} \meta{var} -% \cs{__debug_chk_var_global:N} \meta{var} +% \cs{__kernel_chk_var_local:N} \meta{var} +% \cs{__kernel_chk_var_global:N} \meta{var} % \end{syntax} -% Applies \cs{__debug_chk_var_exist:N} \meta{var}, then -% \cs{__debug_chk_var_scope:NN} \meta{scope} \meta{var}, where +% Applies \cs{__kernel_chk_var_exist:N} \meta{var}, then +% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var}, where % \meta{scope} is |l| or~|g|. % \end{function} % -% \begin{function}{\__debug_log:x} +% \begin{function}{\__kernel_debug_log:x} % \begin{syntax} -% \cs{__debug_log:x} \Arg{message text} +% \cs{__kernel_debug_log:x} \Arg{message text} % \end{syntax} % If the \texttt{log-functions} option is active, this function writes % the \meta{message text} to the log file using \cs{iow_log:x}. @@ -1296,9 +1297,9 @@ % This function is only created if debugging is enabled. % \end{function} % -% \begin{function}{\__debug_patch:nnNNpn} +% \begin{function}{\__kernel_patch:nnNNpn} % \begin{syntax} -% \cs{__debug_patch:nnNNpn} \Arg{before} \Arg{after} +% \cs{__kernel_patch:nnNNpn} \Arg{before} \Arg{after} % \meta{definition} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % If debugging is not enabled, this function ignores the \meta{before} @@ -1311,24 +1312,24 @@ % needed. % \end{function} % -% \begin{function}{\__debug_patch_conditional:nNNpnn} +% \begin{function}{\__kernel_patch_conditional:nNNpnn} % \begin{syntax} -% \cs{__debug_patch_conditional:nNNpnn} \Arg{before} +% \cs{__kernel_patch_conditional:nNNpnn} \Arg{before} % \meta{definition} \meta{conditional} \meta{parameters} \Arg{type} \Arg{code} % \end{syntax} -% Similar to \cs{__debug_patch:nnNNpn} for conditionals, namely +% Similar to \cs{__kernel_patch:nnNNpn} for conditionals, namely % \meta{definition} must be \cs{prg_new_conditional:Npnn} or its % \texttt{_protected} counterpart. There is no \meta{after} code % because that would interfere with the action of the conditional. % \end{function} % % \begin{function} -% {\__debug_patch_args:nNNpn, \__debug_patch_conditional_args:nNNpnn} +% {\__kernel_patch_args:nNNpn, \__kernel_patch_conditional_args:nNNpnn} % \begin{syntax} -% \cs{__debug_patch_args:nNNpn} \Arg{arguments} +% \cs{__kernel_patch_args:nNNpn} \Arg{arguments} % \meta{definition} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% Like \cs{__debug_patch:nnNNpn}, this tweaks the following +% Like \cs{__kernel_patch:nnNNpn}, this tweaks the following % definition, but from the \enquote{inside out} (and if debugging is % not enabled, the \meta{arguments} are ignored). It replaces |#1|, % |#2| and so on in the \meta{code} of the definition as indicated by @@ -1338,25 +1339,25 @@ % front of the \meta{arguments} is used instead of the \meta{code} % when defining the actual function. For instance, % \begin{quote} -% \cs{__debug_patch_args:nNNpn} |{ { (#1) } }| \\ +% \cs{__kernel_patch_args:nNNpn} |{ { (#1) } }| \\ % \cs{cs_new:Npn} \cs{int_eval:n} |#1| \\ % ~~|{ \__int_value:w \__int_eval:w #1 \__int_eval_end: }| % \end{quote} % would replace |#1| by |(#1)| in the definition of \cs{int_eval:n} when % debugging is enabled. This fails if the \meta{code} contains~|##|. -% The \cs{__debug_patch_conditional_args:nNNpnn} function is for use +% The \cs{__kernel_patch_conditional_args:nNNpnn} function is for use % before \cs{prg_new_conditional:Npnn} or its \texttt{_protected} % counterpart. % \end{function} % % \begin{function} -% {\__debug_patch_args:nnnNNpn, \__debug_patch_conditional_args:nnnNNpnn} +% {\__kernel_patch_args:nnnNNpn, \__kernel_patch_conditional_args:nnnNNpnn} % \begin{syntax} -% \cs{__debug_patch_args:nnnNNpn} \Arg{before} \Arg{after} \Arg{arguments} +% \cs{__kernel_patch_args:nnnNNpn} \Arg{before} \Arg{after} \Arg{arguments} % \meta{definition} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% A combination of \cs{__debug_patch:nnNNpn} and -% \cs{__debug_patch_args:nNNpn}. +% A combination of \cs{__kernel_patch:nnNNpn} and +% \cs{__kernel_patch_args:nNNpn}. % \end{function} % % \begin{function}{\__kernel_check_defined:NT} @@ -1781,7 +1782,7 @@ %<@@=debug> % \end{macrocode} % -% \begin{macro}{\@@:TF} +% \begin{macro}{\__kernel_debug:TF} % A more meaningful test of whether debugging is enabled than messing % up with guards. We can also more easily change the logic in one % place then. At present, debugging is disabled in the format and in @@ -1789,10 +1790,10 @@ % options \texttt{enable-debug}, \texttt{log-functions} or % \texttt{check-declarations} was given. % \begin{macrocode} -\cs_set_protected:Npn \@@:TF #1#2 {#2} +\cs_set_protected:Npn \__kernel_debug:TF #1#2 {#2} %<*package> \tex_ifodd:D \l@expl@enable@debug@bool - \cs_set_protected:Npn \@@:TF #1#2 {#1} + \cs_set_protected:Npn \__kernel_debug:TF #1#2 {#1} \fi: %</package> % \end{macrocode} @@ -1801,34 +1802,34 @@ % \begin{macro}{\debug_on:n, \debug_off:n} % % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { \cs_set_protected:Npn \debug_on:n #1 { \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } { - \cs_if_exist_use:cF { @@_##1_on: } - { \__msg_kernel_error:nnn { kernel } { debug } {##1} } + \cs_if_exist_use:cF { __debug_##1_on: } + { \__kernel_msg_error:nnn { kernel } { debug } {##1} } } } \cs_set_protected:Npn \debug_off:n #1 { \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } { - \cs_if_exist_use:cF { @@_##1_off: } - { \__msg_kernel_error:nnn { kernel } { debug } {##1} } + \cs_if_exist_use:cF { __debug_##1_off: } + { \__kernel_msg_error:nnn { kernel } { debug } {##1} } } } } { \cs_set_protected:Npn \debug_on:n #1 { - \__msg_kernel_error:nnx { kernel } { enable-debug } + \__kernel_msg_error:nnx { kernel } { enable-debug } { \tl_to_str:n { \debug_on:n {#1} } } } \cs_set_protected:Npn \debug_off:n #1 { - \__msg_kernel_error:nnx { kernel } { enable-debug } + \__kernel_msg_error:nnx { kernel } { enable-debug } { \tl_to_str:n { \debug_off:n {#1} } } } } @@ -1836,32 +1837,32 @@ % \end{macro} % % \begin{macro}{\debug_suspend:, \debug_resume:} -% \begin{macro}{\@@_suspended:T} -% \begin{macro}{\l_@@_suspended_tl} +% \begin{macro}{\__debug_suspended:T} +% \begin{macro}{\l__debug_suspended_tl} % Suspend and resume locally all debug-related errors and logging % except deprecation errors. The \cs{debug_suspend:} and \cs{debug_resume:} % pairs can be nested. We keep track of nesting in a token list % containing a number of periods. At first begin with the -% \enquote{non-suspended} version of \cs{@@_suspended:T}. +% \enquote{non-suspended} version of \cs{__debug_suspended:T}. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \cs_set_nopar:Npn \l_@@_suspended_tl { } + \cs_set_nopar:Npn \l__debug_suspended_tl { } \cs_set_protected:Npn \debug_suspend: { - \tl_put_right:Nn \l_@@_suspended_tl { . } - \cs_set_eq:NN \@@_suspended:T \use:n + \tl_put_right:Nn \l__debug_suspended_tl { . } + \cs_set_eq:NN \__debug_suspended:T \use:n } \cs_set_protected:Npn \debug_resume: { - \tl_set:Nx \l_@@_suspended_tl - { \tl_tail:N \l_@@_suspended_tl } - \tl_if_empty:NT \l_@@_suspended_tl + \tl_set:Nx \l__debug_suspended_tl + { \tl_tail:N \l__debug_suspended_tl } + \tl_if_empty:NT \l__debug_suspended_tl { - \cs_set_eq:NN \@@_suspended:T \use_none:n + \cs_set_eq:NN \__debug_suspended:T \use_none:n } } - \cs_set:Npn \@@_suspended:T #1 { } + \cs_set:Npn \__debug_suspended:T #1 { } } { \cs_set_protected:Npn \debug_suspend: { } @@ -1873,76 +1874,76 @@ % \end{macro} % % \begin{macro} -% {\@@_check-declarations_on:, \@@_check-declarations_off:} -% \begin{macro}{\@@_chk_var_exist:N} -% \begin{macro}{\@@_chk_cs_exist:N, \@@_chk_cs_exist:c} -% \begin{macro}{\@@_chk_var_local:N, \@@_chk_var_global:N} -% \begin{macro}{\@@_chk_var_scope:NN} +% {\__debug_check-declarations_on:, \__debug_check-declarations_off:} +% \begin{macro}{\__kernel_chk_var_exist:N} +% \begin{macro}{\__kernel_chk_cs_exist:N, \__kernel_chk_cs_exist:c} +% \begin{macro}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} +% \begin{macro}{\__kernel_chk_var_scope:NN} % When debugging is enabled these two functions set up functions that % test their argument (when \texttt{check-declarations} is active) % \begin{itemize} -% \item \cs{@@_chk_var_exist:N} and \cs{@@_chk_cs_exist:N}, two +% \item \cs{__kernel_chk_var_exist:N} and \cs{__kernel_chk_cs_exist:N}, two % functions that test that their argument is defined; -% \item \cs{@@_chk_var_scope:NN} that checks that its argument |#2| +% \item \cs{__kernel_chk_var_scope:NN} that checks that its argument |#2| % has scope |#1|. -% \item \cs{@@_chk_var_local:N} and \cs{@@_chk_var_global:N} that +% \item \cs{__kernel_chk_var_local:N} and \cs{__kernel_chk_var_global:N} that % perform both checks. % \end{itemize} % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \exp_args:Nc \cs_set_protected:Npn { @@_check-declarations_on: } + \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_on: } { - \cs_set_protected:Npn \@@_chk_var_exist:N ##1 + \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 { - \@@_suspended:T \use_none:nnn + \__debug_suspended:T \use_none:nnn \cs_if_exist:NF ##1 { - \__msg_kernel_error:nnx { kernel } { non-declared-variable } + \__kernel_msg_error:nnx { kernel } { non-declared-variable } { \token_to_str:N ##1 } } } - \cs_set_protected:Npn \@@_chk_cs_exist:N ##1 + \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 { - \@@_suspended:T \use_none:nnn + \__debug_suspended:T \use_none:nnn \cs_if_exist:NF ##1 { - \__msg_kernel_error:nnx { kernel } { command-not-defined } + \__kernel_msg_error:nnx { kernel } { command-not-defined } { \token_to_str:N ##1 } } } - \cs_set_protected:Npn \@@_chk_var_scope:NN + \cs_set_protected:Npn \__kernel_chk_var_scope:NN { - \@@_suspended:T \use_none:nnn - \@@_chk_var_scope_aux:NN + \__debug_suspended:T \use_none:nnn + \__debug_chk_var_scope_aux:NN } - \cs_set_protected:Npn \@@_chk_var_local:N ##1 + \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 { - \@@_suspended:T \use_none:nnnnn - \@@_chk_var_exist:N ##1 - \@@_chk_var_scope_aux:NN l ##1 + \__debug_suspended:T \use_none:nnnnn + \__kernel_chk_var_exist:N ##1 + \__debug_chk_var_scope_aux:NN l ##1 } - \cs_set_protected:Npn \@@_chk_var_global:N ##1 + \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 { - \@@_suspended:T \use_none:nnnnn - \@@_chk_var_exist:N ##1 - \@@_chk_var_scope_aux:NN g ##1 + \__debug_suspended:T \use_none:nnnnn + \__kernel_chk_var_exist:N ##1 + \__debug_chk_var_scope_aux:NN g ##1 } } - \exp_args:Nc \cs_set_protected:Npn { @@_check-declarations_off: } + \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_off: } { - \cs_set_protected:Npn \@@_chk_var_exist:N ##1 { } - \cs_set_protected:Npn \@@_chk_cs_exist:N ##1 { } - \cs_set_protected:Npn \@@_chk_var_local:N ##1 { } - \cs_set_protected:Npn \@@_chk_var_global:N ##1 { } - \cs_set_protected:Npn \@@_chk_var_scope:NN ##1##2 { } + \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_scope:NN ##1##2 { } } - \cs_set_protected:Npn \@@_chk_cs_exist:c - { \exp_args:Nc \@@_chk_cs_exist:N } + \cs_set_protected:Npn \__kernel_chk_cs_exist:c + { \exp_args:Nc \__kernel_chk_cs_exist:N } \tex_ifodd:D \l@expl@check@declarations@bool - \use:c { @@_check-declarations_on: } + \use:c { __debug_check-declarations_on: } \else: - \use:c { @@_check-declarations_off: } + \use:c { __debug_check-declarations_off: } \fi: } { } @@ -1953,13 +1954,13 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_chk_var_scope_aux:NN} -% \begin{macro}{\@@_chk_var_scope_aux:Nn} -% \begin{macro}{\@@_chk_var_scope_aux:NNn} +% \begin{macro}{\__debug_chk_var_scope_aux:NN} +% \begin{macro}{\__debug_chk_var_scope_aux:Nn} +% \begin{macro}{\__debug_chk_var_scope_aux:NNn} % First check whether the name of the variable |#2| starts with % \meta{letter}|_|. If it does then pass that letter, the % \meta{scope}, and the variable name to -% \cs{@@_chk_var_scope_aux:NNn}. That function compares the two +% \cs{__debug_chk_var_scope_aux:NNn}. That function compares the two % letters and triggers an error if they differ (the \cs{scan_stop:} % case is not reachable here). If the second character was not |_| % then pass the same data to the same auxiliary, except for its first @@ -1969,30 +1970,30 @@ % letter \meta{scope} according to what the first assignment to the % given variable was. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \cs_set_protected:Npn \@@_chk_var_scope_aux:NN #1#2 - { \exp_args:NNf \@@_chk_var_scope_aux:Nn #1 { \cs_to_str:N #2 } } - \cs_set_protected:Npn \@@_chk_var_scope_aux:Nn #1#2 + \cs_set_protected:Npn \__debug_chk_var_scope_aux:NN #1#2 + { \exp_args:NNf \__debug_chk_var_scope_aux:Nn #1 { \cs_to_str:N #2 } } + \cs_set_protected:Npn \__debug_chk_var_scope_aux:Nn #1#2 { \if:w _ \use_i:nn \use_i_delimit_by_q_stop:nw #2 ? ? \q_stop - \exp_after:wN \@@_chk_var_scope_aux:NNn + \exp_after:wN \__debug_chk_var_scope_aux:NNn \use_i_delimit_by_q_stop:nw #2 ? \q_stop #1 {#2} \else: - \exp_args:Nc \@@_chk_var_scope_aux:NNn - { @@_chk_/ #2 } + \exp_args:Nc \__debug_chk_var_scope_aux:NNn + { __debug_chk_/ #2 } #1 {#2} \fi: } - \cs_set_protected:Npn \@@_chk_var_scope_aux:NNn #1#2#3 + \cs_set_protected:Npn \__debug_chk_var_scope_aux:NNn #1#2#3 { \if:w #1 #2 \else: \if:w #1 \scan_stop: \cs_gset_nopar:Npn #1 {#2} \else: - \__msg_kernel_error:nnxxx { kernel } { local-global } + \__kernel_msg_error:nnxxx { kernel } { local-global } {#1} {#2} { \iow_char:N \\ #3 } \fi: \fi: @@ -2005,11 +2006,11 @@ % \end{macro} % % \begin{macro} -% {\@@_check-expressions_on:, \@@_check-expressions_off:} -% \begin{macro}{\@@_chk_expr:nNnN} -% \begin{macro}{\@@_chk_expr_aux:nNnN} +% {\__debug_check-expressions_on:, \__debug_check-expressions_off:} +% \begin{macro}{\__kernel_chk_expr:nNnN} +% \begin{macro}{\__debug_chk_expr_aux:nNnN} % When debugging is enabled these two functions set -% \cs{@@_chk_expr:nNnN} to test or not whether the given +% \cs{__kernel_chk_expr:nNnN} to test or not whether the given % expression is valid. The idea is to evaluate the expression within % a brace group (to catch trailing \cs{use_none:nn} or similar), then % test that the result is what we expect. This is done by turning it @@ -2027,22 +2028,22 @@ % |1+2\relax+3| would incorrectly be accepted as a valid integer % expression. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \exp_args:Nc \cs_set_protected:Npn { @@_check-expressions_on: } + \exp_args:Nc \cs_set_protected:Npn { __debug_check-expressions_on: } { - \cs_set:Npn \@@_chk_expr:nNnN ##1##2 + \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2 { - \@@_suspended:T { ##1 \use_none:nnnnnnn } - \exp_after:wN \@@_chk_expr_aux:nNnN + \__debug_suspended:T { ##1 \use_none:nnnnnnn } + \exp_after:wN \__debug_chk_expr_aux:nNnN \exp_after:wN { \tex_the:D ##2 ##1 \tex_relax:D } ##2 } } - \exp_args:Nc \cs_set_protected:Npn { @@_check-expressions_off: } - { \cs_set:Npn \@@_chk_expr:nNnN ##1##2##3##4 {##1} } - \use:c { @@_check-expressions_off: } - \cs_set:Npn \@@_chk_expr_aux:nNnN #1#2#3#4 + \exp_args:Nc \cs_set_protected:Npn { __debug_check-expressions_off: } + { \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2##3##4 {##1} } + \use:c { __debug_check-expressions_off: } + \cs_set:Npn \__debug_chk_expr_aux:nNnN #1#2#3#4 { \tl_if_empty:oF { @@ -2051,7 +2052,7 @@ \__int_value:w #3 #2 #1 \tex_relax:D } { - \__msg_kernel_expandable_error:nnnn + \__kernel_msg_expandable_error:nnnn { kernel } { expr } {#4} {#1} } #1 @@ -2063,29 +2064,29 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_log-functions_on:, \@@_log-functions_off:} -% \begin{macro}{\@@_log:x} +% \begin{macro}{\__debug_log-functions_on:, \__debug_log-functions_off:} +% \begin{macro}{\__kernel_debug_log:x} % These two functions (corresponding to the \pkg{expl3} option -% \texttt{log-functions}) control whether \cs{@@_log:x} writes to the +% \texttt{log-functions}) control whether \cs{__kernel_debug_log:x} writes to the % log file or not. Since \cs{iow_log:x} does not yet have its final % definition we do not use \cs{cs_set_eq:NN} (not defined yet anyway). % Once everything is defined, turn logging on or off depending on what % option was given. When debugging is not enabled, simply produce an % error. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \exp_args:Nc \cs_set_protected:Npn { @@_log-functions_on: } + \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_on: } { - \cs_set_protected:Npn \@@_log:x - { \@@_suspended:T \use_none:nn \iow_log:x } + \cs_set_protected:Npn \__kernel_debug_log:x + { \__debug_suspended:T \use_none:nn \iow_log:x } } - \exp_args:Nc \cs_set_protected:Npn { @@_log-functions_off: } - { \cs_set_protected:Npn \@@_log:x { \use_none:n } } + \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_off: } + { \cs_set_protected:Npn \__kernel_debug_log:x { \use_none:n } } \tex_ifodd:D \l@expl@log@functions@bool - \use:c { @@_log-functions_on: } + \use:c { __debug_log-functions_on: } \else: - \use:c { @@_log-functions_off: } + \use:c { __debug_log-functions_off: } \fi: } { } @@ -2093,33 +2094,42 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_deprecation_on:, \@@_deprecation_off:} -% \begin{variable}{\g_@@_deprecation_on_tl, \g_@@_deprecation_off_tl} +% \begin{macro}{\__debug_deprecation_on:, \__debug_deprecation_off:} +% \begin{macro}{\__kernel_deprecation_code:nn} +% \begin{variable}{\g__debug_deprecation_on_tl, \g__debug_deprecation_off_tl} % Some commands were more recently deprecated and not yet removed; % only make these into errors if the user requests it. This relies on % two token lists, mostly filled up by calls to -% \cs{@@_deprecation:nnNNpn} in each module. +% \cs{__kernel_patch_deprecation:nnNNpn} in each module. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \cs_set_protected:Npn \@@_deprecation_on: - { \g_@@_deprecation_on_tl } - \cs_set_protected:Npn \@@_deprecation_off: - { \g_@@_deprecation_off_tl } - \cs_set_nopar:Npn \g_@@_deprecation_on_tl { } - \cs_set_nopar:Npn \g_@@_deprecation_off_tl { } + \cs_set_protected:Npn \__debug_deprecation_on: + { \g__debug_deprecation_on_tl } + \cs_set_protected:Npn \__debug_deprecation_off: + { \g__debug_deprecation_off_tl } + \cs_set_nopar:Npn \g__debug_deprecation_on_tl { } + \cs_set_nopar:Npn \g__debug_deprecation_off_tl { } + \cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2 + { + \tl_gput_right:Nn \g__debug_deprecation_on_tl {#1} + \tl_gput_right:Nn \g__debug_deprecation_off_tl {#2} + } + } + { + \cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2 { } } - { } % \end{macrocode} % \end{variable} % \end{macro} +% \end{macro} % -% \begin{macro}{\@@_deprecation:nnNNpn} -% \begin{macro}{\@@_deprecation_aux:nnNnn} +% \begin{macro}{\__kernel_patch_deprecation:nnNNpn} +% \begin{macro}{\__debug_deprecation_aux:nnNnn} % Grab a definition (at present, must be \cs{cs_new_protected:Npn}). -% Add to \cs{g_@@_deprecation_on_tl} some code that makes the +% Add to \cs{g__debug_deprecation_on_tl} some code that makes the % defined macro |#3| outer (and defines it as an error). Add to -% \cs{g_@@_deprecation_off_tl} the definition itself. In both +% \cs{g__debug_deprecation_off_tl} the definition itself. In both % cases we undefine the token with \cs{tex_let:D} to avoid taking a % potentially outer macro as the argument of some \pkg{expl3} % function. Finally define the macro itself to produce a warning then @@ -2127,35 +2137,35 @@ % together with the \texttt{x}-expanding assignment and \cs{exp_not:n} % this gives a convenient way of storing the macro's definition in % itself in order to only produce the warning once for each macro. -% If debugging is disabled, \cs{@@_deprecation:nnNNpn} lets the +% If debugging is disabled, \cs{__kernel_patch_deprecation:nnNNpn} lets the % definition happen. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \cs_set_protected:Npn \@@_deprecation:nnNNpn #1#2#3#4#5# + \cs_set_protected:Npn \__kernel_patch_deprecation:nnNNpn #1#2#3#4#5# { \if_meaning:w \cs_new_protected:Npn #3 \else: - \__msg_kernel_error:nnx { kernel } { debug-unpatchable } + \__kernel_msg_error:nnx { kernel } { debug-unpatchable } { \token_to_str:N #3 ~(for~deprecation) } \fi: - \@@_deprecation_aux:nnNnn {#1} {#2} #4 {#5} + \__debug_deprecation_aux:nnNnn {#1} {#2} #4 {#5} } - \cs_set_protected:Npn \@@_deprecation_aux:nnNnn #1#2#3#4#5 + \cs_set_protected:Npn \__debug_deprecation_aux:nnNnn #1#2#3#4#5 { - \tl_gput_right:Nn \g_@@_deprecation_on_tl + \tl_gput_right:Nn \g__debug_deprecation_on_tl { \tex_let:D #3 \scan_stop: \__deprecation_error:Nnn #3 {#2} {#1} } - \tl_gput_right:Nn \g_@@_deprecation_off_tl + \tl_gput_right:Nn \g__debug_deprecation_off_tl { \tex_let:D #3 \scan_stop: \cs_set_protected:Npn #3 #4 {#5} } \cs_new_protected:Npx #3 { - \exp_not:N \__msg_kernel_warning:nnxxx + \exp_not:N \__kernel_msg_warning:nnxxx { kernel } { deprecated-command } {#1} { \token_to_str:N #3 } { \tl_to_str:n {#2} } \exp_not:n { \cs_gset_protected:Npn #3 #4 {#5} } @@ -2163,87 +2173,87 @@ } } } - { \cs_set_protected:Npn \@@_deprecation:nnNNpn #1#2 { } } + { \cs_set_protected:Npn \__kernel_patch_deprecation:nnNNpn #1#2 { } } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} -% {\@@_patch:nnNNpn, \@@_patch_conditional:nNNpnn} +% {\__kernel_patch:nnNNpn, \__kernel_patch_conditional:nNNpnn} % \begin{macro} -% {\@@_patch_aux:nnnn, \@@_patch_auxii:nnnn} -% When debugging is not enabled, \cs{@@_patch:nnNNpn} and -% \cs{@@_patch_conditional:nNNpnn} throw the patch away. +% {\__debug_patch_aux:nnnn, \__debug_patch_auxii:nnnn} +% When debugging is not enabled, \cs{__kernel_patch:nnNNpn} and +% \cs{__kernel_patch_conditional:nNNpnn} throw the patch away. % Otherwise they can be followed by \cs{cs_new:Npn} (or similar), and % \cs{prg_new_conditional:Npnn} (or similar), respectively. In each % case, grab the name of the function to be defined and its parameters % then insert tokens before and/or after the definition. % \begin{macrocode} -\@@:TF +\__kernel_debug:TF { - \cs_set_protected:Npn \@@_patch:nnNNpn #1#2#3#4#5# - { \@@_patch_aux:nnnn {#1} {#2} { #3 #4 #5 } } - \cs_set_protected:Npn \@@_patch_conditional:nNNpnn #1#2#3#4# - { \@@_patch_auxii:nnnn {#1} { #2 #3 #4 } } - \cs_set_protected:Npn \@@_patch_aux:nnnn #1#2#3#4 + \cs_set_protected:Npn \__kernel_patch:nnNNpn #1#2#3#4#5# + { \__debug_patch_aux:nnnn {#1} {#2} { #3 #4 #5 } } + \cs_set_protected:Npn \__kernel_patch_conditional:nNNpnn #1#2#3#4# + { \__debug_patch_auxii:nnnn {#1} { #2 #3 #4 } } + \cs_set_protected:Npn \__debug_patch_aux:nnnn #1#2#3#4 { #3 { #1 #4 #2 } } - \cs_set_protected:Npn \@@_patch_auxii:nnnn #1#2#3#4 + \cs_set_protected:Npn \__debug_patch_auxii:nnnn #1#2#3#4 { #2 {#3} { #1 #4 } } } { - \cs_set_protected:Npn \@@_patch:nnNNpn #1#2 { } - \cs_set_protected:Npn \@@_patch_conditional:nNNpnn #1 { } + \cs_set_protected:Npn \__kernel_patch:nnNNpn #1#2 { } + \cs_set_protected:Npn \__kernel_patch_conditional:nNNpnn #1 { } } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} -% {\@@_patch_args:nNNpn, \@@_patch_conditional_args:nNNpnn} +% {\__kernel_patch_args:nNNpn, \__kernel_patch_conditional_args:nNNpnn} % \begin{macro} -% {\@@_patch_args:nnnNNpn, \@@_patch_conditional_args:nnnNNpnn} +% {\__kernel_patch_args:nnnNNpn, \__kernel_patch_conditional_args:nnnNNpnn} % \begin{macro} % { -% \@@_tmp:w, -% \@@_patch_args_aux:nnnNNnn, -% \@@_patch_args_aux:nnnNNnnn, -% \@@_patch_args_aux:nnnn +% \__debug_tmp:w, +% \__debug_patch_args_aux:nnnNNnn, +% \__debug_patch_args_aux:nnnNNnnn, +% \__debug_patch_args_aux:nnnn % } -% See \cs{@@_patch:nnNNpn}. The first argument is something like +% See \cs{__kernel_patch:nnNNpn}. The first argument is something like % |{#1}{(#2)}|. Define a temporary macro using the \meta{parameters} % and \meta{code} of the definition that follows, then expand that % temporary macro in front of the first argument to obtain new % \meta{code}. Then perform the definition as if that new \meta{code} % was directly typed in the file. % \begin{macrocode} -\cs_set_protected:Npn \@@_patch_args:nNNpn - { \@@_patch_args:nnnNNpn { } { } } -\cs_set_protected:Npn \@@_patch_conditional_args:nNNpnn - { \@@_patch_conditional_args:nnnNNpnn { } { } } -\@@:TF +\cs_set_protected:Npn \__kernel_patch_args:nNNpn + { \__kernel_patch_args:nnnNNpn { } { } } +\cs_set_protected:Npn \__kernel_patch_conditional_args:nNNpnn + { \__kernel_patch_conditional_args:nnnNNpnn { } { } } +\__kernel_debug:TF { - \cs_set_protected:Npn \@@_patch_args:nnnNNpn #1#2#3#4#5#6# - { \@@_patch_args_aux:nnnNNnn {#1} {#2} {#3} #4 #5 {#6} } - \cs_set_protected:Npn \@@_patch_conditional_args:nnnNNpnn #1#2#3#4#5#6# - { \@@_patch_args_aux:nnnNNnnn {#1} {#2} {#3} #4 #5 {#6} } - \cs_set_protected:Npn \@@_patch_args_aux:nnnNNnn #1#2#3#4#5#6#7 + \cs_set_protected:Npn \__kernel_patch_args:nnnNNpn #1#2#3#4#5#6# + { \__debug_patch_args_aux:nnnNNnn {#1} {#2} {#3} #4 #5 {#6} } + \cs_set_protected:Npn \__kernel_patch_conditional_args:nnnNNpnn #1#2#3#4#5#6# + { \__debug_patch_args_aux:nnnNNnnn {#1} {#2} {#3} #4 #5 {#6} } + \cs_set_protected:Npn \__debug_patch_args_aux:nnnNNnn #1#2#3#4#5#6#7 { - \cs_set:Npn \@@_tmp:w #6 {#7} - \exp_after:wN \@@_patch_args_aux:nnnn \exp_after:wN - { \@@_tmp:w #3 } { #4 #5 #6 } {#1} {#2} + \cs_set:Npn \__debug_tmp:w #6 {#7} + \exp_after:wN \__debug_patch_args_aux:nnnn \exp_after:wN + { \__debug_tmp:w #3 } { #4 #5 #6 } {#1} {#2} } - \cs_set_protected:Npn \@@_patch_args_aux:nnnNNnnn #1#2#3#4#5#6#7#8 + \cs_set_protected:Npn \__debug_patch_args_aux:nnnNNnnn #1#2#3#4#5#6#7#8 { - \cs_set:Npn \@@_tmp:w #6 {#8} - \exp_after:wN \@@_patch_args_aux:nnnn \exp_after:wN - { \@@_tmp:w #3 } { #4 #5 #6 {#7} } {#1} {#2} + \cs_set:Npn \__debug_tmp:w #6 {#8} + \exp_after:wN \__debug_patch_args_aux:nnnn \exp_after:wN + { \__debug_tmp:w #3 } { #4 #5 #6 {#7} } {#1} {#2} } - \cs_set_protected:Npn \@@_patch_args_aux:nnnn #1#2#3#4 + \cs_set_protected:Npn \__debug_patch_args_aux:nnnn #1#2#3#4 { #2 { #3 #1 #4 } } } { - \cs_set_protected:Npn \@@_patch_args:nnnNNpn #1#2#3 { } - \cs_set_protected:Npn \@@_patch_conditional_args:nnnNNpnn #1#2#3 { } + \cs_set_protected:Npn \__kernel_patch_args:nnnNNpn #1#2#3 { } + \cs_set_protected:Npn \__kernel_patch_conditional_args:nnnNNpnn #1#2#3 { } } % \end{macrocode} % \end{macro} @@ -2376,7 +2386,7 @@ { \@@_generate_conditional:nnNnnnnn {#1} {#2} #3 {#4} {#5} } { \tl_count:n {#2} } { - \__msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } + \__kernel_msg_error:nnxx { kernel } { bad-number-of-arguments } { \token_to_str:c { #1 : #2 } } { \tl_count:n {#2} } \use_none:nn @@ -2405,7 +2415,7 @@ \cs_set_protected:Npn \@@_generate_conditional:nnNnnnnn #1#2#3#4#5#6#7#8 { \if_meaning:w \c_false_bool #3 - \__msg_kernel_error:nnx { kernel } { missing-colon } + \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:c {#1} } \exp_after:wN \use_none:nn \fi: @@ -2434,7 +2444,7 @@ \use:c { @@_generate_ #7 _form:wnnnnnn } \tl_if_empty:nF {#7} { - \__msg_kernel_error:nnxx + \__kernel_msg_error:nnxx { kernel } { conditional-form-unknown } {#7} { \token_to_str:c { #3 : #4 } } } @@ -2476,7 +2486,7 @@ { #7 \exp_end: \c_true_bool \c_false_bool } } { - \__msg_kernel_error:nnx { kernel } { protected-predicate } + \__kernel_msg_error:nnx { kernel } { protected-predicate } { \token_to_str:c { #4 _p: #5 } } } } @@ -2556,12 +2566,12 @@ \cs_set_protected:Npn \@@_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6 { \if_meaning:w \c_false_bool #3 - \__msg_kernel_error:nnx { kernel } { missing-colon } + \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:c {#1} } \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: \if_meaning:w \c_false_bool #6 - \__msg_kernel_error:nnx { kernel } { missing-colon } + \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:c {#4} } \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: @@ -2575,7 +2585,7 @@ \use:c { @@_set_eq_conditional_ #6 _form:wNnnnn } \tl_if_empty:nF {#6} { - \__msg_kernel_error:nnxx + \__kernel_msg_error:nnxx { kernel } { conditional-form-unknown } {#6} { \token_to_str:c { #1 : #2 } } } @@ -2584,20 +2594,20 @@ #5 {#1} {#2} {#3} {#4} \@@_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5 } -\__debug_patch:nnNNpn - { \__debug_chk_cs_exist:c { #5 _p : #6 } } { } +\__kernel_patch:nnNNpn + { \__kernel_chk_cs_exist:c { #5 _p : #6 } } { } \cs_set:Npn \@@_set_eq_conditional_p_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 _p : #4 } { #5 _p : #6 } } -\__debug_patch:nnNNpn - { \__debug_chk_cs_exist:c { #5 : #6 TF } } { } +\__kernel_patch:nnNNpn + { \__kernel_chk_cs_exist:c { #5 : #6 TF } } { } \cs_set:Npn \@@_set_eq_conditional_TF_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 TF } { #5 : #6 TF } } -\__debug_patch:nnNNpn - { \__debug_chk_cs_exist:c { #5 : #6 T } } { } +\__kernel_patch:nnNNpn + { \__kernel_chk_cs_exist:c { #5 : #6 T } } { } \cs_set:Npn \@@_set_eq_conditional_T_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 T } { #5 : #6 T } } -\__debug_patch:nnNNpn - { \__debug_chk_cs_exist:c { #5 : #6 F } } { } +\__kernel_patch:nnNNpn + { \__kernel_chk_cs_exist:c { #5 : #6 F } } { } \cs_set:Npn \@@_set_eq_conditional_F_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 F } { #5 : #6 F } } % \end{macrocode} @@ -2880,14 +2890,14 @@ % only temporary, they will be redefined later on. % % \begin{macro} -% {\__msg_kernel_error:nnxx, \__msg_kernel_error:nnx, \__msg_kernel_error:nn} +% {\__kernel_msg_error:nnxx, \__kernel_msg_error:nnx, \__kernel_msg_error:nn} % If an internal error occurs before \LaTeX3 has loaded \pkg{l3msg} then % the code should issue a usable if terse error message and halt. This % can only happen if a coding error is made by the team, so this is % a reasonable response. Setting the \tn{newlinechar} is needed, to % turn |^^J| into a proper line break in plain \TeX{}. % \begin{macrocode} -\cs_set_protected:Npn \__msg_kernel_error:nnxx #1#2#3#4 +\cs_set_protected:Npn \__kernel_msg_error:nnxx #1#2#3#4 { \tex_newlinechar:D = `\^^J \tex_relax:D \tex_errmessage:D @@ -2900,10 +2910,10 @@ } \tex_end:D } -\cs_set_protected:Npn \__msg_kernel_error:nnx #1#2#3 - { \__msg_kernel_error:nnxx {#1} {#2} {#3} { } } -\cs_set_protected:Npn \__msg_kernel_error:nn #1#2 - { \__msg_kernel_error:nnxx {#1} {#2} { } { } } +\cs_set_protected:Npn \__kernel_msg_error:nnx #1#2#3 + { \__kernel_msg_error:nnxx {#1} {#2} {#3} { } } +\cs_set_protected:Npn \__kernel_msg_error:nn #1#2 + { \__kernel_msg_error:nnxx {#1} {#2} { } { } } % \end{macrocode} % \end{macro} % @@ -2936,13 +2946,13 @@ % issued. We have to make sure we don't put the argument into the % conditional processing since it may be an |\if...| type function! % \begin{macrocode} -\__debug_patch:nnNNpn { } - { \__debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } +\__kernel_patch:nnNNpn { } + { \__kernel_debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 { - \__msg_kernel_error:nnxx { kernel } { command-already-defined } + \__kernel_msg_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } } @@ -3238,7 +3248,7 @@ { \@@_parm_from_arg_count:nnF { \use:nnn #2 #1 } {#3} { - \__msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } + \__kernel_msg_error:nnxx { kernel } { bad-number-of-arguments } { \token_to_str:N #1 } { \int_eval:n {#3} } \use_none:n } @@ -3314,14 +3324,14 @@ \str_if_eq_x:nnF { } { \tl_map_function:nN {#2} \@@_generate_from_signature:n } { - \__msg_kernel_error:nnx { kernel } { non-base-function } + \__kernel_msg_error:nnx { kernel } { non-base-function } { \token_to_str:N #5 } } \cs_generate_from_arg_count:NNnn #5 #4 { \tl_count:n {#2} } {#6} } { - \__msg_kernel_error:nnx { kernel } { missing-colon } + \__kernel_msg_error:nnx { kernel } { missing-colon } { \token_to_str:N #5 } } } @@ -3452,7 +3462,7 @@ \cs_if_exist:NTF #1 {#2} { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } + \__kernel_msg_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } |