diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-30 22:39:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-30 22:39:09 +0000 |
commit | a28e1bfccd6fe522fcd296426e4d89c7fb4f19b6 (patch) | |
tree | b72347e08575b56fcfed87c4d837b48dcfd1e02a /Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | |
parent | b40c37a9e22b8235ff9c0bc256d00f7af94304c3 (diff) |
l3 (30apr18)
git-svn-id: svn://tug.org/texlive/trunk@47516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3skip.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 250f71b65ce..4dd819ce073 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 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -1042,33 +1042,6 @@ % \end{texnote} % \end{function} % -% \section{Internal functions} -% -% \begin{function}[EXP]{\__dim_eval:w, \__dim_eval_end:} -% \begin{syntax} -% \cs{__dim_eval:w} \meta{dimexpr} \cs{__dim_eval_end:} -% \end{syntax} -% Evaluates \meta{dimension expression} as described for \cs{dim_eval:n}. -% The evaluation stops when an unexpandable token which is not a valid -% part of a dimension is read or when \cs{__dim_eval_end:} is -% reached. The latter is gobbled by the scanner mechanism: -% \cs{__dim_eval_end:} itself is unexpandable but used correctly -% the entire construct is expandable. -% \begin{texnote} -% This is the \eTeX{} primitive \tn{dimexpr}. -% \end{texnote} -% \end{function} -% -% \begin{function}[EXP]{\__dim_eval:n} -% \begin{syntax} -% \cs{__dim_eval:n} \Arg{dimexpr} -% \end{syntax} -% By default this expands to \cs{__dim_eval:w} \meta{dimexpr} -% \cs{__dim_eval_end:} but when debugging is enabled this expands to a -% more complicated construction that evaluates \meta{dimexpr} with -% parentheses and within a brace group to detect early termination. -% \end{function} -% % \end{documentation} % % \begin{implementation} @@ -1106,7 +1079,7 @@ %<*package> \cs_new_protected:Npn \dim_new:N #1 { - \__chk_if_free_cs:N #1 + \__kernel_chk_if_free_cs:N #1 \cs:w newdimen \cs_end: #1 } %</package> @@ -1244,7 +1217,10 @@ { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: \scan_stop: } \@@_tmp:w \__kernel_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: \scan_stop: } + { + \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 \__kernel_chk_var_local:N @@ -1252,7 +1228,10 @@ { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: \scan_stop: } \@@_tmp:w \__kernel_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: \scan_stop: } + { + \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} @@ -1328,13 +1307,13 @@ % \begin{macro}{\@@_ratio:n} % With dimension expressions, something like |10 pt * ( 5 pt / 10 pt )| does % not work. Instead, the ratio part needs to be converted to an integer -% expression. Using \cs{__int_value:w} forces everything into |sp|, avoiding +% expression. Using \cs{int_value:w} forces everything into |sp|, avoiding % any decimal parts. % \begin{macrocode} \cs_new:Npn \dim_ratio:nn #1#2 { \@@_ratio:n {#1} / \@@_ratio:n {#2} } \cs_new:Npn \@@_ratio:n #1 - { \__int_value:w \@@_eval:w (#1) \@@_eval_end: } + { \int_value:w \@@_eval:w (#1) \@@_eval_end: } % \end{macrocode} % \end{macro} % \end{macro} @@ -1367,10 +1346,11 @@ % \@@_compare_<:w, % \@@_compare_>:w % } +% \begin{macro}{\@@_compare_error:} % This code is adapted from the \cs{int_compare:nTF} function. First % make sure that there is at least one relation operator, by % evaluating a dimension expression with a trailing -% \cs{__prg_compare_error:}. Just like for integers, the looping +% \cs{@@_compare_error:}. Just like for integers, the looping % auxiliary \cs{@@_compare:wNN} closes a primitive conditional and % opens a new one. It is actually easier to grab a dimension operand % than an integer one, because once evaluated, dimensions all end with @@ -1381,9 +1361,9 @@ \prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF } { \exp_after:wN \@@_compare:w - \dim_use:N \@@_eval:w #1 \__prg_compare_error: + \dim_use:N \@@_eval:w #1 \@@_compare_error: } -\cs_new:Npn \@@_compare:w #1 \__prg_compare_error: +\cs_new:Npn \@@_compare:w #1 \@@_compare_error: { \exp_after:wN \if_false: \exp:w \exp_end_continue_f:w \@@_compare:wNN #1 ? { = \@@_compare_end:w \else: } \q_stop @@ -1412,10 +1392,17 @@ #1 \reverse_if:N #2 > #3 = { #1 #2 < #3 } \cs_new:Npn \@@_compare_end:w #1 \prg_return_false: #2 \q_stop { #1 \prg_return_false: \else: \prg_return_true: \fi: } +\cs_new_protected:Npn \@@_compare_error: + { + \if_int_compare:w \c_zero \c_zero \fi: + = + \@@_compare_error: + } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[EXP, noTF]{\dim_case:nn} % \begin{macro}{\@@_case:nnTF} @@ -1452,7 +1439,8 @@ { \@@_case_end:nw {#3} } { \@@_case:nw {#1} } } -\cs_new_eq:NN \@@_case_end:nw \__prg_case_end:nw +\cs_new:Npn \@@_case_end:nw #1#2#3 \q_mark #4#5 \q_stop + { \exp_end: #1 #4 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1555,9 +1543,18 @@ % \begin{macrocode} \__kernel_patch_args:nNNpn { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_step_function:nnnN } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \dim_step_function:nnnN } - { \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } \dim_step_function:nnnN } + { + \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } + \dim_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } + \dim_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } + \dim_step_function:nnnN + } } \cs_new:Npn \dim_step_function:nnnN #1#2#3 { @@ -1599,25 +1596,25 @@ % The approach here is to build a function, with a global integer % required to make the nesting safe (as seen in other in line % functions), and map that function using \cs{dim_step_function:nnnN}. -% We put a \cs{__prg_break_point:Nn} so that \texttt{map_break} -% functions from other modules correctly decrement \cs{g__prg_map_int} +% We put a \cs{prg_break_point:Nn} so that \texttt{map_break} +% functions from other modules correctly decrement \cs{g__kernel_prg_map_int} % before looking for their own break point. The first argument is % \cs{scan_stop:}, so that no breaking function recognizes this break % point as its own. % \begin{macrocode} \cs_new_protected:Npn \dim_step_inline:nnnn { - \int_gincr:N \g__prg_map_int + \int_gincr:N \g__kernel_prg_map_int \exp_args:NNc \@@_step:NNnnnn \cs_gset_protected:Npn - { __prg_map_ \int_use:N \g__prg_map_int :w } + { @@_map_ \int_use:N \g__kernel_prg_map_int :w } } \cs_new_protected:Npn \dim_step_variable:nnnNn #1#2#3#4#5 { - \int_gincr:N \g__prg_map_int + \int_gincr:N \g__kernel_prg_map_int \exp_args:NNc \@@_step:NNnnnn \cs_gset_protected:Npx - { __prg_map_ \int_use:N \g__prg_map_int :w } + { @@_map_ \int_use:N \g__kernel_prg_map_int :w } {#1}{#2}{#3} { \tl_set:Nn \exp_not:N #4 {##1} @@ -1628,7 +1625,7 @@ { #1 #2 ##1 {#6} \dim_step_function:nnnN {#3} {#4} {#5} #2 - \__prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__prg_map_int } + \prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__kernel_prg_map_int } } % \end{macrocode} % \end{macro} @@ -1647,18 +1644,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_eval:n} -% Evaluating a dimension expression expandably. This is for use in -% other modules, to avoid having to patch many commands. The only -% difference with \cs{dim_eval:n} is the lack of \cs{dim_use:N}, to -% produce an internal dimension rather than expand it into characters. -% \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \@@_eval:n } } -\cs_new:Npn \@@_eval:n #1 { \@@_eval:w #1 \@@_eval_end: } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\dim_use:N, \dim_use:c} % Accessing a \meta{dim}. % \begin{macrocode} @@ -1702,7 +1687,7 @@ % \end{macro} % % \begin{macro}[EXP]{\dim_to_decimal_in_bp:n} -% Conversion to big points is done using a scaling inside \cs{__dim_eval:w} +% Conversion to big points is done using a scaling inside \cs{@@_eval:w} % as \eTeX{} does that using $64$-bit precision. Here, $800/803$ is the % integer fraction for $72/72.27$. This is a common case so is hand-coded % for accuracy (and speed). @@ -1717,9 +1702,14 @@ % off-scale. % \begin{macrocode} \__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_to_decimal_in_sp:n } } + { + { + \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } + \dim_to_decimal_in_sp:n + } + } \cs_new:Npn \dim_to_decimal_in_sp:n #1 - { \int_eval:n { \@@_eval:w #1 \@@_eval_end: } } + { \int_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} % \end{macro} % @@ -1799,13 +1789,17 @@ % % \subsection{Creating and initialising \texttt{skip} variables} % +% \begin{macrocode} +%<@@=skip> +% \end{macrocode} +% % \begin{macro}{\skip_new:N, \skip_new:c} % Allocation of a new internal registers. % \begin{macrocode} %<*package> \cs_new_protected:Npn \skip_new:N #1 { - \__chk_if_free_cs:N #1 + \__kernel_chk_if_free_cs:N #1 \cs:w newskip \cs_end: #1 } %</package> @@ -1948,19 +1942,15 @@ % \begin{macrocode} \prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF } { - \if_int_compare:w - \__str_if_eq_x:nn { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } - = 0 \exp_stop_f: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \str_if_eq_x:nnTF { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } + { \prg_return_true: } + { \prg_return_false: } } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP,pTF]{\skip_if_finite:n} -% \begin{macro}[EXP]{\__skip_if_finite:wwNw} +% \begin{macro}[EXP]{\@@_if_finite:wwNw} % With \eTeX{}, we have an easy access to the order of infinities of % the stretch and shrink components of a skip. However, to access % both, we either need to evaluate the expression twice, or evaluate @@ -1980,11 +1970,11 @@ } \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } { - \exp_after:wN \__skip_if_finite:wwNw + \exp_after:wN \@@_if_finite:wwNw \skip_use:N \etex_glueexpr:D ##1 ; \prg_return_false: #1 ; \prg_return_true: \q_stop } - \cs_new:Npn \__skip_if_finite:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3} + \cs_new:Npn \@@_if_finite:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3} } \exp_args:No \@@_tmp:w { \tl_to_str:n { fil } } % \end{macrocode} @@ -2020,12 +2010,22 @@ % \begin{macrocode} \cs_new_eq:NN \skip_horizontal:N \tex_hskip:D \__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \etex_glueexpr:D { } \skip_horizontal:n } } + { + { + \__kernel_chk_expr:nNnN {#1} \etex_glueexpr:D { } + \skip_horizontal:n + } + } \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 \__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \etex_glueexpr:D { } \skip_vertical:n } } + { + { + \__kernel_chk_expr:nNnN {#1} \etex_glueexpr:D { } + \skip_vertical:n + } + } \cs_new:Npn \skip_vertical:n #1 { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: } \cs_generate_variant:Nn \skip_horizontal:N { c } @@ -2097,7 +2097,7 @@ %<*package> \cs_new_protected:Npn \muskip_new:N #1 { - \__chk_if_free_cs:N #1 + \__kernel_chk_if_free_cs:N #1 \cs:w newmuskip \cs_end: #1 } %</package> |