summaryrefslogtreecommitdiff
path: root/tex/context/base/page-str.mkiv
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-str.mkiv
downloadcontext-85b7bc695629926641c7cb752fd478adfdf374f3.tar.gz
stable 2010-05-24 13:10
Diffstat (limited to 'tex/context/base/page-str.mkiv')
-rw-r--r--tex/context/base/page-str.mkiv144
1 files changed, 144 insertions, 0 deletions
diff --git a/tex/context/base/page-str.mkiv b/tex/context/base/page-str.mkiv
new file mode 100644
index 000000000..d73643cbe
--- /dev/null
+++ b/tex/context/base/page-str.mkiv
@@ -0,0 +1,144 @@
+%D \module
+%D [ file=page-str,
+%D version=2010.03.13, % 2006.03.21,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Page Streams,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Page Macros / Page Streams}
+
+%D The first version of this component of \CONTEXT\ was written
+%D for Thomas Schmitz who asked for parallel page streams. While
+%D playing with the code, I decided to make it into a component
+%D that can be used to construct all kind of stream related
+%D mechanisms. Because I could apply this feature in a project,
+%D there is some additional code here (related to graphics).
+%D
+%D These macros were written while listening to and watching the DVD
+%D \quotation {Rush In Rio}.
+%D
+%D The reimplementation (or rather experimenting with the complete
+%D rewrite) was done while looping over \quotation {Wende Snijders
+%D No.9}.
+%D
+%D Remark: marknotes are gone, at least for a while.
+
+\writestatus{loading}{ConTeXt Page Macros / Page Streams}
+
+\registerctxluafile{page-str}{1.001}
+
+\unprotect
+
+\let \currentoutputstream \empty
+\newif \ifinoutputstream
+\newtoks \everyenableoutputstream
+
+\appendtoks
+ \flushsidefloats
+\to \everyenableoutputstream
+
+\def\initializeoutputstreams
+ {\ctxlua{streams.initialize()}%
+ \glet\initializeoutputstreams\relax}
+
+\def\enableoutputstream[#1]%
+ {\initializeoutputstreams
+ \the\everyenableoutputstream
+ \inoutputstreamtrue
+ \xdef\currentoutputstream{#1}%
+ \ctxlua{streams.enable("#1")}}
+
+\def\disableoutputstream
+ {\inoutputstreamfalse
+ \global\let\currentoutputstream\s!default
+ \ctxlua{streams.disable()}}
+
+\unexpanded\def\startoutputstream[#1]%
+ {\begingroup
+ \initializeoutputstreams
+ \the\everyenableoutputstream
+ \inoutputstreamtrue
+ \xdef\currentoutputstream{#1}%
+ \ctxlua{streams.start("#1")}}
+
+\unexpanded\def\stopoutputstream
+ {\ctxlua{streams.stop()}%
+ \endgroup}
+
+\def\flushoutputstream [#1]{\ctxlua{streams.flush("#1")}}
+\def\outputstreamcopy [#1]{\vbox{\ctxlua{streams.flush("#1",true)}}}
+\def\outputstreambox [#1]{\vbox{\ctxlua{streams.flush("#1")}}}
+\def\outputstreamunvcopy[#1]{\ctxlua{streams.flush("#1",true)}}
+\def\outputstreamunvbox [#1]{\ctxlua{streams.flush("#1")}}
+\def\synchronizestreams [#1]{\ctxlua{streams.synchronize("#1")}}
+\def\dopushoutputstream [#1]{\ctxlua{streams.push("#1")}}
+
+\def\pushoutputstream {\dosingleempty\dopushoutputstream}
+
+% \unexpanded\def\defineoutputstream[#1]%
+% {\doifundefined{otrs:#1}{\expandafter\newbox\csname otrs:#1\endcsname}}
+%
+% \def\useoutputstream[#1]%
+% {\writestatus{otr}{using output stream #1}%
+% \xdef\currentoutputstream{#1}}
+%
+% \directsetup{stream:\firstoutputstream:set}
+% \directsetup{stream:\firstoutputstream:top}
+% \directsetup{stream:\firstoutputstream:bottom}
+% \directsetup{stream:\firstoutputstream:reset}
+
+%D Obsolete in \MKIV:
+
+\unexpanded\def\definemarknote {\dodoubleempty\dodefinemarknote}
+\def\dodefinemarknote[#1][#2]{}
+\def\setmarknote [#1]{\gobbleoneargument}
+\def\flushmarknotes [#1]{}
+\def\erasemarknotes [#1]{}
+
+\protect \endinput
+
+% \enabletrackers[streams.flushing]
+%
+% \setuplayout[grid=yes] \showgrid
+%
+% \starttext
+%
+% \input tufte
+%
+% \startoutputstream[nl]
+%
+% Wat doen we hier?
+%
+% \enableoutputstream[en]
+%
+% Are you sleeping, brother John?\footnote{xxx}
+%
+% \dorecurse{4}{x \footnote{note \recurselevel}\input tufte \par \pushoutputstream}
+%
+% \enableoutputstream[de]
+%
+% Bruder Jakob, schläfst du noch?\footnote{yyy}
+%
+% \dorecurse{4}{x \footnote{note \recurselevel}\input ward \par \pushoutputstream}
+%
+% \disableoutputstream
+%
+% \stopoutputstream
+%
+% Vader Jacob, slaap je nog?\footnote{zzz}
+%
+% \input tufte
+%
+% \synchronizestreams[en,de,nl]
+%
+% \page \flushoutputstream[en] \input knuth
+% \page \flushoutputstream[de] \input knuth
+% \page \flushoutputstream[nl] \input knuth
+%
+% \stoptext