summaryrefslogtreecommitdiff
path: root/tex/context/base/mkii/page-ins.mkii
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/base/mkii/page-ins.mkii
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/base/mkii/page-ins.mkii')
-rw-r--r--tex/context/base/mkii/page-ins.mkii103
1 files changed, 103 insertions, 0 deletions
diff --git a/tex/context/base/mkii/page-ins.mkii b/tex/context/base/mkii/page-ins.mkii
new file mode 100644
index 000000000..ce0f51d72
--- /dev/null
+++ b/tex/context/base/mkii/page-ins.mkii
@@ -0,0 +1,103 @@
+%D \module
+%D [ file=core-ins,
+%D version=2002.04.16,
+%D title=\CONTEXT\ Insertion Macros,
+%D subtitle=Insertions,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Insertions}
+
+%D Insertions are special data collections that are associated
+%D to \TEX's internal page builder. When multiple footnote
+%D classes were introduced, I decided to isolate some of the
+%D functionality in a module.
+
+\unprotect
+
+\newtoks\@@insertionlist
+
+\def\processinsertions{\the\@@insertionlist}
+
+\let\doprocessinsert\gobbleoneargument
+
+%\def\installinsertion#1%
+% {\ifx#1\undefined
+% \newinsert#1%
+% \count#1\plusthousand
+% \skip #1\zeropoint
+% \dimen#1\maxdimen
+% \appendtoks\doprocessinsert#1\to\@@insertionlist
+% \fi}
+
+\def\installinsertion#1%
+ {\ifx#1\undefined
+ \let#1\relax
+ \fi
+ \ifx#1\relax % permits \csname...\endcsname
+ \newinsert#1%
+ \count#1\plusthousand
+ \skip #1\zeropoint
+ \dimen#1\maxdimen
+ \appendtoks\doprocessinsert#1\to\@@insertionlist
+ \fi}
+
+
+\def\synchronizeinsertions
+ {\def\doprocessinsert##1{\ifvoid##1\else\insert##1{\unvbox##1}\fi}%
+ \processinsertions}
+
+%D For instance, when we postpone footnotes, we need to save
+%D some data related to the inserts. The next methods are
+%D far from ideal, but better than nothing. We save and
+%D restore box content and associated data independently.
+%D The box content is only restores when non||void.
+
+\def\backupinsertion#1%
+ {\csname\string#1\endcsname}
+
+\def\installbackupinsertion#1%
+ {\expandafter\newinsert\csname\string#1\endcsname
+ \count\backupinsertion#1\zerocount
+ \skip \backupinsertion#1\zeropoint
+ \dimen\backupinsertion#1\maxdimen}
+
+\def\saveinsertionbox#1%
+ {\ifdim\ht#1>\zeropoint % hm, actually unknown
+ \global\setbox\backupinsertion#1\box#1%
+ \else
+ \global\setbox\backupinsertion#1\emptybox
+ \fi}
+
+\def\restoreinsertionbox#1%
+ {\ifvoid\backupinsertion#1\else % if void, we keep the content
+ \global\setbox#1\box\backupinsertion#1%
+ \fi}
+
+\def\eraseinsertionbackup#1%
+ {\global\setbox\backupinsertion#1\emptybox}
+
+\def\saveinsertiondata#1%
+ {\global\skip \backupinsertion#1\skip #1%
+ \global\count\backupinsertion#1\count#1%
+ \global\dimen\backupinsertion#1\dimen#1}
+
+\def\restoreinsertiondata#1%
+ {\global\skip #1\skip \backupinsertion#1%
+ \global\count#1\count\backupinsertion#1%
+ \global\dimen#1\dimen\backupinsertion#1}
+
+%D Auxiliary macros:
+
+\def\addinsertionheight#1\to#2%
+ {\ifvoid#1\else
+ \advance#2 1\skip#1\relax
+ \advance#2 \ht #1\relax
+ \fi}
+
+\protect \endinput