summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv92
1 files changed, 37 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv b/Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv
index 838ad742188..c08f9856fa7 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/page-imp.mkiv
@@ -26,7 +26,7 @@
\newtoks\t_page_text_data
\unexpanded\def\starttextdata#1\stoptextdata
- {\glet\page_shipouts_flush_text_data\page_shipouts_flush_text_data_indeed
+ {\global\let\page_shipouts_flush_text_data\page_shipouts_flush_text_data_indeed
\globaladdtotoks\t_page_text_data{#1}}
\let\stoptextdata\relax
@@ -34,7 +34,7 @@
\def\page_shipouts_flush_text_data_indeed
{\vsmashed{\the\t_page_text_data}%
\global\t_page_text_data\emptytoks
- \glet\page_shipouts_flush_text_data\relax}
+ \global\let\page_shipouts_flush_text_data\relax}
\let\page_shipouts_flush_text_data\relax
@@ -63,21 +63,9 @@
\newbox \shipoutscratchbox
-\setnewconstant\shipoutfinalizemethod\plusone
+\setnewconstant\shipoutfinalizemethod\plusone % this will be default (we will have two finalizers)
-\unexpanded\def\shipoutrange#1#2%
- {\begingroup
- \scratchtoks\emptytoks
- \dostepwiserecurse{#1}{\numexpr#2-\plusone\relax}\plusone{\etoksapp\scratchtoks{##1,}}%
- \xdef\pagestoshipout{\the\scratchtoks,\number#2}%
- \doglobal\appendtoks
- \ifnum\realpageno>\numexpr#2+\plusone\relax
- \global\everypar{\normalend}%
- \fi
- \to\everyaftershipout
- \endgroup}
-
-\unexpanded\def\installshipoutmethod#1#2% % a handler takes one argument: something to be boxed
+\unexpanded\def\installshipoutmethod#1#2% % a handler takes one argument: something to be boxed
{\setgvalue{\??shipoutmethod#1}##1{#2{##1}}} % and shipped out (don't depend on the exact package)
\let\installpagehandler\installshipoutmethod % will go
@@ -85,6 +73,13 @@
\unexpanded\def\invokepagehandler#1%
{\expandnamespacevalue\??shipoutmethod{#1}\v!normal}
+% \def\page_shipouts_handle
+% {\csname\??shipoutmethod\ifcsname\??shipoutmethod\v_page_target_method\endcsname
+% \v_page_target_method
+% \else
+% \v!none
+% \fi\endcsname}
+
\def\page_shipouts_handle
{\ifcsname\??shipoutmethod\v_page_target_method\endcsname
\expandafter\lastnamedcs
@@ -117,14 +112,12 @@
\page_boxes_flush_before
\fi
\the\everybeforeshipout
- \ifcase\shipoutfinalizemethod % not nice ... needs thinking
+ \ifcase\shipoutfinalizemethod
\page_shipouts_handle{#1}%
\else
- \setbox\shipoutscratchbox\hpack
- {#1}% just in case there are objects there, hook for testing (will go away)
- \page_shipouts_handle
- {\finalizeshipoutbox\shipoutscratchbox
- \box\shipoutscratchbox}%
+ \setbox\shipoutscratchbox\hpack{#1}% just in case there are objects there, hook for testing (will go away)
+ \finalizeshipoutbox\shipoutscratchbox
+ \page_shipouts_handle{\box\shipoutscratchbox}%
\fi
\setnextrealpageno % so this comes before \everyaftershipout so in fact:
\the\everyaftershipout % at this point we're already on the next realpage
@@ -134,12 +127,11 @@
\def\page_shipouts_ignore#1%
{\begingroup
- \writestatus\m!system
- {\ifarrangingpages arranged \fi page
+ \message
+ {[\ifarrangingpages arranged \fi page
\ifarrangingpages\the\arrangeno\else\the\realpageno\fi\normalspace
- not flushed}%
- % \setbox\scratchbox\hpack
- % {#1}% no finalize
+ not flushed]}%
+ \setbox\scratchbox\hpack{#1}%
\deadcycles\zerocount
\endgroup}
@@ -162,11 +154,7 @@
\box\scratchbox
\endgroup}
-\ifdefined \page_shipout_box \else
-
- \def\page_shipout_box#1{\normalshipout\box#1\relax} % takes a number
-
-\fi
+\newdimen\d_page_shipouts_offset \d_page_shipouts_offset=-1in
\def\page_shipouts_normal#1%
{\global\advance\shippedoutpages\plusone
@@ -185,36 +173,30 @@
\normalexpanded{\doifelseinset{\the\shippedoutpages}{\pagestoshipout}}\donetrue\donefalse
\fi
\ifdone
- \setbox\shipoutscratchbox\hpack
- {#1}% finalizes
+ \setbox\shipoutscratchbox\hpack{#1}%
\ifcase\shipoutfinalizemethod
\finalizeshipoutbox\shipoutscratchbox
\fi
- \setbox\shipoutscratchbox\vpack
- {\scratchdimen\clf_shipoutoffset\relax
- \ifdim\scratchdimen=\zeropoint\else
- \offinterlineskip
- \vkern\scratchdimen
- \hkern\scratchdimen
- \fi
+ \normalshipout\vpack
+ {\offinterlineskip
+ \vskip\d_page_shipouts_offset
+ \hskip\d_page_shipouts_offset
\hpack
{\page_otr_flush_every_stuff
\page_otr_flush_special_content
\box\shipoutscratchbox}}%
- \page_shipout_box\shipoutscratchbox % takes a box number!
\else
\page_shipouts_ignore{#1}%
\fi}
\def\page_shipouts_arrange#1%
- {\begingroup
- \setbox\shipoutscratchbox\hpack
- {#1}% finalizes
- \setbox\shipoutscratchbox\hpack
+ {% \global\advance\shippedoutpages\plusone
+ \begingroup
+ \setbox\scratchbox\hpack
{\page_otr_flush_every_stuff
\page_otr_flush_special_content
\box\shipoutscratchbox}%
- \pusharrangedpage\shipoutscratchbox
+ \pusharrangedpage\scratchbox
\deadcycles\zerocount
\endgroup}
@@ -328,14 +310,14 @@
\let\pusharrangedpage\relax
\def\dosetuparrangement#1#2#3#4#5#6#7#8%
- {\global\arrangedpageX #1%
- \global\arrangedpageY #2%
- \global\arrangedpageT #3%
- \global\c_page_marks_nx #4%
- \global\c_page_marks_ny #5%
- \glet \pusharrangedpage #6%
- \glet \poparrangedpages #7%
- \glet \handlearrangedpage#8}
+ {\global\arrangedpageX #1%
+ \global\arrangedpageY #2%
+ \global\arrangedpageT #3%
+ \global\c_page_marks_nx #4%
+ \global\c_page_marks_ny #5%
+ \global\let\pusharrangedpage #6%
+ \global\let\poparrangedpages #7%
+ \global\let\handlearrangedpage#8}
\installpagearrangement {\v!normal}
{\global\arrangingpagesfalse}