diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3skip.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index fa2b011f990..0e8636b4402 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2021-05-11} +% \date{Released 2021-05-25} % % \maketitle % @@ -1129,7 +1129,7 @@ \cs_new_protected:Npn \dim_const:Nn #1#2 { \dim_new:N #1 - \tex_global:D #1 ~ \dim_eval:n {#2} \scan_stop: + \tex_global:D #1 = \dim_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \dim_const:Nn { c } % \end{macrocode} @@ -1139,11 +1139,12 @@ % \begin{macro}{\dim_gzero:N, \dim_gzero:c} % 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). +% \LaTeXe{} length). Besides, these functions are then simply copied +% for \cs{skip_zero:N} and related functions. % \begin{macrocode} -\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_skip } +\cs_new_protected:Npn \dim_zero:N #1 { #1 = \c_zero_skip } \cs_new_protected:Npn \dim_gzero:N #1 - { \tex_global:D #1 \c_zero_skip } + { \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} @@ -1184,9 +1185,9 @@ % length). % \begin{macrocode} \cs_new_protected:Npn \dim_set:Nn #1#2 - { #1 ~ \@@_eval:w #2 \@@_eval_end: \scan_stop: } + { #1 = \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gset:Nn #1#2 - { \tex_global:D #1 ~ \@@_eval:w #2 \@@_eval_end: \scan_stop: } + { \tex_global:D #1 = \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_set:Nn { c } \cs_generate_variant:Nn \dim_gset:Nn { c } % \end{macrocode} @@ -1213,27 +1214,27 @@ % \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|. +% Using |by| here would slow things down just to detect nonsensical +% cases such as passing |\dimen 123| as the first argument. % 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 -% \cs{@@_tmp:w}. +% the local versions. % \begin{macrocode} \cs_new_protected:Npn \dim_add:Nn #1#2 - { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: \scan_stop: } + { \tex_advance:D #1 \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gadd:Nn #1#2 { - \tex_global:D \tex_advance:D #1 by + \tex_global:D \tex_advance:D #1 \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } \cs_new_protected:Npn \dim_sub:Nn #1#2 - { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: \scan_stop: } + { \tex_advance:D #1 - \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_new_protected:Npn \dim_gsub:Nn #1#2 { - \tex_global:D \tex_advance:D #1 by + \tex_global:D \tex_advance:D #1 -\@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_sub:Nn { c } @@ -1642,13 +1643,9 @@ % \end{macro} % % \begin{macro}{\dim_use:N, \dim_use:c} -% Accessing a \meta{dim}. +% Accessing a \meta{dim}. We hand-code the |c| variant for some speed gain. % \begin{macrocode} \cs_new_eq:NN \dim_use:N \tex_the:D -% \end{macrocode} -% We hand-code this for some speed gain: -% \begin{macrocode} -%\cs_generate_variant:Nn \dim_use:N { c } \cs_new:Npn \dim_use:c #1 { \tex_the:D \cs:w #1 \cs_end: } % \end{macrocode} % \end{macro} @@ -1673,7 +1670,7 @@ ##1 . ##2 \tl_to_str:n { pt } } { - \int_compare:nNnTF {#2} > { 0 } + \int_compare:nNnTF {#2} > \c_zero_int { #1 . #2 } { #1 } } @@ -1808,7 +1805,7 @@ \cs_new_protected:Npn \skip_const:Nn #1#2 { \skip_new:N #1 - \tex_global:D #1 ~ \skip_eval:n {#2} \scan_stop: + \tex_global:D #1 = \skip_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \skip_const:Nn { c } % \end{macrocode} @@ -1818,8 +1815,8 @@ % \begin{macro}{\skip_gzero:N, \skip_gzero:c} % Reset the register to zero. % \begin{macrocode} -\cs_new_protected:Npn \skip_zero:N #1 { #1 \c_zero_skip } -\cs_new_protected:Npn \skip_gzero:N #1 { \tex_global:D #1 \c_zero_skip } +\cs_new_eq:NN \skip_zero:N \dim_zero:N +\cs_new_eq:NN \skip_gzero:N \dim_gzero:N \cs_generate_variant:Nn \skip_zero:N { c } \cs_generate_variant:Nn \skip_gzero:N { c } % \end{macrocode} @@ -1856,9 +1853,9 @@ % Much the same as for dimensions. % \begin{macrocode} \cs_new_protected:Npn \skip_set:Nn #1#2 - { #1 ~ \tex_glueexpr:D #2 \scan_stop: } + { #1 = \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gset:Nn #1#2 - { \tex_global:D #1 ~ \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D #1 = \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_set:Nn { c } \cs_generate_variant:Nn \skip_gset:Nn { c } % \end{macrocode} @@ -1886,15 +1883,15 @@ % Using |by| here deals with the (incorrect) case |\skip123|. % \begin{macrocode} \cs_new_protected:Npn \skip_add:Nn #1#2 - { \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } + { \tex_advance:D #1 \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_add:Nn { c } \cs_generate_variant:Nn \skip_gadd:Nn { c } \cs_new_protected:Npn \skip_sub:Nn #1#2 - { \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } + { \tex_advance:D #1 - \tex_glueexpr:D #2 \scan_stop: } \cs_new_protected:Npn \skip_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 - \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_sub:Nn { c } \cs_generate_variant:Nn \skip_gsub:Nn { c } % \end{macrocode} @@ -1911,7 +1908,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF } { - \str_if_eq:eeTF { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } + \str_if_eq:eeTF { \skip_eval:n {#1} } { \skip_eval:n {#2} } { \prg_return_true: } { \prg_return_false: } } @@ -1956,9 +1953,8 @@ % \begin{macro}{\skip_use:N, \skip_use:c} % Accessing a \meta{skip}. % \begin{macrocode} -\cs_new_eq:NN \skip_use:N \tex_the:D -%\cs_generate_variant:Nn \skip_use:N { c } -\cs_new:Npn \skip_use:c #1 { \tex_the:D \cs:w #1 \cs_end: } +\cs_new_eq:NN \skip_use:N \dim_use:N +\cs_new_eq:NN \skip_use:c \dim_use:c % \end{macrocode} % \end{macro} % @@ -2055,7 +2051,7 @@ \cs_new_protected:Npn \muskip_const:Nn #1#2 { \muskip_new:N #1 - \tex_global:D #1 ~ \muskip_eval:n {#2} \scan_stop: + \tex_global:D #1 = \muskip_eval:n {#2} \scan_stop: } \cs_generate_variant:Nn \muskip_const:Nn { c } % \end{macrocode} @@ -2066,9 +2062,9 @@ % Reset the register to zero. % \begin{macrocode} \cs_new_protected:Npn \muskip_zero:N #1 - { #1 \c_zero_muskip } + { #1 = \c_zero_muskip } \cs_new_protected:Npn \muskip_gzero:N #1 - { \tex_global:D #1 \c_zero_muskip } + { \tex_global:D #1 = \c_zero_muskip } \cs_generate_variant:Nn \muskip_zero:N { c } \cs_generate_variant:Nn \muskip_gzero:N { c } % \end{macrocode} @@ -2108,9 +2104,9 @@ % This should be pretty familiar. % \begin{macrocode} \cs_new_protected:Npn \muskip_set:Nn #1#2 - { #1 ~ \tex_muexpr:D #2 \scan_stop: } + { #1 = \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gset:Nn #1#2 - { \tex_global:D #1 ~ \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D #1 = \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_set:Nn { c } \cs_generate_variant:Nn \muskip_gset:Nn { c } % \end{macrocode} @@ -2144,15 +2140,15 @@ % Using |by| here deals with the (incorrect) case |\muskip123|. % \begin{macrocode} \cs_new_protected:Npn \muskip_add:Nn #1#2 - { \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } + { \tex_advance:D #1 \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_add:Nn { c } \cs_generate_variant:Nn \muskip_gadd:Nn { c } \cs_new_protected:Npn \muskip_sub:Nn #1#2 - { \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } + { \tex_advance:D #1 - \tex_muexpr:D #2 \scan_stop: } \cs_new_protected:Npn \muskip_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } + { \tex_global:D \tex_advance:D #1 - \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_sub:Nn { c } \cs_generate_variant:Nn \muskip_gsub:Nn { c } % \end{macrocode} @@ -2174,8 +2170,8 @@ % \begin{macro}{\muskip_use:N, \muskip_use:c} % Accessing a \meta{muskip}. % \begin{macrocode} -\cs_new_eq:NN \muskip_use:N \tex_the:D -\cs_generate_variant:Nn \muskip_use:N { c } +\cs_new_eq:NN \muskip_use:N \dim_use:N +\cs_new_eq:NN \muskip_use:c \dim_use:c % \end{macrocode} % \end{macro} % |