[latex3-commits] [git/LaTeX3-latex3-latex2e] misused-replacing-args: \@@_replacing_args_unset: -> reset (793a5155)
PhelypeOleinik
phelype.oleinik at latex-project.org
Mon Apr 17 02:25:00 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : misused-replacing-args
Link : https://github.com/latex3/latex2e/commit/793a5155dc9883229dc3e854adfa08214fc5f35c
>---------------------------------------------------------------
commit 793a5155dc9883229dc3e854adfa08214fc5f35c
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sun Apr 16 21:25:00 2023 -0300
\@@_replacing_args_unset: -> reset
Stack approach so that occasional nesting doesn't blow up
>---------------------------------------------------------------
793a5155dc9883229dc3e854adfa08214fc5f35c
base/lthooks.dtx | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index e4716c3f..83ddd01e 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -3500,13 +3500,13 @@
{
\@@_replacing_args_false:
\@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} {#3}
- \@@_replacing_args_unset:
+ \@@_replacing_args_reset:
}
\cs_new_protected:Npn \hook_gput_code_with_args:nnn #1 #2 #3
{
\@@_replacing_args_true:
\@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} {#3}
- \@@_replacing_args_unset:
+ \@@_replacing_args_reset:
}
% \end{macrocode}
%
@@ -5125,8 +5125,8 @@
{ \@@_replacing_args_false: }
{ \@@_replacing_args_true: }
\@@_update_hook_code:n {##1}
+ \@@_replacing_args_reset:
}
- \@@_replacing_args_unset:
% \end{macrocode}
% If we are debugging we show results hook by hook for all hooks
% that have data.
@@ -6237,13 +6237,13 @@
{
\@@_replacing_args_false:
\@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} {#2}
- \@@_replacing_args_unset:
+ \@@_replacing_args_reset:
}
\cs_new_protected:Npn \hook_gput_next_code_with_args:nn #1 #2
{
\@@_replacing_args_true:
\@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} {#2}
- \@@_replacing_args_unset:
+ \@@_replacing_args_reset:
}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2020/10/01}{\hook_gput_next_code:nn}
@@ -6627,7 +6627,7 @@
% \begin{macrocode}
\@@_replacing_args_false:
\@@_cs_gput_right:nnn { _next } {#1} { \@@_use_once_clear:n {#1} }
- \@@_replacing_args_unset:
+ \@@_replacing_args_reset:
\@@_if_usable:nTF {#1}
{ \@@_use_initialized:n {#1} }
{
@@ -6913,26 +6913,37 @@
% \begin{macro}[EXP]{\@@_misused_if_replacing_args:nn}
% \begin{macro}{\@@_replacing_args_true:}
% \begin{macro}{\@@_replacing_args_false:}
-% \begin{macro}{\@@_replacing_args_unset:}
+% \begin{macro}{\@@_replacing_args_reset:}
+% \begin{macro}{\g_@@_replacing_stack_seq}
% An internal conditional that checks if the code being added to the
% hook contains arguments.
% \changes{v1.1a}{2023/04/06}
% {Macro added (hook-args).}
% \begin{macrocode}
+\seq_new:N \g_@@_replacing_stack_seq
\cs_new:Npn \@@_misused_if_replacing_args:nn #1 #2
{
\msg_expandable_error:nnn { latex2e } { should-not-happen }
{ Misused~\@@_if_replacing_args:. }
}
-\cs_new_eq:NN \@@_if_replacing_args:TF \@@_misused_if_replacing_args:nn
+\cs_new:Npn \@@_if_replacing_args:TF
+ { \@@_misused_if_replacing_args:nn }
\cs_new_protected:Npn \@@_replacing_args_true:
- { \cs_set_eq:NN \@@_if_replacing_args:TF \use_i:nn }
+ {
+ \seq_gpush:No \g_@@_replacing_stack_seq
+ { \@@_if_replacing_args:TF }
+ \cs_set:Npn \@@_if_replacing_args:TF { \use_i:nn }
+ }
\cs_new_protected:Npn \@@_replacing_args_false:
- { \cs_set_eq:NN \@@_if_replacing_args:TF \use_ii:nn }
-\cs_new_protected:Npn \@@_replacing_args_unset:
{
- \cs_set_eq:NN \@@_if_replacing_args:TF
- \@@_misused_if_replacing_args:nn
+ \seq_gpush:No \g_@@_replacing_stack_seq
+ { \@@_if_replacing_args:TF }
+ \cs_set:Npn \@@_if_replacing_args:TF { \use_ii:nn }
+ }
+\cs_new_protected:Npn \@@_replacing_args_reset:
+ {
+ \seq_gpop:NN \g_@@_replacing_stack_seq \l_@@_return_tl
+ \cs_gset_eq:NN \@@_if_replacing_args:TF \l_@@_return_tl
}
% \end{macrocode}
% \end{macro}
@@ -6940,6 +6951,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Messages}
%
More information about the latex3-commits
mailing list.