diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-21 22:02:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-21 22:02:53 +0000 |
commit | 51d74983b14a9c2832b6bfbdcac4e99243aabbb6 (patch) | |
tree | 05fdccae9fc0c2c4cbd2371ae2b9cc1b73ea615c /Master/texmf-dist/source/latex | |
parent | 71fb1b25309a75d246b0896063f0940332c85919 (diff) |
l3 (21jul17)
git-svn-id: svn://tug.org/texlive/trunk@44864 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
61 files changed, 1622 insertions, 1325 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx index 66fdbfa57ad..b2147969d79 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -252,7 +252,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3str-convert}{2017/07/15}{} +\ProvidesExplPackage{l3str-convert}{2017/07/19}{} {L3 Experimental string encoding conversions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index f2fa9a21e75..2cbc3ae82ef 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -163,7 +163,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2017/07/15}{} +\ProvidesExplPackage{l3str-format}{2017/07/19}{} {L3 Experimental string formatting} \RequirePackage{l3str} %</package> diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx index c7d7306c484..ad176e7a727 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx @@ -54,7 +54,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -673,7 +673,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2017/07/15}{} +\ProvidesExplPackage{xcoffins}{2017/07/19}{} {L3 Experimental design level coffins} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 1ce666677fb..ca799677f59 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{l3galley}{Support package l3kernel too old} @@ -59,7 +59,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -685,7 +685,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2017/07/15}{} +\ProvidesExplPackage{l3galley}{2017/07/19}{} {L3 Experimental galley code} %</package> % \end{macrocode} @@ -2018,7 +2018,7 @@ { \dim_compare:nNnT { \etex_glueexpr:D \g_@@_interpar_vspace_user_tl } - < { \etex_glueexpr:D #1 \scan_stop: } + < { \etex_glueexpr:D (#1) \scan_stop: } { \galley_vspace_set_single:n {#1} } } } @@ -2310,6 +2310,7 @@ % generic build system is invoked (in case the % \cs{etex_interlinepenalties:D} has accidentally been cleared). % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new_protected:Npn \galley_interline_penalty_set:n #1 { \int_compare:nNnTF { \etex_interlinepenalties:D 0 } = 0 diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 8a5209af0fd..f1c746e2aa8 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -732,7 +732,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2017/07/15}{} +\ProvidesExplPackage{xgalley}{2017/07/19}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 8af4d9ce93f..13ad6e42e04 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2017/07/15}% +\def\ExplFileDate{2017/07/19}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1465,6 +1465,7 @@ } \cs_set_protected:Npn \box_rotate:Nn #1#2 { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } + \__debug_patch_args:nNNpn { {#1} { (#2) } { (#3) } } \cs_set_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3 { \hbox_set:Nn #1 @@ -1475,6 +1476,7 @@ { \box_use:N #1 } } } + \__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_set_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 { \hbox_set:Nn #1 @@ -1483,6 +1485,7 @@ { \box_use:N #1 } } } + \__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_set_protected:Npn \box_resize_to_wd:Nn #1#2 { \hbox_set:Nn #1 @@ -1707,14 +1710,6 @@ \fi % \end{macrocode} % -% \begin{macro}{\__iow_wrap_set:Nx} -% Without \LaTeXe{} there is no \cs{protected@edef} so the more risky -% direct use of \cs{tl_set:Nx} is required. -% \begin{macrocode} -\cs_set_eq:NN \__iow_wrap_set:Nx \tl_set:Nx -% \end{macrocode} -% \end{macro} -% % For driver loading in generic mode, there are no options: pick the most % appropriate case! To allow this loading to take place a temporary % definition of \cs{ProvidesExplFile} is provided diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins index 94b3fe38571..24cf7c8ed85 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3.ins +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -149,6 +149,7 @@ and all files in that bundle must be distributed together. \generate{\file{l3str.sty} {\from{l3oldmodules.dtx} {l3str,oldmodules}}} \generate{\file{l3tl.sty} {\from{l3oldmodules.dtx} {l3tl,oldmodules}}} \generate{\file{l3tl-analysis.sty}{\from{l3oldmodules.dtx} {l3tl-analysis,oldmodules}}} +\generate{\file{l3tl-build.sty} {\from{l3oldmodules.dtx} {l3tl-build,oldmodules}}} \generate{\file{l3token.sty} {\from{l3oldmodules.dtx} {l3token,oldmodules}}} % Lua code diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 35abf3765d7..74c0d275820 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 260e328e5c8..573b39c470f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1149,15 +1149,6 @@ % % \section{Internal kernel functions} % -% \begin{function}{\__chk_if_exist_cs:N, \__chk_if_exist_cs:c} -% \begin{syntax} -% \cs{__chk_if_exist_cs:N} \meta{cs} -% \end{syntax} -% This function 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}{\__chk_if_free_cs:N, \__chk_if_free_cs:c} % \begin{syntax} % \cs{__chk_if_free_cs:N} \meta{cs} @@ -1167,51 +1158,6 @@ % error. % \end{function} % -% \begin{function}{\__chk_if_exist_var:N} -% \begin{syntax} -% \cs{__chk_if_exist_var:N} \meta{var} -% \end{syntax} -% This function checks that \meta{var} is defined according to the -% criteria for \cs{cs_if_free_p:N}, and if not raises a kernel-level -% error. This function is only created if the package option -% \texttt{check-declarations} is active. -% \end{function} -% -% \begin{function}{\__debug_log:x} -% \begin{syntax} -% \cs{__debug_log:x} \Arg{message text} -% \end{syntax} -% Only defined when debugging is enabled (hence only in package mode -% with the right options). If the \texttt{log-functions} option is -% active, this function writes the \meta{message text} to the log file -% using \cs{iow_log:x}. Otherwise, the \meta{message text} is ignored -% using \cs{use_none:n}. -% \end{function} -% -% \begin{function}{\__debug_suspend_log:, \__debug_resume_log:} -% \begin{syntax} -% \cs{__debug_suspend_log:} \ldots{} \cs{__debug_log:x} \ldots{} \cs{__debug_resume_log:} -% \end{syntax} -% Any \cs{__debug_log:x} command between \cs{__debug_suspend_log:} and -% \cs{__debug_resume_log:} is suppressed. These two commands can be -% nested and do nothing when debugging is disabled. -% \end{function} -% -% \begin{function}{\__debug_patch:nnNw} -% \begin{syntax} -% \cs{__debug_patch:nnNw} \Arg{before} \Arg{after} \meta{definition} \ldots{} -% \end{syntax} -% If debugging is enabled (by one of few \pkg{expl3} options that -% imply \texttt{enable-debug}), adds the \meta{before} and -% \meta{after} tokens (which can involve |#1| and so on) in the -% \meta{definition} that follows. Otherwise ignore the \meta{before} -% and \meta{after} code and perform the \meta{definition} with no -% patching. The \meta{definition} must start with \cs{cs_new:Npn} or -% \cs{cs_set:Npn} or \cs{cs_gset:Npn} or \cs{prg_new_conditional:Npnn} -% or their protected counterparts. Other cases could be added as -% needed. -% \end{function} -% % \begin{function}[EXP]{\__cs_count_signature:N, \__cs_count_signature:c} % \begin{syntax} % \cs{__cs_count_signature:N} \meta{function} @@ -1266,6 +1212,108 @@ % normally (spaces, characters with category other). % \end{function} % +% \begin{function}{\__debug:TF} +% \begin{syntax} +% \cs{__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 +% \texttt{check-declarations}, \texttt{enable-debug}, or +% \texttt{log-functions}. Otherwise runs the \meta{false code}. The +% |T| and |F| variants are not provided for this low-level +% conditional. +% \end{function} +% +% \begin{function}{\__debug_chk_cs_exist:N, \__debug_chk_cs_exist:c} +% \begin{syntax} +% \cs{__debug_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_var_exist:N} +% \begin{syntax} +% \cs{__debug_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_log:x} +% \begin{syntax} +% \cs{__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}. +% Otherwise, the \meta{message text} is ignored using \cs{use_none:n}. +% This function is only created if debugging is enabled. +% \end{function} +% +% \begin{function}{\__debug_suspend_log:, \__debug_resume_log:} +% \begin{syntax} +% \cs{__debug_suspend_log:} \ldots{} \cs{__debug_log:x} \ldots{} \cs{__debug_resume_log:} +% \end{syntax} +% Any \cs{__debug_log:x} command between \cs{__debug_suspend_log:} and +% \cs{__debug_resume_log:} is suppressed. These two commands can be +% nested. These functions are only created if debugging is enabled. +% \end{function} +% +% \begin{function}{\__debug_patch:nnNNpn} +% \begin{syntax} +% \cs{__debug_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} +% and \meta{after} code and performs the \meta{definition} with no +% patching. Otherwise it replaces \meta{code} by \meta{before} +% \meta{code} \meta{after} (which can involve |#1| and so on) in the +% \meta{definition} that follows. The \meta{definition} must start +% with \cs{cs_new:Npn} or \cs{cs_set:Npn} or \cs{cs_gset:Npn} or their +% \texttt{_protected} counterparts. Other cases can be added as +% needed. +% \end{function} +% +% \begin{function}{\__debug_patch_conditional:nNNpnn} +% \begin{syntax} +% \cs{__debug_patch_conditional:nNNpn} \Arg{before} +% \meta{definition} \meta{conditional} \meta{parameters} \Arg{type} \Arg{code} +% \end{syntax} +% Similar to \cs{__debug_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} +% \begin{syntax} +% \cs{__debug_patch_args:nNNpn} \Arg{arguments} +% \meta{definition} \meta{function} \meta{parameters} \Arg{code} +% \end{syntax} +% Like \cs{__debug_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 +% the \meta{arguments}. More precisely, a temporary function is +% defined using the \meta{definition} with the \meta{parameters} and +% \meta{code}, then the result of expanding that function once in +% 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{cs_new:Npn} \cs{int_eval:n} |#1| \\ +% ~~|{ \__int_value:w \__int_eval:w #1 \__int_eval_end: }| +% \end{quote} +% replaces |#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 +% before \cs{prg_new_conditional:Npnn} or its \texttt{_protected} +% counterpart. +% \end{function} +% % \begin{function}{\__kernel_register_show:N, \__kernel_register_show:c} % \begin{syntax} % \cs{__kernel_register_show:N} \meta{register} @@ -1665,6 +1713,313 @@ % \end{macrocode} % \end{macro} % +% \subsection{Debugging and patching later definitions} +% +% \begin{macro}[int]{\__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 +% generic mode, while in \LaTeXe{} mode it is enabled if one of the +% options \texttt{enable-debug}, \texttt{log-functions} or +% \texttt{check-declarations} was given. +% \begin{macrocode} +\cs_set_protected:Npn \__debug:TF #1#2 {#2} +%<*package> +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \__debug:TF #1#2 {#1} +\fi: +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\debug_on:n, \debug_off:n} +% +% \begin{macrocode} +\__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 { __debug_##1_on: } + { \__msg_kernel_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 { __debug_##1_off: } + { \__msg_kernel_error:nnn { kernel } { debug } {##1} } + } + } + } + { + \cs_set_protected:Npn \debug_on:n #1 + { + \__msg_kernel_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 } + { \tl_to_str:n { \debug_off:n {#1} } } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux] +% {\__debug_check-declarations_on:, \__debug_check-declarations_off:} +% \begin{macro}[int]{\__debug_chk_var_exist:N} +% \begin{macro}[int]{\__debug_chk_cs_exist:N, \__debug_chk_cs_exist:c} +% When debugging is not active these two functions produce an +% error. Otherwise they set up \cs{__debug_chk_var_exist:N} and +% \cs{__debug_chk_cs_exist:N}, two functions that test (when +% \texttt{check-declarations} is active) that their argument is +% defined. +% \begin{macrocode} +\__debug:TF + { + \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_on: } + { + \cs_set_protected:Npn \__debug_chk_var_exist:N ##1 + { + \cs_if_exist:NF ##1 + { + \__msg_kernel_error:nnx { kernel } { non-declared-variable } + { \token_to_str:N ##1 } + } + } + \cs_set_protected:Npn \__debug_chk_cs_exist:N ##1 + { + \cs_if_exist:NF ##1 + { + \__msg_kernel_error:nnx { kernel } { command-not-defined } + { \token_to_str:N ##1 } + } + } + } + \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_off: } + { + \cs_set_protected:Npn \__debug_chk_var_exist:N ##1 { } + \cs_set_protected:Npn \__debug_chk_cs_exist:N ##1 { } + } + \cs_set_protected:Npn \__debug_chk_cs_exist:c + { \exp_args:Nc \__debug_chk_cs_exist:N } + \tex_ifodd:D \l@expl@check@declarations@bool + \use:c { __debug_check-declarations_on: } + \else: + \use:c { __debug_check-declarations_off: } + \fi: + } + { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]{\__debug_log-functions_on:, \__debug_log-functions_off:} +% \begin{macro}[int]{\__debug_log:x, \__debug_suspend_log:, \__debug_resume_log:} +% These two functions +% (corresponding to the \pkg{expl3} option \texttt{log-functions}) +% control whether \cs{__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). The +% \cs{__debug_suspend_log:} function disables \cs{__debug_log:x} until +% the matching \cs{__debug_resume_log:}. These two commands are used +% to improve the logging for datatypes with multiple parts, currently +% only coffins. They should come in pairs, which can be nested (this +% complicates the code here and is currently unused). The function +% \cs{exp_not:o} is defined in \pkg{l3expan} later on but +% \cs{__debug_suspend_log:} and \cs{__debug_resume_log:} are not used +% before that point. 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} +\__debug:TF + { + \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_on: } + { + \cs_set_protected:Npn \__debug_log:x { \iow_log:x } + \cs_set_protected:Npn \__debug_suspend_log: + { + \cs_set_protected:Npx \__debug_resume_log: + { + \cs_set_protected:Npn \__debug_resume_log: + { \exp_not:o { \__debug_resume_log: } } + \cs_set_protected:Npn \__debug_log:x + { \exp_not:o { \__debug_log:x } } + } + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_off: } + { + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + \cs_set_protected:Npn \__debug_suspend_log: { } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \tex_ifodd:D \l@expl@log@functions@bool + \use:c { __debug_log-functions_on: } + \else: + \use:c { __debug_log-functions_off: } + \fi: + } + { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\__debug_deprecation_on:, \__debug_deprecation_off:} +% \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, filled up by calls to +% \cs{__debug_deprecation:nnNNpn} in each module. +% \begin{macrocode} +\__debug:TF + { + \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 { } + } + { } +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}[int]{\__debug_deprecation:nnNNpn} +% \begin{macro}[aux]{\__debug_deprecation_aux:nnNnn} +% Grab a definition (at present, must be \cs{cs_new_protected:Npn}). +% 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__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 +% redefine and call itself. The macro initially takes no parameters: +% 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{__debug_deprecation:nnNNpn} lets the +% definition happen. +% \begin{macrocode} +\__debug:TF + { + \cs_set_protected:Npn \__debug_deprecation:nnNNpn #1#2#3#4#5# + { + \if_meaning:w \cs_new_protected:Npn #3 + \else: + \__msg_kernel_error:nnx { kernel } { debug-unpatchable } + { \token_to_str:N #3 ~(for~deprecation) } + \fi: + \__debug_deprecation_aux:nnNnn {#1} {#2} #4 {#5} + } + \cs_set_protected:Npn \__debug_deprecation_aux:nnNnn #1#2#3#4#5 + { + \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__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 + { kernel } { deprecated-command } + {#1} { \token_to_str:N #3 } { \tl_to_str:n {#2} } + \exp_not:n { \cs_gset_protected:Npn #3 #4 {#5} } + \exp_not:N #3 + } + } + } + { \cs_set_protected:Npn \__debug_deprecation:nnNNpn #1#2 { } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int] +% {\__debug_patch:nnNNpn, \__debug_patch_conditional:nNNpnn} +% \begin{macro}[aux] +% {\__debug_patch_aux:nnNNnn, \__debug_patch_aux:nNNnnn} +% When debugging is not enabled, \cs{__debug_patch:nnNNpn} and +% \cs{__debug_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} +\__debug:TF + { + \cs_set_protected:Npn \__debug_patch:nnNNpn #1#2#3#4#5# + { \__debug_patch_aux:nnNNnn {#1} {#2} #3 #4 {#5} } + \cs_set_protected:Npn \__debug_patch_conditional:nNNpnn #1#2#3#4# + { \__debug_patch_aux:nNNnnn {#1} #2 #3 {#4} } + \cs_set_protected:Npn \__debug_patch_aux:nnNNnn #1#2#3#4#5#6 + { #3 #4 #5 { #1 #6 #2 } } + \cs_set_protected:Npn \__debug_patch_aux:nNNnnn #1#2#3#4#5#6 + { #2 #3 #4 {#5} { #1 #6 } } + } + { + \cs_set_protected:Npn \__debug_patch:nnNNpn #1#2 { } + \cs_set_protected:Npn \__debug_patch_conditional:nNNpnn #1 { } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int] +% {\__debug_patch_args:nNNpn, \__debug_patch_conditional_args:nNNpnn} +% \begin{macro}[aux] +% { +% \__debug_tmp:w, +% \__debug_patch_args_aux:nNNnn, +% \__debug_patch_args_aux:nNNnnn +% } +% See \cs{__debug_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. To make it easy to expand in the +% definition, treat it as a \enquote{pre}-code to an empty definition. +% \begin{macrocode} +\__debug:TF + { + \cs_set_protected:Npn \__debug_patch_args:nNNpn #1#2#3#4# + { \__debug_patch_args_aux:nNNnn {#1} #2 #3 {#4} } + \cs_set_protected:Npn \__debug_patch_conditional_args:nNNpnn #1#2#3#4# + { \__debug_patch_args_aux:nNNnnn {#1} #2 #3 {#4} } + \cs_set_protected:Npn \__debug_patch_args_aux:nNNnn #1#2#3#4#5 + { + \cs_set:Npn \__debug_tmp:w #4 {#5} + \exp_after:wN \__debug_patch_aux:nnNNnn \exp_after:wN + { \__debug_tmp:w #1 } { } #2 #3 {#4} { } + } + \cs_set_protected:Npn \__debug_patch_args_aux:nNNnnn #1#2#3#4#5#6 + { + \cs_set:Npn \__debug_tmp:w #4 {#6} + \exp_after:wN \__debug_patch_aux:nNNnnn \exp_after:wN + { \__debug_tmp:w #1 } #2 #3 {#4} {#5} { } + } + } + { + \cs_set_protected:Npn \__debug_patch_args:nNNpn #1 { } + \cs_set_protected:Npn \__debug_patch_conditional_args:nNNpnn #1 { } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Conditional processing and definitions} % % Underneath any predicate function (|_p|) or other conditional forms @@ -1995,26 +2350,22 @@ #5 {#1} {#2} {#3} {#4} \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5 } +\__debug_patch:nnNNpn + { \__debug_chk_cs_exist:c { #5 _p : #6 } } { } \cs_set:Npn \__prg_set_eq_conditional_p_form:wNnnnn #1 \q_stop #2#3#4#5#6 - { - \__chk_if_exist_cs:c { #5 _p : #6 } - #2 { #3 _p : #4 } { #5 _p : #6 } - } + { #2 { #3 _p : #4 } { #5 _p : #6 } } +\__debug_patch:nnNNpn + { \__debug_chk_cs_exist:c { #5 : #6 TF } } { } \cs_set:Npn \__prg_set_eq_conditional_TF_form:wNnnnn #1 \q_stop #2#3#4#5#6 - { - \__chk_if_exist_cs:c { #5 : #6 TF } - #2 { #3 : #4 TF } { #5 : #6 TF } - } + { #2 { #3 : #4 TF } { #5 : #6 TF } } +\__debug_patch:nnNNpn + { \__debug_chk_cs_exist:c { #5 : #6 T } } { } \cs_set:Npn \__prg_set_eq_conditional_T_form:wNnnnn #1 \q_stop #2#3#4#5#6 - { - \__chk_if_exist_cs:c { #5 : #6 T } - #2 { #3 : #4 T } { #5 : #6 T } - } + { #2 { #3 : #4 T } { #5 : #6 T } } +\__debug_patch:nnNNpn + { \__debug_chk_cs_exist:c { #5 : #6 F } } { } \cs_set:Npn \__prg_set_eq_conditional_F_form:wNnnnn #1 \q_stop #2#3#4#5#6 - { - \__chk_if_exist_cs:c { #5 : #6 F } - #2 { #3 : #4 F } { #5 : #6 F } - } + { #2 { #3 : #4 F } { #5 : #6 F } } % \end{macrocode} % \end{macro} % \end{macro} @@ -2278,7 +2629,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Checking and patching (new) functions} +% \subsection{Preliminaries for new functions} % % We provide two kinds of functions that can be used to define % control sequences. On the one hand we have functions that check @@ -2338,130 +2689,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\debug_log_functions_on:, \debug_log_functions_off:} -% \begin{macro}[int]{\__debug_log:x, \__debug_suspend_log:, \__debug_resume_log:} -% When debugging is not enabled at all (including in the format), the -% \cs[index=debug_log_functions_on:]{debug_log_functions_on/off:} -% functions simply produce errors, while \cs{__debug_suspend_log:} and -% \cs{__debug_resume_log:} do nothing. -% \begin{macrocode} -\cs_set_protected:Npn \debug_log_functions_on: - { - \__msg_kernel_error:nnx { kernel } { enable-debug } - { \token_to_str:N \debug_log_functions_on: } - } -\cs_set_protected:Npn \debug_log_functions_off: - { - \__msg_kernel_error:nnx { kernel } { enable-debug } - { \token_to_str:N \debug_log_functions_off: } - } -\cs_set_protected:Npn \__debug_suspend_log: { } -\cs_set_protected:Npn \__debug_resume_log: { } -% \end{macrocode} -% Otherwise, they set up \cs{__debug_log:x}, -% \cs{__debug_suspend_log:}, and \cs{__debug_resume_log:} to have the -% following behaviour. The function \cs{__debug_log:x} is used to -% write some information to the \texttt{log} file in case the -% \texttt{log-function} option is active and to otherwise ignore its -% argument. Using this function rather than directly using -% \cs{iow_log:x} allows for \cs{__debug_suspend_log:} which disables -% such messages until the matching \cs{__debug_resume_log:}. These -% two commands are used to improve the logging for datatypes with -% multiple parts (currently only coffins). They should come in pairs, -% which can be nested. The function \cs{exp_not:o} is defined in -% \pkg{l3expan} later on but \cs{__debug_suspend_log:} and -% \cs{__debug_resume_log:} are not used before that point. Once -% everything is defined, turn logging on or off depending on what -% option was given. -% \begin{macrocode} -%<*package> -\tex_ifodd:D \l@expl@enable@debug@bool - \cs_set_protected:Npn \debug_log_functions_on: - { - \cs_set_protected:Npn \__debug_log:x { \iow_log:x } - \cs_set_protected:Npn \__debug_suspend_log: - { - \cs_set_protected:Npx \__debug_resume_log: - { - \cs_set_protected:Npn \__debug_resume_log: - { \exp_not:o { \__debug_resume_log: } } - \cs_set_protected:Npn \__debug_log:x - { \exp_not:o { \__debug_log:x } } - } - \cs_set_protected:Npn \__debug_log:x { \use_none:n } - } - \cs_set_protected:Npn \__debug_resume_log: { } - } - \cs_set_protected:Npn \debug_log_functions_off: - { - \cs_set_protected:Npn \__debug_log:x { \use_none:n } - \cs_set_protected:Npn \__debug_suspend_log: { } - \cs_set_protected:Npn \__debug_resume_log: { } - } - \tex_ifodd:D \l@expl@log@functions@bool - \debug_log_functions_on: - \else: - \debug_log_functions_off: - \fi: -\fi: -%</package> -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\__debug_patch:nnNw} -% \begin{macro}[aux] -% { -% \__debug_patch_param:NNnnNnp, -% \__debug_patch_new:nnNNnn, -% \__debug_patch_new_conditional:nnNNnnn -% } -% When debugging is not enabled, \cs{__debug_patch:nnNw} throws the -% patch away. Otherwise it can be followed by \cs{cs_new:Npn} or -% \cs{prg_new_conditional:Npnn} or their protected counterparts. In -% each case, grab the name of the function to be defined and its -% parameters using \cs{__debug_patch_param:w} then insert tokens -% before and after the definition. Of course for a conditional one -% should likely not insert anything after the code. -% \begin{macrocode} -\cs_set_protected:Npn \__debug_patch:nnNw #1#2 { } -%<*package> -\tex_ifodd:D \l@expl@enable@debug@bool - \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3 - { - \tex_ifcase:D - \if_meaning:w #3 \cs_new_protected:Npn 1~ \fi: - \if_meaning:w #3 \cs_new:Npn 1~ \fi: - \if_meaning:w #3 \cs_set_protected:Npn 1~ \fi: - \if_meaning:w #3 \cs_set:Npn 1~ \fi: - \if_meaning:w #3 \cs_gset_protected:Npn 1~ \fi: - \if_meaning:w #3 \cs_gset:Npn 1~ \fi: - \if_meaning:w #3 \prg_new_protected_conditional:Npnn 2~ \fi: - \if_meaning:w #3 \prg_new_conditional:Npnn 2~ \fi: - \__msg_kernel_error:nnx { kernel } { debug-unpatchable } - { \token_to_str:N #3 } - \or: - \exp_after:wN \__debug_patch_param:NNnnNnp - \exp_after:wN \__debug_patch_new:nnNNnn - \else: - \exp_after:wN \__debug_patch_param:NNnnNnp - \exp_after:wN \__debug_patch_new_conditional:nnNNnnn - \fi: - \use_none:nn {#1} {#2} #3 - } - \cs_set_protected:Npn \__debug_patch_param:NNnnNnp #1#2#3#4#5#6#7# - { #1 {#3} {#4} #5 #6 {#7} } - \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6 - { #3 #4 #5 { #1 #6 #2 } } - \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn - #1#2#3#4#5#6#7 - { #3 #4 #5 {#6} { #1 #7 #2 } } -\fi: -%</package> -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}[int]{\__chk_if_free_cs:N, \__chk_if_free_cs:c} % This command is called by \cs{cs_new_nopar:Npn} and \cs{cs_new_eq:NN} % \emph{etc.}\ @@ -2471,7 +2698,7 @@ % 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:nnNw { } +\__debug_patch:nnNNpn { } { \__debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \cs_set_protected:Npn \__chk_if_free_cs:N #1 { @@ -2486,66 +2713,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\debug_check_declarations_on:, \debug_check_declarations_off:} -% \begin{macro}[int]{\__chk_if_exist_var:N} -% When debugging is not active these two user functions produce an -% error. Otherwise they set up \cs{__chk_if_exist_var:N}, a function -% which when \texttt{check-declarations} is active tests that a given -% variable is defined. -% \begin{macrocode} -\cs_set_protected:Npn \debug_check_declarations_on: - { - \__msg_kernel_error:nnx { kernel } { enable-debug } - { \token_to_str:N \debug_check_declarations_on: } - } -\cs_set_protected:Npn \debug_check_declarations_off: - { - \__msg_kernel_error:nnx { kernel } { enable-debug } - { \token_to_str:N \debug_check_declarations_off: } - } -%<*package> -\tex_ifodd:D \l@expl@enable@debug@bool - \cs_set_protected:Npn \debug_check_declarations_on: - { - \cs_set_protected:Npn \__chk_if_exist_var:N ##1 - { - \cs_if_exist:NF ##1 - { - \__msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N ##1 } - } - } - } - \cs_set_protected:Npn \debug_check_declarations_off: - { \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { } } - \tex_ifodd:D \l@expl@check@declarations@bool - \debug_check_declarations_on: - \else: - \debug_check_declarations_off: - \fi: -\fi: -%</package> -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\__chk_if_exist_cs:N, \__chk_if_exist_cs:c} -% This function issues an error message when the control sequence -% in its argument does not exist. -% \begin{macrocode} -\cs_set_protected:Npn \__chk_if_exist_cs:N #1 - { - \cs_if_exist:NF #1 - { - \__msg_kernel_error:nnx { kernel } { command-not-defined } - { \token_to_str:N #1 } - } - } -\cs_set_protected:Npn \__chk_if_exist_cs:c - { \exp_args:Nc \__chk_if_exist_cs:N } -% \end{macrocode} -% \end{macro} -% % \subsection{Defining new functions} % % \begin{macro} @@ -2745,7 +2912,7 @@ \exp_args:Nx \__cs_parm_from_arg_count_test:nnF { \exp_after:wN \exp_not:n - \if_case:w \__int_eval:w #2 \__int_eval_end: + \if_case:w \__int_eval:w (#2) \__int_eval_end: { } \or: { ##1 } \or: { ##1##2 } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 161ac10180d..a1a14e30bdf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -138,7 +138,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 7b27571dee6..4a1d1b34627 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -536,22 +536,22 @@ % \meta{dimexpr} and then stores the result inside the \meta{box}. % \end{function} % -% \begin{function}[updated = 2017-04-058] -% { -% \vbox_set:Nw, \vbox_set:cw, -% \vbox_set_end:, -% \vbox_gset:Nw, \vbox_gset:cw, -% \vbox_gset_end: -% } -% \begin{syntax} -% \cs{vbox_set:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:} -% \end{syntax} -% Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. In contrast -% to \cs{vbox_set:Nn} this function does not absorb the argument -% when finding the \meta{content}, and so can be used in circumstances -% where the \meta{content} may not be a simple argument. -% \end{function} +% \begin{function}[updated = 2017-04-05] +% { +% \vbox_set:Nw, \vbox_set:cw, +% \vbox_set_end:, +% \vbox_gset:Nw, \vbox_gset:cw, +% \vbox_gset_end: +% } +% \begin{syntax} +% \cs{vbox_set:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:} +% \end{syntax} +% Typesets the \meta{contents} at natural height and then stores the +% result inside the \meta{box}. In contrast +% to \cs{vbox_set:Nn} this function does not absorb the argument +% when finding the \meta{content}, and so can be used in circumstances +% where the \meta{content} may not be a simple argument. +% \end{function} % % \begin{function}[added = 2017-06-08] % { @@ -944,13 +944,18 @@ % \begin{macro}{\box_set_ht:Nn, \box_set_ht:cn} % \begin{macro}{\box_set_dp:Nn, \box_set_dp:cn} % \begin{macro}{\box_set_wd:Nn, \box_set_wd:cn} -% Measuring is easy: all primitive work. These primitives are not +% Setting the size is easy: all primitive work. These primitives are not % expandable, so the derived functions are not either. +% When debugging, the dimension expression |#2| is surrounded by +% parentheses to catch early termination. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \box_set_dp:Nn #1#2 { \box_dp:N #1 \__dim_eval:w #2 \__dim_eval_end: } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \box_set_ht:Nn #1#2 { \box_ht:N #1 \__dim_eval:w #2 \__dim_eval_end: } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \box_set_wd:Nn #1#2 { \box_wd:N #1 \__dim_eval:w #2 \__dim_eval_end: } \cs_generate_variant:Nn \box_set_ht:Nn { c } @@ -980,13 +985,19 @@ % \begin{macro}{\box_move_up:nn, \box_move_down:nn} % \testfile* % Move box material in different directions. +% When debugging, the dimension expression |#1| is surrounded by +% parentheses to catch early termination. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \box_move_left:nn #1#2 { \tex_moveleft:D \__dim_eval:w #1 \__dim_eval_end: #2 } +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \box_move_right:nn #1#2 { \tex_moveright:D \__dim_eval:w #1 \__dim_eval_end: #2 } +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \box_move_up:nn #1#2 { \tex_raise:D \__dim_eval:w #1 \__dim_eval_end: #2 } +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \box_move_down:nn #1#2 { \tex_lower:D \__dim_eval:w #1 \__dim_eval_end: #2 } % \end{macrocode} @@ -1183,7 +1194,9 @@ % \begin{macro}{\hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn} % \testfile* % Storing material in a horizontal box with a specified width. +% Again, put the dimension expression in parentheses when debugging. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } {#3} } \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 { \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: @@ -1229,6 +1242,7 @@ % \begin{macro}{\hbox_gset_to_wd:Nnw, \hbox_gset_to_wd:cnw} % Combining the above ideas. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2 { \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: @@ -1248,6 +1262,7 @@ % \testfile* % Put a horizontal box directly into the input stream. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \hbox_to_wd:nn #1#2 { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: @@ -1308,6 +1323,7 @@ % \testfile* % Put a vertical box directly into the input stream. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } {#2} } \cs_new_protected:Npn \vbox_to_ht:nn #1#2 { \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end: @@ -1363,6 +1379,7 @@ % \testfile* % Storing material in a vertical box with a specified height. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } {#3} } \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 { \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: @@ -1409,6 +1426,7 @@ % \begin{macro}{\vbox_gset_to_ht:Nnw, \vbox_gset_to_ht:cnw} % A combination of the above ideas. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2 { \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: @@ -1440,6 +1458,7 @@ % \testfile* % Splitting a vertical box in two. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} {#2} { (#3) } } \cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3 { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: } % \end{macrocode} @@ -1984,8 +2003,14 @@ % % \begin{macro}[deprecated = 2018-12-31]{\box_resize:Nnn, \box_resize:cnn} % \begin{macrocode} -\cs_new_eq:NN \box_resize:Nnn \box_resize_to_wd_and_ht_plus_dp:Nnn -\cs_new_eq:NN \box_resize:cnn \box_resize_to_wd_and_ht_plus_dp:cnn +\__debug_deprecation:nnNNpn + { 2018-12-31 } { \box_resize_to_wd_and_ht_plus_dp:Nnn } +\cs_new_protected:Npn \box_resize:Nnn + { \box_resize_to_wd_and_ht_plus_dp:Nnn } +\__debug_deprecation:nnNNpn + { 2018-12-31 } { \box_resize_to_wd_and_ht_plus_dp:cnn } +\cs_new_protected:Npn \box_resize:cnn + { \box_resize_to_wd_and_ht_plus_dp:cnn } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index e8f04f06024..fd489351898 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -84,31 +84,25 @@ % % \section{Additions to \pkg{l3basics}} % -% \begin{function}[added = 2017-07-14] -% {\debug_check_declarations_on:, \debug_check_declarations_off:} +% \begin{function}[added = 2017-07-16]{\debug_on:n, \debug_off:n} % \begin{syntax} -% \cs{debug_check_declarations_on:} -% \cs{debug_check_declarations_off:} +% \cs{debug_on:n} |{| \meta{comma-separated list} |}| +% \cs{debug_off:n} |{| \meta{comma-separated list} |}| % \end{syntax} -% Turn on and off within a group the code that checks that all -% \pkg{expl3} variables used were previously declared, as done -% globally by the \texttt{check-declarations} option. This can only -% be used if \pkg{expl3} is loaded with one of the options -% \texttt{check-declarations}, \texttt{log-functions}, or -% \texttt{enable-debug}. -% \end{function} -% -% \begin{function}[added = 2017-07-14] -% {\debug_log_functions_on:, \debug_log_functions_off:} -% \begin{syntax} -% \cs{debug_log_functions_on:} -% \cs{debug_log_functions_off:} -% \end{syntax} -% Turn on and off within a group the code that logs function -% definitions, as done globally by the \texttt{log-functions} option. -% This can only be used if \pkg{expl3} is loaded with one of the -% options \texttt{check-declarations}, \texttt{log-functions}, or -% \texttt{enable-debug}. +% Turn on and off within a group various debugging code, some of which +% is also available as \pkg{expl3} load-time options. The items that +% can be used in the \meta{list} are +% \begin{itemize} +% \item \texttt{check-declarations} that checks all \pkg{expl3} +% variables used were previously declared; +% \item \texttt{deprecation} that makes soon-to-be-deprecated commands produce errors; +% \item \texttt{log-functions} that logs function definitions; +% \end{itemize} +% Providing these as switches rather than options allows testing code +% even if it relies on other packages: load all other packages, call +% \cs{debug_on:n}, and load the code that one is interested in +% testing. These functions can only be used in \LaTeXe{} package mode +% loaded with \texttt{enable-debug} or another option implying it. % \end{function} % % \begin{function}[added = 2017-07-04]{\mode_leave_vertical:} @@ -273,16 +267,17 @@ % \end{texnote} % \end{function} % -% \begin{function}[TF, added = 2014-07-02]{\file_if_exist_input:n} +% \begin{function}[added = 2014-07-02]{\file_if_exist_input:n, \file_if_exist_input:nF} % \begin{syntax} % \cs{file_if_exist_input:n} \Arg{file name} -% \cs{file_if_exist_input:nTF} \Arg{file name} \Arg{true code} \Arg{false code} +% \cs{file_if_exist_input:nF} \Arg{file name} \Arg{false code} % \end{syntax} % 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 +% \cs{file_path_include:n}. If found then % 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 +% \cs{file_input:n}, otherwise inserts the \meta{false code}. +% Note that these functions do not raise % an error if the file is not found, in contrast to \cs{file_input:n}. % \end{function} % @@ -855,33 +850,81 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP, added = 2017-02-17] -% {\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} +% \begin{function}[EXP, added = 2017-02-17, updated = 2017-07-15]{\tl_range:nnn} % \begin{syntax} % \cs{tl_range:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} % \cs{tl_range:nnn} \Arg{token list} \Arg{start index} \Arg{end index} % \end{syntax} % Leaves in the input stream the items from the \meta{start index} to the -% \meta{end index} inclusive. Positive \meta{indices} are counted +% \meta{end index} inclusive. Spaces and braces are preserved between +% the items returned (but never at either end of the list). Positive +% \meta{indices} are counted % from the start of the \meta{token list}, $1$~being the first item, and % negative \meta{indices} are counted from the end of the token list, % $-1$~being the last item. If either of \meta{start index} or % \meta{end index} is~$0$, the result is empty. For instance, % \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcdef } { 2 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcdef } { -4 } { -1 } } -% \iow_term:x { \tl_range:nnn { abcdef } { -2 } { -1 } } -% \iow_term:x { \tl_range:nnn { abcdef } { 0 } { -1 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { 2 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { -4 } { -1 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { -2 } { -1 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { 0 } { -1 } } % \end{verbatim} -% prints \texttt{{b}{c}{d}{e}}, \texttt{{c}{d}{e}{f}}, \texttt{{e}{f}}, and an empty +% prints \verb*|bcd {e{}}|, \verb*|cd {e{}}f|, \verb*|{e{}}f| and an empty % line to the terminal. The \meta{start index} must always be smaller than % or equal to the \meta{end index}: if this is not the case then no output % is generated. Thus % \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcdef } { 5 } { 2 } } -% \iow_term:x { \tl_range:nnn { abcdef } { -1 } { -4 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { 5 } { 2 } } +% \iow_term:x { \tl_range:nnn { abcd~{e{}}f } { -1 } { -4 } } +% \end{verbatim} +% both yield empty token lists. For improved performance, see +% \cs{tl_range_braced:nnn} and \cs{tl_range_unbraced:nnn}. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{item} +% does not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% +% \begin{function}[EXP, added = 2017-07-15] +% { +% \tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn, +% \tl_range_unbraced:Nnn, \tl_range_unbraced:cnn, \tl_range_unbraced:nnn +% } +% \begin{syntax} +% \cs{tl_range_braced:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} +% \cs{tl_range_braced:nnn} \Arg{token list} \Arg{start index} \Arg{end index} +% \cs{tl_range_unbraced:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} +% \cs{tl_range_unbraced:nnn} \Arg{token list} \Arg{start index} \Arg{end index} +% \end{syntax} +% Leaves in the input stream the items from the \meta{start index} to +% the \meta{end index} inclusive, using the same indexing as +% \cs{tl_range:nnn}. Spaces are ignored. Regardless of whether items +% appear with or without braces in the \meta{token list}, the +% \cs{tl_range_braced:nnn} function wraps each item in braces, while +% \cs{tl_range_unbraced:nnn} does not (overall it removes an outer set +% of braces). For instance, +% \begin{verbatim} +% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { 2 } { 5 } } +% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { -4 } { -1 } } +% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { -2 } { -1 } } +% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { 0 } { -1 } } % \end{verbatim} -% both yield empty token lists. +% prints \verb*|{b}{c}{d}{e{}}|, \verb*|{c}{d}{e{}}{f}|, \verb*|{e{}}{f}|, and an empty +% line to the terminal, while +% \begin{verbatim} +% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { 2 } { 5 } } +% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { -4 } { -1 } } +% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { -2 } { -1 } } +% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { 0 } { -1 } } +% \end{verbatim} +% prints \verb*|bcde{}|, \verb*|cde{}f|, \verb*|e{}f|, and an empty +% line to the terminal. Because braces are removed, the result of +% \cs{tl_range_unbraced:nnn} may have a different number of items as +% for \cs{tl_range:nnn} or \cs{tl_range_braced:nnn}. In cases where +% preserving spaces is important, consider the slower function +% \cs{tl_range:nnn}. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} @@ -890,7 +933,7 @@ % \end{texnote} % \end{function} % -% \section{Additions to \pkg{l3tokens}} +% \section{Additions to \pkg{l3token}} % % \begin{function}[TF, updated = 2012-12-20]{\peek_N_type:} % \begin{syntax} @@ -973,6 +1016,7 @@ % Trimming from the left- and right-hand edges of the box is easy: kern the % appropriate parts off each side. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } {#3} { (#4) } {#5} } \cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5 { \hbox_set:Nn \l_@@_internal_box @@ -1002,7 +1046,7 @@ { \hbox_set:Nn \l_@@_internal_box { - \box_move_down:nn { #3 - \box_dp:N #1 } + \box_move_down:nn { (#3) - \box_dp:N #1 } { \box_use:N \l_@@_internal_box } } \box_set_dp:Nn \l_@@_internal_box \c_zero_dim @@ -1023,7 +1067,7 @@ { \hbox_set:Nn \l_@@_internal_box { - \box_move_up:nn { #5 - \box_ht:N \l_@@_internal_box } + \box_move_up:nn { (#5) - \box_ht:N \l_@@_internal_box } { \box_use:N \l_@@_internal_box } } \box_set_ht:Nn \l_@@_internal_box \c_zero_dim @@ -1039,6 +1083,7 @@ % dimensions. As a result, there are some things to watch out for in the % vertical direction. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } {#3} { (#4) } {#5} } \cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 { \hbox_set:Nn \l_@@_internal_box @@ -1070,7 +1115,7 @@ } \box_set_ht:Nn \l_@@_internal_box { - #5 + (#5) \dim_compare:nNnT {#3} > \c_zero_dim { - (#3) } } @@ -1574,7 +1619,7 @@ { \prop_put:cnx { l_@@_poles_ \__int_value:w #1 _prop } {#2} { - { \dim_eval:n #3 + \box_wd:N #1 } {#4} + { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} {#5} {#6} } } @@ -1660,9 +1705,10 @@ % \end{macro} % \end{macro} % -% \begin{macro}[TF]{\file_if_exist_input:n} -% Input of a file with a test for existence cannot be done the usual -% way as the tokens to insert are in an odd place. +% \begin{macro}{\file_if_exist_input:n, \file_if_exist_input:nF} +% Input of a file with a test for existence. We do not define the |T| +% or |TF| variants because the most useful place to place the +% \meta{true code} would be inconsistent with other conditionals. % \begin{macrocode} \cs_new_protected:Npn \file_if_exist_input:n #1 { @@ -1670,15 +1716,6 @@ \str_if_empty:NF \l__file_full_name_str { \@@_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nT #1#2 - { - \file_get_full_name:nN {#1} \l__file_full_name_str - \str_if_empty:NF \l__file_full_name_str - { - #2 - \@@_input:V \l__file_full_name_str - } - } \cs_new_protected:Npn \file_if_exist_input:nF #1#2 { \file_get_full_name:nN {#1} \l__file_full_name_str @@ -1686,15 +1723,27 @@ {#2} { \@@_input:V \l__file_full_name_str } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[deprecated = 2017-12-31]{\file_if_exist_input:nT, \file_if_exist_input:nTF} +% For removal after 2017-12-31. +% \begin{macrocode} +\__debug_deprecation:nnNNpn { 2017-12-31 } + { \file_if_exist:nTF and~ \file_input:n } \cs_new_protected:Npn \file_if_exist_input:nTF #1#2#3 { \file_get_full_name:nN {#1} \l__file_full_name_str \str_if_empty:NTF \l__file_full_name_str - {#3} - { - #2 - \@@_input:V \l__file_full_name_str - } + {#3} { #2 \@@_input:V \l__file_full_name_str } + } +\__debug_deprecation:nnNNpn { 2017-12-31 } + { \file_if_exist:nT and~ \file_input:n } +\cs_new_protected:Npn \file_if_exist_input:nT #1#2 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str + { #2 \@@_input:V \l__file_full_name_str } } % \end{macrocode} % \end{macro} @@ -1733,6 +1782,7 @@ % \begin{macrocode} \cs_if_exist:NTF \pdftex_uniformdeviate:D { + \__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \int_rand:nn #1#2 { \exp_after:wN \@@_rand:ww @@ -2107,6 +2157,7 @@ % \begin{macro}{\sys_gset_rand_seed:n} % The primitive always assigns the seed globally. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new_protected:Npn \sys_gset_rand_seed:n #1 { \pdftex_setrandomseed:D \__int_eval:w #1 \__int_eval_end: } % \end{macrocode} @@ -3825,37 +3876,68 @@ % \end{macrocode} % \end{macro} % +% Some preliminary code is needed for the \cs{tl_range:nnn} family of functions. +% % \begin{macro}{\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} +% \begin{macro}{\tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn} +% \begin{macro} +% {\tl_range_unbraced:Nnn, \tl_range_unbraced:cnn, \tl_range_unbraced:nnn} % \begin{macro}[aux] -% {\@@_range:nnnw, \@@_range:nnw, \@@_range_normalize:nn, \@@_range_collect:w, \@@_range_skip:w} +% { +% \@@_range:Nnnn, \@@_range:nnnNn, \@@_range:nnNn, \@@_range_skip:w, +% \@@_range_braced:w, \@@_range_collect_braced:w, +% \@@_range_unbraced:w, \@@_range_collect_unbraced:w, +% \@@_range:w, \@@_range_skip_spaces:n, \@@_range_collect:nn, +% \@@_range_collect:ff, \@@_range_collect_space:nw, +% \@@_range_collect_N:nN, \@@_range_collect_group:nN, +% } % To avoid checking for the end of the token list at every step, start % by counting the number $l$ of items and \enquote{normalizing} the % bounds, namely clamping them to the interval $[0,l]$ and dealing -% with negative indices. More precisely, \cs{@@_range:nnw} receives -% the number of items to skip at the beginning of the token list, and -% the index of the last item to keep. If nothing should be kept, -% leave |{}|: this stops the \texttt{f}-expansion of \cs{tl_head:f} -% and that function produces an empty result. Otherwise, repeatedly -% call \cs{@@_range_skip:w} to delete |#1| items from the input stream -% (the extra brace group avoids an off-by-one mistake), then -% repeatedly call \cs{@@_range_collect:w} to store in its second -% argument the items to be kept. Eventually, the result is a brace -% group followed by the rest of the token list, and \cs{tl_head:f} -% cleans up and gives the result in \cs{exp_not:n}. +% with negative indices. More precisely, \cs{@@_range_items:nnNn} +% receives the number of items to skip at the beginning of the token +% list, the index of the last item to keep, a function among +% \cs{@@_range:w}, \cs{@@_range_braced:w}, \cs{@@_range_unbraced:w}, +% and the token list itself. If nothing should be kept, leave |{}|: +% this stops the \texttt{f}-expansion of \cs{tl_head:f} and that +% function produces an empty result. Otherwise, repeatedly call +% \cs{@@_range_skip:w} to delete |#1| items from the input stream (the +% extra brace group avoids an off-by-one shift). For the braced +% version \cs{@@_range_braced:w} sets up +% \cs{@@_range_collect_braced:w} which stores items one by one in an +% argument after the semicolon. The unbraced version is almost +% identical. The version preserving braces and spaces starts by +% deleting spaces before the argument to avoid collecting them, and +% sets up \cs{@@_range_collect:nn} with a first argument of the form +% |{| \Arg{collected} \meta{tokens} |}|, whose head is the collected +% tokens and whose tail is what remains of the original token list. +% This form makes it easier to move tokens to the \meta{collected} +% tokens. Depending on the first token of the tail, either just move +% it (if it is a space) or also decrement the number of items left to +% find. Eventually, the result is a brace group followed by the rest +% of the token list, and \cs{tl_head:f} cleans up and gives the result +% in \cs{exp_not:n}. % \begin{macrocode} \cs_new:Npn \tl_range:Nnn { \exp_args:No \tl_range:nnn } \cs_generate_variant:Nn \tl_range:Nnn { c } -\cs_new:Npn \tl_range:nnn #1#2#3 +\cs_new:Npn \tl_range:nnn { \@@_range:Nnnn \@@_range:w } +\cs_new:Npn \tl_range_braced:Nnn { \exp_args:No \tl_range_braced:nnn } +\cs_generate_variant:Nn \tl_range_braced:Nnn { c } +\cs_new:Npn \tl_range_braced:nnn { \@@_range:Nnnn \@@_range_braced:w } +\cs_new:Npn \tl_range_unbraced:Nnn { \exp_args:No \tl_range_unbraced:nnn } +\cs_generate_variant:Nn \tl_range_unbraced:Nnn { c } +\cs_new:Npn \tl_range_unbraced:nnn { \@@_range:Nnnn \@@_range_unbraced:w } +\cs_new:Npn \@@_range:Nnnn #1#2#3#4 { \tl_head:f { - \exp_args:Nf \@@_range:nnnw { \tl_count:n {#1} } {#2} {#3} - #1 + \exp_args:Nf \@@_range:nnnNn + { \tl_count:n {#2} } {#3} {#4} #1 {#2} } } -\cs_new:Npn \@@_range:nnnw #1#2#3 +\cs_new:Npn \@@_range:nnnNn #1#2#3 { - \exp_args:Nff \@@_range:nnw + \exp_args:Nff \@@_range:nnNn { \exp_args:Nf \@@_range_normalize:nn { \int_eval:n { #2 - 1 } } {#1} @@ -3865,15 +3947,14 @@ { \int_eval:n {#3} } {#1} } } -\cs_new:Npn \@@_range:nnw #1#2 +\cs_new:Npn \@@_range:nnNn #1#2#3#4 { \if_int_compare:w #2 > #1 \exp_stop_f: \else: \exp_after:wN { \exp_after:wN } \fi: - \exp_after:wN \@@_range_collect:w + \exp_after:wN #3 \__int_value:w \__int_eval:w #2 - #1 \exp_after:wN ; - \exp_after:wN { \exp_after:wN } - \exp:w \@@_range_skip:w #1 ; { } + \exp_after:wN { \exp:w \@@_range_skip:w #1 ; { } #4 } } \cs_new:Npn \@@_range_skip:w #1 ; #2 { @@ -3884,17 +3965,70 @@ \exp_after:wN \exp_end: \fi: } -\cs_new:Npn \@@_range_collect:w #1 ; #2#3 +\cs_new:Npn \@@_range_braced:w #1 ; #2 + { \@@_range_collect_braced:w #1 ; { } #2 } +\cs_new:Npn \@@_range_unbraced:w #1 ; #2 + { \@@_range_collect_unbraced:w #1 ; { } #2 } +\cs_new:Npn \@@_range_collect_braced:w #1 ; #2#3 { \if_int_compare:w #1 > 1 \exp_stop_f: - \exp_after:wN \@@_range_collect:w + \exp_after:wN \@@_range_collect_braced:w \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; \fi: { #2 {#3} } } +\cs_new:Npn \@@_range_collect_unbraced:w #1 ; #2#3 + { + \if_int_compare:w #1 > 1 \exp_stop_f: + \exp_after:wN \@@_range_collect_unbraced:w + \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; + \fi: + { #2 #3 } + } +\cs_new:Npn \@@_range:w #1 ; #2 + { + \exp_args:Nf \@@_range_collect:nn + { \@@_range_skip_spaces:n {#2} } {#1} + } +\cs_new:Npn \@@_range_skip_spaces:n #1 + { + \tl_if_head_is_space:nTF {#1} + { \exp_args:Nf \@@_range_skip_spaces:n {#1} } + { { } #1 } + } +\cs_new:Npn \@@_range_collect:nn #1#2 + { + \int_compare:nNnTF {#2} = 0 + {#1} + { + \exp_args:No \tl_if_head_is_space:nTF { \use_none:n #1 } + { + \exp_args:Nf \@@_range_collect:nn + { \@@_range_collect_space:nw #1 } + {#2} + } + { + \@@_range_collect:ff + { + \exp_args:No \tl_if_head_is_N_type:nTF { \use_none:n #1 } + { \@@_range_collect_N:nN } + { \@@_range_collect_group:nn } + #1 + } + { \int_eval:n { #2 - 1 } } + } + } + } +\cs_new:Npn \@@_range_collect_space:nw #1 ~ { { #1 ~ } } +\cs_new:Npn \@@_range_collect_N:nN #1#2 { { #1 #2 } } +\cs_new:Npn \@@_range_collect_group:nn #1#2 { { #1 {#2} } } +\cs_generate_variant:Nn \@@_range_collect:nn { ff } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}[EXP, aux]{\@@_range_normalize:nn} % This function converts an \meta{index} argument into an explicit % position in the token list (a result of $0$ denoting \enquote{out of @@ -3924,7 +4058,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Additions to \pkg{l3tokens}} +% \subsection{Additions to \pkg{l3token}} % % \begin{macrocode} %<@@=peek> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 52e656a701d..12ab4c124e7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 9e37e602bf8..3ac5cea4fb7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -507,19 +507,37 @@ % data structures. These are created globally, as there is a need to % avoid any strange effects if the coffin is created inside a group. % This means that the usual rule about \cs[no-index]{l_\ldots} variables has -% to be broken. +% to be broken. The \cs{__debug_suspend_log:} and +% \cs{__debug_resume_log:} functions prevent \cs{prop_clear_new:c} +% from writing useless information to the log file; however they only +% exist if debugging is enabled. % \begin{macrocode} -\cs_new_protected:Npn \coffin_new:N #1 +\__debug:TF { - \box_new:N #1 - \__debug_suspend_log: - \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } - \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } - \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } - \c_@@_corners_prop - \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } - \c_@@_poles_prop - \__debug_resume_log: + \cs_new_protected:Npn \coffin_new:N #1 + { + \box_new:N #1 + \__debug_suspend_log: + \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } + \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } + \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } + \c_@@_corners_prop + \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } + \c_@@_poles_prop + \__debug_resume_log: + } + } + { + \cs_new_protected:Npn \coffin_new:N #1 + { + \box_new:N #1 + \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } + \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } + \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } + \c_@@_corners_prop + \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } + \c_@@_poles_prop + } } \cs_generate_variant:Nn \coffin_new:N { c } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx index 6fca2d5caf0..22ed6f1d24e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index b8a7f5fdee2..e6adade9d42 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -52,13 +52,6 @@ % A few commands have had to be deprecated over the years. This module % defines deprecated and deleted commands to produce an error. % -% \begin{macro}{\deprecation_error:} -% \begin{syntax} -% \cs{deprecation_error:} -% \end{syntax} -% Defines commands that will soon become deprecated to produce errors. -% \end{macro} -% % \end{documentation} % % \begin{implementation} @@ -124,44 +117,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\deprecation_error:} -% Some commands were more recently deprecated and not yet removed; -% only make these into errors if the user requests it. This allows -% testing code even if it relies on other packages: load all other -% packages, call \cs{deprecation_error:}, and load the code that one is -% interested in testing. -% -% One of the deprecated syntaxes is within floating point expressions; -% to keep related code in the same place we define in \pkg{l3fp-parse} -% a version of \cs{__fp_parse_round:Nw} producing an error. -% \begin{macrocode} -\cs_new_protected:Npn \deprecation_error: - { - \@@_error:Nnn \tl_to_lowercase:n { } { 2017-12-31 } - \@@_error:Nnn \tl_to_uppercase:n { } { 2017-12-31 } - \@@_error:Nnn \ior_get_str:NN { \ior_str_get:NN } { 2017-12-31 } - \@@_error:Nnn \box_resize:Nnn { \box_resize_to_wd_and_ht_plus_dp:Nnn } { 2018-12-31 } - \@@_error:Nnn \box_resize:cnn { \box_resize_to_wd_and_ht_plus_dp:cnn } { 2018-12-31 } - \@@_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } - \@@_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } - \@@_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } - \@@_error:Nnn \g_file_current_name_tl { \g_file_curr_name_str } { 2018-12-31 } - \@@_error:Nnn \file_add_path:nN { \file_get_full_name:nN } { 2018-12-31 } - \@@_error:Nnn \file_path_include:n - { \seq_put_right:Nn \l_file_search_path_seq } { 2018-12-31 } - \@@_error:Nnn \file_path_remove:n - { \seq_remove_all:Nn \l_file_search_path_seq } { 2018-12-31 } - \@@_error:Nnn \file_list: { \file_log_list: } { 2018-12-31 } - \@@_error:Nnn \ior_list_streams: { \ior_show_list: } { 2018-12-31 } - \@@_error:Nnn \ior_log_streams: { \ior_log_list: } { 2018-12-31 } - \@@_error:Nnn \iow_list_streams: { \iow_show_list: } { 2018-12-31 } - \@@_error:Nnn \iow_log_streams: { \iow_log_list: } { 2018-12-31 } - \cs_set_eq:NN \__fp_parse_round:Nw \__fp_parse_round_deprecation_error:Nw - \cs_set_eq:NN \deprecation_error: \scan_stop: - } -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 08ae366efed..985518e71e4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -70,14 +70,14 @@ and all files in that bundle must be distributed together. % This isn't included in the typeset documentation because it's a bit % ugly: %<*class> -\ProvidesExplClass{l3doc}{2017/07/15}{} +\ProvidesExplClass{l3doc}{2017/07/19}{} {L3 Experimental documentation class} %</class> % \fi % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % \maketitle % \tableofcontents % @@ -594,6 +594,15 @@ and all files in that bundle must be distributed together. % \end{macrocode} % \end{variable} % +% \begin{variable}[int]{\l_@@_in_function_bool} +% True when inside a \texttt{function} or \texttt{variable} +% environment. Used by the \texttt{syntax} environment to determine +% its behaviour. +% \begin{macrocode} +\bool_new:N \l_@@_in_function_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}[int]{\l_@@_long_name_bool, \l_@@_trial_width_dim} % The boolean \cs{l_@@_long_name_bool} is \texttt{true} if the width % \cs{l_@@_trial_width_dim} of the coffin \cs{l_@@_functions_coffin} @@ -1225,6 +1234,16 @@ and all files in that bundle must be distributed together. { The~deprecated~function(s)~'#1'~should~have~been~removed~on~#2. } \msg_new:nnn { l3doc } { date-format } { The~date~'#1'~should~be~given~in~YYYY-MM-DD~format. } +\msg_new:nnn { l3doc } { syntax-nested-function } + { + The~'syntax'~environment~should~be~used~in~the~ + innermost~'function'~environment. + } +\msg_new:nnn { l3doc } { multiple-syntax } + { + The~'syntax'~environment~should~only~be~used~once~in~ + a~'function'~environment. + } % \end{macrocode} % % \subsection{Options and configuration} @@ -2146,14 +2165,18 @@ and all files in that bundle must be distributed together. % \end{macrocode} % % \begin{macro}[aux]{\@@_date_set:Nn} -% Minimal check that the date is not given in the YYYY/MM/DD format. -% Eventually we should check the input more carefully. +% Normalize the date into the format \texttt{YYYY-MM-DD}; more +% precisely month and day are allowed to be single digits. % \begin{macrocode} \cs_new_protected:Npn \@@_date_set:Nn #1#2 { - \tl_if_in:nnT {#2} { / } - { \msg_error:nnn { l3doc } { date-format } {#2} } \tl_set:Nn #1 {#2} + \regex_replace_once:nnNF + { \A(\d\d\d\d)[-/](\d\d?)[-/](\d\d?)\Z } { \1-\2-\3 } #1 + { + \msg_error:nnn { l3doc } { date-format } {#2} + \tl_set:Nn #1 { 1970-01-01 } + } } % \end{macrocode} % \end{macro} @@ -2167,10 +2190,13 @@ and all files in that bundle must be distributed together. % \begin{macrocode} \cs_new_protected:Npn \@@_deprecated_on:n #1 { - \@@_date_compare:nNnT {#1} < { \tex_year:D - \tex_month:D - \tex_day:D } + \@@_date_set:Nn \l_@@_tmpa_tl {#1} + \exp_args:No \@@_date_compare:nNnT + { \l_@@_tmpa_tl } < { \tex_year:D - \tex_month:D - \tex_day:D } { \msg_error:nnxx { l3doc } { deprecated-function } - { \tl_to_str:N \l_@@_macro_argument_tl } {#1} + { \tl_to_str:N \l_@@_macro_argument_tl } + { \l_@@_tmpa_tl } } \bool_set_true:N \l_@@_macro_internal_bool } @@ -2236,30 +2262,39 @@ and all files in that bundle must be distributed together. % \end{macro} % % \begin{macro}[aux]{\@@_function_init:} -% Allow |<...>| to be used as markup for |\meta{...}|. Clear various -% variables. +% Complain if \texttt{function} environments are nested. Clear +% various variables. % \begin{macrocode} -\group_begin: - \char_set_catcode_active:N \< - \cs_new_protected:Npn \@@_function_init: - { - \coffin_clear:N \l_@@_descr_coffin - \box_gclear:N \g_@@_syntax_box - \coffin_clear:N \l_@@_syntax_coffin - \coffin_clear:N \l_@@_functions_coffin - \bool_set_false:N \l_@@_macro_TF_bool - \bool_set_false:N \l_@@_macro_pTF_bool - \bool_set_false:N \l_@@_macro_noTF_bool - \bool_set_false:N \l_@@_macro_EXP_bool - \bool_set_false:N \l_@@_macro_rEXP_bool - \bool_set_false:N \l_@@_no_label_bool - \bool_set_false:N \l_@@_names_verb_bool - \clist_clear:N \l_@@_function_label_clist - \tl_set:Nn \l_@@_override_module_tl { \q_no_value } - \char_set_catcode_active:N \< - \cs_set_protected_nopar:Npn < ##1 > { \meta {##1} } +\cs_new_protected:Npn \@@_function_init: + { + \box_if_empty:NF \g_@@_syntax_box + { \msg_error:nn { l3doc } { syntax-nested-function } } + \coffin_clear:N \l_@@_descr_coffin + \box_gclear:N \g_@@_syntax_box + \coffin_clear:N \l_@@_syntax_coffin + \coffin_clear:N \l_@@_functions_coffin + \bool_set_false:N \l_@@_macro_TF_bool + \bool_set_false:N \l_@@_macro_pTF_bool + \bool_set_false:N \l_@@_macro_noTF_bool + \bool_set_false:N \l_@@_macro_EXP_bool + \bool_set_false:N \l_@@_macro_rEXP_bool + \bool_set_false:N \l_@@_no_label_bool + \bool_set_false:N \l_@@_names_verb_bool + \bool_set_true:N \l_@@_in_function_bool + \clist_clear:N \l_@@_function_label_clist + \tl_set:Nn \l_@@_override_module_tl { \q_no_value } + \char_set_active_eq:NN \< \@@_shorthand_meta: + \char_set_catcode_active:N \< } -\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_shorthand_meta:, \@@_shorthand_meta:w} +% Allow |<...>| to be used as markup for |\meta{...}|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_shorthand_meta: + { \mode_if_math:TF { < } { \@@_shorthand_meta:w } } +\cs_new_protected_nopar:Npn \@@_shorthand_meta:w #1 > { \meta {#1} } % \end{macrocode} % \end{macro} % @@ -2320,7 +2355,7 @@ and all files in that bundle must be distributed together. \cs_new_protected:Npn \@@_function_assemble: { \hcoffin_set:Nn \l_@@_syntax_coffin - { \box_use:N \g_@@_syntax_box } + { \box_use_clear:N \g_@@_syntax_box } \bool_if:NTF \l_@@_long_name_bool { \coffin_join:NnnNnnnn @@ -2505,6 +2540,8 @@ and all files in that bundle must be distributed together. \dim_new:N \l_@@_syntax_dim \cs_new_protected:Npn \@@_syntax:w { + \box_if_empty:NF \g_@@_syntax_box + { \msg_error:nn { l3doc } { multiple-syntax } } \dim_set:Nn \l_@@_syntax_dim { \textwidth @@ -2527,6 +2564,13 @@ and all files in that bundle must be distributed together. \end{tabular} \arrayrulecolor{black} \hbox_gset_end: + \bool_if:NF \l_@@_in_function_bool + { + \begin{quote} + \mode_leave_vertical: + \box_use_clear:N \g_@@_syntax_box + \end{quote} + } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 73912b764a1..90b78be08e2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index c6ecb231a2f..ff1503c1200 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -99,7 +99,7 @@ % rotated by the \meta{angle} (expressed in degrees). The material is % inserted with no apparent height or width, and is rotated such the % the \TeX{} reference point of the box is the center of rotation and -% remains the reference point after rotation. It is the responsibly of +% remains the reference point after rotation. It is the responsibility of % the code using this function to adjust the apparent size of the box to % be correct at the \TeX{} side. % @@ -113,7 +113,7 @@ % \end{syntax} % Inserts the content of the \meta{box} at the current insertion point % scale by the \meta{x-scale} and \meta{y-scale}. The material is -% inserted with no apparent height or width. It is the responsibly of +% inserted with no apparent height or width. It is the responsibility of % the code using this function to adjust the apparent size of the box to % be correct at the \TeX{} side. % @@ -569,8 +569,9 @@ { \tl_set:Nx \l__color_current_tl { - \exp_after:wN \@@_color_pickup_aux:w - \current@color ~ 0 ~ 0 ~ 0 \q_stop + \exp_after:wN \exp_after:wN\exp_after:wN + \@@_color_pickup_aux:w \exp_after:wN + \current@color \c_space_tl 0 ~ 0 ~ 0 \q_stop } } \cs_new:Npn \@@_color_pickup_aux:w #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \q_stop @@ -636,10 +637,10 @@ { \use:c { @@_color_convert_ #1 :w } } \cs_new:Npn \@@_color_convert_gray:w #1 ~ #2 \q_stop { #1 ~ g ~ #1 ~ G } -\cs_new:Npn \@@_color_convert_cmyk:w #1 ~ #2 ~ #3 ~ #4 \q_stop - { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } -\cs_new:Npn \@@_color_convert_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop +\cs_new:Npn \@@_color_convert_cmyk:w #1 ~ #2 ~ #3 ~ #4 ~#5 \q_stop { #1 ~ #2 ~ #3 ~ #4 ~ k ~ #1 ~ #2 ~ #3 ~ #4 ~ K } +\cs_new:Npn \@@_color_convert_rgb:w #1 ~ #2 ~ #3 ~ #4 \q_stop + { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } \cs_new_protected:Npx \@@_color_reset: { \cs_if_exist:NTF \luatex_pdfextension:D diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index c5c7a073aaa..0dda580c27d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -102,9 +102,22 @@ % \section{Methods for defining variants} % \label{sec:l3expan:variants-method} % -% ^^A Bruno: Should we put a table of variant types (N, c, n, V, v, o, f, x) for reference here? -% -% ^^A Bruno: Should \cs_generate_variant:Nn \foo:n { c } and \foo:N { o } really be ok? +% We recall the set of available argument specifiers. +% \begin{itemize} +% \item |N|~is used for single-token arguments while |c|~constructs a +% control sequence from its name and passes it to a parent function as +% an |N|-type argument. +% \item Many argument types extract or expand some tokens and provide it +% as an |n|-type argument, namely a braced multiple-token argument: +% |V|~extracts the value of a variable, |v|~extracts the value from +% the name of a variable, |n|~uses the argument as it is, |o|~expands +% once, |f|~expands fully the first token, |x|~expands fully all +% tokens at the price of being non-expandable. +% \item A few odd argument types remain: |T|~and |F|~for conditional +% processing, otherwise identical to~|n|, |p|~for the parameter text +% in definitions, |w|~for arguments with a specific syntax, and |D|~to +% denote primitives that should not be used directly. +% \end{itemize} % % \begin{function}[updated = 2015-08-06]{\cs_generate_variant:Nn} % \begin{syntax} @@ -139,6 +152,11 @@ % protected. The \meta{variant} is created globally, as is any % \cs[no-index]{exp_args:N\meta{variant}} function needed to carry out the % expansion. +% +% While \cs{cs_generate_variant:Nn} |\foo:N { o }| is currently +% allowed, one must know that it will break if the result of the +% expansion is more than one token or if |\foo:N| requires its +% argument not to be braced. % \end{function} % % \section{Introducing the variants} @@ -1476,9 +1494,9 @@ % iterate through the comma list of variant argument specifiers, which % we first convert to a string: the reason is explained later. % \begin{macrocode} +\__debug_patch:nnNNpn { \__debug_chk_cs_exist:N #1 } { } \cs_new_protected:Npn \cs_generate_variant:Nn #1#2 { - \__chk_if_exist_cs:N #1 \@@_generate_variant:N #1 \exp_after:wN \@@_split_function:NN \exp_after:wN #1 @@ -1788,7 +1806,7 @@ % \cs{cs_new_protected:Npx}. Then define the variant by % combining the |\exp_args:N #3| variant and the base function. % \begin{macrocode} -\__debug_patch:nnNw +\__debug_patch:nnNNpn { \cs_if_free:NF #4 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 8f6235bca9c..c81711dcf85 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -532,7 +532,7 @@ % % \subsection{Wrapping lines in output} % -% \begin{function}[added = 2012-06-28, updated = 2015-08-05]{\iow_wrap:nnnN} +% \begin{function}[added = 2012-06-28, updated = 2017-07-17]{\iow_wrap:nnnN} % \begin{syntax} % \cs{iow_wrap:nnnN} \Arg{text} \Arg{run-on text} \Arg{set up} \meta{function} % \end{syntax} @@ -1205,10 +1205,10 @@ { 1 } { \cs_if_exist:NTF \normalend - { \tex_count:D 38 \scan_stop: } + { \tex_count:D 38 ~ } { - \tex_count:D 16 \scan_stop: - \cs_if_exist:NT \loccount { - 1 } + \tex_count:D 16 ~ % + \cs_if_exist:NT \loccount { - 1 } } } { @@ -1548,10 +1548,10 @@ { 1 } { \cs_if_exist:NTF \normalend - { \tex_count:D 39 \scan_stop: } + { \tex_count:D 39 ~ } { - \tex_count:D 17 \scan_stop: - \cs_if_exist:NT \loccount { - 1 } + \tex_count:D 17 ~ + \cs_if_exist:NT \loccount { - 1 } } } { @@ -1918,7 +1918,6 @@ % \end{macro} % % \begin{macro}{\iow_wrap:nnnN} -% \begin{macro}[aux]{\@@_wrap_set:Nx} % The main wrapping function works as follows. First give |\\|, % \verb*|\ | and other formatting commands the correct definition for % messages and perform the given setup~|#3|. The definition of @@ -1942,16 +1941,14 @@ #3 % \end{macrocode} % Then fully-expand the input: in package mode, the expansion uses -% \LaTeXe{}'s \cs{protected} mechanism. As soon as the expansion is -% done, reset \cs{iow_indent:n} to its error definition: it only works -% in the first argument of \cs{iow_wrap:nnnN}. +% \LaTeXe{}'s \tn{protect} mechanism in the same way as \tn{typeout}. +% In generic mode this setting is useless but harmless. As soon as +% the expansion is done, reset \cs{iow_indent:n} to its error +% definition: it only works in the first argument of +% \cs{iow_wrap:nnnN}. % \begin{macrocode} -%<*initex> +%<package> \cs_set_eq:NN \protect \token_to_str:N \tl_set:Nx \l_@@_wrap_tl {#1} -%</initex> -%<*package> - \@@_wrap_set:Nx \l_@@_wrap_tl {#1} -%</package> \cs_set_eq:NN \iow_indent:n \@@_indent_error:n % \end{macrocode} % Afterwards, set the newline marker (two assignments to fully expand, @@ -1975,15 +1972,6 @@ #4 { \tl_to_str:N \l_@@_wrap_tl } } % \end{macrocode} -% As using the generic loader means that \cs{protected@edef} is -% not available, it's not placed directly in the wrap function but is set -% up as an auxiliary. In the generic loader this can then be redefined. -% \begin{macrocode} -%<*package> -\cs_new_eq:NN \@@_wrap_set:Nx \protected@edef -%</package> -% \end{macrocode} -% \end{macro} % \end{macro} % % \begin{macro}[aux]{\@@_wrap_do:, \@@_wrap_start:w} @@ -2365,56 +2353,56 @@ % % \begin{variable}[deprecated = 2018-12-31]{\g_file_current_name_tl} % For removal after 2018-12-31. +% Contrarily to most other deprecated commands this is expandable +% so we need to put code by hand in two token lists. We use +% \cs{tex_def:D} directly because \cs{g_file_current_name_tl} is made +% outer by \cs{debug_deprecation_on:}. % \begin{macrocode} \tl_new:N \g_file_current_name_tl \tl_gset:Nn \g_file_current_name_tl { \g_file_curr_name_str } +\__debug:TF + { + \tl_gput_right:Nn \g__debug_deprecation_on_tl + { + \__deprecation_error:Nnn \g_file_current_name_tl + { \g_file_curr_name_str } { 2018-12-31 } + } + \tl_gput_right:Nn \g__debug_deprecation_off_tl + { \tex_def:D \g_file_current_name_tl { \g_file_curr_name_str } } + } + { } % \end{macrocode} % \end{variable} % % \begin{macro}[deprecated = 2018-12-31]{\file_path_include:n} % \begin{macro}[deprecated = 2018-12-31]{\file_path_remove:n} -% \begin{macro}[deprecated = 2018-12-31, aux]{\__file_path_include:n} % Wrapper functions to manage the search path. % \begin{macrocode} +\__debug_deprecation:nnNNpn { 2018-12-31 } + { \seq_put_right:Nn \l_file_search_path_seq } \cs_new_protected:Npn \file_path_include:n #1 { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \file_path_include:n } - { - \token_to_str:N \seq_put_right:Nn \c_space_tl - \token_to_str:N \l_file_search_path_seq - } \__file_name_sanitize:nN {#1} \l__file_full_name_str \seq_if_in:NVF \l_file_search_path_seq \l__file_full_name_str { \seq_put_right:NV \l_file_search_path_seq \l__file_full_name_str } } +\__debug_deprecation:nnNNpn { 2018-12-31 } + { \seq_remove_all:Nn \l_file_search_path_seq } \cs_new_protected:Npn \file_path_remove:n #1 { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \file_path_remove:n } - { - \token_to_str:N \seq_remove_all:Nn \c_space_tl - \token_to_str:N \l_file_search_path_seq - } \__file_name_sanitize:nN {#1} \l__file_full_name_str \seq_remove_all:NV \l_file_search_path_seq \l__file_full_name_str } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}[deprecated = 2018-12-31]{\file_add_path:nN} % For removal after 2018-12-31. % \begin{macrocode} +\__debug_deprecation:nnNNpn { 2018-12-31 } { \file_get_full_name:nN } \cs_new_protected:Npn \file_add_path:nN #1#2 { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \file_add_path:nN } - { \token_to_str:N \file_get_full_name:nN } \file_get_full_name:nN {#1} #2 \str_if_empty:NT #2 { \tl_set:Nn #2 { \q_no_value } } @@ -2425,30 +2413,16 @@ % \begin{macro}[added = 2012-06-24, updated = 2012-07-31, deprecated=2017-12-31]{\ior_get_str:NN} % For removal after 2017-12-31. % \begin{macrocode} -\cs_new_protected:Npn \ior_get_str:NN - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2017-12-31 } - { \token_to_str:N \ior_get_str:NN } - { \token_to_str:N \ior_str_get:NN } - \cs_gset_eq:NN \ior_get_str:NN \ior_str_get:NN - \ior_str_get:NN - } +\__debug_deprecation:nnNNpn { 2017-12-31 } { \ior_str_get:NN } +\cs_new_protected:Npn \ior_get_str:NN { \ior_str_get:NN } % \end{macrocode} % \end{macro} % % \begin{macro}[deprecated = 2018-12-31]{\file_list:} % Renamed to \cs{file_log_list:}. For removal after 2018-12-31. % \begin{macrocode} -\cs_new_protected:Npn \file_list: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \file_list: } - { \token_to_str:N \file_log_list: } - \cs_gset_eq:NN \file_list: \file_log_list: - \file_log_list: - } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \file_log_list: } +\cs_new_protected:Npn \file_list: { \file_log_list: } % \end{macrocode} % \end{macro} % @@ -2456,42 +2430,14 @@ % {\ior_list_streams:, \ior_log_streams:, \iow_list_streams:, \iow_log_streams:} % These got a more consistent naming. % \begin{macrocode} -\cs_new_protected:Npn \ior_list_streams: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \ior_list_streams: } - { \token_to_str:N \ior_show_list: } - \cs_gset_eq:NN \ior_list_streams: \ior_show_list: - \ior_show_list: - } -\cs_new_protected:Npn \ior_log_streams: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \ior_log_streams: } - { \token_to_str:N \ior_log_list: } - \cs_gset_eq:NN \ior_log_streams: \ior_log_list: - \ior_log_list: - } -\cs_new_protected:Npn \iow_list_streams: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \iow_list_streams: } - { \token_to_str:N \iow_show_list: } - \cs_gset_eq:NN \iow_list_streams: \iow_show_list: - \iow_show_list: - } -\cs_new_protected:Npn \iow_log_streams: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \iow_log_streams: } - { \token_to_str:N \iow_log_list: } - \cs_gset_eq:NN \iow_log_streams: \iow_log_list: - \iow_log_list: - } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \ior_show_list: } +\cs_new_protected:Npn \ior_list_streams: { \ior_show_list: } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \ior_log_list: } +\cs_new_protected:Npn \ior_log_streams: { \ior_log_list: } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \iow_show_list: } +\cs_new_protected:Npn \iow_list_streams: { \iow_show_list: } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \iow_log_list: } +\cs_new_protected:Npn \iow_log_streams: { \iow_log_list: } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 1a09fdf2ec4..6cfa0e15a21 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index 2923b1cbe62..e53a8a9093f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -196,8 +196,8 @@ % When the option \texttt{check-declarations} is used, check for the % function defined by \cs{flag_new:n}. % \begin{macrocode} -\__debug_patch:nnNw - { \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } } { } +\__debug_patch:nnNNpn + { \exp_args:Nc \__debug_chk_var_exist:N { flag~#1 } } { } \cs_new_protected:Npn \flag_clear:n #1 { \@@_clear:wn 0 ; {#1} } \cs_new_protected:Npn \@@_clear:wn #1 ; #2 { @@ -240,7 +240,7 @@ % \subsection{Expandable flag commands} % % \begin{macro}[EXP,aux]{\@@_chk_exist:n} -% Analogue of \cs{__chk_if_exist_var:N} for flags, and with an +% Analogue of \cs{__debug_chk_var_exist:N} for flags, and with an % expandable error. We need to add checks by hand because flags are % not implemented in terms of other variables. Not all functions need % to be patched since some are defined in terms of others. @@ -275,7 +275,7 @@ % \begin{macro}[EXP, pTF]{\flag_if_raised:n} % Test if the flag has a non-zero height, by checking the |0| control sequence. % \begin{macrocode} -\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { } +\__debug_patch_conditional:nNNpnn { \@@_chk_exist:n {#1} } \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { \if_cs_exist:w flag~#1~0 \cs_end: @@ -292,7 +292,7 @@ % Extract the value of the flag by going through all of the % control sequences starting from |0|. % \begin{macrocode} -\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { } +\__debug_patch:nnNNpn { \@@_chk_exist:n {#1} } { } \cs_new:Npn \flag_height:n #1 { \@@_height_loop:wn 0; {#1} } \cs_new:Npn \@@_height_loop:wn #1 ; #2 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index de23e977006..2721cac127b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index eadf3479acc..8bfe95207c5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index ae6a2ad07b0..10b3b57f62b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index bde140cea7e..5ba88f3c664 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -390,6 +390,7 @@ % performed by \cs{@@_mul_npos_o:Nww}, and cancelled by % \cs{prg_do_nothing:} here. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_to_fp:n #1 { \exp_after:wN \@@_from_dim_test:ww diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index b0731d99868..edbfdcc57d6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -191,15 +191,13 @@ % \end{macro} % % \begin{macro}[aux, EXP]{\@@_ln_significand:NNNNnnnN} -% \begin{quote} -% \cs{@@_ln_significand:NNNNnnnN} \meta{X_1} \Arg{X_2} \Arg{X_3} -% \Arg{X_4} \meta{continuation} -% \end{quote} +% \begin{syntax} +% \cs{@@_ln_significand:NNNNnnnN} \meta{X_1} \Arg{X_2} \Arg{X_3} \Arg{X_4} \meta{continuation} +% \end{syntax} % This function expands to -% \begin{quote} -% \meta{continuation} \Arg{Y_1} \Arg{Y_2} \Arg{Y_3} \Arg{Y_4} -% \Arg{Y_5} \Arg{Y_6} |;| -% \end{quote} +% \begin{syntax} +% \meta{continuation} \Arg{Y_1} \Arg{Y_2} \Arg{Y_3} \Arg{Y_4} \Arg{Y_5} \Arg{Y_6} |;| +% \end{syntax} % where $Y = - \ln(X)$ as an extended fixed point. % \begin{macrocode} \cs_new:Npn \@@_ln_significand:NNNNnnnN #1#2#3#4 @@ -316,10 +314,9 @@ % a faithful rounding). % ^^A todo: doc % -% \begin{quote} -% \cs{@@_ln_x_iv:wnnnnnnnn} -% \meta{1 or 2} \meta{8d} |;| \Arg{4d} \Arg{4d} \meta{fixed-tl} -% \end{quote} +% \begin{syntax} +% \cs{@@_ln_x_iv:wnnnnnnnn} \meta{1 or 2} \meta{8d} |;| \Arg{4d} \Arg{4d} \meta{fixed-tl} +% \end{syntax} % The number is $x$. Compute $y$ by adding 1 to the five first digits. % \begin{macrocode} \cs_new:Npn \@@_ln_x_iv:wnnnnnnnn #1; #2#3#4#5 #6#7#8#9 @@ -357,7 +354,7 @@ % We now have essentially % ^^A todo: determine error on $Q_{6}$ (probably $6.7$), % ^^A todo: conclude the final result is off by $<10^{-23}$ -% \begin{quote} +% \begin{syntax} % \cs{@@_ln_div_after:Nw} \meta{fixed tl} % \cs{@@_div_significand_pack:NNN} $10^6 + Q_{1}$ % \cs{@@_div_significand_pack:NNN} $10^6 + Q_{2}$ @@ -366,16 +363,17 @@ % \cs{@@_div_significand_pack:NNN} $10^6 + Q_{5}$ % \cs{@@_div_significand_pack:NNN} $10^6 + Q_{6}$ |;| % \meta{exponent} |;| \meta{continuation} -% \end{quote} +% \end{syntax} % where \meta{fixed tl} holds the logarithm of a number % in $[1,10]$, and \meta{exponent} is % the exponent. Also, the expansion is done backwards. Then % \cs{@@_div_significand_pack:NNN} puts things in the % correct order to add the $Q_{i}$ together and put semicolons % between each piece. Once those have been expanded, we get -% \begin{quote} -% \cs{@@_ln_div_after:Nw} \meta{fixed-tl} \meta{1d} |;| \meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{exponent} |;| -% \end{quote} +% \begin{syntax} +% \cs{@@_ln_div_after:Nw} \meta{fixed-tl} \meta{1d} |;| \meta{4d} |;| \meta{4d} |;| +% ~~\meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{4d} |;| \meta{exponent} |;| +% \end{syntax} % ^^A todo: redoc. % Just as with division, we know that the first two digits % are |1| and |0| because of bounds on the final result of @@ -407,9 +405,11 @@ } % \end{macrocode} % -% \begin{quote} -% \cs{@@_ln_t_large:NNw} \meta{sign}\meta{fixed tl} \meta{t_1}|;| \meta{t_2} |;| \meta{t_3}|;| \meta{t_4}|;| \meta{t_5} |;| \meta{t_6}|;| \meta{exponent} |;| \meta{continuation} -% \end{quote} +% \begin{syntax} +% \cs{@@_ln_t_large:NNw} \meta{sign} \meta{fixed tl} +% ~~\meta{t_1}|;| \meta{t_2} |;| \meta{t_3}|;| \meta{t_4}|;| \meta{t_5} |;| \meta{t_6}|;| +% ~~\meta{exponent} |;| \meta{continuation} +% \end{syntax} % Compute the square $|t|^2$, and keep $|t|$ at the end with its % sign. We know that $|t|<0.1765$, so every piece has at most $4$ % digits. However, since we were not careful in \cs{@@_ln_t_small:w}, @@ -455,13 +455,13 @@ % % \begin{macro}{\@@_ln_Taylor:wwNw} % Denoting $T=t^2$, we get -% \begin{quote} +% \begin{syntax} % \cs{@@_ln_Taylor:wwNw} -% \Arg{T_1} \Arg{T_2} \Arg{T_3} \Arg{T_4} \Arg{T_5} \Arg{T_6} |;| |;| -% \Arg{(2t)_1} \Arg{(2t)_2} \Arg{(2t)_3} \Arg{(2t)_4} \Arg{(2t)_5} \Arg{(2t)_6} |;| -% |{| \cs{@@_ln_c:NwNw} \meta{sign} |}| -% \meta{fixed tl} \meta{exponent} |;| \meta{continuation} -% \end{quote} +% ~~\Arg{T_1} \Arg{T_2} \Arg{T_3} \Arg{T_4} \Arg{T_5} \Arg{T_6} |;| |;| +% ~~\Arg{(2t)_1} \Arg{(2t)_2} \Arg{(2t)_3} \Arg{(2t)_4} \Arg{(2t)_5} \Arg{(2t)_6} |;| +% ~~|{| \cs{@@_ln_c:NwNw} \meta{sign} |}| +% ~~\meta{fixed tl} \meta{exponent} |;| \meta{continuation} +% \end{syntax} % And we want to compute % \[ % \ln\left(\frac{1+t}{1-t}\right) @@ -508,11 +508,11 @@ % \end{macro} % % \begin{macro}{\@@_ln_c:NwNw} -% \begin{quote} +% \begin{syntax} % \cs{@@_ln_c:NwNw} \meta{sign} -% \Arg{r_1} \Arg{r_2} \Arg{r_3} \Arg{r_4} \Arg{r_5} \Arg{r_6} |;| -% \meta{fixed tl} \meta{exponent} |;| \meta{continuation} -% \end{quote} +% ~~\Arg{r_1} \Arg{r_2} \Arg{r_3} \Arg{r_4} \Arg{r_5} \Arg{r_6} |;| +% ~~\meta{fixed tl} \meta{exponent} |;| \meta{continuation} +% \end{syntax} % We are now reduced to finding $\ln(c)$ and $\meta{exponent}\ln(10)$ % in a table, and adding it to the mixture. The first step is to % get $\ln(c) - \ln(x) = - \ln(a)$, then we get $|b|\ln(10)$ and add @@ -535,11 +535,11 @@ % \end{macro} % % \begin{macro}{\@@_ln_exponent:wn} -% \begin{quote}\raggedright +% \begin{syntax} % \cs{@@_ln_exponent:wn} -% \Arg{s_1} \Arg{s_2} \Arg{s_3} \Arg{s_4} \Arg{s_5} \Arg{s_6} |;| -% \Arg{exponent} -% \end{quote} +% ~~\Arg{s_1} \Arg{s_2} \Arg{s_3} \Arg{s_4} \Arg{s_5} \Arg{s_6} |;| +% ~~\Arg{exponent} +% \end{syntax} % Compute \meta{exponent} times $\ln(10)$. Apart from the cases where % \meta{exponent} is $0$ or $1$, the result is necessarily at % least $\ln(10) \simeq 2.3$ in magnitude. We can thus drop the least diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 1144d72e0ac..5553fc4c5cb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index af6f55373a7..26f18c3c1e2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index f83cd642d62..cd0bf745c9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -181,11 +181,10 @@ % be values of registers. Assume that one number, say, $12345$, has % already been found, and that we want to parse the next number. The % current status of the code may look as follows. -% \begin{quote}\ttfamily -% \cs{exp_after:wN} |\add:ww| -% \cs{__int_value:w} 12345 \cs{exp_after:wN} ; \newline +% \begin{syntax} +% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 \cs{exp_after:wN} ; % \cs{exp:w} |\operand:w| \meta{stuff} -% \end{quote} +% \end{syntax} % One step of expansion expands \cs{exp_after:wN}, which triggers the % primitive \cs{__int_value:w}, which reads the five digits we have % already found, |12345|. This integer is unfinished, causing the @@ -194,19 +193,19 @@ % what follows and make a number out of it, then leave \cs{exp_end:}, the % number, and a semicolon in the input stream. Once |\operand:w| is % done expanding, we obtain essentially -% \begin{quote}\ttfamily -% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; \newline +% \begin{syntax} +% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; % \cs{exp:w} \cs{exp_end:} 333444 ; -% \end{quote} +% \end{syntax} % where in fact \cs{exp_after:wN} has already been expanded, % \cs{__int_value:w} has already seen |12345|, and % \cs{exp:w} is still looking for a number. It finds % \cs{exp_end:}, hence expands to nothing. Now, \cs{__int_value:w} sees % the \texttt{;}, which cannot be part of a number. The expansion % stops, and we are left with -% \begin{quote}\ttfamily +% \begin{syntax} % |\add:ww| 12345 ; 333444 ; -% \end{quote} +% \end{syntax} % which can safely perform the addition by grabbing two arguments % delimited by~|;|. % @@ -290,10 +289,10 @@ % of this function is that it reads one \meta{number}, performing no % computation, and finds the following binary \meta{operator}. Then it % expands to -% \begin{quote} -% \meta{number} \newline -% ~~|\__fp_parse_infix_|\meta{operator}|:N| \meta{precedence} -% \end{quote} +% \begin{syntax} +% \meta{number} +% | \__fp_parse_infix_|\meta{operator}|:N| \meta{precedence} +% \end{syntax} % expanding the \texttt{infix} auxiliary before leaving the above in the % input stream. % @@ -310,17 +309,17 @@ % auxiliary for the following \meta{operator}, to know whether to % perform the computation of the \meta{operator}. If it should not be % performed, the \texttt{infix} auxiliary expands to -% \begin{quote} +% \begin{syntax} % |@| \cs{use_none:n} |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % and otherwise it calls \cs{@@_parse_operand:Nw} with the precedence of % the \meta{operator} to find its second operand \meta{number_2} and the % next \meta{operator_2}, and expands to -% \begin{quote} -% |@| \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% |@| \cs{@@_parse_apply_binary:NwNwN} +% ~~~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % The \texttt{infix} function is responsible for comparing precedences, % but cannot directly call the computation functions, because the first % operand \meta{number} is before the \texttt{infix} function in the @@ -329,57 +328,57 @@ % % A definition of \cs{@@_parse_operand:Nw} \meta{precedence} with some % of the expansion control removed is -% \begin{quote} -% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline -% \cs{exp_after:wN} \meta{precedence} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline +% \begin{syntax} +% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} +% \cs{exp_after:wN} \meta{precedence} +% \cs{exp:w} \cs{exp_end_continue_f:w} % ~~\cs{@@_parse_one:Nw} \meta{precedence} -% \end{quote} +% \end{syntax} % This expands \cs{@@_parse_one:Nw} \meta{precedence} completely, which % finds a number, wraps the next \meta{operator} into an \texttt{infix} % function, feeds this function the \meta{precedence}, and expands it, % yielding either -% \begin{quote} -% \cs{@@_parse_continue:NwN} \meta{precedence} \newline -% \meta{number} |@| \newline +% \begin{syntax} +% \cs{@@_parse_continue:NwN} \meta{precedence} +% \meta{number} |@| % \cs{use_none:n} |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % or -% \begin{quote} -% \cs{@@_parse_continue:NwN} \meta{precedence} \newline -% \meta{number} |@| \newline -% \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% \cs{@@_parse_continue:NwN} \meta{precedence} +% \meta{number} |@| +% \cs{@@_parse_apply_binary:NwNwN} +% ~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % The definition of \cs{@@_parse_continue:NwN} is then very simple: -% \begin{verbatim} -% \cs_new:Npn \__fp_parse_continue:NwN #1#2@#3 { #3 #1 #2 @ } -% \end{verbatim} +% \begin{syntax} +% |\cs_new:Npn \__fp_parse_continue:NwN #1#2@#3 { #3 #1 #2 @ }| +% \end{syntax} % In the first case, |#3|~is \cs{use_none:n}, yielding -% \begin{quote} -% \cs{use_none:n} \meta{precedence} \meta{number} |@| \newline +% \begin{syntax} +% \cs{use_none:n} \meta{precedence} \meta{number} |@| % |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % then \meta{number} |@| |\__fp_parse_infix_|\meta{operator}|:N|. In % the second case, |#3|~is \cs{@@_parse_apply_binary:NwNwN}, whose role % is to compute \meta{number} \meta{operator} \meta{number_2} and to % prepare for the next comparison of precedences: first we get -% \begin{quote} -% \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~\meta{precedence} \meta{number} |@| \newline -% ~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% \cs{@@_parse_apply_binary:NwNwN} +% ~~\meta{precedence} \meta{number} |@| +% ~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % then -% \begin{quote} -% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline -% \cs{exp_after:wN} \meta{precedence} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline -% |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline +% \begin{syntax} +% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} +% \cs{exp_after:wN} \meta{precedence} +% \cs{exp:w} \cs{exp_end_continue_f:w} +% |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} +% \cs{exp:w} \cs{exp_end_continue_f:w} % |\__fp_parse_infix_|\meta{operator_2}|:N| \meta{precedence} -% \end{quote} +% \end{syntax} % where |\__fp_|\meta{operator}|_o:ww| computes \meta{number} % \meta{operator} \meta{number_2} and expands after the result, thus % triggers the comparison of the precedence of the \meta{operator_2} and @@ -679,9 +678,9 @@ % functions read tokens one by one, and output digits into the input % stream, until meeting a non-digit, or up to a number of digits equal % to their index. The full expansion is -% \begin{quote} +% \begin{syntax} % \meta{digits} |;| \meta{filling 0} |;| \meta{length} -% \end{quote} +% \end{syntax} % where \meta{filling 0} is a string of zeros such that \meta{digits} % \meta{filling 0} has the length given by the index of the function, % and \meta{length} is the number of zeros in the \meta{filling 0} @@ -1574,11 +1573,11 @@ % % Expansion is a little bit tricky here, in part because we accept input % where multiplication is implicit. -% \begin{verbatim} -% \@@_parse:n { 3.2 erf(0.1) } -% \@@_parse:n { 3.2 e\l_my_int } -% \@@_parse:n { 3.2 \c_pi_fp } -% \end{verbatim} +% \begin{syntax} +% \cs{@@_parse:n} |{ 3.2 erf(0.1) }| +% \cs{@@_parse:n} |{ 3.2 e\l_my_int }| +% \cs{@@_parse:n} |{ 3.2 \c_pi_fp }| +% \end{syntax} % The first case indicates that just looking one character ahead for an % \enquote{\texttt{e}} is not enough, since we would mistake the % function \texttt{erf} for an exponent of \enquote{\texttt{rf}}. An diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index ec0829787e3..28e006e3a19 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index ccc13714253..87a59147606 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -86,6 +86,7 @@ % \begin{macro}[aux, EXP] % { % \@@_parse_word_round:N, \@@_parse_round:Nw, +% \@@_parse_round_no_error:Nw, % \@@_parse_round_deprecation_error:Nw % } % \begin{macro}[aux, deprecated = 2017-12-31]{round+, round0, round-} @@ -95,9 +96,8 @@ % set up. When \pkg{l3doc} complains, remove the syntax by % removing everything until the last \cs{fi:} in % \cs{@@_parse_word_round:N} (and getting rid of the unused -% definitions of \cs{@@_parse_round:Nw} and -% \cs{@@_parse_round_deprecation_error:Nw} here and in -% \pkg{l3deprecation}, perhaps also of the |fp-deprecated| error). +% definitions of \cs{@@_parse_round:Nw} and so on, as well as the +% |fp-deprecated| error in \pkg{l3fp-parse}). % \begin{macrocode} \cs_new:Npn \@@_parse_word_round:N #1#2 { @@ -116,17 +116,35 @@ \@@_round_o:Nw \@@_round_to_nearest:NNN #1 #2 } -\cs_new:Npn \@@_parse_round:Nw - #1 #2 \@@_round_to_nearest:NNN #3#4 { #2 #1 #3 } -\cs_new:Npn \@@_parse_round_deprecation_error:Nw - #1 #2 \@@_round_to_nearest:NNN #3#4 +\__debug:TF { - \@@_error:nnfn { fp-deprecated } { round#4() } + \tl_gput_right:Nn \g__debug_deprecation_on_tl { - \str_case:nn {#2} - { { + } { ceil } { 0 } { trunc } { - } { floor } } - } { } - #2 #1 #3 + \cs_set_eq:NN \@@_parse_round:Nw + \@@_parse_round_deprecation_error:Nw + } + \tl_gput_right:Nn \g__debug_deprecation_off_tl + { + \cs_set_eq:NN \@@_parse_round:Nw + \@@_parse_round_no_error:Nw + } + \cs_new:Npn \@@_parse_round_deprecation_error:Nw + #1 #2 \@@_round_to_nearest:NNN #3#4 + { + \@@_error:nnfn { fp-deprecated } { round#4() } + { + \str_case:nn {#2} + { { + } { ceil } { 0 } { trunc } { - } { floor } } + } { } + #2 #1 #3 + } + \cs_new:Npn \@@_parse_round_no_error:Nw + #1 #2 \@@_round_to_nearest:NNN #3#4 { #2 #1 #3 } + \cs_new_eq:NN \@@_parse_round:Nw \@@_parse_round_no_error:Nw + } + { + \cs_new:Npn \@@_parse_round:Nw + #1 #2 \@@_round_to_nearest:NNN #3#4 { #2 #1 #3 } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index df5477dc2cd..15834540953 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 4ff2e34c2bd..0af1408ec84 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 2293af64152..e4e0e69724d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index fba1893a993..26155d7526d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1008,7 +1008,9 @@ % \begin{macro}{\int_eval:n} % Wrapper for \cs{@@_eval:w}: can be used in an integer expression % or directly in the input stream. +% When debugging, use parentheses to catch early termination. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \int_eval:n #1 { \@@_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} @@ -1026,6 +1028,7 @@ % evaluation. The absolute value is obtained by removing a leading % sign if any. All three functions expand in two steps. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \int_abs:n #1 { \@@_value:w \exp_after:wN \@@_abs:N @@ -1034,6 +1037,7 @@ } \cs_new:Npn \@@_abs:N #1 { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_set:Npn \int_max:nn #1#2 { \@@_value:w \exp_after:wN \@@_maxmin:wwN @@ -1042,6 +1046,7 @@ > \exp_stop_f: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_set:Npn \int_min:nn #1#2 { \@@_value:w \exp_after:wN \@@_maxmin:wwN @@ -1086,6 +1091,7 @@ % truncating behaviour that we want. The details are thanks to Heiko % Oberdiek: getting things right in all cases is not so easy. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \int_div_truncate:nn #1#2 { \@@_value:w \@@_eval:w @@ -1115,6 +1121,7 @@ % \end{macrocode} % Finally there's the modulus operation. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \int_mod:nn #1#2 { \@@_value:w \@@_eval:w \exp_after:wN \@@_mod:ww @@ -1177,7 +1184,7 @@ { \__chk_if_free_cs:N #1 \tex_global:D \@@_constdef:Nw #1 = - \@@_eval:w #2 \@@_eval_end: + \@@_eval:w (#2) \@@_eval_end: } } } @@ -1267,8 +1274,10 @@ % \UnitTested % Adding and subtracting to and from a counter \ldots % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_add:Nn #1#2 { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_sub:Nn #1#2 { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gadd:Nn @@ -1322,6 +1331,7 @@ % if they are not defined. Thus there is no need for the checking % code seen with token list variables. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_set:Nn #1#2 { #1 ~ \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gset:Nn { \tex_global:D \int_set:Nn } @@ -1526,6 +1536,7 @@ % \UnitTested % More efficient but less natural in typing. % \begin{macrocode} +\__debug_patch_conditional_args:nNNpnn { { (#1) \@@_eval_end: } {#2} { (#3) } } \prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF } { \if_int_compare:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end: @@ -1584,6 +1595,7 @@ % \UnitTested % A predicate function. % \begin{macrocode} +\__debug_patch_conditional_args:nNNpnn { { (#1) } } \prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF} { \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1592,6 +1604,7 @@ \prg_return_false: \fi: } +\__debug_patch_conditional_args:nNNpnn { { (#1) } } \prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF} { \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1707,6 +1720,7 @@ % step size of zero before checking the sign, but we optimize for the % most frequent case (positive step). % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } { (#3) } } \cs_new:Npn \int_step_function:nnnN #1#2#3 { \exp_after:wN \@@_step:wwwN @@ -2466,13 +2480,24 @@ % \begin{variable}[deprecated = 2018-12-31]{\c_minus_one} % The actual allocation mechanism is in \pkg{l3alloc}; it requires % \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. +% We also store in two global token lists some code for +% \cs{debug_deprecation_on:} and \cs{debug_deprecation_off:}. For the +% latter, we need to locally set \cs{c_minus_one} back to the constant +% hence use a private name. We use \cs{tex_let:D} directly because +% \cs{c_minus_one} (as all deprecated commands) is made outer by +% \cs{debug_deprecation_on:}. % \begin{macrocode} -%<*package> -\cs_new_eq:NN \c_minus_one \m@ne -%</package> -%<*initex> -\int_const:Nn \c_minus_one { -1 } -%</initex> +%<package>\cs_gset_eq:NN \c__deprecation_minus_one \m@ne +%<initex>\int_const:Nn \c__deprecation_minus_one { -1 } +\cs_new_eq:NN \c_minus_one \c__deprecation_minus_one +\__debug:TF + { + \tl_gput_right:Nn \g__debug_deprecation_on_tl + { \__deprecation_error:Nnn \c_minus_one { -1 } { 2018-12-31 } } + \tl_gput_right:Nn \g__debug_deprecation_off_tl + { \tex_let:D \c_minus_one \c__deprecation_minus_one } + } + { } % \end{macrocode} % \end{variable} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index c8da27656d9..19c924b2018 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 6f4847fd0d2..f1a5202abad 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1514,7 +1514,7 @@ % Setting the code for a key first logs if appropriate that we are % defining a new key, then saves the code. % \begin{macrocode} -\__debug_patch:nnNw +\__debug_patch:nnNNpn { \cs_if_exist:cF { \c_@@_code_root_tl #1 } { \__debug_log:x { Defining~key~#1~\msg_line_context: } } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 80ec22a2e2a..c0b66d51732 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index d71000c896d..582db1433c5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -833,7 +833,7 @@ % This auxiliary is similar to \cs{__chk_if_free_cs:N}, and is used when % defining messages with \cs{msg_new:nnnn}. % \begin{macrocode} -\__debug_patch:nnNw { } +\__debug_patch:nnNNpn { } { \__debug_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { @@ -1952,9 +1952,14 @@ %<*package> \bool_if:NTF \l@expl@enable@debug@bool { - \@@_kernel_new:nnn { kernel } { debug-unpatchable } - { Only~some~definitions~can~be~patched;~'#3'~cannot. } - \@@_kernel_new:nnnn { check } { non-declared-variable } + \@@_kernel_new:nnnn { kernel } { debug } + { The~debugging~option~'#1'~does~not~exist~\msg_line_context:. } + { + The~functions~'\iow_char:N\\debug_on:n'~and~ + '\iow_char:N\\debug_off:n'~only~accept~the~arguments~ + 'check-declarations',~'deprecation',~'log-functions',~not~'#1'. + } + \@@_kernel_new:nnnn { kernel } { non-declared-variable } { The~variable~#1~has~not~been~declared~\msg_line_context:. } { Checking~is~active,~and~you~have~tried~do~so~something~like: \\ diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 3ade94184a8..c540774860c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index 2340345b14a..4fe4cb652c9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -110,6 +110,7 @@ %<l3str>{l3str} %<l3tl>{l3tl} %<l3tl-analysis>{l3tl-analysis} +%<l3tl-build>{l3tl-build} %<l3token>{l3token} % \end{macrocode} % @@ -129,20 +130,20 @@ \typeout{** } \typeout{** Its functionality is now only provided as part of the expl3 package.} \typeout{** } -%<!l3regex|l3sort|l3tl-analysis>\typeout{** After showing you an error message you can hit <return> we will continue} -%<!l3regex|l3sort|l3tl-analysis>\typeout{** for now by loading expl3 for you. However, the old packages will be} -%<!l3regex|l3sort|l3tl-analysis>\typeout{** removed entirely at the end of 2017.} -%<l3regex|l3sort|l3tl-analysis>\typeout{** The old packages will be removed entirely at the end of 2018.} +%<!l3regex&!l3sort&!l3tl-analysis&!l3tl-build>\typeout{** After showing you an error message you can hit <return> we will continue} +%<!l3regex&!l3sort&!l3tl-analysis&!l3tl-build>\typeout{** for now by loading expl3 for you. However, the old packages will be} +%<!l3regex&!l3sort&!l3tl-analysis&!l3tl-build>\typeout{** removed entirely at the end of 2017.} +%<l3regex|l3sort|l3tl-analysis|l3tl-build>\typeout{** The old packages will be removed entirely at the end of 2018.} \typeout{** } \typeout{** Therefore, please replace '\string\usepackage{\old@liii@module@name}'} \typeout{** with '\string\usepackage{expl3}' in your documents as soon as possible.} \typeout{** } \typeout{*******************************************************************} -%<!l3regex|l3sort|l3tl-analysis>\PackageError -%<l3regex|l3sort|l3tl-analysis>\PackageWarning +%<!l3regex&!l3sort&!l3tl-analysis&!l3tl-build>\PackageError +%<l3regex|l3sort|l3tl-analysis|l3tl-build>\PackageWarning \old@liii@module@name{This package is obsolete --- use 'expl3' instead} -%<!l3regex|l3sort|l3tl-analysis> \@ehc +%<!l3regex&!l3sort&!l3tl-analysis&!l3tl-build> \@ehc % \end{macrocode} % Finally load \texttt{expl3} so that the user can continue for now. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index b54376773d6..67af5299b7c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -270,7 +270,7 @@ % Sets \meta{boolean_1} to the current value of \meta{boolean_2}. % \end{function} % -% \begin{function}[updated = 2012-07-08] +% \begin{function}[updated = 2017-07-15] % {\bool_set:Nn, \bool_set:cn, \bool_gset:Nn, \bool_gset:cn} % \begin{syntax} % \cs{bool_set:Nn} \meta{boolean} \Arg{boolexpr} @@ -296,7 +296,7 @@ % Displays the logical truth of the \meta{boolean} on the terminal. % \end{function} % -% \begin{function}[added = 2012-02-09, updated = 2015-08-07]{\bool_show:n} +% \begin{function}[added = 2012-02-09, updated = 2017-07-15]{\bool_show:n} % \begin{syntax} % \cs{bool_show:n} \Arg{boolean expression} % \end{syntax} @@ -311,7 +311,7 @@ % Writes the logical truth of the \meta{boolean} in the log file. % \end{function} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\bool_log:n} +% \begin{function}[added = 2014-08-22, updated = 2017-07-15]{\bool_log:n} % \begin{syntax} % \cs{bool_log:n} \Arg{boolean expression} % \end{syntax} @@ -354,8 +354,7 @@ % \meta{true} or \meta{false}. It supports the logical operations And, % Or and Not as the well-known infix operators |&&| and \verb"||" and prefix~|!| % with their usual precedences (namely, |&&| binds more tightly than -% \verb"||"). In -% addition to this, parentheses can be used to isolate +% \verb"||"). In addition to this, parentheses can be used to isolate % sub-expressions. For example, % \begin{verbatim} % \int_compare_p:n { 1 = 1 } && @@ -368,18 +367,22 @@ % \end{verbatim} % is a valid boolean expression. % -% At present, the infix operators |&&| and \verb"||" perform lazy -% evaluation, but this will change in the near future. % Contrarily to some other programming languages, the operators |&&| and -% \verb"||" will evaluate both operands in all cases, even when the first +% \verb"||" evaluate both operands in all cases, even when the first % operand is enough to determine the result. This \enquote{eager} % evaluation should be contrasted with the \enquote{lazy} evaluation of % \cs[no-index]{bool_lazy_\ldots{}} functions. % % \begin{texnote} % The eager evaluation of boolean expressions is unfortunately -% necessary. Indeed, a lazy parser can get confused if |&&| and -% \verb"||" appear as (unbraced) arguments of some predicates. +% necessary in \TeX{}. Indeed, a lazy parser can get confused if |&&| +% or \verb"||" or parentheses appear as (unbraced) arguments of some +% predicates. For instance, the innocuous-looking expression below +% would break (in a lazy parser) if |#1| were a closing parenthesis +% and \cs[no-index]{l_tmpa_bool} were \texttt{true}. +% \begin{verbatim} +% ( \l_tmpa_bool || \token_if_eq_meaning_p:NN X #1 ) +% \end{verbatim} % \end{texnote} % % Minimal (lazy) evaluation can be obtained using the conditionals @@ -405,7 +408,7 @@ % line is expanded because its logical value is needed to determine the % result of \cs{bool_lazy_and_p:nn}. % -% \begin{function}[EXP, pTF, updated = 2012-07-08]{\bool_if:n} +% \begin{function}[EXP, pTF, updated = 2017-07-15]{\bool_if:n} % \begin{syntax} % \cs{bool_if_p:n} \Arg{boolean expression} % \cs{bool_if:nTF} \Arg{boolean expression} \Arg{true code} \Arg{false code} @@ -418,8 +421,8 @@ % |!| (\enquote{Not}) and parentheses. The logical Not applies to % the next predicate or group. % \end{function} -% -% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_all:n} +% +% \begin{function}[EXP, pTF, added = 2015-11-15, updated = 2017-07-15]{\bool_lazy_all:n} % \begin{syntax} % \cs{bool_lazy_all_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} % \cs{bool_lazy_all:nTF} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} \Arg{true code} \Arg{false code} @@ -433,7 +436,7 @@ % when there are only two \meta{boolean expressions}. % \end{function} % -% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_and:nn} +% \begin{function}[EXP, pTF, added = 2015-11-15, updated = 2017-07-15]{\bool_lazy_and:nn} % \begin{syntax} % \cs{bool_lazy_and_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2} % \cs{bool_lazy_and:nnTF} \Arg{boolexpr_1} \Arg{boolexpr_2} \Arg{true code} \Arg{false code} @@ -446,7 +449,7 @@ % than two \meta{boolean expressions}. % \end{function} % -% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_any:n} +% \begin{function}[EXP, pTF, added = 2015-11-15, updated = 2017-07-15]{\bool_lazy_any:n} % \begin{syntax} % \cs{bool_lazy_any_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} % \cs{bool_lazy_any:nTF} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} \Arg{true code} \Arg{false code} @@ -460,7 +463,7 @@ % when there are only two \meta{boolean expressions}. % \end{function} % -% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_or:nn} +% \begin{function}[EXP, pTF, added = 2015-11-15, updated = 2017-07-15]{\bool_lazy_or:nn} % \begin{syntax} % \cs{bool_lazy_or_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2} % \cs{bool_lazy_or:nnTF} \Arg{boolexpr_1} \Arg{boolexpr_2} \Arg{true code} \Arg{false code} @@ -473,7 +476,7 @@ % than two \meta{boolean expressions}. % \end{function} % -% \begin{function}[EXP, updated = 2012-07-08]{\bool_not_p:n} +% \begin{function}[EXP, updated = 2017-07-15]{\bool_not_p:n} % \begin{syntax} % \cs{bool_not_p:n} \Arg{boolean expression} % \end{syntax} @@ -481,7 +484,7 @@ % expression. % \end{function} % -% \begin{function}[EXP, updated = 2012-07-08]{\bool_xor_p:nn} +% \begin{function}[EXP, updated = 2017-07-15]{\bool_xor_p:nn} % \begin{syntax} % \cs{bool_xor_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2} % \end{syntax} @@ -538,7 +541,7 @@ % until the \meta{boolean} is \texttt{false}. % \end{function} % -% \begin{function}[rEXP, updated = 2012-07-08]{\bool_do_until:nn} +% \begin{function}[rEXP, updated = 2017-07-15]{\bool_do_until:nn} % \begin{syntax} % \cs{bool_do_until:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -550,7 +553,7 @@ % \texttt{true}. % \end{function} % -% \begin{function}[rEXP, updated = 2012-07-08]{\bool_do_while:nn} +% \begin{function}[rEXP, updated = 2017-07-15]{\bool_do_while:nn} % \begin{syntax} % \cs{bool_do_while:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -562,7 +565,7 @@ % \texttt{false}. % \end{function} % -% \begin{function}[rEXP, updated = 2012-07-08]{\bool_until_do:nn} +% \begin{function}[rEXP, updated = 2017-07-15]{\bool_until_do:nn} % \begin{syntax} % \cs{bool_until_do:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -574,7 +577,7 @@ % then loops until the \meta{boolean expression} is \texttt{true}. % \end{function} % -% \begin{function}[rEXP, updated = 2012-07-08]{\bool_while_do:nn} +% \begin{function}[rEXP, updated = 2017-07-15]{\bool_while_do:nn} % \begin{syntax} % \cs{bool_while_do:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -808,16 +811,16 @@ % make sure the boolean exists. This is needed because booleans are % not based on token lists nor on \TeX{} registers. % \begin{macrocode} -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } @@ -852,10 +855,10 @@ % argument the meaning \cs{c_true_bool} or \cs{c_false_bool}. % Again, we include some checking code. % \begin{macrocode} -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_set:Nn #1#2 { \tex_chardef:D #1 = \bool_if_p:n {#2} } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \bool_gset:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } \cs_generate_variant:Nn \bool_set:Nn { c } @@ -871,7 +874,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF } { - \if_meaning:w \c_true_bool #1 + \if_bool:N #1 \prg_return_true: \else: \prg_return_false: @@ -942,7 +945,8 @@ % input syntax somewhat similar to the one found in other programming % languages with |(| and |)| for grouping, |!| for logical % \enquote{Not}, |&&| for logical \enquote{And} and \verb"||" for -% logical \enquote{Or}. We shall use the terms Not, And, Or, Open and +% logical \enquote{Or}. However, they perform eager evaluation. +% We shall use the terms Not, And, Or, Open and % Close for these operations. % % Any expression is terminated by a Close operation. Evaluation @@ -951,9 +955,8 @@ % \begin{itemize} % \item If an Open is seen, start evaluating a new expression using % the Eval function and call GetNext again. -% \item If a Not is seen, remove the |!| and call a GetNotNext -% function, which eventually reverses the logic compared to -% GetNext. +% \item If a Not is seen, remove the |!| and call a GetNext +% function with the logic reversed. % \item If none of the above, reinsert the token found (this is % supposed to be a predicate function) in front of an Eval % function, which evaluates it to the boolean value \meta{true} or @@ -968,11 +971,11 @@ % seen, continue with GetNext to examine truth value of next % boolean (sub-)expression. % \item[\meta{false}And] Current truth value is false, logical And -% seen, stop evaluating the predicates within this sub-expression -% and break to the nearest Close. Then return \meta{false}. -% \item[\meta{true}Or] Current truth value is true, logical Or -% seen, stop evaluating the predicates within this sub-expression -% and break to the nearest Close. Then return \meta{true}. +% seen, stop using the values of predicates within this +% sub-expression until the next Close. Then return \meta{false}. +% \item[\meta{true}Or] Current truth value is true, logical Or seen, +% stop using the values of predicates within this sub-expression +% until the nearest Close. Then return \meta{true}. % \item[\meta{false}Or] Current truth value is false, logical Or % seen, continue with GetNext to examine truth value of next % boolean (sub-)expression. @@ -981,15 +984,6 @@ % \item[\meta{false}Close] Current truth value is false, Close % seen, return \meta{false}. % \end{description} -% We introduce an additional Stop operation with the same -% semantics as the Close operation. -% \begin{description} -% \item[\meta{true}Stop] Current truth value is true, return -% \meta{true}. -% \item[\meta{false}Stop] Current truth value is false, return -% \meta{false}. -% \end{description} -% The reasons for this follow below. % \begin{macrocode} \prg_new_conditional:Npnn \bool_if:n #1 { T , F , TF } { @@ -1003,82 +997,40 @@ % \end{macro} % % \begin{macro}[EXP]{\bool_if_p:n} -% \begin{macro}[EXP, aux] -% { -% \@@_if_left_parentheses:wwwn , -% \@@_if_right_parentheses:wwwn , -% \@@_if_or:wwwn -% } -% First issue a \cs{group_align_safe_begin:} as we are using |&&| -% as syntax shorthand for the And operation and we need to hide it for -% \TeX{}. This is closed at the end of the expression parsing -% (see |S| below). -% -% Minimal (\enquote{short-circuit}) evaluation of boolean expressions -% requires skipping to the end of the current parenthesized group when -% \meta{true}\verb"||" is seen, but to the next \verb"||" or closing -% parenthesis when \meta{false}|&&| is seen. To avoid having separate -% functions for the two cases, we transform the boolean expression by -% doubling each parenthesis and adding parenthesis around each -% \verb"||". This ensures that |&&| binds tighter than \verb"||". -% -% The replacement is done in three passes, for left and right -% parentheses and for \verb"||". At each pass, the part of the -% expression that has been transformed is stored before \cs{q_nil}, -% the rest lies until the first \cs{q_mark}, followed by an empty -% brace group. A trailing marker ensures that the auxiliaries' -% delimited arguments do not run-away. As long as the delimiter -% matches inside the expression, material is moved before \cs{q_nil} -% and we continue. Afterwards, the trailing marker is taken as a -% delimiter, |#4| is the next auxiliary, immediately followed by a new -% \cs{q_nil} delimiter, which indicates that nothing has been treated -% at this pass. The last step calls \cs{@@_if_parse:NNNww} which -% cleans up and triggers the evaluation of the expression itself. +% First issue a \cs{group_align_safe_begin:} as we are using |&&| as +% syntax shorthand for the And operation and we need to hide it for +% \TeX{}. This group is closed after \cs{@@_get_next:NN} returns +% \cs{c_true_bool} or \cs{c_false_bool}. That function requires the +% trailing parenthesis to know where the expression ends. % \begin{macrocode} \cs_new:Npn \bool_if_p:n #1 { \group_align_safe_begin: - \@@_if_left_parentheses:wwwn \q_nil - #1 \q_mark { } - ( \q_mark { \@@_if_right_parentheses:wwwn \q_nil } - ) \q_mark { \@@_if_or:wwwn \q_nil } - || \q_mark \@@_if_parse:NNNww - \q_stop - } -\cs_new:Npn \@@_if_left_parentheses:wwwn #1 \q_nil #2 ( #3 \q_mark #4 - { #4 \@@_if_left_parentheses:wwwn #1 #2 (( \q_nil #3 \q_mark {#4} } -\cs_new:Npn \@@_if_right_parentheses:wwwn #1 \q_nil #2 ) #3 \q_mark #4 - { #4 \@@_if_right_parentheses:wwwn #1 #2 )) \q_nil #3 \q_mark {#4} } -\cs_new:Npn \@@_if_or:wwwn #1 \q_nil #2 || #3 \q_mark #4 - { #4 \@@_if_or:wwwn #1 #2 )||( \q_nil #3 \q_mark {#4} } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[EXP, aux]{\@@_if_parse:NNNww} -% After removing extra tokens from the transformation phase, start -% evaluating. At the end, we need to finish the special -% \texttt{align_safe} group before finally -% returning a \cs{c_true_bool} or \cs{c_false_bool} as there might -% otherwise be something left in front in the input stream. For this -% we call the Stop operation, denoted simply by a |S| following the -% last Close operation. -% \begin{macrocode} -\cs_new:Npn \@@_if_parse:NNNww #1#2#3#4 \q_mark #5 \q_stop - { - \__bool_get_next:NN \use_i:nn (( #4 )) S + \exp_after:wN + \group_align_safe_end: + \exp:w \exp_end_continue_f:w % ( + \@@_get_next:NN \use_i:nnnn #1 ) } % \end{macrocode} % \end{macro} % % \begin{macro}[aux]{\@@_get_next:NN} -% The GetNext operation. This is a switch: if what follows is neither -% |!| nor |(|, we assume it is a predicate. The first argument is -% \cs{use_ii:nn} if the logic must eventually be reversed (after a -% |!|), otherwise it is \cs{use_i:nn}. This function eventually -% expand to the truth value \cs{c_true_bool} or \cs{c_false_bool} of -% the expression which follows until the next unmatched closing -% parenthesis. +% The GetNext operation. Its first argument is \cs{use_i:nnnn}, +% \cs{use_ii:nnnn}, \cs{use_iii:nnnn}, or \cs{use_iv:nnnn} (we call +% these \enquote{states}). In the first state, this function +% eventually expand to the truth value \cs{c_true_bool} or +% \cs{c_false_bool} of the expression which follows until the next +% unmatched closing parenthesis. For instance +% \enquote{\cs{@@_get_next:NN} \cs{use_i:nnnn} \cs{c_true_bool} +% \texttt{\&\&} \cs{c_true_bool} \texttt{)}} (including the closing +% parenthesis) expands to \cs{c_true_bool}. In the second state +% (after a |!|) the logic is reversed. We call these two states +% \enquote{normal} and the next two \enquote{skipping}. In the third +% state (after \cs{c_true_bool}\verb"||") it always returns +% \cs{c_true_bool}. In the fourth state (after \cs{c_false_bool}|&&|) +% it always returns \cs{c_false_bool} and also stops when encountering +% \verb"||", not only parentheses. This code itself is a switch: if +% what follows is neither |!| nor |(|, we assume it is a predicate. % \begin{macrocode} \cs_new:Npn \@@_get_next:NN #1#2 { @@ -1094,23 +1046,31 @@ % \end{macro} % % \begin{macro}[aux]{\@@_!:Nw} -% The Not operation reverses the logic: discard the |!| token and call -% the GetNext operation with its first argument reversed. +% The Not operation reverses the logic: it discards the |!|~token and +% calls the GetNext operation with the appropriate first argument. +% Namely the first and second states are interchanged, but after +% \cs{c_true_bool}\verb"||" or \cs{c_false_bool}|&&| the |!|~is +% ignored. % \begin{macrocode} \cs_new:cpn { @@_!:Nw } #1#2 - { \exp_after:wN \@@_get_next:NN #1 \use_ii:nn \use_i:nn } + { + \exp_after:wN \@@_get_next:NN + #1 \use_ii:nnnn \use_i:nnnn \use_iii:nnnn \use_iv:nnnn + } % \end{macrocode} % \end{macro} % % \begin{macro}[aux]{\@@_(:Nw} -% The Open operation starts a sub-expression after discarding the -% token. This is done by calling GetNext, with a post-processing step -% which looks for And, Or or Close afterwards. +% The Open operation starts a sub-expression after discarding the open +% parenthesis. This is done by calling GetNext (which eventually +% discards the corresponding closing parenthesis), with a +% post-processing step which looks for And, Or or Close after the +% group. % \begin{macrocode} \cs_new:cpn { @@_(:Nw } #1#2 { \exp_after:wN \@@_choose:NNN \exp_after:wN #1 - \__int_value:w \@@_get_next:NN \use_i:nn + \__int_value:w \@@_get_next:NN \use_i:nnnn } % \end{macrocode} % \end{macro} @@ -1118,8 +1078,8 @@ % \begin{macro}[aux]{\@@_p:Nw} % If what follows GetNext is neither |!| nor |(|, evaluate the % predicate using the primitive \cs{__int_value:w}. The canonical -% true and false values have numerical values $1$ and $0$ -% respectively. Look for And, Or or Close afterwards. +% \texttt{true} and \texttt{false} values have numerical values $1$ +% and $0$ respectively. Look for And, Or or Close afterwards. % \begin{macrocode} \cs_new:cpn { @@_p:Nw } #1 { \exp_after:wN \@@_choose:NNN \exp_after:wN #1 \__int_value:w } @@ -1127,149 +1087,63 @@ % \end{macro} % % \begin{macro}[aux]{\@@_choose:NNN} -% Branching the eight-way switch. The arguments are 1: \cs{use_i:nn} -% or \cs{use_ii:nn}, 2: $0$ or $1$ encoding the current truth value, -% 3: the next operation, And, Or, Close or Stop. If |#1| is -% \cs{use_ii:nn}, the logic of |#2| must be reversed. +% \begin{macro}[aux]+\@@_)_0:+ +% \begin{macro}[aux]+\@@_)_1:+ +% \begin{macro}[aux]+\@@_)_2:+ +% \begin{macro}[aux]+\@@_&_0:+ +% \begin{macro}[aux]+\@@_&_1:+ +% \begin{macro}[aux]+\@@_&_2:+ +% \begin{macro}[aux]+\@@_|_0:+ +% \begin{macro}[aux]+\@@_|_1:+ +% \begin{macro}[aux]+\@@_|_2:+ +% The arguments are |#1|: a function such as \cs{use_i:nnnn}, |#2|: +% $0$ or $1$ encoding the current truth value, |#3|: the next +% operation, And, Or or Close. We distinguish three cases according +% to a combination of |#1| and |#2|. Case~2 is when |#1| is +% \cs{use_iii:nnnn} (state~3), namely after +% \cs{c_true_bool}~\verb"||". Case~1 is when |#1| is \cs{use_i:nnnn} +% and |#2| is \texttt{true} or when |#1| is \cs{use_ii:nnnn} and |#2| +% is \texttt{false}, for instance for |!|\cs{c_false_bool}. Case~0 +% includes the same with \texttt{true}/\texttt{false} interchanged and +% the case where |#1| is \cs{use_iv:nnnn} namely after +% \cs{c_false_bool}~|&&|. +% +% When seeing~|)| the current subexpression is done, leave the +% appropriate boolean. When seeing~|&| in case~0 go into state~4, +% equivalent to having seen \cs{c_false_bool}~|&&|. In case~1, namely +% when the argument is \texttt{true} and we are in a normal state +% continue in the normal state~1. In case~2, namely when skipping +% alternatives in an Or, continue in the same state. When +% seeing~\verb"|" in case~0, continue in a normal state; in particular +% stop skipping for \cs{c_false_bool}~|&&| because that binds more +% tightly than~\verb"||". In the other two cases start skipping for +% \cs{c_true_bool}~\verb"||". % \begin{macrocode} \cs_new:Npn \@@_choose:NNN #1#2#3 { \use:c { - @@_ #3 _ - #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } - :w + @@_ \token_to_str:N #3 _ + #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } 2 0 : } } +\cs_new:cpn { @@_)_0: } { \c_false_bool } +\cs_new:cpn { @@_)_1: } { \c_true_bool } +\cs_new:cpn { @@_)_2: } { \c_true_bool } +\cs_new:cpn { @@_&_0: } & { \@@_get_next:NN \use_iv:nnnn } +\cs_new:cpn { @@_&_1: } & { \@@_get_next:NN \use_i:nnnn } +\cs_new:cpn { @@_&_2: } & { \@@_get_next:NN \use_iii:nnnn } +\cs_new:cpn { @@_|_0: } | { \@@_get_next:NN \use_i:nnnn } +\cs_new:cpn { @@_|_1: } | { \@@_get_next:NN \use_iii:nnnn } +\cs_new:cpn { @@_|_2: } | { \@@_get_next:NN \use_iii:nnnn } % \end{macrocode} % \end{macro} -% -% \begin{macro}[aux] -% { -% \@@_)_0:w, -% \@@_)_1:w, -% \@@_S_0:w, -% \@@_S_1:w, -% } -% Closing a group is just about returning the result. The Stop -% operation is similar except it closes the special alignment group -% before returning the boolean. -% \begin{macrocode} -\cs_new:cpn { @@_)_0:w } { \c_false_bool } -\cs_new:cpn { @@_)_1:w } { \c_true_bool } -\cs_new:cpn { @@_S_0:w } { \group_align_safe_end: \c_false_bool } -\cs_new:cpn { @@_S_1:w } { \group_align_safe_end: \c_true_bool } -% \end{macrocode} % \end{macro} -% -% \begin{macro}[aux]+\@@_&_1:w+ -% \begin{macro}[aux]+\@@_|_0:w+ -% Two cases where we simply continue scanning. We must remove the -% second |&| or \verb"|". -% \begin{macrocode} -\cs_new:cpn { @@_&_1:w } & { \@@_get_next:NN \use_i:nn } -\cs_new:cpn { @@_|_0:w } | { \@@_get_next:NN \use_i:nn } -% \end{macrocode} % \end{macro} % \end{macro} -% -% \begin{macro}[aux]+\@@_&_0:w+ -% \begin{macro}[aux]+\@@_|_1:w+ -% \begin{macro}[aux] -% { -% \@@_eval_skip_to_end_auxi:Nw, -% \@@_eval_skip_to_end_auxii:Nw, -% \@@_eval_skip_to_end_auxiii:Nw -% } -% When the truth value has already been decided, we have to throw away -% the remainder of the current group as we are doing minimal -% evaluation. This is slightly tricky as there are no braces so we -% have to play match the |()| manually. -% \begin{macrocode} -\cs_new:cpn { @@_&_0:w } & - { \@@_eval_skip_to_end_auxi:Nw \c_false_bool } -\cs_new:cpn { @@_|_1:w } | - { \@@_eval_skip_to_end_auxi:Nw \c_true_bool } -% \end{macrocode} -% There is always at least one |)| waiting, namely the outer -% one. However, we are facing the problem that there may be more than -% one that need to be finished off and we have to detect the correct -% number of them. Here is a complicated example showing how this is -% done. After evaluating the following, we realize we must skip -% everything after the first And. Note the extra Close at the end. -% \begin{quote} -% |\c_false_bool && ((abc) && xyz) && ((xyz) && (def)))| -% \end{quote} -% First read up to the first Close. This gives us the list we first -% read up until the first right parenthesis so we are looking at the -% token list -% \begin{quote} -% |((abc| -% \end{quote} -% This contains two Open markers so we must remove two groups. Since -% no evaluation of the contents is to be carried out, it doesn't -% matter how we remove the groups as long as we wind up with the -% correct result. We therefore first remove a |()| pair and what -% preceded the Open -- but leave the contents as it may contain Open -% tokens itself -- leaving -% \begin{quote} -% |(abc && xyz) && ((xyz) && (def)))| -% \end{quote} -% Another round of this gives us -% \begin{quote} -% |(abc && xyz| -% \end{quote} -% which still contains an Open so we remove another |()| pair, giving us -% \begin{quote} -% |abc && xyz && ((xyz) && (def)))| -% \end{quote} -% Again we read up to a Close and again find Open tokens: -% \begin{quote} -% |abc && xyz && ((xyz| -% \end{quote} -% Further reduction gives us -% \begin{quote} -% |(xyz && (def)))| -% \end{quote} -% and then -% \begin{quote} -% |(xyz && (def| -% \end{quote} -% with reduction to -% \begin{quote} -% |xyz && (def))| -% \end{quote} -% and ultimately we arrive at no Open tokens being skipped and we can -% finally close the group nicely. -% \begin{macrocode} -%% ( -\cs_new:Npn \@@_eval_skip_to_end_auxi:Nw #1#2 ) - { - \@@_eval_skip_to_end_auxii:Nw #1#2 ( % ) - \q_no_value \q_stop - {#2} - } -% \end{macrocode} -% If no right parenthesis, then |#3| is no_value and we are done, return -% the boolean |#1|. If there is, we need to grab a |()| pair and then -% recurse -% \begin{macrocode} -\cs_new:Npn \@@_eval_skip_to_end_auxii:Nw #1#2 ( #3#4 \q_stop #5 % ) - { - \quark_if_no_value:NTF #3 - {#1} - { \@@_eval_skip_to_end_auxiii:Nw #1 #5 } - } -% \end{macrocode} -% Keep the boolean, throw away anything up to the |(| as it is -% irrelevant, remove a |()| pair but remember to reinsert |#3| as it may -% contain |(| tokens! -% \begin{macrocode} -\cs_new:Npn \@@_eval_skip_to_end_auxiii:Nw #1#2 ( #3 ) - { % ( - \@@_eval_skip_to_end_auxi:Nw #1#3 ) - } -% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} @@ -1510,6 +1384,7 @@ % pool. Also, it is considerably slower than what we use here so the % few extra csnames are well spent I would say. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \prg_replicate:nn #1 { \exp:w diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 2d3ecc3bbd2..b44693bdb13 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 6b5f79741c3..5ad64e6a37f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index 625907bf5a0..c1e07cca601 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1441,9 +1441,16 @@ % \cs{__tl_build_one:o} by a single call to \cs{__tl_build_one:x}, because % the \texttt{x}-expanding assignment may be interrupted by |\x|. % \begin{macrocode} +\__debug_patch:nnNNpn + { + \__debug_trace_push:nnN { regex } { 1 } \@@_escape_use:nnnn + \__tl_build:Nw \l_@@_internal_a_tl + \__tl_build_one:n { \__debug_trace_pop:nnN { regex } { 1 } \@@_escape_use:nnnn } + \use_none:nn + } + { } \cs_new_protected:Npn \@@_escape_use:nnnn #1#2#3#4 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_escape_use:nnnn } \__tl_build:Nw \l_@@_internal_a_tl \cs_set:Npn \@@_escape_unescaped:N ##1 { #1 } \cs_set:Npn \@@_escape_escaped:N ##1 { #2 } @@ -1457,7 +1464,6 @@ } \__tl_build_one:o \l_@@_internal_b_tl \__tl_build_end: -%<trace> \trace_pop:nnn { regex } { 1 } { @@_escape_use:nnnn } \l_@@_internal_a_tl } % \end{macrocode} @@ -3665,9 +3671,14 @@ \@@_compile:n {#1} \@@_build:N \l_@@_internal_regex } +\__debug_patch:nnNNpn + { \__debug_trace_push:nnN { regex } { 1 } \@@_build:N } + { + \@@_trace_states:n { 2 } + \__debug_trace_pop:nnN { regex } { 1 } \@@_build:N + } \cs_new_protected:Npn \@@_build:N #1 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_build } \@@_standard_escapechar: \int_zero:N \l_@@_capturing_group_int \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int @@ -3678,8 +3689,6 @@ \@@_group:nnnN {#1} { 1 } { 0 } \c_false_bool \@@_toks_put_right:Nn \l_@@_right_state_int { \@@_action_success: } -%<trace> \@@_trace_states:n { 2 } -%<trace> \trace_pop:nnn { regex } { 1 } { @@_build } } % \end{macrocode} % \end{macro} @@ -3691,9 +3700,14 @@ % work properly at the outer level, we need to put the appropriate % \texttt{left} and \texttt{right} states in their sequence. % \begin{macrocode} +\__debug_patch:nnNNpn + { \__debug_trace_push:nnN { regex } { 1 } \@@_build_for_cs:n } + { + \@@_trace_states:n { 2 } + \__debug_trace_pop:nnN { regex } { 1 } \@@_build_for_cs:n + } \cs_new_protected:Npn \@@_build_for_cs:n #1 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_build_for_cs } \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int \@@_build_new_state: \@@_build_new_state: @@ -3706,8 +3720,6 @@ \exp_after:wN \@@_action_success: \fi: } -%<trace> \@@_trace_states:n { 2 } -%<trace> \trace_pop:nnn { regex } { 1 } { @@_build_for_cs } } % \end{macrocode} % \end{macro} @@ -3760,10 +3772,9 @@ % \texttt{right} state is the new empty state, and the \texttt{left} % state points to the previously \enquote{current} state. % \begin{macrocode} -\cs_new_protected:Npn \@@_build_new_state: +\__debug_patch:nnNNpn { -%<*trace> - \trace:nnx { regex } { 2 } + \__debug_trace:nnx { regex } { 2 } { regex~new~state~ L=\int_use:N \l_@@_left_state_int ~ -> ~ @@ -3771,7 +3782,10 @@ M=\int_use:N \l_@@_max_state_int ~ -> ~ \int_eval:n { \l_@@_max_state_int + 1 } } -%</trace> + } + { } +\cs_new_protected:Npn \@@_build_new_state: + { \@@_toks_clear:N \l_@@_max_state_int \int_set_eq:NN \l_@@_left_state_int \l_@@_right_state_int \int_set_eq:NN \l_@@_right_state_int \l_@@_max_state_int @@ -3924,9 +3938,11 @@ % auxiliaries expects \texttt{left_state} and \texttt{right_state} to % be set properly. % \begin{macrocode} +\__debug_patch:nnNNpn + { \__debug_trace_push:nnN { regex } { 1 } \@@_group_aux:nnnnN } + { \__debug_trace_pop:nnN { regex } { 1 } \@@_group_aux:nnnnN } \cs_new_protected:Npn \@@_group_aux:nnnnN #1#2#3#4#5 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_group } \if_int_compare:w #3 = 0 \exp_stop_f: \@@_build_new_state: %<assert>\assert_int:n { \l_@@_max_state_int = \l_@@_right_state_int + 1 } @@ -3942,7 +3958,6 @@ \or: \@@_group_repeat:nnN {#1} {#3} #5 \else: \@@_group_repeat:nnnN {#1} {#3} {#4} #5 \fi: -%<trace> \trace_pop:nnn { regex } { 1 } { @@_group } } % \end{macrocode} % \end{macro} @@ -4006,9 +4021,11 @@ % the group. The left and right states of the group are extracted from % the relevant sequences. % \begin{macrocode} +\__debug_patch:nnNNpn + { \__debug_trace_push:nnN { regex } { 1 } \@@_branch:n } + { \__debug_trace_pop:nnN { regex } { 1 } \@@_branch:n } \cs_new_protected:Npn \@@_branch:n #1 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_branch } \@@_build_new_state: \seq_get:NN \l_@@_left_state_seq \l_@@_internal_a_tl \int_set:Nn \l_@@_left_state_int \l_@@_internal_a_tl @@ -4018,7 +4035,6 @@ \seq_get:NN \l_@@_right_state_seq \l_@@_internal_a_tl \@@_build_transition_right:nNn \@@_action_free:n \l_@@_right_state_int \l_@@_internal_a_tl -%<trace> \trace_pop:nnn { regex } { 1 } { @@_branch } } % \end{macrocode} % \end{macro} @@ -4492,6 +4508,7 @@ % \subsubsection{Matching: framework} % % \begin{macro}[int]{\@@_match:n} +% \begin{macro}[aux]{\@@_match_init:} % First store the query into \tn{toks} registers and arrays (see % \cs{@@_query_set:nnn}). Then initialize the variables that should % be set once for each user function (even for multiple @@ -4502,10 +4519,14 @@ % smothering an empty match at the start). Once all this is set up, we % are ready for the ride. Find the first match. % \begin{macrocode} +\__debug_patch:nnNNpn + { + \__debug_trace_push:nnN { regex } { 1 } \@@_match:n + \__debug_trace:nnx { regex } { 1 } { analyzing~query~token~list } + } + { \__debug_trace_pop:nnN { regex } { 1 } \@@_match:n } \cs_new_protected:Npn \@@_match:n #1 { -%<trace> \trace_push:nnx { regex } { 1 } { @@_match } -%<trace> \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l_@@_balance_int \int_set:Nn \l_@@_curr_pos_int { 2 * \l_@@_max_state_int } \@@_query_set:nnn { } { -1 } { -2 } @@ -4514,7 +4535,14 @@ { \@@_query_set:nnn {##1} {"##2} {##3} } \int_set_eq:NN \l_@@_max_pos_int \l_@@_curr_pos_int \@@_query_set:nnn { } { -1 } { -2 } -%<trace> \trace:nnx { regex } { 1 } { initializing } + \@@_match_init: + \@@_match_once: + } +\__debug_patch:nnNNpn + { \__debug_trace:nnx { regex } { 1 } { initializing } } + { } +\cs_new_protected:Npn \@@_match_init: + { \bool_gset_false:N \g_@@_success_bool \int_step_inline:nnnn \l_@@_min_state_int { 1 } { \l_@@_max_state_int - 1 } @@ -4526,11 +4554,10 @@ { 2 * \l_@@_max_state_int } \int_set_eq:NN \l_@@_submatch_int \l_@@_min_submatch_int \bool_set_false:N \l_@@_empty_success_bool - \@@_match_once: -%<trace> \trace_pop:nnx { regex } { 1 } { @@_match } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[int]{\@@_match_once:} % This function finds one match, then does some action defined by the @@ -4692,11 +4719,11 @@ % state is marked as $\texttt{step}+1$: any thread hitting it at that % point will be terminated. % \begin{macrocode} +\__debug_patch:nnNNpn + { \__debug_trace:nnx { regex } { 2 } { state~\int_use:N \l_@@_curr_state_int } } + { } \cs_new_protected:Npn \@@_use_state: { -%<*trace> - \trace:nnx { regex } { 2 } { state~\int_use:N \l_@@_curr_state_int } -%</trace> \__intarray_gset_fast:Nnn \g_@@_state_active_intarray { \l_@@_curr_state_int } { \l_@@_step_int } \@@_toks_use:w \l_@@_curr_state_int @@ -5056,9 +5083,11 @@ % parsed, make sure that there is no open csname. Finally, define the % \texttt{balance_one_match} and \texttt{do_one_match} functions. % \begin{macrocode} +\__debug_patch:nnNNpn + { \__debug_trace_push:nnN { regex } { 1 } \@@_replacement:n } + { \__debug_trace_pop:nnN { regex } { 1 } \@@_replacement:n } \cs_new_protected:Npn \@@_replacement:n #1 { -%<trace> \trace_push:nnn { regex } { 1 } { @@_replacement:n } \__tl_build:Nw \l_@@_internal_a_tl \int_zero:N \l_@@_balance_int \tl_clear:N \l_@@_balance_tl @@ -5095,7 +5124,6 @@ } \__tl_build_end: \exp_args:No \@@_replacement_aux:n \l_@@_internal_a_tl -%<trace> \trace_pop:nnn { regex } { 1 } { @@_replacement:n } } \cs_new_protected:Npn \@@_replacement_aux:n #1 { @@ -6435,27 +6463,60 @@ % % \subsection{Code for tracing} % -% The tracing code is still very experimental, and is meant to be used -% with the \pkg{l3trace} package, currently in \texttt{l3trial}. +% There is a more extensive implementation of tracing in the l3trial +% package \pkg{l3trace}. Function names are a bit different but could +% be merged. +% +% \begin{macro}[int] +% {\__debug_trace_push:nnN, \__debug_trace_pop:nnN, \__debug_trace:nnx} +% Here |#1| is the module name (\texttt{regex}) and |#2| is +% typically~1. If the module's current tracing level is less than +% |#2| show nothing, otherwise write |#3| to the terminal. +% \begin{macrocode} +\__debug:TF + { + \cs_new_protected:Npn \__debug_trace_push:nnN #1#2#3 + { \__debug_trace:nnx {#1} {#2} { entering~ \token_to_str:N #3 } } + \cs_new_protected:Npn \__debug_trace_pop:nnN #1#2#3 + { \__debug_trace:nnx {#1} {#2} { leaving~ \token_to_str:N #3 } } + \cs_new_protected:Npn \__debug_trace:nnx #1#2#3 + { + \int_compare:nNnF + { \int_use:c { g__debug_trace_#1_int } } < {#2} + { \iow_term:x { Trace:~#3 } } + } + } + { } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\g__debug_trace_regex_int} +% No tracing when that is zero. +% \begin{macrocode} +\int_new:N \g__debug_trace_regex_int +% \end{macrocode} +% \end{variable} % % \begin{macro}[int]{\@@_trace_states:n} % This function lists the contents of all states of the \textsc{nfa}, % stored in \tn{toks} from $0$ to \cs{l_@@_max_state_int} % (excluded). % \begin{macrocode} -%<*trace> -\cs_new_protected:Npn \@@_trace_states:n #1 +\__debug:TF { - \int_step_inline:nnnn - \l_@@_min_state_int - { 1 } - { \l_@@_max_state_int - 1 } + \cs_new_protected:Npn \@@_trace_states:n #1 { - \trace:nnx { regex } { #1 } - { \iow_char:N \\toks ##1 = { \@@_toks_use:w ##1 } } + \int_step_inline:nnnn + \l_@@_min_state_int + { 1 } + { \l_@@_max_state_int - 1 } + { + \__debug_trace:nnx { regex } {#1} + { \iow_char:N \\toks ##1 = { \@@_toks_use:w ##1 } } + } } } -%</trace> + { } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 9d724ec4715..44fb86d338c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 8f2e175ecaa..044aba65b3e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1110,6 +1110,7 @@ % \begin{macro}{\dim_gset:Nn, \dim_gset:cn} % Setting dimensions is easy enough. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \dim_set:Nn #1#2 { #1 ~ \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \dim_gset:Nn { \tex_global:D \dim_set:Nn } @@ -1140,11 +1141,13 @@ % \begin{macro}{\dim_gsub:Nn, \dim_gsub:cn} % Using |by| here deals with the (incorrect) case |\dimen123|. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \dim_add:Nn #1#2 { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \dim_gadd:Nn { \tex_global:D \dim_add:Nn } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \dim_sub:Nn #1#2 { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \dim_gsub:Nn { \tex_global:D \dim_sub:Nn } @@ -1169,6 +1172,7 @@ % Functions for $\min$, $\max$, and absolute value with only one evaluation. % The absolute value is evaluated by removing a leading~|-| if present. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_abs:n #1 { \exp_after:wN \@@_abs:N @@ -1176,6 +1180,7 @@ } \cs_new:Npn \@@_abs:N #1 { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \dim_max:nn #1#2 { \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN @@ -1184,6 +1189,7 @@ > \@@_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \dim_min:nn #1#2 { \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN @@ -1227,6 +1233,7 @@ % \begin{macro}[pTF, EXP]{\dim_compare:nNn} % Simple comparison. % \begin{macrocode} +\__debug_patch_conditional_args:nNNpnn { { (#1) \@@_eval_end: } {#2} { (#3) } } \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { \if_dim:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end: @@ -1426,6 +1433,7 @@ % \begin{macro}{\dim_eval:n} % Evaluating a dimension expression expandably. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_eval:n #1 { \dim_use:N \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} @@ -1447,15 +1455,16 @@ % \begin{macro}[EXP, aux]{\@@_to_decimal:w} % A function which comes up often enough to deserve a place in the % kernel. Evaluate the dimension expression~|#1| then remove the -% trailing \texttt{pt}. The argument is put in parentheses as this -% prevents the dimension expression from terminating early and leaving -% extra tokens lying around. This is used a lot by low-level -% manipulations. +% trailing \texttt{pt}. When debugging is enabled, the argument is +% put in parentheses as this prevents the dimension expression from +% terminating early and leaving extra tokens lying around. This is +% used a lot by low-level manipulations. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_to_decimal:n #1 { \exp_after:wN - \@@_to_decimal:w \dim_use:N \@@_eval:w (#1) \@@_eval_end: + \@@_to_decimal:w \dim_use:N \@@_eval:w #1 \@@_eval_end: } \use:x { @@ -1486,6 +1495,7 @@ % Another hard-coded conversion: this one is necessary to avoid things going % off-scale. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_to_decimal_in_sp:n #1 { \int_eval:n { \@@_eval:w #1 \@@_eval_end: } } % \end{macrocode} @@ -1635,6 +1645,7 @@ % \begin{macro}{\skip_gset:Nn, \skip_gset:cn} % Much the same as for dimensions. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \skip_set:Nn #1#2 { #1 ~ \etex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gset:Nn { \tex_global:D \skip_set:Nn } @@ -1666,11 +1677,13 @@ % \begin{macro}{\skip_gsub:Nn, \skip_gsub:cn} % Using |by| here deals with the (incorrect) case |\skip123|. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \skip_add:Nn #1#2 { \tex_advance:D #1 by \etex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gadd:Nn { \tex_global:D \skip_add:Nn } \cs_generate_variant:Nn \skip_add:Nn { c } \cs_generate_variant:Nn \skip_gadd:Nn { c } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \skip_sub:Nn #1#2 { \tex_advance:D #1 by - \etex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gsub:Nn { \tex_global:D \skip_sub:Nn } @@ -1713,6 +1726,7 @@ % \begin{macrocode} \cs_set_protected:Npn \__cs_tmp:w #1 { + \__debug_patch_conditional_args:nNNpnn { { (##1) } } \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } { \exp_after:wN \__skip_if_finite:wwNw @@ -1731,6 +1745,7 @@ % \begin{macro}{\skip_eval:n} % Evaluating a skip expression expandably. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \skip_eval:n #1 { \skip_use:N \etex_glueexpr:D #1 \scan_stop: } % \end{macrocode} @@ -1752,9 +1767,11 @@ % Inserting skips. % \begin{macrocode} \cs_new_eq:NN \skip_horizontal:N \tex_hskip:D +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \skip_horizontal:n #1 { \skip_horizontal:N \etex_glueexpr:D #1 \scan_stop: } \cs_new_eq:NN \skip_vertical:N \tex_vskip:D +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \skip_vertical:n #1 { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: } \cs_generate_variant:Nn \skip_horizontal:N { c } @@ -1892,6 +1909,7 @@ % \begin{macro}{\muskip_gset:Nn, \muskip_gset:cn} % This should be pretty familiar. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \muskip_set:Nn #1#2 { #1 ~ \etex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gset:Nn { \tex_global:D \muskip_set:Nn } @@ -1929,11 +1947,13 @@ % \begin{macro}{\muskip_gsub:Nn, \muskip_gsub:cn} % Using |by| here deals with the (incorrect) case |\muskip123|. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \muskip_add:Nn #1#2 { \tex_advance:D #1 by \etex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gadd:Nn { \tex_global:D \muskip_add:Nn } \cs_generate_variant:Nn \muskip_add:Nn { c } \cs_generate_variant:Nn \muskip_gadd:Nn { c } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \muskip_sub:Nn #1#2 { \tex_advance:D #1 by - \etex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gsub:Nn { \tex_global:D \muskip_sub:Nn } @@ -1950,6 +1970,7 @@ % \begin{macro}{\muskip_eval:n} % Evaluating a muskip expression expandably. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \muskip_eval:n #1 { \muskip_use:N \etex_muexpr:D #1 \scan_stop: } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 98e256c3b29..2f3bc0afab5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1078,24 +1078,10 @@ % \begin{macro}[deprecated = 2018-12-31]{\sort_ordered:, \sort_reversed:} % These functions were renamed for consistency. % \begin{macrocode} -\cs_new_protected:Npn \sort_ordered: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \sort_ordered: } - { \token_to_str:N \sort_return_same: } - \cs_gset_eq:NN \sort_ordered: \sort_return_same: - \sort_return_same: - } -\cs_new_protected:Npn \sort_reversed: - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2018-12-31 } - { \token_to_str:N \sort_reversed: } - { \token_to_str:N \sort_return_swapped: } - \cs_gset_eq:NN \sort_reversed: \sort_return_swapped: - \sort_return_swapped: - } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \sort_return_same: } +\cs_new_protected:Npn \sort_ordered: { \sort_return_same: } +\__debug_deprecation:nnNNpn { 2018-12-31 } { \sort_return_swapped: } +\cs_new_protected:Npn \sort_reversed: { \sort_return_swapped: } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 1642d85a1ee..2ed04451f7d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -271,7 +271,7 @@ % \end{syntax} % This function compares the \meta{test string} in turn with each % of the \meta{string cases}. If the two are equal (as described for -% \cs{str_if_eq:nnTF} then the associated \meta{code} is left in the +% \cs{str_if_eq:nnTF}) then the associated \meta{code} is left in the % input stream and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none @@ -280,7 +280,7 @@ % available. % \end{function} % -% \begin{function}[added = 2013-07-24, EXP, TF]{\str_case_x:nn} +% \begin{function}[added = 2013-07-24, EXP, noTF]{\str_case_x:nn} % \begin{syntax} % \cs{str_case_x:nnTF} \Arg{test string} \\ % ~~|{| \\ @@ -294,7 +294,7 @@ % \end{syntax} % This function compares the full expansion of the \meta{test string} % in turn with the full expansion of the \meta{string cases}. If the two -% full expansions are equal (as described for \cs{str_if_eq:nnTF} then the +% full expansions are equal (as described for \cs{str_if_eq:nnTF}) then the % associated \meta{code} is left in the input stream % and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the @@ -1049,6 +1049,7 @@ } \cs_new:Npn \str_item_ignore_spaces:nn #1 { \exp_args:No \@@_item:nn { \tl_to_str:n {#1} } } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new:Npn \@@_item:nn #1#2 { \exp_after:wN \@@_item:w @@ -1145,6 +1146,7 @@ } \cs_new:Npn \str_range_ignore_spaces:nnn #1 { \exp_args:No \@@_range:nnn { \tl_to_str:n {#1} } } +\__debug_patch_args:nNNpn { {#1} { (#2) } { (#3) } } \cs_new:Npn \@@_range:nnn #1#2#3 { \exp_after:wN \@@_range:w diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index 559a20d56df..e23a84d4717 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index d5ca22491ab..1be06702cb6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -313,12 +313,8 @@ % The whole process takes linear time, because we avoid building the % result one item at a time. % -% To ease the difficult first pass, we first do some setup with -% \cs{@@_setup:n}. Active characters set equal to non-active -% characters cause trouble, so we disable all active characters by -% setting them equal to \texttt{undefined} locally. We also set there -% the escape character to be printable (backslash, but this later -% oscillates between slash and backslash): this makes it possible to +% We make the escape character printable (backslash, but this later +% oscillates between slash and backslash): this allows us to % distinguish characters from control sequences. % % A token has two characteristics: its \tn{meaning}, and what it looks @@ -339,7 +335,7 @@ % \item a non-active character, in which case its meaning is % automatically that associated to its character code and category % code, we call it \enquote{true} character; -% \item an active character (we eliminate those in the setup step); +% \item an active character; % \item a control sequence. % \end{itemize} % The only tokens which are not valid \texttt{N}-type arguments are true @@ -360,7 +356,6 @@ { \group_begin: \group_align_safe_begin: - \@@_setup:n {#1} \@@_a:n {#1} \@@_b:n {#1} \group_align_safe_end: @@ -369,54 +364,36 @@ % \end{macrocode} % \end{macro} % -% \subsection{Setup} -% -% \begin{macro}[int]{\@@_setup:n} -% \begin{macro}[aux]{\@@_disable_loop:N} -% Active characters can cause problems later on in the processing, -% so the first step is to disable them, by setting them to -% \texttt{undefined}. Since Unicode contains too many characters -% to loop over all of them, we instead loop over the input token -% list as a string: any active character in the token list -% must appear in its string representation. The string is shortened -% a little by making the escape character unprintable. The active -% space must be disabled separately (the loop skips over it otherwise), -% and we end the loop by feeding an odd non-\texttt{N}-type argument -% to the looping macro. For \pTeX{} and \upTeX{} we skip characters -% beyond $[0,255]$ because \tn{lccode} only allows those values. +% \subsection{Disabling active characters} +% +% \begin{macro}[aux]{\@@_disable:n} +% Active characters can cause problems later on in the processing, so +% we provide a way to disable them, by setting them to +% \texttt{undefined}. Since Unicode contains too many characters to +% loop over all of them, we instead do this whenever we encounter a +% character. For \pTeX{} and \upTeX{} we skip characters beyond +% $[0,255]$ because \tn{lccode} only allows those values. % \begin{macrocode} -\cs_new_protected:Npn \@@_setup:n #1 - { - \int_set:Nn \tex_escapechar:D { -1 } - \exp_after:wN \@@_disable_loop:N - \tl_to_str:n {#1} { ~ } { ? \__prg_break: } - \__prg_break_point: - \scan_stop: - } \group_begin: \char_set_catcode_active:N \^^@ - \cs_new_protected:Npn \@@_disable_loop:N #1 + \cs_new_protected:Npn \@@_disable:n #1 { - \tex_lccode:D 0 = `#1 ~ + \tex_lccode:D 0 = #1 \exp_stop_f: \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D - \@@_disable_loop:N } \cs_if_exist:NT \ptex_kanjiskip:D { - \cs_gset_protected:Npn \@@_disable_loop:N #1 + \cs_gset_protected:Npn \@@_disable:n #1 { - \use_none:n #1 \scan_stop: - \if_int_compare:w 256 > `#1 \exp_stop_f: - \tex_lccode:D 0 = `#1 ~ + \if_int_compare:w 256 > #1 \exp_stop_f: + \tex_lccode:D 0 = #1 \exp_stop_f: \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \fi: - \@@_disable_loop:N } } \group_end: % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{First pass} % @@ -425,14 +402,14 @@ % Also, we wish to store some representation of each special token % in a \tn{toks} register. % -% After the setup step, we have $11$ types of tokens: +% We have $11$ types of tokens: % \begin{itemize} % \item[1.] a true non-space begin-group character; % \item[2.] a true space begin-group character; % \item[3.] a true non-space end-group character; % \item[4.] a true space end-group character; % \item[5.] a true space blank space character; -% \item[6.] an undefined active character; +% \item[6.] an active character; % \item[7.] any other true character; % \item[8.] a control sequence equal to a begin-group token (category code $1$); % \item[9.] a control sequence equal to an end-group token (category code $2$); @@ -463,6 +440,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_a:n #1 { + \@@_disable:n { 32 } \int_set:Nn \tex_escapechar:D { 92 } \int_zero:N \l_@@_normal_int \int_zero:N \l_@@_index_int @@ -484,7 +462,7 @@ % \begin{macro}[int]{\@@_a_type:w} % At this point, \cs{l_@@_token} holds the meaning % of the following token. We store in \cs{l_@@_type_int} -% the meaning of the token ahead: +% information about the meaning of the token ahead: % \begin{itemize} % \item 0 space token; % \item 1 begin-group token; @@ -528,17 +506,18 @@ % \begin{macro}[int]{\@@_a_space:w} % \begin{macro}[aux]{\@@_a_space_test:w} % In this branch, the following token's meaning is a blank space. -% Apply \tn{string} to that token: if it is a control sequence -% the result starts with the escape character; otherwise it is -% a true blank space, whose string representation is also a blank space. -% We test for that in \cs{@@_a_space_test:w}, -% after grabbing as \cs{l_@@_char_token} the first character -% of the string representation. +% Apply \tn{string} to that token: a true blank space gives a space, a +% control sequence gives a result starting with the escape character, +% an active character gives something else than a space since we +% disabled the space. We grab as \cs{l_@@_char_token} the first +% character of the string representation then test it in +% \cs{@@_a_space_test:w}. % Also, since \cs{@@_a_store:} expects the special token to be % stored in the relevant \tn{toks} register, we do that. The extra % \cs{exp_not:n} is unnecessary of course, but it makes the treatment % of all tokens more homogeneous. % If we discover that the next token was actually a control sequence +% or an active character % instead of a true space, then we step the counter of normal tokens. % We now have in front of us the whole string representation of % the control sequence, including potential spaces; those will appear @@ -569,29 +548,29 @@ % \end{macro} % % \begin{macro}[int]{\@@_a_bgroup:w, \@@_a_egroup:w} -% \begin{macro}[aux]{\@@_a_group:nw} -% \begin{macro}[aux]{\@@_a_group_test:w} -% The token might be either a true character token with -% catcode $1$ or $2$, or it could be a control sequence. -% The only tricky case is if the character code happens -% to be equal to the escape character: then we change -% the escape character from backslash to solidus or back, -% so that the string representation of the true character -% and of a control sequence set equal to it start differently. -% Then probe what the first character of that string -% representation is: this is the place where we need -% \cs{l_@@_char_token} to be a separate control -% sequence from \cs{l_@@_token}, to compare them. +% \begin{macro}[aux] +% {\@@_a_group:nw, \@@_a_group_aux:w, \@@_a_group_auxii:w, \@@_a_group_test:w} +% The token is most likely a true character token with catcode $1$ or +% $2$, but it might be a control sequence, or an active character. +% Optimizing for the first case, we store in a toks register some code +% that expands to that token. Since we will turn what follows into +% a string, we make sure the escape character is different from the +% current character code (by switching between solidus and backslash). +% To detect the special case of an active character let to the catcode +% $1$ or~$2$ character with the same character code, we disable the +% active character with that character code and re-test: if the +% following token has become undefined we can in fact safely grab it. +% We are finally ready to turn what follows to a string and test it. +% This is one place where we need \cs{l_@@_char_token} to be a +% separate control sequence from \cs{l_@@_token}, to compare them. % \begin{macrocode} \group_begin: - \char_set_catcode_group_begin:N \^^@ - \char_set_catcode_group_end:N \^^E + \char_set_catcode_group_begin:N \^^@ % { \cs_new_protected:Npn \@@_a_bgroup:w - { \@@_a_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } } - \char_set_catcode_group_begin:N \^^B + { \@@_a_group:nw { \exp_after:wN ^^@ \if_false: } \fi: } } \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \@@_a_egroup:w - { \@@_a_group:nw { \if_false: ^^B \fi: ^^@ } } + { \@@_a_group:nw { \if_false: { \fi: ^^@ } } % } \group_end: \cs_new_protected:Npn \@@_a_group:nw #1 { @@ -600,6 +579,19 @@ \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } \fi: + \@@_disable:n { \tex_lccode:D 0 } + \tex_futurelet:D \l_@@_token \@@_a_group_aux:w + } +\cs_new_protected:Npn \@@_a_group_aux:w + { + \if_meaning:w \l_@@_token \tex_undefined:D + \exp_after:wN \@@_a_safe:N + \else: + \exp_after:wN \@@_a_group_auxii:w + \fi: + } +\cs_new_protected:Npn \@@_a_group_auxii:w + { \tex_afterassignment:D \@@_a_group_test:w \exp_after:wN \cs_set_eq:NN \exp_after:wN \l_@@_char_token @@ -617,7 +609,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}[int]{\@@_a_store:} % This function is called each time we meet a special token; @@ -643,17 +634,17 @@ % \item 2 space begin-group character. % \end{itemize} % This has the property that non-space characters correspond to odd -% values of \cs{l_@@_type_int}. -% The number of normal tokens, and the type of special token, -% are packed into a \tn{skip} register. -% Finally, we check whether we reached the last closing brace, in which -% case we stop by disabling the looping function (locally). +% values of \cs{l_@@_type_int}. The number of normal tokens until +% here and the type of special token are packed into a \tn{skip} +% register. Finally, we check whether we reached the last closing +% brace, in which case we stop by disabling the looping function +% (locally). % \begin{macrocode} \cs_new_protected:Npn \@@_a_store: { \tex_advance:D \l_@@_nesting_int \l_@@_type_int \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: - \tex_multiply:D \l_@@_type_int 2 \exp_stop_f: + \tex_advance:D \l_@@_type_int \l_@@_type_int \fi: \tex_skip:D \l_@@_index_int = \l_@@_normal_int sp plus \l_@@_type_int sp \scan_stop: @@ -669,11 +660,11 @@ % \begin{macro}[int]{\@@_a_safe:N} % \begin{macro}[aux]{\@@_a_cs:ww} % This should be the simplest case: since the upcoming token is safe, -% we can simply grab it in a second pass. However, other branches of -% the code must pass their tokens through \tn{string}, hence we do it -% here as well, with some optimizations. If the token is a single +% we can simply grab it in a second pass. If the token is a single % character (including space), the \cs{if_charcode:w} test yields -% true, and we simply count one \enquote{normal} token. On the other +% true; we disable a potentially active character (that could +% otherwise masquerade as the true character in the next pass) and we +% count one \enquote{normal} token. On the other % hand, if the token is a control sequence, we should replace it by % its string representation for compatibility with other code % branches. Instead of slowly looping through the characters with @@ -692,10 +683,15 @@ \scan_stop: \exp_after:wN \use_none:n \token_to_str:N #1 \prg_do_nothing: \scan_stop: - \int_incr:N \l_@@_normal_int + \exp_after:wN \use_i:nn \else: - \@@_cs_space_count:NN \@@_a_cs:ww #1 + \exp_after:wN \use_ii:nn \fi: + { + \@@_disable:n { `#1 } + \int_incr:N \l_@@_normal_int + } + { \@@_cs_space_count:NN \@@_a_cs:ww #1 } \@@_a_loop:w } \cs_new_protected:Npn \@@_a_cs:ww #1; #2; @@ -704,10 +700,10 @@ \tex_skip:D \l_@@_index_int = \__int_eval:w \l_@@_normal_int + 1 sp \scan_stop: \tex_advance:D \l_@@_index_int #1 \exp_stop_f: - \l_@@_normal_int #2 \exp_stop_f: \else: - \tex_advance:D \l_@@_normal_int #2 \exp_stop_f: + \tex_advance:D \fi: + \l_@@_normal_int #2 \exp_stop_f: } % \end{macrocode} % \end{macro} @@ -753,8 +749,9 @@ % character to a printable value). In both cases, we leave % \cs{exp_not:n} \Arg{token} \cs{s__tl} in the input stream % (after \texttt{x}-expansion). Here, \cs{exp_not:n} is used -% rather than \cs{exp_not:N} because |#3| could be \cs{s__tl}, -% hence must be hidden behind braces in the result. +% rather than \cs{exp_not:N} because |#3| could be +% a macro parameter character or could be \cs{s__tl} +% (which must be hidden behind braces in the result). % \begin{macrocode} \cs_new:Npn \@@_b_normals:ww #1; { @@ -861,7 +858,7 @@ \fi: \tex_the:D \tex_toks:D #1 \s__tl \if_case:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: - A + \token_to_str:N A \or: 1 \or: 1 \else: 2 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx index 06882053001..0b34405e188 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 82d13e8cb54..4d9390f0654 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1160,14 +1160,14 @@ \tex_ifodd:D \l@expl@enable@debug@bool \cs_new_protected:Npn \tl_set_eq:NN #1#2 { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 + \__debug_chk_var_exist:N #1 + \__debug_chk_var_exist:N #2 \cs_set_eq:NN #1 #2 } \cs_new_protected:Npn \tl_gset_eq:NN #1#2 { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 + \__debug_chk_var_exist:N #1 + \__debug_chk_var_exist:N #2 \cs_gset_eq:NN #1 #2 } \else: @@ -1186,20 +1186,20 @@ % three arguments must be checked: a token list |#2| or |#3| equal to % \cs{scan_stop:} would lead to problems later on. % \begin{macrocode} -\__debug_patch:nnNw +\__debug_patch:nnNNpn { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 + \__debug_chk_var_exist:N #1 + \__debug_chk_var_exist:N #2 + \__debug_chk_var_exist:N #3 } { } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } -\__debug_patch:nnNw +\__debug_patch:nnNNpn { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 + \__debug_chk_var_exist:N #1 + \__debug_chk_var_exist:N #2 + \__debug_chk_var_exist:N #3 } { } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 @@ -1252,25 +1252,25 @@ % which makes the token list registers provided by \TeX{} % more or less redundant. The \cs{tl_set:No} version is done % \enquote{by hand} as it is used quite a lot. Each definition is -% prefixed by a call to \cs{__debug_patch:nnNw} which adds an +% prefixed by a call to \cs{__debug_patch:nnNNpn} which adds an % existence check to the definition. % \begin{macrocode} -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } @@ -1295,28 +1295,28 @@ % } % Adding to the left is done directly to gain a little performance. % \begin{macrocode} -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } @@ -1345,28 +1345,28 @@ % } % The same on the right. % \begin{macrocode} -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } -\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } +\__debug_patch:nnNNpn { \__debug_chk_var_exist:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } @@ -2964,24 +2964,10 @@ % \begin{macro}[deprecated=2017-12-31]{\tl_to_lowercase:n, \tl_to_uppercase:n} % For removal after 2017-12-31. % \begin{macrocode} -\cs_new_protected:Npn \tl_to_lowercase:n #1 - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2017-12-31 } - { \token_to_str:N \tl_to_lowercase:n } - { } - \cs_gset_eq:NN \tl_to_lowercase:n \tex_lowercase:D - \tex_lowercase:D {#1} - } -\cs_new_protected:Npn \tl_to_uppercase:n #1 - { - \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } - { 2017-12-31 } - { \token_to_str:N \tl_to_uppercase:n } - { } - \cs_gset_eq:NN \tl_to_uppercase:n \tex_uppercase:D - \tex_uppercase:D {#1} - } +\__debug_deprecation:nnNNpn { 2017-12-31 } { \tex_lowercase:D } +\cs_new_protected:Npn \tl_to_lowercase:n #1 { \tex_lowercase:D {#1} } +\__debug_deprecation:nnNNpn { 2017-12-31 } { \tex_uppercase:D } +\cs_new_protected:Npn \tl_to_uppercase:n #1 { \tex_uppercase:D {#1} } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index ecbc69d46b4..fa14dede902 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1107,7 +1107,7 @@ % \cs{char_generate:nn} but omits various sanity tests. In particular, this % means it is used in certain places where engine variations need to be % accounted for by the kernel. The \meta{catcode} must give an explicit -% integer after a single expansion. +% integer when expanded (and must not absorb a space for instance). % \end{function} % % \end{documentation} @@ -1131,13 +1131,15 @@ % \begin{macro}{\char_show_value_catcode:n} % Simple wrappers around the primitives. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_catcode:nn #1#2 { \tex_catcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: - } + } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_catcode:n #1 - { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_catcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_catcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_catcode:n {#1} } } % \end{macrocode} @@ -1269,40 +1271,48 @@ % \begin{macro}{\char_show_value_sfcode:n} % Pretty repetitive, but necessary! % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_mathcode:nn #1#2 { \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_mathcode:n #1 - { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_mathcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_mathcode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_lccode:nn #1#2 { \tex_lccode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_lccode:n #1 - { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_lccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_lccode:n #1 { \__msg_show_wrap:n { > ~ \char_value_lccode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_uccode:nn #1#2 { \tex_uccode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_uccode:n #1 - { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_uccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_uccode:n #1 { \__msg_show_wrap:n { > ~ \char_value_uccode:n {#1} } } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new_protected:Npn \char_set_sfcode:nn #1#2 { \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: = \__int_eval:w #2 \__int_eval_end: } +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \char_value_sfcode:n #1 - { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: } + { \tex_the:D \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_show_value_sfcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_sfcode:n {#1} } } % \end{macrocode} @@ -1385,6 +1395,7 @@ % the interface layer, turn the two arguments into integers up-front so % this is only done once. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \char_generate:nn #1#2 { \exp:w \exp_after:wN \@@_generate_aux:w @@ -1395,8 +1406,7 @@ { \exp:w \exp_after:wN \@@_generate_aux:nnw \exp_after:wN - { \__int_value:w \__int_eval:w #1 \exp_after:wN } - {#2} \exp_end: + { \__int_value:w \__int_eval:w #1 } {#2} \exp_end: } % \end{macrocode} % Before doing any actual conversion, first some special case filtering. @@ -2250,61 +2260,53 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_true_remove:w { - \group_align_safe_end: \tex_afterassignment:D \@@_true_aux:w \cs_set_eq:NN \@@_tmp:w } % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\@@_token_generic:NN} -% The generic function stores the test token in both implicit and +% \begin{macro}{\@@_token_generic_aux:NNNTF} +% The generic functions store the test token in both implicit and % explicit modes, and the \texttt{true} and \texttt{false} code as % token lists, more or less. The two branches have to be absorbed here % as the input stream needs to be cleared for the peek function itself. +% Here, |#1| is \cs{@@_true_remove:w} when removing the token and +% \cs{@@_true_aux:w} otherwise. % \begin{macrocode} -\cs_new_protected:Npn \@@_token_generic:NNTF #1#2#3#4 +\cs_new_protected:Npn \@@_token_generic_aux:NNNTF #1#2#3#4#5 { - \cs_set_eq:NN \l_@@_search_token #2 - \tl_set:Nn \l_@@_search_tl {#2} - \cs_set:Npx \@@_true:w + \group_align_safe_begin: + \cs_set_eq:NN \l_@@_search_token #3 + \tl_set:Nn \l_@@_search_tl {#3} + \cs_set:Npx \@@_true_aux:w { \exp_not:N \group_align_safe_end: - \exp_not:n {#3} + \exp_not:n {#4} } + \cs_set_eq:NN \@@_true:w #1 \cs_set:Npx \@@_false:w { \exp_not:N \group_align_safe_end: - \exp_not:n {#4} + \exp_not:n {#5} } - \group_align_safe_begin: - \peek_after:Nw #1 + \peek_after:Nw #2 } -\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3 - { \@@_token_generic:NNTF #1 #2 {#3} { } } -\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3 - { \@@_token_generic:NNTF #1 #2 { } {#3} } % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\@@_token_remove_generic:NN} +% \begin{macro}[TF]{\@@_token_generic:NN, \@@_token_remove_generic:NN} % For token removal there needs to be a call to the auxiliary % function which does the work. % \begin{macrocode} -\cs_new_protected:Npn \@@_token_remove_generic:NNTF #1#2#3#4 - { - \cs_set_eq:NN \l_@@_search_token #2 - \tl_set:Nn \l_@@_search_tl {#2} - \cs_set_eq:NN \@@_true:w \@@_true_remove:w - \cs_set:Npx \@@_true_aux:w { \exp_not:n {#3} } - \cs_set:Npx \@@_false:w - { - \exp_not:N \group_align_safe_end: - \exp_not:n {#4} - } - \group_align_safe_begin: - \peek_after:Nw #1 - } +\cs_new_protected:Npn \@@_token_generic:NNTF + { \@@_token_generic_aux:NNNTF \@@_true_aux:w } +\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3 + { \@@_token_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3 + { \@@_token_generic:NNTF #1 #2 { } {#3} } +\cs_new_protected:Npn \@@_token_remove_generic:NNTF + { \@@_token_generic_aux:NNNTF \@@_true_remove:w } \cs_new_protected:Npn \@@_token_remove_generic:NNT #1#2#3 { \@@_token_remove_generic:NNTF #1 #2 {#3} { } } \cs_new_protected:Npn \@@_token_remove_generic:NNF #1#2#3 diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 7d93a5cad0e..abd41d41c05 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{l3keys2e}{Support package l3kernel too old} @@ -60,7 +60,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -131,7 +131,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2017/07/15}{} +\ProvidesExplPackage{l3keys2e}{2017/07/19}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx index f5af0b21774..1b0a6063dac 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{xfp}{Support package l3kernel too old} @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -143,7 +143,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2017/07/15}{} +\ProvidesExplPackage{xfp}{2017/07/19}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index 289e1932800..668a640a081 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{xfrac}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -533,7 +533,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2017/07/15}{} +\ProvidesExplPackage{xfrac}{2017/07/19}{} {L3 Experimental split-level fractions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 9f43230d35c..34826137abe 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{xparse}{Support package l3kernel too old} @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -131,15 +131,15 @@ % internal code surrounded by a brace pair. This is the \pkg{xparse} % type specifier for a normal \TeX{} argument. % \item[l] An argument which reads everything up to the first -% open group token: in standard \LaTeX{} this is a left brace. +% begin-group token: in standard \LaTeX{} this is a left brace. % \item[r] Reads a \enquote{required} delimited argument, where the -% delimiters are given as \meta{token1} and \meta{token2}: -% \texttt{r}\meta{token1}\meta{token2}. If the opening \meta{token} +% delimiters are given as \meta{char1} and \meta{char2}: +% \texttt{r}\meta{char1}\meta{char2}. If the opening \meta{character} % is missing, the default marker |-NoValue-| will be inserted after % a suitable error. % \item[R] As for \texttt{r}, this is a \enquote{required} delimited % argument but has a user-definable recovery \meta{default}, given -% as \texttt{R}\meta{token1}\meta{token2}\marg{default}. +% as \texttt{R}\meta{char1}\meta{char2}\marg{default}. % \item[u] Reads an argument \enquote{until} \meta{tokens} are encountered, % where the desired \meta{tokens} are given as an argument to the % specifier: \texttt{u}\marg{tokens}. @@ -158,35 +158,35 @@ % \item[o] A standard \LaTeX{} optional argument, surrounded with square % brackets, which will supply % the special |-NoValue-| marker if not given (as described later). -% \item[d] An optional argument which is delimited by \meta{token1} -% and \meta{token2}, which are given as arguments: -% \texttt{d}\meta{token1}\meta{token2}. As with \texttt{o}, if no +% \item[d] An optional argument which is delimited by \meta{char1} +% and \meta{char2}, given as follows: +% \texttt{d}\meta{char1}\meta{char2}. As with \texttt{o}, if no % value is given the special marker |-NoValue-| is returned. % \item[O] As for \texttt{o}, but returns \meta{default} if no % value is given. Should be given as \texttt{O}\marg{default}. % \item[D] As for \texttt{d}, but returns \meta{default} if no -% value is given: \texttt{D}\meta{token1}\meta{token2}\marg{default}. +% value is given: \texttt{D}\meta{char1}\meta{char2}\marg{default}. % Internally, the \texttt{o}, \texttt{d} and \texttt{O} types are % short-cuts to an appropriated-constructed \texttt{D} type argument. % \item[s] An optional star, which will result in a value % \cs{BooleanTrue} if a star is present and \cs{BooleanFalse} % otherwise (as described later). -% \item[t] An optional \meta{token}, which will result in a value -% \cs{BooleanTrue} if \meta{token} is present and \cs{BooleanFalse} -% otherwise. Given as \texttt{t}\meta{token}. +% \item[t] An optional \meta{char}, which will result in a value +% \cs{BooleanTrue} if \meta{char} is present and \cs{BooleanFalse} +% otherwise. Given as \texttt{t}\meta{char}. % \item[g] An optional argument given inside a pair of \TeX{} group % tokens (in standard \LaTeX, |{| \ldots |}|), which returns % |-NoValue-| if not present. % \item[G] As for \texttt{g} but returns \meta{default} if no value % is given: \texttt{G}\marg{default}. % \item[e] A set of optional \emph{embellishments}, each of which -% requires a \emph{value}: \texttt{e}\marg{tokens}. If an +% requires a \emph{value}: \texttt{e}\marg{chars}. If an % embellishment is not present, |-NoValue-| is returned. Each % embellishment gives one argument, ordered as for the list of -% \meta{tokens} in the argument specification. All \meta{tokens} +% \meta{chars} in the argument specification. All \meta{chars} % must be distinct. \emph{This is an experimental type}. % \item[E] As for \texttt{e} but returns one or more \meta{defaults} -% if values are not given: \texttt{E}\marg{tokens}\marg{defaults}. See +% if values are not given: \texttt{E}\marg{chars}\marg{defaults}. See % Section~\ref{sec:embellishment} for more details. % \end{itemize} % @@ -235,14 +235,14 @@ % \foobaz[ {abc}] % => " {abc}" % \end{verbatim} % -% Two more tokens have a special meaning when creating an argument +% Two more characters have a special meaning when creating an argument % specifier. First, \texttt{+} is used to make an argument long (to % accept paragraph tokens). In contrast to \LaTeXe's \cs{newcommand}, % this applies on an argument-by-argument basis. So modifying the % example to `|s o o +m O{default}|' means that the mandatory argument % is now \cs{long}, whereas the optional arguments are not. % -% Secondly, the token \texttt{>} is used to declare so-called +% Secondly, the character \texttt{>} is used to declare so-called % \enquote{argument processors}, which can be used to modify the contents of an % argument before it is passed to the macro definition. The use of % argument processors is a somewhat advanced topic, (or at least a less @@ -354,20 +354,20 @@ % \subsection{Default values for \enquote{embellishments}} % \label{sec:embellishment} % -% The \texttt{E}-type argument allows one default value per test token. +% The \texttt{E}-type argument allows one default value per test character. % This is achieved by giving a list of defaults for each entry in the % list, for example: % \begin{verbatim} % E{^_}{{UP}{DOWN}} % \end{verbatim} -% If the list of default values is \emph{shorter} than the list of test tokens, -% the special \cs{NoValue} marker will be returned (as for the \texttt{e}-type +% If the list of default values is \emph{shorter} than the list of test characters, +% the special |-NoValue-| marker will be returned (as for the \texttt{e}-type % argument). Thus for example % \begin{verbatim} % E{^_}{{UP}} % \end{verbatim} -% has default \texttt{UP} for the |^| test token, but will return the -% \cs{NoValue} marker as a default for |_|. This allows mixing of explicit +% has default \texttt{UP} for the |^| test character, but will return the +% |-NoValue-| marker as a default for |_|. This allows mixing of explicit % defaults with testing for missing values. % % \subsection{Declaring commands and environments} @@ -514,7 +514,7 @@ % % \begin{variable}{\BooleanFalse, \BooleanTrue} % The \texttt{true} and \texttt{false} flags set when searching for -% an optional token (using \texttt{s} or \texttt{t\meta{token}}) have +% an optional character (using \texttt{s} or \texttt{t\meta{char}}) have % names which are accessible outside of code blocks. % \end{variable} % @@ -545,7 +545,7 @@ % processor can therefore be used to regularise input at an early stage, % allowing the internal functions to be completely independent of input % form. Processors are applied to user input and to default values for -% optional arguments, but \emph{not} to the special \cs{NoValue} marker. +% optional arguments, but \emph{not} to the special |-NoValue-| marker. % % Each argument processor is specified by the syntax % \texttt{>}\marg{processor} in the argument specification. Processors @@ -593,7 +593,7 @@ % input. The processed input is placed inside % $\text{\meta{number}} + 1$ sets of braces for further use. % If there are fewer than \Arg{number} of \Arg{tokens} in the argument -% then \cs{NoValue} markers are added at the end of the processed +% then |-NoValue-| markers are added at the end of the processed % argument. % \begin{verbatim} % \NewDocumentCommand \foo @@ -776,7 +776,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2017/07/15}{} +\ProvidesExplPackage{xparse}{2017/07/19}{} {L3 Experimental document command parser} % \end{macrocode} % @@ -1487,7 +1487,7 @@ % The first thing that is done in the loop is to check that the various % argument types have the correct number of data items associated with % them. The opportunity is also taken to make sure that where a single -% token is required, one has actually been supplied. +% character is required, one has actually been supplied. % % The second is that processors and the marker~|+| for long arguments % must be followed by arguments. @@ -1667,10 +1667,10 @@ % } % \begin{macro}[aux]{\@@_normalize_E_unique_check:w} % Optional argument types. Check that all required data is present -% (and consists of single tokens if applicable) and check for +% (and consists of single characters if applicable) and check for % forbidden types for expandable commands. For \texttt{E}-type % require that there is at least one embellishment, that each one is a -% single token, and that there aren't more optional arguments than +% single character, and that there aren't more optional arguments than % embellishments; also remember that each embellishment counts as one % argument for \cs{l_@@_current_arg_int}. Then in each case % store the data in \cs{l_@@_arg_spec_tl}, and @@ -1680,9 +1680,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_normalize_type_D:w #1#2#3 { - \@@_single_token_check:n {#1} - \@@_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \@@_single_char_check:n {#1} + \@@_single_char_check:n {#2} \@@_add_arg_spec:n { D #1 #2 {#3} } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} \bool_set_false:N \l_@@_grab_expandably_bool @@ -1692,7 +1692,7 @@ { \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn } \tl_if_blank:nT {#1} { \@@_bad_arg_spec:wn } - \tl_map_function:nN {#1} \@@_single_token_check:n + \tl_map_function:nN {#1} \@@_single_char_check:n \@@_normalize_E_unique_check:w #1 \q_nil \q_stop \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } { \@@_bad_arg_spec:wn } @@ -1720,8 +1720,8 @@ } \cs_new_protected:Npn \@@_normalize_type_t:w #1 { - \@@_single_token_check:n {#1} \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } + \@@_single_char_check:n {#1} \tl_put_right:Nn \l_@@_arg_spec_tl { t #1 } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} \bool_set_false:N \l_@@_grab_expandably_bool @@ -1741,7 +1741,7 @@ % \@@_normalize_type_v:w % } % Mandatory arguments. First check the required data is present, -% consists of single tokens where applicable, and that the argument +% consists of single characters where applicable, and that the argument % type is allowed for expandable commands if applicable. For the % \texttt{m} and \texttt{R} argument types check that they do not % follow some optional argument with that delimiter as otherwise the @@ -1767,9 +1767,9 @@ } \cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3 { - \@@_single_token_check:n {#1} - \@@_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \@@_single_char_check:n {#1} + \@@_single_char_check:n {#2} \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } \@@_add_arg_spec:n { R #1 #2 {#3} } \int_incr:N \l_@@_mandatory_args_int @@ -1797,15 +1797,26 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_single_token_check:n} -% A spin-out function to check that what should be single tokens really -% are single tokens. +% \begin{macro}{\@@_single_char_check:n} +% Checks that what should be single characters really are single +% characters (possibly surrounded by spaces). % \begin{macrocode} -\cs_new_protected:Npn \@@_single_token_check:n #1 +\cs_new_protected:Npn \@@_single_char_check:n #1 { - \exp_args:Nx \tl_if_single_token:nF { \tl_trim_spaces:n {#1} } + \exp_args:Nx \tl_if_single_token:nTF { \tl_trim_spaces:n {#1} } { - \__msg_kernel_error:nnxx { xparse } { not-single-token } + \group_begin: + \tex_escapechar:D = 92 \scan_stop: + \exp_args:Nx \tl_if_single_token:nF + { \exp_args:No \tl_to_str:n { \use:nn #1 { } } } + { + \__msg_kernel_warning:nnxx { xparse } { not-single-char } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + } + \group_end: + } + { + \__msg_kernel_error:nnxx { xparse } { not-single-char } { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } \@@_bad_def:wn } @@ -1887,18 +1898,17 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_add_arg_spec:n #1 { - \bool_if:NF \l_@@_long_bool + \bool_lazy_and:nnT + { ! \l_@@_long_bool } + { \l_@@_some_long_bool } { - \bool_if:NT \l_@@_some_long_bool + \bool_if:NT \l_@@_expandable_bool { - \bool_if:NT \l_@@_expandable_bool - { - \__msg_kernel_error:nnx { xparse } { inconsistent-long } - { \iow_char:N \\ \l_@@_function_tl } - \@@_bad_def:wn - } - \bool_set_false:N \l_@@_grab_expandably_bool + \__msg_kernel_error:nnx { xparse } { inconsistent-long } + { \iow_char:N \\ \l_@@_function_tl } + \@@_bad_def:wn } + \bool_set_false:N \l_@@_grab_expandably_bool } \bool_if:NTF \l_@@_long_bool { \bool_set_true:N \l_@@_some_long_bool } @@ -4140,12 +4150,15 @@ \\ \\ LaTeX~will~ignore~this~entire~definition. } -\__msg_kernel_new:nnnn { xparse } { not-single-token } - { Argument~delimiter~'#2'~for~the~command~'#1'~should~be~a~single~token. } +\__msg_kernel_new:nnnn { xparse } { not-single-char } + { + Argument~delimiter~'#2'~for~the~command~'#1'~should~be~ + a~single~character. + } { \c__msg_coding_error_text_tl - The~argument~specification~provided~was~not~valid:~ - in~a~place~where~a~single~token~is~required,~LaTeX~found~'#2'. \\ \\ + The~argument~specification~provided~was~not~valid:~in~a~place~ + where~a~single~character~is~required,~LaTeX~found~'#2'. \\ \\ LaTeX~will~ignore~this~entire~definition. } \__msg_kernel_new:nnnn { xparse } { processor-in-expandable } diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 6e02cb5befd..8a472f07df9 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/07/15] -%<package>\@ifpackagelater{expl3}{2017/07/15} +\RequirePackage{expl3}[2017/07/19] +%<package>\@ifpackagelater{expl3}{2017/07/19} %<package> {} %<package> {% %<package> \PackageError{xtemplate}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -682,7 +682,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2017/07/15}{} +\ProvidesExplPackage{xtemplate}{2017/07/19}{} {L3 Experimental prototype document functions} % \end{macrocode} % |