summaryrefslogtreecommitdiff
path: root/tex/context/base/page-ins.mkii
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
committerMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
commit85b7bc695629926641c7cb752fd478adfdf374f3 (patch)
tree80293f5aaa7b95a500a78392c39688d8ee7a32fc /tex/context/base/page-ins.mkii
downloadcontext-85b7bc695629926641c7cb752fd478adfdf374f3.tar.gz
stable 2010-05-24 13:10
Diffstat (limited to 'tex/context/base/page-ins.mkii')
-rw-r--r--tex/context/base/page-ins.mkii103
1 files changed, 103 insertions, 0 deletions
diff --git a/tex/context/base/page-ins.mkii b/tex/context/base/page-ins.mkii
new file mode 100644
index 000000000..069153434
--- /dev/null
+++ b/tex/context/base/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 / Hans Hagen \& Ton Otten}]
+%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