summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2003-01-10 00:00:00 +0100
committerHans Hagen <pragma@wxs.nl>2003-01-10 00:00:00 +0100
commit8de3b8a6a820ba65fe85f0cb83700b6282e61d71 (patch)
treedcc2e712bc7cd631ffeb9190bb8a6320e38617f3 /tex
parentd66c6c7f5bf3b189c2b194ba167fb39f548742e5 (diff)
downloadcontext-8de3b8a6a820ba65fe85f0cb83700b6282e61d71.tar.gz
stable 2003.01.10
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex239
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-buf.tex2
-rw-r--r--tex/context/base/core-fig.tex2
-rw-r--r--tex/context/base/core-fil.tex3
-rw-r--r--tex/context/base/core-itm.tex15
-rw-r--r--tex/context/base/core-job.tex31
-rw-r--r--tex/context/base/core-mis.tex50
-rw-r--r--tex/context/base/core-pos.tex6
-rw-r--r--tex/context/base/core-sys.tex7
-rw-r--r--tex/context/base/core-tbl.tex236
-rw-r--r--tex/context/base/enco-def.tex3
-rw-r--r--tex/context/base/font-ini.tex6
-rw-r--r--tex/context/base/font-run.tex2
-rw-r--r--tex/context/base/java-ans.tex1
-rw-r--r--tex/context/base/java-fld.tex18
-rw-r--r--tex/context/base/lang-ger.tex26
-rw-r--r--tex/context/base/m-chart.tex24
-rw-r--r--tex/context/base/m-pstric.tex9
-rw-r--r--tex/context/base/math-tex.tex2
-rw-r--r--tex/context/base/meta-ini.tex4
-rw-r--r--tex/context/base/mult-com.tex13
-rw-r--r--tex/context/base/mult-ini.tex2
-rw-r--r--tex/context/base/page-app.tex6
-rw-r--r--tex/context/base/page-flt.tex7
-rw-r--r--tex/context/base/page-imp.tex2
-rw-r--r--tex/context/base/page-ini.tex3
-rw-r--r--tex/context/base/page-lay.tex18
-rw-r--r--tex/context/base/page-mul.tex2
-rw-r--r--tex/context/base/page-run.tex4
-rw-r--r--tex/context/base/page-set.tex42
-rw-r--r--tex/context/base/s-map-01.tex6
-rw-r--r--tex/context/base/s-mod-00.tex4
-rw-r--r--tex/context/base/s-mod-01.tex2
-rw-r--r--tex/context/base/s-mod-02.tex2
-rw-r--r--tex/context/base/s-pre-00.tex2
-rw-r--r--tex/context/base/setupb.tex6
-rw-r--r--tex/context/base/spec-fdf.tex459
-rw-r--r--tex/context/base/spec-tpd.tex6
-rw-r--r--tex/context/base/supp-fil.tex93
-rw-r--r--tex/context/base/symb-ini.tex11
-rw-r--r--tex/context/base/syst-ext.tex24
-rw-r--r--tex/context/base/syst-new.tex22
-rw-r--r--tex/context/base/type-ini.tex11
-rw-r--r--tex/context/base/type-syn.tex10
-rw-r--r--tex/context/base/x-corres.tex136
-rw-r--r--tex/context/base/x-fig-00.tex2
-rw-r--r--tex/context/base/x-fig-01.tex249
-rw-r--r--tex/context/base/x-fig-02.tex2
-rw-r--r--tex/context/base/x-fig-03.tex2
-rw-r--r--tex/context/base/x-res-00.tex62
-rw-r--r--tex/context/base/x-res-01.tex449
-rw-r--r--tex/context/base/x-res-02.tex72
-rw-r--r--tex/context/base/x-res-03.tex44
-rw-r--r--tex/context/base/x-res-04.tex325
-rw-r--r--tex/context/base/x-xml-02.tex8
-rw-r--r--tex/context/base/xtag-ext.tex33
-rw-r--r--tex/context/base/xtag-ini.tex4
-rw-r--r--tex/context/base/xtag-pre.tex14
59 files changed, 2219 insertions, 628 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index e7269d251..2180bd1b7 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -19,6 +19,170 @@
\unprotect
+\setupclipping
+ [\c!linkeroffset=\zeropoint,
+ \c!rechteroffset=\zeropoint,
+ \c!bovenoffset=\zeropoint,
+ \c!onderoffset=\zeropoint]
+
+\def\doclip[#1]% nb top->bottom left->right
+ {\bgroup
+ \getparameters[\??cp][#1]%
+ \dowithnextbox
+ {\ifdim\@@cpbreedte>\zeropoint
+ \dimen0=\@@cpbreedte
+ \dimen4=\@@cphoffset
+ \else
+ \dimen0=\wd\nextbox
+ \divide\dimen0 \@@cpnx
+ \dimen4=\@@cpx\dimen0
+ \advance\dimen4 -\dimen0
+ \dimen0=\@@cpsx\dimen0
+ \fi
+ \relax % sure
+ \ifdim\@@cphoogte>\zeropoint
+ \dimen2=\@@cphoogte
+ \dimen6=\ht\nextbox
+ \advance\dimen6 -\@@cpvoffset
+ \advance\dimen6 -\dimen2
+ \else
+ \dimen2=\ht\nextbox
+ \divide\dimen2 \@@cpny
+ \dimen6=-\@@cpy\dimen2
+ \advance\dimen6 -\@@cpsy\dimen2
+ \advance\dimen6 \dimen2
+ \dimen2=\@@cpsy\dimen2
+ \advance\dimen6 \ht\nextbox
+ \fi
+ \setbox\nextbox\hbox % old
+ {\advance\dimen4 -\@@cplinkeroffset % new !
+ \advance\dimen6 \@@cpbovenoffset % new !
+ \hskip-\dimen4\lower\dimen6\box\nextbox}% old
+ \wd\nextbox\zeropoint
+ \ht\nextbox\zeropoint
+ \dp\nextbox\zeropoint
+ \setbox\nextbox\hbox
+ {\advance\dimen0 \@@cplinkeroffset % new !
+ \advance\dimen0 \@@cprechteroffset % new !
+ \advance\dimen2 \@@cpbovenoffset % new !
+ \advance\dimen2 \@@cponderoffset % new !
+ \dostartclipping\@@cpmp{\dimen0}{\dimen2}% old
+ \box\nextbox
+ \dostopclipping}%
+ \setbox\nextbox\hbox % new !
+ {\dimen0-\@@cplinkeroffset % new !
+ \dimen2-\@@cpbovenoffset % new !
+ \hskip\dimen0\lower\dimen2\box\nextbox}% new !
+ \wd\nextbox\dimen0
+ \ht\nextbox\dimen2
+ \dp\nextbox\zeropoint
+ \box\nextbox
+ \egroup}%
+ \hbox}
+
+% beware, we have clipping offsets of 2\lineheight by default
+
+\def\columntextareaparameter#1%
+ {\csname\??mt\currentcolumntestarea#1\endcsname}
+
+\def\dodoplacecolumntextareas#1#2%
+ {\def\currentcolumntestarea{#1#2}%
+ \!!counta\columntextareaparameter\c!x
+ \!!countb\columntextareaparameter\c!nx
+ \docalculatecolumnsetspan
+ \!!heighta\columntextareaparameter\c!ny\lineheight
+ % to do: met/zonder ht/dp
+ \ifnum\columntextareaparameter\c!y=\zerocount
+ \advance\!!heighta -\lineheight
+ \advance\!!heighta \topskip
+ \fi
+ \advance\!!heighta -\lineheight % option
+ \setbox\scratchbox\vbox
+ {\donetrue\localframed
+ [\??mt\currentcolumntestarea]
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,\c!regels=]
+ {\columntextareaparameter\empty}}%
+ \!!counta\columntextareaparameter\c!x
+ \!!countb\columntextareaparameter\c!y
+ \advance\!!countb \columntextareaparameter\c!ny
+ \advance\!!countb \minusone
+ \OTRSETsetgridcell
+ \!!counta\!!countb
+ \hbox{\clip
+ [\c!bovenoffset=\columntextareaparameter\c!clipoffset,%
+ \c!onderoffset=\columntextareaparameter\c!clipoffset,%
+ \c!linkeroffset=\columntextareaparameter\c!clipoffset,%
+ \c!breedte=\!!widthb,%
+ \c!hoogte=\!!heighta]%
+ {\copy\scratchbox}}%
+ \ifcase\!!countc\else
+ \advance\!!counta \columntextareaparameter\c!nx
+ \advance\!!counta -\!!countc
+ \advance\!!widtha -\!!widthb
+ \OTRSETsetgridcell
+ \!!counta\!!countb
+ \hbox
+ {\hskip-\namedlayoutparameter\v!oneven\c!rugwit
+ \clip
+ [\c!bovenoffset=\columntextareaparameter\c!clipoffset,%
+ \c!onderoffset=\columntextareaparameter\c!clipoffset,%
+ \c!rechteroffset=\columntextareaparameter\c!clipoffset,%
+ \c!breedte=\!!widtha,%
+ \c!hoogte=\!!heighta,%
+ \c!hoffset=\!!widthb]%
+ {\copy\scratchbox}}%
+ \fi}
+
+\def\NormalizeFontSize#1#2#3#4#5% the normal struggle with accuracy
+ {\bgroup
+ \dimen0=#4% #4 can be \ht0 or so
+ \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt
+ \ifdim\wd0>\zeropoint
+ \dimen2=#10 % #1 is \wd or \ht
+ \dimen4=\maxdimen % 10000pt
+ \divide\dimen4 \dimen2
+ \divide\dimen0 1638 % 1000
+ \dimen0=\number\dimen4\dimen0
+ \divide \dimen0 \plustwo % ...
+ \xdef\TheNormalizedFontSize{\the\dimen0}%
+ \else
+ \dimen0\bodyfontsize
+ \fi
+ \definedfont[#5 at \the\dimen0]%
+ \expandafter
+ \egroup
+ \expandafter\font\expandafter#2\fontname\font\relax}
+
+
+
+% todo namespace \@@meta:#1:... ! ! ! ! ! !
+
+\def\presetMPvariable
+ {\dodoubleargument\dopresetMPvariable}
+
+\def\dopresetMPvariable[#1][#2=#3]%
+ {\doifundefined{#1:#2}{\setvalue{#1:#2}{#3}}}
+
+\def\complexcolumnbreak[#1]% if empty, do nothing and avoid processing
+ {\doifsomething{#1}{\executecolumnbreakhandlers{#1}}}
+
+\def\OTRSETsethsize
+ {%\OTRSETassignwidth\OTRSETidentifier\to\localcolumnwidth
+ \localcolumnwidth\OTRSETlocalwidth\mofcolumns
+ \tekstbreedte\localcolumnwidth
+ \hsize\localcolumnwidth}
+
+\def\OTRSETsynchronizehsize
+ {\ifcase0\getvalue{\??mc\??mc\c!breedte}\else % some width set
+ \bgroup
+ \scratchdimen\OTRSETlocalwidth\mofcolumns
+ \ifdim\scratchdimen=\tekstbreedte
+ \egroup
+ \else
+ \egroup \OTRSETsethsize % only if change in width and \column/\break
+ \fi
+ \fi }
+
\def\filluparrangedpages % beware: \realpageno is 1 ahead
{\ifarrangingpages
\scratchcounter\realpageno
@@ -31,6 +195,23 @@
\fi
\fi}
+\def\substituteincommalist#1#2#3% old, new, list (slooow)
+ {\edef\!!stringb{#1}%
+ \edef\!!stringd{#2}%
+ \let\!!stringa#3%
+ \let#3\empty
+ \def\dosubstituteincommalist##1%
+ {\edef\!!stringc{##1}%
+ \ifx\!!stringb\!!stringc
+ \ifx\!!stringd\empty\else
+ \edef#3{#3\ifx#3\empty\else,\fi\!!stringd}%
+ \fi
+ \def\docommando####1{\edef#3{#3,####1}}%
+ \else
+ \edef#3{#3\ifx#3\empty\else,\fi##1}%
+ \fi}%
+ \@EA\rawprocesscommacommand\@EA[\!!stringa]\dosubstituteincommalist}
+
% experiment, not yet to be used
\def\displaybreak
@@ -63,6 +244,25 @@
\def\@@nmpre{\@@nmprepos\empty\tfskip\relax\hss}
\def\@@nmpos{\@@nmprepos\tfskip\empty\hss\relax}
+\def\startpagefigure
+ {\dodoubleempty\dostartpagefigure}
+
+\def\dostartpagefigure[#1][#2]%
+ {\bgroup
+ \getparameters[\??ex][\c!offset=\!!zeropoint,#2]%
+ \startTEXpage[\c!offset=\@@exoffset]%
+ \externalfigure[#1][#2]\ignorespaces}
+
+\def\stoppagefigure
+ {\stopTEXpage
+ \egroup}
+
+\def\pagefigure
+ {\dodoubleempty\dopagefigure}
+
+\def\dopagefigure[#1][#2]%
+ {\dostartpagefigure[#1][#2]\stoppagefigure}
+
\def\doprocesstabskipline#1%
{\bgroup
\scratchcounter\plusone
@@ -263,8 +463,8 @@
\installcolumnbreakhandler {SET} \v!lokaal
{\columnhbreak
\ejectinsert
- \ejectpage} % brrr
- % no \OTRSETsethsize, can be mid smaller (like tabulate)
+ \ejectpage % brrr
+ \OTRSETsynchronizehsize} % no \OTRSETsethsize, can be mid smaller (like tabulate)
% We need to make sure that we really leave the column; mid
% column we may end up in an empty gap, and we don;t want to
@@ -286,7 +486,8 @@
\fi
\else
\exitloop
- \fi}}
+ \fi}%
+ \OTRSETsynchronizehsize}
% testcase : pascal demo-bbi, paragraaf/aanduiding koppen
@@ -1273,16 +1474,34 @@
\def\??vars{@@vars}
\def\setvariables
- {\dodoubleargument\dosetvariables}
+ {\dotripleargument\dosetvariables[\getrawparameters]}
+
+\def\globalsetvariables
+ {\dotripleargument\dosetvariables[\globalgetrawparameters]}
-\def\dosetvariables[#1][#2]%
+\def\dosetvariables[#1][#2][#3]%
{\errorisfataltrue
- \def\currentvariableclass{#1}%
- \getrawparameters[\??vars:#1:][#2]%
+ \def\currentvariableclass{#2}%
+ #1[\??vars:#2:][#3]%
\errorisfatalfalse}
+\beginTEX
+
\def\getvariable#1#2% to be sped up
- {\csname\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi\endcsname}
+ {\csname
+ \ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi
+ \endcsname}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\getvariable#1#2% to be sped up
+ {\csname
+ \ifcsname\??vars:#1:#2\endcsname\??vars:#1:#2\else\s!empty\fi
+ \endcsname}
+
+\endETEX
\def\showvariable#1#2%
{\showvalue{\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi}}
@@ -1509,12 +1728,12 @@
\def\plaatsexterndocument[#1]%
{\def\doexternaldocument[##1][##2][##3]%
- {\readlocfile{##2}{}{}}%
+ {\readlocfile{##2}\donothing\donothing}%
\getvalue{\v!file:::#1}}
%D Far from complete.
-\def\startgeheel%
+\def\startgeheel
{\startregelcorrectie
\insidefloattrue}
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index cc22ab771..52781f9c5 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -15,7 +15,7 @@
\catcode`\{=1 \catcode`\}=2
-\def\contextversion{2002.12.20}
+\def\contextversion{2003.1.10}
%D Welcome to the main module. When this module is ran through
%D \type{initex} or \type{tex -i} or \type{whatevertex} using
diff --git a/tex/context/base/core-buf.tex b/tex/context/base/core-buf.tex
index bb08de0cf..5633bb069 100644
--- a/tex/context/base/core-buf.tex
+++ b/tex/context/base/core-buf.tex
@@ -213,7 +213,7 @@
{\letbeundefined{#4}% \letvalue{#4}=\relax % \undefined
\@EA\convertargument\csname#3\endcsname\to\beginofblock
\@EA\convertargument\csname#4\endcsname\to\endofblock}%
- \def\closeblock%
+ \def\closeblock
{\ifsegmentatebuffer
\immediate\write\tmpblocks{\string\stopbufferparagraph}%
\fi
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index 73b83cd26..48394eec3 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -1990,7 +1990,7 @@
\position(0,0)
{\box0}%
\position(0,0)
- {\rooster
+ {\basegrid
[\c!nx=\@@exxmax,
\c!dx=\withoutpt{\the\efxsteps},
\c!ny=\@@exymax,
diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex
index 2aaf377e3..ca5f3056a 100644
--- a/tex/context/base/core-fil.tex
+++ b/tex/context/base/core-fil.tex
@@ -167,7 +167,8 @@
\dododousemodules\f!privateprefix{#2}%
\dododousemodules\f!styleprefix {#2}%
\dododousemodules\f!xstyleprefix {#2}%
- \dododousemodules\f!thirdprefix {#2}}
+ \dododousemodules\f!thirdprefix {#2}%
+ \dododousemodules\empty {#2}}% new, fall back on raw name
{\dododousemodules{#1-}{#2}}%
\ifconditional\moduleisloaded\else
\showmessage\m!systems6{#2}%
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index 2f0185db4..4ad389d31 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -666,7 +666,7 @@
\hskip\itemsignal % new, concat
\ignorespaces}
-\def\complexitem[#1]#2\par% todo: no two pass data
+\def\complexitem[#1]#2\par % todo: no two pass data
{\startitemgroup[#1]
\complexdoitemgroupitem[]\ignorespaces\begstrut#2\unskip\endstrut\par
\stopitemgroup}
@@ -759,12 +759,15 @@
\dorecurse{\getvalue{\??ig#1\c!niveaus}}{\initializeitemgrouplevel\recurselevel}%
\popmacro\currentitemgroup}}
-% efficient default itemize as well as upward compatible definition
-
-% \def\startitemize {\startitemgroup[]}
-% \def\stopitemize {\stopitemgroup}
-% \def\setupitemize {\setupitemgroup[]}
+% efficient default itemize as well as upward compatible
+% definition:
\defineitemgroup [\e!itemize] [\c!niveaus=6]
+% keep these, needed for styles:
+
+\def\startitemize {\startitemgroup[]}
+\def\stopitemize {\stopitemgroup}
+\def\setupitemize {\setupitemgroup[]}
+
\protect \endinput
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
index 9df225d31..84219cb75 100644
--- a/tex/context/base/core-job.tex
+++ b/tex/context/base/core-job.tex
@@ -60,14 +60,19 @@
% \readlocfile{#1}{}{}
% \doglobal\decrement\fileprocesslevel}
-\def\processlocalfile#1#2%
+\def\dostarttextfile#1%
{\doglobal\increment\fileprocesslevel
- \setxvalue{\c!file::\fileprocesslevel}{#2}%
- \@EA\doglobal\@EA\addtocommalist\@EA{#2}\processedfiles
- % #1=\readlocfile|\readsetfile{dir} #2=filename
- #1{#2}\donothing\donothing
- \doglobal\decrement\fileprocesslevel}
+ \setxvalue{\c!file::\fileprocesslevel}{#1}%
+ \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles}
+
+\def\dostoptextfile
+ {\doglobal\decrement\fileprocesslevel}
+\def\processlocalfile#1#2%
+ {% #1=\readlocfile|\readsetfile{dir} #2=filename
+ % #1{#2}\donothing\donothing
+ #1{#2}\donothing{\readfile{#2}\donothing\donothing}}
+
\def\processfile#1%
{\ifx\allinputpaths\empty
\def\next{\processlocalfile\readlocfile}%
@@ -257,7 +262,9 @@
\def\doexecutefile#1%
{\registreerfileinfo[begin]{#1}%
+ \dostarttextfile{#1}%
\processfile{#1}%
+ \dostoptextfile
\registreerfileinfo[end]{#1}}
\def\donotexecutefile#1%
@@ -269,12 +276,16 @@
\def\omgeving #1 % at outermost level only
{\def\startomgeving ##1 {}%
\let\stopomgeving\relax
+ \dostarttextfile{#1}%
\startreadingfile
\processfile{#1}% was : \readlocfile{#1}{}{}
- \stopreadingfile}
+ \stopreadingfile
+ \dostoptextfile}
\def\onderdeel #1 % at outermost level only
- {\processfile{#1}}
+ {\dostarttextfile{#1}%
+ \processfile{#1}%
+ \dostoptextfile}
\def\environment{\omgeving} % for the moment, no \let !
@@ -399,6 +410,10 @@
\appendtoks \flushnotes \to \everydisplay
\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
+
+%D Better here than in supp-mps:
+
+\def\executesystemcommand{\immediate\write18}
% Default-instellingen (verborgen)
diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex
index b20f61b63..35aa0523d 100644
--- a/tex/context/base/core-mis.tex
+++ b/tex/context/base/core-mis.tex
@@ -1068,10 +1068,10 @@
% seldom used, move from kernel to run time module
-\def\rooster
- {\dosingleempty\dorooster}
+\def\basegrid
+ {\dosingleempty\dobasegrid}
-\def\dorooster[#1]%
+\def\dobasegrid[#1]%
{\begingroup
\getparameters[\??rt]
[\c!x=0,\c!y=0,
@@ -1104,38 +1104,38 @@
\!!width \linewidth
\!!height \dimen2
\!!depth \!!zeropoint}%
- \doglobal\newcounter\@@roosterc
- \doglobal\newcounter\@@roosterd
- \doglobal\newcounter\@@roostere
+ \doglobal\newcounter\@@gridc
+ \doglobal\newcounter\@@gridd
+ \doglobal\newcounter\@@gride
\def\setlegend##1##2##3%
- {\gdef\@@roosterc{0}%
+ {\gdef\@@gridc{0}%
\dimen0=2em\relax
\dimen2=##2\@@rteenheid\relax
\dimen2=\@@rtschaal\dimen2\relax
\dimen2=\@@rtfactor\dimen2\relax
\divide\dimen0 \dimen2\relax
- \xdef\@@roostere{\number\dimen0}%
- \ifnum\@@roostere>50
- \gdef\@@roostere{100}%
- \else\ifnum\@@roostere>10
- \gdef\@@roostere{50}%
- \else\ifnum\@@roostere>5
- \gdef\@@roostere{10}%
- \else\ifnum\@@roostere>1
- \gdef\@@roostere{5}%
+ \xdef\@@gride{\number\dimen0}%
+ \ifnum\@@gride>50
+ \gdef\@@gride{100}%
+ \else\ifnum\@@gride>10
+ \gdef\@@gride{50}%
+ \else\ifnum\@@gride>5
+ \gdef\@@gride{10}%
+ \else\ifnum\@@gride>1
+ \gdef\@@gride{5}%
\else
- \gdef\@@roostere{1}%
+ \gdef\@@gride{1}%
\fi\fi\fi\fi
- \gdef\@@roosterd{0}%
+ \gdef\@@gridd{0}%
\def\legend
- {\ifnum\@@roosterd=\zerocount
+ {\ifnum\@@gridd=\zerocount
\vbox
- {\increment(\@@roosterc,##1)%
- \hbox to 2em{\hss\@@roosterc\hss}}%
- \global\let\@@roosterd=\@@roostere
+ {\increment(\@@gridc,##1)%
+ \hbox to 2em{\hss\@@gridc\hss}}%
+ \global\let\@@gridd=\@@gride
\fi
- \doglobal\decrement\@@roosterd
- \doglobal\increment(\@@roosterc,##1)}}%
+ \doglobal\decrement\@@gridd
+ \doglobal\increment(\@@gridc,##1)}}%
\def\draw##1##2##3##4##5##6##7##8##9%
{\setuppositioning
[\c!status=##8,
@@ -1178,6 +1178,8 @@
\draw\legend\@@rtny0\@@rtdy\legend{-2em}{-.75ex}\v!overlay\@@rtplaats}%
\stoppositioning
\endgroup}
+
+\let\grid\basegrid
% Dit wordt:
%
diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex
index 9565febdc..4cc15f433 100644
--- a/tex/context/base/core-pos.tex
+++ b/tex/context/base/core-pos.tex
@@ -1687,8 +1687,8 @@
\c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]%
\getparameters[\??td#1][#2]%
\doifvalue{\??td#1\c!status}\v!start\checktextbackgrounds
- \unexpanded\setvalue{#1}%
- {\groupedcommand{\starttextbackground[#1]}{\stoptextbackground}}%
+ \unexpanded\setvalue{#1}%
+ {\groupedcommand{\starttextbackground[#1]}{\stoptextbackground}}%
\setvalue{\e!start#1}{\starttextbackground[#1]}%
\setvalue{\e!stop #1}{\stoptextbackground}%
\fi}
@@ -1757,6 +1757,8 @@
\c!kaderkleur=red,
\c!achtergrond=,
\c!variant=1]
+
+\ifx\basegrid\undefined \else \letvalue\v!grid=\basegrid \fi
% lelijk, aanpassen, opties
diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex
index d233225fa..1376030fa 100644
--- a/tex/context/base/core-sys.tex
+++ b/tex/context/base/core-sys.tex
@@ -18,10 +18,11 @@
\def\outputfilename{\@@svfile}
\def\inputfilename {\@@svinputfile}
+\let\jobfilesuffix\c!tex
+
\def\splitjobfilename
- {\edef\ascii{\inputfilename}\convertcommand\ascii\to\ascii
- %\beforesplitstring\ascii\at.\to\jobfilename
- %\aftersplitstring \ascii\at.\to\jobfilesuffix
+ {\resetsystemmode{suffix-\jobfilesuffix}%
+ \edef\ascii{\inputfilename}\convertcommand\ascii\to\ascii
\splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix
\lowercasestring\jobfilesuffix\to\jobfilesuffix
\doifnothing\jobfilename {\let\jobfilename \jobname}%
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index 2bf47a88d..b84ce5e37 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -8,29 +8,29 @@
%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.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
\writestatus{loading}{Context Core Macros / Tabulation}
-% \processbetween gebruiken in head/tail macros
+% \processbetween gebruiken in head/tail macros
\unprotect
-% watch out, cells expand pretty late on a per row basis
+% watch out, cells expand pretty late on a per row basis
% |p2|p3| 2:3
-% spanning
+% spanning
-% Be careful with changing the hsize calculation in p mode;
+% Be careful with changing the hsize calculation in p mode;
% the following code works quite well:
-%
+%
% \setupfield [line][location=low,height=1.2\lineheight,width=\hsize]
% \definefield [test] [line] [line] []
-%
+%
% \starttabulate[|l|p|]
-% \NC test \NC \field [test] \NC \NR
-% \stoptabulate
+% \NC test \NC \field [test] \NC \NR
+% \stoptabulate
% In-text tabbing environment
%
@@ -63,9 +63,9 @@
% j i<n> skip right of column
% k i<n> skip around column
-% g g{char} align at char
-% . align at .
-% , align at ,
+% g g{char} align at char
+% . align at .
+% , align at ,
% Still to be done
@@ -76,16 +76,16 @@
% ~ \hskip.5em
% | check
-% nesting
+% nesting
% 10 evt auto stack; dan wel andere signal dan void nodig
-% present but not yet 100% ok
+% present but not yet 100% ok
%
% \FL top hrule
% \ML mid hrule (with auto split)
% \LL bottom hrule
-% \HL
+% \HL
% \VL as soon as needed
% color as soon as needed
@@ -93,15 +93,15 @@
% \EQ \RQ \HQ equal (raw, hook)
% \NC \RC \HC normal (raw, hook)
%
-% \NR
+% \NR
-% \HR : rule with lineheight
+% \HR : rule with lineheight
-% tricky: align scans ahead, over # and expands ones before
-% while doing
+% tricky: align scans ahead, over # and expands ones before
+% while doing
-% new:
-%
+% new:
+%
% \starttabulate[|cg{.}|cg{,}|cg{,}|]
% \NC period \NC comma \NC comma \NC\NR
% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR
@@ -109,7 +109,7 @@
% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR
% \NG 10 \NG 10 \NG 0,00 \NC\NR
% \stoptabulate
-%
+%
% \starttabulate[|c.|c,|c,|]
% \NC period \NC comma \NC comma \NC\NR
% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR
@@ -151,7 +151,7 @@
\newif \ifsplittabulate \splittabulatetrue
\newif \ifhandletabulatepbreak \handletabulatepbreaktrue
\newif \iftabulateequal
-\newif \iftracetabulate
+\newif \iftracetabulate
\newif \ifframedtabulate
\newdimen \tabulatepwidth
@@ -163,15 +163,15 @@
% [|lg{.}|] => \NG 12.34 \NC
-\gdef\handletabulatecharalign#1 % space delimited !
+\gdef\handletabulatecharalign#1 % space delimited !
{\edef\alignmentclass{\tabulatecolumn}%
\edef\alignmentcharacter{\getvalue{\@@tabalign@@\tabulatecolumn}}%
\ifcase\tabulatepass\or
\setfirstpasscharacteralign\checkalignment{#1}%
- \fi % force hsize
+ \fi % force hsize
\setsecondpasscharacteralign\checkalignment{#1}}
-\def\noftabcolumns{16}
+\def\noftabcolumns{16}
\def\@@tabbox@@ {@@tabbox@}
\def\@@tabhook@@ {@@tabhook@}
@@ -181,7 +181,7 @@
% {\@EA\newbox\csname\@@tabbox@@\recurselevel\endcsname}
\def\tablebox#1%
- {\csname\@@tabbox@@\number#1\endcsname}
+ {\csname\@@tabbox@@\number#1\endcsname}
\def\checktablebox#1%
{\ifundefinedelse{\@@tabbox@@\number#1}%
@@ -198,7 +198,7 @@
\def\initializetableboxes#1%
{\dorecurse#1{\initializetablebox\recurselevel}}
-\initializetableboxes\noftabcolumns
+\initializetableboxes\noftabcolumns
\def\dotabulatenobreak
{\noalign
@@ -208,12 +208,12 @@
\par
\kern-\linewidth
\nobreak
- \fi}}
+ \fi}}
\let\notabulatehook\empty
\def\checktabulatehook
- {\ifnum\tabulatetype<2
+ {\ifnum\tabulatetype<\plustwo
%\global\let\tabulatehook\relax
\global\let\tabulatehook\notabulatehook
\else
@@ -268,9 +268,9 @@
%\doifdefinedelse{\@@tabalign@@\the\tabulatecolumns}
% {\appendtoks\handletabulatecharalign## \to\!!toksa}
% {\appendtoks\tabulatehook ##\to \!!toksa}%
- % waarom kan ik hier geen \xx{##} geven, om een of
- % andere reden passeert dan tex de hele regel (incl \NC's)
- % als argument; elke delimiter <> space gaat trouwens fout
+ % waarom kan ik hier geen \xx{##} geven, om een of
+ % andere reden passeert dan tex de hele regel (incl \NC's)
+ % als argument; elke delimiter <> space gaat trouwens fout
\appendtoks \unskip\unskip\ifmmode\else\endgraf\fi\egroup\to\!!toksa
\appendtoks\ifnum\tabulatetype=1 \else \to\!!toksa
\@EA\appendtoks \the\tabulateafter\to\!!toksa
@@ -317,7 +317,7 @@
\else\ifx .\next \def\nextnext{\gettabulatealign.}%
\else\ifx ,\next \def\nextnext{\gettabulatealign,}%
\else \message{unknown preamble key [\meaning\next]}%
- \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi
\fi
\nextnext}
@@ -469,8 +469,8 @@
\def\settabulatepheight
{\scratchdimen\ht\tablebox\tabulatecolumn\relax
- \ifdim\scratchdimen>\tabulatemaxpheight
- \global\tabulatemaxpheight\scratchdimen
+ \ifdim\scratchdimen>\tabulatemaxpheight
+ \global\tabulatemaxpheight\scratchdimen
\fi}
\def\handletabulatepbreak
@@ -480,12 +480,12 @@
\dotabulatenobreak
\fi
\doglobal\increment\tabulateminplines
- \ifnum\tabulateminplines=\tabulatemaxplines\relax
+ \ifnum\tabulateminplines=\tabulatemaxplines\relax
\dotabulatenobreak
\fi
\fi \fi}}
-%D \startbuffer
+%D \startbuffer
%D \starttabulatie[|c|p|p|]
%D \NC \bf Alpha \NC \bf Beta \NC \bf Gamma \NC\NR
%D \NC 1 \NC right indeed \NC definitely wrong \NC\NR
@@ -495,11 +495,11 @@
%D \NC 5 \NC \thinrules[n=5] \NC \thinrules[n=5] \NC\NR
%D \NC 6 \NC \thinrules[n=3] \NC \thinrules[n=4] \NC\NR
%D \stoptabulate
-%D \stopbuffer
-%D
+%D \stopbuffer
+%D
%D \typebuffer {\tracetabulatetrue\haalbuffer}
%D
-%D \startbuffer
+%D \startbuffer
%D \starttabulatie[|c|p|p|]
%D \NC \bf Alpha \NC \bf Beta \NC \bf Gamma \NC\NR
%D \NC 1 \NC right indeed \NC definitely wrong \NC\NR
@@ -507,7 +507,7 @@
%D \NC 3 \NC very true \NC as false as can be \NC\NR
%D \NC 4 \NC the whole truth \NC but the truth \NC\NR
%D \stoptabulatie
-%D \stopbuffer
+%D \stopbuffer
%D
%D \typebuffer {\tracetabulatetrue\haalbuffer}
@@ -528,7 +528,7 @@
\c!binnen,\c!inspringen,\c!marge,\c!uitlijnen,
\c!lijnkleur,\c!lijndikte,EQ]}%
\copyparameters
- [\??tt#1::#2][\??tt#1::]%
+ [\??tt#1::#2][\??tt#1::]%
[\c!eenheid,\c!afstand,\c!voor,\c!korps,\c!na,
\c!binnen,\c!inspringen,\c!kader,
\c!marge,\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]%
@@ -563,7 +563,7 @@
% \def\fulltabulatecontent
% {\tabulatecontent}
-
+
\def\fulltabulatecontent
{\ifx\tabulateheadcontent\empty\else
\TABLEnoalign{\global\settrue\tabulatesomeamble}%
@@ -579,16 +579,16 @@
\setvalue{\e!start\e!tabulatehead}%
{\dosingleempty\dostartstarttabulatehead}
-\def\dostartstarttabulatehead[#1]%
+\def\dostartstarttabulatehead[#1]%
{\processcontent{\e!stop\e!tabulatehead}\next
- {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!hoofd}\next}}
+ {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!hoofd}\next}}
\setvalue{\e!start\e!tabulatetail}%
{\dosingleempty\dostartstarttabulatetail}
-\def\dostartstarttabulatetail[#1]%
+\def\dostartstarttabulatetail[#1]%
{\processcontent{\e!stop\e!tabulatetail}\next
- {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!voet}\next}}
+ {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!voet}\next}}
\def\dosubstarttabulate
{\dodoubleempty\dodosubstarttabulate}
@@ -604,32 +604,32 @@
\getparameters[\??tt\e!tabulate::][#2]%
\fi
\iffirstargument
- \def\next{\dofinalstarttabulate[\e!tabulate][][#1]}%
+ \def\next{\dofinalstarttabulate[\e!tabulate][][#1]}%
\else
- \def\next{\dofinalstarttabulate[\e!tabulate][][|l|p|]}%
+ \def\next{\dofinalstarttabulate[\e!tabulate][][|l|p|]}%
\fi
\next}
-\newtoks\everytabulate
+\newtoks\everytabulate
\chardef\tabulatepass=0
-\def\dofinalstarttabulate[#1][#2][#3]% identifier sub preamble
+\def\dofinalstarttabulate[#1][#2][#3]% identifier sub preamble
{\edef\currenttabulate{#1::#2}%
\ifinsidefloat \else
\witruimte
\getvalue{\??tt\currenttabulate\c!voor}%
\fi
- \bgroup
- % todo: spacing around tabulate when bodyfont is set
- % expansion en test needed ?
+ \bgroup
+ % todo: spacing around tabulate when bodyfont is set
+ % expansion en test needed ?
\doifvaluesomething{\??tt\currenttabulate\c!korps}
{\expanded{\switchtobodyfont
[\getvalue{\??tt\currenttabulate\c!korps}]}}%
- \postponefootnotes % new, to be tested
+ \postponefootnotes % new, to be tested
\chardef\tabulatepass\plusone
\widowpenalty\zerocount % otherwise lines are not broken
\clubpenalty \zerocount % but overlap in funny ways
- \the\everytabulate
+ \the\everytabulate
\getvalue{\??tt\currenttabulate\c!binnen}%
\scratchdimen\leftskip
\advance\scratchdimen \hangindent
@@ -641,7 +641,7 @@
{\dorecurse{##1}{\appendtoks##2\to\!!toksb}\do}%
\def\do
{\futurelet\next\dodo}%
- \def\dodo % \@EAEAEA gebruiken
+ \def\dodo % \@EAEAEA gebruiken
{\ifx\next\relax
% exit
\else\ifx*\next
@@ -665,15 +665,15 @@
\chardef\tabulatetype=0
-% 0 = NC column next EQ equal column
-% 1 = RC column raw RQ equal column raw
-% 2 = HC column hook HQ equal column hook
+% 0 = NC column next EQ equal column
+% 1 = RC column raw RQ equal column raw
+% 2 = HC column hook HQ equal column hook
\newif\iftabulatefirstflushed
\def\tabulateEQ
{\iftabulatefirstflushed\else\getvalue{\??tt\currenttabulate EQ}\fi
- \global\tabulateequalfalse}
+ \global\tabulateequalfalse}
\def\tabulatenormalcolumn#1%
{&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&}
@@ -686,10 +686,10 @@
\ifnum\tabulatecolumn>\tabulatecolumns\relax
\expandafter\NR
\else
- \expandafter\ignorespaces % interferes with the more tricky hooks
+ \expandafter\ignorespaces % interferes with the more tricky hooks
\fi}
-\def\setquicktabulate#1% see \startlegend \startgiven
+\def\setquicktabulate#1% see \startlegend \startgiven
{\let#1\tabulateautocolumn
\let\\\tabulateautocolumn}
@@ -699,7 +699,7 @@
\def\tabulateruleseperator%
{\bgroup
\let\factor\!!plusone
- \scratchskip\dp\strutbox
+ \scratchskip\dp\strutbox
\ExpandFirstAfter\processallactionsinset
[\getvalue{\??tt\currenttabulate\c!afstand}]
[ \v!blanko=>\scratchskip\bigskipamount,
@@ -720,7 +720,7 @@
% {\scratchdimen\getvalue{\??tt\currenttabulate\c!lijndikte}%
% \hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax
% \doifvalue{\??tt\currenttabulate\c!afstand}\v!grid
-% {\kern-\scratchdimen}}} % experimental tm-prikkels
+% {\kern-\scratchdimen}}} % experimental tm-prikkels
\def\dotabulaterule#1%
{\color
@@ -731,27 +731,27 @@
{\dotabulaterule
{\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax
\doifvalue{\??tt\currenttabulate\c!afstand}\v!grid
- {\kern-\scratchdimen}}} % experimental tm-prikkels
+ {\kern-\scratchdimen}}} % experimental tm-prikkels
\def\tabulateline
{\multispan\totaltabulatecolumns % \multispan is a plain macro
- % for the moment this one
- \strut\hskip\getvalue{\??tt\currenttabulate\c!marge}%
- % neg values are ok !
+ % for the moment this one
+ \strut\hskip\getvalue{\??tt\currenttabulate\c!marge}%
+ % neg values are ok !
\dotabulaterule
- {\!!heighta.5\lineheight
- \advance\!!heighta-\strutdepth
+ {\!!heighta.5\lineheight
+ \advance\!!heighta-\strutdepth
\!!deptha-\!!heighta
\advance\!!deptha\scratchdimen
\leaders\hrule\!!height\!!heighta\!!depth\!!deptha\hfill}%
\cr}
-%D When set to true, no (less) break optimization is done.
+%D When set to true, no (less) break optimization is done.
\newif\iftolerantTABLEbreak
-%D The main processing macro is large but splitting it up
-%D would make things less clear.
+%D The main processing macro is large but splitting it up
+%D would make things less clear.
\def\doregistertabulateparoptions
{\ifinsidefloat \else \iftrialtypesetting \else
@@ -760,24 +760,24 @@
% \global\let\registertabulateparoptions\empty
\fi \fi}
-\appendtoks
+\appendtoks
\global\let\registertabulateparoptions\doregistertabulateparoptions
-\to \everytabulate
+\to \everytabulate
\newtoks\everytabulaterow
-\appendtoks
+\appendtoks
\registertabulateparoptions
-\to \everytabulaterow
+\to \everytabulaterow
\def\flushtabulateindent
- {\ifnum\tabulatecolumn=\zerocount
+ {\ifnum\tabulatecolumn=\zerocount
\hbox to \tabulateindent
- {% we now have a local hsize, and since we want to
- % register positional info (i.e. real hsizes) we
+ {% we now have a local hsize, and since we want to
+ % register positional info (i.e. real hsizes) we
% need to reconstitute the original hsize
\advance\hsize\tabulateindent
- % this is indeed rather messy and took a few hours
+ % this is indeed rather messy and took a few hours
% to dis/uncover
\the\everytabulaterow
\hss}%
@@ -793,7 +793,7 @@
\ExpandFirstAfter\processaction % use \setalignmentswitch instead
[\getvalue{\??tt\currenttabulate\c!uitlijnen}]
[\v!normaal=>\def\@@tabulatealign{0},% = default value
- \v!rechts=>\def\@@tabulatealign{1},% chardefs gebruiken
+ \v!rechts=>\def\@@tabulatealign{1},% chardefs gebruiken
\v!links=>\def\@@tabulatealign{2},%
\v!midden=>\def\@@tabulatealign{3},%
\s!default=>\def\@@tabulatealign{0},%
@@ -810,29 +810,29 @@
\global\tabulatepwidth\zeropoint
\global\tabulateequalfalse
\resettabulatepheight
- \def\NC{\tabulatenormalcolumn0}%
- \def\RC{\tabulatenormalcolumn1}%
- \def\HC{\tabulatenormalcolumn2}%
- \def\EQ{\tabulateequalcolumn 0}%
- \def\RQ{\tabulateequalcolumn 1}%
- \def\HQ{\tabulateequalcolumn 2}%
- \def\NG{\NC\handletabulatecharalign}%
- \def\ND{\NC\handletabulatedigits}% new, undocumented, test first
- \def\HR % horizontal rule line (break untested)
+ \unexpanded \def\NC{\tabulatenormalcolumn0}%
+ \unexpanded \def\RC{\tabulatenormalcolumn1}%
+ \unexpanded \def\HC{\tabulatenormalcolumn2}%
+ \unexpanded \def\EQ{\tabulateequalcolumn 0}%
+ \unexpanded \def\RQ{\tabulateequalcolumn 1}%
+ \unexpanded \def\HQ{\tabulateequalcolumn 2}%
+ \unexpanded \def\NG{\NC\handletabulatecharalign}%
+ \unexpanded \def\ND{\NC\handletabulatedigits}% new, undocumented, test first
+ \unexpanded \def\HR % horizontal rule line (break untested)
{\TABLEnoalign
{\ifnum\noftabulatelines=\totalnoftabulatelines
\@EA\dotabulatenobreak
- \else
+ \else
\@EA\allowbreak
\fi}%
\tabulateline
\TABLEnoalign
- {\ifnum\noftabulatelines=\zerocount
+ {\ifnum\noftabulatelines=\zerocount
\@EA\dotabulatenobreak
\else
\@EA\allowbreak
\fi}}%
- \def\NR % next row
+ \unexpanded \def\NR % next row
{\doglobal\increment\noftabulatelines
\global\tabulatefirstflushedfalse
\global\tabulateequalfalse
@@ -841,22 +841,22 @@
\unskip\unskip\crcr\flushtabulated
\TABLEnoalign
{\iftolerantTABLEbreak\else
- \ifnum\noftabulatelines=\plusone
+ \ifnum\noftabulatelines=\plusone
\dotabulatenobreak
\else\ifnum\noftabulatelines=\minusnoftabulatelines
- \ifnum\tabulatemaxplines<2
+ \ifnum\tabulatemaxplines<2
\dotabulatenobreak
\fi
\fi\fi
\fi
\global\tabulatefirstflushedfalse}}%
\let\HL\empty \let\SR\NR \let\AR\NR
- \let\FL\empty \let\FR\NR
+ \let\FL\empty \let\FR\NR
\let\ML\empty \let\MR\NR
\let\LL\empty \let\LR\NR
\global\let\flushtabulated\empty
\let\savedbar|\let|\nexttabulate
- \tabskip\zeropoint
+ \tabskip\zeropoint
\ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint
\!!toksa{&\flushtabulateindent\strut##%
\tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut
@@ -872,7 +872,7 @@
\advance\scratchcounter4%
\edef\totaltabulatecolumns{\the\scratchcounter}%
\tabulatewidth\zeropoint
- % \dorecurse\tabulatecolumns % can be made faster
+ % \dorecurse\tabulatecolumns % can be made faster
% {\doifundefinedelse{\@@tabbox@@\recurselevel}
% {\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}%
% {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}%
@@ -901,11 +901,11 @@
\setbox0\vbox % outside if because of line counting
{\footnotesenabledfalse
\let\tabulateindent\!!zeropoint
- \trialtypesettingtrue % very important
+ \trialtypesettingtrue % very important
\@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}}%
\ifnum\nofautotabulate>\zerocount
- % so, even if the natural size is larger, in the final
- % run, we force the calculated width
+ % so, even if the natural size is larger, in the final
+ % run, we force the calculated width
\tabulatewidth\hsize
\advance\tabulatewidth -\wd0
\advance\tabulatewidth -\tabulatepwidth
@@ -966,7 +966,7 @@
\let\minusnoftabulatelines\noftabulatelines
\decrement\minusnoftabulatelines
\doglobal\newcounter\noftabulatelines
- \def\HL{\TABLEnoalign
+ \unexpanded \def\HL{\TABLEnoalign
{\ifnum\noftabulatelines=\zerocount \@EA \FL\else
\ifnum\noftabulatelines<\totalnoftabulatelines\relax\@EAEAEA\ML\else
\@EAEAEA\LL\fi\fi}}%
@@ -978,7 +978,7 @@
\vskip\dp\strutbox
\vskip\dp\strutbox}%
\baselinecorrection}%
- \def\FL{\TABLEnoalign
+ \unexpanded \def\FL{\TABLEnoalign
{\ifinsidefloat\else
\doifemptyvalue{\??tt\currenttabulate\c!voor} % no expansion
{\tablebaselinecorrection}%
@@ -988,10 +988,10 @@
\tabulateruleseperator
\prevdepth\dp\strutbox
\dotabulatenobreak}}%
- \def\ML{\TABLEnoalign
+ \unexpanded \def\ML{\TABLEnoalign
{\tabulateruleseperator
\tabulaterule
- \ifnum\noftabulatelines>\plusone
+ \ifnum\noftabulatelines>\plusone
\ifnum\noftabulatelines<\minusnoftabulatelines
\vskip\topskip\allowbreak\vskip-\topskip
\vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}%
@@ -999,7 +999,7 @@
\fi
\fi
\tabulateruleseperator}}%
- \def\LL{\TABLEnoalign
+ \unexpanded \def\LL{\TABLEnoalign
{\dotabulatenobreak
\tabulateruleseperator
\dotabulatenobreak
@@ -1012,12 +1012,12 @@
\fi}}%
\startframedcontent[\getvalue{\??tt\currenttabulate\c!kader}]%
%
- \chardef\tabulatepass2
+ \chardef\tabulatepass\plustwo
\@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}%
\prevdepth\dp\strutbox % nog eens beter, temporary hack
\doifvalue{\??tt\currenttabulate\c!afstand}\v!grid
- {\vskip-\dp\strutbox}% experimental tm-prikkels
- %
+ {\vskip-\dp\strutbox}% experimental tm-prikkels
+ %
\stopframedcontent
%
\egroup
@@ -1033,7 +1033,7 @@
% \NC \digits{@@@.@10,@@} \NC\NR
% \NC \digits{@@@.@@1,@@} \NC\NR
% \stoptabulatie
-%
+%
% \starttabulatie[|mc|]
% \ND 100.000,00 \NC\NR
% \ND @10.000,00 \NC\NR
@@ -1041,7 +1041,7 @@
% \ND @@@.@10,@@ \NC\NR
% \ND @@@.@@1,@@ \NC\NR
% \stoptabulatie
-%
+%
% \starttabulatie[|c|]
% \ND $100.000,00$ \NC\NR
% \ND $@10.000,00$ \NC\NR
@@ -1049,7 +1049,7 @@
% \ND $@@@.@10,@@$ \NC\NR
% \ND $@@@.@@1,@@$ \NC\NR
% \stoptabulatie
-%
+%
% \starttabulatie[|c|]
% \NC $\digits 100.000,00 $ \NC\NR
% \NC $\digits @10.000,00 $ \NC\NR
@@ -1057,7 +1057,7 @@
% \NC $\digits @@@.@10,@@ $ \NC\NR
% \NC $\digits @@@.@@1,@@ $ \NC\NR
% \stoptabulatie
-%
+%
% \starttabulatie[|c|]
% \NC \digits $100.000,00$ \NC\NR
% \NC \digits $@10.000,00$ \NC\NR
@@ -1091,7 +1091,7 @@
\c!na=\blanko,
\c!afstand={\v!diepte,\v!middel},
\c!uitlijnen=\v!normaal,
- \c!marge=\!!zeropoint,
+ \c!marge=\!!zeropoint,
\c!inspringen=\v!nee]
\protect \endinput
diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex
index 880d398b1..95d03f870 100644
--- a/tex/context/base/enco-def.tex
+++ b/tex/context/base/enco-def.tex
@@ -22,6 +22,9 @@
\startencoding[default]
+\definecharacter textcomma ,
+\definecharacter textperiod .
+
\definecharacter textacute 19
\definecharacter textbottomdot 46
\definecharacter textbreve 21
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index 3e7534bdc..03751b224 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -3744,12 +3744,14 @@
\unexpanded\def\getglyph#1#2% slow, faster, much faster
%{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}}
%{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}}
- {{\symbolicfont{#1}#2}}
+ %{{\symbolicfont{#1}#2}}
+ {{\symbolicfont{#1}\doifnumberelse{#2}\char\donothing#2}}
\unexpanded\def\getrawglyph#1#2% for simple symbols
{{\scaledfont\fontbody
\font\definedfont=#1 at \currentfontbodyscale\scaledfont
- \definedfont#2}}
+ %\definedfont#2}}
+ \definedfont\doifnumberelse{#2}\char\donothing#2}}
%D The last implementation of \type {\getglyph} permits
%D definitions like:
diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex
index dd13fea2b..0377be96b 100644
--- a/tex/context/base/font-run.tex
+++ b/tex/context/base/font-run.tex
@@ -175,7 +175,7 @@
\fi}}
\stopoverlay}}}
\par}}
- {\tf\rooster[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!eenheid=em]}
+ {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!eenheid=em]}
\stopoverlay
\nointerlineskip
\vskip2pt
diff --git a/tex/context/base/java-ans.tex b/tex/context/base/java-ans.tex
index ab10bb2a8..636c894f9 100644
--- a/tex/context/base/java-ans.tex
+++ b/tex/context/base/java-ans.tex
@@ -16,6 +16,7 @@
function Do_Check_Answer (field, value)
{ if (event.value.toLowerCase()==value.toLowerCase())
{ event.target.hidden = true }
+ % { event.target.display = display.hidden }
return("\040") } // funny, "" does not work
\stopJSpreamble
diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex
index 37175f84e..6c77cdf55 100644
--- a/tex/context/base/java-fld.tex
+++ b/tex/context/base/java-fld.tex
@@ -131,16 +131,21 @@
\startJSpreamble {Field} used now
+function PresetFields ()
+ { this.syncAnnotScan() }
+
var visible_field = new Array() ; % no garbage collection !
var visible_fields = 0 ;
function Hide_When_Down ()
{ event.target.hidden = true }
+% { event.target.display = display.hidden }
function Hide_Field ( Name )
{ var v = this.getField(Name) ;
if (v)
{ v.hidden = true ;
+ % { v.display = display.hidden ;
v.readonly = true ;
this.dirty = false } }
@@ -150,6 +155,7 @@ function Do_Vide_Field ( Name, Closable )
{ ++visible_fields ;
visible_field[visible_fields] = Name ;
v.hidden = false ;
+ % v.display = display.visible ;
if (Closable)
{ v.readonly = false ;
v.value = "On" }
@@ -176,7 +182,13 @@ function Vide_Hide_Fields ( Name ) % show only one field
function Toggle_Hide ( Name )
{ var v = this.getField(Name) ;
- if (v) { v.hidden = !v.hidden ; this.dirty = false } }
+ if (v)
+ { v.hidden = !v.hidden ;
+ % if v.display == display.hidden
+ % { v.display = display.visible }
+ % else
+ % { v.display = display.hidden }
+ this.dirty = false } }
function Field_On ( Name )
{ v = this.getField(Name) ;
@@ -205,6 +217,10 @@ function Flip_Fields ( Name )
{ v = this.getField(Names[i]) ;
if (v)
{ v.hidden = !v.hidden ;
+ % if v.display == display.hidden
+ % { v.display = display.visible }
+ % else
+ % { v.display = display.hidden }
v.value = "On" } } }
function Forget_Changes ()
diff --git a/tex/context/base/lang-ger.tex b/tex/context/base/lang-ger.tex
index 995986e26..d73f4f902 100644
--- a/tex/context/base/lang-ger.tex
+++ b/tex/context/base/lang-ger.tex
@@ -318,7 +318,7 @@
\setupheadtext [\s!nl] [\v!tabellen=Tabellen]
\setupheadtext [\s!de] [\v!tabellen=Tabellen]
\setupheadtext [\s!da] [\v!tabellen=Tabeller]
-\setupheadtext [\s!sv] [\v!tabellen=Tabellen]
+\setupheadtext [\s!sv] [\v!tabellen=Tabeller]
\setupheadtext [\s!af] [\v!tabellen=Tabelle]
\setupheadtext [\s!no] [\v!tabellen=Tabeller]
@@ -326,7 +326,7 @@
\setupheadtext [\s!nl] [\v!figuren=Figuren]
\setupheadtext [\s!de] [\v!figuren=Abbildungen]
\setupheadtext [\s!da] [\v!figuren=Figurer]
-\setupheadtext [\s!sv] [\v!figuren=Figuren]
+\setupheadtext [\s!sv] [\v!figuren=Figurer]
\setupheadtext [\s!af] [\v!figuren=Figure]
\setupheadtext [\s!no] [\v!figuren=Figurer]
@@ -334,7 +334,7 @@
\setupheadtext [\s!nl] [\v!grafieken=Grafieken]
\setupheadtext [\s!de] [\v!grafieken=Graphiken]
\setupheadtext [\s!da] [\v!grafieken=Grafik]
-\setupheadtext [\s!sv] [\v!grafieken=Grafiskt]
+\setupheadtext [\s!sv] [\v!grafieken=Grafik]
\setupheadtext [\s!af] [\v!grafieken=Grafieke]
\setupheadtext [\s!no] [\v!grafieken=Grafikk]
@@ -342,7 +342,7 @@
\setupheadtext [\s!nl] [\v!intermezzos=Intermezzo's]
\setupheadtext [\s!de] [\v!intermezzos=Intermezzi]
\setupheadtext [\s!da] [\v!intermezzos=Intermezzoer]
-\setupheadtext [\s!sv] [\v!intermezzos=Intermezzot]
+\setupheadtext [\s!sv] [\v!intermezzos=Intermezzon]
\setupheadtext [\s!af] [\v!intermezzos=Intermezzos]
\setupheadtext [\s!no] [\v!intermezzos=Intermesso]
@@ -350,7 +350,7 @@
\setupheadtext [\s!nl] [\v!index=Index]
\setupheadtext [\s!de] [\v!index=Index]
\setupheadtext [\s!da] [\v!index=Indeks]
-\setupheadtext [\s!sv] [\v!index=Index]
+\setupheadtext [\s!sv] [\v!index=Sakregister]
\setupheadtext [\s!af] [\v!index=Indeks]
\setupheadtext [\s!no] [\v!index=Indeks]
@@ -358,7 +358,7 @@
\setupheadtext [\s!nl] [\v!afkortingen=Afkortingen]
\setupheadtext [\s!de] [\v!afkortingen=Abk\uumlaut rzungen]
\setupheadtext [\s!da] [\v!afkortingen=Forkortelser]
-\setupheadtext [\s!sv] [\v!afkortingen=F\oumlaut rkortningen]
+\setupheadtext [\s!sv] [\v!afkortingen=F\oumlaut rkortningar]
\setupheadtext [\s!af] [\v!afkortingen=Afkortings]
\setupheadtext [\s!no] [\v!afkortingen=Forkortelser]
@@ -366,7 +366,7 @@
\setupheadtext [\s!nl] [\v!logos=Logo's]
\setupheadtext [\s!de] [\v!logos=Logos]
\setupheadtext [\s!da] [\v!logos=Logoer]
-\setupheadtext [\s!sv] [\v!logos=Logo]
+\setupheadtext [\s!sv] [\v!logos=Loggor]
\setupheadtext [\s!af] [\v!logos=Logos]
\setupheadtext [\s!no] [\v!logos=Logoer]
@@ -374,7 +374,7 @@
\setupheadtext [\s!nl] [\v!eenheden=Eenheden]
\setupheadtext [\s!de] [\v!eenheden=Einheiten]
\setupheadtext [\s!da] [\v!eenheden=Enheder]
-\setupheadtext [\s!sv] [\v!eenheden=Enheten]
+\setupheadtext [\s!sv] [\v!eenheden=Enheter]
\setupheadtext [\s!af] [\v!eenheden=Eenhede]
\setupheadtext [\s!no] [\v!eenheden=Enheter]
@@ -406,7 +406,7 @@
\setuplabeltext [\s!nl] [\v!grafiek=Grafiek ]
\setuplabeltext [\s!de] [\v!grafiek=Graphik ]
\setuplabeltext [\s!da] [\v!grafiek=Grafik ]
-\setuplabeltext [\s!sv] [\v!grafiek=Grafisk ]
+\setuplabeltext [\s!sv] [\v!grafiek=Grafik ]
\setuplabeltext [\s!af] [\v!grafiek=Grafiek ]
\setuplabeltext [\s!no] [\v!grafiek=Grafikk ]
@@ -478,7 +478,7 @@
\setuplabeltext [\s!nl] [\v!regels=regels ]
\setuplabeltext [\s!de] [\v!regels=Zeilen ]
\setuplabeltext [\s!da] [\v!regels=linier ] % or linjer
-\setuplabeltext [\s!sv] [\v!regels=raden ]
+\setuplabeltext [\s!sv] [\v!regels=rader ]
\setuplabeltext [\s!af] [\v!regels=re\ediaeresis ls ]
\setuplabeltext [\s!no] [\v!regels=linjer ]
@@ -655,6 +655,12 @@
\setuplabeltext [\s!da] [\v!hieronder=se forneden]
\setuplabeltext [\s!da] [\v!zie=se ]
+\setuplabeltext [\s!sv] [\v!pagina=Sida ]
+\setuplabeltext [\s!sv] [\v!oppagina=p\aring\ sida ]
+\setuplabeltext [\s!sv] [\v!hierboven=se ovan]
+\setuplabeltext [\s!sv] [\v!hieronder=se nedan]
+\setuplabeltext [\s!sv] [\v!zie=se ]
+
\setuplabeltext [\s!no] [\v!pagina=Side ]
\setuplabeltext [\s!no] [\v!oppagina=p\aring\ side ]
\setuplabeltext [\s!no] [\v!hierboven=se foroven]
diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex
index 1e3f23d13..31a75f62d 100644
--- a/tex/context/base/m-chart.tex
+++ b/tex/context/base/m-chart.tex
@@ -545,7 +545,7 @@
end_chart ;
\stopMPdrawing
\MPdrawingdonetrue
- \setbox0=\hbox
+ \setbox0\hbox
{\MPstaticgraphictrue
\MPshiftdrawingfalse
\getMPdrawing}%
@@ -562,33 +562,33 @@
\getMPdata
\doglobal\newcounter\FLOWcomment
\let\startFLOWcell\startFLOWcellD
- \setbox2=\vbox to \ht0
+ \setbox2\vbox to \ht0
{\forgetall % \offinterlineskip
\resetFLOWlocation
\processFLOWbuffer\currentFLOWnumber\vss}%
- \setbox2=\hbox
+ \setbox2\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}%
- \wd2=\wd0\ht2=\ht0\dp2=\dp0
+ \wd2\wd0\ht2\ht0\dp2\dp0
\let\startFLOWcell\startFLOWcellE
- \setbox4=\vbox to \ht0
+ \setbox4\vbox to \ht0
{\forgetall % \offinterlineskip
\resetFLOWlocation
\processFLOWbuffer\currentFLOWnumber\vss}%
- \setbox4=\hbox
+ \setbox4\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}%
- \wd4=\wd0\ht4=\ht0\dp4=\dp0
+ \wd4\wd0\ht4\ht0\dp4\dp0
\doifelse\@@FLOWoptie\v!test
- {\setbox6=\vbox
+ {\setbox6\vbox
{\forgetall
\vskip\@@FLOW@@offset
\hskip\@@FLOW@@offset
- \rooster
+ \basegrid
[\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth,
\c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight,
\c!xstap=1,\c!ystap=1,
\c!eenheid=pt,\c!plaats=\v!midden]}%
- \wd6=\wd0\ht6=\ht0\dp6=\dp0
- \setbox8=\vbox
+ \wd6\wd0\ht6\ht0\dp6\dp0
+ \setbox8\vbox
{\forgetall\offinterlineskip
\vskip\@@FLOW@@offset
\dostepwiserecurse\@@FLOWy\@@FLOWny\plusone
@@ -606,7 +606,7 @@
{}%
\hfill}}}
\vfill}}}%
- \wd8=\wd0\ht8=\ht0\dp8=\dp0
+ \wd8\wd0\ht8\ht0\dp8\dp0
\framed
[\c!offset=\v!overlay,\c!kaderkleur=green]
{\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}}
diff --git a/tex/context/base/m-pstric.tex b/tex/context/base/m-pstric.tex
index 4fb3ae7a5..34aee9cbe 100644
--- a/tex/context/base/m-pstric.tex
+++ b/tex/context/base/m-pstric.tex
@@ -81,9 +81,12 @@
\startTEXpage[#1]\box\scratchbox\stopTEXpage
\endbuffer
% Here we go!
- \immediate\write18{texexec \bufferprefix pstricks.tmp --once --batch}%
- \immediate\write18{dvips \bufferprefix pstricks}%
- \immediate\write18{ps2pdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}%
+ %\immediate\write18{texexec \bufferprefix pstricks.tmp --once --batch}%
+ %\immediate\write18{dvips -G0 -Ppdf \bufferprefix pstricks -o}%
+ %\immediate\write18{ps2pdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}%
+ \executesystemcommand{texexec \bufferprefix pstricks.tmp --once --batch}%
+ \executesystemcommand{dvips -G0 -Ppdf \bufferprefix pstricks -o}%
+ \executesystemcommand{ps2pdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}%
% We pick up the dimensions from the scratch file.
\readlocfile{\bufferprefix pstricks-dim.tmp}{}{}%
% Since the graphic is put on a page (sigh) by dvips/gs
diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex
index 602b7ec41..b5d1760b9 100644
--- a/tex/context/base/math-tex.tex
+++ b/tex/context/base/math-tex.tex
@@ -218,7 +218,7 @@
\definemathsymbol [forall] [ord] [sy] ["38]
\definemathsymbol [exists] [ord] [sy] ["39]
\definemathsymbol [neg] [ord] [sy] ["3A]
-\definemathsymbol [flat] [ord] [sy] ["5B]
+\definemathsymbol [flat] [ord] [mi] ["5B]
\definemathsymbol [natural] [ord] [mi] ["5C]
\definemathsymbol [sharp] [ord] [mi] ["5D]
\definemathsymbol [clubsuit] [ord] [sy] ["7C]
diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex
index fef55e603..34892efae 100644
--- a/tex/context/base/meta-ini.tex
+++ b/tex/context/base/meta-ini.tex
@@ -126,7 +126,7 @@
\def\dosetupMPvariables[#1][#2]%
{\ifsecondargument
- \getrawparameters[#1:][#2]%
+ \getrawparameters[#1:][#2]% brr, todo: [\@@meta#1:]
\else
\getrawparameters[\@@meta][#1]%
\fi}
@@ -156,6 +156,8 @@
\let\MPvar\MPvariable
+\let\setMPvariables\setupMPvariables
+
%D \macros
%D {startuniqueMPgraphic, uniqueMPgraphic}
%D
diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex
index bd9fedb34..c73d6d026 100644
--- a/tex/context/base/mult-com.tex
+++ b/tex/context/base/mult-com.tex
@@ -801,11 +801,12 @@ stelnummerin: stelnummerin setupnumber
setupitemgroups: stelitemgroepenin setupitemgroups
setupitemgroups setupitemgroups
setupitemgroups setupitemgroups
-% downward compatible
+
+ % downward compatible definitions
+
setupitemgroups: stelopsommingenin setupitemizations
stelleaufzaehlungenein nastavvycty
impostaelencazioni setareitemization
-% will be replaced / generatated
startitemize: startopsomming startitemize
startaufzaehlung startvycet
iniziaelenco startenumerare
@@ -815,7 +816,9 @@ stelnummerin: stelnummerin setupnumber
stopitemize: stopopsomming stopitemize
stopaufzaehlung stopvycet
terminaelenco stopenumerare
-%
+
+ % so far
+
definieerkop: definieerkop definehead
definiereueberschrift definujnadpis
definiscitesta definesteantet
@@ -864,7 +867,7 @@ stelnummerin: stelnummerin setupnumber
definelayout: definieerlayout definelayout
definelayout definelayout
definiscilayout definelayout %%%
- stellayoutin: stellayoutin setuplayout
+ setuplayout: stellayoutin setuplayout
stellelayoutein nastavvzhled
impostalayout seteazaaspect
paslayoutaan: paslayoutaan adaptlayout
@@ -1326,7 +1329,7 @@ movesidefloat: verplaatszijblok movesidefloat
colorbar: kleurenbalk colorbar
farbbalken barevnalista
barracolori baraculoare
- rooster: rooster grid
+ grid: rooster grid
gitter mrizka
griglia grid
button: button button
diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex
index 6928f13d2..186364762 100644
--- a/tex/context/base/mult-ini.tex
+++ b/tex/context/base/mult-ini.tex
@@ -1241,7 +1241,7 @@
%D because it sometimes generates spaces.
%D
%D \starttypen
-%D \def\setinterfacesetupconstant%
+%D \def\setinterfacesetupconstant
%D {\ifinterfacetranslation
%D \expandafter\setinterfaceconstant
%D \fi}
diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex
index 04df66168..6d3d04ff0 100644
--- a/tex/context/base/page-app.tex
+++ b/tex/context/base/page-app.tex
@@ -17,8 +17,8 @@
\unprotect
\def\dostartfittingpage[#1][#2]%
- {\pagina
- \bgroup
+ {\pagina % this is kind of tricky! there can be preceding page refs
+ \bgroup % resulting in a zero height page; test fig-make !
\dontcomplain
\setbox\scratchbox\hbox
\bgroup
@@ -50,7 +50,7 @@
\fi
\setuppapersize
[\??fp\s!dummy][\??fp\s!dummy]%
- \stellayoutin
+ \setuplayout
[\??fp\s!dummy]%
\startmakeup[\v!standaard][\c!tekststatus=\v!leeg,\c!dubbelzijdig=\v!nee,\c!pagina=]%
\centerbox{\box\scratchbox}%
diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex
index 376c98eb7..44e5e096e 100644
--- a/tex/context/base/page-flt.tex
+++ b/tex/context/base/page-flt.tex
@@ -271,15 +271,15 @@
\hsize\@@mbbreedte}%
\fi
\global\insidefloattrue
-\begingroup
-\the\everyinsidefloat
+ \begingroup % **
+ \the\everyinsidefloat
\let\@@extrafloat\empty
\presetmorefloatvariables{#2}%
\dowithnextboxcontent % better a \the\everyfloattoks
{\setlocalfloathsize
\postponefootnotes} % new
{\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}%
-\endgroup}
+ \doifnotinset\v!tekst{#2}\endgroup} % ** not yet done
\vbox}
\def\xxdocompletefloat#1#2%
@@ -790,6 +790,7 @@
{\dp\floatbox\openstrutdepth}% dp\strutbox}% % toegevoegd
\box\floatbox
\blanko[\@@bknawit]%
+ \endgroup % **
\doinsertfloatinfo}
\def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag
diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex
index 8e426caf9..cff58acf5 100644
--- a/tex/context/base/page-imp.tex
+++ b/tex/context/base/page-imp.tex
@@ -1173,7 +1173,7 @@
[\s!dummy][\c!hoogte=\@@iphoogte,\c!breedte=\@@ipbreedte]
\setuppapersize
[\s!dummy][\s!dummy]
- \stellayoutin % \setuplayout
+ \setuplayout
[\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
\c!hoogte=\v!midden,\c!breedte=\v!midden,
\c!tekstafstand=\!!zeropoint,
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index a770420a3..55d55ebef 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -1527,8 +1527,7 @@
\doifdefinedelse{\??cn:\OTRidentifier:\@@columnspecification}
{\getvalue{\??cn:\OTRidentifier:\@@columnspecification}}
{\doifdefinedelse{\??cn::\@@columnspecification}
- {\executecolumnbreakhandlers{\getvalue{\??cn
-::\@@columnspecification}}}
+ {\executecolumnbreakhandlers{\getvalue{\??cn::\@@columnspecification}}}
{\getvalue{\??cn:\OTRidentifier:\s!unknown}}}}
%let\nextcolumn\columnbreak
diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex
index dfbc7d9d1..2669585b0 100644
--- a/tex/context/base/page-lay.tex
+++ b/tex/context/base/page-lay.tex
@@ -611,7 +611,7 @@
\newif\ifdoublesidedprint
-\def\presetcenterpagebox % in \stellayoutin !!!!!!!!!!!!!!!!
+\def\presetcenterpagebox % in \setuplayout !!!!!!!!!!!!!!!!
{\doublesidedprintfalse
\ExpandFirstAfter\processallactionsinset
[\@@lyplaats]
@@ -629,26 +629,26 @@
\def\dodefinelayout[#1][#2]%
{\getparameters[\??ly#1][\c!status=\v!start,#2]}
-\def\dodostellayoutin[#1][#2]%
+\def\dodosetuplayout[#1][#2]%
{\ConvertToConstant\doifnot{#2}{\v!reset}
{\getparameters[\??ly#1][#2]%
\checkforems[#2]}}
-\def\dostellayoutin[#1][#2]%
+\def\dosetuplayout[#1][#2]%
{\let\currentlayout\empty
\ifsecondargument
- \dodostellayoutin[#1][#2]%
+ \dodosetuplayout[#1][#2]%
\else\iffirstargument
\doifassignmentelse{#1}
- {\dodostellayoutin[][#1]}
+ {\dodosetuplayout[][#1]}
{\doifnot{#1}\v!reset{\def\currentlayout{#1}}}%
\fi\fi
\recalculatelayout
\checkcurrentlayout % here ?
\presetcenterpagebox}
-\def\stellayoutin
- {\dodoubleempty\dostellayoutin}
+\def\setuplayout
+ {\dodoubleempty\dosetuplayout}
\let\@@zahoogte=\!!zeropoint
@@ -1091,7 +1091,7 @@
{\popmacro\currentlayout
\popmacro\restorepapersize
\restorepapersize
- \stellayoutin} % \setuplayout}
+ \setuplayout}
%D \macros
%D {showprint, showframe, showlayout, showsetups}
@@ -1122,7 +1122,7 @@
%D since they could change while going to a new page,
%D depending on the current font setting.
-\stellayoutin
+\setuplayout
[ \c!kopwit=.08417508418\papierhoogte, % 2.5cm
\c!boven=\!!zeropoint,
\c!bovenafstand=\!!zeropoint,
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index b29597af6..cc14f168e 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -1356,7 +1356,7 @@
\else
\dogetfloat
\ifdim\wd\floatbox>\finalcolumntextwidth % better somewhere else too
- \global\setbox\floatbox=\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
+ \global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
\fi % otherwise the graphic may disappear
\ifdim\wd\floatbox>\hsize
\dimen0\wd\floatbox
diff --git a/tex/context/base/page-run.tex b/tex/context/base/page-run.tex
index 07080f08c..963426621 100644
--- a/tex/context/base/page-run.tex
+++ b/tex/context/base/page-run.tex
@@ -26,7 +26,7 @@
\definepapersize[X][\c!breedte=4em, \c!hoogte=6em]%
\definepapersize[Y][\c!breedte=12em,\c!hoogte=14em]%
\setuppapersize[#1,X][#2,Y]%
- \stellayoutin[#3]%
+ \setuplayout[#3]%
\setbox0\vbox
{\framed
[\c!offset=\v!overlay,\c!strut=\v!nee,
@@ -377,7 +377,7 @@
{\bgroup
\pagina
\showframe
- \stellayoutin[\c!markering=\v!aan]
+ \setuplayout[\c!markering=\v!aan]
\dorecurse{4}{\showsetups\pagina}
\egroup}
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index d7d4409c3..2ec3de97b 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -250,7 +250,7 @@
\def\OTRSETdomakegridbox#1#2#3%
{\hbox\bgroup
\dontcomplain
- \forgetall % can go once in flush
+ \forgetall % can go once in \flush
\ifbalancecolumns
\ifnum\realpageno=\balancingpageno\relax
\!!heighta \localcolumnmaxcells\lineheight
@@ -424,6 +424,10 @@
\tekstbreedte\localcolumnwidth
\hsize\localcolumnwidth}
+\def\OTRSETsynchronizehsize
+ {\doifnotvalue{\??mc\OTRSETidentifier\the\mofcolumns\c!breedte}\v!passend
+ \OTRSETsethsize}
+
\def\OTRSETcheckfreelines
{\OTRSETsetvsize}
@@ -447,7 +451,8 @@
\fi
% brrr:
\ejectinsert
- \ejectpage} % no \OTRSETsethsize, can be mid smaller (like tabulate)
+ \ejectpage
+ \OTRSETsynchronizehsize} % no \OTRSETsethsize, can be mid smaller (like tabulate)
% \installcolumnbreakhandler {SET} \v!forceer
% {\OTRSETgotocolumn[\v!forceer]}
@@ -605,7 +610,10 @@
\fi
\OTRSETfindnextgap
% \message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait
- % \OTRSETsethsize % no, can be mid smaller (like tabulate)
+ % we cannot adapt the hsize since it may have changed (like
+ % inside a tabulate) so we only change it when there is a
+ % reason to do so
+ \OTRSETsynchronizehsize
\OTRSETsetvsize}
\def\OTRSETfindnextgap
@@ -626,7 +634,7 @@
\fi
\fi}
-\def\OTRSETcheckfreelines{}
+\let\OTRSETcheckfreelines\donothing
\def\OTRSETfillgapsbetweencells#1#2% col
{\ifnum\columngaplimit>\zerocount
@@ -1356,9 +1364,9 @@
\binnenkolommentrue % will be different flag
%\let\redofloatorder\gobbleoneargument % will also be a flag
\activateotr{SET}{ONE}% andere naam, activate or so
-\doifelsenothing{#1}
- {\globallet\OTRSETlist\s!default}
- {\xdef\OTRSETlist{#1}}%
+ \doifelsenothing{#1}
+ {\globallet\OTRSETlist\s!default}
+ {\xdef\OTRSETlist{#1}}%
\OTRSETstartnextpage
\OTRSETgetmanualbalance % here
\OTRSETassignwidths
@@ -1526,7 +1534,7 @@
\OTRSETcheckinsert
\OTRSETcheckgrid
\OTRSETsetvsize
- \OTRSETsethsize
+ \OTRSETsethsize % or local ?
\OTRSETsetplaceholders
\OTRSEThandlepreposttext
\initializecolumntextareas % name !
@@ -1676,11 +1684,15 @@
{\advance\scratchcounter \plusone }
{\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!afstand}}%
- \divide\scratchdimen \scratchcounter
+ \ifcase\scratchcounter\else
+ \divide\scratchdimen \scratchcounter
+ \fi
+ \setgvalue{\??mc\??mc\c!breedte}{0}%
\dorecurse\nofcolumns
{\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}\v!passend
{\dimen0=\scratchdimen}
- {\dimen0=\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
+ {\setgvalue{\??mc\??mc\c!breedte}{1}%
+ \dimen0=\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
\setxvalue{\??mc\recurselevel\??mc\c!breedte}{\the\dimen0}}}
\def\OTRSETlocalwidth#1%
@@ -1697,7 +1709,7 @@
{\hbox
{\localcolortrue
\setbox\scratchbox\hbox to \hsize
- {\iftracecolumnset
+ {\iftracecolumnset \incolortrue \localcolortrue
#2\hskip-.5ex\vrule\!!width1ex\!!height.5ex\!!depth.5ex\hss
\fi
\hss}%
@@ -1721,7 +1733,7 @@
\global\setbox\placeholderboxf\columnplaceholder1\darkgray}
\def\doOTRSETshowstatus
- {\llap{\tt\tfxx\blue
+ {\llap{\incolortrue \localcolortrue \tt\tfxx\blue
(\the\vsize->\number\columnfirstcell\#\number\columnfreecells)%
\hskip\leftskip}}
@@ -1914,7 +1926,7 @@
[ \v!links=>\doglobal\addtocommalist{#1}\columnleftareas,
\v!rechts=>\doglobal\addtocommalist{#1}\columnrightareas]%
\getparameters[\??mt#1#2]
- [\c!x=1,\c!y=1,\c!nx=1,\c!ny=1,
+ [\c!x=1,\c!y=1,\c!nx=1,\c!ny=1,\c!clipoffset=2\lineheight,
\c!offset=\v!overlay,\c!strut=\v!nee,\c!kader=\v!uit,
\c!status=\v!stop,#3]}}%
\else
@@ -2187,8 +2199,8 @@
\box\scratchbox
\else
% we only set \columnsetspacing when asked for, else bottom problems
- \scratchcounter\framedtextparameter{cs:#1}\c!nregels\relax
- \ifcase\scratchcounter\else\chardef\columnslotspacing\scratchcounter\fi
+ % don't change this any more (test naw)
+ \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nregels\relax
% todo: nboven/onder & \chardef\columnslotlocation2
%\OTRSETstoreincolumnslotHERE\scratchbox
\edef\floatmethod{\framedtextparameter{cs:#1}\c!default}%
diff --git a/tex/context/base/s-map-01.tex b/tex/context/base/s-map-01.tex
index 2bfea496d..0edf5aa5d 100644
--- a/tex/context/base/s-map-01.tex
+++ b/tex/context/base/s-map-01.tex
@@ -111,7 +111,7 @@
\stelkolommenin
[\c!afstand=1pc]
-%D Later zullen we zonodig nog instelleb dat de \MAPS\ op een
+%D Later zullen we zonodig nog instellen dat de \MAPS\ op een
%D grid wordt gezet. Het zetten op een grid is voor \TEX\ niet
%D triviaal, en de ondersteuning in \CONTEXT\ is dan ook
%D enigzins experimenteel. De \MAPS\ is in die zin een soort
@@ -419,7 +419,7 @@
\fi
\setupheader[\c!status=\v!leeg]
\stelpaginanummerin[\c!nummer=\MapsPagina]
- \stellayoutin[\c!grid=\MapsGrid]
+ \setuplayout[\c!grid=\MapsGrid]
\ifgridsnapping % nog controleren
\stelblankoin[\v!regel]
\definieerblanko[mapsvoor][\v!halveregel]
@@ -586,7 +586,7 @@
%D In kolom||mode gebruiken we geen marge en hebben dus wat
%D meer breedte ter beschikking.
-\stellayoutin
+\setuplayout
[\c!breedte=38pc]
\setupheadertexts
diff --git a/tex/context/base/s-mod-00.tex b/tex/context/base/s-mod-00.tex
index 67142c3a6..c4586bf10 100644
--- a/tex/context/base/s-mod-00.tex
+++ b/tex/context/base/s-mod-00.tex
@@ -163,7 +163,7 @@
\c!breedte=\v!midden]
\def\moduletitel%
- {\stellayoutin[titlepage]
+ {\setuplayout[titlepage]
\ifx\ModuleNumber\undefined \else
\ifnum\ModuleNumber<10
\edef\ModuleNumber{00\ModuleNumber}
@@ -209,7 +209,7 @@
[\v!pagina]
[\c!achtergrond=]
\fi
- \stellayoutin}
+ \setuplayout}
\let\stopdocumentation=\relax
diff --git a/tex/context/base/s-mod-01.tex b/tex/context/base/s-mod-01.tex
index c71c8806f..800287ccc 100644
--- a/tex/context/base/s-mod-01.tex
+++ b/tex/context/base/s-mod-01.tex
@@ -32,7 +32,7 @@
\emergencystretch=5em
-\stellayoutin
+\setuplayout
[\c!rugwit=3.5cm,
\c!linkermarge=1.75cm,
\c!rechtermarge=0cm,
diff --git a/tex/context/base/s-mod-02.tex b/tex/context/base/s-mod-02.tex
index d7a70f705..0d7f707f6 100644
--- a/tex/context/base/s-mod-02.tex
+++ b/tex/context/base/s-mod-02.tex
@@ -128,7 +128,7 @@
\stelpapierformaatin
[S6][S6]
-\stellayoutin
+\setuplayout
[rugwit=72.5pt,
linkermarge=50pt,
linkermargeafstand=12.5pt,
diff --git a/tex/context/base/s-pre-00.tex b/tex/context/base/s-pre-00.tex
index 502969801..8266a5929 100644
--- a/tex/context/base/s-pre-00.tex
+++ b/tex/context/base/s-pre-00.tex
@@ -97,6 +97,7 @@
var v = this.getField("presentation:"+dummy) ;
if (v)
{ v.hidden = true }
+ % { v.display = display.hidden }
else
{ ++pagenumber ;
if (pagenumber<=\lastpage)
@@ -104,6 +105,7 @@
dummy = 100*(pagenumber) + presentation[pagenumber] ;
v = this.getField("presentation:"+dummy) ;
if (v) { v.hidden = true }
+ % if (v) { v.display = display.hidden }
++this.pageNum } }
this.dirty = false }
\stopJSpreamble
diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex
index 83215f61d..707ea7ec5 100644
--- a/tex/context/base/setupb.tex
+++ b/tex/context/base/setupb.tex
@@ -3145,7 +3145,7 @@
\startsetup
\command
- [\y!stellayoutin]
+ [\y!setuplayout]
\type
[\c!vars!]
\variable
@@ -3857,7 +3857,7 @@
\startsetup
\command
- [\y!rooster]
+ [\y!grid]
\type
[\c!vars!]
\variable
@@ -4814,7 +4814,7 @@
[\y!setuppapersize]
[]
\inheritvariables
- [\y!stellayoutin]
+ [\y!setuplayout]
[]
\stopsetup
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index 253e0b3cd..87c9b0557 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -15,9 +15,9 @@
%D value, it is kind of not there. If ResetForm is used, the
%D default is assigned, but pushbuttons are spoiled. Adding a
%D \type {/MK} dictionary helps, but gives ugly down
-%D appearances (displaced with background). What a mess.
-%D Also, in order to get at least something, the \type {/AS}
-%D key should be provided.
+%D appearances (displaced with background). What a mess.
+%D Also, in order to get at least something, the \type {/AS}
+%D key should be provided.
% to do : /IF << /SW /N >> == no scaling / clipping of widget
@@ -35,7 +35,7 @@
\newif\ifovercomePDFbugs \overcomePDFbugsfalse % dest sort problem / 3-
\newif\ifovercomePDFspace \overcomePDFspacetrue % dest sort problem / 3-
-\newif\ifovercomePDFpage \overcomePDFpagetrue % pdf spec change / 5+
+\newif\ifovercomePDFpage \overcomePDFpagetrue % pdf spec change / 5+
\chardef\safePDFcode=`-
@@ -46,8 +46,8 @@
\lccode`\<\safePDFcode \lccode`\>\safePDFcode
\lccode`\[\safePDFcode \lccode`\]\safePDFcode
\lccode`\(\safePDFcode \lccode`\)\safePDFcode
- \ifovercomePDFspace
- \lccode`\ \safePDFcode
+ \ifovercomePDFspace
+ \lccode`\ \safePDFcode
\fi
\ifovercomePDFbugs
\xdef\PDFdestination{'#1'}%
@@ -57,48 +57,48 @@
\lowercase\@EA{\@EA\xdef\@EA\PDFdestination\@EA{\PDFdestination}}%
\egroup}
-%D This is much faster since we don't have to set the full
-%D range of lc-codes; about 5 sec on a 1000mhz PIII for
-%D 20K named destinations "x(x) x"). Of course when you use
-%D page destinations, the saving is nil.
+%D This is much faster since we don't have to set the full
+%D range of lc-codes; about 5 sec on a 1000mhz PIII for
+%D 20K named destinations "x(x) x"). Of course when you use
+%D page destinations, the saving is nil.
-% \beginETEX \scantokens
-%
-% \doifnotmode{atpragma}{\let\next\setPDFdestination} % experimental
-%
+% \beginETEX \scantokens
+%
+% \doifnotmode{atpragma}{\let\next\setPDFdestination} % experimental
+%
% \bgroup
-%
-% \catcode`\/=\@@active \catcode`\#=\@@active
-% \catcode`\<=\@@active \catcode`\>=\@@active
-% \catcode`\[=\@@active \catcode`\]=\@@active
-% \catcode`\(=\@@active \catcode`\)=\@@active
-%
+%
+% \catcode`\/=\@@active \catcode`\#=\@@active
+% \catcode`\<=\@@active \catcode`\>=\@@active
+% \catcode`\[=\@@active \catcode`\]=\@@active
+% \catcode`\(=\@@active \catcode`\)=\@@active
+%
% \gdef\PDFrepchar{-}
-%
+%
% \gdef\setPDFdcharacters
-% {\catcode`\/=\@@active \let/\PDFrepchar
+% {\catcode`\/=\@@active \let/\PDFrepchar
% \catcode`\#=\@@active \let#\PDFrepchar
% \catcode`\<=\@@active \let<\PDFrepchar
-% \catcode`\>=\@@active \let>\PDFrepchar
+% \catcode`\>=\@@active \let>\PDFrepchar
% \catcode`\[=\@@active \let[\PDFrepchar
% \catcode`\]=\@@active \let]\PDFrepchar
% \catcode`\(=\@@active \let(\PDFrepchar
% \catcode`\)=\@@active \let)\PDFrepchar}
-%
+%
% \egroup
-%
-% \def\setPDFdestination#1% expansion is needed, otherwise embedded
-% {\bgroup % macros will not expand under the new
+%
+% \def\setPDFdestination#1% expansion is needed, otherwise embedded
+% {\bgroup % macros will not expand under the new
% \setPDFdcharacters % catcode regime
-% \ifovercomePDFspace
+% \ifovercomePDFspace
% \catcode32=\@@ignore
% \fi
% \xdef\PDFdestination{\ifovercomePDFbugs'\fi#1\ifovercomePDFbugs'\fi}%
% \scantokens\@EA{\@EA\xdef\@EA\PDFdestination\@EA{\PDFdestination}}%
% \egroup}
-%
-% \doifnotmode{atpragma}{\let\setPDFdestination\next} % experimental
-%
+%
+% \doifnotmode{atpragma}{\let\setPDFdestination\next} % experimental
+%
% \endETEX
%D \macros
@@ -120,10 +120,10 @@
\def\sanitizePDFstring#1\to#2%
{\bgroup
\obeylccodes
- \lccode`( =1 \lccode`) =1
- \lccode`< =1 \lccode`> =1
- \lccode`[ =1 \lccode`] =1
- \lccode`\\=1 \lccode`/ =1
+ \lccode`( \plusone \lccode`) \plusone
+ \lccode`< \plusone \lccode`> \plusone
+ \lccode`[ \plusone \lccode`] \plusone
+ \lccode`\\\plusone \lccode`/ \plusone
\lowercase{\convertargument#1\to\ascii}%
% by integrating the split in the loop below
% \splitofftokens\maxPDFstringsize\from\ascii\to\ascii
@@ -149,21 +149,21 @@
%\endTEX
%
-% \beginETEX \scantokens
-%
-% \doifnotmode{atpragma}{\let\next\sanitizePDFstring} % experimental
-%
+% \beginETEX \scantokens
+%
+% \doifnotmode{atpragma}{\let\next\sanitizePDFstring} % experimental
+%
% \bgroup
-%
+%
% \catcode`\.=\@@escape
-%
-% .catcode`./=.@@active
-% .catcode`.<=.@@active .catcode`.>=.@@active
-% .catcode`.[=.@@active .catcode`.]=.@@active
-% .catcode`.(=.@@active .catcode`.)=.@@active
-%
+%
+% .catcode`./=.@@active
+% .catcode`.<=.@@active .catcode`.>=.@@active
+% .catcode`.[=.@@active .catcode`.]=.@@active
+% .catcode`.(=.@@active .catcode`.)=.@@active
+%
% .gdef.setPDFscharacters%
-% {.catcode`.\=.@@other
+% {.catcode`.\=.@@other
% .catcode`./=.@@active .def/{.noexpand./}%
% .catcode`.<=.@@active .def<{.noexpand.<}%
% .catcode`.>=.@@active .def>{.noexpand.>}%
@@ -171,19 +171,19 @@
% .catcode`.]=.@@active .def]{.noexpand.]}%
% .catcode`.(=.@@active .def({.noexpand.(}%
% .catcode`.)=.@@active .def){.noexpand.)}}
-%
+%
% .gdef.sanitizePDFstring#1.to#2%
% {.bgroup
% .setPDFscharacters
-% .catcode`=.@@escape
+% .catcode`=.@@escape
% .edef.next{.strippedcsname#2}%
% .scantokens{setxvalue{next}{#1}}%
% .egroup}
-%
+%
% .egroup
-%
-% \doifnotmode{atpragma}{\let\sanitizePDFstring\next} % experimental
-%
+%
+% \doifnotmode{atpragma}{\let\sanitizePDFstring\next} % experimental
+%
% \endETEX
%D \macros
@@ -211,7 +211,7 @@
%D \starttypen
%D \doPDFdestination name #1
%D \doPDFaction width #1 height #2 action #3
-%D \doPDFannotation width #1 height #2 data #3
+%D \doPDFannotation width #1 height #2 data #3
%D \doPDFannotationobject class #1 name #2 width #3 height #4 data #5
%D \doPDFdictionaryobject class #1 name #2 data #3
%D \doPDFarrayobject class #1 name #2 data #3
@@ -238,8 +238,8 @@
\let\doPDFresetpageattributes\relax
\let\doPDFresetpageresources \relax
-\appendtoksonce
- \doPDFresetpageattributes
+\appendtoksonce
+ \doPDFresetpageattributes
\doPDFresetpageresources
\to \everyaftershipout
@@ -251,11 +251,11 @@
\fi
\fi
-%D For special (\METAPOST) effects, we need to build
-%D resource dictionaries. Here is the framework.
+%D For special (\METAPOST) effects, we need to build
+%D resource dictionaries. Here is the framework.
-\let\docuPDFextgstates\empty
-%let\pagePDFextgstates\empty
+\let\docuPDFextgstates\empty
+%let\pagePDFextgstates\empty
\def\checkPDFextgstates
{\ifx\docuPDFextgstates\empty \else
@@ -267,7 +267,7 @@
\doPDFpageresource{/ExtGState \PDFobjectreference}%
\fi}
-\appendtoksonce
+\appendtoksonce
\checkPDFextgstates
\to \everyshipout
@@ -276,7 +276,7 @@
%D Another special mechanism (needed for color separation):
-\let\docuPDFcolorspaces\empty
+\let\docuPDFcolorspaces\empty
\def\checkPDFcolorspaces
{\ifx\docuPDFcolorspaces\empty \else
@@ -288,7 +288,7 @@
\doPDFpageresource{/ColorSpace \PDFobjectreference}%
\fi}
-\appendtoksonce
+\appendtoksonce
\checkPDFcolorspaces
\to \everyshipout
@@ -305,10 +305,10 @@
\let\currentPDFpagemode \empty % document catalog
\let\currentPDFviewerprefs\empty % document catalog
-\let\currentPDFcropbox \empty % page attributes
-\let\currentPDFbleedbox \empty % page attributes
-\let\currentPDFartbox \empty % page attributes
-\let\currentPDFtrimbox \empty % page attributes
+\let\currentPDFcropbox \empty % page attributes
+\let\currentPDFbleedbox \empty % page attributes
+\let\currentPDFartbox \empty % page attributes
+\let\currentPDFtrimbox \empty % page attributes
\def\doPDFsetupscreen#1#2#3#4#5#6% watch the extra argument
{\bgroup
@@ -323,13 +323,13 @@
% % \PointsToWholeBigPoints\!!heighta\bottom
% % \PointsToWholeBigPoints\!!widtha \width
% % \PointsToWholeBigPoints\!!heightb\height
-% % but since pdf/x does not round when checking if
+% % but since pdf/x does not round when checking if
% % the boxes fit inside the media box ...
% \PointsToBigPoints{#2}\left
% \PointsToBigPoints\!!heighta\bottom
% \PointsToBigPoints\!!widtha \width
% \PointsToBigPoints\!!heightb\height
-% \xdef\currentPDFcropboxspec
+% \xdef\currentPDFcropboxspec
% {[\left\space\bottom\space\width\space\height]}%
% \global\let\currentPDFtrimboxspec\currentPDFcropboxspec
\xdef\currentPDFpagemode
@@ -339,7 +339,7 @@
\egroup}
\appendtoksonce % hack to prevent duplicates
- \ifcase\realfolio \or % only at page one
+ \ifcase\realfolio \or % only at page one
\doPDFaddtocatalog{\currentPDFpagemode\currentPDFviewerprefs}%
\doPDFaddtoinfo{/Trapped /False}%
\fi
@@ -358,7 +358,7 @@
% \PointsToWholeBigPoints\!!heighta\bottom
% \PointsToWholeBigPoints\!!widtha \width
% \PointsToWholeBigPoints\!!heightb\height
- % but since pdf/x does not round when checking if
+ % but since pdf/x does not round when checking if
% the boxes fit inside the media box ...
\PointsToBigPoints{#3}\left
\PointsToBigPoints\!!heighta\bottom
@@ -372,7 +372,7 @@
\def\doPDFsetupbleedbox{\doPDFsetupwhateverbox\currentPDFbleedbox}
\def\doPDFsetuptrimbox {\doPDFsetupwhateverbox\currentPDFtrimbox }
-\gdef\currentPDFtrimbox{\currentPDFcropbox} % default, needed for pdf/x
+\gdef\currentPDFtrimbox{\currentPDFcropbox} % default, needed for pdf/x
\def\flushPDFwhateverbox#1#2%
{\doifsomething{#1}{\doPDFpageattribute{/#2Box #1}}}
@@ -385,14 +385,14 @@
\to \everyshipout
\def\doPDFsetupidentity#1#2#3#4#5#6%
- {\bgroup
+ {\bgroup
\enablePDFdocencoding
\expanded{\doPDFaddtoinfo
{/Title (#1)
/Subject (#2)
/Author (#3)
/Creator (#4)
- /ModDate (#5)
+ /ModDate (#5)
/ID (\jobname.#5) % needed for pdf/x
/Keywords (#6)}}%
\egroup}
@@ -407,12 +407,12 @@
\let\lastPDFaction\empty
-%D We can safe a couple of references by moving this code
-%D to the specific drivers.
+%D We can safe a couple of references by moving this code
+%D to the specific drivers.
%D
-%D The following code used to work okay, but as with any
-%D update of Acrobat Viewers, upward compatibility was
-%D just a dream.
+%D The following code used to work okay, but as with any
+%D update of Acrobat Viewers, upward compatibility was
+%D just a dream.
\def\doPDFsetupopenaction
{\doPDFaddtocatalog{/OpenAction <<\lastPDFaction>>}}
@@ -420,9 +420,9 @@
\def\doPDFsetupcloseaction
{\doPDFaddtocatalog{/CloseAction <<\lastPDFaction>>}}
-%D So, starting with version~5 viewers, when the open actions
-%D started yto give problems, for testing purposes we
-%D decided use indirect actions.
+%D So, starting with version~5 viewers, when the open actions
+%D started yto give problems, for testing purposes we
+%D decided use indirect actions.
%\def\doPDFsetupopenaction%
% {\doPDFdictionaryobject class FDF name local:openaction data \lastPDFaction
@@ -444,7 +444,7 @@
{\global\let\PDFclosepageaction\lastPDFaction}
\def\checkPDFpageactions
- {\iflocation % important since direct -)
+ {\iflocation % important since direct -)
\donefalse
\ifx\PDFopenpageaction \empty\!!doneafalse\else\donetrue\!!doneatrue\fi
\ifx\PDFclosepageaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
@@ -457,8 +457,8 @@
\global\let\PDFclosepageaction\empty
\fi}
-\appendtoksonce
- \checkPDFpageactions
+\appendtoksonce
+ \checkPDFpageactions
\to \everyshipout
%D \macros
@@ -488,7 +488,16 @@
%D The goto macros use the switch \type{\ifsecondaryreference}
%D to determine if actions should be linked.
-\def\locationfilesuffix{pdf}
+\def\locationfilesuffix{pdf}
+
+% \def\preparePDFlocationfile#1#2%
+% {\setreferencefilename#1\to#2%
+% \expanded{\doifnotinstring{.\locationfilesuffix}{#2}}
+% {\edef#2{#2.\locationfilesuffix}}}
+%
+% \def\preparePDFlocationfile#1\to#2%
+% {\setreferencefilename#1\to#2%
+% \expanded{\doifnotinstring{.pdf}{#2}}{\edef#2{#2.pdf}}}
\def\doPDFstartgotolocation#1#2#3#4#5#6%
{\bgroup
@@ -498,10 +507,12 @@
{\let\action\empty}
{\doifelsenothing{#4}
{\let\PDFfile\empty}
- {\doifparentfileelse{#4}
+ {\expanded{\beforesplitstring#4}\at.\to\PDFfile
+ \doifparentfileelse\PDFfile % {#4}
{\let\PDFfile\empty}
- {\setreferencefilename#4.\locationfilesuffix\to\PDFfile
- \edef\PDFfile%
+ %{\setreferencefilename#4.\locationfilesuffix\to\PDFfile
+ {\@EA\setreferencefilename\PDFfile.\locationfilesuffix\to\PDFfile
+ \edef\PDFfile
{R /F (\PDFfile)\ifgotonewwindow\space/NewWindow true \fi}}}%
\edef\action%
{/S /GoTo\PDFfile\space /D (\PDFdestination)}}}
@@ -512,8 +523,7 @@
\setPDFdestination{#5}%
\doifsomething\PDFdestination
{\edef\PDFdestination{\URLhash\PDFdestination}}}%
- \edef\action%
- {/S /URI /URI (#3\PDFfile\PDFdestination)}}%
+ \edef\action{/S /URI /URI (#3\PDFfile\PDFdestination)}}%
\ifx\action\empty\else
\ifsecondaryreference
\savesecondaryPDFreference\action
@@ -528,28 +538,30 @@
\def\PDFgotonewwindow{\ifgotonewwindow\space/NewWindow true \fi}
-\def\doPDFstartgotorealpage#1#2#3#4#5% watch the R append trick
+\def\doPDFstartgotorealpage#1#2#3#4#5% watch the R append trick
{\bgroup
- \doifelsenothing{#3}
+ \doifelsenothing{#3}% #1 = url
{\scratchcounter0#5\relax
\ifnum\scratchcounter>0
- \advance\scratchcounter \minusone % pdf starts numbering at zero
+ \advance\scratchcounter \minusone % pdf starts numbering at zero
\doifelsenothing{#4}
{\let\PDFfile\empty}
- {\doifparentfileelse{#4}
+ {\expanded{\beforesplitstring#4}\at.\to\PDFfile
+ \doifparentfileelse\PDFfile % {#4}
{\let\PDFfile\empty}
- {\setreferencefilename#4.\locationfilesuffix\to\PDFfile
+ %{\setreferencefilename#4.\locationfilesuffix\to\PDFfile
+ {\@EA\setreferencefilename\PDFfile.\locationfilesuffix\to\PDFfile
\edef\PDFfile{R /F (\PDFfile)\PDFgotonewwindow}}}%
\ifx\PDFfile\empty
- \ifovercomePDFpage % a named page ref
+ \ifovercomePDFpage % a named page ref
\edef\PDFdestination{(page:\the\scratchcounter)}%
- \else % beware: optimizers remove this one
+ \else % beware: optimizers remove this one
\edef\PDFdestination{[\the\scratchcounter\space\PDFpageviewwrd]}%
\fi
\else % across files it's a page number
\edef\PDFdestination{[\the\scratchcounter\space\PDFpageviewwrd]}%
\fi
- \edef\action{/S /GoTo\PDFfile\space /D \PDFdestination}%
+ \edef\action{/S /GoTo\PDFfile\space /D \PDFdestination}%
\else
\let\action\empty
\fi}
@@ -569,17 +581,22 @@
\fi
\egroup}
-\def\fakePDFpagedestination % as in pdf, we start numbering at zero
+\let\lastfakedPDFpage\!!zerocount
+
+\def\fakePDFpagedestination % as in pdf, we start numbering at zero
{\iflocation \ifovercomePDFpage \ifarrangingpages \else
- \bgroup
- \advance\realpageno \minusone % is \expanded needed ?
- \expanded{\doPDFdestination name {page:\realfolio}}%
- \egroup
+ \ifnum\lastfakedPDFpage<\realpageno
+ \bgroup
+ \xdef\lastfakedPDFpage{\realfolio}%
+ \advance\realpageno \minusone % is \expanded needed ?
+ \expanded{\doPDFdestination name {page:\realfolio}}%
+ \egroup
+ \fi
\fi \fi \fi}
-
-\appendtoksonce
- \fakePDFpagedestination
-\to \everyshipout
+
+\appendtoksonce
+ \fakePDFpagedestination
+\to \everyshipout
\def\doPDFstartgotoJS#1#2#3%
{\bgroup
@@ -621,27 +638,31 @@
\def\PDFformcode#1%
{\doFDFiffieldset{#1}{/Field [\doFDFgetfieldset{#1}]}}
-% bit 3 = html
-% bit 6 = xml
-% bit 4 = get
+% bit 3 = html
+% bit 6 = xml
+% bit 4 = get
+
+\ifx\PDFsubmitfiller\undefined \let\PDFsubmitfiller\empty \fi
\chardef\PDFformmethod=1 % 0=GET 1=POST
\def\PDFformflag#1#2{\ifcase\PDFformmethod#1\else#2\fi}
-
+
\def\PDFexecuteimportform {/Named /N /AcroForm:ImportFDF}
\def\PDFexecuteexportform {/Named /N /AcroForm:ExportFDF}
\def\PDFexecuteresetform {/ResetForm \PDFformcode\argumentA}
\def\PDFexecutesubmitform {/SubmitForm \PDFformcode\argumentB
/Flags \ifcase\submitoutputformat\space
\PDFformflag{12} {4} % 0=unknown
- \or \PDFformflag{12} {4} % 1=HTML
- \or \PDFformflag {8} {0} % 2=FDF
+ \or \PDFformflag{12} {4} % 1=HTML
+ \or \PDFformflag {8} {0} % 2=FDF
\or \PDFformflag{40}{32} % 3=XML
\else \PDFformflag{12} {4} % ?=unknown
\fi
- /F (\argumentA)}
-
+ /F (\argumentA)\PDFsubmitfiller}
+
+% urifill permits url substitution
+
\def\PDFexecutehide {/Hide /T (\argumentA) /H true}
\def\PDFexecuteshow {/Hide /T (\argumentA) /H false}
@@ -689,7 +710,7 @@
%D {doPDFstartrunprogram}
%D
%D Running programs is possible, but is non that portable, and
-%D therefore dangerous.
+%D therefore dangerous.
\def\doPDFstartrunprogram#1#2#3#4% new: #3 => #3#4
{\bgroup
@@ -794,11 +815,11 @@
\def\doPDFinsertmov#1#2#3#4#5#6#7#8#9%
{\bgroup
- \xdef\currentmovie{#2}% label
+ \xdef\currentmovie{#2}% label
\PointsToBigPoints{#7}\width
\PointsToBigPoints{#8}\height
\let\pdf@@options\empty
- \let\pdf@@actions\empty
+ \let\pdf@@actions\empty
\donefalse
\@EA\processallactionsinset\@EA
[#9]
@@ -816,14 +837,14 @@
%D \macros
%D {doPDFinsertsoundtrack}
%D
-%D In \PDF\ sounds can be embedded like movies.
+%D In \PDF\ sounds can be embedded like movies.
\let\currentsound\s!unknown
-\def\doPDFinsertsoundtrack#1#2#3%
+\def\doPDFinsertsoundtrack#1#2#3%
{\bgroup
\xdef\currentsound{#2}%
- \let\pdf@@actions\empty
+ \let\pdf@@actions\empty
\@EA\processallactionsinset\@EA
[#3]
[\v!herhaal=>\edef\pdf@@actions{\pdf@@actions /Mode /Repeat }]%
@@ -844,7 +865,7 @@
\def\doPDFinsertbookmark#1#2#3#4#5% level sublevels text page open=1
{\bgroup
- % todo, unicode
+ % todo, unicode
\sanitizePDFdocencoding#3\to\bookmarktext % uses scratchcounter
\scratchcounter#4%
\advance\scratchcounter \minusone
@@ -874,7 +895,7 @@
\def\FDFflagEdit {262144} % 19
%D A few more (pdf 1.4) flags, what the spell check one: for
-%D obscure reasons for Adobe downward compatibility means
+%D obscure reasons for Adobe downward compatibility means
%D enabling features that harm old applications like testing.
\def\FDFflagDoNotSpellCheck {4194304} % 23
@@ -888,7 +909,7 @@
\def\FDFflagNoExport {4} % 3
\def\FDFflagPassword {8192} % 14
\def\FDFflagSort {524288} % 20
-\def\FDFflagFileSelect {1048576} % 21
+\def\FDFflagFileSelect {1048576} % 21
%D There is a second, again bitset oriented, \type{/F} flag:
@@ -952,9 +973,9 @@
\let\FDFdefaultindex\!!zerocount
\let\FDFdefaultvalue\empty
-\def\setFDFvalues[#1][#2]% #1 = list (item=>value) #2 = default
+\def\setFDFvalues[#1][#2]% #1 = list (item=>value) #2 = default
{\let\FDFvalues \empty
- %when radio opt works ok
+ %when radio opt works ok
%\let\FDFfirstvalues \empty
%\let\FDFsecondvalues\empty
%\let\FDFkidlist \empty
@@ -1058,7 +1079,7 @@
%\def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8]%
% {\global\let\FDFactions\empty
% \setFDFaction D#1% mousedown
-% \setFDFaction U#2% mouseup
+% \setFDFaction U#2% mouseup
% \setFDFaction E#3% enterregion
% \setFDFaction X#4% exitregion
% \setFDFaction K#5% afterkeystroke
@@ -1068,12 +1089,12 @@
% \ifx\FDFactions\empty\else
% \xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
% \fi}
-%% \setFDFaction A#2}% mouseup % changed for version 5
+%% \setFDFaction A#2}% mouseup % changed for version 5
\def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8,%
{\global\let\FDFactions\empty
\setFDFaction D#1% mousedown
-% \setFDFaction U#2% mouseup
+% \setFDFaction U#2% mouseup
\setFDFaction E#3% enterregion
\setFDFaction X#4% exitregion
\setFDFaction K#5% afterkeystroke
@@ -1088,7 +1109,7 @@
\ifx\FDFactions\empty\else
\xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
\fi
- \setFDFaction A#1}% mouseup
+ \setFDFaction A#1}% mouseup
%D The event handler becomes something:
%D
@@ -1116,7 +1137,7 @@
% {\FDFactions /#1 << /S /JavaScript /JS (\sanitizedJScode) >> }%
% \fi
% \egroup}
-%
+%
% acrobat 5 supports other that JS actions too
\def\setFDFaction#1#2%
@@ -1148,9 +1169,9 @@
%D \macros
%D {doFDFregistercalculationset}
-%D
+%D
%D There is at most one calculation order list, which defines
-%D the order in which fields are calculated.
+%D the order in which fields are calculated.
\let\PDFcalculationset\empty
@@ -1176,10 +1197,10 @@
\doPDFarrayobject class FDF name local:fields data \FDFcollection
\doPDFgetobjectreference{FDF}{local:fields}\PDFobjectreference
% The /NeedAppearances is pretty important because
- % otherwise Acrobat 5 blows up on cloned radio widgets
+ % otherwise Acrobat 5 blows up on cloned radio widgets
\doPDFdictionaryobject class FDF name local:acroform data
{/Fields \PDFobjectreference\space
- /NeedAppearances true
+ /NeedAppearances true
\doFDFiffieldset\PDFcalculationset{/CO [\doFDFgetfieldset\PDFcalculationset]}
/DR << /Font << \FDFfonts >> >>
/DA (/Helv 10 Tf 0 g)}%
@@ -1248,10 +1269,10 @@
\def\FDFnameCoOb {Courier-Oblique}
\def\FDFnameCoBO {Courier-BoldOblique}
-%D And a big one: (should be run time loaded (spec-run or
+%D And a big one: (should be run time loaded (spec-run or
%D so)).
-\def\FDFencodingvector
+\def\FDFencodingvector
{/Type /Encoding
/Differences
[ 24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek
@@ -1330,7 +1351,7 @@
\v!hoogte=>\def\PDFpageviewkey{ fitv}% % and here and
\def\PDFpageviewwrd{ /FitV}, % here too
\v!standaard=>\def\PDFpageviewkey{ xyz\PDFpagexyzspec}%
- \def\PDFpageviewwrd{ /XYZ\PDFpagexyzspec},
+ \def\PDFpageviewwrd{ /XYZ\PDFpagexyzspec},
\s!unknown=>\def\PDFpageviewkey{ fit}%
\def\PDFpageviewwrd{ /Fit}]%
\edef\PDFpageview{/View [\PDFpageviewwrd]}}
@@ -1493,11 +1514,11 @@
\doFDFappearance{On}{#6}{#8}%
\doPDFannotationobject class FDF name #1 width #2 height #3 data
{/Subtype /Widget /T (#1) /FT /Btn
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
+ \ifFDFvalues
+ /DV /\FDFdefault\space
+ /V /\FDFdefault\space
+ /AS /\FDFdefault\space
+ \fi
/Ff \FDFflag\space
/F \FDFplus\space
\FDFappearance\space
@@ -1508,11 +1529,11 @@
\doPDFdictionaryobject class FDF name #1 data
{/T (#1) /FT /Btn
/Kids [\FDFkids]
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
+ \ifFDFvalues
+ /DV /\FDFdefault\space
+ /V /\FDFdefault\space
+ /AS /\FDFdefault\space
+ \fi
/Ff \FDFflag\space
/F \FDFplus\space
\FDFactions}%
@@ -1524,11 +1545,11 @@
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
+ \ifFDFvalues
+ /DV /\FDFdefault\space
+ /V /\FDFdefault\space
+ /AS /\FDFdefault\space
+ \fi
/Ff \FDFflag\space
/F \FDFplus\space
\FDFappearance\space
@@ -1541,11 +1562,11 @@
{/Subtype /Widget
/Parent \PDFobjectreference\space
/F \FDFplus\space
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
+ \ifFDFvalues
+ /DV /\FDFdefault\space
+ /V /\FDFdefault\space
+ /AS /\FDFdefault\space
+ \fi
\FDFappearance
\FDFactions}%
\fi
@@ -1574,7 +1595,7 @@
{/Subtype /Widget
/Parent \PDFobjectreference\space
/F \FDFplus\space
- /AS /\FDFdefault\space
+ /AS /\FDFdefault\space
\FDFappearance\space
\FDFactions}%
\registerFDFobject{#1}%
@@ -1595,7 +1616,7 @@
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
- /AS /\FDFdefault\space
+ /AS /\FDFdefault\space
/F \FDFplus\space
\FDFappearance\space
\FDFactions}%
@@ -1607,17 +1628,17 @@
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
- /AS /\FDFdefault\space
+ /AS /\FDFdefault\space
/F \FDFplus\space
\FDFappearance\space
\FDFactions}%
\fi
\egroup}
-%D \macros
+%D \macros
%D {setFDFstrings}
%D
-%D This one creates a string array.
+%D This one creates a string array.
%\def\setFDFstrings[#1]%
% {\let\FDFstrings\empty
@@ -1633,29 +1654,29 @@
\setFDFactions[#5]%
\doPDFdictionaryobject class FDF name #1 data
{/Subtype /Widget /FT /Btn /T (#1) /Rect [0 0 0 0]
- % used to be this
+ % used to be this
% /V (#2)
- % then this
- % /DV (#2)
- % since this bomded in 5
+ % then this
+ % /DV (#2)
+ % since this bomded in 5
% /V (#2)
- % and now finally this works
+ % and now finally this works
/H /N
-% /opt is buggy in 5.05, only works once, sigh
+% /opt is buggy in 5.05, only works once, sigh
%\ifx\FDFfirstvalues\FDFsecondvalues
/V /#2
%\else
% /V /\FDFdefaultindex\space
% /Opt [\FDFsecondvalues]
%\fi
- /Ff \FDFflag\space
- /F \FDFplus\space
+ /Ff \FDFflag\space
+ /F \FDFplus\space
/Kids [\FDFkids]
\FDFactions}%
\egroup}
%D At the cost of some more references, we can save bytes,
-%D by sharing appearance dictionaries. This code needs more
+%D by sharing appearance dictionaries. This code needs more
%D documentation. Surprise:
\def\dodoFDFappearance#1#2%
@@ -1686,11 +1707,11 @@
\fi
\fi}
-\def\doFDFappearance#1#2#3%
- {\ifcase#3\relax % push only field
+\def\doFDFappearance#1#2#3%
+ {\ifcase#3\relax % push only field
\edef\yes{#2}%
\let\no\empty
- \else % on / off field
+ \else % on / off field
\dogetcommacommandelement1\from#2,\to\yes
\dogetcommacommandelement2\from#2,\to\no
\fi
@@ -1760,7 +1781,7 @@
\doPDFresetgotowhereever % just to be sure
-% we can (in etex) share more by testing on this
+% we can (in etex) share more by testing on this
\def\savesecondaryPDFreference#1%
%{\setxvalue{PDF-SR:\the\nofsecondaryreferences}{#1}}
@@ -1796,7 +1817,7 @@
\endETEX
-\beginTEX
+\beginTEX
\def\getsecondaryPDFreferences%
{\ifcase\nofsecondaryreferences\else
@@ -1868,7 +1889,7 @@
%D sure or the order in which the name and value are given
%D (actually the reverse).
-\def\PERLloadFDFfields#1% will become obsolete soon
+\def\PERLloadFDFfields#1% will become obsolete soon
{\bgroup
\global\let\allFDFfields\empty
\ifrunFDFconverter
@@ -1893,7 +1914,7 @@
\global\let\normalslash=/
\catcode`\/=\@@escape
-\gdef\TEXloadFDFfields#1% will become obsolete due to XFDF
+\gdef\TEXloadFDFfields#1% will become obsolete due to XFDF
{\bgroup
\setbox0=\hbox
{\global\let\allFDFfields\empty
@@ -1962,7 +1983,7 @@
\long\def\sanitizePDFdocencoding#1\to#2%
{\enablePDFcrlf
\enablePDFdocencoding
- %\honorunexpanded % otherwise problems with "e etc in de
+ %\honorunexpanded % otherwise problems with "e etc in de
\edef#2{#1}}
\bgroup
@@ -1980,9 +2001,9 @@
\newevery\everysetfield\relax
-\appendtoksonce
- \enablePDFdocencoding
- \enablePDFcrlf
+\appendtoksonce
+ \enablePDFdocencoding
+ \enablePDFcrlf
\to \everysetfield
%D \macros
@@ -1991,29 +2012,29 @@
%D An example its use is the next special, one that deals with
%D text annotations.
-\def\PDFcommentNew {/Insert}
-\def\PDFcommentBalloon {/Comment}
+\def\PDFcommentNew {/Insert}
+\def\PDFcommentBalloon {/Comment}
\def\PDFcommentAddition {/NewParagraph}
-\def\PDFcommentHelp {/Help}
-\def\PDFcommentParagraph {/Paragraph}
-\def\PDFcommentKey {/Key }
+\def\PDFcommentHelp {/Help}
+\def\PDFcommentParagraph {/Paragraph}
+\def\PDFcommentKey {/Key }
-\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8%
- {\bgroup % title width height color open symbol collect data
- \doifelsenothing{#1}
+\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8%
+ {\bgroup % title width height color open symbol collect data
+ \doifelsenothing{#1}
{\let\PDFidentifier\empty}
{\def\PDFidentifier{/T (#1)}}%
- \doifelsenothing{#4}
+ \doifelsenothing{#4}
{\let\PDFattributes\empty}
{\def\PDFattributes{/C \FDFcolor{#4}}}%
- \doifundefinedelse{PDFcomment#6}
+ \doifundefinedelse{PDFcomment#6}
{\let\PDFcomment\empty}
{\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}%
\sanitizePDFencoding#8\to\PDFdata
\setbox\scratchbox=\vbox to #3
{\vfill
- \doPDFannotation width #2 height #3 data
- {/Subtype /Text
+ \doPDFannotation width #2 height #3 data
+ {/Subtype /Text
\ifcase#5 \else/Open true\fi
/Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi
\PDFcomment
@@ -2027,8 +2048,8 @@
\startmode[atpragma]
-% todo: scale annot relative to paper width to get
-% dimensions honored
+% todo: scale annot relative to paper width to get
+% dimensions honored
\newcounter\nofFDFcomments
@@ -2036,10 +2057,10 @@
\newbox\PDFcommentbox
-\def\doPDFflushcomments
+\def\doPDFflushcomments
{\box\PDFcommentbox}
-\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8%
+\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8%
{\bgroup % title width height color open symbol collect data
\doifelsenothing{#1}
{\let\PDFidentifier\empty}
@@ -2065,10 +2086,10 @@
{\donefalse}%
\ifdone
\setbox\scratchbox\hbox
- {\doPDFannotation width #2 height #3 data % text window
+ {\doPDFannotation width #2 height #3 data % text window
{/Subtype /Popup
/Parent \PDFobjectreference}}%
- \ifcase#7\relax
+ \ifcase#7\relax
\vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
\else % incredible trial and error hack
\global\setbox\PDFcommentbox\vbox
@@ -2078,10 +2099,10 @@
\box\scratchbox}%
\fi
\fi
- \doPDFannotationobject class FDF name {c:\nofFDFcomments}
- width {\width} height {\height} data
+ \doPDFannotationobject class FDF name {c:\nofFDFcomments}
+ width {\width} height {\height} data
{/Subtype /Text
- \ifcase#5 \else/Open true\fi
+ \ifcase#5 \else/Open true\fi
\ifdone /Popup \the\pdflastannot\space 0 R\fi
/Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi
\PDFcomment
@@ -2092,7 +2113,7 @@
\else
\doPDFannotation width #2 height #3 data
{/Subtype /Text
- \ifcase#5 \else/Open true\fi
+ \ifcase#5 \else/Open true\fi
/Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi
\PDFcomment
\PDFidentifier
@@ -2165,7 +2186,7 @@
\advance\dimen2 #2\relax
\PointsToBigPoints{\dimen2}#3}
-\def\doPDFovalbox#1#2#3#4#5#6#7% todo: \scratchdimen/\scatchbox
+\def\doPDFovalbox#1#2#3#4#5#6#7% todo: \scratchdimen/\scatchbox
{\bgroup
\dimen0=#4\divide\dimen0 2
\doPDFovalcalc{0pt}{+\dimen0}\xmin
@@ -2214,7 +2235,7 @@
%D for fills. This means that we have to set the color in a
%D rather redundant looking way. Unfortunately this makes the
%D \PDF\ file much larger than needed. We can save few bytes
-%D by not setting the stroke color. Due to zip compression we
+%D by not setting the stroke color. Due to zip compression we
%D only save a few percent.
% \newif\ifPDFstrokecolor \PDFstrokecolortrue
@@ -2243,8 +2264,8 @@
%D We need to register the spot colors and their fallbacks.
% we cannot use /DeviceN since GS <=7.21 breaks on it
-% and Jaws does not handle it at all {[/DeviceN [/All|/None]
-% /Device#2 \the\pdflastobj\space0 R]} so we use separation
+% and Jaws does not handle it at all {[/DeviceN [/All|/None]
+% /Device#2 \the\pdflastobj\space0 R]} so we use separation
% colors that work and print ok
\def\doPDFregistersomespotcolor#1#2#3#4%
@@ -2311,7 +2332,7 @@
%D
%D When producing output for an image setter, sometimes negative
%D output is needed.
-
+
\def\doPDFstartnegative
{\ifx\initializePDFnegative\undefined\else
\initializePDFnegative
@@ -2323,21 +2344,21 @@
\PDFcode{/GSpositive gs}%
\fi}
-%D Transparency support (experimental):
+%D Transparency support (experimental):
\def\PDFtransparancydictionary#1#2#3% type fraction extras
- {<</Type /ExtGState
+ {<</Type /ExtGState
/ca #2 /CA #2
- /BM /\ifcase#1 Normal\or Normal\or Multiply\or Screen\or
- Overlay\or SoftLight\or HardLight\or ColorDodge\or
- ColorBurn\or Darken\or Lighten\or Difference\or
+ /BM /\ifcase#1 Normal\or Normal\or Multiply\or Screen\or
+ Overlay\or SoftLight\or HardLight\or ColorDodge\or
+ ColorBurn\or Darken\or Lighten\or Difference\or
Exclusion\else Compatible\fi
#3>>}
-\newif\ifPDFtransparencysupported
+\newif\ifPDFtransparencysupported
\def\dodoPDFstarttransparency#1#2%
- {\presetPDFtransparency{#1}{#2}%
+ {\presetPDFtransparency{#1}{#2}%
\PDFcode{\PDFtransparencyidentifier\space gs }}
\def\dodoPDFstoptransparency
@@ -2355,7 +2376,7 @@
\let\doPDFstoptransparency\relax
-%D These use:
+%D These use:
\let\PDFtransparencyresetreference \empty
\let\PDFtransparencyresetidentifier\empty
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 15d7638f9..01bd94077 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -11,6 +11,12 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% method = auto
+%
+% \definefileinsertion{tpd}{auto}#1#2#3#4#5#6#7#8#9%
+% {\executesystemcommand{t:/ruby/pstopdf.rb #2}%
+% \dodoinsertfile{tpd}{pdf}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}
+
% \let\PDFdestvoffset\zeropoint
% \newbox\pdfdestbox
%
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index da5afe5f4..4842761cb 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -127,10 +127,10 @@
\immediate\closein#1\relax
\else
\fileprocessedtrue
- \gdef\dofinishfile%
+ \gdef\dofinishfile
{\immediate\closein#1\relax
\global\let\doprocessline\relax}%
- \gdef\doprocessline%
+ \gdef\doprocessline
{\ifeof#1%
\expandafter\dofinishfile
\else
@@ -184,11 +184,11 @@
\chardef\kindoffile=0 % 0=normal 1=http
\def\checkfilename#1%
- {\ifinstringelse{http://}{#1}%
- \chardef\kindoffile1
- \else
- \chardef\kindoffile0
- \fi}
+ {\doifinstringelse{@@/}{@@#1}% unix: /full/path
+ {\chardef\kindoffile\plusone}
+ {\doifinstringelse{:/}{#1}% windows: e:/full/path or http://
+ {\chardef\kindoffile\plusone}
+ {\chardef\kindoffile\zerocount}}}
%D \macros
%D {readfile,ReadFile,maxreadlevel,
@@ -256,23 +256,30 @@
\def\maxreadlevel{3}
-\def\doreadfile#1#2#3%
- {\sanitizefilename#1\to\readfilename
+\def\doreadfile#1#2#3#4%
+ {\sanitizefilename#2\to\readfilename
\checkfilename\readfilename
\ifcase\kindoffile
- \immediate\openin\scratchread=\readfilename\relax
- \ifeof\scratchread
- \immediate\closein\scratchread
- \decrement\readlevel\relax
- \ifnum\readlevel>0
- \def\next{\doreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}}%
- \else
- \def\next{#3}%
- \fi
+ % not a full path or url, check for existence
+ \def\next{\redoreadfile{\pathplusfile{#1}{\readfilename}}{#3}{#4}}%
+ \else
+ % a full path or url, no further checking done
+ \def\next{#3\dodoreadfile}%
+ \fi
+ \next}
+
+\def\redoreadfile#1#2#3%
+ {\immediate\openin\scratchread=\readfilename\relax
+ \ifeof\scratchread
+ \immediate\closein\scratchread
+ \decrement\readlevel\relax
+ \ifnum\readlevel>\zerocount
+ \def\next{\redoreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}}%
\else
- \def\next{\immediate\closein\scratchread#2\dodoreadfile}%
+ \def\next{#3}%
\fi
\else
+ \immediate\closein\scratchread
\def\next{#2\dodoreadfile}%
\fi
\next}
@@ -284,7 +291,8 @@
\def\readfile% #1%
{\let\readlevel\maxreadlevel
- \doreadfile} % {#1}
+ %\doreadfile} % {#1}
+ \doreadfile\empty} % {#1}
\def\ReadFile#1%
{\readfile{#1}\donothing\donothing}
@@ -305,11 +313,13 @@
\def\readjobfile#1% current path, no backtracking
{\newcounter\readlevel
- \doreadfile{\pathplusfile{\f!currentpath}{#1}}}
+ %\doreadfile{\pathplusfile{\f!currentpath}{#1}}}
+ \doreadfile\f!currentpath{#1}}
\def\readlocfile#1% current path, backtracking
{\let\readlevel\maxreadlevel
- \doreadfile{\pathplusfile{\f!currentpath}{#1}}}
+ %\doreadfile{\pathplusfile{\f!currentpath}{#1}}}
+ \doreadfile\f!currentpath{#1}}
%D System files can be anywhere and therefore
%D \type{\readsysfile} is not bound to the current directory
@@ -317,7 +327,8 @@
\def\readsysfile#1% current path, obeys tex search
{\let\readlevel\maxreadlevel
- \doreadfile{#1}}
+ %\doreadfile{#1}}
+ \doreadfile\empty{#1}}
%D Of the last two, \type{\readfixfile} searches on the
%D directory specified and backtracks too, while
@@ -325,11 +336,13 @@
\def\readfixfile#1#2% specified path, backtracking
{\let\readlevel\maxreadlevel
- \doreadfile{\pathplusfile{#1}{#2}}}
+ %\doreadfile{\pathplusfile{#1}{#2}}}
+ \doreadfile{#1}{#2}}
\def\readsetfile#1#2% specified path, no backtracking
{\newcounter\readlevel
- \doreadfile{\pathplusfile{#1}{#2}}}
+ %\doreadfile{\pathplusfile{#1}{#2}}}
+ \doreadfile{#1}{#2}}
%D After having defined this commands, we reconsidered the
%D previously defined \type{\readfile}. This time we more or
@@ -408,15 +421,27 @@
%D \doiflocfileelse {filename} {before loading} {not found}
%D \stoptypen
-\def\doiffileelse#1#2#3%
- {\immediate\openin\scratchread=#1\relax
- \ifeof\scratchread
- \def\next{#3}%
- \else
- \def\next{#2}%
- \fi
- \immediate\closein\scratchread
- \next}
+% \def\doiffileelse#1#2#3%
+% {\immediate\openin\scratchread=#1\relax
+% \ifeof\scratchread
+% \def\next{#3}%
+% \else
+% \def\next{#2}%
+% \fi
+% \immediate\closein\scratchread
+% \next}
+
+\def\doiffileelse#1%
+ {\doifelsenothing{#1}
+ {\secondoftwoarguments}
+ {\immediate\openin\scratchread=#1\relax
+ \ifeof\scratchread
+ \immediate\closein\scratchread
+ \expandafter\secondoftwoarguments
+ \else
+ \immediate\closein\scratchread
+ \expandafter\firstoftwoarguments
+ \fi}}
% \def\doiflocfileelse#1%
% {\doiffileelse{\pathplusfile\f!currentpath{#1}}}
diff --git a/tex/context/base/symb-ini.tex b/tex/context/base/symb-ini.tex
index 76a7fca24..b365ae771 100644
--- a/tex/context/base/symb-ini.tex
+++ b/tex/context/base/symb-ini.tex
@@ -186,14 +186,17 @@
\def\defaultsymbolfactor{10}
\def\defaultsymbolheight{1.25ex}
-\def\dohandlefiguresymbol#1#2%
+\def\figuresymbol
+ {\dodoubleempty\dofiguresymbol}
+
+\def\dofiguresymbol[#1][% #2]%
{\externalfigure
[#1]
[\c!reset=\v!ja,
\c!symbool=\v!ja,
+ %\c!hfactor=\defaultsymbolfactor,
\c!hoogte=\defaultsymbolheight,
- %\c!hfactor=\defaultsymbolfactor,
- #2]}
+ }% #2]}
\appendtoks \resetexternalfigures \to \everysymbol
@@ -202,7 +205,7 @@
\def\dodefinefiguresymbol[#1][#2][#3]%
{\ifsecondargument
- \definesymbol[#1][\dohandlefiguresymbol{#2}{#3}]%
+ \definesymbol[#1][{\dofiguresymbol[#2][#3]}]%
\fi}
% but for the moment we keep it here
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index d283aa056..f2f210a62 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -3667,7 +3667,7 @@
%D \expandafter\dohandletokens
%D \fi}
%D
-%D \def\dohandletokens%
+%D \def\dohandletokens
%D {\afterassignment\dodohandletokens\let\next= }
%D
%D \long\def\handletokens#1\with#2%
@@ -3686,13 +3686,14 @@
%D \stoptypen
%D \macros
-%D {counttoken}
+%D {counttoken,counttokens}
%D
%D For the few occasions that we want to know the number of
%D specific tokens in a string, we can use:
%D
%D \starttypen
-%D \counttoken token\in string\to \count
+%D \counttoken token\in string\to \count
+%D \counttokens string\to \count
%D \stoptypen
%D
%D This macro, that for instance is used in \type{cont-tab},
@@ -3714,6 +3715,23 @@
\docounttoken#2\end
\resetglobal}
+% \def\counttoken#1\in#2\to#3%
+% {\redoglobal#3\zerocount
+% \def\!!stringa{#1}%
+% \def\docounttoken##1% obeys {}
+% {\def\!!stringb{##1}%
+% \ifx\!!stringa\!!stringb
+% \dodoglobal\advance#3\plusone
+% \fi}%
+% \handletokens#1\with\docounttoken
+% \resetglobal}
+
+\def\counttokens#1\to#2%
+ {\redoglobal#2\zerocount
+ \def\docounttoken##1{\dodoglobal\advance#2\plusone}%
+ \handletokens#1\with\docounttoken
+ \resetglobal}
+
%D \macros
%D {splitofftokens}
%D
diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex
index ba6e0bc46..1d2b911b5 100644
--- a/tex/context/base/syst-new.tex
+++ b/tex/context/base/syst-new.tex
@@ -225,11 +225,11 @@
% here ?
-\def\dosetrawvalue#1#2#3%
- {\@EA\def\csname#1#2\endcsname{#3}}
+\def\dosetrawvalue #1#2#3{\@EA \def\csname#1#2\endcsname{#3}}
+\def\dosetrawgvalue#1#2#3{\@EA\gdef\csname#1#2\endcsname{#3}}
-\def\getrawparameters%
- {\dogetparameters\dosetrawvalue}
+\def\getrawparameters {\dogetparameters\dosetrawvalue }
+\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue}
\def\splitskip#1%
{\scratchskip\zeropoint \!!plus 1pt \!!minus 1pt
@@ -500,15 +500,15 @@
% The following macros are used in XML handling.
-\def\dowithstringed#1#2#3#4% " ' space
+\long\def\dowithstringed#1#2#3#4% " ' space
{\if#4"\@EA#1\else\if#4'\@EAEAEA#2\else\@EAEAEA#3\fi\fi#4}
\def\unstringed
{\dowithstringed\unstringdouble\unstringsingle\unstringnothing}
-\def\unstringdouble"#1"{#1}
-\def\unstringsingle'#1'{#1}
-\def\unstringspaced #1 {#1}
+\long\def\unstringdouble"#1"{#1}
+\long\def\unstringsingle'#1'{#1}
+\long\def\unstringspaced #1 {#1}
\def\grabstring
{\dowithstringed\grabstringdouble\grabstringsingle\grabstringspaced}
@@ -517,9 +517,9 @@
{\def\@@dowithgrabbedstring{#1}%
\afterassignment\@@dowithgrabbedstring\grabstring}
-\def\grabstringdouble"#1"{\scratchtoks{#1}}
-\def\grabstringsingle'#1'{\scratchtoks{#1}}
-\def\grabstringspaced #1 {\scratchtoks{#1}}
+\long\def\grabstringdouble"#1"{\scratchtoks{#1}}
+\long\def\grabstringsingle'#1'{\scratchtoks{#1}}
+\long\def\grabstringspaced #1 {\scratchtoks{#1}}
\def\expifequalelse#1#2%
{\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then}
diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex
index b59299ff7..145463fb0 100644
--- a/tex/context/base/type-ini.tex
+++ b/tex/context/base/type-ini.tex
@@ -344,9 +344,9 @@
{\dododefinetypeface[#1][#2]
\iffifthargument % sixth is optional
% \getparameters[\??ts][rscale=1,\s!encoding=\defaultencoding,#6]
- % we need to expand since iin #6 there can be a \typescripttwo
- %\expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\defaultencoding,#6]}%
-\expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\s!default,#6]}%
+ % we need to expand since in #6 there can be a \typescripttwo
+\expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\defaultencoding,#6]}%
+% toch niet \expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\s!default,#6]}%
\pushmacro\relativefontsize
\pushmacro\typefaceencoding
\pushmacro\fontclass
@@ -356,11 +356,6 @@
\saverelativefontsize{#2}{\relativefontsize}% fall back
\writestatus{typeface}{[#1] [#2] [#3] [#4]}
\usetypescript[map][\typefaceencoding]
- % \usetypescript[#3][#4][name]
- % \usetypescript[#3][#4][default]
- % \usetypescript[#3][#4][\typefaceencoding]
- % \usetypescript[#3][#4][special]
- % save some file loading and run time
\usetypescript[#3][#4][name,default,\typefaceencoding,special]
\usetypescript[#3][#5][size]
\popmacro\fontclass
diff --git a/tex/context/base/type-syn.tex b/tex/context/base/type-syn.tex
index 148d2fadb..c153d93fb 100644
--- a/tex/context/base/type-syn.tex
+++ b/tex/context/base/type-syn.tex
@@ -62,6 +62,16 @@
\definefontsynonym [MathSymbol] [ComputerModernMath-Symbol]
\stoptypescript
+\starttypescript [serif] [computer-modern-vari] [name]
+ \definefontsynonym [Serif] [ComputerModernMono-Variable]
+ \definefontsynonym [SerifBold] [Serif]
+ \definefontsynonym [SerifItalic] [Serif]
+ \definefontsynonym [SerifSlanted] [SerifItalic]
+ \definefontsynonym [SerifBoldItalic] [SerifItalic]
+ \definefontsynonym [SerifBoldSlanted] [SerifSlanted]
+ \definefontsynonym [SerifCaps] [Serif]
+\stoptypescript
+
% This will change some day.
\starttypescript [math] [computer-modern] [name]
diff --git a/tex/context/base/x-corres.tex b/tex/context/base/x-corres.tex
new file mode 100644
index 000000000..ba39dd157
--- /dev/null
+++ b/tex/context/base/x-corres.tex
@@ -0,0 +1,136 @@
+%D \module
+%D [ file=x-corres,
+%D version=2003.12.15, % replaces keep-02a cum suis
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=Handling Correspondence Base,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE / 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.
+
+%D The selection spec:
+
+\setvariables
+ [contacts]
+ [selection=,
+ file=]
+
+%D First we define the group expansion pass:
+
+\startsetups[contacts:collect]
+
+ \defineXMLprocess [contacts]
+
+ \defineXMLignore [contact]
+
+ \defineXMLargument [contactfile]
+ \processfile
+
+ \defineXMLenvironmentsave [contactgroup] [label=]
+ {\startXMLmappinggroup[contacts]}
+ {\XMLaddcontactgrouptoselection
+ \stopXMLmappinggroup}
+
+\stopsetups
+
+%D Next we define the main processing pass:
+
+\startsetups[contacts:process]
+
+ \defineXMLprocess[contacts]
+
+ \defineXMLignore [contactgroup]
+
+ \defineXMLargument [contactfile]
+ \processfile
+
+ \defineXMLenvironmentsave[contact] [label=]
+ {\startXMLmappinggroup[contacts]}
+ {\XMLselectcontact
+ \stopXMLmappinggroup}
+
+\stopsetups
+
+\startXMLmapping[contacts]
+
+ \defineXMLsave [initials]
+ \defineXMLsave [formalname]
+ \defineXMLsave [informalname]
+ \defineXMLsave [title]
+ \defineXMLsave [prefix]
+ \defineXMLsave [suffix]
+ \defineXMLsave [telephone]
+ \defineXMLsave [mobiletelephone]
+ \defineXMLsave [telefax]
+ \defineXMLsave [email]
+ \defineXMLsave [address]
+ \defineXMLsave [information]
+
+ \defineXMLenvironment [p] \endgraf \endgraf
+
+ \defineXMLargument [member] \XMLaddcontacttoselection
+
+\stopXMLmapping
+
+%D The selection macros: we expand groups and replace them
+%D by contact labels in the selection spec.
+
+\def\XMLaddcontactgrouptoselection
+ {\edef\XMLcontactlist{\getvariable{contacts}{selection}}%
+ \edef\XMLgrouplabel {\XMLop{label}}%
+ \expanded{\doifinset{\XMLgrouplabel}{\XMLcontactlist}}
+ {\let\XMLgrouplist\empty
+ \XMLflush{contactgroup}%
+ \substituteincommalist\XMLgrouplabel\XMLgrouplist\XMLcontactlist
+ \expanded
+ {\globalsetvariables
+ [contacts]
+ [selection={\XMLcontactlist}]}}}
+
+\def\XMLaddcontacttoselection#1%
+ {\addtocommalist{#1}\XMLgrouplist}
+
+%D The main selector:
+
+\def\XMLselectcontact
+ {\edef\XMLcontactlist {\getvariable{contacts}{selection}}%
+ \edef\XMLcontactlabel{\XMLop{label}}%
+ \doifelsenothing{\XMLcontactlist}
+ {\donetrue}
+ {\expanded{\doifinsetelse{\XMLcontactlabel}{\XMLcontactlist}}
+ {\donetrue}
+ {\donefalse}}%
+ \ifdone
+ \XMLflush{contact}%
+ \setups[contact:handle]%
+ \fi}
+
+%D The default:
+
+\startsetups[contact:handle]
+
+ \XMLflush{address}
+
+\stopsetups
+
+\setups[contacts:process]
+
+%D Handy:
+
+\def\XMLprocesscontacts
+ {\dosingleempty\XMLprocesscontacts}
+
+\def\XMLprocesscontacts[#1]%
+ {\bgroup
+ \doifelsenothing{#1}
+ {\XMLprocesscontacts[\getvariable{contacts}{file}]}
+ {\setups[contacts:collect]%
+ \processcommacommand[#1]\processXMLfile
+ \setups[contacts:process]%
+ \processcommacommand[#1]\processXMLfile}%
+ \egroup}
+
+\endinput
diff --git a/tex/context/base/x-fig-00.tex b/tex/context/base/x-fig-00.tex
index 7665a0da3..62b40c4ac 100644
--- a/tex/context/base/x-fig-00.tex
+++ b/tex/context/base/x-fig-00.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\readfile{x-res-04} \donothing \donothing \endinput
+
% naast label, ook fig als ref en dan naar fig ref springen
%D This module implements an interface to a figure database
diff --git a/tex/context/base/x-fig-01.tex b/tex/context/base/x-fig-01.tex
index f4900fc4e..c43b61367 100644
--- a/tex/context/base/x-fig-01.tex
+++ b/tex/context/base/x-fig-01.tex
@@ -8,53 +8,55 @@
%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.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-%D See \type {x-fig-00.tex} for more information on how to use
-%D and generate figure databases. This file loads the file
-%D named \type {\jobfilename} (\TEXEXEC\ will set this
-%D variable). You can apply this style to a database by
+\readfile {x-res-01} \donothing \donothing \endinput
+
+%D See \type {x-fig-00.tex} for more information on how to use
+%D and generate figure databases. This file loads the file
+%D named \type {\jobfilename} (\TEXEXEC\ will set this
+%D variable). You can apply this style to a database by
%D saying:
-%D
-%D \starttypen
+%D
+%D \starttypen
%D texexec --pdf --use=fig-make yourfile.xml
-%D \stoptypen
-%D
-%D The following modes are supported:
-%D
+%D \stoptypen
+%D
+%D The following modes are supported:
+%D
%D \starttabulatie[|lT|l|]
-%D \NC letter \NC map the preview on letter size \NC \NR
-%D \NC compact \NC use an alternative presentation \NC \NR
+%D \NC letter \NC map the preview on letter size \NC \NR
+%D \NC compact \NC use an alternative presentation \NC \NR
%D \stoptabulatie
%D
-%D The resulting file has the following characteristics:
+%D The resulting file has the following characteristics:
%D
%D \startopsomming[opelkaar]
%D \som the document is split into three sections: first each
-%D figure is shown at its own page, then an overview of
-%D figures is shown with some data alongside, and
-%D finally an index and table of contents shows up
-%D \som there is no title page, which means that one can
+%D figure is shown at its own page, then an overview of
+%D figures is shown with some data alongside, and
+%D finally an index and table of contents shows up
+%D \som there is no title page, which means that one can
%D access a figure by page number without offset
-%D \som the document is opened at the first overview page,
-%D that is, when the viewer supports it
+%D \som the document is opened at the first overview page,
+%D that is, when the viewer supports it
%D \som the graphic is shown 3~times: on a page of its own,
-%D scaled to a fixed dimension, and relative to a4 or
-%D letter paper size
-%D \som the labels can be accessed in an index and list at
+%D scaled to a fixed dimension, and relative to a4 or
+%D letter paper size
+%D \som the labels can be accessed in an index and list at
%D the end of the document
%D \stopopsomming
%D
-%D We use named destinations, which means that one can
+%D We use named destinations, which means that one can
%D access a figure by name from an external application.
\usemodule[fig-00]
\setupoutput[pdftex] \overcomePDFspacefalse
-\doifnothing {\jobfilename} {\end}
-\doiffileelse {\jobfilename.xml} {} {\end}
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xml} {} {\end}
\def\StartDescription
@@ -65,7 +67,7 @@
\defineXMLpush[comment]}
\def\StopDescription
- {\subject [begin] {Figure collection}
+ {\subject {Figure collection}
\starttabulate[|lBe|p|]
\doifXMLdataelse{organization}
{\NC organization \NC \XMLpop{organization} \NC \NR}{}
@@ -99,7 +101,7 @@
backgroundcolor=gray,
foregroundcolor=darkred,
frame=off]
- {\bf \XMLpop{dummy}}
+ {\bf \XMLpop{dummy}}
\stopbuffer
\def\StopFigureA
@@ -144,22 +146,38 @@
\setuptolerance
[verytolerant]
-% the next hack will be replaced by a layout definition
+% Ugly:
+
+\startnotmode[previewpage-letter,previewpage-S6]
+ \enablemode[previewpage-A4]
+\stopnotmode
+
+\startmode[letter] % downward compatible
+ \enablemode[previewpage-letter]
+\stopmode
-\startbuffer[paper]
-\startnotmode[letter]
+%startbuffer[paper]
+\startsetups[paper]
+\startmode[previewpage-A4]
\framed
- [width=210mm,height=297mm,offset=10pt,frame=off,
+ [width=210mm,height=297mm,offset=overlay,frame=off,
background=color,backgroundcolor=white]
{\externalfigure[\XMLpop{file}][reset=yes]}
-\stopnotmode
-\startmode[letter]
+\stopmode
+\startmode[previewpage-letter]
\framed
- [width=8.5in,height=11in,offset=10pt,frame=off,
+ [width=8.5in,height=11in,offset=overlay,frame=off,
background=color,backgroundcolor=white]
{\externalfigure[\XMLpop{file}][reset=yes]}
\stopmode
-\stopbuffer
+\startmode[previewpage-S6]
+ \framed
+ [width=600pt,height=450pt,offset=overlay,frame=off,
+ background=color,backgroundcolor=white]
+ {\externalfigure[\XMLpop{file}][reset=yes]}
+\stopmode
+\stopsetups
+%stopbuffer
\setupbuttons
[offset=10pt,
@@ -172,20 +190,25 @@
{\par
\doglobal\increment\CurrentPage
\doifelsenothing{\XMLpop{label}}
- {\expanded{\definereference[Figure][\XMLpop{file}]}}
- {\expanded{\definereference[Figure][\XMLpop{label}]}}%
- \button
+ {\expanded{\definereference[Figure][\XMLpop{file}]}%
+ \expanded{\definereference[GridPg][grid:\XMLpop{file}]}}
+ {\expanded{\definereference[Figure][\XMLpop{label}]}%
+ \expanded{\definereference[GridPg][grid:\XMLpop{label}]}}%
+ \button % content in setup
{\hbox to \hsize
{\forgetall \dontcomplain
\doifelsenothing{\XMLpop{label}}
{\pagereference[about: \XMLpop{file}]}
{\pagereference[about: \XMLpop{label}]}%
+ % moved here, because descriptions may be absent
+ \ifnum\CurrentPage=1 \pagereference[begin]\fi
+ %
\expanded{\writetolist[figurelist]{\CurrentPage}{\XMLpop{label}}}%
\expanded{\figureindex{\CurrentPage}{\XMLpop{label}}}%
\startnotmode[compact]%
\vbox to 100pt
{\hsize30pt
- \vskip5pt
+ \vskip5pt
\hbox to \hsize{\hss\strut\bf\CurrentPage\hss}%
\vfill}%
\advance\hsize by -30pt
@@ -194,12 +217,13 @@
\advance\hsize by -10pt
\hskip10pt
\stopmode
- \framed
+ \button % \framed
[width=150pt,height=100pt,offset=10pt,frame=off,
- background=color,backgroundcolor=white]
+ background=color,backgroundcolor=white,color=]
{\externalfigure
[\XMLpop{file}]
[maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}%
+ [GridPg]%
\freezedimenmacro\naturalfigurewidth \let\FigWid\naturalfigurewidth
\freezedimenmacro\naturalfigureheight\let\FigHei\naturalfigureheight
\advance\hsize by -150pt
@@ -207,11 +231,16 @@
\advance\hsize by -10pt
\vbox to 100pt
{\hsize40pt
- \externalfigure
- [paper]
- [type=buffer,frame=on,
- framecolor=darkred,rulethickness=.5pt,
- width=40pt,object=no]
+ %\externalfigure
+ % [paper]
+ % [type=buffer,frame=on,
+ % framecolor=darkred,rulethickness=.5pt,
+ % width=40pt,object=no]
+ \framed
+ [offset=overlay,
+ framecolor=darkred,
+ rulethickness=.5pt]
+ {\scale[width=40pt]{\setups[paper]}}% {\disableXML\getbuffer[paper]}}%
\startmode[compact]%
\vfill
\hbox to \hsize{\hss\strut\bf\CurrentPage\hss}%
@@ -224,21 +253,17 @@
{\blank[disable]
\starttabulate[|Bel|p|]
\NC file \NC \XMLpop{file} \NC \NR
- \doifXMLdataelse{label}
- {\NC label \NC \XMLpop{label} \NC \NR}
- {}
+ \doifXMLdata{label}
+ {\NC label \NC \XMLpop{label} \NC \NR}
\NC w$\times$h \NC \FigWid$\times$\FigHei \NC \NR
- \doifXMLdataelse{copyright}
+ \doifXMLdata{copyright}
{\NC copyright \NC \XMLpop{copyright} \NC \NR}
- {}
- \doifXMLdataelse{status}
+ \doifXMLdata{status}
{\doifelse{\XMLpop{status}}{obsolete}
{\NC status \NC \bf\darkred\XMLpop{status} \NC \NR}
{\NC status \NC \XMLpop{status} \NC \NR}}
- {}
- \doifXMLdataelse{comment}
- {\NC comment \NC \XMLpop{comment} \NC \NR}
- {}
+ \doifXMLdata{comment}
+ {\NC comment \NC \XMLpop{comment} \NC \NR}
\stoptabulate
\vfill}}}%
[Figure]
@@ -266,7 +291,7 @@
[width=max,
height=max]
-\setupcolors
+\setupcolors
[state=start]
\setupinteraction
@@ -279,7 +304,7 @@
[section]
[style=bfb]
-\setupbodyfont
+\setupbodyfont
[pos]
\setupinteractionmenu
@@ -301,40 +326,30 @@
\stopinteractionmenu
\setupinteraction
- [openaction=page(\NumberOfFigures)]
+ [openaction=begin]
\defineXMLenvironment [figurelibrary] \StartLibrary \StopLibrary
-\starttext
+\starttext
\def\StartLibrary{\mainlanguage[\XMLpar{figurelibrary}{language}{en}]}
\def\StopLibrary {}
-\defineXMLignore
- [description]
-
-\defineXMLenvironment
- [figure]
- \StartFigureC
- \StopFigureC
+\defineXMLignore [description]
+\defineXMLenvironment [figure] \StartFigureC \StopFigureC
\doglobal\newcounter\CurrentPage
-\processXMLfilegrouped{\jobfilename.xml}
+\processXMLfilegrouped{\jobfilename.xml}
\increment\NumberOfFigures
-\defineXMLignore
- [description]
-
-\defineXMLenvironment
- [figure]
- \StartFigureA
- \StopFigureA
+\defineXMLignore [description]
+\defineXMLenvironment [figure] \StartFigureA \StopFigureA
\doglobal\newcounter\CurrentPage
-\processXMLfilegrouped{\jobfilename.xml}
+\processXMLfilegrouped{\jobfilename.xml}
\setuppapersize
[S6][S6]
@@ -363,4 +378,80 @@
\placeregister[figureindex]
\stopcolumns
-\stoptext
+\doifmodeelse{clipgrid-distance,clipgrid-steps}{\page}{\stoptext}
+
+\startuniqueMPgraphic{clipgrid}{dx,dy,nx,ny,type}
+ numeric gdx, gdy, lbx, lby ;
+ if \MPvar{type}=1 :
+ gdx := \MPvar{dy} ;
+ gdy := \MPvar{dx} ;
+ else :
+ gdx := OverlayWidth /\MPvar{nx} ;
+ gdy := OverlayHeight/\MPvar{ny} ;
+ fi ;
+ lbx := gdx ;
+ lby := gdy ;
+ defaultfont := "\truefontname{Mono}" ;
+ defaultscale := .5 ;
+ numeric pen ; pen := .25pt ;
+ def MyGrid text t =
+ draw vlingrid (0,OverlayWidth ,gdy,OverlayWidth ,OverlayHeight) t ;
+ draw hlingrid (0,OverlayHeight,gdx,OverlayHeight,OverlayWidth ) t ;
+ enddef ;
+ pickup pencircle scaled pen ;
+ MyGrid withcolor white ;
+ MyGrid dashed evenly scaled pen ;
+ draw OverlayBox withcolor white ;
+ draw OverlayBox dashed evenly scaled pen ;
+ draw vlinlabel.bot(0,eps+OverlayWidth /lby,2,OverlayWidth ) ;
+ draw hlinlabel.lft(0,eps+OverlayHeight/lbx,2,OverlayHeight) ;
+ setbounds currentpicture to OverlayBox enlarged (2*EmWidth) ;
+\stopuniqueMPgraphic
+
+\presetMPvariable[clipgrid][dx=10pt]
+\presetMPvariable[clipgrid][dy=10pt]
+\presetMPvariable[clipgrid][nx=10]
+\presetMPvariable[clipgrid][ny=10]
+
+\startmode[clipgrid-distance]
+ \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=1}]
+\stopmode
+
+\startmode[clipgrid-steps]
+ \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=2}]
+\stopmode
+
+\setupexternalfigures
+ [background={color,foreground,grid},
+ backgroundcolor=white]
+
+\def\StartFigureD
+ {\StartFigureA}
+
+\def\StopFigureD
+ {\doglobal\increment\CurrentPage
+ \setupbackgrounds[page][background=page]
+ \startpagefigure[\XMLpop{file}][offset=20pt]%
+ \doifelsenothing{\XMLpop{label}}
+ {\expanded{\definereference[Description][about: \XMLpop{file}]}%
+ \pagereference[grid:\XMLpop{file}]}
+ {\expanded{\definereference[Description][about: \XMLpop{label}]}%
+ \pagereference[grid:\XMLpop{label}]}
+ \stoppagefigure
+ %\pagefigure[\XMLpop{file}][offset=20pt]
+ \setupbackgrounds[page][background=]
+ \egroup}
+
+\defineXMLignore
+ [description]
+
+\defineXMLenvironment
+ [figure]
+ \StartFigureD
+ \StopFigureD
+
+\doglobal\newcounter\CurrentPage
+
+\processXMLfilegrouped{\jobfilename.xml} \page
+
+\stoptext
diff --git a/tex/context/base/x-fig-02.tex b/tex/context/base/x-fig-02.tex
index 1bdfc2f11..2205fc658 100644
--- a/tex/context/base/x-fig-02.tex
+++ b/tex/context/base/x-fig-02.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\readfile {x-res-02} \donothing \donothing \endinput
+
%D This module enables non||\ConTeXt\ users to access the
%D database. For this, you need to run
%D
diff --git a/tex/context/base/x-fig-03.tex b/tex/context/base/x-fig-03.tex
index 80e4a3ef9..bf5ea226c 100644
--- a/tex/context/base/x-fig-03.tex
+++ b/tex/context/base/x-fig-03.tex
@@ -11,8 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D This file is the companion of \type {x-fig-02.tex}.
-
\ifx \undefined \convertMPtoPDF \input supp-pdf.tex \fi
\ifx \undefined \includefigurefile \else \expandafter \endinput \fi
diff --git a/tex/context/base/x-res-00.tex b/tex/context/base/x-res-00.tex
new file mode 100644
index 000000000..8cf8606d8
--- /dev/null
+++ b/tex/context/base/x-res-00.tex
@@ -0,0 +1,62 @@
+%D \module
+%D [ file=x-res-00,
+%D version=2001.03.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Resource Libraries,
+%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.
+
+\unprotect
+
+% \defineXMLcommandpush [rl:instance] (todo)
+% \rawframed == [frame=off,offset=overlay]
+
+% resource library
+
+\defineXMLprocess [rl:figurelibrary] % not to be used any longer
+\defineXMLprocess [rl:library]
+
+% resource library description
+
+\defineXMLignore [rl:description]
+
+\defineXMLpush [rl:organization]
+\defineXMLpush [rl:product]
+\defineXMLpush [rl:project]
+
+% resource library entries
+
+\defineXMLignore [rl:applet]
+\defineXMLignore [rl:application]
+\defineXMLignore [rl:figure]
+\defineXMLignore [rl:movie]
+\defineXMLignore [rl:sound]
+
+\defineXMLpush [rl:file]
+\defineXMLpush [rl:label]
+\defineXMLpush [rl:original]
+\defineXMLpush [rl:title]
+\defineXMLpush [rl:alternative]
+\defineXMLpush [rl:dummy]
+\defineXMLpush [rl:icon]
+\defineXMLpush [rl:copyright]
+\defineXMLpush [rl:comment]
+\defineXMLpush [rl:status]
+\defineXMLpush [rl:original]
+\defineXMLpush [rl:manipulation]
+
+% instances
+
+\defineXMLignore [rl:instance]
+
+\defineXMLpush [rl:background]
+\defineXMLpush [rl:viewport]
+\defineXMLpush [rl:dimension]
+\defineXMLpush [rl:position]
+
+\protect \endinput
diff --git a/tex/context/base/x-res-01.tex b/tex/context/base/x-res-01.tex
new file mode 100644
index 000000000..7928f5a95
--- /dev/null
+++ b/tex/context/base/x-res-01.tex
@@ -0,0 +1,449 @@
+%D \module
+%D [ file=x-fig-01,
+%D version=2001.03.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Figure Base Generation,
+%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.
+
+%D See \type {x-fig-00.tex} and \type {x-fig-04.tex} for more
+%D information on how to use and generate figure databases.
+%D This file loads the file named \type {\jobfilename}
+%D (\TEXEXEC\ will set this variable). You can apply this
+%D style to a database by saying:
+%D
+%D \starttypen
+%D texexec --pdf --use=fig-make yourfile.xml
+%D \stoptypen
+%D
+%D The following modes are supported:
+%D
+%D \starttabulatie[|lT|l|]
+%D \NC letter \NC map the preview on letter size \NC \NR
+%D \NC compact \NC use an alternative presentation \NC \NR
+%D \stoptabulatie
+%D
+%D The resulting file has the following characteristics:
+%D
+%D \startopsomming[opelkaar]
+%D \som the document is split into three sections: first each
+%D figure is shown at its own page, then an overview of
+%D figures is shown with some data alongside, and
+%D finally an index and table of contents shows up
+%D \som there is no title page, which means that one can
+%D access a figure by page number without offset
+%D \som the document is opened at the first overview page,
+%D that is, when the viewer supports it
+%D \som the graphic is shown 3~times: on a page of its own,
+%D scaled to a fixed dimension, and relative to a4 or
+%D letter paper size
+%D \som the labels can be accessed in an index and list at
+%D the end of the document
+%D \stopopsomming
+%D
+%D We use named destinations, which means that one can
+%D access a figure by name from an external application.
+
+\usemodule[res-00]
+
+\autoXMLnamespace[rl]
+
+\setupoutput[pdftex] \overcomePDFspacefalse
+
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xml} {} {\end}
+
+\def\StartDescription
+ {\bgroup}
+
+\def\StopDescription
+ {\subject {Figure collection}
+ \starttabulate[|lBe|p|]
+ \doifXMLdataelse{rl:organization}
+ {\NC organization \NC \XMLflush{rl:organization} \NC \NR}{}
+ \doifXMLdataelse{rl:project}
+ {\NC project \NC \XMLflush{rl:project} \NC \NR}{}
+ \doifXMLdataelse{rl:product}
+ {\NC product \NC \XMLflush{rl:product} \NC \NR}{}
+ \doifXMLdataelse{rl:comment}
+ {\NC comment \NC \XMLflush{rl:comment} \NC \NR}{}
+ \stoptabulate
+ \blank[2*big]
+ \egroup}
+
+\def\StartFigureA
+ {\bgroup
+ \XMLassign{rl:file}{unknown}}
+
+\defineoverlay[page][\overlaybutton{Description}]
+
+\startbuffer[unknown]
+ \framed
+ [width=\XMLpar{rl:dummy}{width}{12cm},
+ height=\XMLpar{rl:dummy}{height}{8cm},
+ background=color,
+ backgroundcolor=gray,
+ foregroundcolor=darkred,
+ align=normal,
+ frame=off]
+ {\bf \XMLflush{rl:dummy}}
+\stopbuffer
+
+\useexternalfigure[unknown][unknown][type=buffer,object=no]
+
+% \def\externalfigurereplacement#1#2#3%
+% {\getbuffer[rl-unknown]}
+
+\def\StopFigureA
+ {\doglobal\increment\CurrentPage
+ \setupbackgrounds[page][background=page]
+ \doifelsenothing{\XMLflush{rl:label}}
+ {\expanded{\definereference[Description][about: \XMLflush{rl:file}]}%
+ \expanded{\pagereference[\XMLflush{rl:file}]}}
+ {\expanded{\definereference[Description][about: \XMLflush{rl:label}]}%
+ \expanded{\pagereference[\XMLflush{rl:label}]}}
+ \pagefigure[\XMLflush{rl:file}]
+ \setupbackgrounds[page][background=]
+ \egroup}
+
+\def\StartFigureB
+ {\StartFigureA}
+
+\defineregister
+ [figureindex]
+ [figureindices]
+
+\setupregister
+ [figureindex]
+ [ownnumber=yes,
+ criterium=text,
+ interaction=text,
+ indicator=no]
+
+\definelist
+ [figurelist]
+
+\setuplist
+ [figurelist]
+ [criterium=text,
+ pagenumber=no,
+ width=2em,
+ interaction=all]
+
+\setupcolors
+ [state=start]
+
+\setuptolerance
+ [verytolerant]
+
+% Ulgy:
+
+\startnotmode[previewpage-letter,previewpage-S6]
+ \enablemode[previewpage-A4]
+\stopnotmode
+
+\startmode[letter] % downward compatible
+ \enablemode[previewpage-letter]
+\stopmode
+
+%startbuffer[paper]
+\startsetups[paper]
+\startmode[previewpage-A4]
+ \framed
+ [width=210mm,height=297mm,offset=overlay,frame=off,
+ background=color,backgroundcolor=white]
+ {\externalfigure[\XMLflush{rl:file}][reset=yes]}
+\stopmode
+\startmode[previewpage-letter]
+ \framed
+ [width=8.5in,height=11in,offset=overlay,frame=off,
+ background=color,backgroundcolor=white]
+ {\externalfigure[\XMLflush{rl:file}][reset=yes]}
+\stopmode
+\startmode[previewpage-S6]
+ \framed
+ [width=600pt,height=450pt,offset=overlay,frame=off,
+ background=color,backgroundcolor=white]
+ {\externalfigure[\XMLflush{rl:file}][reset=yes]}
+\stopmode
+\stopsetups
+%stopbuffer
+
+\setupbuttons
+ [offset=10pt,
+ width=broad,
+ strut=no,
+ rulethickness=1pt,
+ framecolor=darkred]
+
+\definecolor[XMLRLcolor][white]
+
+\def\StopFigureB
+ {\doglobal\increment\CurrentPage
+ \doifelsenothing{\XMLflush{rl:label}}
+ {\expanded{\definereference[Figure][\XMLflush{rl:file}]}%
+ \expanded{\definereference[GridPg][grid:\XMLflush{rl:file}]}}
+ {\expanded{\definereference[Figure][\XMLflush{rl:label}]}%
+ \expanded{\definereference[GridPg][grid:\XMLflush{rl:label}]}}%
+ \button
+ {\hbox to \hsize
+ {\forgetall \dontcomplain
+ \doifelsenothing{\XMLflush{rl:label}}
+ {\expanded{\pagereference[about: \XMLflush{rl:file}]}}
+ {\expanded{\pagereference[about: \XMLflush{rl:label}]}}%
+ % moved here, because descriptions may be absent
+ \ifnum\CurrentPage=1 \pagereference[begin]\fi
+ %
+ \expanded{\writetolist[figurelist]{\CurrentPage}{\XMLflush{rl:label}}}%
+ \expanded{\figureindex{\CurrentPage}{\XMLflush{rl:label}}}%
+ \startnotmode[compact]%
+ \vbox to 100pt
+ {\hsize30pt
+ \vskip5pt
+ \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}%
+ \vfill}%
+ \advance\hsize by -30pt
+ \stopnotmode
+ \startmode[compact]%
+ \advance\hsize by -10pt
+ \hskip10pt
+ \stopmode
+ \button % \framed
+ [width=150pt,height=100pt,offset=10pt,frame=off,
+ background=color,backgroundcolor=white,color=]
+ {\externalfigure
+ [\XMLflush{rl:file}]
+ [maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}%
+ [GridPg]%
+ \freezedimenmacro\naturalfigurewidth \let\FigWid\naturalfigurewidth
+ \freezedimenmacro\naturalfigureheight\let\FigHei\naturalfigureheight
+ \advance\hsize by -150pt
+ \hskip10pt
+ \advance\hsize by -10pt
+ \vbox to 100pt
+ {\hsize40pt
+ %\externalfigure
+ % [paper]
+ % [type=buffer,frame=on,
+ % framecolor=darkred,rulethickness=.5pt,
+ % width=40pt,object=no]
+ \framed
+ [offset=overlay,
+ framecolor=darkred,
+ rulethickness=.5pt]
+ {\scale[width=40pt]{\setups[paper]}}% {\disableXML\getbuffer[paper]}}%
+ \startmode[compact]%
+ \vfill
+ \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}%
+ \stopmode
+ \vfill}%
+ \advance\hsize by -40pt
+ \hskip10pt
+ \advance\hsize by -10pt
+ \vbox to 100pt
+ {\blank[disable]
+ \starttabulate[|Bel|p|]
+ \NC file \NC \XMLflush{rl:file} \NC \NR
+ \doifXMLdata{rl:label}
+ {\NC label \NC \XMLflush{rl:label} \NC \NR}
+ \NC w$\times$h \NC \FigWid$\times$\FigHei \NC \NR
+ \doifXMLdata{rl:copyright}
+ {\NC copyright \NC \XMLflush{rl:copyright} \NC \NR}
+ \doifXMLdata{rl:status}
+ {\doif{\XMLflush{rl:status}}{obsolete}
+ {\NC status \NC \bf\darkred\XMLflush{rl:status} \NC \NR}
+ {\NC status \NC \XMLflush{rl:status} \NC \NR}}
+ \doifXMLdata{rl:comment}
+ {\NC comment \NC \XMLflush{rl:comment} \NC \NR}
+ \stoptabulate
+ \vfill}}}%
+ [Figure]
+ \vskip10pt
+ \egroup}
+
+\def\StartFigureC
+ {\StartFigureA}
+
+\def\StopFigureC
+ {\doglobal\increment\NumberOfFigures
+ \egroup}
+
+\setuplayout
+ [topspace=15pt,backspace=15pt,
+ header=0pt,footer=0pt,bottom=20pt,bottomdistance=10pt,
+ width=middle,height=fit]
+
+\setupbackgrounds
+ [page]
+ [background=,
+ backgroundcolor=gray]
+
+\setupinteractionscreen
+ [width=max,
+ height=max]
+
+\setupcolors
+ [state=start]
+
+\setupinteraction
+ [style=,
+ color=,
+ contrastcolor=,
+ state=start]
+
+\setuphead
+ [section]
+ [style=bfb]
+
+\setupbodyfont
+ [pos]
+
+\setupinteractionmenu
+ [bottom]
+ [left=\hfill,
+ middle=\hskip10pt,
+ frame=off,
+ style=bold,
+ background=color,
+ backgroundcolor=darkred,
+ foregroundcolor=white]
+
+\startinteractionmenu[bottom]
+ \but [begin] begin \\
+ \but [index] index \\
+ \but [list] list \\
+ \but [CloseDocument] close \\
+ \but [PreviousJump] go back \\
+\stopinteractionmenu
+
+\setupinteraction
+ [openaction=begin]
+
+\defineXMLenvironment [rl:figurelibrary] \StartLibrary \StopLibrary
+\defineXMLenvironment [rl:library] \StartLibrary \StopLibrary
+
+\starttext
+
+\def\StartLibrary{\mainlanguage[\XMLpar{rl:library}{language}{en}]}
+\def\StopLibrary {}
+
+\defineXMLignore [rl:description]
+\defineXMLenvironment [rl:figure] \StartFigureC \StopFigureC
+
+\doglobal\newcounter\CurrentPage
+
+\processXMLfilegrouped{\jobfilename.xml}
+
+\increment\NumberOfFigures
+
+\defineXMLignore [rl:description]
+\defineXMLenvironment [rl:figure] \StartFigureA \StopFigureA
+
+\doglobal\newcounter\CurrentPage
+
+\processXMLfilegrouped{\jobfilename.xml}
+
+\setuppapersize
+ [S6][S6]
+
+\setupbackgrounds
+ [page]
+ [background=color]
+
+\setupinteraction
+ [menu=on]
+
+\defineXMLenvironment [rl:description] \StartDescription \StopDescription
+\defineXMLenvironment [rl:figure] \StartFigureB \StopFigureB
+
+\doglobal\newcounter\CurrentPage
+
+\processXMLfilegrouped{\jobfilename.xml} \page
+
+\subject [list] {List of figures}
+
+\placelist[figurelist] \page
+
+\subject [index] {Index of figures}
+
+\startcolumns
+\placeregister[figureindex]
+\stopcolumns
+
+\doifmodeelse{clipgrid-distance,clipgrid-steps}{\page}{\stoptext}
+
+\startuniqueMPgraphic{clipgrid}{dx,dy,nx,ny,type}
+ numeric gdx, gdy, lbx, lby ;
+ if \MPvar{type}=1 :
+ gdx := \MPvar{dy} ;
+ gdy := \MPvar{dx} ;
+ else :
+ gdx := OverlayWidth /\MPvar{nx} ;
+ gdy := OverlayHeight/\MPvar{ny} ;
+ fi ;
+ lbx := gdx ;
+ lby := gdy ;
+ defaultfont := "\truefontname{Mono}" ;
+ defaultscale := .5 ;
+ numeric pen ; pen := .25pt ;
+ def MyGrid text t =
+ draw vlingrid (0,OverlayWidth ,gdy,OverlayWidth ,OverlayHeight) t ;
+ draw hlingrid (0,OverlayHeight,gdx,OverlayHeight,OverlayWidth ) t ;
+ enddef ;
+ pickup pencircle scaled pen ;
+ MyGrid withcolor white ;
+ MyGrid dashed evenly scaled pen ;
+ draw OverlayBox withcolor white ;
+ draw OverlayBox dashed evenly scaled pen ;
+ draw vlinlabel.bot(0,eps+OverlayWidth /lby,2,OverlayWidth ) ;
+ draw hlinlabel.lft(0,eps+OverlayHeight/lbx,2,OverlayHeight) ;
+ setbounds currentpicture to OverlayBox enlarged (2*EmWidth) ;
+\stopuniqueMPgraphic
+
+\presetMPvariable[clipgrid][dx=10pt]
+\presetMPvariable[clipgrid][dy=10pt]
+\presetMPvariable[clipgrid][nx=10]
+\presetMPvariable[clipgrid][ny=10]
+
+\startmode[clipgrid-distance]
+ \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=1}]
+\stopmode
+
+\startmode[clipgrid-steps]
+ \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=2}]
+\stopmode
+
+\setupexternalfigures
+ [background={color,foreground,grid},
+ backgroundcolor=white]
+
+\def\StartFigureD
+ {\StartFigureA}
+
+\def\StopFigureD
+ {\doglobal\increment\CurrentPage
+ \setupbackgrounds[page][background=page]
+ \startpagefigure[\XMLflush{rl:file}][offset=20pt]%
+ \doifelsenothing{\XMLflush{rl:label}}
+ {\expanded{\definereference[Description][about: \XMLflush{rl:file}]}%
+ \expanded{\pagereference[grid:\XMLflush{rl:file}]}}
+ {\expanded{\definereference[Description][about: \XMLflush{rl:label}]}%
+ \expanded{\pagereference[grid:\XMLflush{rl:label}]}}
+ \stoppagefigure
+ %\pagefigure[\XMLflush{rl:file}][offset=20pt]
+ \setupbackgrounds[page][background=]
+ \egroup}
+
+\defineXMLignore [rl:description]
+\defineXMLenvironment [rl:figure] \StartFigureD \StopFigureD
+
+\doglobal\newcounter\CurrentPage
+
+\processXMLfilegrouped{\jobfilename.xml} \page
+
+\stoptext
diff --git a/tex/context/base/x-res-02.tex b/tex/context/base/x-res-02.tex
new file mode 100644
index 000000000..4a7ea35d5
--- /dev/null
+++ b/tex/context/base/x-res-02.tex
@@ -0,0 +1,72 @@
+%D \module
+%D [ file=x-fig-02,
+%D version=2001.03.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Figure Base Inclusion (I),
+%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.
+
+%D This module enables non||\ConTeXt\ users to access the
+%D database. For this, you need to run
+%D
+%D \starttypen
+%D texexec --pdf --use=fig-fake yourfile.xml
+%D \stoptypen
+%D
+%D The resulting file, \type {yourfile.fig}, can be loaded
+%D in the normal way. The figures can be accessed with:
+%D
+%D \starttypen
+%D \getfigurefile{label}
+%D \getfigurepage{label}
+%D \stoptypen
+%D
+%D A a bonus, the following macro is defined:
+%D
+%D \starttypen
+%D \includefigurefile width 10cm {label}
+%D \stoptypen
+
+\usemodule[res-00]
+
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xml} {} {\end}
+
+\defineXMLenvironment [rl:figurelibrary] \StartLibrary \StopLibrary
+\defineXMLenvironment [rl:library] \StartLibrary \StopLibrary
+\defineXMLenvironment [rl:figure] \StartFigure \StopFigure
+
+\def\StartLibrary
+ {\immediate\openout \scratchwrite=\jobfilename.fig
+ \immediate\write\scratchwrite{\string\input\space x-fig-03.tex \string\relax}
+ \immediate\write\scratchwrite{}}
+
+\def\StopLibrary
+ {\immediate\write\scratchwrite{}
+ \immediate\write\scratchwrite{\string\endinput}
+ \immediate\closeout\scratchwrite}
+
+\def\StartFigure
+ {\bgroup}
+
+\def\StopFigure
+ {\doglobal\increment\CurrentPage
+ \immediate\write\scratchwrite
+ {\string\setfiguredata\space
+ {\XMLpop{rl:label}}
+ {\jobfilename}
+ {\CurrentPage}}
+ \egroup}
+
+\doglobal\newcounter\CurrentPage
+
+\starttext
+
+\processXMLfilegrouped{\jobfilename.xml}
+
+\stoptext
diff --git a/tex/context/base/x-res-03.tex b/tex/context/base/x-res-03.tex
new file mode 100644
index 000000000..bf5ea226c
--- /dev/null
+++ b/tex/context/base/x-res-03.tex
@@ -0,0 +1,44 @@
+%D \module
+%D [ file=x-fig-03,
+%D version=2001.03.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Figure Base Inclusion (II),
+%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.
+
+\ifx \undefined \convertMPtoPDF \input supp-pdf.tex \fi
+\ifx \undefined \includefigurefile \else \expandafter \endinput \fi
+
+\gdef\getfigurefile#1%
+ {\expandafter\ifx\csname x-fig-f-#1\endcsname\relax
+ \currentfigurefile
+ \else
+ \csname x-fig-f-#1\endcsname
+ \fi}
+
+\gdef\getfigurepage#1%
+ {\expandafter\ifx\csname x-fig-p-#1\endcsname\relax
+ 1%
+ \else
+ \csname x-fig-p-#1\endcsname
+ \fi}
+
+\gdef\setfiguredata#1#2#3%
+ {\gdef\currentfigurefile{#2}%
+ \expandafter\gdef\csname x-fig-f-#1\endcsname{#2}%
+ \expandafter\gdef\csname x-fig-p-#1\endcsname{#3}}
+
+\def\includefigurefile#1#%
+ {\doincludefigurefile{#1}}
+
+\def\doincludefigurefile#1#2%
+ {\edef\next{\noexpand\pdfimage
+ #1 page \getfigurepage{#2} {\getfigurefile{#2}.pdf}}%
+ \next}
+
+\endinput
diff --git a/tex/context/base/x-res-04.tex b/tex/context/base/x-res-04.tex
new file mode 100644
index 000000000..58b7771f5
--- /dev/null
+++ b/tex/context/base/x-res-04.tex
@@ -0,0 +1,325 @@
+% hele base laden
+
+\setXMLfallbackmode3
+
+% icon : preview
+% caption : \figurebasevariable{caption}
+% background : rgb cmyk gray name
+% dimensions : width height offset (l,r,t,b) area
+% alternative : tag label / evt list
+%
+% movie
+% sound
+% applet
+% application
+
+%D \module
+%D [ file=x-fig-04,
+%D version=2001.03.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Figure Base Loading,
+%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.
+
+\usemodule[res-00] % basic element definitions
+
+%D This module implements an interface to a figure database
+%D and file. The database is formatted in \XML\ conforming
+%D the following \DTD:
+%D
+%D \typefile{x-fig-00.dtd}
+%D
+%D A figure base coded this way looks like:
+%D
+%D \starttypen
+%D <!-- texexec --pdf --use=fig-01 figtest.xml -->
+%D
+%D <figurelibrary language="nl">
+%D
+%D <description>
+%D <organization>PRAGMA Advanced Document Engineering</organization>
+%D <project>Manuals</project>
+%D <product>Beginners Manual</product>
+%D <comment>A bunch of figures.</comment>
+%D </description>
+%D
+%D <figure>
+%D <file>koe.pdf</file>
+%D <label>a dutch cow</label>
+%D <copyright>Corel Draw Suite</copyright>
+%D <comment>I bet that you've seen this cow before.</comment>
+%D </figure>
+%D
+%D <figure>
+%D <dummy width="4cm" height="3cm">non existent</dummy>
+%D <label>a european cow</label>
+%D <copyright>Nobody</copyright>
+%D <comment>When will we talk about European cows?</comment>
+%D </figure>
+%D
+%D </figurelibrary>
+%D \stoptypen
+%D
+%D You can convert this base into a \PDF\ file using
+%D \TEXEXEC\ and another module in this suite.
+%D
+%D \starttypen
+%D texexec --pdf --use=fig-make yourfile.xml
+%D \stoptypen
+%D
+%D You can now select a graphic from this file using the
+%D
+%D \starttypen
+%D \externalfigure[a dutch cow][width=4cm]
+%D \stoptypen
+%D
+%D This module overloads this command so that a figure is
+%D it first searched in the list of databases.
+%D
+%D \starttypen
+%D \usemodule [fig-base]
+%D \usefigurebases[yourfile]
+%D \stoptypen
+%D
+%D The special keyword \type {reset} can be used to reset
+%D this list.
+
+\startcommands dutch english
+ german czech
+ italian romanian
+
+ usefigurebase: gebruikfiguurbestand usefigurebase
+ usefigurebase usefigurebase
+ usefigurebase usefigurebase
+
+\stopcommands
+
+\unprotect
+
+% 0 = no loading
+% 1 = selective loading
+% 2 = full loading
+
+\chardef\figurebasemode=1 % 2
+
+\newcounter\figurefilepage
+
+% loading a complete figure base
+
+\startXMLmapping[rl:load]
+
+\defineXMLenvironmentsave [rl:figure]
+ {\bgroup}
+ {\XMLflush{rl:figure}
+ \doglobal\increment\figurefilepage
+ \figbase@savedata{\XMLflush{rl:label}}\figurefilepage
+ \egroup}
+
+\stopXMLmapping
+
+\def\loadfigurebase#1%
+ {\doifnotflagged{rl:#1}
+ {\writestatus{figbase}{loading #1 into memory}%
+ \startnointerference
+ \autoXMLnamespace[rl]
+ \startXMLmapping[rl:load]
+ \doglobal\newcounter\figurefilepage
+ \processXMLfilegrouped{#1.xml}
+ \stopXMLmapping
+ \doglobal\setflag{rl:#1}
+ \stopnointerference}}
+
+\def\figbase@savedata#1#2%
+ {%\writestatus{figbase}{data of #1 loaded}%
+ \doglobal\saveXMLdatastructure{rl:#1}{record}{page="#2"}{}{rl:figure}{}}
+
+% locating and if needed loading one figure record
+
+\startXMLmapping[rl:find]
+
+\defineXMLenvironment[rl:instance]
+ {\bgroup}
+ {\doif\askedlabel{\XMLflush{rl:label}}
+ {\doglobal\saveXMLdata{rl:g:manipulation}{rl:manipulation}%
+ \doifXMLdata{rl:original}
+ {\xdef\askedlabel{\XMLflush{rl:original}}}}%
+ \egroup}
+
+\defineXMLenvironmentsave [rl:figure]
+ {\bgroup}
+ {\XMLflush{rl:figure}
+ \doglobal\increment\figurefilepage
+ \doif\askedlabel{\XMLflush{rl:label}}
+ {\ifnum\figurebasemode=\plusone % load used ones
+ \figbase@savedata\askedlabel\figurefilepage
+ \fi
+ \doglobal\saveXMLdata{rl:l:manipulation}{rl:manipulation}%
+ \xdef\figurefilelabel {\XMLflush{rl:label}}%
+ \xdef\figurefilefile {\XMLflush{rl:file}}%
+ \xdef\figurefileoriginal{\XMLflush{rl:original}}%
+ \xdef\figurefilename {\XMLflush{rl:file}}
+ \endinput}%
+ \egroup}
+
+\defineXMLenvironment [rl:record]
+ {}
+ {\xdef\figurefilename{\XMLpop{rl:file}}
+ \xdef\figurefilepage{\XMLop {page}}}
+
+\stopXMLmapping
+
+\def\getfigurefilename#1#2%
+ {\ifnum\figurebasemode=2 \loadfigurebase{#1} \fi
+ \startnointerference
+ \traceXMLelementsfalse
+ \autoXMLnamespace[rl]
+ \startXMLmapping[rl:find]
+ \resetfigurefilebase
+ \xdef\figurefilebase{#1}
+ \doglobal\newcounter\figurefilepage
+ \def\askedlabel{#2}
+ \doifelseXMLelement{rl:\askedlabel}
+ {\enableXMLelements\flushXMLelement{rl:\askedlabel}}
+ {\processcommacommand[\figurepathlist]\dogetfigurefilename}%
+ \stopXMLmapping
+ \stopnointerference}
+
+% todo: niet toegekendede naam doorgeven aan calculate en pad
+% in padstring
+
+\def\dogetfigurefilename#1%
+ {\ifx\figurefilename\empty
+ \bgroup
+ \globalletempty\figurefilelabel
+ \globalletempty\figurefileoriginal
+ \globalletempty\figurefilefile
+ \xdef\figurefilebasepath{#1}%
+ \assignfullfilename{#1}\figurefilebase\to\filename
+ \expanded{\processXMLfilegrouped{\filename.xml}}%
+ \ifx\figurefilename\empty \else
+ \global\let\figurefilebase\figurefilebase
+ \fi
+ \egroup
+ \fi}
+
+\newtoks\figurebaseresets
+
+\appendtoks
+ \globalletempty\figurefilebase
+ \globalletempty\figurefilename
+ \globalletempty\figurefilebasepath
+ \globalletempty\figurefilepage
+ \globalletempty\figurefilelabel
+ %\globalletempty\figurefileoriginal
+ %\globalletempty\figurefilefile
+\to\figurebaseresets
+
+\def\resetfigurefilebase
+ {\the\figurebaseresets}
+
+\let\normalcalculateexternalfigure\calculateexternalfigure
+
+\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
+ {\resetfigurefilebase
+ \ifx\figurebaselist\empty
+ \normalcalculateexternalfigure
+ [#1][#2][#3][#4][#5][#6]%
+ \else
+ \def\docommando##1%
+ {\getfigurefilename{##1}{#3}%
+ \ifx\figurefilename\empty\else
+ \gdef\figurefilelabel{#3}%
+ \quitcommalist
+ \fi}%
+ \processcommacommand[\figurebaselist]\docommando
+ \ifx\figurefilename\empty
+ \stripspaces\from#3\to\figurefilename % to be sure
+ \normalcalculateexternalfigure
+ [#1][#2][\figurefilename][#4][#5][#6]%
+ \else
+ \doiffileelse{\figurefilebase.pdf}
+ {\let\figurepathlist\figurefilebasepath
+ \normalcalculateexternalfigure
+ [#1][#2][\figurefilebase.pdf]%
+ [\c!pagina=\figurefilepage,#4][#5][#6]}
+ {\@EA\stripspaces\@EA\from\figurefilename\to\figurefilename
+ \normalcalculateexternalfigure
+ [#1][#2][\figurefilename][#4][#5][#6]}%
+ \fi
+ \fi}
+
+% management
+
+% will become \useresourcelibrary
+
+\def\usefigurebase[#1]%
+ {\doifelse{#1}\v!reset
+ {\let\figurebaselist\empty}
+ {\addtocommalist{#1}\figurebaselist}}
+
+\let\figurebaselist\empty
+
+\resetfigurefilebase
+
+% manipulations / todo: fixed order
+
+\defineXMLsave [rl:manipulation]
+
+\defineXMLsingular [rl:background] [r=0,g=0,b=0,s=0,c=0,m=0,y=0,k=0]
+ {\global\setbox\foundexternalfigure\vbox
+ {\definecolor
+ [XMLRLcolor]
+ [r=\XMLop{r},g=\XMLop{g},b=\XMLop{b},s=\XMLop{s},%
+ c=\XMLop{c},m=\XMLop{m},y=\XMLop{y},k=\XMLop{k}]%
+ \framed
+ [\c!kader=\v!uit,\c!offset=\v!overlay,
+ \c!achtergrond=\v!kleur,\c!achtergrondkleur=XMLRLcolor]
+ {\box\foundexternalfigure}}}
+
+\defineXMLsingular [rl:viewport] [\??cp] % []
+ {\global\setbox\foundexternalfigure\vbox
+ {\expandXMLta \getXMLta
+ \clip
+ [\XMLta]
+ {\box\foundexternalfigure}}%
+ \global\setbox\foundexternalfigure\vbox
+ {\scale
+ [\c!hoogte=\figurewidth,\c!hoogte=\figureheight]
+ {\box\foundexternalfigure}}}
+
+\defineXMLsingular [rl:dimensions] [width=,height=]
+ {}
+
+\defineXMLsingular [rl:position] [offset=,width=,height=,hoffset=,voffset=]
+ {}
+
+\appendtoks
+ \doglobal\eraseXMLelement{rl:l:manipulation}%
+ \doglobal\eraseXMLelement{rl:g:manipulation}%
+\to \figurebaseresets
+
+\appendtoks
+ \startnointerference
+ \processXMLelement{rl:l:manipulation}%
+ \processXMLelement{rl:g:manipulation}%
+ \stopnointerference
+\to \externalfigurepostprocessors
+
+\protect \doifnotmode{demo}{\endinput}
+
+\starttext
+
+\setupcolors[state=start]
+
+\usefigurebase[d-fig-01]
+
+\externalfigure[part of a dutch cow][width=3cm,frame=on]
+\externalfigure[a simple dutch cow][width=5cm,frame=on]
+\externalfigure[another simple dutch cow][width=5cm,frame=on]
+
+\stoptext
diff --git a/tex/context/base/x-xml-02.tex b/tex/context/base/x-xml-02.tex
index 098bf874b..2f0d18d65 100644
--- a/tex/context/base/x-xml-02.tex
+++ b/tex/context/base/x-xml-02.tex
@@ -47,7 +47,7 @@
[verytolerant]
\setupalign
- [right]
+ [broad,right]
\lowercasestring \inputfilename \to \lcinputfilename
@@ -57,9 +57,15 @@
\setupfootertexts
[\currentdate\space\string| \currenttime\space \string| \pagenumber]
+% let's have a look at the type of content:
+
\setupXMLfile
[level=2]
+\startmode[*suffix-xml]
+ % ok
+\stopmode
+
\startmode[*suffix-rng]
\showXMLlin[value]
\stopmode
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index 539efa2ae..b5c38db0b 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -87,16 +87,43 @@
\edef\@@XMLmapping{\@@XMLmapping+#1}%
\edef\@@XMLelement{\@@XMLelement+#1}}
-\def\stopXMLmapping%
+\def\stopXMLmapping
{\protect
\popmacro\@@XMLmapping
\popmacro\@@XMLelement}
-
+
+%D \macros
+%D {startXMLmappinggroup}
+%D
+%D Imagine something:
+%D
+%D \starttypen
+%D \defineXMLenvironment [something]
+%D {\startXMLmapping[whatever]}
+%D {\stopXMLmapping}
+%D \stoptypen
+%D
+%D Here the \type {\stopXMLmapping} will never be reached
+%D because we are in a mapping. Therefore we need:
+
+\def\startXMLmappinggroup
+ {\dodoubleempty\dostartXMLmappinggroup}
+
+\def\dostartXMLmappinggroup[#1][#2]%
+ {\bgroup
+ \letcscsname\savedXMLmeaning\csname\@@XMLelement:/\currentXMLelement\endcsname
+ \dostartXMLmapping[#1][#2]% do ! else wrong !
+ \letcsnamecs\csname\@@XMLelement:/\currentXMLelement\endcsname\savedXMLmeaning}
+
+\def\stopXMLmappinggroup
+ {\stopXMLmapping
+ \egroup}
+
%D Context Directives:
\def\@@CTXML{@@CTXML}
-\def\defineXMLdirective%
+\def\defineXMLdirective
{\dodoubleempty\dodefineXMLdirective}
\long\def\dodefineXMLdirective[#1][#2]#3%
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index e09c63924..9639b2960 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -2132,11 +2132,11 @@
\def\douseXMLfilter#1%
{\doifundefined{\c!file\f!xtagprefix#1}
- {\setvalue{\c!file\f!xtagprefix#1}{}%
+ {\letvalue{\c!file\f!xtagprefix#1}\empty
\makeshortfilename[\f!xtagprefix#1]%
\writestatus{xml}{loading module #1}% will be \showmessage
\startreadingfile
- \readsysfile{\shortfilename}{}{}%
+ \readsysfile\shortfilename\donothing\donothing
\stopreadingfile}}
%D Temporarily here.
diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex
index 78b1505ed..84bbeecda 100644
--- a/tex/context/base/xtag-pre.tex
+++ b/tex/context/base/xtag-pre.tex
@@ -207,11 +207,17 @@
\setvalue{XMLdoctype>}{}
\setvalue{XMLdoctype[}{\processuntil{]>}}
-\def\XMLdoctypeS YSTEM %
- {\dowithgrabbedstring\dodohandleXMLdoctype}
+%\def\XMLdoctypeS YSTEM %
+% {\dowithgrabbedstring\dodohandleXMLdoctype}
-\def\XMLdoctypeP UBLIC %
- {\dowithgrabbedstring{\dowithgrabbedstring\dodohandleXMLdoctype}}
+%\def\XMLdoctypeP UBLIC %
+% {\dowithgrabbedstring{\dowithgrabbedstring\dodohandleXMLdoctype}}
+
+\def\XMLdoctypeS YSTEM {\XMLgrabstring}
+\def\XMLdoctypeP UBLIC {\XMLgrabstring}
+
+\def\XMLgrabstring
+ {\doifnextcharelse>{\gobbleuntil>}{\dowithgrabbedstring\XMLgrabstring}}
%D Some day we may need to support entities within a
%D document type namespace.