diff --git a/l3kernel/l3skip.dtx b/l3kernel/l3skip.dtx index 991916eae2..348ac29882 100644 --- a/l3kernel/l3skip.dtx +++ b/l3kernel/l3skip.dtx @@ -1075,12 +1075,15 @@ % % \begin{macro}{\dim_zero:N, \dim_zero:c} % \begin{macro}{\dim_gzero:N, \dim_gzero:c} -% Reset the register to zero. +% Reset the register to zero. Using \cs{c_zero_skip} deals with the +% case where the variable passed is incorrectly a skip (for example a +% \LaTeXe{} length). % \begin{macrocode} \__debug_patch:nnNNpn { \__debug_chk_var_local:N #1 } { } -\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_dim } +\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_skip } \__debug_patch:nnNNpn { \__debug_chk_var_global:N #1 } { } -\cs_new_protected:Npn \dim_gzero:N #1 { \tex_global:D #1 \c_zero_dim } +\cs_new_protected:Npn \dim_gzero:N #1 + { \tex_global:D #1 \c_zero_skip } \cs_generate_variant:Nn \dim_zero:N { c } \cs_generate_variant:Nn \dim_gzero:N { c } % \end{macrocode} @@ -1132,7 +1135,7 @@ % \begin{macro}{\dim_gset:Nn, \dim_gset:cn} % Setting dimensions is easy enough but when debugging we want both to % check that the variable is correctly local/global and to wrap the -% expression in some code. The |\scan_stop:| deals with the case +% expression in some code. The \cs{scan_stop:} deals with the case % where the variable passed is a skip (for example a \LaTeXe{} % length). % \begin{macrocode} @@ -1151,14 +1154,17 @@ % \begin{macro}{\dim_set_eq:NN, \dim_set_eq:cN, \dim_set_eq:Nc, \dim_set_eq:cc} % \begin{macro} % {\dim_gset_eq:NN, \dim_gset_eq:cN, \dim_gset_eq:Nc, \dim_gset_eq:cc} -% All straightforward. +% All straightforward, with a \cs{scan_stop:} to deal with the case +% where |#1| is (incorrectly) a skip. % \begin{macrocode} \__debug_patch:nnNNpn { \__debug_chk_var_local:N #1 } { } -\cs_new_protected:Npn \dim_set_eq:NN #1#2 { #1 = #2 } +\cs_new_protected:Npn \dim_set_eq:NN #1#2 + { #1 = #2 \scan_stop: } \cs_generate_variant:Nn \dim_set_eq:NN { c } \cs_generate_variant:Nn \dim_set_eq:NN { Nc , cc } \__debug_patch:nnNNpn { \__debug_chk_var_global:N #1 } { } -\cs_new_protected:Npn \dim_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } +\cs_new_protected:Npn \dim_gset_eq:NN #1#2 + { \tex_global:D #1 = #2 \scan_stop: } \cs_generate_variant:Nn \dim_gset_eq:NN { c } \cs_generate_variant:Nn \dim_gset_eq:NN { Nc , cc } % \end{macrocode} @@ -1169,7 +1175,8 @@ % \begin{macro}{\dim_gadd:Nn, \dim_gadd:cn} % \begin{macro}{\dim_sub:Nn, \dim_sub:cn} % \begin{macro}{\dim_gsub:Nn, \dim_gsub:cn} -% Using |by| here deals with the (incorrect) case |\dimen123|. Since +% Using |by| here deals with the (incorrect) case |\dimen123|. +% Using \cs{scan_stop:} deals with skip variables. Since % debugging checks that the variable is correctly local/global, the % global versions cannot be defined as \cs{tex_global:D} followed by % the local versions. The debugging code is inserted by @@ -1177,18 +1184,18 @@ % \begin{macrocode} \@@_tmp:w \__debug_chk_var_local:N \cs_new_protected:Npn \dim_add:Nn #1#2 - { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } + { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: \scan_stop: } \@@_tmp:w \__debug_chk_var_global:N \cs_new_protected:Npn \dim_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } + { \tex_global:D \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } \@@_tmp:w \__debug_chk_var_local:N \cs_new_protected:Npn \dim_sub:Nn #1#2 - { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } + { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: \scan_stop: } \@@_tmp:w \__debug_chk_var_global:N \cs_new_protected:Npn \dim_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } + { \tex_global:D \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_sub:Nn { c } \cs_generate_variant:Nn \dim_gsub:Nn { c } % \end{macrocode}