summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-28 22:07:57 +0000
committerKarl Berry <karl@freefriends.org>2019-01-28 22:07:57 +0000
commit58716ee4be6eb8b578e9e7097971079d0e9d0b6a (patch)
tree04ad920aed8f772a75bad93e9ec399c067f44001 /Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
parent0e9654fedc389811d7b81b1d05f8a4a986caec1c (diff)
l3 (28jan19)
git-svn-id: svn://tug.org/texlive/trunk@49853 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx536
1 files changed, 299 insertions, 237 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index 59509d55283..54892ac54e5 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
@@ -1,6 +1,8 @@
% \iffalse meta-comment
%
-%% File: l3candidates.dtx Copyright (C) 2012-2019 The LaTeX3 Project
+%% File: l3candidates.dtx
+%
+% Copyright (C) 2012-2019 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -42,7 +44,7 @@
% }^^A
% }
%
-% \date{Released 2019-01-13}
+% \date{Released 2019-01-28}
%
% \maketitle
%
@@ -141,14 +143,15 @@
%
% \subsection{Viewing part of a box}
%
-% \begin{function}{\box_clip:N, \box_clip:c}
+% \begin{function}[updated = 2019-01-23]
+% {\box_clip:N, \box_clip:c, \box_gclip:N, \box_gclip:c}
% \begin{syntax}
% \cs{box_clip:N} \meta{box}
% \end{syntax}
% Clips the \meta{box} in the output so that only material inside the
% bounding box is displayed in the output. The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the clipping is
-% applied. The clipping applies within the current \TeX{} group level.
+% applied.
%
% \textbf{These functions require the \LaTeX3 native drivers: they do
% not work with the \LaTeXe{} \pkg{graphics} drivers!}
@@ -161,9 +164,13 @@
% \end{texnote}
% \end{function}
%
-% \begin{function}{\box_trim:Nnnnn, \box_trim:cnnnn}
+% \begin{function}[added = 2019-01-23]
+% {
+% \box_set_trim:Nnnnn, \box_set_trim:cnnnn,
+% \box_gset_trim:Nnnnn, \box_gset_trim:cnnnn
+% }
% \begin{syntax}
-% \cs{box_trim:Nnnnn} \meta{box} \Arg{left} \Arg{bottom} \Arg{right} \Arg{top}
+% \cs{box_set_trim:Nnnnn} \meta{box} \Arg{left} \Arg{bottom} \Arg{right} \Arg{top}
% \end{syntax}
% Adjusts the bounding box of the \meta{box} \meta{left} is removed from
% the left-hand edge of the bounding box, \meta{right} from the right-hand
@@ -172,14 +179,18 @@
% unless \cs{box_clip:N} is subsequently applied.
% The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the trim
-% operation is applied. The adjustment applies within the current \TeX{}
-% group level. The behavior of the operation where the trims requested is
+% operation is applied.
+% The behavior of the operation where the trims requested is
% greater than the size of the box is undefined.
% \end{function}
%
-% \begin{function}{\box_viewport:Nnnnn, \box_viewport:cnnnn}
+% \begin{function}[added = 2019-01-23]
+% {
+% \box_set_viewport:Nnnnn, \box_set_viewport:cnnnn,
+% \box_gset_viewport:Nnnnn, \box_gset_viewport:cnnnn
+% }
% \begin{syntax}
-% \cs{box_viewport:Nnnnn} \meta{box} \Arg{llx} \Arg{lly} \Arg{urx} \Arg{ury}
+% \cs{box_set_viewport:Nnnnn} \meta{box} \Arg{llx} \Arg{lly} \Arg{urx} \Arg{ury}
% \end{syntax}
% Adjusts the bounding box of the \meta{box} such that it has lower-left
% co-ordinates (\meta{llx}, \meta{lly}) and upper-right co-ordinates
@@ -189,13 +200,16 @@
% subsequently applied.
% The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the viewport
-% operation is applied. The adjustment applies within the current \TeX{}
-% group level.
+% operation is applied.
% \end{function}
%
% \section{Additions to \pkg{l3coffins}}
%
-% \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn}
+% \begin{function}[updated = 2019-01-23]
+% {
+% \coffin_resize:Nnn, \coffin_resize:cnn,
+% \coffin_gresize:Nnn, \coffin_gresize:cnn
+% }
% \begin{syntax}
% \cs{coffin_resize:Nnn} \meta{coffin} \Arg{width} \Arg{total-height}
% \end{syntax}
@@ -203,7 +217,11 @@
% both of which should be given as dimension expressions.
% \end{function}
%
-% \begin{function}{\coffin_rotate:Nn, \coffin_rotate:cn}
+% \begin{function}
+% {
+% \coffin_rotate:Nn, \coffin_rotate:cn,
+% \coffin_grotate:Nn, \coffin_grotate:cn
+% }
% \begin{syntax}
% \cs{coffin_rotate:Nn} \meta{coffin} \Arg{angle}
% \end{syntax}
@@ -213,7 +231,11 @@
% the bounding box of the coffin growing unnecessarily.
% \end{function}
%
-% \begin{function}{\coffin_scale:Nnn, \coffin_scale:cnn}
+% \begin{function}[updated = 2019-01-23]
+% {
+% \coffin_scale:Nnn, \coffin_scale:cnn,
+% \coffin_gscale:Nnn, \coffin_gscale:cnn
+% }
% \begin{syntax}
% \cs{coffin_scale:Nnn} \meta{coffin} \Arg{x-scale} \Arg{y-scale}
% \end{syntax}
@@ -224,19 +246,6 @@
%
% \section{Additions to \pkg{l3expan}}
%
-% \begin{function}[added = 2017-12-12]{\prg_generate_conditional_variant:Nnn}
-% \begin{syntax}
-% \cs{prg_generate_conditional_variant:Nnn} \cs[no-index]{\meta{name}:\meta{arg spec}} \Arg{variant argument specifiers} \Arg{condition specifiers}
-% \end{syntax}
-% Defines argument-specifier variants of conditionals. This is
-% equivalent to running \cs{cs_generate_variant:Nn} \meta{conditional}
-% \Arg{variant argument specifiers} on each \meta{conditional}
-% described by the \meta{condition specifiers}. These base-form
-% \meta{conditionals} are obtained from the \meta{name} and \meta{arg
-% spec} as described for \cs{prg_new_conditional:Npnn}, and they
-% should be defined.
-% \end{function}
-%
% \begin{function}[added = 2018-04-04]{\exp_args_generate:n}
% \begin{syntax}
% \cs{exp_args_generate:n} \Arg{variant argument specifiers}
@@ -863,6 +872,25 @@
%
% \section{Additions to \pkg{l3sys}}
%
+% \begin{function}[added = 2019-01-16]{\sys_shell_get:nnN}
+% \begin{function}[TF,added = 2019-01-16]{\sys_shell_get:nnN}
+% \begin{syntax}
+% \cs{sys_shell_get:nnN} \Arg{shell~command} \Arg{setup} \meta{tl~var}
+% \cs{sys_shell_get:nnNTF} \Arg{shell~command} \Arg{setup} \meta{tl~var} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Defines \meta{tl} to the text returned by the \meta{shell command}.
+% The \meta{shell command} is converted to a string using
+% \cs{tl_to_str:n}. Category codes may need to be set appropriately
+% via the \meta{setup} argument, which is run just before running the
+% \meta{shell command} (in a group).
+% If shell escape is disabled, the \meta{tl~var} will be empty.
+% Note that quote characters (|"|) \emph{cannot} be used inside the
+% \meta{shell command}. The \cs{sys_shell_get:nnNTF} conditional
+% returns \texttt{true} if the shell is available and no quote is
+% detected, and \texttt{false} otherwise.
+% \end{function}
+% \end{function}
+%
% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str}
% The version string of the current engine, in the same form as
% given in the banner issued when running a job. For \pdfTeX{}
@@ -1231,48 +1259,6 @@
% to add these to the kernel where they are well-documented
% (\emph{e.g.}~in Unicode Consortium or relevant government publications).
%
-% \begin{function}[added = 2014-06-25]
-% {
-% \tl_set_from_file:Nnn, \tl_set_from_file:cnn,
-% \tl_gset_from_file:Nnn, \tl_gset_from_file:cnn
-% }
-% \begin{syntax}
-% \cs{tl_set_from_file:Nnn} \meta{tl} \Arg{setup} \Arg{filename}
-% \end{syntax}
-% Defines \meta{tl} to the contents of \meta{filename}.
-% Category codes may need to be set appropriately via the \meta{setup}
-% argument.
-% \end{function}
-%
-% \begin{function}[added = 2014-06-25]
-% {
-% \tl_set_from_file_x:Nnn, \tl_set_from_file_x:cnn,
-% \tl_gset_from_file_x:Nnn, \tl_gset_from_file_x:cnn
-% }
-% \begin{syntax}
-% \cs{tl_set_from_file_x:Nnn} \meta{tl} \Arg{setup} \Arg{filename}
-% \end{syntax}
-% Defines \meta{tl} to the contents of \meta{filename}, expanding
-% the contents of the file as it is read. Category codes and other
-% definitions may need to be set appropriately via the \meta{setup}
-% argument.
-% \end{function}
-%
-% \begin{function}[added = 2018-07-23]
-% {
-% \tl_set_from_shell:Nnn, \tl_set_from_shell:cnn,
-% \tl_gset_from_shell:Nnn, \tl_gset_from_shell:cnn
-% }
-% \begin{syntax}
-% \cs{tl_set_from_shell:Nnn} \meta{tl~var} \Arg{setup} \Arg{shell~command}
-% \end{syntax}
-% Defines \meta{tl} to the text returned by the \meta{shell command}.
-% Category codes may need to be set appropriately via the \meta{setup}
-% argument. If shell escape is disabled, the \meta{tl~var} will be empty.
-% Note that quote characters (|"|) \emph{cannot} be used inside the
-% \meta{shell command}.
-% \end{function}
-%
% \begin{function}[EXP, added = 2017-07-15]
% {
% \tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn,
@@ -1521,20 +1507,34 @@
%
% \subsubsection{Viewing part of a box}
%
-% \begin{macro}{\box_clip:N, \box_clip:c}
+% \begin{macro}{\box_clip:N, \box_clip:c, \box_gclip:N, \box_gclip:c}
% A wrapper around the driver-dependent code.
% \begin{macrocode}
\cs_new_protected:Npn \box_clip:N #1
{ \hbox_set:Nn #1 { \driver_box_use_clip:N #1 } }
\cs_generate_variant:Nn \box_clip:N { c }
+\cs_new_protected:Npn \box_gclip:N #1
+ { \hbox_gset:Nn #1 { \driver_box_use_clip:N #1 } }
+\cs_generate_variant:Nn \box_gclip:N { c }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\box_trim:Nnnnn, \box_trim:cnnnn}
+% \begin{macro}
+% {
+% \box_set_trim:Nnnnn, \box_set_trim:cnnnn,
+% \box_gset_trim:Nnnnn, \box_gset_trim:cnnnn
+% }
+% \begin{macro}{\@@_set_trim:NnnnnN}
% Trimming from the left- and right-hand edges of the box is easy: kern the
% appropriate parts off each side.
% \begin{macrocode}
-\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5
+\cs_new_protected:Npn \box_set_trim:Nnnnn #1#2#3#4#5
+ { \@@_set_trim:NnnnnN #1 {#2} {#3} {#4} {#5} \box_set_eq:NN }
+\cs_generate_variant:Nn \box_set_trim:Nnnnn { c }
+\cs_new_protected:Npn \box_gset_trim:Nnnnn #1#2#3#4#5
+ { \@@_set_trim:NnnnnN #1 {#2} {#3} {#4} {#5} \box_gset_eq:NN }
+\cs_generate_variant:Nn \box_gset_trim:Nnnnn { c }
+\cs_new_protected:Npn \@@_set_trim:NnnnnN #1#2#3#4#5#6
{
\hbox_set:Nn \l_@@_internal_box
{
@@ -1556,7 +1556,7 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_down:nn \c_zero_dim
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_dp:Nn \l_@@_internal_box { \box_dp:N #1 - (#3) }
}
@@ -1564,7 +1564,7 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_down:nn { (#3) - \box_dp:N #1 }
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_dp:Nn \l_@@_internal_box \c_zero_dim
}
@@ -1576,7 +1576,7 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_up:nn \c_zero_dim
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_ht:Nn \l_@@_internal_box
{ \box_ht:N \l_@@_internal_box - (#5) }
@@ -1585,22 +1585,33 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_up:nn { (#5) - \box_ht:N \l_@@_internal_box }
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_ht:Nn \l_@@_internal_box \c_zero_dim
}
- \box_set_eq:NN #1 \l_@@_internal_box
+ #6 #1 \l_@@_internal_box
}
-\cs_generate_variant:Nn \box_trim:Nnnnn { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\box_viewport:Nnnnn, \box_viewport:cnnnn}
+% \begin{macro}
+% {
+% \box_set_viewport:Nnnnn, \box_set_viewport:cnnnn,
+% \box_gset_viewport:Nnnnn, \box_gset_viewport:cnnnn
+% }
+% \begin{macro}{\@@_viewport:NnnnnN}
% The same general logic as for the trim operation, but with absolute
% dimensions. As a result, there are some things to watch out for in the
% vertical direction.
% \begin{macrocode}
-\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5
+\cs_new_protected:Npn \box_set_viewport:Nnnnn #1#2#3#4#5
+ { \@@_set_viewport:NnnnnN #1 {#2} {#3} {#4} {#5} \box_set_eq:NN }
+\cs_generate_variant:Nn \box_set_viewport:Nnnnn { c }
+\cs_new_protected:Npn \box_gset_viewport:Nnnnn #1#2#3#4#5
+ { \@@_set_viewport:NnnnnN #1 {#2} {#3} {#4} {#5} \box_gset_eq:NN }
+\cs_generate_variant:Nn \box_gset_viewport:Nnnnn { c }
+\cs_new_protected:Npn \@@_set_viewport:NnnnnN #1#2#3#4#5#6
{
\hbox_set:Nn \l_@@_internal_box
{
@@ -1613,13 +1624,13 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_down:nn \c_zero_dim
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_dp:Nn \l_@@_internal_box { - \@@_dim_eval:n {#3} }
}
{
\hbox_set:Nn \l_@@_internal_box
- { \box_move_down:nn {#3} { \box_use:N \l_@@_internal_box } }
+ { \box_move_down:nn {#3} { \box_use_drop:N \l_@@_internal_box } }
\box_set_dp:Nn \l_@@_internal_box \c_zero_dim
}
\dim_compare:nNnTF {#5} > \c_zero_dim
@@ -1627,7 +1638,7 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_up:nn \c_zero_dim
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_ht:Nn \l_@@_internal_box
{
@@ -1640,15 +1651,15 @@
\hbox_set:Nn \l_@@_internal_box
{
\box_move_up:nn { - \@@_dim_eval:n {#5} }
- { \box_use:N \l_@@_internal_box }
+ { \box_use_drop:N \l_@@_internal_box }
}
\box_set_ht:Nn \l_@@_internal_box \c_zero_dim
}
- \box_set_eq:NN #1 \l_@@_internal_box
+ #6 #1 \l_@@_internal_box
}
-\cs_generate_variant:Nn \box_viewport:Nnnnn { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsection{Additions to \pkg{l3coffins}}
%
@@ -1676,6 +1687,14 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_corners_prop, \l_@@_poles_prop}
+% Used to avoid needing to track scope for intermediate steps.
+% \begin{macrocode}
+\prop_new:N \l_@@_corners_prop
+\prop_new:N \l_@@_poles_prop
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\l_@@_bounding_shift_dim}
% The shift of the bounding box of a coffin from the real content.
% \begin{macrocode}
@@ -1700,7 +1719,12 @@
% \end{variable}
% \end{variable}
%
-% \begin{macro}{\coffin_rotate:Nn, \coffin_rotate:cn}
+% \begin{macro}
+% {
+% \coffin_rotate:Nn, \coffin_rotate:cn,
+% \coffin_grotate:Nn, \coffin_grotate:cn
+% }
+% \begin{macro}{\@@_rotate:NnNN}
% Rotating a coffin requires several steps which can be conveniently
% run together. The sine and cosine of the angle in degrees are
% computed. This is then used to set \cs{l_@@_sin_fp} and
@@ -1708,16 +1732,28 @@
% of the procedure.
% \begin{macrocode}
\cs_new_protected:Npn \coffin_rotate:Nn #1#2
+ { \@@_rotate:NnNN #1 {#2} \box_rotate:Nn \prop_set_eq:cN }
+\cs_new_protected:Npn \coffin_grotate:Nn #1#2
+ { \@@_rotate:NnNN #1 {#2} \box_grotate:Nn \prop_gset_eq:cN }
+\cs_new_protected:Npn \@@_rotate:NnNN #1#2#3#4
{
\fp_set:Nn \l_@@_sin_fp { sind ( #2 ) }
\fp_set:Nn \l_@@_cos_fp { cosd ( #2 ) }
% \end{macrocode}
+% Use a local copy of the property lists to avoid needing to pass the
+% name and scope around.
+% \begin{macrocode}
+ \prop_set_eq:Nc \l_@@_corners_prop
+ { coffin ~ \@@_to_value:N #1 ~ corners }
+ \prop_set_eq:Nc \l_@@_poles_prop
+ { coffin ~ \@@_to_value:N #1 ~ poles }
+% \end{macrocode}
% The corners and poles of the coffin can now be rotated around the
% origin. This is best achieved using mapping functions.
% \begin{macrocode}
- \prop_map_inline:cn { l_@@_corners_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_corners_prop
{ \@@_rotate_corner:Nnnn #1 {##1} ##2 }
- \prop_map_inline:cn { l_@@_poles_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_poles_prop
{ \@@_rotate_pole:Nnnnnn #1 {##1} ##2 }
% \end{macrocode}
% The bounding box of the coffin needs to be rotated, and to do this
@@ -1733,7 +1769,7 @@
% \begin{macrocode}
\@@_find_corner_maxima:N #1
\@@_find_bounding_shift:
- \box_rotate:Nn #1 {#2}
+ #3 #1 {#2}
% \end{macrocode}
% The correction of the box position itself takes place here. The idea
% is that the bounding box for a coffin is tight up to the content, and
@@ -1765,19 +1801,27 @@
\box_set_dp:Nn \l_@@_internal_box { 0 pt }
\box_set_wd:Nn \l_@@_internal_box
{ \l_@@_right_corner_dim - \l_@@_left_corner_dim }
- \hbox_set:Nn #1 { \box_use:N \l_@@_internal_box }
+ \hbox_set:Nn #1 { \box_use_drop:N \l_@@_internal_box }
% \end{macrocode}
% The final task is to move the poles and corners such that they are
% back in alignment with the box reference point.
% \begin{macrocode}
- \prop_map_inline:cn { l_@@_corners_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_corners_prop
{ \@@_shift_corner:Nnnn #1 {##1} ##2 }
- \prop_map_inline:cn { l_@@_poles_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_poles_prop
{ \@@_shift_pole:Nnnnnn #1 {##1} ##2 }
+% \end{macrocode}
+% Update the coffin data.
+% \begin{macrocode}
+ #4 { coffin ~ \@@_to_value:N #1 ~ corners }
+ \l_@@_corners_prop
+ #4 { coffin ~ \@@_to_value:N #1 ~ poles }
+ \l_@@_poles_prop
}
\cs_generate_variant:Nn \coffin_rotate:Nn { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_set_bounding:N}
% The bounding box corners for a coffin are easy enough to find: this
@@ -1821,7 +1865,7 @@
\cs_new_protected:Npn \@@_rotate_corner:Nnnn #1#2#3#4
{
\@@_rotate_vector:nnNN {#3} {#4} \l_@@_x_dim \l_@@_y_dim
- \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } {#2}
+ \prop_put:Nnx \l_@@_corners_prop {#2}
{ { \dim_use:N \l_@@_x_dim } { \dim_use:N \l_@@_y_dim } }
}
% \end{macrocode}
@@ -1838,7 +1882,7 @@
\@@_rotate_vector:nnNN {#3} {#4} \l_@@_x_dim \l_@@_y_dim
\@@_rotate_vector:nnNN {#5} {#6}
\l_@@_x_prime_dim \l_@@_y_prime_dim
- \@@_set_pole:Nnx #1 {#2}
+ \prop_put:Nnx \l_@@_poles_prop {#2}
{
{ \dim_use:N \l_@@_x_dim } { \dim_use:N \l_@@_y_dim }
{ \dim_use:N \l_@@_x_prime_dim }
@@ -1892,7 +1936,7 @@
\dim_set:Nn \l_@@_right_corner_dim { -\c_max_dim }
\dim_set:Nn \l_@@_bottom_corner_dim { \c_max_dim }
\dim_set:Nn \l_@@_left_corner_dim { \c_max_dim }
- \prop_map_inline:cn { l_@@_corners_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_corners_prop
{ \@@_find_corner_maxima_aux:nn ##2 }
}
\cs_new_protected:Npn \@@_find_corner_maxima_aux:nn #1#2
@@ -1939,7 +1983,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_shift_corner:Nnnn #1#2#3#4
{
- \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _ prop } {#2}
+ \prop_put:Nnx \l_@@_corners_prop {#2}
{
{ \dim_eval:n { #3 - \l_@@_left_corner_dim } }
{ \dim_eval:n { #4 - \l_@@_bottom_corner_dim } }
@@ -1947,7 +1991,7 @@
}
\cs_new_protected:Npn \@@_shift_pole:Nnnnnn #1#2#3#4#5#6
{
- \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _ prop } {#2}
+ \prop_put:Nnx \l_@@_poles_prop {#2}
{
{ \dim_eval:n { #3 - \l_@@_left_corner_dim } }
{ \dim_eval:n { #4 - \l_@@_bottom_corner_dim } }
@@ -1980,7 +2024,12 @@
% \end{variable}
% \end{variable}
%
-% \begin{macro}{\coffin_resize:Nnn, \coffin_resize:cnn}
+% \begin{macro}
+% {
+% \coffin_resize:Nnn, \coffin_resize:cnn,
+% \coffin_gresize:Nnn, \coffin_gresize:cnn
+% }
+% \begin{macro}{\@@_resize:NnnNN}
% Resizing a coffin begins by setting up the user-friendly names for
% the dimensions of the coffin box. The new sizes are then turned into
% scale factor. This is the same operation as takes place for the
@@ -1989,6 +2038,20 @@
% \begin{macrocode}
\cs_new_protected:Npn \coffin_resize:Nnn #1#2#3
{
+ \@@_resize:NnnNN #1 {#2} {#3}
+ \box_resize_to_wd_and_ht_plus_dp:Nnn
+ \prop_set_eq:cN
+ }
+\cs_generate_variant:Nn \coffin_resize:Nnn { c }
+\cs_new_protected:Npn \coffin_gresize:Nnn #1#2#3
+ {
+ \@@_resize:NnnNN #1 {#2} {#3}
+ \box_gresize_to_wd_and_ht_plus_dp:Nnn
+ \prop_gset_eq:cN
+ }
+\cs_generate_variant:Nn \coffin_gresize:Nnn { c }
+\cs_new_protected:Npn \@@_resize:NnnNN #1#2#3#4#5
+ {
\fp_set:Nn \l_@@_scale_x_fp
{ \dim_to_fp:n {#2} / \dim_to_fp:n { \coffin_wd:N #1 } }
\fp_set:Nn \l_@@_scale_y_fp
@@ -1996,22 +2059,26 @@
\dim_to_fp:n {#3}
/ \dim_to_fp:n { \coffin_ht:N #1 + \coffin_dp:N #1 }
}
- \box_resize_to_wd_and_ht_plus_dp:Nnn #1 {#2} {#3}
- \@@_resize_common:Nnn #1 {#2} {#3}
+ #4 #1 {#2} {#3}
+ \@@_resize_common:NnnN #1 {#2} {#3} #5
}
-\cs_generate_variant:Nn \coffin_resize:Nnn { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@@_resize_common:Nnn}
+% \begin{macro}{\@@_resize_common:NnnN}
% The poles and corners of the coffin are scaled to the appropriate
% places before actually resizing the underlying box.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_resize_common:Nnn #1#2#3
+\cs_new_protected:Npn \@@_resize_common:NnnN #1#2#3#4
{
- \prop_map_inline:cn { l_@@_corners_ \@@_to_value:N #1 _prop }
+ \prop_set_eq:Nc \l_@@_corners_prop
+ { coffin ~ \@@_to_value:N #1 ~ corners }
+ \prop_set_eq:Nc \l_@@_poles_prop
+ { coffin ~ \@@_to_value:N #1 ~ poles }
+ \prop_map_inline:Nn \l_@@_corners_prop
{ \@@_scale_corner:Nnnn #1 {##1} ##2 }
- \prop_map_inline:cn { l_@@_poles_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_poles_prop
{ \@@_scale_pole:Nnnnnn #1 {##1} ##2 }
% \end{macrocode}
% Negative $x$-scaling values place the poles in the wrong
@@ -2019,18 +2086,25 @@
% \begin{macrocode}
\fp_compare:nNnT \l_@@_scale_x_fp < \c_zero_fp
{
- \prop_map_inline:cn
- { l_@@_corners_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_corners_prop
{ \@@_x_shift_corner:Nnnn #1 {##1} ##2 }
- \prop_map_inline:cn
- { l_@@_poles_ \@@_to_value:N #1 _prop }
+ \prop_map_inline:Nn \l_@@_poles_prop
{ \@@_x_shift_pole:Nnnnnn #1 {##1} ##2 }
}
+ #4 { coffin ~ \@@_to_value:N #1 ~ corners }
+ \l_@@_corners_prop
+ #4 { coffin ~ \@@_to_value:N #1 ~ poles }
+ \l_@@_poles_prop
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\coffin_scale:Nnn, \coffin_scale:cnn}
+% \begin{macro}
+% {
+% \coffin_scale:Nnn, \coffin_scale:cnn,
+% \coffin_gscale:Nnn, \coffin_gscale:cnn
+% }
+% \begin{macro}{\coffin_scale:NnnNN}
% For scaling, the opposite calculation is done to find the new
% dimensions for the coffin. Only the total height is needed, as this
% is the shift required for corners and poles. The scaling is done
@@ -2038,22 +2112,29 @@
% without needing to use the \texttt{fp} module.
% \begin{macrocode}
\cs_new_protected:Npn \coffin_scale:Nnn #1#2#3
+ { \@@_scale:NnnNN #1 {#2} {#3} \box_scale:Nnn \prop_set_eq:cN }
+\cs_generate_variant:Nn \coffin_scale:Nnn { c }
+\cs_new_protected:Npn \coffin_gscale:Nnn #1#2#3
+ { \@@_scale:NnnNN #1 {#2} {#3} \box_gscale:Nnn \prop_gset_eq:cN }
+\cs_generate_variant:Nn \coffin_gscale:Nnn { c }
+\cs_new_protected:Npn \@@_scale:NnnNN #1#2#3#4#5
{
\fp_set:Nn \l_@@_scale_x_fp {#2}
\fp_set:Nn \l_@@_scale_y_fp {#3}
- \box_scale:Nnn #1 { \l_@@_scale_x_fp } { \l_@@_scale_y_fp }
+ #4 #1 { \l_@@_scale_x_fp } { \l_@@_scale_y_fp }
\dim_set:Nn \l_@@_internal_dim
{ \coffin_ht:N #1 + \coffin_dp:N #1 }
\dim_set:Nn \l_@@_scaled_total_height_dim
{ \fp_abs:n { \l_@@_scale_y_fp } \l_@@_internal_dim }
\dim_set:Nn \l_@@_scaled_width_dim
{ -\fp_abs:n { \l_@@_scale_x_fp } \coffin_wd:N #1 }
- \@@_resize_common:Nnn #1
+ \@@_resize_common:NnnN #1
{ \l_@@_scaled_width_dim } { \l_@@_scaled_total_height_dim }
+ #5
}
-\cs_generate_variant:Nn \coffin_scale:Nnn { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_scale_vector:nnNN}
% This functions scales a vector from the origin using the pre-set scale
@@ -2078,13 +2159,13 @@
\cs_new_protected:Npn \@@_scale_corner:Nnnn #1#2#3#4
{
\@@_scale_vector:nnNN {#3} {#4} \l_@@_x_dim \l_@@_y_dim
- \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } {#2}
+ \prop_put:Nnx \l_@@_corners_prop {#2}
{ { \dim_use:N \l_@@_x_dim } { \dim_use:N \l_@@_y_dim } }
}
\cs_new_protected:Npn \@@_scale_pole:Nnnnnn #1#2#3#4#5#6
{
\@@_scale_vector:nnNN {#3} {#4} \l_@@_x_dim \l_@@_y_dim
- \@@_set_pole:Nnx #1 {#2}
+ \prop_put:Nnx \l_@@_poles_prop {#2}
{
{ \dim_use:N \l_@@_x_dim } { \dim_use:N \l_@@_y_dim }
{#5} {#6}
@@ -2101,14 +2182,14 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_x_shift_corner:Nnnn #1#2#3#4
{
- \prop_put:cnx { l_@@_corners_ \@@_to_value:N #1 _prop } {#2}
+ \prop_put:Nnx \l_@@_corners_prop {#2}
{
{ \dim_eval:n { #3 + \box_wd:N #1 } } {#4}
}
}
\cs_new_protected:Npn \@@_x_shift_pole:Nnnnnn #1#2#3#4#5#6
{
- \prop_put:cnx { l_@@_poles_ \@@_to_value:N #1 _prop } {#2}
+ \prop_put:Nnx \l_@@_poles_prop {#2}
{
{ \dim_eval:n { #3 + \box_wd:N #1 } } {#4}
{#5} {#6}
@@ -2942,6 +3023,71 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_internal_tl}
+% \begin{macrocode}
+\tl_new:N \l_@@_internal_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\c_@@_marker_tl}
+% The same idea as the marker for rescanning token lists.
+% \begin{macrocode}
+\tl_const:Nx \c_@@_marker_tl { : \token_to_str:N : }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[TF]{\sys_shell_get:nnN}
+% \begin{macro}{\sys_shell_get:nnN,\@@_get:nnN,\@@_get_do:Nw}
+% Setting using a shell is at this level just a slightly specialised file
+% operation, with an additional check for quotes, as these are not supported.
+% \begin{macrocode}
+\cs_new_protected:Npn \sys_shell_get:nnN #1#2#3
+ {
+ \sys_shell_get:nnNF {#1} {#2} #3
+ { \tl_clear:N #3 }
+ }
+\prg_new_protected_conditional:Npnn \sys_shell_get:nnN #1#2#3 { T , F , TF }
+ {
+ \sys_if_shell:TF
+ { \exp_args:No \@@_get:nnN { \tl_to_str:n {#1} } {#2} #3 }
+ { \prg_return_false: }
+ }
+\cs_new_protected:Npn \@@_get:nnN #1#2#3
+ {
+ \tl_if_in:nnTF {#1} { " }
+ {
+ \__kernel_msg_error:nnx
+ { kernel } { quote-in-shell } {#1}
+ \prg_return_false:
+ }
+ {
+ \if_false: { \fi:
+ \group_begin:
+ \int_set_eq:NN \tex_tracingnesting:D \c_zero_int
+ \exp_args:No \tex_everyeof:D { \c_@@_marker_tl }
+ #2 \scan_stop:
+ \exp_after:wN \@@_get_do:Nw
+ \exp_after:wN #3
+ \exp_after:wN \prg_do_nothing:
+ \tex_input:D | "#1" \scan_stop:
+ \if_false: } \fi:
+ \prg_return_true:
+ }
+ }
+\exp_args:Nno \use:nn
+ { \cs_new_protected:Npn \@@_get_do:Nw #1#2 }
+ { \c_@@_marker_tl }
+ {
+ \group_end:
+ \tl_set:No #1 {#2}
+ }
+\__kernel_msg_new:nnnn { kernel } { quote-in-shell }
+ { Quotes~in~shell~command~'#1'. }
+ { Shell~commands~cannot~contain~quotes~("). }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{variable}{\c_sys_platform_str}
% Detecting the platform on \LuaTeX{} is easy: for other engines, we use
% the fact that the two common cases have special null files. It is possible
@@ -3144,136 +3290,52 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}
+% \subsubsection{Deprecated functions}
+%
+% \begin{macro}[deprecated = 2020-12-31]
% {
-% \tl_set_from_file:Nnn, \tl_set_from_file:cnn,
-% \tl_gset_from_file:Nnn, \tl_gset_from_file:cnn
+% \tl_set_from_file:Nnn, \tl_set_from_file:cnn,
+% \tl_gset_from_file:Nnn, \tl_gset_from_file:cnn,
+% \tl_set_from_file_x:Nnn, \tl_set_from_file_x:cnn,
+% \tl_gset_from_file_x:Nnn, \tl_gset_from_file_x:cnn
% }
-% \begin{macro}{\@@_set_from_file:NNnn}
-% \begin{macro}{\@@_from_file_do:w}
-% \begin{macro}{\@@_set_from:nNNn}
-% The approach here is similar to that for doing a rescan, and so the same
-% internals can be reused. Thus the plan is to insert a pair of tokens of
-% the same charcode but different catcodes after the file has been read.
-% This plus \cs{exp_not:N} allows the primitive to be used to carry out
-% a set operation.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_from_file:Nnn
- { \@@_set_from_file:NNnn \tl_set:Nn }
-\cs_new_protected:Npn \tl_gset_from_file:Nnn
- { \@@_set_from_file:NNnn \tl_gset:Nn }
-\cs_generate_variant:Nn \tl_set_from_file:Nnn { c }
-\cs_generate_variant:Nn \tl_gset_from_file:Nnn { c }
-\cs_new_protected:Npn \@@_set_from_file:NNnn #1#2#3#4
+% \begin{macrocode}
+\__kernel_patch_deprecation:nnNNpn { 2020-12-31 } { \file_get:nnN }
+\cs_new_protected:Npn \tl_set_from_file:Nnn #1#2#3
+ { \file_get:nnN {#2} {#3} #1 }
+\cs_generate_variant:Nn \tl_set_from_file:Nnn { c }
+\__kernel_patch_deprecation:nnNNpn { 2020-12-31 } { \file_get:nnN }
+\cs_new_protected:Npn \tl_gset_from_file:Nnn #1#2#3
{
- \file_get_full_name:nN {#4} \l_@@_file_name_str
- \str_if_empty:NTF \l_@@_file_name_str
- { \__kernel_file_missing:n {#4} }
- {
- \exp_args:NV \@@_set_from:nNNn
- \l_@@_file_name_str
- #1 #2 {#3}
- }
+ \group_begin:
+ \file_get:nnN {#3} {#2} \l_@@_internal_a_tl
+ \tl_gset_eq:NN #1 \l_@@_internal_a_tl
+ \group_end:
}
-\exp_args:Nno \use:nn
- { \cs_new_protected:Npn \@@_from_file_do:w #1 }
- { \c_@@_rescan_marker_tl }
- { \tl_set:No \l_@@_internal_a_tl {#1} }
-\cs_new_protected:Npn \@@_set_from:nNNn #1#2#3#4
+\cs_generate_variant:Nn \tl_gset_from_file:Nnn { c }
+\__kernel_patch_deprecation:nnNNpn { 2020-12-31 } { \file_get:nnN }
+\cs_new_protected:Npn \tl_set_from_file_x:Nnn #1#2#3
{
\group_begin:
- \exp_args:No \tex_everyeof:D
- { \c_@@_rescan_marker_tl \exp_not:N }
- #4 \scan_stop:
- \exp_after:wN \@@_from_file_do:w
- \exp_after:wN \prg_do_nothing:
- \tex_input:D #1 \scan_stop:
+ \file_get:nnN {#3} {#2} \l_@@_internal_a_tl
+ #2 \scan_stop:
+ \tl_set:Nx \l_@@_internal_a_tl { \l_@@_internal_a_tl }
\exp_args:NNNo \group_end:
- #2 #3 \l_@@_internal_a_tl
+ \tl_set:Nn #1 \l_@@_internal_a_tl
}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}
-% {
-% \tl_set_from_file_x:Nnn, \tl_set_from_file_x:cnn,
-% \tl_gset_from_file_x:Nnn, \tl_gset_from_file_x:cnn
-% }
-% \begin{macro}{\@@_set_from_file_x:NNnn}
-% When reading a file and allowing expansion of the content, the set up
-% only needs to prevent \TeX{} complaining about the end of the file. That
-% is done simply, with a group then used to trap the definition needed.
-% Once the business is done using some scratch space, the tokens can be
-% transferred to the real target.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_from_file_x:Nnn
- { \@@_set_from_file_x:NNnn \tl_set:Nn }
-\cs_new_protected:Npn \tl_gset_from_file_x:Nnn
- { \@@_set_from_file_x:NNnn \tl_gset:Nn }
-\cs_generate_variant:Nn \tl_set_from_file_x:Nnn { c }
-\cs_generate_variant:Nn \tl_gset_from_file_x:Nnn { c }
-\cs_new_protected:Npn \@@_set_from_file_x:NNnn #1#2#3#4
+\cs_generate_variant:Nn \tl_set_from_file_x:Nnn { c }
+\__kernel_patch_deprecation:nnNNpn { 2020-12-31 } { \file_get:nnN }
+\cs_new_protected:Npn \tl_gset_from_file_x:Nnn #1#2#3
{
- \file_get_full_name:nN {#4} \l_@@_file_name_str
- \str_if_empty:NTF \l_@@_file_name_str
- { \__kernel_file_missing:n {#4} }
- {
- \group_begin:
- \tex_everyeof:D { \exp_not:N }
- #3 \scan_stop:
- \tl_set:Nx \l_@@_internal_a_tl
- { \tex_input:D \l_@@_file_name_str \c_space_token }
- \exp_args:NNNo \group_end:
- #1 #2 \l_@@_internal_a_tl
- }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \begin{variable}{\l_@@_file_name_str}
-% \begin{macrocode}
-\str_new:N \l_@@_file_name_str
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}
-% {
-% \tl_set_from_shell:Nnn, \tl_set_from_shell:cnn,
-% \tl_gset_from_shell:Nnn, \tl_gset_from_shell:cnn
-% }
-% \begin{macro}{\@@_set_from_shell:NNnn}
-% Setting using a shell is at this level just a slightly specialised file
-% operation.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_from_shell:Nnn
- { \@@_set_from_shell:NNnn \tl_set:Nn }
-\cs_generate_variant:Nn \tl_set_from_shell:Nnn { c }
-\cs_new_protected:Npn \tl_gset_from_shell:Nnn
- { \@@_set_from_shell:NNnn \tl_gset:Nn }
-\cs_generate_variant:Nn \tl_gset_from_shell:Nnn { c }
-\cs_new_protected:Npn \@@_set_from_shell:NNnn #1#2#3#4
- {
- \sys_if_shell:TF
- {
- \tl_set:Nn \l_@@_internal_a_tl {#4}
- \tl_if_in:NnTF \l_@@_internal_a_tl { " }
- {
- \__kernel_msg_error:nnx
- { kernel } { quote-in-shell } {#4}
- }
- { \@@_set_from:nNNn { | " #4 " } #1 #2 {#3} }
- }
- { #1 #2 { } }
+ \group_begin:
+ \file_get:nnN {#3} {#2} \l_@@_internal_a_tl
+ #2 \scan_stop:
+ \tl_gset:Nx #1 { \l_@@_internal_a_tl }
+ \group_end:
}
-\__kernel_msg_new:nnnn { kernel } { quote-in-shell }
- { Quotes~in~shell~command~'#1'. }
- { Shell~commands~cannot~contain~quotes~("). }
+\cs_generate_variant:Nn \tl_gset_from_file_x:Nnn { c }
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \subsubsection{Unicode case changing}
%