Skip to content

Commit

Permalink
Support for global coffin set-eq
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jan 20, 2019
1 parent 5d3e833 commit ba4e847
Show file tree
Hide file tree
Showing 17 changed files with 194 additions and 101 deletions.
81 changes: 52 additions & 29 deletions l3kernel/l3coffins.dtx
Expand Up @@ -76,13 +76,18 @@
% coffin.
% \end{function}
%
% \begin{function}[added = 2011-08-17]
% {\coffin_set_eq:NN, \coffin_set_eq:Nc, \coffin_set_eq:cN, \coffin_set_eq:cc}
% \begin{function}[added = 2011-08-17, updated = 2019-01-18]
% {
% \coffin_set_eq:NN, \coffin_set_eq:Nc,
% \coffin_set_eq:cN, \coffin_set_eq:cc,
% \coffin_gset_eq:NN, \coffin_gset_eq:Nc,
% \coffin_gset_eq:cN, \coffin_gset_eq:cc,
% }
% \begin{syntax}
% \cs{coffin_set_eq:NN} \meta{coffin_1} \meta{coffin_2}
% \end{syntax}
% Sets both the content and poles of \meta{coffin_1} equal to those
% of \meta{coffin_2} within the current \TeX\ group level.
% of \meta{coffin_2}.
% \end{function}
%
% \begin{function}[EXP, pTF, added = 2012-06-20]
Expand Down Expand Up @@ -789,21 +794,60 @@
% \begin{macro}
% {
% \coffin_set_eq:NN, \coffin_set_eq:Nc,
% \coffin_set_eq:cN, \coffin_set_eq:cc
% \coffin_set_eq:cN, \coffin_set_eq:cc,
% \coffin_gset_eq:NN, \coffin_gset_eq:Nc,
% \coffin_gset_eq:cN, \coffin_gset_eq:cc
% }
% Setting two coffins equal is just a wrapper around other functions.
% \begin{macro}{\@@_set_eq:NNNNNNN}
% \begin{macro}{\@@_set_eq:NNNNNN}
% Setting two coffins equal means checking the scope of the source
% coffin plus defining the scope of the target coffin. If the source
% coffin was never set up, we just clear the target.
% \begin{macrocode}
\cs_new_protected:Npn \coffin_set_eq:NN #1#2
{
\@@_set_eq:NNNNNNN #1 #2
\@@_reset_structure:N \box_set_eq:NN \prop_set_eq:cc l
\coffin_clear:N
}
\cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \coffin_gset_eq:NN #1#2
{
\@@_set_eq:NNNNNNN #1 #2
\@@_greset_structure:N \box_gset_eq:NN \prop_gset_eq:cc g
\coffin_gclear:N
}
\cs_generate_variant:Nn \coffin_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \@@_set_eq:NNNNNNN #1#2#3#4#5#6#7
{
\@@_if_exist:NT #1
{
\box_set_eq:NN #1 #2
\@@_set_eq_structure:NN #1 #2
\@@_if_exist:NT #2
{
\tl_if_empty:cTF { g_@@_scope_ \@@_to_value:N #2 _tl }
{ #7 #2 }
{
#3 #1
#4 #1 #2
\exp_args:Nv \@@_set_eq:NNNNN
{ g_@@_scope_ \@@_to_value:N #2 _tl }
#1 #2 #5 #6
}
}
}
}
\cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \@@_set_eq:NNNNN #1#2#3#4#5
{
#4
{ #5 _@@_corners_ \@@_to_value:N #2 _prop }
{ #1 _@@_corners_ \@@_to_value:N #3 _prop }
#4 { #5 _@@_poles_ \@@_to_value:N #2 _prop }
{ #1 _@@_poles_ \@@_to_value:N #3 _prop }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{variable}{\c_empty_coffin}
% \begin{variable}{\l_@@_aligned_coffin}
Expand Down Expand Up @@ -910,27 +954,6 @@
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@_set_eq_structure:NN, \@@_gset_eq_structure:NN}
% Setting coffin structures equal simply means copying the property
% list.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_eq_structure:NN #1#2
{
\prop_set_eq:cc { l_@@_corners_ \@@_to_value:N #1 _prop }
{ l_@@_corners_ \@@_to_value:N #2 _prop }
\prop_set_eq:cc { l_@@_poles_ \@@_to_value:N #1 _prop }
{ l_@@_poles_ \@@_to_value:N #2 _prop }
}
\cs_new_protected:Npn \@@_gset_eq_structure:NN #1#2
{
\prop_gset_eq:cc { l_@@_corners_ \@@_to_value:N #1 _prop }
{ l_@@_corners_ \@@_to_value:N #2 _prop }
\prop_gset_eq:cc { l_@@_poles_ \@@_to_value:N #1 _prop }
{ l_@@_poles_ \@@_to_value:N #2 _prop }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}
% {\coffin_set_horizontal_pole:Nnn, \coffin_set_horizontal_pole:cnn}
% \begin{macro}{\coffin_set_vertical_pole:Nnn, \coffin_set_vertical_pole:cnn}
Expand Down
26 changes: 16 additions & 10 deletions l3kernel/testfiles/m3coffins001.luatex.tlg
Expand Up @@ -110,19 +110,21 @@ Size of coffin \zzz:
> wd = 6.11111pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.05556pt}{0pt}{0pt}{1000pt}
> r => {6.11111pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x6.11111, direction TLT
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 Z
.\pdfcolorstack 0 pop
! OK.
<argument> \zzz
l. ...}
Expand All @@ -132,25 +134,29 @@ Size of coffin \zzz:
> wd = 7.50002pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.75pt}{0pt}{0pt}{1000pt}
> r => {7.50002pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002, direction TLT
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 A
.\pdfcolorstack 0 pop
! OK.
<argument> \zzz
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002, direction TLT
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 A
.\pdfcolorstack 0 pop
! OK.
<argument> \aaa
l. ...}
Expand Down
4 changes: 2 additions & 2 deletions l3kernel/testfiles/m3coffins001.lvt
Expand Up @@ -44,8 +44,8 @@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\TEST{Equating~coffins}{
\sbox \aaa {A}
\sbox \zzz {Z}
\hcoffin_set:Nn \aaa {A}
\hcoffin_set:Nn \zzz {Z}
\coffin_show_structure:N \zzz
\box_show:N \zzz
\coffin_set_eq:NN \zzz \aaa
Expand Down
26 changes: 16 additions & 10 deletions l3kernel/testfiles/m3coffins001.ptex.tlg
Expand Up @@ -110,19 +110,21 @@ Size of coffin \zzz:
> wd = 6.11111pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.05556pt}{0pt}{0pt}{1000pt}
> r => {6.11111pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x6.11111
.\special{color push gray 0}
.\OT1/cmr/m/n/10 Z
.\special{color pop}
! OK.
<argument> \zzz
l. ...}
Expand All @@ -132,25 +134,29 @@ Size of coffin \zzz:
> wd = 7.50002pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.75pt}{0pt}{0pt}{1000pt}
> r => {7.50002pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\special{color push gray 0}
.\OT1/cmr/m/n/10 A
.\special{color pop}
! OK.
<argument> \zzz
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\special{color push gray 0}
.\OT1/cmr/m/n/10 A
.\special{color pop}
! OK.
<argument> \aaa
l. ...}
Expand Down
26 changes: 16 additions & 10 deletions l3kernel/testfiles/m3coffins001.tlg
Expand Up @@ -110,19 +110,21 @@ Size of coffin \zzz:
> wd = 6.11111pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.05556pt}{0pt}{0pt}{1000pt}
> r => {6.11111pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x6.11111
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 Z
.\pdfcolorstack 0 pop
! OK.
<argument> \zzz
l. ...}
Expand All @@ -132,25 +134,29 @@ Size of coffin \zzz:
> wd = 7.50002pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.75pt}{0pt}{0pt}{1000pt}
> r => {7.50002pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 A
.\pdfcolorstack 0 pop
! OK.
<argument> \zzz
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\pdfcolorstack 0 push {0 g 0 G}
.\OT1/cmr/m/n/10 A
.\pdfcolorstack 0 pop
! OK.
<argument> \aaa
l. ...}
Expand Down
26 changes: 16 additions & 10 deletions l3kernel/testfiles/m3coffins001.uptex.tlg
Expand Up @@ -110,19 +110,21 @@ Size of coffin \zzz:
> wd = 6.11111pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.05556pt}{0pt}{0pt}{1000pt}
> r => {6.11111pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x6.11111
.\special{color push gray 0}
.\OT1/cmr/m/n/10 Z
.\special{color pop}
! OK.
<argument> \zzz
l. ...}
Expand All @@ -132,25 +134,29 @@ Size of coffin \zzz:
> wd = 7.50002pt
Poles of coffin \zzz:
> l => {0pt}{0pt}{0pt}{1000pt}
> hc => {0pt}{0pt}{0pt}{1000pt}
> r => {0pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0pt}{1000pt}{0pt}
> vc => {0pt}{0pt}{1000pt}{0pt}
> t => {0pt}{0pt}{1000pt}{0pt}
> hc => {3.75pt}{0pt}{0pt}{1000pt}
> r => {7.50002pt}{0pt}{0pt}{1000pt}
> b => {0pt}{0.0pt}{1000pt}{0pt}
> vc => {0pt}{3.41666pt}{1000pt}{0pt}
> t => {0pt}{6.83331pt}{1000pt}{0pt}
> B => {0pt}{0pt}{1000pt}{0pt}
> H => {0pt}{0pt}{1000pt}{0pt}
> T => {0pt}{0pt}{1000pt}{0pt}.
<recently read> }
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\special{color push gray 0}
.\OT1/cmr/m/n/10 A
.\special{color pop}
! OK.
<argument> \zzz
l. ...}
> \box...=
\hbox(6.83331+0.0)x7.50002
.\special{color push gray 0}
.\OT1/cmr/m/n/10 A
.\special{color pop}
! OK.
<argument> \aaa
l. ...}
Expand Down

0 comments on commit ba4e847

Please sign in to comment.