summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/buff-par.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/buff-par.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/buff-par.mkiv151
1 files changed, 151 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/buff-par.mkiv b/Master/texmf-dist/tex/context/base/buff-par.mkiv
new file mode 100644
index 00000000000..c44a75050b1
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/buff-par.mkiv
@@ -0,0 +1,151 @@
+%D \module
+%D [ file=buff-par,
+%D version=2010.12.05,
+%D title=\CONTEXT\ Buffer Macros,
+%D subtitle=Parallel,
+%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 Buffer Macros / Parallel}
+
+\registerctxluafile{buff-par}{1.001}
+
+%D This module is developped for Thomas Schmitz as part of
+%D a project.
+
+\unprotect
+
+\letvalue{\??px:}\empty
+
+\def\parallelparameter#1%
+ {\csname\??px:%
+ \ifcsname\??px:\currentparallel:\currentparallelinstance:#1\endcsname
+ \currentparallel:\currentparallelinstance:#1%
+ \else\ifcsname\??px:\currentparallel:#1\endcsname
+ \currentparallel:#1%
+ \else\ifcsname\??px:#1\endcsname
+ #1%
+ \fi\fi\fi
+ \endcsname}
+
+\unexpanded\def\defineparallel
+ {\dodoubleargument\dodefineparallel}
+
+\def\dodefineparallel[#1][#2]%
+ {\ctxcommand{defineparallel("#1","#2")}%
+ \processcommalist[#2]\dododefineparallel
+ \setuvalue{\e!start#1}{\dostartparallelset{#1}}%
+ \setuvalue{\e!stop #1}{\dostopparallelset}}
+
+\def\dododefineparallel#1%
+ {\definebuffer[#1]%%
+ \setuvalue{\e!stop#1}{\dowithparallel{#1}}}
+
+\def\dostartparallelset#1%
+ {\def\currentparallel{#1}%
+ \ctxcommand{nextparallel("\currentparallel")}}
+
+\def\dostopparallelset#1%
+ {}
+
+\def\dowithparallel#1% defined moet ook aan de lua kant kunnen
+ {\ctxcommand{saveparallel("\currentparallel","#1",buffers.raw("\thedefinedbuffer{#1}"))}}
+
+\unexpanded\def\placeparallel
+ {\dotripleempty\doplaceparallel}
+
+\def\doplaceparallel[#1][#2][#3]%
+ {\begingroup
+ \def\currentparallel{#1}%
+ \ctxcommand{placeparallel("\currentparallel","#2","#3")}%
+ \endgroup}
+
+% was: \parallelparameter\c!command}
+
+\def\doflushparallel#1#2#3#4#5% {instance}{status}{line}{label}{content}
+ {\begingroup
+ \def\currentparallelinstance{#1}%
+ \def\currentparallelnumber {#2}%
+ \def\currentparallelline {#3}%
+ \def\currentparallellabel {#4}%
+ \def\currentparallelcontent {#5}%
+ \ifcase#2\relax
+ \expandafter\noflushparalleldefault
+ \or
+ \expandafter\doflushparalleldefault
+ \fi
+ \endgroup}
+
+\def\noflushparalleldefault{}
+\def\doflushparalleldefault{\directsetup{\parallelparameter\c!setups}}
+
+\startsetups parallel:place:default
+ \hangafter1
+ \hangindent4em
+ \dontleavehmode
+ \hbox to 3em \bgroup
+ \hss
+ \bf
+ \doifsomething \currentparallellabel {
+ \textreference[\currentparallellabel]{\currentparallelline}
+ }
+ \currentparallelline
+ \quad
+ \egroup
+ \currentparallelcontent
+ \par
+\stopsetups
+
+\unexpanded\def\setupparallel
+ {\dotripleempty\dosetupparallel}
+
+\def\dosetupparallel[#1][#2][#3]%
+ {\ifthirdargument
+ \getparameters[\??px:#1:#2:][#3]%
+ \else\ifsecondargument
+ \getparameters[\??px:#1:][#2]%
+ \else
+ \getparameters[\??px:][#1]% maybe no : here
+ \fi\fi}
+
+\setupparallel
+% [\c!command=\doflushparalleldefault]
+ [\c!setups=parallel:place:default]
+
+\def\doifelseparallel#1#2%
+ {\cldcontext{commands.doifelseparallel("#1","#2")}}
+
+\def\resetparallel
+ {\dodoubleempty\doresetparallel}
+
+\def\resetparallel[#1][#2]%
+ {\ctxcommand{resetparallel("#1","#2"))}}
+
+% default
+
+% \def\doflushparalleldefault#1#2#3#4% todo: setups instead
+% {\ifcase#1\or
+% \begingroup
+% \hangafter1
+% \hangindent4em
+% \dontleavehmode
+% \hbox to 3em{\hss\bf\doifsomething{#3}{\textreference[#3]{#2}}#2\quad}#4\par
+% \endgroup
+% \fi}
+
+\protect \endinput
+
+% \def\dododefineparallel#1%
+% {\setuvalue{\e!stop #1}{}%
+% \setuvalue{\e!start#1}{\dostartparallel{#1}}}
+%
+% \def\dostartparallel#1%
+% {\grabuntil{\e!stop#1}{\dododostartparallel{#1}}}
+%
+% \def\dododostartparallel#1#2%
+% {\ctxcommand{saveparallel("\currentparallel","#1",\!!bs\detokenize{#2}\!!es)}}