summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2002-01-11 00:00:00 +0100
committerHans Hagen <pragma@wxs.nl>2002-01-11 00:00:00 +0100
commit736de6a312c37fbb8cea65cf0a86eda7dbbe0575 (patch)
treead6691db97ee31450f9ca5b30a90a22df067331b
parent398264e8338d79fc389c76f0a1f0b30e4442f4e3 (diff)
downloadcontext-736de6a312c37fbb8cea65cf0a86eda7dbbe0575.tar.gz
stable 2002.01.11
-rw-r--r--context/config/texexec.rme6
-rw-r--r--context/data/cont-cz.tws56
-rw-r--r--context/data/cont-de.tws44
-rw-r--r--context/data/cont-en.tws44
-rw-r--r--context/data/cont-it.tws52
-rw-r--r--context/data/cont-nl.tws44
-rw-r--r--context/data/cont-ro.tws56
-rw-r--r--context/data/type-buy.dat11
-rw-r--r--context/data/type-tmf.dat8
-rw-r--r--context/perltk/fdf2tan.pl3
-rw-r--r--context/perltk/fdf2tex.pl213
-rw-r--r--context/perltk/mptopdf.pl52
-rw-r--r--context/perltk/path_tre.pm36
-rw-r--r--context/perltk/runperl.zipbin1451 -> 1698 bytes
-rw-r--r--context/perltk/texexec.pl145
-rw-r--r--context/perltk/texexec.rme6
-rw-r--r--context/perltk/texfind.pl270
-rw-r--r--context/perltk/texfont.pl90
-rw-r--r--context/perltk/texutil.pl129
-rw-r--r--doc/context/base/minstall.pdfbin95067 -> 95511 bytes
-rw-r--r--doc/context/base/mreadme.pdfbin70679 -> 71045 bytes
-rw-r--r--metapost/context/metafun.mp4
-rw-r--r--metapost/context/mp-char.mp105
-rw-r--r--metapost/context/mp-form.mp378
-rw-r--r--metapost/context/mp-func.mp59
-rw-r--r--metapost/context/mp-grid.mp129
-rw-r--r--metapost/context/mp-grph.mp167
-rw-r--r--metapost/context/mp-page.mp22
-rw-r--r--metapost/context/mp-shap.mp22
-rw-r--r--metapost/context/mp-spec.mp217
-rw-r--r--metapost/context/mp-text.mp62
-rw-r--r--metapost/context/mp-tool.mp456
-rw-r--r--pdftex/config/context/il2-ams-cmr.map (renamed from pdftex/config/il2-ams-cmr.map)0
-rw-r--r--pdftex/config/context/original-adobe-euro.map (renamed from pdftex/config/original-adobe-euro.map)0
-rw-r--r--pdftex/config/context/original-ams-cmr.map (renamed from pdftex/config/original-ams-cmr.map)0
-rw-r--r--pdftex/config/context/original-ams-euler.map (renamed from pdftex/config/original-ams-euler.map)0
-rw-r--r--pdftex/config/context/original-ams-logo.map8
-rw-r--r--pdftex/config/context/original-context-symbol.map (renamed from pdftex/config/original-context-symbol.map)0
-rw-r--r--pdftex/config/context/original-vogel-symbol.map1
-rw-r--r--pdftex/config/context/original-youngryu-px.map (renamed from pdftex/config/ec-youngryu-px.map)0
-rw-r--r--pdftex/config/context/original-youngryu-tx.map (renamed from pdftex/config/ec-youngryu-tx.map)0
-rw-r--r--pdftex/config/context/pl0-ams-cmr.map (renamed from pdftex/config/pl0-ams-cmr.map)0
-rw-r--r--pdftex/config/original-bh-lucida.map49
-rw-r--r--pdftex/config/original-micropress-informal.map7
-rw-r--r--tex/context/base/colo-ini.tex855
-rw-r--r--tex/context/base/colo-rgb.tex29
-rw-r--r--tex/context/base/cont-fil.tex8
-rw-r--r--tex/context/base/cont-log.tex14
-rw-r--r--tex/context/base/cont-new.tex403
-rw-r--r--tex/context/base/cont-sys.ori4
-rw-r--r--tex/context/base/cont-usr.ori18
-rw-r--r--tex/context/base/context.tex34
-rw-r--r--tex/context/base/core-buf.tex109
-rw-r--r--tex/context/base/core-con.tex153
-rw-r--r--tex/context/base/core-dat.tex38
-rw-r--r--tex/context/base/core-des.tex46
-rw-r--r--tex/context/base/core-fig.tex265
-rw-r--r--tex/context/base/core-fil.tex115
-rw-r--r--tex/context/base/core-fld.tex65
-rw-r--r--tex/context/base/core-fnt.tex85
-rw-r--r--tex/context/base/core-gen.tex60
-rw-r--r--tex/context/base/core-grd.tex73
-rw-r--r--tex/context/base/core-hlp.tex18
-rw-r--r--tex/context/base/core-int.tex914
-rw-r--r--tex/context/base/core-itm.tex1057
-rw-r--r--tex/context/base/core-job.tex22
-rw-r--r--tex/context/base/core-lst.tex129
-rw-r--r--tex/context/base/core-mak.tex2
-rw-r--r--tex/context/base/core-mar.tex144
-rw-r--r--tex/context/base/core-mat.tex42
-rw-r--r--tex/context/base/core-mis.tex77
-rw-r--r--tex/context/base/core-nav.tex62
-rw-r--r--tex/context/base/core-new.tex360
-rw-r--r--tex/context/base/core-not.tex251
-rw-r--r--tex/context/base/core-ntb.tex180
-rw-r--r--tex/context/base/core-num.tex91
-rw-r--r--tex/context/base/core-obj.tex235
-rw-r--r--tex/context/base/core-par.tex4
-rw-r--r--tex/context/base/core-pos.tex226
-rw-r--r--tex/context/base/core-ref.tex1617
-rw-r--r--tex/context/base/core-reg.tex314
-rw-r--r--tex/context/base/core-rul.tex469
-rw-r--r--tex/context/base/core-sec.tex871
-rw-r--r--tex/context/base/core-spa.tex1323
-rw-r--r--tex/context/base/core-syn.tex46
-rw-r--r--tex/context/base/core-sys.tex101
-rw-r--r--tex/context/base/core-tab.tex99
-rw-r--r--tex/context/base/core-tbl.tex200
-rw-r--r--tex/context/base/core-uti.tex109
-rw-r--r--tex/context/base/core-var.tex55
-rw-r--r--tex/context/base/core-ver.tex92
-rw-r--r--tex/context/base/core-vis.tex76
-rw-r--r--tex/context/base/enco-ans.tex26
-rw-r--r--tex/context/base/enco-com.tex1
-rw-r--r--tex/context/base/enco-def.tex12
-rw-r--r--tex/context/base/enco-fde.tex2
-rw-r--r--tex/context/base/enco-fpl.tex2
-rw-r--r--tex/context/base/enco-ini.tex110
-rw-r--r--tex/context/base/enco-pfr.tex91
-rw-r--r--tex/context/base/enco-tbo.tex5
-rw-r--r--tex/context/base/font-ini.tex1090
-rw-r--r--tex/context/base/font-run.tex10
-rw-r--r--tex/context/base/hand-ini.tex123
-rw-r--r--tex/context/base/java-fld.tex9
-rw-r--r--tex/context/base/java-ini.tex14
-rw-r--r--tex/context/base/lang-alt.tex30
-rw-r--r--tex/context/base/lang-ger.tex35
-rw-r--r--tex/context/base/lang-ini.tex496
-rw-r--r--tex/context/base/lang-ita.tex2
-rw-r--r--tex/context/base/lang-lab.tex186
-rw-r--r--tex/context/base/lang-sla.tex2
-rw-r--r--tex/context/base/lang-ura.tex2
-rw-r--r--tex/context/base/m-chart.tex57
-rw-r--r--tex/context/base/m-pstric.tex14
-rw-r--r--tex/context/base/m-quest.tex8
-rw-r--r--tex/context/base/m-steps.tex5
-rw-r--r--tex/context/base/m-units.tex66
-rw-r--r--tex/context/base/math-ini.tex48
-rw-r--r--tex/context/base/math-pln.tex336
-rw-r--r--tex/context/base/math-tex.tex19
-rw-r--r--tex/context/base/meta-fig.tex57
-rw-r--r--tex/context/base/meta-ini.tex261
-rw-r--r--tex/context/base/meta-pag.tex111
-rw-r--r--tex/context/base/meta-txt.tex62
-rw-r--r--tex/context/base/mult-com.tex49
-rw-r--r--tex/context/base/mult-con.tex27
-rw-r--r--tex/context/base/mult-ini.tex106
-rw-r--r--tex/context/base/mult-sys.tex18
-rw-r--r--tex/context/base/page-bck.tex138
-rw-r--r--tex/context/base/page-flt.tex585
-rw-r--r--tex/context/base/page-imp.tex867
-rw-r--r--tex/context/base/page-ini.tex284
-rw-r--r--tex/context/base/page-lay.tex363
-rw-r--r--tex/context/base/page-lin.tex5
-rw-r--r--tex/context/base/page-log.tex8
-rw-r--r--tex/context/base/page-lyr.tex161
-rw-r--r--tex/context/base/page-mak.tex28
-rw-r--r--tex/context/base/page-mar.tex31
-rw-r--r--tex/context/base/page-mul.tex41
-rw-r--r--tex/context/base/page-num.tex206
-rw-r--r--tex/context/base/page-one.tex135
-rw-r--r--tex/context/base/page-run.tex92
-rw-r--r--tex/context/base/page-set.tex563
-rw-r--r--tex/context/base/page-sid.tex175
-rw-r--r--tex/context/base/page-txt.tex65
-rw-r--r--tex/context/base/ppchtex.tex312
-rw-r--r--tex/context/base/s-abr-01.tex2
-rw-r--r--tex/context/base/s-faq-01.tex31
-rw-r--r--tex/context/base/s-faq-02.tex17
-rw-r--r--tex/context/base/s-faq-03.tex40
-rw-r--r--tex/context/base/s-mod-00.tex247
-rw-r--r--tex/context/base/s-mod-01.tex30
-rw-r--r--tex/context/base/s-pre-19.tex3
-rw-r--r--tex/context/base/setupa.tex335
-rw-r--r--tex/context/base/setupb.tex111
-rw-r--r--tex/context/base/setupd.tex6
-rw-r--r--tex/context/base/setupe.tex310
-rw-r--r--tex/context/base/spec-def.tex893
-rw-r--r--tex/context/base/spec-dpm.tex82
-rw-r--r--tex/context/base/spec-dvi.tex16
-rw-r--r--tex/context/base/spec-fdf.tex420
-rw-r--r--tex/context/base/spec-ini.tex953
-rw-r--r--tex/context/base/spec-mis.tex12
-rw-r--r--tex/context/base/spec-pdf.tex57
-rw-r--r--tex/context/base/spec-ps.tex18
-rw-r--r--tex/context/base/spec-tpd.tex205
-rw-r--r--tex/context/base/spec-tr.tex10
-rw-r--r--tex/context/base/spec-win.tex23
-rw-r--r--tex/context/base/spec-yy.tex4
-rw-r--r--tex/context/base/supp-box.tex798
-rw-r--r--tex/context/base/supp-emp.tex4
-rw-r--r--tex/context/base/supp-eps.tex151
-rw-r--r--tex/context/base/supp-fil.tex72
-rw-r--r--tex/context/base/supp-fun.tex5
-rw-r--r--tex/context/base/supp-ini.tex48
-rw-r--r--tex/context/base/supp-lan.tex140
-rw-r--r--tex/context/base/supp-mat.tex5
-rw-r--r--tex/context/base/supp-mis.tex21
-rw-r--r--tex/context/base/supp-mpe.tex712
-rw-r--r--tex/context/base/supp-mps.tex464
-rw-r--r--tex/context/base/supp-mrk.tex619
-rw-r--r--tex/context/base/supp-num.tex13
-rw-r--r--tex/context/base/supp-pdf.tex556
-rw-r--r--tex/context/base/supp-ran.tex21
-rw-r--r--tex/context/base/supp-vis.tex138
-rw-r--r--tex/context/base/symb-ini.tex218
-rw-r--r--tex/context/base/symb-mvs.tex215
-rw-r--r--tex/context/base/symb-nav.tex4
-rw-r--r--tex/context/base/symb-run.tex53
-rw-r--r--tex/context/base/syst-eet.tex270
-rw-r--r--tex/context/base/syst-etx.tex91
-rw-r--r--tex/context/base/syst-ext.tex1364
-rw-r--r--tex/context/base/syst-gen.tex1544
-rw-r--r--tex/context/base/syst-new.tex200
-rw-r--r--tex/context/base/syst-pln.tex636
-rw-r--r--tex/context/base/syst-prm.tex85
-rw-r--r--tex/context/base/syst-tex.tex30
-rw-r--r--tex/context/base/type-buy.tex27
-rw-r--r--tex/context/base/type-enc.tex183
-rw-r--r--tex/context/base/type-exa.tex16
-rw-r--r--tex/context/base/type-ini.tex205
-rw-r--r--tex/context/base/type-map.tex21
-rw-r--r--tex/context/base/type-pre.tex32
-rw-r--r--tex/context/base/type-syn.tex2
-rw-r--r--tex/context/base/verb-ini.tex189
-rw-r--r--tex/context/base/verb-raw.tex7
-rw-r--r--tex/context/base/x-chemml.tex212
-rw-r--r--tex/context/base/x-contml.tex451
-rw-r--r--tex/context/base/x-fdf-00.tex40
-rw-r--r--tex/context/base/x-fig-00.tex12
-rw-r--r--tex/context/base/x-fig-01.tex33
-rw-r--r--tex/context/base/x-fig-02.tex10
-rw-r--r--tex/context/base/x-mathml.tex (renamed from tex/context/base/m-mathml.tex)8
-rw-r--r--tex/context/base/x-physml.tex16
-rw-r--r--tex/context/base/x-sch-00.tex382
-rw-r--r--tex/context/base/x-sch-01.tex122
-rw-r--r--tex/context/base/x-xml-01.tex80
-rw-r--r--tex/context/base/x-xml-02.tex67
-rw-r--r--tex/context/base/xtag-cml.tex222
-rw-r--r--tex/context/base/xtag-exp.tex81
-rw-r--r--tex/context/base/xtag-ext.tex115
-rw-r--r--tex/context/base/xtag-ini.tex1949
-rw-r--r--tex/context/base/xtag-map.tex405
-rw-r--r--tex/context/base/xtag-meh.tex2
-rw-r--r--tex/context/base/xtag-mmc.tex89
-rw-r--r--tex/context/base/xtag-mml.tex65
-rw-r--r--tex/context/base/xtag-mmp.tex14
-rw-r--r--tex/context/base/xtag-pml.tex83
-rw-r--r--tex/context/base/xtag-pmu.tex188
-rw-r--r--tex/context/base/xtag-pre.tex325
-rw-r--r--tex/context/base/xtag-run.tex233
-rw-r--r--tex/context/base/xtag-xsd.tex28
-rw-r--r--tex/context/config/cont-usr.tex18
-rw-r--r--tex/context/extra/setup-qr.tex169
-rw-r--r--tex/context/user/cont-sys.rme4
-rw-r--r--tex/generic/context/mptopdf.tex2
-rw-r--r--tex/generic/context/ppchtex.noc7
237 files changed, 27134 insertions, 13344 deletions
diff --git a/context/config/texexec.rme b/context/config/texexec.rme
index 91a0adc92..30ecfedf0 100644
--- a/context/config/texexec.rme
+++ b/context/config/texexec.rme
@@ -51,7 +51,7 @@ set TeXShell to tetex
%
% Here are some general defaults. They can be overruled later.
-set UsedInterfaces to en nl de uk
+set UsedInterfaces to en nl metafun mptopdf
set UserInterface to en
set TeXExecutable to tex
@@ -89,7 +89,7 @@ for fptex set TeXPassString to -progname=context
for fptex set TeXBatchFlag to -int=batchmode
for fptex set MpToTeXExecutable to mpto
for fptex set MpVirginFlag to -ini
-for fptex set MpPassString to -progname=mpost
+for fptex set MpPassString to -progname=mpost
for fptex set MpBatchFlag to -int=batchmode
% MikTeX users probably have to set up some paths too.
@@ -100,7 +100,7 @@ for miktex set TeXPassString to --alias=context
for miktex set TeXBatchFlag to --interaction=batchmode
for miktex set MpToTeXExecutable to mptotex
for miktex set MpVirginFlag to --initialize
-for miktex set MpPassString to --alias=mpost
+for miktex set MpPassString to --alias=mpost
for miktex set MpBatchFlag to --interaction=batchmode
for miktex set TeXFormatFlag to --undump=
diff --git a/context/data/cont-cz.tws b/context/data/cont-cz.tws
index b667a8673..487f66256 100644
--- a/context/data/cont-cz.tws
+++ b/context/data/cont-cz.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:nastavjazyk:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:instalacejazyka::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definujskupinubarev:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*jmeno::
val:rgb,cmyk,seda,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:nastavtype:
-typ:var/:
+typ:vars/:
var:mezera:zap,vyp::
var:volba:sklonene,normalni,zadny::
var:pismeno:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
@@ -405,6 +405,7 @@ var:alternativa:a,b,c::
var:tloustkalinky:*dimenze::
var:offsetspodku:*dimenze::
var:offsetvrsku:*dimenze::
+var:barvalinky:*jmeno::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:nivy:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:nizko::
val:*text::
val:*text::
stopsetup
@@ -1725,8 +1727,9 @@ var:zpusob:skrztext,skrz*sekce::
var:text:*text::
var:oddelovaccisla:*text::
var:oddelovactextu:*text::
-var:*sekce*cislo:ano,ne::
+var:*sekcecislo singular: jmeno v singularu:ano,ne::
var:oddelovac:*text::
+var:strut:ano,ne::
var:status:start,stop::
var:prikaz:*\prikaz#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definujstartstop:
typ:val/vars/:
+val:*jmeno::
var:pred:*prikaz::
var:po:*prikaz::
var:pismeno:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
@@ -1780,6 +1784,7 @@ var:mezi:*prikaz::
var:zarovnani:vlevo,nastred,vpravo,ne::
var:konverze:cisla,pismena,Pismena,rimskecislice,Rimskecislice::
var:zpusob:skrztext,skrz*sekce::
+var:oddelovac:*text::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:nastavodkazovani:
-typ:var/:
+typ:vars/:
var:status:start,stop::
-var:*sekce*cislo:ano,ne::
+var:*sekcecislo singular: jmeno v singularu:ano,ne::
var:prefix:+,-,*text::
var:interakce:popisek,text,vse,symbol::
var:sirka:*dimenze::
@@ -1980,7 +1985,7 @@ val:*jmeno::
var:status:start,stop::
var:alternativa:a,b,c,...,zadny,prikaz::
var:propojeni:zap,vyp::
-var:kriterium:*sekce,lokalne,predchozi,vse::
+var:kriterium:*sekce,lokalne,predchozi,aktualni,vse::
var:hranicestranky:*seznam::
var:pismeno:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
var:stylcisla:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
@@ -1998,9 +2003,9 @@ var:mezi:*prikaz::
var:vlevo:*text::
var:vpravo:*text::
var:popisek:ano,ne::
-var:prefix:ano,ne::
+var:prefix:ano,ne,zadny::
var:cislostranky:ano,ne::
-var:*sekce*cislo:ano,ne::
+var:*sekcecislo singular: jmeno v singularu:ano,ne::
var:zarovnejtitul:ano,ne::
var:marginalie:*dimenze::
var:sirka:*dimenze,prizpusobive::
@@ -2008,6 +2013,7 @@ var:vyska:*dimenze,prizpusobive,siroky::
var:hloubka:*dimenze,prizpusobive,siroky::
var:vzdalenost:*dimenze::
var:oddelovac:*text::
+var:predel:*text::
var:symbol:zadny,1,2,3,...::
var:expanzen:ano,ne,prikaz::
var:maxsirka:*dimenze::
@@ -2067,6 +2073,7 @@ var:odsadpristi:ano,ne::
var:alternativa:*jmeno::
var:mezerapred:*dimenze::
var:po:*dimenze::
+var:oddelovac:*text::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:alternativa:normalni,naokraji,nastred,text::
var:prikaz:*\prikaz#1#2::
var:ciselnyprikaz:*\prikaz#1::
var:textovyprikaz:*\prikaz#1::
+var:oddelovac:*text::
var:prefix:+,-,*text::
var:umistihlavicku:ano,ne::
var:zvysujicicislo:ano,ne,*soubor::
@@ -2420,14 +2428,14 @@ stopsetup
startsetup
com:definujrejstrik:
typ:val/val/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*jmeno v pluralu::
stopsetup
startsetup
com:nastavrejstrik:
typ:val/val/vars/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*jmeno::
var:n:*cislo::
var:rovnovaha:ano,ne::
@@ -2437,7 +2445,7 @@ var:stylstranky:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
var:styltextu:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
var:indikator:ano,ne::
var:propojeni:ano,ne::
-var:*sekce*cislo:ano,ne::
+var:*sekcecislo singular: jmeno v singularu:ano,ne::
var:kriterium:*sekce,lokalne,vse::
var:vzdalenost:*dimenze::
var:symbol:1,2,...,n,a,...,zadny::
@@ -2467,7 +2475,7 @@ stopsetup
startsetup
com:zapisdorejstriku:
typ:val/val/idxs/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*text::
val:*text::
stopsetup
@@ -2508,7 +2516,7 @@ stopsetup
startsetup
com:definujsynonyma:
typ:val/val/val/val/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*jmeno v pluralu::
val:*prikaz::
val:*prikaz::
@@ -2555,7 +2563,7 @@ stopsetup
startsetup
com:definujtrideni:
typ:val/val/val/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*jmeno v pluralu::
val:*prikaz::
stopsetup
@@ -2625,6 +2633,7 @@ var:statusupati:normalni,stop,start,prazdne,zadny,zadneznaceni::
var:statustextu:normalni,stop,start,prazdne,zadny,zadneznaceni::
var:statusvrsku:stop,start::
var:statusspodku:stop,start::
+var:pagestate:stop,start::
var:barva:*jmeno::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:aktualnidatum:
typ:vals/:
-val:den,mesic,vsedniden,rok, dd,mm,jj,yy,d,m,j,y,znacka:den,mesic,rok:
+ivl:datum::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*cislo::
var:m:*cislo::
var:y:*cislo::
-ivl:aktualnidatum::
+val:den,mesic,vsedniden,rok, dd,mm,jj,yy,d,m,j,y,znacka:den,mesic,rok:
stopsetup
startsetup
@@ -2928,7 +2937,7 @@ stopsetup
startsetup
com:definujplvouciobjekt:
typ:val/val/:
-val:*jmeno v singularu::
+val:*\@@mssetupsingular ::
val:*jmeno v pluralu::
stopsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:pred:*prikaz::
var:po:*prikaz::
var:pismeno:normalni,tucne,sklonene,tucnesklonene,opis,kap,male...,*prikaz::
+var:barva:*jmeno::
+var:misto:text,marginalie::
stopsetup
startsetup
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:oznaceni:
-typ:poss/poss/vars/arg/:
-val:*cislo::
-val:*cislo::
+typ:pos/pos/vars/arg/:
val:*cislo::
val:*cislo::
ivr:nastavoramovani::
@@ -3873,7 +3882,6 @@ com:nastavpole:
typ:val/vals/vars/vars/vars/:
val:*jmeno::
val:popisek,horizontalne,vertikalne,ramecek::
-ivr:oramovani::
ivr:nastavvsechnapole::
stopsetup
@@ -3882,7 +3890,6 @@ com:nastavvsechnapole:
typ:vals/val/vars/vars/vars/:
val:*jmeno::
val:reset,popisek,horizontalne,vertikalne,ramecek::
-ivr:oramovani::
var:n:*cislo::
var:vzdalenost:*dimenze::
var:pred:*prikaz::
@@ -3903,6 +3910,7 @@ var:pocitat:*reference::
var:offsetpole:*dimenze::
var:barvarameckupole:*jmeno::
var:barvapozadipole:*jmeno::
+ivr:oramovani::
stopsetup
startsetup
diff --git a/context/data/cont-de.tws b/context/data/cont-de.tws
index 6475304ca..be43a9135 100644
--- a/context/data/cont-de.tws
+++ b/context/data/cont-de.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:stellespracheein:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:installieresprache::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definierefarbengruppe:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*Name::
val:rgb,cmyk,grau,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:stelletipein:
-typ:var/:
+typ:vars/:
var:spatium:an,aus::
var:option:geneigt,normal,kein::
var:stil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
@@ -405,6 +405,7 @@ var:alternative:a,b,c::
var:liniendicke:*Dimension::
var:untenoffset:*Dimension::
var:obenoffset:*Dimension::
+var:linienfarbe:*Name::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:tiho:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:tief::
val:*Text::
val:*Text::
stopsetup
@@ -1725,8 +1727,9 @@ var:art:protext,pro*Abschnitt::
var:text:*Text::
var:nummernseperator:*Text::
var:textseparator:*Text::
-var:*Abschnitt*Nummer:ja,nein::
+var:*Abschnittnummer:ja,nein::
var:seperator:*Text::
+var:strut:ja,nein::
var:status:start,stop::
var:befehl:*\Befehl#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definierestartstop:
typ:val/vars/:
+val:*Name::
var:vor:*Befehl::
var:nach:*Befehl::
var:stil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
@@ -1780,6 +1784,7 @@ var:zwischen:*Befehl::
var:ausrichtung:links,mittig,rechts,nein::
var:konversion:ziffern,buchstaben,Buchstaben,roemischezahlen,Roemischezahlen::
var:art:protext,pro*Abschnitt::
+var:seperator:*Text::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:stellereferenzierenein:
-typ:var/:
+typ:vars/:
var:status:start,stop::
-var:*Abschnitt*Nummer:ja,nein::
+var:*Abschnittnummer:ja,nein::
var:prefix:+,-,*Text::
var:interaktion:label,text,alles,symbol::
var:breite:*Dimension::
@@ -1980,7 +1985,7 @@ val:*Name::
var:status:start,stop::
var:alternative:a,b,c,...,kein,befehl::
var:verknuepfung:an,aus::
-var:kriterium:*Abschnitt,lokal,vorig,alles::
+var:kriterium:*Abschnitt,lokal,vorig,aktuell,alles::
var:seitenbegrenzung:*Liste::
var:stil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
var:nummernstil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
@@ -1998,9 +2003,9 @@ var:zwischen:*Befehl::
var:links:*Text::
var:rechts:*Text::
var:label:ja,nein::
-var:prefix:ja,nein::
+var:prefix:ja,nein,kein::
var:seitennummer:ja,nein::
-var:*Abschnitt*Nummer:ja,nein::
+var:*Abschnittnummer:ja,nein::
var:titelausrichten:ja,nein::
var:marginalie:*Dimension::
var:breite:*Dimension,passend::
@@ -2008,6 +2013,7 @@ var:hoehe:*Dimension,passend,breit::
var:tiefe:*Dimension,passend,breit::
var:abstand:*Dimension::
var:seperator:*Text::
+var:abschnitttrenner:*Text::
var:symbol:kein,1,2,3,...::
var:expansion:ja,nein,befehl::
var:maxbreite:*Dimension::
@@ -2067,6 +2073,7 @@ var:ziehefolgendeein:ja,nein::
var:alternative:*Name::
var:vorspatium:*Dimension::
var:nach:*Dimension::
+var:seperator:*Text::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:alternative:normal,imrand,mittig,text::
var:befehl:*\Befehl#1#2::
var:nummerbefehl:*\Befehl#1::
var:textbefehl:*\Befehl#1::
+var:seperator:*Text::
var:prefix:+,-,*Text::
var:setzekopf:ja,nein::
var:nummererhoehen:ja,nein,*Datei::
@@ -2437,7 +2445,7 @@ var:seitenstil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
var:textstil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
var:indikator:ja,nein::
var:verknuepfung:ja,nein::
-var:*Abschnitt*Nummer:ja,nein::
+var:*Abschnittnummer:ja,nein::
var:kriterium:*Abschnitt,lokal,alles::
var:abstand:*Dimension::
var:symbol:1,2,...,n,a,...,kein::
@@ -2625,6 +2633,7 @@ var:fusszeilenstatus:normal,stop,start,leer,kein,keinebeschriftung::
var:textstatus:normal,stop,start,leer,kein,keinebeschriftung::
var:statusoben:stop,start::
var:untenstatus:stop,start::
+var:pagestate:stop,start::
var:farbe:*Name::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:heutigesdatum:
typ:vals/:
-val:tag,monat,wochentag,jahr, dd,mm,jj,yy,d,m,j,y,merkmal:tag,monat,jahr:
+ivl:datum::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*Nummer::
var:m:*Nummer::
var:y:*Nummer::
-ivl:heutigesdatum::
+val:tag,monat,wochentag,jahr, dd,mm,jj,yy,d,m,j,y,merkmal:tag,monat,jahr:
stopsetup
startsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:vor:*Befehl::
var:nach:*Befehl::
var:stil:normal,fett,geneigt,fettgeneigt,tippen,kap,klein...,*Befehl::
+var:farbe:*Name::
+var:platz:text,marginalie::
stopsetup
startsetup
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:bemerkung:
-typ:poss/poss/vars/arg/:
-val:*Nummer::
-val:*Nummer::
+typ:pos/pos/vars/arg/:
val:*Nummer::
val:*Nummer::
ivr:stelleumrahmtein::
@@ -3873,7 +3882,6 @@ com:stellefeldein:
typ:val/vals/vars/vars/vars/:
val:*Name::
val:label,horizontal,vertikal,rahmen::
-ivr:umrahmt::
ivr:stellefelderin::
stopsetup
@@ -3882,7 +3890,6 @@ com:stellefelderin:
typ:vals/val/vars/vars/vars/:
val:*Name::
val:zuruecksetzten,label,horizontal,vertikal,rahmen::
-ivr:umrahmt::
var:n:*Nummer::
var:abstand:*Dimension::
var:vor:*Befehl::
@@ -3903,6 +3910,7 @@ var:berechnen:*Referenz::
var:feldoffset:*Dimension::
var:feldrahmenfarbe:*Name::
var:feldhintergrundfarbe:*Name::
+ivr:umrahmt::
stopsetup
startsetup
diff --git a/context/data/cont-en.tws b/context/data/cont-en.tws
index 62138e399..a0da7693d 100644
--- a/context/data/cont-en.tws
+++ b/context/data/cont-en.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:setuplanguage:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:installlanguage::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definecolorgroup:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*name::
val:rgb,cmyk,gray,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:setuptype:
-typ:var/:
+typ:vars/:
var:space:on,off::
var:option:slanted,normal,none::
var:style:normal,bold,slanted,boldslanted,type,cap,small...,*command::
@@ -405,6 +405,7 @@ var:alternative:a,b,c::
var:rulethickness:*dimension::
var:bottomoffset:*dimension::
var:topoffset:*dimension::
+var:rulecolor:*name::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:lohi:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:low::
val:*text::
val:*text::
stopsetup
@@ -1725,8 +1727,9 @@ var:way:bytext,by*section::
var:text:*text::
var:numberseparator:*text::
var:textseparator:*text::
-var:*section*number:yes,no::
+var:*sectionnumber:yes,no::
var:separator:*text::
+var:strut:yes,no::
var:state:start,stop::
var:command:*\command#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definestartstop:
typ:val/vars/:
+val:*name::
var:before:*command::
var:after:*command::
var:style:normal,bold,slanted,boldslanted,type,cap,small...,*command::
@@ -1780,6 +1784,7 @@ var:inbetween:*command::
var:align:left,middle,right,no::
var:conversion:numbers,characters,Characters,romannumerals,Romannumerals::
var:way:bytext,by*section::
+var:separator:*text::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:setupreferencing:
-typ:var/:
+typ:vars/:
var:state:start,stop::
-var:*section*number:yes,no::
+var:*sectionnumber:yes,no::
var:prefix:+,-,*text::
var:interaction:label,text,all,symbol::
var:width:*dimension::
@@ -1980,7 +1985,7 @@ val:*name::
var:state:start,stop::
var:alternative:a,b,c,...,none,command::
var:coupling:on,off::
-var:criterium:*section,local,previous,all::
+var:criterium:*section,local,previous,current,all::
var:pageboundaries:*list::
var:style:normal,bold,slanted,boldslanted,type,cap,small...,*command::
var:numberstyle:normal,bold,slanted,boldslanted,type,cap,small...,*command::
@@ -1998,9 +2003,9 @@ var:inbetween:*command::
var:left:*text::
var:right:*text::
var:label:yes,no::
-var:prefix:yes,no::
+var:prefix:yes,no,none::
var:pagenumber:yes,no::
-var:*section*number:yes,no::
+var:*sectionnumber:yes,no::
var:aligntitle:yes,no::
var:margin:*dimension::
var:width:*dimension,fit::
@@ -2008,6 +2013,7 @@ var:height:*dimension,fit,broad::
var:depth:*dimension,fit,broad::
var:distance:*dimension::
var:separator:*text::
+var:stopper:*text::
var:symbol:none,1,2,3,...::
var:expansion:yes,no,command::
var:maxwidth:*dimension::
@@ -2067,6 +2073,7 @@ var:indentnext:yes,no::
var:alternative:*name::
var:spacebefore:*dimension::
var:after:*dimension::
+var:separator:*text::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:alternative:normal,inmargin,middle,text::
var:command:*\command#1#2::
var:numbercommand:*\command#1::
var:textcommand:*\command#1::
+var:separator:*text::
var:prefix:+,-,*text::
var:placehead:yes,no::
var:incrementnumber:yes,no,*file::
@@ -2437,7 +2445,7 @@ var:pagestyle:normal,bold,slanted,boldslanted,type,cap,small...,*command::
var:textstyle:normal,bold,slanted,boldslanted,type,cap,small...,*command::
var:indicator:yes,no::
var:coupling:yes,no::
-var:*section*number:yes,no::
+var:*sectionnumber:yes,no::
var:criterium:*section,local,all::
var:distance:*dimension::
var:symbol:1,2,...,n,a,...,none::
@@ -2625,6 +2633,7 @@ var:footerstate:normal,stop,start,empty,none,nomarking::
var:textstate:normal,stop,start,empty,none,nomarking::
var:topstate:stop,start::
var:bottomstate:stop,start::
+var:pagestate:stop,start::
var:color:*name::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:currentdate:
typ:vals/:
-val:day,month,weekday,year, dd,mm,jj,yy,d,m,j,y,referral:day,month,year:
+ivl:date::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*number::
var:m:*number::
var:y:*number::
-ivl:currentdate::
+val:day,month,weekday,year, dd,mm,jj,yy,d,m,j,y,referral:day,month,year:
stopsetup
startsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:before:*command::
var:after:*command::
var:style:normal,bold,slanted,boldslanted,type,cap,small...,*command::
+var:color:*name::
+var:location:text,margin::
stopsetup
startsetup
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:remark:
-typ:poss/poss/vars/arg/:
-val:*number::
-val:*number::
+typ:pos/pos/vars/arg/:
val:*number::
val:*number::
ivr:setupframed::
@@ -3873,7 +3882,6 @@ com:setupfield:
typ:val/vals/vars/vars/vars/:
val:*name::
val:label,horizontal,vertical,frame::
-ivr:framed::
ivr:setupfields::
stopsetup
@@ -3882,7 +3890,6 @@ com:setupfields:
typ:vals/val/vars/vars/vars/:
val:*name::
val:reset,label,horizontal,vertical,frame::
-ivr:framed::
var:n:*number::
var:distance:*dimension::
var:before:*command::
@@ -3903,6 +3910,7 @@ var:calculate:*reference::
var:fieldoffset:*dimension::
var:fieldframecolor:*name::
var:fieldbackgroundcolor:*name::
+ivr:framed::
stopsetup
startsetup
diff --git a/context/data/cont-it.tws b/context/data/cont-it.tws
index 2c850d62b..29173a4a2 100644
--- a/context/data/cont-it.tws
+++ b/context/data/cont-it.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:impostalingua:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:installalingua::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definiscigruppocolori:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*name::
val:rgb,cmyk,grigio,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:impostatype:
-typ:var/:
+typ:vars/:
var:spazio:attivo,disattivo::
var:opzione:inclinato,normale,nessuno::
var:stile:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
@@ -405,6 +405,7 @@ var:alternativa:a,b,c::
var:spessorelinea:*dimension::
var:offsetfondo:*dimension::
var:offsetcima:*dimension::
+var:colorelinea:*name::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:pedap:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:basso::
val:*text::
val:*text::
stopsetup
@@ -1725,8 +1727,9 @@ var:modo:datesto,da*section::
var:testo:*text::
var:separatorenumero:*text::
var:separatoretesto:*text::
-var:*section*number:si,no::
+var:*sectionnumber:si,no::
var:separatore:*text::
+var:strut:si,no::
var:stato:inizia,termina::
var:comando:*\command#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definisciiniziatermina:
typ:val/vars/:
+val:*name::
var:prima:*command::
var:dopo:*command::
var:stile:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
@@ -1780,6 +1784,7 @@ var:tra:*command::
var:allinea:sinistra,centro,destra,no::
var:conversione:numeri,lettere,Lettere,numeriromani,Numeriromani::
var:modo:datesto,da*section::
+var:separatore:*text::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:impostariferimento:
-typ:var/:
+typ:vars/:
var:stato:inizia,termina::
-var:*section*number:si,no::
+var:*sectionnumber:si,no::
var:prefisso:+,-,*text::
var:interazione:etichetta,testo,tutti,simbolo::
var:ampiezza:*dimension::
@@ -1980,7 +1985,7 @@ val:*name::
var:stato:inizia,termina::
var:alternativa:a,b,c,...,nessuno,comando::
var:accoppiamento:attivo,disattivo::
-var:criterio:*section,locale,precedente,tutti::
+var:criterio:*section,locale,precedente,corrente,tutti::
var:limitipagina:*list::
var:stile:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
var:stilenumero:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
@@ -1998,9 +2003,9 @@ var:tra:*command::
var:sinistra:*text::
var:destra:*text::
var:etichetta:si,no::
-var:prefisso:si,no::
+var:prefisso:si,no,nessuno::
var:numeropagina:si,no::
-var:*section*number:si,no::
+var:*sectionnumber:si,no::
var:allineatitolo:si,no::
var:margine:*dimension::
var:ampiezza:*dimension,adatta::
@@ -2008,6 +2013,7 @@ var:altezza:*dimension,adatta,ampio::
var:profondita:*dimension,adatta,ampio::
var:distanza:*dimension::
var:separatore:*text::
+var:stopper:*text::
var:simbolo:nessuno,1,2,3,...::
var:espansione:si,no,comando::
var:ampiezzamax:*dimension::
@@ -2067,6 +2073,7 @@ var:rientrasuccessivo:si,no::
var:alternativa:*name::
var:spazioprima:*dimension::
var:dopo:*dimension::
+var:separatore:*text::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:alternativa:normale,inmargine,centro,testo::
var:comando:*\command#1#2::
var:comandonumero:*\command#1::
var:comandotesto:*\command#1::
+var:separatore:*text::
var:prefisso:+,-,*text::
var:mettitesta:si,no::
var:incrementanumero:si,no,*file::
@@ -2437,7 +2445,7 @@ var:stilepagina:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo.
var:stiletesto:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
var:indicatore:si,no::
var:accoppiamento:si,no::
-var:*section*number:si,no::
+var:*sectionnumber:si,no::
var:criterio:*section,locale,tutti::
var:distanza:*dimension::
var:simbolo:1,2,...,n,a,...,nessuno::
@@ -2625,6 +2633,7 @@ var:statopdp:normale,termina,inizia,vuoto,nessuno,nomarcature::
var:statotesto:normale,termina,inizia,vuoto,nessuno,nomarcature::
var:statocima:termina,inizia::
var:statofondo:termina,inizia::
+var:statopagina:termina,inizia::
var:colore:*name::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:datadioggi:
typ:vals/:
-val:giorno,mese,giornosettimana,anno, dd,mm,jj,yy,d,m,j,y,referral:giorno,mese,anno:
+ivl:data::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*number::
var:m:*number::
var:y:*number::
-ivl:datadioggi::
+val:giorno,mese,giornosettimana,anno, dd,mm,jj,yy,d,m,j,y,referral:giorno,mese,anno:
stopsetup
startsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:prima:*command::
var:dopo:*command::
var:stile:normale,grassetto,inclinato,grassettoinclinato,type,cap,piccolo...,*command::
+var:colore:*name::
+var:luogo:testo,margine::
stopsetup
startsetup
@@ -3178,7 +3189,7 @@ val:*text::
stopsetup
startsetup
-com:iniziatabulate:
+com:iniziatabulato:
typ:val/vars/stp/:
val:*text::
ivr:usafiguraesterna::
@@ -3336,7 +3347,7 @@ val:*text::
stopsetup
startsetup
-com:rotazione:
+com:ruota:
typ:vars/arg/:
ivr:impostarotazione::
stopsetup
@@ -3354,7 +3365,7 @@ typ:arg/:
stopsetup
startsetup
-com:scale:
+com:scala:
typ:vars/arg/:
var:sx:*number::
var:sy:*number::
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:commento:
-typ:poss/poss/vars/arg/:
-val:*number::
-val:*number::
+typ:pos/pos/vars/arg/:
val:*number::
val:*number::
ivr:impostaincorniciato::
@@ -3873,7 +3882,6 @@ com:impostacampo:
typ:val/vals/vars/vars/vars/:
val:*name::
val:etichetta,orizzontale,verticale,cornice::
-ivr:incorniciato::
ivr:impostacampi::
stopsetup
@@ -3882,7 +3890,6 @@ com:impostacampi:
typ:vals/val/vars/vars/vars/:
val:*name::
val:reimposta,etichetta,orizzontale,verticale,cornice::
-ivr:incorniciato::
var:n:*number::
var:distanza:*dimension::
var:prima:*command::
@@ -3903,6 +3910,7 @@ var:calcola:*reference::
var:offsetcampo:*dimension::
var:colorecornicecampo:*name::
var:coloresfondocampo:*name::
+ivr:incorniciato::
stopsetup
startsetup
@@ -4056,7 +4064,7 @@ ivr:impostaposizionamento::
stopsetup
startsetup
-com:posizionetesto:
+com:posizionatesto:
typ:val/arg/:
val:*name::
val:*text::
diff --git a/context/data/cont-nl.tws b/context/data/cont-nl.tws
index 1afde8131..b457504fd 100644
--- a/context/data/cont-nl.tws
+++ b/context/data/cont-nl.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:steltaalin:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:installeertaal::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definieerkleurgroep:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*naam::
val:rgb,cmyk,grijs,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:steltypein:
-typ:var/:
+typ:vars/:
var:spatie:aan,uit::
var:optie:schuin,normaal,geen::
var:letter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
@@ -405,6 +405,7 @@ var:variant:a,b,c::
var:lijndikte:*maat::
var:onderoffset:*maat::
var:bovenoffset:*maat::
+var:lijnkleur:*naam::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:laho:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:laag::
val:*tekst::
val:*tekst::
stopsetup
@@ -1725,8 +1727,9 @@ var:wijze:pertekst,per*sectie::
var:tekst:*tekst::
var:nummerscheider:*tekst::
var:tekstscheider:*tekst::
-var:*sectie*getal:ja,nee::
+var:*sectienummer:ja,nee::
var:scheider:*tekst::
+var:strut:ja,nee::
var:status:start,stop::
var:commando:*\commando#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definieerstartstop:
typ:val/vars/:
+val:*naam::
var:voor:*commando::
var:na:*commando::
var:letter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
@@ -1780,6 +1784,7 @@ var:tussen:*commando::
var:uitlijnen:links,midden,rechts,nee::
var:conversie:cijfers,letters,Letters,romeins,Romeins::
var:wijze:pertekst,per*sectie::
+var:scheider:*tekst::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:stelrefererenin:
-typ:var/:
+typ:vars/:
var:status:start,stop::
-var:*sectie*getal:ja,nee::
+var:*sectienummer:ja,nee::
var:prefix:+,-,*tekst::
var:interactie:label,tekst,alles,symbool::
var:breedte:*maat::
@@ -1980,7 +1985,7 @@ val:*naam::
var:status:start,stop::
var:variant:a,b,c,...,geen,commando::
var:koppeling:aan,uit::
-var:criterium:*sectie,lokaal,vorige,alles::
+var:criterium:*sectie,lokaal,vorige,huidige,alles::
var:paginaovergangen:*lijst::
var:letter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
var:nummerletter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
@@ -1998,9 +2003,9 @@ var:tussen:*commando::
var:links:*tekst::
var:rechts:*tekst::
var:label:ja,nee::
-var:prefix:ja,nee::
+var:prefix:ja,nee,geen::
var:paginanummer:ja,nee::
-var:*sectie*getal:ja,nee::
+var:*sectienummer:ja,nee::
var:titeluitlijnen:ja,nee::
var:marge:*maat::
var:breedte:*maat,passend::
@@ -2008,6 +2013,7 @@ var:hoogte:*maat,passend,ruim::
var:diepte:*maat,passend,ruim::
var:afstand:*maat::
var:scheider:*tekst::
+var:afsluiter:*tekst::
var:symbool:geen,1,2,3,...::
var:expansie:ja,nee,commando::
var:maxbreedte:*maat::
@@ -2067,6 +2073,7 @@ var:springvolgendein:ja,nee::
var:variant:*naam::
var:voorwit:*maat::
var:na:*maat::
+var:scheider:*tekst::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:variant:normaal,inmarge,midden,tekst::
var:commando:*\commando#1#2::
var:nummercommando:*\commando#1::
var:tekstcommando:*\commando#1::
+var:scheider:*tekst::
var:prefix:+,-,*tekst::
var:plaatskop:ja,nee::
var:verhoognummer:ja,nee,*file::
@@ -2437,7 +2445,7 @@ var:paginaletter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
var:tekstletter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
var:aanduiding:ja,nee::
var:koppeling:ja,nee::
-var:*sectie*getal:ja,nee::
+var:*sectienummer:ja,nee::
var:criterium:*sectie,lokaal,alles::
var:afstand:*maat::
var:symbool:1,2,...,n,a,...,geen::
@@ -2625,6 +2633,7 @@ var:voetstatus:normaal,stop,start,leeg,geen,geenmarkering::
var:tekststatus:normaal,stop,start,leeg,geen,geenmarkering::
var:bovenstatus:stop,start::
var:onderstatus:stop,start::
+var:paginastatus:stop,start::
var:kleur:*naam::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:huidigedatum:
typ:vals/:
-val:dag,maand,weekdag,jaar, dd,mm,jj,yy,d,m,j,y,kenmerk:dag,maand,jaar:
+ivl:datum::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*getal::
var:m:*getal::
var:y:*getal::
-ivl:huidigedatum::
+val:dag,maand,weekdag,jaar, dd,mm,jj,yy,d,m,j,y,kenmerk:dag,maand,jaar:
stopsetup
startsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:voor:*commando::
var:na:*commando::
var:letter:normaal,vet,schuin,vetschuin,type,kap,klein...,*commando::
+var:kleur:*naam::
+var:plaats:tekst,marge::
stopsetup
startsetup
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:toelichting:
-typ:poss/poss/vars/arg/:
-val:*getal::
-val:*getal::
+typ:pos/pos/vars/arg/:
val:*getal::
val:*getal::
ivr:stelomlijndin::
@@ -3873,7 +3882,6 @@ com:stelveldin:
typ:val/vals/vars/vars/vars/:
val:*naam::
val:label,horizontaal,vertikaal,kader::
-ivr:omlijnd::
ivr:stelveldenin::
stopsetup
@@ -3882,7 +3890,6 @@ com:stelveldenin:
typ:vals/val/vars/vars/vars/:
val:*naam::
val:reset,label,horizontaal,vertikaal,kader::
-ivr:omlijnd::
var:n:*getal::
var:afstand:*maat::
var:voor:*commando::
@@ -3903,6 +3910,7 @@ var:bereken:*verwijzing::
var:veldoffset:*maat::
var:veldkaderkleur:*naam::
var:veldachtergrondkleur:*naam::
+ivr:omlijnd::
stopsetup
startsetup
diff --git a/context/data/cont-ro.tws b/context/data/cont-ro.tws
index cbd4162a7..3d73f5ca5 100644
--- a/context/data/cont-ro.tws
+++ b/context/data/cont-ro.tws
@@ -20,6 +20,7 @@ stopsetup
startsetup
com:setarelimba:
typ:val/vars/:
+val:nl,fr,en,uk,de,es,cz,..:nl:
ivr:instalarelimba::
stopsetup
@@ -214,10 +215,9 @@ stopsetup
startsetup
com:definestegrupculori:
-typ:val/val/vals/:
+typ:val/val/trips/:
val:*nume::
val:rgb,cmyk,gri,s:rgb:
-val:trips/::
stopsetup
startsetup
@@ -260,7 +260,7 @@ stopsetup
startsetup
com:seteazatype:
-typ:var/:
+typ:vars/:
var:spatiu:on,dezactivat::
var:optiune:inclinat,normal,niciunul::
var:stil:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
@@ -405,6 +405,7 @@ var:alternativ:a,b,c::
var:grosimerigla:*dimensiune::
var:offsetjos:*dimensiune::
var:offsetsus:*dimensiune::
+var:culoarerigla:*nume::
stopsetup
startsetup
@@ -993,7 +994,8 @@ stopsetup
startsetup
com:jossus:
-typ:arg/arg/:
+typ:val/arg/arg/:
+val:jos::
val:*text::
val:*text::
stopsetup
@@ -1725,8 +1727,9 @@ var:mod:detext,de*sectiune::
var:text:*text::
var:separatornumar:*text::
var:separatortext:*text::
-var:*sectiune*numar:da,nu::
+var:*sectiunenumar singular: nume singular:da,nu::
var:separator:*text::
+var:strut:da,nu::
var:stare:start,stop::
var:comanda:*\comanda#1::
stopsetup
@@ -1753,6 +1756,7 @@ stopsetup
startsetup
com:definestestartstop:
typ:val/vars/:
+val:*nume::
var:inainte:*comanda::
var:dupa:*comanda::
var:stil:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
@@ -1780,6 +1784,7 @@ var:intre:*comanda::
var:aliniere:stanga,centru,dreapta,nu::
var:conversie:numere,caractere,Caractere,numereromane,Numereromane::
var:mod:detext,de*sectiune::
+var:separator:*text::
stopsetup
startsetup
@@ -1881,9 +1886,9 @@ stopsetup
startsetup
com:seteazareferinte:
-typ:var/:
+typ:vars/:
var:stare:start,stop::
-var:*sectiune*numar:da,nu::
+var:*sectiunenumar singular: nume singular:da,nu::
var:prefix:+,-,*text::
var:interactiune:eticheta,text,tot,simbol::
var:latime:*dimensiune::
@@ -1980,7 +1985,7 @@ val:*nume::
var:stare:start,stop::
var:alternativ:a,b,c,...,niciunul,comanda::
var:cuplare:on,dezactivat::
-var:criteriu:*sectiune,local,precedent,tot::
+var:criteriu:*sectiune,local,precedent,curent,tot::
var:marginipagina:*lista::
var:stil:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
var:stilnumar:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
@@ -1998,9 +2003,9 @@ var:intre:*comanda::
var:stanga:*text::
var:dreapta:*text::
var:eticheta:da,nu::
-var:prefix:da,nu::
+var:prefix:da,nu,niciunul::
var:numarpagina:da,nu::
-var:*sectiune*numar:da,nu::
+var:*sectiunenumar singular: nume singular:da,nu::
var:alinieretitlu:da,nu::
var:margine:*dimensiune::
var:latime:*dimensiune,ajustat::
@@ -2008,6 +2013,7 @@ var:inaltime:*dimensiune,ajustat,broad::
var:inaltime:*dimensiune,ajustat,broad::
var:distanta:*dimensiune::
var:separator:*text::
+var:stopper:*text::
var:simbol:niciunul,1,2,3,...::
var:expansiune:da,nu,comanda::
var:latimemaxima:*dimensiune::
@@ -2067,6 +2073,7 @@ var:aliniaturmator:da,nu::
var:alternativ:*nume::
var:spatiuinainte:*dimensiune::
var:dupa:*dimensiune::
+var:separator:*text::
stopsetup
startsetup
@@ -2291,6 +2298,7 @@ var:alternativ:normal,inmargine,centru,text::
var:comanda:*\comanda#1#2::
var:comandanumar:*\comanda#1::
var:comandatext:*\comanda#1::
+var:separator:*text::
var:prefix:+,-,*text::
var:punetitlu:da,nu::
var:numarincrement:da,nu,*fisier::
@@ -2420,14 +2428,14 @@ stopsetup
startsetup
com:definesteregistru:
typ:val/val/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*nume pluram::
stopsetup
startsetup
com:seteazaregistru:
typ:val/val/vars/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*nume::
var:n:*numar::
var:balanta:da,nu::
@@ -2437,7 +2445,7 @@ var:stilpagina:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
var:stiltext:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
var:indicator:da,nu::
var:cuplare:da,nu::
-var:*sectiune*numar:da,nu::
+var:*sectiunenumar singular: nume singular:da,nu::
var:criteriu:*sectiune,local,tot::
var:distanta:*dimensiune::
var:simbol:1,2,...,n,a,...,niciunul::
@@ -2467,7 +2475,7 @@ stopsetup
startsetup
com:scrieinregistru:
typ:val/val/idxs/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*text::
val:*text::
stopsetup
@@ -2508,7 +2516,7 @@ stopsetup
startsetup
com:definestesinonim:
typ:val/val/val/val/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*nume pluram::
val:*comanda::
val:*comanda::
@@ -2555,7 +2563,7 @@ stopsetup
startsetup
com:definestesortare:
typ:val/val/val/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*nume pluram::
val:*comanda::
stopsetup
@@ -2625,6 +2633,7 @@ var:staresubsol:normal,stop,start,gol,niciunul,faramarcare::
var:staretext:normal,stop,start,gol,niciunul,faramarcare::
var:staresus:stop,start::
var:starejos:stop,start::
+var:pagestate:stop,start::
var:culoare:*nume::
stopsetup
@@ -2642,7 +2651,7 @@ stopsetup
startsetup
com:datacurenta:
typ:vals/:
-val:zi,luna,zisaptamana,an, dd,mm,jj,yy,d,m,j,y,referinta:zi,luna,an:
+ivl:data::
stopsetup
startsetup
@@ -2651,7 +2660,7 @@ typ:vars/vals/:
var:d:*numar::
var:m:*numar::
var:y:*numar::
-ivl:datacurenta::
+val:zi,luna,zisaptamana,an, dd,mm,jj,yy,d,m,j,y,referinta:zi,luna,an:
stopsetup
startsetup
@@ -2928,7 +2937,7 @@ stopsetup
startsetup
com:definestefloat:
typ:val/val/:
-val:*nume singular::
+val:*\@@mssetupsingular ::
val:*nume pluram::
stopsetup
@@ -3054,6 +3063,8 @@ typ:vars/:
var:inainte:*comanda::
var:dupa:*comanda::
var:stil:normal,aldin,inclinat,aldininclinat,type,cap,mic...,*comanda::
+var:culoare:*nume::
+var:locatie:text,margine::
stopsetup
startsetup
@@ -3729,9 +3740,7 @@ stopsetup
startsetup
com:remarca:
-typ:poss/poss/vars/arg/:
-val:*numar::
-val:*numar::
+typ:pos/pos/vars/arg/:
val:*numar::
val:*numar::
ivr:seteazainconjurat::
@@ -3873,7 +3882,6 @@ com:seteazacamp:
typ:val/vals/vars/vars/vars/:
val:*nume::
val:eticheta,orizontal,vertical,incadrat::
-ivr:framed::
ivr:seteazacampuri::
stopsetup
@@ -3882,7 +3890,6 @@ com:seteazacampuri:
typ:vals/val/vars/vars/vars/:
val:*nume::
val:reset,eticheta,orizontal,vertical,incadrat::
-ivr:framed::
var:n:*numar::
var:distanta:*dimensiune::
var:inainte:*comanda::
@@ -3903,6 +3910,7 @@ var:calculeaza:*referinta::
var:offsetcamp:*dimensiune::
var:culoareframecamp:*nume::
var:culoarefundalcamp:*nume::
+ivr:framed::
stopsetup
startsetup
diff --git a/context/data/type-buy.dat b/context/data/type-buy.dat
index a63991016..2835f0338 100644
--- a/context/data/type-buy.dat
+++ b/context/data/type-buy.dat
@@ -30,17 +30,22 @@
--en=? --ve=lucas --co=sun --re
--en=? --ve=lucas --co=sun --so=lucas/sun --ma --in
-# creative aliance arcadia
+# lucas antiqua
+
+--en=? --ve=lucas --co=antiqua --re
+--en=? --ve=lucas --co=antiqua --so=lucas/antiqua --ma --in
+
+# creative arcadia
--en=? --ve=creative --co=arcadia --re
--en=? --ve=creative --co=arcadia --so=creative/arcadia --ma --in
-# creative aliance industria
+# creative industria
--en=? --ve=creative --co=industria --re
--en=? --ve=creative --co=industria --so=creative/industria --ma --in
-# creative aliance insigna
+# creative insignia
--en=? --ve=creative --co=insignia --re
--en=? --ve=creative --co=insignia --so=creative/insignia --ma --in
diff --git a/context/data/type-tmf.dat b/context/data/type-tmf.dat
index f4ecaf613..2c32895e3 100644
--- a/context/data/type-tmf.dat
+++ b/context/data/type-tmf.dat
@@ -43,10 +43,10 @@
# bit charter
---en=? --ve=bit --co=charter --so=auto
---en=? --ve=bit --co=charter --so=auto --ca=* bchr8a
---en=? --ve=bit --co=charter --so=auto --sl=* bchr8a
---en=? --ve=bit --co=charter --so=auto --sl=* bchb8a
+--en=? --ve=bitstrea --co=charter --so=auto
+--en=? --ve=bitstrea --co=charter --so=auto --ca=* bchr8a
+--en=? --ve=bitstrea --co=charter --so=auto --sl=* bchr8a
+--en=? --ve=bitstrea --co=charter --so=auto --sl=* bchb8a
# uwr bookman
diff --git a/context/perltk/fdf2tan.pl b/context/perltk/fdf2tan.pl
index 0e505d054..c612f9886 100644
--- a/context/perltk/fdf2tan.pl
+++ b/context/perltk/fdf2tan.pl
@@ -1,3 +1,6 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ if 0;
+
#D \module
#D [ file=fdf2tan.pl,
#D version=2000.02.06,
diff --git a/context/perltk/fdf2tex.pl b/context/perltk/fdf2tex.pl
new file mode 100644
index 000000000..f9684cd9f
--- /dev/null
+++ b/context/perltk/fdf2tex.pl
@@ -0,0 +1,213 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# not yet public
+
+# We're dealing with:
+
+$InpFile = $ARGV[0] ; $OutFile = $ARGV[1] ; $Field = $ARGV[2] ;
+
+# beware: fields are funny sorted
+
+$Program = "fdf2tex 1.02 - ConTeXt / PRAGMA 1997-2000" ;
+
+if ($Field eq "")
+ { print "\n$Program\n\n" }
+
+# filter \type{filename.fdf} into \type{filename.fdt}
+
+unless ($OutFile)
+ { $OutFile = $InpFile ;
+ $OutFile =~ s/\..*// }
+
+unless ($InpFile=~/\./)
+ { if (-e "$InpFile.fdf")
+ { $InpFile .= ".fdf" }
+ elsif (-e "$InpFile.xml")
+ { $InpFile .= ".xml" } }
+
+unless ($OutFile=~/\./)
+ { $OutFile .= ".fdt" }
+
+if (open (FDF, "<$InpFile"))
+ { binmode FDF ;
+ open (FDT, ">$OutFile") ;
+ if ($Field eq "")
+ { print " input file : $InpFile\n" ;
+ print " output file : $OutFile\n" } }
+else
+ { if ($Field eq "")
+ { print " error : $InpFile not found\n" }
+ exit }
+
+# load the whole file in the buffer
+
+$_ = "" ; while ($Line=<FDF>) { chomp $Line; $_ .= $Line }
+
+# or faster: dan ///s gebruiken (ipv m)
+
+# $/ = "\0777" ; $_ = <FDF> ;
+
+# zoom in on the objects and remove the header and trialer
+
+if ($InpFile =~ /\.xml$/)
+
+{ # begin kind of xml alternative
+
+s/\>\s*\</\>\</goms ;
+$N = s/\<field\s+(.*?)\/\>/\\FDFfield\[$1\]\n/goms ;
+s/(name|value)\=\"(.*?)\"/$1=\{$2\}/goms ;
+s/\} (name|value)/\}\,$1/goms ;
+s/\<fdfobject\>(.*?)\<\/fdfobject\>/\\beginFDFobject\n$1\\endFDFobject\n/goms ;
+s/\<fdfdata\>(.*?)\<\/fdfdata\>/\\beginFDFdata\n$1\\endFDFdata\n/goms ;
+s/\<fdffields\>(.*?)\<\/fdffields\>/\\beginFDFfields\n$1\\endFDFfields\n/goms ;
+
+} # end kind of xml alternative
+
+else
+
+{ # begin fdf alternative
+
+s/.*?obj\s*?<<(.*?)>>\s*?endobj/\n\\beginFDFobject$1\n\\endFDFobject/go;
+s/trailer.*//;
+
+# zoom in on the FDF data
+
+s/\/FDF.*?<<(.*)>>/\n\\beginFDFdata$1\n\\endFDFdata/go;
+
+# zoom in on the Field collection and remove whatever else
+
+s/\/Fields.*?\[.*?<<.*?(.*).*?>>.*?\]/\n\\beginFDFfields<<$1>>\n\\endFDFfields/go;
+s/\\endFDFfields.*\n\\endFDFdata/\\endFDFfields\n\\endFDFdata/go;
+
+# tag each field
+
+$N = s/\<<(.*?)>>/\n\\FDFfield[$1]/go;
+
+# remove non relevant entries, but keep \type{/T} and \type{/V}
+
+s/\s*?\/[Kids|Opt]\s*?<<.*?>>//go;
+s/\s*?\/[Ff|setFf|ClrFf|F|SetF|ClrF]\s*?\d*?//go;
+s/\s*?\/[AP|A|AS]\s*?\[.*?\]//go;
+s/\s*?\/AS\s*?\/.*?\s//go;
+
+# format the field identifier
+
+s/(.*?)\/T.*?\((.*?)\)/$1 name=$2,/go;
+
+# format the value, which can be a name or string
+
+s/\/V\s?\((.*?)\)/value=\{$1\},/go;
+s/\/V\s?\/(.*?)[\s|\/]/value=\{$1\},/go;
+
+# sanitize some special \TeX\ tokens
+
+s/(\#|\$|\&|\^|\_|\|)/\\$1/go;
+
+# remove spaces and commas
+
+#s/\s?([name|value])/$1/go;
+s/\[\s*/\[/go;
+s/,\]/\]/go;
+
+# convert PDFDocEncoding
+
+s/\\225/\\\/L/ ;
+s/\\226/\\OE/ ;
+s/\\227/\\vS/ ;
+s/\\230/\\"Y/ ;
+s/\\231/\\vZ/ ;
+s/\\233/\\\/l/ ;
+s/\\234/\\oe/ ;
+s/\\235/\\vs/ ;
+s/\\236/\\vz/ ;
+s/\\253/\\<</ ;
+s/\\273/\\>>/ ;
+s/\\300/\\`A/ ;
+s/\\301/\\'A/ ;
+s/\\302/\\^A/ ;
+s/\\303/\\~A/ ;
+s/\\304/\\"A/ ;
+s/\\305/\\oA/ ;
+s/\\306/\\AE/ ;
+s/\\307/\\,C/ ;
+s/\\310/\\`E/ ;
+s/\\311/\\'E/ ;
+s/\\312/\\^E/ ;
+s/\\313/\\"E/ ;
+s/\\314/\\`I/ ;
+s/\\315/\\'I/ ;
+s/\\316/\\^I/ ;
+s/\\317/\\"I/ ;
+s/\\321/\\~N/ ;
+s/\\322/\\`O/ ;
+s/\\323/\\'O/ ;
+s/\\324/\\^O/ ;
+s/\\325/\\~O/ ;
+s/\\326/\\"O/ ;
+s/\\330/\\\/O/ ;
+s/\\331/\\`U/ ;
+s/\\332/\\'U/ ;
+s/\\333/\\^U/ ;
+s/\\334/\\"U/ ;
+s/\\335/\\'Y/ ;
+s/\\337/\\ss/ ;
+s/\\340/\\`a/ ;
+s/\\341/\\'a/ ;
+s/\\342/\\^a/ ;
+s/\\343/\\~a/ ;
+s/\\344/\\"a/ ;
+s/\\345/\\oa/ ;
+s/\\346/\\ae/ ;
+s/\\347/\\,c/ ;
+s/\\350/\\`e/ ;
+s/\\351/\\'e/ ;
+s/\\352/\\^e/ ;
+s/\\353/\\"e/ ;
+s/\\354/\\`i/ ;
+s/\\355/\\'i/ ;
+s/\\356/\\^i/ ;
+s/\\357/\\"i/ ;
+s/\\361/\\~n/ ;
+s/\\362/\\`o/ ;
+s/\\363/\\'o/ ;
+s/\\364/\\^o/ ;
+s/\\365/\\~o/ ;
+s/\\366/\\"o/ ;
+s/\\370/\\\/o/ ;
+s/\\371/\\`u/ ;
+s/\\372/\\'u/ ;
+s/\\373/\\^u/ ;
+s/\\374/\\"u/ ;
+s/\\375/\\'y/ ;
+s/\\377/\\"y/ ;
+
+s/\\\</\</ ;
+s/\\\>/\>/ ;
+s/\\\(/\(/ ;
+s/\\\)/\)/ ;
+s/\#/\\#/ ;
+
+# convert newline and return commands
+
+s/\\n/ /go;
+s/\\r/\\par /go;
+
+} # end fdf alternative
+
+# flush buffer
+
+print FDT $_ ;
+
+close FDT ;
+close FDF ;
+
+# report some characteristics
+
+if ($Field eq "")
+ { print " number of fields : $N\n" }
+else
+ { if (/\\FDFfield\[value\=\{(.*)\}\,\s*name=$Field/mos)
+ { print "$1" }
+ elsif (/\\FDFfield\[name=$Field\,\s*value\=\{(.*)\}/mos)
+ { print "$1" } }
diff --git a/context/perltk/mptopdf.pl b/context/perltk/mptopdf.pl
index 1ff0c56c0..e55fb74b2 100644
--- a/context/perltk/mptopdf.pl
+++ b/context/perltk/mptopdf.pl
@@ -20,15 +20,32 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
# use File::Copy ; # not in every perl
use Config ;
+use Getopt::Long ;
+use strict ;
-$program = "MPtoPDF 1.1" ;
-$pattern = $ARGV[0] ;
-$done = 0 ;
-$report = '' ;
+$Getopt::Long::passthrough = 1 ; # no error message
+$Getopt::Long::autoabbrev = 1 ; # partial switch accepted
+
+my $Help = my $Latex = 0 ;
+
+&GetOptions
+ ( "help" => \$Help ,
+ "latex" => \$Latex ) ;
+
+my $program = "MPtoPDF 1.2" ;
+my $pattern = $ARGV[0] ;
+my $done = 0 ;
+my $report = '' ;
+my $latexswitch = " --tex=latex --format=latex " ;
+
+## $dosish = ($Config{'osname'} =~ /dos|mswin/i) ;
+my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^(ms|cyg)win/i) ;
-my $dosish = ($Config{'osname'} =~ /dos|mswin/io) ;
my $miktex = ($ENV{"TEXSYSTEM"} =~ /miktex/io);
+my @files ;
+my $command = "" ;
+
sub CopyFile # agressive copy, works for open files like in gs
{ my ($From,$To) = @_ ;
return unless open(INP,"<$From") ; binmode INP ;
@@ -37,13 +54,21 @@ sub CopyFile # agressive copy, works for open files like in gs
close (INP) ;
close (OUT) }
-if (($pattern eq '')||($pattern =~ /^\-+(h|help)$/io))
- { print "\n$program: provide MP output file (or pattern)\n" ;
+if (($pattern eq '')||($Help))
+ { print "\n$program : provide MP output file (or pattern)\n" ;
exit }
elsif ($pattern =~ /\.mp$/io)
- { $error = system ("texexec --mptex $pattern") ;
+ { shift @ARGV ; my $rest = join(" ", @ARGV) ;
+ if (open(INP,$pattern))
+ { while (<INP>)
+ { if (/(documentstyle|documentclass|begin\{document\})/io)
+ { $Latex = 1 ; last } }
+ close (INP) }
+ if ($Latex)
+ { $rest .= " $latexswitch" }
+ my $error = system ("texexec --mptex $rest $pattern") ;
if ($error)
- { print "\n$program: error while processing mp file\n" ; exit }
+ { print "\n$program : error while processing mp file\n" ; exit }
else
{ $pattern =~ s/\.mp$//io ;
@files = glob "$pattern.*" } }
@@ -55,7 +80,7 @@ else
{ $pattern .= '.*' ;
@files = glob "$pattern" }
-foreach $file (@files)
+foreach my $file (@files)
{ $_ = $file ;
if (s/\.(\d+|mps)$// && -e $file)
{ if ($miktex)
@@ -64,7 +89,8 @@ foreach $file (@files)
else
{ $command = "pdfetex \\&mptopdf" } }
else
- { $command = "pdfetex -progname=pdfetex -efmt=mptopdf" }
+# { $command = "pdfetex -progname=pdfetex -efmt=mptopdf" }
+ { $command = "pdfetex -progname=context -efmt=mptopdf" }
if ($dosish)
{ system ("$command \\relax $file") }
else
@@ -76,6 +102,6 @@ foreach $file (@files)
++$done } }
if ($done)
- { print "\n$program: $pattern is converted to$report\n" }
+ { print "\n$program : $pattern is converted to$report\n" }
else
- { print "\n$program: no filename matches $pattern\n" }
+ { print "\n$program : no filename matches $pattern\n" }
diff --git a/context/perltk/path_tre.pm b/context/perltk/path_tre.pm
new file mode 100644
index 000000000..546afcd27
--- /dev/null
+++ b/context/perltk/path_tre.pm
@@ -0,0 +1,36 @@
+#D \module
+#D [ file=path\_tre.pm,
+#D version=1999.05.05,
+#D title=Path modules,
+#D subtitle=selecting a path,
+#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 licen-en.pdf for
+#C details.
+
+#D Not yet documented, source will be cleaned up.
+
+package Tk::path_tre ;
+
+use Tk;
+require Tk::DirTree ;
+
+use base qw(Tk::DirTree);
+use strict;
+
+Construct Tk::Widget 'PathTree';
+
+sub ClassInit
+ { my ($class,$mw) = @_ ;
+ return $class -> SUPER::ClassInit ($mw) }
+
+sub dirnames
+ { my ( $w, $dir ) = @_ ;
+ unless ($dir=~/\//) { $dir .= '/' }
+ my @names = $w->Callback("-dircmd", $dir, $w->cget("-showhidden"));
+ return( @names ) }
+
+__END__
diff --git a/context/perltk/runperl.zip b/context/perltk/runperl.zip
index 4855544f0..2db7d8033 100644
--- a/context/perltk/runperl.zip
+++ b/context/perltk/runperl.zip
Binary files differ
diff --git a/context/perltk/texexec.pl b/context/perltk/texexec.pl
index 94205ca64..ca9eb8abc 100644
--- a/context/perltk/texexec.pl
+++ b/context/perltk/texexec.pl
@@ -2,8 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
if 0;
# todo: second run of checksum of mp file with --nomprun changes
-
-# todo: merge wybo's enhanced help function
+# todo: merge wybo's enhanced help function [along with updating manual]
#D \module
#D [ file=texexec.pl,
@@ -49,7 +48,10 @@ my %Help ;
$ENV{"MPXCOMMAND"} = "0" ; # otherwise loop
-my $dosish = ($Config{'osname'} =~ /dos|mswin/i) ;
+my $TotalTime = time ;
+
+## $dosish = ($Config{'osname'} =~ /dos|mswin/i) ;
+my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^(ms|cyg)win/i) ;
my $TeXUtil = 'texutil' ;
my $TeXExec = 'texexec' ;
@@ -128,7 +130,7 @@ my $MpyForce = 0 ;
my $RunPath = "" ;
my $Arguments = "" ;
my $Pretty = 0 ;
-my $SetFile = "" ;
+my $SetFile = "" ;
&GetOptions
( "arrange" => \$Arrange ,
@@ -198,6 +200,13 @@ my $SetFile = "" ;
"pretty" => \$Pretty ,
"setfile=s" => \$SetFile ) ;
+# a set file (like blabla.bat) can set paths now
+
+if ($SetFile ne "")
+ { load_set_file ($SetFile,$Verbose) ; $SetFile = "" }
+
+# later we will do a second attempt.
+
$SIG{INT} = "IGNORE" ;
if ($ARGV[0] =~ /\.mpx$/io) # catch -tex=.... bug in mpost
@@ -222,7 +231,7 @@ if (($LogFile ne '')&&($LogFile =~ /\w+\.log$/io))
*STDOUT = *LOGFILE ;
*STDERR = *LOGFILE }
-my $Program = " TeXExec 2.5 - ConTeXt / PRAGMA ADE 1997-2001" ;
+my $Program = " TeXExec 2.6 - ConTeXt / PRAGMA ADE 1997-2001" ;
print "\n$Program\n\n";
@@ -472,6 +481,11 @@ my $TcXPath = IniValue('TcXPath' , '' ) ;
$SetFile = IniValue('SetFile' , $SetFile ) ;
+if (($Verbose)&&($kpsewhich ne ''))
+ { print "\n" ;
+ my $CnfFile = `$kpsewhich -progname=context texmf.cnf` ;
+ chomp $CnfFile ;
+ print " applications will use : $CnfFile\n" }
if (($FmtLanguage)&&($MainLanguage eq 'standard'))
{ $MainLanguage = $FmtLanguage }
@@ -480,8 +494,6 @@ if (($FmtBodyFont)&&($MainBodyFont eq 'standard'))
if (($FmtResponse)&&($MainResponse eq 'standard'))
{ $MainResponse = $FmtResponse }
-if ($Verbose) { print "\n" }
-
if ($TeXFormatFlag eq "" )
{ $TeXFormatFlag = "&" }
@@ -497,21 +509,24 @@ if ($TeXProgram)
my $fmtutil = '' ;
-if ($Alone)
- { if ($Verbose)
- { print " generating format : not using fmtutil\n" } }
-elsif ($TeXShell =~ /tetex|fptex/i)
- { foreach (@paths)
- { my $p = checked_path($_) . 'fmtutil' ;
- if (-e $p)
- { $fmtutil = $p ; last }
- elsif (-e $p . '.exe')
- { $fmtutil = $p . '.exe' ; last } }
- if ($Verbose)
- { if ($fmtutil eq '')
- { print " locating fmtutil : not found in path\n" }
- else
- { print " locating fmtutil : found\n" } } }
+if ($MakeFormats||$Verbose)
+ { if ($Alone)
+ { if ($Verbose)
+ { print " generating format : not using fmtutil\n" } }
+ elsif ($TeXShell =~ /tetex|fptex/i)
+ { foreach (@paths)
+ { my $p = checked_path($_) . 'fmtutil' ;
+ if (-e $p)
+ { $fmtutil = $p ; last }
+ elsif (-e $p . '.exe')
+ { $fmtutil = $p . '.exe' ; last } }
+ if ($Verbose)
+ { if ($fmtutil eq '')
+ { print " locating fmtutil : not found in path\n" }
+ else
+ { print " locating fmtutil : $fmtutil\n" } } } }
+
+if ($Verbose) { print "\n" }
unless ($TeXScriptsPath)
{ $TeXScriptsPath = $own_path }
@@ -814,7 +829,7 @@ sub CheckOutputFormat
{ $FullFormat = $OutputFormat } } # 'standard' to terminal
sub MakeOptionFile
- { my ($FinalRun, $FastDisabled, $JobName) = @_ ;
+ { my ($FinalRun, $FastDisabled, $JobName, $JobSuffix) = @_ ;
open (OPT, ">$JobName.top") ;
print OPT "\\unprotect\n" ;
if ($Result) # no '' test
@@ -853,7 +868,7 @@ sub MakeOptionFile
elsif (/.5.4/goi)
{ print OPT "\\setuppapersize[A5][A4]\n" }
elsif (!/standard/)
- { $_ = uc $_ ; my ($from,$to) = split (/\*/) ;
+ { s/x/\*/io ; $_ = uc $_ ; my ($from,$to) = split (/\*/) ;
if ($to eq "") { $to = $from }
print OPT "\\setuppapersize[$from][$to]\n" } }
if (($PdfSelect||$PdfCombine||$PdfCopy||$PdfArrange)&&($Background ne ''))
@@ -881,6 +896,8 @@ sub MakeOptionFile
{ print OPT "\\setupenv[$Arguments]\n" }
if ($Input)
{ print OPT "\\setupsystem[inputfile=$Input]\n" }
+ else
+ { print OPT "\\setupsystem[inputfile=$JobName.$JobSuffix]\n" }
if ($Mode)
{ print OPT "\\enablemode[$Mode]\n" }
if ($Pages)
@@ -1184,44 +1201,44 @@ sub CheckChanges # also tub
if (open(MP, $MPJobName))
{ while (<MP>)
{ unless (/random/oi)
- { $checksum += do { unpack("%32C*",<MP>) % 65535 } } }
+ { $checksum += do { unpack("%32C*",<MP>) % 65535 } } }
close (MP) }
$MPJobName = MPJobName($JobName,"mprun") ;
if (open(MP, $MPJobName))
{ while (<MP>)
{ unless (/random/oi)
- { $checksum += do { unpack("%32C*",<MP>) % 65535 } } }
+ { $checksum += do { unpack("%32C*",<MP>) % 65535 } } }
close(MP) }
return $checksum }
+my $DummyFile = 0 ;
+
sub RunConTeXtFile
{ my ($JobName, $JobSuffix) = @_ ;
$JobName =~ s/\\/\//goi ;
$RunPath =~ s/\\/\//goi ;
- my $DummyFile = 0 ;
+ my $OriSuffix = $JobSuffix ;
if (-e "$JobName.$JobSuffix")
- { $DummyFile = ($JobSuffix =~ /xml/io) }
+ { $DummyFile = ($JobSuffix =~ /(xml|xsd)/io) }
elsif (($RunPath)&&(-e "$RunPath/$JobName.$JobSuffix"))
{ $DummyFile = 1 }
if ($DummyFile)
- { open (TMP,">$JobName.tex") ;
- if ($JobSuffix =~ /xml/io)
+ { open (TMP,">$JobName.run") ;
+ if ($JobSuffix =~ /(xml|xsd)/io)
{ if ($Filters ne "")
{ print " using xml filters : $Filters\n" }
- print TMP "\\ifx\\processXMLfile\\undefined\n" ;
- print TMP " \\let\\processXMLfile\\processfile\n" ;
- print TMP "\\fi\n" ;
print TMP "\\starttext\n" ;
- print TMP "\\processXMLfilegrouped{$JobName.xml}\n" ;
+ print TMP "\\processXMLfilegrouped{$JobName.$JobSuffix}\n" ;
print TMP "\\stoptext\n" }
else
{ print TMP "\\processfile{$JobName}\n" }
close (TMP) ;
- $JobSuffix = "tex" }
+ $JobSuffix = "run" }
if (-e "$JobName.$JobSuffix")
- { ScanPreamble ("$JobName.$JobSuffix") ;
- if ($ConTeXtInterface eq "unknown")
- { ScanContent ("$JobName.$JobSuffix") }
+ { unless ($Dummy) # we don't need this for xml
+ { ScanPreamble ("$JobName.$JobSuffix") ;
+ if ($ConTeXtInterface eq "unknown")
+ { ScanContent ("$JobName.$JobSuffix") } }
if ($ConTeXtInterface eq "unknown")
{ $ConTeXtInterface = $UserInterface }
if ($ConTeXtInterface eq "unknown")
@@ -1286,7 +1303,7 @@ sub RunConTeXtFile
$Problems = 0 ;
my $TeXRuns = 0 ;
if (($PdfArrange)||($PdfSelect)||($RunOnce))
- { MakeOptionFile (1, 1, $JobName) ;
+ { MakeOptionFile (1, 1, $JobName, $OriSuffix) ;
print "\n" ;
$Problems = RunTeX($JobName, $JobSuffix) ;
if ($ForceTeXutil)
@@ -1296,7 +1313,7 @@ sub RunConTeXtFile
PopResult($JobName) }
else
{ while (!$StopRunning&&($TeXRuns<$NOfRuns)&&(!$Problems))
- { MakeOptionFile (0, 0, $JobName) ;
+ { MakeOptionFile (0, 0, $JobName, $OriSuffix) ;
++$TeXRuns ;
print " TeX run : $TeXRuns\n\n" ;
my $mpchecksumbefore = $mpchecksumafter = 0 ;
@@ -1315,14 +1332,14 @@ sub RunConTeXtFile
if (($NOfRuns==1)&&$ForceTeXutil)
{ $Ok = RunTeXutil ($JobName) }
if ((!$Problems)&&(($FinalMode||$FinalRunNeeded))&&($NOfRuns>1))
- { MakeOptionFile (1, $FinalMode, $JobName) ;
+ { MakeOptionFile (1, $FinalMode, $JobName, $OriSuffix) ;
print " final TeX run : $TeXRuns\n\n" ;
$Problems = RunTeX($JobName, $JobSuffix) }
CopyFile("$JobName.top","$JobName.tmp") ;
unlink "$JobName.tup" ; # previous tuo file
unlink "$JobName.top" ; # runtime option file
PopResult($JobName) }
- if ($DummyFile)
+ if ($DummyFile) # $JobSuffix == run
{ unlink "$JobName.$JobSuffix" } } }
sub RunSomeTeXFile
@@ -1354,19 +1371,27 @@ sub RunModule
next unless $Suffix =~ /(tex|mp|pl|pm)/io ;
DoRunModule($Name, $Suffix) } }
-sub DoRunModule
+# the next one can be more efficient: directly process ted
+# file a la --use=abr-01,mod-01
+
+sub DoRunModule
{ my ($FileName,$FileSuffix) = @_ ;
RunPerlScript ($TeXUtil, "--documents $FileName.$FileSuffix" ) ;
print " module : $FileName\n\n" ;
open (MOD, ">$ModuleFile.tex") ;
- # print MOD "% format=dutch\n" ;
- print MOD "\\gebruikmodule[abr-01,mod-01]\n" ;
+ # we need to signal to texexec what interface to use
+ open(TED, "$FileName.ted") ; my $firstline = <TED> ; close (TED) ;
+ if ($firstline =~ /interface=en/)
+ { print MOD $firstline }
+ else
+ { print MOD "% interface=nl\n" }
+ # so far
+ print MOD "\\usemodule[abr-01,mod-01]\n" ;
print MOD "\\def\\ModuleNumber{1}\n" ;
print MOD "\\starttekst\n" ;
- print MOD "\\input $FileName.ted\n" ;
+ print MOD "\\readlocfile{$FileName.ted}{}{}\n" ;
print MOD "\\stoptekst\n" ;
close (MOD) ;
- # $ConTeXtInterface = "nl" ;
RunConTeXtFile($ModuleFile, "tex") ;
if ($FileName ne $ModuleFile)
{ foreach my $FileSuffix ("dvi", "pdf", "tui", "tuo", "log")
@@ -1526,8 +1551,8 @@ sub RunSelect
# { print " papersize : $PaperFormat\n" ;
# print SEL "\\setuppapersize[$PaperFormat][$PaperFormat]\n" }
#
- { $_ = $PaperFormat ; # NO UPPERCASE !
- my ($from,$to) = split (/\*/) ;
+ { $_ = $PaperFormat ; # NO UPPERCASE !
+ s/x/\*/io ; my ($from,$to) = split (/\*/) ;
if ($to eq "") { $to = $from }
print " papersize : $PaperFormat\n" ;
print SEL "\\setuppapersize[$from][$to]\n" }
@@ -1599,7 +1624,7 @@ sub RunCopy
sub RunCombine
{ my $FileName = shift ;
print " pdffile : $FileName\n" ;
- my ($nx,$ny) = split (/\*/,$Combination,2) ;
+ $Combination =~ s/x/\*/io ; my ($nx,$ny) = split (/\*/,$Combination,2) ;
return unless ($nx&&$ny) ;
print " combination : $Combination\n" ;
open (COM, ">$CombineFile.tex") ;
@@ -1608,9 +1633,9 @@ sub RunCombine
# { print " papersize : $PaperFormat\n" ;
# print COM "\\setuppapersize\n" ;
# print COM " [$PaperFormat][$PaperFormat]\n" }
-# see RunSelect
- { $_ = $PaperFormat ; # NO UPPERCASE !
- my ($from,$to) = split (/\*/) ;
+# see RunSelect
+ { $_ = $PaperFormat ; # NO UPPERCASE !
+ s/x/\*/io ; my ($from,$to) = split (/\*/) ;
if ($to eq "") { $to = $from }
print " papersize : $PaperFormat\n" ;
print COM "\\setuppapersize[$from][$to]\n" }
@@ -1853,6 +1878,8 @@ $TexFound = $MergeBE || /btex .*? etex/o ;
if ($MergeBE)
{ s/beginfig\s*\((\d+)\)\s*\;/beginfig($1)\;\n$mpbetex{$1}\n/goims }
# flush
+ unless (/beginfig\s*\(\s*0\s*\)/gmois)
+ { print MP $mpbetex{0} }
print MP $_ ;
print MP "end .\n" ;
close(MP) }
@@ -1861,7 +1888,7 @@ $TexFound = $MergeBE || /btex .*? etex/o ;
$Problems = system ("$MpToTeXExecutable $MpFile > $MpTex" ) ;
if (-e $MpTex && !$Problems)
{ open (TMP,">>$MpTex") ;
- print TMP "\\end\n" ; # to be sure
+ print TMP "\\end\{document\}\n" ; # to be sure
close (TMP) ;
if (($Format eq '')||($Format =~ /^cont.*/io))
{ $OutputFormat = "dvips" ;
@@ -1871,8 +1898,8 @@ $TexFound = $MergeBE || /btex .*? etex/o ;
if (-e $MpDvi && !$Problems)
{ print " dvi to metapost : $MpName\n" ;
$Problems = system ("$DviToMpExecutable $MpDvi $MpName.mpx") }
-# $Problems = system ("dvicopy $MpDvi texexec.dvi") ;
-# $Problems = system ("$DviToMpExecutable texexec.dvi $MpName.mpx") }
+ # $Problems = system ("dvicopy $MpDvi texexec.dvi") ;
+ # $Problems = system ("$DviToMpExecutable texexec.dvi $MpName.mpx") }
unlink $MpTex ;
unlink $MpDvi } }
print " metapost : $MpName\n" ;
@@ -1923,7 +1950,7 @@ sub load_set_file
my ($file, $trace) = @_ ;
if (open(BAT,$file))
{ while (<BAT>)
- { chomp ;
+ { chomp ;
if (/\s*SET\s+(.+?)\=(.+)\s*/io)
{ my ($var,$val) = ($1, $2) ;
$val =~ s/\%(.+?)\%/$ENV{$1}/goi ;
@@ -1967,4 +1994,8 @@ else
{ print $Help{HELP} ;
unless ($Verbose) { print $Help{VERBOSE} } }
+$TotalTime = time - $TotalTime ;
+
+print "\n total run time : $TotalTime seconds\n" ;
+
if ($Problems) { exit 1 }
diff --git a/context/perltk/texexec.rme b/context/perltk/texexec.rme
index 91a0adc92..30ecfedf0 100644
--- a/context/perltk/texexec.rme
+++ b/context/perltk/texexec.rme
@@ -51,7 +51,7 @@ set TeXShell to tetex
%
% Here are some general defaults. They can be overruled later.
-set UsedInterfaces to en nl de uk
+set UsedInterfaces to en nl metafun mptopdf
set UserInterface to en
set TeXExecutable to tex
@@ -89,7 +89,7 @@ for fptex set TeXPassString to -progname=context
for fptex set TeXBatchFlag to -int=batchmode
for fptex set MpToTeXExecutable to mpto
for fptex set MpVirginFlag to -ini
-for fptex set MpPassString to -progname=mpost
+for fptex set MpPassString to -progname=mpost
for fptex set MpBatchFlag to -int=batchmode
% MikTeX users probably have to set up some paths too.
@@ -100,7 +100,7 @@ for miktex set TeXPassString to --alias=context
for miktex set TeXBatchFlag to --interaction=batchmode
for miktex set MpToTeXExecutable to mptotex
for miktex set MpVirginFlag to --initialize
-for miktex set MpPassString to --alias=mpost
+for miktex set MpPassString to --alias=mpost
for miktex set MpBatchFlag to --interaction=batchmode
for miktex set TeXFormatFlag to --undump=
diff --git a/context/perltk/texfind.pl b/context/perltk/texfind.pl
new file mode 100644
index 000000000..53a560c79
--- /dev/null
+++ b/context/perltk/texfind.pl
@@ -0,0 +1,270 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+#D \module
+#D [ file=texfind.pl,
+#D version=1998.05.10,
+#D title=\TEXFIND,
+#D subtitle=searching files,
+#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 licen-en.pdf for
+#C details.
+
+# test with "doif(un|)defined"
+
+use strict ;
+use Getopt::Long ;
+use File::Find ;
+use Cwd ;
+use Tk ;
+use Tk::widgets ;
+use Tk::ROText ;
+
+use FindBin ;
+use lib $FindBin::Bin ;
+use path_tre ;
+
+my $FileSuffix = 'tex' ;
+my $SearchString = '' ;
+my $Recurse = 0 ;
+my $NumberOfHits = 0 ;
+my $QuitSearch = 0 ;
+my $Location = '' ;
+my $currentpath = '.' ;
+
+my @FileList ;
+
+my ($dw, $mw, $log, $sea, $fil, $num, $but, $dir, $loc) ;
+
+$mw = MainWindow -> new () ;
+$dw = MainWindow -> new () ;
+
+$mw -> protocol( 'WM_DELETE_WINDOW' => sub { exit } ) ;
+$dw -> protocol( 'WM_DELETE_WINDOW' => sub { exit } ) ;
+
+$log = $mw -> Scrolled ( 'ROText' ,
+ -scrollbars => 'se' ,
+ -font => 'courier' ,
+ -wrap => 'none' ,
+ -width => 65 ,
+ -height => 22 )
+ -> pack ( -side => 'bottom' ,
+ -padx => 2 ,
+ -pady => 2 ,
+ -expand => 1 ,
+ -fill => 'both' ) ;
+
+$sea = $mw -> Entry ( -textvariable => \$SearchString ,
+ -font => 'courier' ,
+ -width => 20 )
+ -> pack ( -side => 'left' ,
+ -padx => 2 ,
+ -pady => 2 ) ;
+
+$fil = $mw -> Entry ( -textvariable => \$FileSuffix ,
+ -font => 'courier' ,
+ -width => 5 )
+ -> pack ( -side => 'left' ,
+ -padx => 2 ,
+ -pady => 2 ) ;
+
+$but = $mw -> Checkbutton ( -variable => \$Recurse ,
+ -text => 'recurse' )
+ -> pack ( -side => 'left' ) ;
+
+$num = $mw -> Entry ( -textvariable => \$NumberOfHits ,
+ -font => 'courier' ,
+ -justify => 'right' ,
+ -width => 5 )
+ -> pack ( -side => 'right' ,
+ -padx => 2 ,
+ -pady => 2 ) ;
+
+$loc = $mw -> Entry ( -textvariable => \$Location ,
+ -font => 'courier' ,
+ -width => 8 )
+ -> pack ( -side => 'right' ,
+ -padx => 2 ,
+ -pady => 2 ) ;
+
+sub BuildDir
+ { if (Exists($dir)) { $dir -> destroy } ;
+ $dir = $dw -> Scrolled ( 'PathTree' ,
+ -scrollbars => 'se' )
+ -> pack ( -expand => 1 ,
+ -fill => 'both' ,
+ -padx => 2 ,
+ -pady => 2 ) ;
+ $dir -> configure ( -font => 'courier' ,
+ -height => 24 ,
+ -width => 65 ,
+ -selectbackground => 'blue3' ,
+ -browsecmd => \&ChangePath ) ;
+ $dir -> bind ('<Return>' , \&ShowFile ) ;
+ $dir -> bind ('<Double-1>' , \&ShowFile ) }
+
+BuildDir ;
+
+sub ShowFile { $mw -> raise ; $sea -> focusForce }
+sub ShowPath { $dw -> raise ; $dir -> focusForce }
+
+$log -> tagConfigure ( 'found', -foreground => 'green3' ) ;
+$log -> tagConfigure ( 'title', -foreground => 'blue3' ) ;
+
+$sea -> bind ('<Return>' , \&LocateStrings ) ;
+$fil -> bind ('<Return>' , \&LocateStrings ) ;
+$loc -> bind ('<Return>' , \&ChangeLocation ) ;
+$log -> bind ('<Return>' , \&ShowPath ) ;
+
+$sea -> bind ('<KeyPress>' , \&QuitSearch ) ;
+$fil -> bind ('<KeyPress>' , \&QuitSearch ) ;
+$loc -> bind ('<KeyPress>' , \&QuitSearch ) ;
+
+$sea -> bind ('<Escape>' , \&QuitSearch ) ;
+$fil -> bind ('<Escape>' , \&QuitSearch ) ;
+$loc -> bind ('<Escape>' , \&QuitSearch ) ;
+$log -> bind ('<Escape>' , \&QuitSearch ) ;
+
+$sea -> bind ('<Double-1>' , \&LocateStrings ) ;
+$fil -> bind ('<Double-1>' , \&LocateStrings ) ;
+$loc -> bind ('<Double-1>' , \&ChangeLocation ) ;
+$log -> bind ('<Double-1>' , \&ShowPath ) ;
+
+sub ChangePath
+ { my $currentpath = shift ;
+chdir($currentpath) ;
+ $QuitSearch = 1 ;
+ $log -> delete ('1.0', 'end') ;
+ $log -> insert ('end', "$currentpath\n\n", 'title') }
+
+sub ChangeLocation
+ { $QuitSearch = 1 ;
+ $log -> delete ('1.0', 'end') ;
+ $Location =~ s/^\s*//o ;
+ $Location =~ s/\s*$//o ;
+ $Location =~ s/(\\|\/\/)/\//go ;
+ unless (-d $Location)
+ { unless ($Location =~ /\//) { $Location .= '/' } }
+ if (-d $Location)
+ { $log -> insert ('end', "changed to location '$Location'\n\n", 'title') ;
+ $currentpath = $Location ;
+ chdir ($currentpath) ;
+ $dir -> destroy ;
+ BuildDir ;
+ $dw -> raise ;
+ $dw -> focusForce }
+ else
+ { $log -> insert ('end', "unknown location '$Location'\n\n", 'title') ;
+ $Location = '' } }
+
+sub QuitSearch
+ { $QuitSearch = 1 }
+
+sub SearchFile
+ { my ($FileName, $SearchString) = @_ ;
+ my $Ok = 0 ; my $len ;
+ open (TEX, $FileName) ;
+ my $LineNumber = 0 ;
+ while (<TEX>)
+ { ++$LineNumber ;
+ if ($QuitSearch)
+ { if ($Ok) { $log -> see ('end') }
+ last }
+ if (/$SearchString/i)
+ { ++$NumberOfHits ; $num -> update ;
+ unless ($Ok)
+ { $Ok = 1 ;
+ $log -> insert ('end', "$FileName\n\n",'title') }
+ $log -> insert ('end', sprintf("%5i : ",$LineNumber), 'title') ;
+ s/^\s*//o ;
+#
+ $len = 0 ;
+ while (/(.*?)($SearchString)/gi)
+ { $len += length($1) + length($2) ;
+ $log -> insert ('end', "$1") ;
+ $log -> insert ('end', "$2", 'found' ) }
+ $_ = substr($_,$len) ;
+ $log -> insert ('end', "$_") ;
+#
+ $log -> update ;
+ $log -> see ('end') } }
+ if ($Ok) { $log -> insert ('end', "\n") }
+ close (TEX) }
+
+sub DoLocateFiles
+ { @FileList = () ;
+ $NumberOfHits = 0 ;
+ if ($FileSuffix ne "")
+ { $log -> delete ('1.0', 'end') ;
+ if ($Recurse)
+ { $log -> insert ('end', "recursively identifying files\n", 'title') ;
+ $log -> see ('end') ;
+ find (\&wanted, $currentpath) ;
+ sub wanted
+ { if ($QuitSearch) { last ; return }
+ if (/.*\.$FileSuffix/i)
+ { ++$NumberOfHits ; $num -> update ;
+ push @FileList, $File::Find::name } } }
+ else
+ { $log -> insert ('end', "identifying files\n", 'title') ;
+ $log -> see ('end') ;
+ opendir(DIR, $currentpath) ; my @TEMPLIST = readdir(DIR) ; closedir(DIR) ;
+ foreach my $FileName (@TEMPLIST)
+ { if ($FileName =~ /.*\.$FileSuffix/i)
+ { ++$NumberOfHits ; $num -> update ;
+ if ($QuitSearch)
+ { last }
+ push @FileList, $FileName } } }
+ @FileList = sort @FileList } }
+
+sub DoLocateStrings
+ { $log -> delete ('1.0', 'end') ;
+ $log -> update ;
+ $log -> see ('end') ;
+ $NumberOfHits = 0 ;
+ if ($SearchString ne "")
+ { foreach my $FileName (@FileList)
+ { if ($QuitSearch)
+ { $log -> insert ('end', "search aborted\n", 'title') ;
+ $log -> see ('end') ;
+ last }
+ SearchFile($FileName,$SearchString) } }
+ unless ($QuitSearch)
+ { $log -> insert ('end', "done\n", 'title') ;
+ $log -> see ('end') } }
+
+sub LocateStrings
+ { $QuitSearch = 0 ;
+ DoLocateFiles() ;
+ DoLocateStrings() }
+
+$log -> insert ('end',
+
+ "data fields\n\n" , '' ,
+
+
+ "string :", 'title', " regular expression to search for\n" , '' ,
+ "suffix :", 'title', " type of file to search in\n" , '' ,
+ "recurse :", 'title', " enable searching subpaths\n" , '' ,
+ "location :", 'title', " drive of root path\n" , '' ,
+ "counter :", 'title', " file/hit counter\n\n" , '' ,
+
+ "key bindings\n\n" , '' ,
+
+ "double 1 :", 'title', " directory window <-> search window\n" , '' ,
+ "enter :", 'title', " start searching\n" , '' ,
+ "escape :", 'title', " quit searching\n\n" , '' ,
+
+ "current path\n\n" , '' ,
+
+ cwd(), 'title', "\n\n" , 'title' ) ;
+
+$log -> update ;
+
+ShowPath ;
+
+MainLoop() ;
diff --git a/context/perltk/texfont.pl b/context/perltk/texfont.pl
index 3eae039ba..3b86e9cd0 100644
--- a/context/perltk/texfont.pl
+++ b/context/perltk/texfont.pl
@@ -1,6 +1,9 @@
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
if 0;
+# This is an example of a crappy unstructured file but once
+# I know what should happen exactly, I will clean it up.
+
#D \module
#D [ file=texfont.pl,
#D version=2000.12.14,
@@ -20,10 +23,13 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
#D Todo : Wybo's help system
#D Todo : list of encodings [texnansi, ec, textext]
+#D Thanks to George N. White III for solving a couple of bugs.
+
use strict ;
my $savedoptions = join (" ",@ARGV) ;
+use Config ;
use File::Copy ;
use Getopt::Long ;
@@ -33,11 +39,15 @@ $Getopt::Long::autoabbrev = 1 ; # partial switch accepted
# Unless a user has specified an installation path, we take
# the dedicated font path or the local path.
+## $dosish = ($Config{'osname'} =~ /dos|mswin/i) ;
+my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^(ms|cyg)win/i) ;
+
my $installpath = "" ; my @searchpaths = () ;
if (defined($ENV{TEXMFLOCAL})) { $installpath = "TEXMFLOCAL" }
if (defined($ENV{TEXMFFONTS})) { $installpath = "TEXMFFONTS" }
+if ($installpath eq "") { $installpath = "TEXMFFONTS" } # redundant
if ($installpath eq "") { $installpath = "TEXMFLOCAL" } # redundant
@searchpaths = ('TEXMFFONTS','TEXMFLOCAL','TEXMFMAIN') ;
@@ -45,7 +55,7 @@ if ($installpath eq "") { $installpath = "TEXMFLOCAL" } # redundant
my $encoding = "texnansi" ;
my $vendor = "" ;
my $collection = "" ;
-my $fontroot = "" ;
+my $fontroot = "" ; #/usr/people/gwhite/texmf-fonts" ;
my $help = 0 ;
my $makepath = 0 ;
my $show = 0 ;
@@ -59,6 +69,7 @@ my $caps = "" ;
my $noligs = 0 ;
my $test = 0 ;
my $virtual = 0 ;
+my $novirtual = 0 ;
my $listing = 0 ;
my $remove = 0 ;
@@ -96,11 +107,16 @@ my $width = "" ;
"remove" => \$remove,
"test" => \$test,
"virtual" => \$virtual,
+ "novirtual" => \$novirtual,
"caps=s" => \$caps,
"batch" => \$batch,
"weight=s" => \$weight,
"width=s" => \$width) ;
+# so we can use both combined
+
+if (!$novirtual) { $virtual = 1 }
+
# A couple of routines.
sub report
@@ -119,7 +135,7 @@ sub error
# The banner.
print "\n" ;
-report ("TeXFont 1.3 - ConTeXt / PRAGMA ADE 2000-2001 (STILL BETA)") ;
+report ("TeXFont 1.5 - ConTeXt / PRAGMA ADE 2000-2001 (STILL BETA)") ;
print "\n" ;
# Handy for scripts: one can provide a preferred path, if it
@@ -163,8 +179,11 @@ if (($weight ne "")||($width ne ""))
if (($listing||$remove)&&($sourcepath eq "."))
{ $sourcepath = "auto" }
-if ($fontroot eq "")
- { $fontroot = `kpsewhich -expand-path=\$$installpath` ;
+if ($fontroot eq "")
+ { if ($dosish)
+ { $fontroot = `kpsewhich --expand-path=\$$installpath` }
+ else
+ { $fontroot = `kpsewhich --expand-path=\\\$$installpath` }
chomp $fontroot }
if ($test)
@@ -237,9 +256,9 @@ if (($batch)||($ARGV[0] =~ /.+\.dat$/io))
{ $selecting = 1 ; next }
else
{ next } }
- else
- { next if (/^\s*[\#\%]/io) ;
- next unless (/\-\-/oi) }
+ else
+ { next if (/^\s*[\#\%]/io) ;
+ next unless (/\-\-/oi) }
s/\s+/ /gio ;
s/(--en.*\=)\?/$1$encoding/io ;
report ("batch line : $_") ;
@@ -253,11 +272,14 @@ error ("unknown tex root $lcfontroot") unless -d $fontroot ;
my $identifier = "$encoding-$vendor-$collection" ;
-my $outlinepath = $sourcepath ;
+my $outlinepath = $sourcepath ; my $path = "" ;
if ($sourcepath eq "auto")
{ foreach my $root (@searchpaths)
- { my $path = `kpsewhich -expand-path=\$$root` ;
+ { if ($dosish)
+ { $path = `kpsewhich -expand-path=\$$root` }
+ else
+ { $path = `kpsewhich -expand-path=\\\$$root` }
chomp $path ;
$sourcepath = "$path/fonts/afm/$vendor/$collection" ;
unless (-d $sourcepath)
@@ -321,7 +343,7 @@ my $pfbpath = "$fontroot/fonts/type1/$vendor/$collection" ;
my $pdfpath = "$fontroot/pdftex/config" ;
sub do_make_path
- { my $str = shift ; mkdir $str, 755 unless -d $str }
+ { my $str = shift ; mkdir $str, 0755 unless -d $str }
sub make_path
{ my $str = shift ;
@@ -391,6 +413,7 @@ sub copy_files
if ($install)
{ copy_files("afm",$sourcepath,$afmpath) ;
+# copy_files("tfm",$sourcepath,$tfmpath) ; # raw supplied names
copy_files("pfb",$outlinepath,$pfbpath) }
error ("no afm files found") unless @files ;
@@ -400,8 +423,11 @@ my $map = my $tex = 0 ; my $mapdata = my $texdata = "" ;
copy ("$pdfpath/$mapfile","$pdfpath/$bakfile") ;
if (open (MAP,"<$pdfpath/$mapfile"))
- { while (<MAP>) { unless (/^\%/o) { $mapdata .= $_ } }
+ { report ("extending map file : $pdfpath/$mapfile") ;
+ while (<MAP>) { unless (/^\%/o) { $mapdata .= $_ } }
close (MAP) }
+else
+ { report ("no map file at : $pdfpath/$mapfile") }
if (open (TEX,"<$texfile"))
{ while (<TEX>) { unless (/stoptext/o) { $texdata .= $_ } }
@@ -510,7 +536,8 @@ if ($encoding ne "") # evt -progname=context
foreach my $file (@files)
{ my $option = my $slant = my $extend = my $vfstr = my $encstr = "" ;
my $strange = "" ;
- $file = lc $file ; my $ok = $file =~ /(.*)\/(.+?)\.(.*)/ ;
+ $file = $file ;
+ my $ok = $file =~ /(.*)\/(.+?)\.(.*)/ ;
my ($path,$name,$suffix) = ($1,$2,$3) ;
# remove trailing _'s
my $fontname = $name ;
@@ -561,8 +588,10 @@ foreach my $file (@files)
{ report "generating new tfm : $use$cleanname$fontsuffix (from $raw$cleanname)" ;
my $ok = `pltotf $raw$cleanname$fontsuffix.vpl $use$cleanname$fontsuffix.tfm ` }
} # end of next stage
+ elsif (-e "$sourcepath/$cleanname.tfm" )
+ { report "using existing tfm : $cleanname.tfm" }
else
- { report "use supplied tfm : $cleanname$fontsuffix" }
+ { report "use supplied tfm : $cleanname" }
# report results
my ($rawfont,$cleanfont,$restfont) = split(/\s/,$font) ;
$cleanfont =~ s/\_/\-/goi ;
@@ -572,7 +601,9 @@ foreach my $file (@files)
my $rawname = "$raw$cleanname$fontsuffix" ;
if ($strange ne "")
{ unlink "$vfpath/$cleanname.vf", "$tfmpath/$cleanname.tfm" ;
- copy ("$cleanname.tfm","$tfmpath/$cleanname.tfm") }
+ copy ("$cleanname.tfm","$tfmpath/$cleanname.tfm") ;
+ # or when available, use vendor one :
+ copy ("$sourcepath/$cleanname.tfm","$tfmpath/$cleanname.tfm") }
elsif ($virtual)
{ unlink "$vfpath/$rawname.vf", "$vfpath/$usename.vf" ;
unlink "$tfmpath/$rawname.tfm", "$tfmpath/$usename.tfm" ;
@@ -581,20 +612,16 @@ foreach my $file (@files)
copy ("$usename.tfm","$tfmpath/$usename.tfm") }
else
{ unlink "$vfpath/$usename.vf", "$tfmpath/$usename.tfm" ;
-# slow but prevents conflicting vf's
-my $rubish = `kpsewhich $usename.vf` ; chomp $rubish ;
-if ($rubish ne "") { unlink $rubish }
+ # slow but prevents conflicting vf's
+ my $rubish = `kpsewhich $usename.vf` ; chomp $rubish ;
+ if ($rubish ne "") { unlink $rubish }
+ #
copy ("$usename.tfm","$tfmpath/$usename.tfm") }
# cleanup
foreach my $suf ("tfm", "vf", "vpl")
{ unlink "$rawname.$suf", unlink "$usename.$suf" ;
unlink "$cleanname.$suf", unlink "$fontname.$suf" ;
unlink "$fontname$fontsuffix.$suf" }
- # quit rest if no type 1 file
- $pfbpath = `kpsewhich $name.pfb` ;
- if ($pfbpath eq "")
- { if ($tex) { $report .= "missing file: \\type \{$name.pfb\}\n" }
- next }
# add line to maps file
$option =~ s/^\s+(.*)/$1/o ;
$option =~ s/(.*)\s+$/$1/o ;
@@ -604,11 +631,22 @@ if ($rubish ne "") { unlink $rubish }
else
{ $option = "4" }
# adding cleanfont is kind of dangerous
- my $thename = "" ;
- if ($virtual) { $thename = $rawname } else { $thename = $usename }
- my $str = "$thename $cleanfont $option < $fontname.pfb $encoding.enc\n" ;
+ my $thename = my $str = my $theencoding = "" ;
+ if ($strange ne "")
+ { $thename = $cleanname ; $theencoding = "" }
+ elsif ($virtual)
+ { $thename = $rawname ; $theencoding = " $encoding.enc" }
+ else
+ { $thename = $usename ; $theencoding = " $encoding.enc" }
+ # quit rest if no type 1 file
+ unless ((-e "$pfbpath/$fontname.pfb")||
+ (-e "$sourcepath/$fontname.pfb"))
+ { if ($tex) { $report .= "missing file: \\type \{$fontname.pfb\}\n" }
+ report ("missing pfb file : $fontname.pfb") }
+ # now add entry to map
+ $str = "$thename $cleanfont $option < $fontname.pfb$theencoding\n" ;
if ($map) # check for redundant entries
- { $mapdata =~ s/^$thename\s.*?$//gmois ;
+ { $mapdata =~ s/^$thename\s.*?$//gmis ;
$maplist .= $str ;
$mapdata .= $str }
# write lines to tex file
diff --git a/context/perltk/texutil.pl b/context/perltk/texutil.pl
index 2b749123f..dbb6ae549 100644
--- a/context/perltk/texutil.pl
+++ b/context/perltk/texutil.pl
@@ -378,6 +378,91 @@ elsif ($UserInterface eq "de")
$MS{"References"} = "Referenzen" ;
} # end of german section
+
+elsif ($UserInterface eq "it")
+
+ { # begin of italian section
+
+ $MS{"ProcessingReferences"} = "elaborazione di comandi, liste e registri" ;
+ $MS{"MergingReferences"} = "fusione dei registri" ;
+ $MS{"GeneratingDocumentation"} = "preparazione del file di documentazione ConTeXt" ;
+ $MS{"GeneratingSources"} = "generazione del solo sorgente ConTeXt" ;
+ $MS{"FilteringDefinitions"} = "filtraggio delle definizioni formali ConTeXt" ;
+ $MS{"CopyingTemplates"} = "copia dei modelli rapidi di voci di TeXEdit" ;
+ $MS{"CopyingInformation"} = "copia delle informazioni di aiuto di TeXEdit" ;
+ $MS{"GeneratingFigures"} = "generazione del file di elengo delle figure" ;
+ $MS{"FilteringLogFile"} = "filtraggio del file di log" ;
+
+ $MS{"SortingIJ"} = "IJ elencato sotto Y" ;
+ $MS{"ConvertingHigh"} = "conversione dei valori ASCII alti" ;
+ $MS{"ProcessingQuotes"} = "elaborazione dei caratteri accentati" ;
+ $MS{"ForcingFileType"} = "impostazine del tipo di file" ;
+ $MS{"UsingEps"} = "elaborazione del file EPS" ;
+ $MS{"UsingTif"} = "elaborazione del file TIF" ;
+ $MS{"UsingPdf"} = "elaborazione del file PDF" ;
+ $MS{"UsingPng"} = "elaborazione del file PNG" ;
+ $MS{"UsingJpg"} = "elaborazione del file JPG" ;
+ $MS{"EpsToPdf"} = "conversione da EPS a PDF";
+ $MS{"EpsPage"} = "impostazione pagina EPS";
+
+ $MS{"FilteringBoxes"} = "filtraggio delle overfull boxes" ;
+ $MS{"ApplyingCriterium"} = "applicazione del criterio overfull" ;
+ $MS{"FilteringUnknown"} = "filtraggio dei messaggi non conosciuti ..." ;
+
+ $MS{"NoInputFile"} = "nessun file di input specificato" ;
+ $MS{"NoOutputFile"} = "nessun file di output generato" ;
+ $MS{"EmptyInputFile"} = "file di input vuoto" ;
+ $MS{"NotYetImplemented"} = "non ancora disponibile" ;
+
+ $MS{"Action"} = " azione :" ;
+ $MS{"Option"} = " opzione :" ;
+ $MS{"Error"} = " errore :" ;
+ $MS{"Remark"} = " commento :" ;
+ $MS{"SystemCall"} = " chiamata di sistema :" ;
+ $MS{"BadSystemCall"} = "chiamata di sistema er :" ; # GB: Hans, I need more space!
+ $MS{"MissingSubroutine"} = " subroutine mancante :" ;
+
+ $MS{"EmbeddedFiles"} = " file inclusi :" ;
+ $MS{"BeginEndError"} = " errore di i/f in :" ;
+ $MS{"SynonymEntries"} = " voci di sinonimi :" ;
+ $MS{"SynonymErrors"} = " voci errate :" ;
+ $MS{"RegisterEntries"} = " voci di registro :" ;
+ $MS{"RegisterErrors"} = " voci errate :" ;
+ $MS{"PassedCommands"} = " comandi passati :" ;
+
+ $MS{"MultiPagePdfFile"} = " troppe pagine :" ;
+ $MS{"MissingMediaBox"} = " mediabox mancante :" ;
+ $MS{"MissingBoundingBox"} = " boundingbox mancante :" ;
+
+ $MS{"NOfDocuments"} = " blocchi di documento :" ;
+ $MS{"NOfDefinitions"} = "blocchi di definizioni :" ;
+ $MS{"NOfSkips"} = " blocchi saltati :" ;
+ $MS{"NOfSetups"} = " impostazioni copiate :" ;
+ $MS{"NOfTemplates"} = " modelli copiati :" ;
+ $MS{"NOfInfos"} = " helpinfo copiati :" ;
+ $MS{"NOfFigures"} = " figure elaborate :" ;
+ $MS{"NOfBoxes"} = " overfull boxes :" ;
+ $MS{"NOfUnknown"} = " sconosciuti ... :" ;
+
+ $MS{"InputFile"} = " file di input :" ;
+ $MS{"OutputFile"} = " file di output :" ;
+ $MS{"FileType"} = " tipo di file :" ;
+ $MS{"EpsFile"} = " file eps :" ;
+ $MS{"PdfFile"} = " file pdf :" ;
+ $MS{"TifFile"} = " file tif :" ;
+ $MS{"PngFile"} = " file png :" ;
+ $MS{"JpgFile"} = " file jpg :" ;
+ $MS{"MPFile"} = " file metapost :" ;
+
+ $MS{"LoadedFilter"} = " filtro caricato :" ;
+ $MS{"RemappedKeys"} = " voci rimappate :" ;
+ $MS{"WrongFilterPath"} = "percorso filtro errato :" ;
+
+ $MS{"Overfull"} = "overfull" ;
+ $MS{"Entries"} = "voci" ;
+ $MS{"References"} = "riferimenti" ;
+
+ } # end of italian section
else
@@ -543,6 +628,36 @@ elsif ($UserInterface eq "de")
} # end of german section
+elsif ($UserInterface eq "it")
+
+ { # begin of italian section GB: Hans, I need more space!
+
+ $MS{"HelpInfo"} =
+
+" --references elabora file ausiliari / tui->tuo \n" .
+" --ij : elenca IJ come Y \n" .
+" --high : converti i valori ASCII alti \n" .
+" --quotes : converti caratteri accentati \n" .
+" --tcxpath : percorso del filtro tcx \n" .
+" \n" .
+" --purge rimuovi i file temporanei ConTeXt \n" .
+" \n" .
+" --documents genera file di documentazione / tex->ted \n" .
+" --sources genera solo sorgente / tex->tes \n" .
+" --setups filtra definizioni ConTeXt / tex->texutil.tus \n" .
+" --templates filtra modelli TeXEdit / tex->tud \n" .
+" --infos filtra helpinfo TeXEdit / tex->tud \n" .
+" \n" .
+" --figures genera lista figure eps / *->texutil.tuf \n" .
+" --epspage : prepara per pdf \n" .
+" --epstopdf : converti in pdf \n" .
+" \n" .
+" --logfile filtra logfile / log->$ProgramLog \n" .
+" --box : controlla overful boxes \n" .
+" --criterium : criterio overfull in pt \n" .
+" --unknown : controlla sconosciuti ... \n" ;
+
+ } # end of italian section
else
@@ -588,6 +703,7 @@ else
#D \som \type{"e}: is translated into an \type{e} and \type{b} etc.
#D \som \type{||}: becomes \type{-}
#D \som \type{\-}: also becomes \type{-}
+#D \som \type{<*..>}: becomes \type{..} (internal XML entity)
#D \stopopsomming
#D
#D Of course other accented characters are handled too. The
@@ -713,7 +829,11 @@ sub SanitizedString
$string =~ s/([\^\"\`\'\~\,])([a-zA-Z])/$2/gio ;
$string .= "\x00";
$string .= $copied }
-$string =~ s/\<ent\:(.*?)\>/$1/go ; # reduce entities / will be table too
+# new and very experimental, will change
+$string =~ s/\<\*(.*?)\>/\\$1 /go ; # reduce entities / will be table too
+$string =~ s/\\getXMLentity\s*\{(.*?)\}/$1/gio ; # {tex} => tex
+$string =~ s/\<[a-zA-Z\/].*?\>//go ; # remove elements
+# so far
$string =~ s/\\-|\|\|/\-/gio ;
$string =~ s/\\[a-zA-Z]*| |\{|\}//gio ; # ?
return $string }
@@ -1410,6 +1530,13 @@ sub HandleDocuments
else
{ $FileType=lc $ProcessType }
Report("FileType", $FileType) ;
+ # we need to signal to texexec what interfaec to use
+ my $firstline = <TEX> ;
+ if ($firstline =~ /^\%.*interface\=/)
+ { print TED $firstline }
+ else
+ { seek TEX, 0, 0 }
+ # so far
print TED "\\startmodule[type=$FileType]\n" ;
while (<TEX>)
{ chomp ;
diff --git a/doc/context/base/minstall.pdf b/doc/context/base/minstall.pdf
index 724ec68c4..29b3da4ca 100644
--- a/doc/context/base/minstall.pdf
+++ b/doc/context/base/minstall.pdf
Binary files differ
diff --git a/doc/context/base/mreadme.pdf b/doc/context/base/mreadme.pdf
index 001da8ede..df48a16b3 100644
--- a/doc/context/base/mreadme.pdf
+++ b/doc/context/base/mreadme.pdf
Binary files differ
diff --git a/metapost/context/metafun.mp b/metapost/context/metafun.mp
index cf63d289f..474a10eb3 100644
--- a/metapost/context/metafun.mp
+++ b/metapost/context/metafun.mp
@@ -40,4 +40,8 @@ input mp-char.mp ;
input mp-step.mp ;
input mp-grph.mp ;
+% mp-form.mp ;
+input mp-grid.mp ;
+input mp-func.mp ;
+
dump ; endinput .
diff --git a/metapost/context/mp-char.mp b/metapost/context/mp-char.mp
index 476199e23..740d36c37 100644
--- a/metapost/context/mp-char.mp
+++ b/metapost/context/mp-char.mp
@@ -19,10 +19,10 @@ if known context_char : endinput ; fi ;
boolean context_char ; context_char := true ;
-current_position := 0 ;
-
% kan naar elders
+current_position := 0 ;
+
def save_text_position (expr p) = % beware: clip shift needed
current_position := current_position + 1 ;
savedata
@@ -85,56 +85,62 @@ def show_shapes (expr n) =
enddef ;
-%D connections -> namespace needed ! ! !
-
-color connection_line_color ;
-
-connection_line_width := shape_line_width ;
-connection_line_color := .8white ;
-connection_smooth_size := 5pt ;
-connection_arrow_size := 4pt ;
-connection_dash_size := 3pt ;
-
-max_x := 6 ;
-max_y := 4 ;
-
-numeric xypoint ; xypoint := 0 ;
-
-pair xypoints [] ;
-
-boolean xyfree [][] ;
-path xypath [][] ;
-numeric xysx [][] ;
-numeric xysy [][] ;
-color xyfill [][] ;
-color xydraw [][] ;
-numeric xyline [][] ;
-boolean xypeep [][] ;
-
-numeric cpath ; cpath := 0 ;
-path cpaths [] ;
-numeric cline [] ;
-color ccolor [] ;
-boolean carrow [] ;
-boolean cdash [] ;
-boolean ccross [] ;
-
-boolean smooth ; smooth := true ;
-boolean peepshape ; peepshape := false ;
-boolean arrowtip ; arrowtip := true ;
-boolean dashline ; dashline := false ;
-boolean forcevalid ; forcevalid := false ;
-boolean touchshape ; touchshape := false ;
-boolean showcrossing ; showcrossing := false ;
-
-picture dash_pattern ;
+%D connections
+
+def new_chart =
+
+ color connection_line_color ;
+
+ connection_line_width := shape_line_width ;
+ connection_line_color := .8white ;
+ connection_smooth_size := 5pt ;
+ connection_arrow_size := 4pt ;
+ connection_dash_size := 3pt ;
+
+ max_x := 6 ;
+ max_y := 4 ;
+
+ numeric xypoint ; xypoint := 0 ;
+
+ pair xypoints [] ;
+
+ boolean xyfree [][] ;
+ path xypath [][] ;
+ numeric xysx [][] ;
+ numeric xysy [][] ;
+ color xyfill [][] ;
+ color xydraw [][] ;
+ numeric xyline [][] ;
+ boolean xypeep [][] ;
+
+ numeric cpath ; cpath := 0 ;
+ path cpaths [] ;
+ numeric cline [] ;
+ color ccolor [] ;
+ boolean carrow [] ;
+ boolean cdash [] ;
+ boolean ccross [] ;
+
+ boolean smooth ; smooth := true ;
+ boolean peepshape ; peepshape := false ;
+ boolean arrowtip ; arrowtip := true ;
+ boolean dashline ; dashline := false ;
+ boolean forcevalid ; forcevalid := false ;
+ boolean touchshape ; touchshape := false ;
+ boolean showcrossing ; showcrossing := false ;
+
+ picture dash_pattern ;
+
+ boolean reverse_y ; reverse_y := true ;
+
+enddef ;
-boolean reverse_y ; reverse_y := true ;
+new_chart ;
def y_pos (expr y) =
if reverse_y : max_y + 1 - y else : y fi
enddef ;
-
+
def initialize_grid (expr maxx, maxy) =
begingroup ;
save i, j ;
@@ -268,7 +274,7 @@ vardef points_initialized (expr xfrom, yfrom, xto, yto, n) =
fi
enddef ;
-def collapse_points =
+def collapse_points = % this is now an mp-tool macro
% remove redundant points
n := 1 ;
for i=2 upto xypoint:
@@ -285,7 +291,7 @@ def collapse_points =
fi ;
enddef ;
-vardef smooth_connection (expr a,b) =
+vardef smooth_connection (expr a,b) = % also a mp-tool macro
sx := connection_smooth_size/grid_width ;
sy := connection_smooth_size/grid_height ;
if ypart a = ypart b :
@@ -822,6 +828,7 @@ def clip_chart (expr minx, miny, maxx, maxy) =
enddef ;
def begin_chart (expr n, maxx, maxy) =
+ new_chart ;
chart_figure := n ;
chart_scale := 1 ;
if chart_figure>0: beginfig(chart_figure) ; fi ;
diff --git a/metapost/context/mp-form.mp b/metapost/context/mp-form.mp
new file mode 100644
index 000000000..51c1fb5c5
--- /dev/null
+++ b/metapost/context/mp-form.mp
@@ -0,0 +1,378 @@
+% Hans Hagen / October 2000
+%
+% This file is mostly a copy from the file format.mp, that
+% comes with MetaPost and is written by John Hobby. This file
+% is meant to be compatible, but has a few more features,
+% controlled by the variables:
+%
+% fmt_initialize when false, initialization is skipped
+% fmt_precision the default accuracy (default=3)
+% fmt_separator the pattern separator (default=%)
+% fmt_zerocheck activate extra sci notation zero check
+%
+% instead of a picture, one can format a number in a for TeX
+% acceptable input string
+
+if known fmt_loaded : expandafter endinput fi ;
+ boolean fmt_loaded ; fmt_loaded := true ;
+
+if unknown fmt_precision :
+ numeric fmt_precision ; fmt_precision := 3 ;
+fi ;
+
+if unknown fmt_initialize :
+ boolean fmt_initialize ; fmt_initialize := true ;
+fi ;
+
+if unknown fmt_separator :
+ string fmt_separator ; fmt_separator := "%" ;
+fi ;
+
+if unknown fmt_zerocheck :
+ boolean fmt_zerocheck ; fmt_zerocheck := false ;
+fi ;
+
+boolean fmt_metapost ; fmt_metapost := true ; % == use old method
+
+% As said, all clever code is from John, the more stupid
+% extensions are mine. The following string variables are
+% responsible for the TeX formatting.
+
+% TeX specs when using TeX instead of pseudo TeX.
+
+string sFebraise_ ; sFebraise_ := "{" ;
+string sFeeraise_ ; sFeeraise_ := "}" ;
+string sFebmath_ ; sFebmath_ := "$" ;
+string sFeemath_ ; sFeemath_ := "$" ;
+
+string sFmneg_ ; sFmneg_ := "-" ;
+string sFemarker_ ; sFemarker_ := "{\times}10^" ;
+string sFeneg_ ; sFeneg_ := "-" ;
+string sFe_plus ; sFe_plus := "" ; % "+"
+
+def sFe_base = Fline_up_("1", sFemarker_) enddef ;
+
+% Macros for generating typeset pictures of computed numbers
+%
+% format(f,x) typeset generalized number x using format string f
+% Mformat(f,x) like format, but x is in Mlog form (see marith.mp)
+% init_numbers(s,m,x,sn,e) choose typeset style given sample sign, mantissa,...
+% roundd(x,d) round numeric x to d places right of decimal point
+% Fe_base what precedes the exponent for typeset powers of 10
+% Fe_plus plus sign if any for typesetting positive exponents
+% Ten_to[] powers of ten for indices 0,1,2,3,4
+%
+% New are:
+%
+% formatstr(f,x) TeX string representing x using format f
+% Mformatstr(f,x) like Mformatstr, but x is in Mlog form
+
+% Other than the above-documented user interface, all
+% externally visible names start with F and end with _.
+
+% Allow big numbers in token lists
+
+begingroup interim warningcheck := 0 ;
+
+%%% Load auxiliary macros.
+
+input string
+input marith
+
+%%% Choosing the Layout %%%
+
+picture Fmneg_, Femarker_, Feneg_, Fe_base, Fe_plus ;
+string Fmfont_, Fefont_ ;
+numeric Fmscale_, Fescale_, Feraise_ ;
+
+% Argument
+%
+% s is a leading minus sign
+% m is a 1-digit mantissa
+% x is whatever follows the mantissa
+% sn is a leading minus for the exponent, and
+% e is a 1-digit exponent.
+%
+% Numbers in scientific notation are constructed by placing
+% these pieces side-by-side; decimal numbers use only m
+% and/or s. To get exponents with leading plus signs, assign
+% to Fe_plus after calling init_numbers. To do something
+% special with a unit mantissa followed by x, assign to
+% Fe_base after calling init_numbers.
+
+vardef init_numbers(expr s, m, x, sn, e) =
+ Fmneg_ := s ;
+ for p within m :
+ Fmfont_ := fontpart p ;
+ Fmscale_ := xxpart p ;
+ exitif true ;
+ endfor
+ Femarker_ := x ;
+ Feneg_ := sn ;
+ for p within e :
+ Fefont_ := fontpart p ;
+ Fescale_ := xxpart p ;
+ Feraise_ := ypart llcorner p ;
+ exitif true ;
+ endfor
+ Fe_base := Fline_up_("1" infont Fmfont_ scaled Fmscale_, Femarker_) ;
+ Fe_plus := nullpicture ;
+enddef ;
+
+%%% Low-Level Typesetting %%%
+
+vardef Fmant_(expr x) = %%% adapted by HH %%%
+ if fmt_metapost :
+ (decimal abs x infont Fmfont_ scaled Fmscale_)
+ else :
+ (decimal abs x)
+ fi
+enddef ;
+
+vardef Fexp_(expr x) = %%% adapted by HH %%%
+ if fmt_metapost :
+ (decimal x infont Fefont_ scaled Fescale_ shifted (0,Feraise_))
+ else :
+ (decimal x)
+ fi
+enddef ;
+
+vardef Fline_up_(text t_) = %%% adapted by HH %%%
+ if fmt_metapost :
+ save p_, c_ ;
+ picture p_ ; p_ = nullpicture ;
+ pair c_ ; c_ = (0,0) ;
+ for q_ = t_ :
+ addto p_ also q_ if string q_ : infont defaultfont scaled defaultscale fi
+ shifted c_ ;
+ c_ := (xpart lrcorner p_, 0) ;
+ endfor
+ p_
+ else :
+ "" for q_ = t_ : & q_ endfor
+ fi
+enddef ;
+
+vardef Fdec_o_(expr x) = %%% adapted by HH %%%
+ if x<0 :
+ Fline_up_(if fmt_metapost : Fmneg_ else : sFmneg_ fi, Fmant_(x))
+ else :
+ Fmant_(x)
+ fi
+enddef ;
+
+vardef Fsci_o_(expr x, e) = %%% adapted by HH %%%
+ if fmt_metapost :
+ Fline_up_
+ (if x < 0 : Fmneg_,fi
+ if abs x = 1 : Fe_base else : Fmant_(x), Femarker_ fi,
+ if e < 0 : Feneg_ else : Fe_plus fi,
+ Fexp_(abs e))
+ else :
+ Fline_up_
+ (if x < 0 : sFmneg_, fi
+ if abs x = 1 : sFe_base else : Fmant_(x), sFemarker_ fi,
+ sFebraise_,
+ if e < 0 : sFeneg_ else : sFe_plus fi,
+ Fexp_(abs e),
+ sFeeraise_)
+ fi
+enddef ;
+
+% Assume prologues=1 implies troff mode. TeX users who want
+% prologues on should use some other positive value. The mpx
+% file mechanism requires separate input files here.
+
+if fmt_initialize : %%% adapted by HH
+ if prologues = 1 : input troffnum else : input texnum fi
+fi ;
+
+%%% Scaling and Rounding %%%
+
+% Find a pair p where x = xpart p*10**ypart p and either p =
+% (0,0) or xpart p is between 1000 and 9999.99999. This is
+% the `exponent form' of x.
+
+vardef Feform_(expr x) =
+ interim warningcheck := 0 ;
+ if string x :
+ Meform(Mlog_str x)
+ else :
+ save b, e ;
+ b = x ; e = 0 ;
+ if abs b >= 10000 :
+ (b/10, 1)
+ elseif b = 0 :
+ origin
+ else :
+ forever :
+ exitif abs b >= 1000 ;
+ b := b*10 ; e := e-1 ;
+ endfor
+ (b, e)
+ fi
+ fi
+enddef ;
+
+% The marith.mp macros include a similar macro Meform that
+% converts from `Mlog form' to exponent form. In case
+% rounding has made the xpart of an exponent form number too
+% large, fix it.
+
+vardef Feadj_(expr x, y) =
+ if abs x >= 10000 : (x/10, y+1) else : (x,y) fi
+enddef ;
+
+% Round x to d places right of the decimal point. When d<0,
+% round to the nearest multiple of 10 to the -d.
+
+vardef roundd(expr x, d) =
+ if abs d > 4 :
+ if d > 0 : x else : 0 fi
+ elseif d > 0 :
+ save i ; i = floor x ;
+ i + round(Ten_to[d]*(x-i))/Ten_to[d]
+ else :
+ round(x/Ten_to[-d])*Ten_to[-d]
+ fi
+enddef ;
+
+Ten_to0 = 1 ;
+Ten_to1 = 10 ;
+Ten_to2 = 100 ;
+Ten_to3 = 1000 ;
+Ten_to4 = 10000 ;
+
+% Round an exponent form number p to k significant figures.
+
+primarydef p Fprec_ k =
+ Feadj_(roundd(xpart p,k-4), ypart p)
+enddef ;
+
+% Round an exponent form number p to k digits right of the
+% decimal point.
+
+primarydef p Fdigs_ k =
+ Feadj_(roundd(xpart p,k+ypart p), ypart p)
+enddef ;
+
+%%% High-Level Routines %%%
+
+% The following operators convert z from exponent form and
+% produce typeset output: Formsci_ generates scientific
+% notation; Formdec_ generates decimal notation; and
+% Formgen_ generates whatever is likely to be most compact.
+
+vardef Formsci_(expr z) = %%% adapted by HH %%%
+ if fmt_zerocheck and (z = origin) :
+ Fsci_o_(0,0)
+ else :
+ Fsci_o_(xpart z/1000, ypart z + 3)
+ fi
+enddef ;
+
+vardef Formdec_(expr z) =
+ if ypart z > 0 :
+ Formsci_(z)
+ else :
+ Fdec_o_
+ (xpart z if ypart z >= -4 :
+ /Ten_to[-ypart z]
+ else :
+ for i = ypart z upto -5 : /(10) endfor /10000
+ fi)
+ fi
+enddef ;
+
+vardef Formgen_(expr q) =
+ clearxy ; (x,y) = q ;
+ if x = 0 : Formdec_
+ elseif y >= -6 : Formdec_
+ else : Formsci_
+ fi (q)
+enddef ;
+
+def Fset_item_(expr s) = %%% adapted by HH %%%
+ if s <> "" :
+ if fmt_metapost :
+ s infont defaultfont scaled defaultscale,
+ else :
+ s,
+ fi
+ fi
+enddef ;
+
+% For each format letter, the table below tells how to
+% round and typeset a quantity z in exponent form.
+%
+% e scientific, p significant figures
+% p decimal, p digits right of the point
+% g decimal or scientific, p sig. figs.
+% G decimal or scientific, p digits
+
+string fmt_[] ;
+
+fmt_[ASCII "e"] = "Formsci_(z Fprec_ p)" ;
+fmt_[ASCII "f"] = "Formdec_(z Fdigs_ p)" ;
+fmt_[ASCII "g"] = "Formgen_(z Fprec_ p)" ;
+fmt_[ASCII "G"] = "Formgen_(z Fdigs_ p)" ;
+
+% The format and Mformat macros take a format string f and
+% generate typeset output for a numeric quantity x. String f
+% should contain a `%' followed by an optional number and one
+% of the format letters defined above. The number should be
+% an integer giving the precision (default 3).
+
+vardef dofmt_@#(expr f, x) = %%% adapted by HH %%%
+ if f = "" :
+ if fmt_metapost : nullpicture else : "" fi
+ else :
+ interim warningcheck := 0 ;
+ save k, l, s, p, z ;
+ pair z ; z = @#(x) ;
+ k = 1 + cspan(f, fmt_separator <> ) ;
+ l-k = cspan(substring(k,infinity) of f, isdigit) ;
+ p = if l > k :
+ scantokens substring(k,l) of f
+ else :
+ fmt_precision
+ fi ;
+ string s ; s = fmt_[ASCII substring (l,l+1) of f] ;
+ if unknown s :
+ if k <= length f :
+ errmessage("No valid format letter found in "&f) ;
+ fi
+ s = if fmt_metapost : nullpicture else : "" fi ;
+ fi
+ Fline_up_
+ (Fset_item_(substring (0,k-1) of f)
+ if not fmt_metapost : sFebmath_, fi
+ scantokens s,
+ if not fmt_metapost : sFeemath_, fi
+ Fset_item_(substring (l+1,infinity) of f)
+ if fmt_metapost : nullpicture else : "" fi)
+ fi
+ hide (fmt_metapost := true)
+enddef ;
+
+%%% so far %%%
+
+vardef format (expr f, x) =
+ fmt_metapost := true ; dofmt_.Feform_(f,x)
+enddef ;
+
+vardef Mformat(expr f, x) =
+ fmt_metapost := true ; dofmt_.Meform (f,x)
+enddef ;
+
+vardef formatstr (expr f, x) =
+ fmt_metapost := false ; dofmt_.Feform_(f,x)
+enddef ;
+
+vardef Mformatstr(expr f, x) =
+ fmt_metapost := false ; dofmt_.Meform (f,x)
+enddef ;
+
+% Restore warningcheck to previous value.
+
+endgroup ;
diff --git a/metapost/context/mp-func.mp b/metapost/context/mp-func.mp
new file mode 100644
index 000000000..d8646ef3b
--- /dev/null
+++ b/metapost/context/mp-func.mp
@@ -0,0 +1,59 @@
+%D \module
+%D [ file=mp-func.mp,
+%D version=2001.12.29,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=function hacks,
+%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 licen-en.pdf for
+%C details.
+
+%D Under construction.
+
+if unknown context_tool : input mp-tool ; fi ;
+if known context_func : endinput ; fi ;
+
+boolean context_func ; context_func := true ;
+
+string pathconnectors[] ;
+
+pathconnectors[0] := "," ;
+pathconnectors[1] := "--" ;
+pathconnectors[2] := ".." ;
+pathconnectors[3] := "..." ;
+
+vardef function (expr f) (expr u, t, b, e, s) = save x ; numeric x ;
+ for xx := b step s until e :
+ hide (x := xx ;) if xx>b : scantokens(pathconnectors[f]) fi
+ (scantokens(u),scantokens(t))
+ endfor
+enddef ;
+
+def punkedfunction = function (1) enddef ;
+def curvedfunction = function (2) enddef ;
+def tightfunction = function (3) enddef ;
+
+vardef constructedpath (expr f) (text t) =
+ save ok ; boolean ok ; ok := false ;
+ for i=t :
+ if ok : scantokens(pathconnectors[f]) else : ok := true ; fi i
+ endfor
+enddef ;
+
+def punkedpath = constructedpath (1) enddef ;
+def curvedpath = constructedpath (2) enddef ;
+def tightpath = constructedpath (3) enddef ;
+
+vardef constructedpairs (expr f) (text p) =
+ save i ; i := -1 ;
+ forever : exitif unknown p[incr(i)] ;
+ if i>0 : scantokens(pathconnectors[f]) fi p[i]
+ endfor
+enddef ;
+
+def punkedpairs = constructedpairs (1) enddef ;
+def curvedpairs = constructedpairs (2) enddef ;
+def tightpairs = constructedpairs (3) enddef ;
diff --git a/metapost/context/mp-grid.mp b/metapost/context/mp-grid.mp
new file mode 100644
index 000000000..c684963d8
--- /dev/null
+++ b/metapost/context/mp-grid.mp
@@ -0,0 +1,129 @@
+%D \module
+%D [ file=mp-grid.mp,
+%D version=2000.07.10,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=grid support,
+%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 licen-en.pdf for
+%C details.
+
+%D Under construction.
+
+if unknown context_tool : input mp-tool ; fi ;
+if known context_grid : endinput ; fi ;
+
+boolean context_grid ; context_grid := true ;
+
+string fmt_separator ; fmt_separator := "@" ;
+numeric fmt_precision ; fmt_precision := 3 ;
+boolean fmt_initialize ; fmt_initialize := false ;
+boolean fmt_zerocheck ; fmt_zerocheck := true ;
+
+if unknown fmt_loaded : input mp-form ; fi ;
+
+boolean fmt_pictures ; fmt_pictures := true ;
+
+def do_format = if fmt_pictures : format else : formatstr fi enddef ;
+def do_mformat = if fmt_pictures : Mformat else : Mformatstr fi enddef ;
+
+def hlingrid (expr Min, Max, Step, Length, Width) text t =
+ image ( for i=Min step Step until Max :
+ draw (origin--(Width,0)) shifted (0,i*Length/Max) t ;
+ endfor ; ) ;
+enddef ;
+
+def vlingrid (expr Min, Max, Step, Length, Height) text t =
+ image ( for i=Min step Step until Max :
+ draw (origin--(0,Height)) shifted (i*Length/Max,0) t ;
+ endfor ; ) ;
+enddef ;
+
+def hloggrid (expr Min, Max, Step, Length, Width) text t =
+ image ( for i=max(Min,1) step Step until min(Max,10) :
+ draw (origin--(Width,0)) shifted (0,Length*log(i)) t ;
+ endfor ; ) ;
+enddef ;
+
+def vloggrid (expr Min, Max, Step, Length, Height) text t =
+ image ( for i=max(Min,1) step Step until min(Max,10) :
+ draw (origin--(0,Height)) shifted (Length*log(i),0) t ;
+ endfor ; ) ;
+enddef ;
+
+vardef hlintext@#(expr Min, Max, Step, Length, Format) text t =
+ image ( do_initialize_numbers ;
+ for i=Min step Step until Max :
+ draw textext@#(do_format(Format,i)) shifted (0,i*Length/Max) t ;
+ endfor ; )
+enddef ;
+
+vardef vlintext@#(expr Min, Max, Step, Length, Format) text t =
+ image ( do_initialize_numbers ;
+ for i=Min step Step until Max :
+ draw textext@#(do_format(Format,i)) shifted (i*Length/Max,0) t ;
+ endfor ; )
+enddef ;
+
+vardef hlogtext@#(expr Min, Max, Step, Length, Format) text t =
+ image ( do_initialize_numbers ;
+ for i=max(Min,1) step Step until min(Max,10) :
+ draw textext@#(do_format(Format,i)) shifted (0,Length*log(i)) t ;
+ endfor ; )
+enddef ;
+
+vardef vlogtext@#(expr Min, Max, Step, Length, Format) text t =
+ image ( do_initialize_numbers ;
+ for i=max(Min,1) step Step until min(Max,10) :
+ draw textext@#(do_format(Format,i)) shifted (Length*log(i),0) t ;
+ endfor ; )
+enddef ;
+
+boolean numbers_initialized ; numbers_initialized := false ;
+
+def do_initialize_numbers =
+ if not numbers_initialized :
+ init_numbers ( textext.raw("$-$") ,
+ textext.raw("$1$") ,
+ textext.raw("${\times}10$") ,
+ textext.raw("${}^-$") ,
+ textext.raw("${}^2$") ) ;
+ numbers_initialized := true ;
+ fi ;
+enddef ;
+
+def initialize_numbers =
+ numbers_initialized := false ; do_initialize_numbers ;
+enddef ;
+
+vardef linlog(expr xy) = ( xpart xy, log(ypart xy)) enddef ;
+vardef loglin(expr xy) = (log(xpart xy), ypart xy) enddef ;
+vardef loglog(expr xy) = (log(xpart xy), log(ypart xy)) enddef ;
+vardef linlin(expr xy) = ( (xpart xy), (ypart xy)) enddef ;
+
+vardef loglinpath primary p = processpath (p) (loglin) enddef ;
+vardef linlogpath primary p = processpath (p) (linlog) enddef ;
+vardef loglogpath primary p = processpath (p) (loglog) enddef ;
+vardef linlinpath primary p = processpath (p) (linlin) enddef ;
+
+def processpath (expr p) (text pp) =
+ if path p :
+ for i=0 upto length(p)-1 :
+ (pp(point i of p)) .. controls
+ (pp(postcontrol i of p)) and
+ (pp(precontrol (i+1) of p)) ..
+ endfor
+ if cycle p :
+ cycle
+ else :
+ (pp(point length(p) of p))
+ fi
+ elseif pair p :
+ (pp(p))
+ else :
+ p
+ fi
+enddef ;
diff --git a/metapost/context/mp-grph.mp b/metapost/context/mp-grph.mp
index 26202d61a..207b2b4f0 100644
--- a/metapost/context/mp-grph.mp
+++ b/metapost/context/mp-grph.mp
@@ -22,14 +22,33 @@ string CRLF ; CRLF := char 10 & char 13 ;
picture _currentpicture_ ;
+def beginfig (expr c) =
+ begingroup
+ charcode := c ;
+ resetfig ;
+ scantokens extra_beginfig ;
+enddef ;
+
+def resetfig =
+ clearxy ;
+ clearit ;
+ clearpen ;
+ pickup defaultpen ;
+ interim linecap := linecap ;
+ interim linejoin := linejoin ;
+ interim miterlimit := miterlimit ;
+ save _background_ ; color _background_ ; _background_ := background ;
+ save background ; color background ; background := _background_ ;
+ drawoptions () ;
+enddef ;
+
def protectgraphicmacros =
save showtext ;
save beginfig ; let beginfig = begingraphictextfig ;
save endfig ; let endfig = endgraphictextfig ;
save end ; let end = relax ;
interim prologues := prologues ;
- interim linecap := butt ;
- interim linejoin := mitered ;
+ resetfig ;
enddef ;
numeric currentgraphictext ; currentgraphictext := 0 ;
@@ -53,7 +72,7 @@ def erasegraphictextfile =
let erasegraphictextfile = relax ;
enddef ;
-extra_beginfig := extra_beginfig & "erasegraphictextfile ;" ;
+extra_beginfig := extra_beginfig & " erasegraphictextfile ;" ;
def begingraphictextfig (expr n) =
foundpicture := n ; scratchpicture := nullpicture ;
@@ -67,25 +86,6 @@ def endgraphictextfig =
fi ;
enddef ;
-% def loadfigure (expr filename, n) =
-% begingroup ;
-% protectgraphicmacros ; % also save linewidth, color, options etc ?
-% save sp ; picture sp ; sp := currentpicture ;
-% save ok ; boolean ok ; ok := false ;
-% def beginfig (expr m) =
-% if n=m :
-% currentpicture := sp ; ok := true ;
-% def endfig = endinput ; enddef ;
-% else :
-% currentpicture := nullpicture ;
-% fi ;
-% enddef ;
-% let endfig = relax ;
-% readfile(filename) ;
-% if not ok : currentpicture := sp ; fi ;
-% endgroup ;
-% enddef ;
-
def loadfigure primary filename =
doloadfigure (filename)
enddef ;
@@ -97,6 +97,11 @@ def doloadfigure (expr filename) text figureattributes =
picture figurepicture ; figurepicture := currentpicture ;
def number primary n = hide(figurenumber := n) enddef ;
protectgraphicmacros ;
+ % defaults
+ interim linecap := rounded ;
+ interim linejoin := rounded ;
+ interim miterlimit := 10 ;
+ %
currentpicture := nullpicture ;
def beginfig (expr n) =
currentpicture := nullpicture ;
@@ -114,37 +119,59 @@ def graphictext primary t =
dographictext(t)
enddef ;
-def dographictext (expr t) text x_op_x =
+def dographictext (expr t) =
begingroup ;
- protectgraphicmacros ;
if graphictextformat<>"" :
- graphictextstring :=
+ graphictextstring :=
"% format=" & graphictextformat & CRLF & graphictextstring ;
- graphictextformat := "" ;
+ graphictextformat := "" ;
fi ;
- let normalwithshade = withshade ;
- save foundpicture, scratchpicture, str ;
- save fill, draw, withshade, reversefill, outlinefill ;
- numeric foundpicture ; picture scratchpicture ; string str ;
currentgraphictext := currentgraphictext + 1 ;
savegraphictext ("\startTEXpage[scale=10000]" & t & "\stopTEXpage") ;
+ dofinishgraphictext
+enddef ;
+
+def redographictext primary t =
+ regraphictext(t)
+enddef ;
+
+def regraphictext (expr t) =
+ begingroup ;
+ save currentgraphictext ; numeric currentgraphictext ;
+ currentgraphictext := t ;
+ dofinishgraphictext
+enddef ;
+
+def dofinishgraphictext text x_op_x =
+ protectgraphicmacros ;
+ interim linecap := butt ; % normally rounded
+ interim linejoin := mitered ; % normally rounded
+ interim miterlimit := 10 ; % todo
+ let normalwithshade = withshade ;
+ save foundpicture, scratchpicture, str ;
+ save fill, draw, withshade, reversefill, outlinefill ;
+ numeric foundpicture ; picture scratchpicture ; string str ;
def draw expr p =
- addto scratchpicture doublepath p withpen currentpen ;
+ % the first, naive implementation was:
+ % addto scratchpicture doublepath p withpen currentpen ;
+ % but it is better to turn lines into fills
+ addto scratchpicture contour boundingbox
+ image (addto currentpicture doublepath p withpen currentpen) ;
enddef ;
def fill expr p =
addto scratchpicture contour p withpen currentpen ;
enddef ;
- def f_op_f = enddef ; boolean f_color ; f_color := false ;
- def d_op_d = enddef ; boolean d_color ; d_color := false ;
- def s_op_s = enddef ; boolean s_color ; s_color := false ;
- boolean reverse_fill ; reverse_fill := false ;
- boolean outline_fill ; outline_fill := false ;
- def reversefill =
- hide(reverse_fill := true )
- enddef ;
- def outlinefill =
- hide(outline_fill := true )
- enddef ;
+ def f_op_f = enddef ; boolean f_color ; f_color := false ;
+ def d_op_d = enddef ; boolean d_color ; d_color := false ;
+ def s_op_s = enddef ; boolean s_color ; s_color := false ;
+ boolean reverse_fill ; reverse_fill := false ;
+ boolean outline_fill ; outline_fill := false ;
+ def reversefill =
+ hide(reverse_fill := true )
+ enddef ;
+ def outlinefill =
+ hide(outline_fill := true )
+ enddef ;
def withshade primary c =
hide(def s_op_s = normalwithshade c enddef ; s_color := true )
enddef ;
@@ -156,53 +183,53 @@ def dographictext (expr t) text x_op_x =
enddef ;
scratchpicture := nullpicture ;
addto scratchpicture doublepath origin x_op_x ; % pre-roll
- for i within scratchpicture : % Below here is a dirty tricky test!
- if (urcorner dashpart i) = origin : outline_fill := false ; fi ;
- endfor ;
+ for i within scratchpicture : % Below here is a dirty tricky test!
+ if (urcorner dashpart i) = origin : outline_fill := false ; fi ;
+ endfor ;
scratchpicture := nullpicture ;
- readfile(jobname & ".mpy") ;
+ readfile(jobname & ".mpy") ;
scratchpicture := (scratchpicture shifted -llcorner scratchpicture) scaled (1/10) ;
- if not d_color and not f_color : d_color := true ; fi
- if s_color : d_color := false ; f_color := false ; fi ;
- if d_color and not reverse_fill :
- for i within scratchpicture :
- if f_color and outline_fill :
- addto currentpicture doublepath pathpart i _op_ x_op_x f_op_f
+ if not d_color and not f_color : d_color := true ; fi
+ if s_color : d_color := false ; f_color := false ; fi ;
+ if d_color and not reverse_fill :
+ for i within scratchpicture :
+ if f_color and outline_fill :
+ addto currentpicture doublepath pathpart i _op_ x_op_x f_op_f
dashed nullpicture ;
- fi ;
- if filled i :
+ fi ;
+ if filled i :
addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
- fi ;
+ fi ;
endfor ;
fi ;
- if f_color :
+ if f_color :
for i within scratchpicture :
- if filled i :
- addto currentpicture contour pathpart i _op_ x_op_x f_op_f
- withpen pencircle scaled 0 ;
- fi ;
+ if filled i :
+ addto currentpicture contour pathpart i _op_ x_op_x f_op_f
+ withpen pencircle scaled 0 ;
+ fi ;
endfor ;
fi ;
- if d_color and reverse_fill :
+ if d_color and reverse_fill :
for i within scratchpicture :
- if filled i :
+ if filled i :
addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
- fi ;
+ fi ;
endfor ;
fi ;
- if s_color :
+ if s_color :
for i within scratchpicture :
- if filled i :
+ if filled i :
addto currentpicture contour pathpart i _op_ x_op_x s_op_s ;
- fi ;
+ fi ;
endfor ;
- else :
+ else :
for i within scratchpicture :
- if stroked i :
+ if stroked i :
addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
- fi ;
+ fi ;
endfor ;
- fi ;
+ fi ;
endgroup ;
enddef ;
diff --git a/metapost/context/mp-page.mp b/metapost/context/mp-page.mp
index 7133ae6ff..285f84c41 100644
--- a/metapost/context/mp-page.mp
+++ b/metapost/context/mp-page.mp
@@ -27,6 +27,10 @@ if unknown OnRightPage :
boolean OnRightPage ; OnRightPage := true ;
fi ;
+if unknown InPageBody :
+ boolean InPageBody ; InPageBody := false ;
+fi ;
+
PageNumber := 0 ;
PaperHeight := 845.04684pt ;
PaperWidth := 597.50787pt ;
@@ -88,7 +92,7 @@ for VerPos=Top step 10 until Bottom:
Field[HorPos][VerPos] := origin--cycle ;
Field[VerPos][HorPos] := Field[HorPos][VerPos] ;
endfor ;
-endfor ;
+endfor ;
% def LoadPageState =
% scantokens "input mp-state.tmp" ;
@@ -201,6 +205,22 @@ def StopPage =
enddef ;
+def OverlayBox =
+ (unitsquare xyscaled (OverlayWidth,OverlayHeight))
+enddef ;
+
+% handy
+
+def innerenlarged =
+ hide(LoadPageState)
+ if OnRightPage : leftenlarged else : rightenlarged fi
+enddef ;
+
+def outerenlarged =
+ hide(LoadPageState)
+ if OnRightPage : rightenlarged else : leftenlarged fi
+enddef ;
+
% obsolete
def llEnlarged (expr p,d) = (llcorner p shifted (-d,-d)) enddef ;
diff --git a/metapost/context/mp-shap.mp b/metapost/context/mp-shap.mp
index f8bfd50cf..0f5fe431d 100644
--- a/metapost/context/mp-shap.mp
+++ b/metapost/context/mp-shap.mp
@@ -199,33 +199,33 @@ vardef some_shape_path (expr type) =
elseif type=59 :
border := mirror (ll--ulx--urx--lr--cycle) ;
- elseif type= 61 :
+ elseif type=61 :
border := normal (fullcircle scaled (1.5*yradius) xscaled (grid_height/grid_width)) ;
- elseif type= 62 :
+ elseif type=62 :
border := normal (fullcircle scaled (2.0*yradius) xscaled (grid_height/grid_width)) ;
- elseif type= 66 :
+ elseif type=66 :
border := normal (rc--origin shifted ( epsilon,0) --cycle &
rc--origin --cycle ) ;
- elseif type= 67 :
+ elseif type=67 :
border := normal (lc--origin shifted (-epsilon,0) --cycle &
lc--origin --cycle ) ;
- elseif type= 68 :
+ elseif type=68 :
border := normal (tc--origin shifted (0, epsilon) --cycle &
tc--origin --cycle ) ;
- elseif type= 69 :
+ elseif type=69 :
border := normal (bc--origin shifted (0,-epsilon) --cycle &
bc--origin --cycle ) ;
- elseif type= 75 :
+ elseif type=75 :
border := mirror (lly--lry--ury--uly--cycle) ;
- elseif type= 76 :
+ elseif type=76 :
border := mirror (ll--lr--ur--uly--cycle) ;
- elseif type= 77 :
+ elseif type=77 :
border := mirror (ll--lr--ury--ul--cycle) ;
- elseif type= 78 :
+ elseif type=78 :
border := mirror (lly--lr--ur--ul--cycle) ;
- elseif type= 79 :
+ elseif type=79 :
border := mirror (ll--lry--ur--ul--cycle) ;
else :
diff --git a/metapost/context/mp-spec.mp b/metapost/context/mp-spec.mp
index 918e73fb4..a8dfb96b6 100644
--- a/metapost/context/mp-spec.mp
+++ b/metapost/context/mp-spec.mp
@@ -11,8 +11,10 @@
%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
%C details.
-% (r,g,b) => cmyk: g=1, b=hash
-% => rest: g=n, b=whatever
+% (r,g,b) => cmyk : r=123 g= 1 b=hash
+% => transparent rgb : r=123 g= 2 b=hash
+% => transparent cmyk : r=123 g= 3 b=hash
+% => rest : r=123 g=n>10 b=whatever
%D This module is rather preliminary and subjected to
%D changes. Here we closely cooperates with the \METAPOST\
@@ -26,7 +28,7 @@ if known context_spec : endinput ; fi ;
boolean context_spec ; context_spec := true ;
numeric _special_counter_ ; _special_counter_ := 0 ;
-numeric _color_counter_ ; _color_counter_ := 0 ;
+numeric _color_counter_ ; _color_counter_ := 11 ; % < 10 reserved
numeric _special_signal_ ; _special_signal_ := 123 ;
%D When set to \type {true}, shading will be supported. Some
@@ -39,32 +41,49 @@ boolean _inline_specials_ ; _inline_specials_ := false ;
%D bookkeeping and collection of specials. At the cost of some
%D obscurity, we now have rather efficient resources.
-string _all_specials_ ; _all_specials_ := "" ;
+string _global_specials_ ; _global_specials_ := "" ;
+string _local_specials_ ; _local_specials_ := "" ;
-vardef add_special_signal =
- if (length _all_specials_>0) : % write the version number
+vardef add_special_signal = % write the version number
+ if (length _global_specials_>0) or (length _local_specials_ >0) :
special ("%%MetaPostSpecials: 1.0 " & decimal _special_signal_ ) ;
fi ;
enddef ;
vardef add_extra_specials =
- scantokens _all_specials_ ;
+ scantokens _global_specials_ ;
+ scantokens _local_specials_ ;
enddef ;
vardef reset_extra_specials =
- _all_specials_ := "" ;
+ % only local ones
+ _local_specials_ := "" ;
enddef ;
+boolean insidefigure ; insidefigure := false ;
+
+% todo: alleen als special gebruikt flush
+
+extra_beginfig :=
+ " insidefigure := true ; " &
+ " reset_extra_specials ; " &
+ extra_beginfig ;
+
extra_endfig :=
- " add_special_signal ; " &
- extra_endfig &
- " add_extra_specials ; " &
- " reset_extra_specials ; " ;
+ " add_special_signal ; " &
+ extra_endfig &
+ " add_extra_specials ; " &
+ " reset_extra_specials ; " &
+ " insidefigure := false ; " ;
+
+def _current_specials_ =
+ if insidefigure : _local_specials_ else : _global_specials_ fi
+enddef ;
def flush_special (expr typ, siz, dat) =
_special_counter_ := _special_counter_ + 1 ;
if _inline_specials_ :
- _all_specials_ := _all_specials_
+ _current_specials_ := _current_specials_
& "special "
& "(" & ditto
& dat & " "
@@ -74,7 +93,7 @@ def flush_special (expr typ, siz, dat) =
& " special"
& ditto & ");" ;
else :
- _all_specials_ := _all_specials_
+ _current_specials_ := _current_specials_
& "special "
& "(" & ditto
& "%%MetaPostSpecial: "
@@ -88,20 +107,20 @@ enddef ;
%D Shade allocation.
-vardef define_circular_shade (expr a, b, ra, rb, ca, cb) =
- flush_special(3, 17, "0 1 1" &
- dddecimal ca & ddecimal a & " " & decimal ra &
- dddecimal cb & ddecimal b & " " & decimal rb ) ;
- _special_counter_
-enddef ;
-
vardef define_linear_shade (expr a, b, ca, cb) =
- flush_special(2, 15, "0 1 1" &
+ flush_special(30, 15, "0 1 1" &
dddecimal ca & ddecimal a &
dddecimal cb & ddecimal b ) ;
_special_counter_
enddef ;
+vardef define_circular_shade (expr a, b, ra, rb, ca, cb) =
+ flush_special(31, 17, "0 1 1" &
+ dddecimal ca & ddecimal a & " " & decimal ra &
+ dddecimal cb & ddecimal b & " " & decimal rb ) ;
+ _special_counter_
+enddef ;
+
%D A few predefined shading macros.
boolean trace_shades ; trace_shades := false ;
@@ -121,6 +140,16 @@ def linear_shade (expr p, n, ca, cb) =
endgroup ;
enddef ;
+vardef predefined_linear_shade (expr p, n, ca, cb) =
+ save a, b, sh ; pair a, b ;
+ if (n=1) : a := llcorner p ; b := urcorner p ;
+ elseif (n=2) : a := llcorner p ; b := ulcorner p ;
+ elseif (n=3) : a := lrcorner p ; b := ulcorner p ;
+ else : a := llcorner p ; b := lrcorner p ;
+ fi ;
+ define_linear_shade (a,b,ca,cb)
+enddef ;
+
def circular_shade (expr p, n, ca, cb) =
begingroup ;
save ab, r ; pair ab ; numeric r ;
@@ -139,6 +168,19 @@ def circular_shade (expr p, n, ca, cb) =
endgroup ;
enddef ;
+vardef predefined_circular_shade (expr p, n, ca, cb) =
+ save ab, r ; pair ab ; numeric r ;
+ r := (xpart lrcorner p - xpart llcorner p) ++
+ (ypart urcorner p - ypart lrcorner p) ;
+ if (n=1) : ab := llcorner p ;
+ elseif (n=2) : ab := lrcorner p ;
+ elseif (n=3) : ab := urcorner p ;
+ elseif (n=4) : ab := ulcorner p ;
+ else : ab := center p ; r := .5r ;
+ fi ;
+ define_circular_shade(ab,ab,0,r,ca,cb)
+enddef ;
+
%D Since a \type {fill p withshade s} syntax looks better
%D than some macro, we implement a new primary.
@@ -149,7 +191,7 @@ enddef ;
%D Figure inclusion.
-numeric cef ; cef := 0 ;
+%numeric cef ; cef := 0 ;
def externalfigure primary filename =
doexternalfigure (filename)
@@ -163,15 +205,15 @@ def doexternalfigure (expr filename) text transformation =
dddecimal (yypart t, xpart t, ypart t) & " " & filename) ;
addto p contour unitsquare scaled 0 ;
setbounds p to unitsquare transformed t ;
-% _color_counter_ := _color_counter_ + 1 ; cef := cef + 1 ;
-% draw p withcolor (_special_signal_/1000,_color_counter_/1000,cef/1000) ;
-draw p withcolor (_special_signal_/1000,cef/1000,_special_counter_/1000) ;
+ _color_counter_ := _color_counter_ + 1 ;
+ draw p withcolor (_special_signal_/1000,_color_counter_/1000,_special_counter_/1000) ;
+%draw p withcolor (_special_signal_/1000,cef/1000,_special_counter_/1000) ;
endgroup ;
enddef ;
%D Experimental:
-numeric currenthyperlink ; currenthyperlink := 0 ;
+%numeric currenthyperlink ; currenthyperlink := 0 ;
def hyperlink primary t = dohyperlink(t) enddef ;
def hyperpath primary t = dohyperpath(t) enddef ;
@@ -188,11 +230,11 @@ def dohyperpath (expr destination) expr somepath =
flush_special(20, 7,
ddecimal (xpart llcorner somepath, ypart llcorner somepath) & " " &
ddecimal (xpart urcorner somepath, ypart urcorner somepath) & " " & destination) ;
- currenthyperlink := currenthyperlink + 1 ;
-% _color_counter_ := _color_counter_ + 1 ;
+% currenthyperlink := currenthyperlink + 1 ;
+ _color_counter_ := _color_counter_ + 1 ;
fill boundingbox unitsquare scaled 0 withcolor
-% (_special_signal_/1000,_color_counter_/1000,currenthyperlink/1000) ;
- (_special_signal_/1000,currenthyperlink/1000,_special_counter_/1000) ;
+ (_special_signal_/1000,_color_counter_/1000,_special_counter_/1000) ;
+% (_special_signal_/1000,currenthyperlink/1000,_special_counter_/1000) ;
endgroup ;
enddef ;
@@ -241,24 +283,121 @@ enddef ;
resetcmykcolors ; boolean cmykcolors ; cmykcolors := false ; % true
+% vardef cmyk(expr c,m,y,k) =
+% if cmykcolors :
+% if not known cmykcolorhash[c][m][y][k] :
+% _cmyk_counter_ := _cmyk_counter_ + 1 ;
+% cmykcolorhash[c][m][y][k] := _cmyk_counter_ ;
+% flush_special(1, 7,
+% decimal _cmyk_counter_ & " " &
+% decimal c & " " &
+% decimal m & " " &
+% decimal y & " " &
+% decimal k) ;
+% fi
+% (_special_signal_/1000,1/1000,cmykcolorhash[c][m][y][k]/1000)
+% else :
+% (1-c-k,1-m-k,1-y-k)
+% fi
+% enddef ;
+
+string cmykcolorpattern[] ; % needed for transparancies
+
vardef cmyk(expr c,m,y,k) =
if cmykcolors :
- if not known cmykcolorhash[c][m][y][k] :
+ save ok ; boolean ok ;
+ if unknown cmykcolorhash[c][m][y][k] :
+ ok := false ; % not yet defined
+ elseif cmykcolorhash[c][m][y][k] = -1 :
+ ok := false ; % locally defined and undefined
+ else :
+ ok := true ; % globally already defined
+ fi ;
+ if not ok :
+ save s ; string s ; s := dddecimal (c,m,y) & " " & decimal k ;
_cmyk_counter_ := _cmyk_counter_ + 1 ;
+ cmykcolorpattern[_cmyk_counter_/1000] := s ;
cmykcolorhash[c][m][y][k] := _cmyk_counter_ ;
- flush_special(1, 7,
- decimal _cmyk_counter_ & " " &
- decimal c & " " &
- decimal m & " " &
- decimal y & " " &
- decimal k) ;
- fi
+ flush_special(1, 7, decimal _cmyk_counter_ & " " & s) ;
+ _local_specials_ := _local_specials_ &
+ " cmykcolorhash[" & decimal c & "][" & decimal m &
+ "][" & decimal y & "][" & decimal k & "] := -1 ; " ;
+ fi ;
(_special_signal_/1000,1/1000,cmykcolorhash[c][m][y][k]/1000)
else :
(1-c-k,1-m-k,1-y-k)
fi
enddef ;
+% newcolor truecyan, truemagenta, trueyellow ;
+%
+% truecyan = cmyk (1,0,0,0) ;
+% truemagenta = cmyk (0,1,0,0) ;
+% trueyellow = cmyk (0,0,1,0) ;
+
+%D Transparency
+
+normaltransparent := 1 ; multiplytransparent := 2 ;
+screentransparent := 3 ; overlaytransparent := 4 ;
+softlighttransparent := 5 ; hardlighttransparent := 6 ;
+colordodgetransparent := 7 ; colorburntransparent := 8 ;
+darkentransparent := 9 ; lightentransparent := 10 ;
+differencetransparent := 11 ; exclusiontransparent := 12 ;
+
+% nottransparent := 0 ;
+% compatibletransparent := 99 ;
+
+% fill fullcircle scaled 10cm withcolor transparant(.8,3,color) ;
+
+vardef transparent(expr n, t, c) =
+ save s, ss, nn, cc, is_cmyk, ok ;
+ string s, ss ; numeric nn ; color cc ; boolean is_cmyk, ok ;
+ % transparancy type
+ if string n :
+ if expandafter known scantokens(n&"transparent") :
+ nn := scantokens(n&"transparent") ;
+ else :
+ nn := 0 ;
+ fi
+ else : % nn := min(n,13)
+ nn := if n<13 : n else : nn := 0 fi ;
+ fi ;
+ % we need to expand the color (can be cmyk(..) or predefined)
+ cc := c ; % expand color
+ % check for cmyk special
+ is_cmyk := (redpart cc = _special_signal_/1000)
+ and (greenpart cc = 1/1000) ;
+ % build special string, fetch cmyk components
+ s := decimal nn & " " & decimal t & " " & if is_cmyk :
+ cmykcolorpattern[bluepart cc] else : dddecimal cc fi ;
+ % check if this one is already used
+ ss := "tr_" & s ;
+ % efficiency hack
+ if expandafter unknown scantokens(ss) :
+ ok := false ; % not yet defined
+ elseif scantokens(ss) < 0 :
+ ok := false ; % locally defined and undefined
+ else :
+ ok := true ; % globally already defined
+ fi ;
+ if not ok :
+ if is_cmyk :
+ flush_special(3, 8, s) ;
+ else :
+ flush_special(2, 7, s) ;
+ fi ;
+ scantokens(ss) := _special_counter_ ;
+ _local_specials_ := _local_specials_ &
+ "scantokens(" & ditto & ss & ditto & ") := -1 ;" ;
+ fi ;
+ % go ahead
+ if is_cmyk :
+ (_special_signal_/1000,3/1000,scantokens(ss)/1000)
+ else :
+ (_special_signal_/1000,2/1000,scantokens(ss)/1000)
+ fi
+enddef ;
+
%D Basic position tracking:
def register (expr label, width, height, offset) =
diff --git a/metapost/context/mp-text.mp b/metapost/context/mp-text.mp
index c08bac5ff..cb6bb3895 100644
--- a/metapost/context/mp-text.mp
+++ b/metapost/context/mp-text.mp
@@ -28,23 +28,71 @@ fi ;
numeric textextoffset ; textextoffset := 0 ;
+% vardef textext@#(expr txt) =
+% interim labeloffset := textextoffset ;
+% noftexpictures := noftexpictures + 1 ;
+% if string txt :
+% write "% figure " & decimal charcode & " : " &
+% "texpictures[" & decimal noftexpictures & "] := btex " &
+% txt & " etex ;" to jobname & ".mpt" ;
+% if unknown texpictures[noftexpictures] :
+% thelabel@#("unknown",origin)
+% else :
+% thelabel@#(texpictures[noftexpictures],origin)
+% fi
+% else :
+% thelabel@#(txt,origin)
+% fi
+% enddef ;
+
+boolean hobbiestextext ; hobbiestextext := false ;
+
vardef textext@#(expr txt) =
interim labeloffset := textextoffset ;
noftexpictures := noftexpictures + 1 ;
if string txt :
- write "% figure " & decimal charcode & " : " &
- "texpictures[" & decimal noftexpictures & "] := btex " &
- txt & " etex ;" to jobname & ".mpt" ;
- if unknown texpictures[noftexpictures] :
- thelabel@#("unknown",origin)
+ if hobbiestextext : % the tex.mp method as fallback (see tex.mp)
+ write "btex " & txt & " etex" to "mptextmp.mp" ;
+ write EOF to "mptextmp.mp" ;
+ scantokens "input mptextmp"
else :
- thelabel@#(texpictures[noftexpictures],origin)
- fi
+ write "% figure " & decimal charcode & " : " &
+ "texpictures[" & decimal noftexpictures & "] := btex " &
+ txt & " etex ;" to jobname & ".mpt" ;
+ if unknown texpictures[noftexpictures] :
+ thelabel@#("unknown",origin)
+ else :
+ thelabel@#(texpictures[noftexpictures],origin)
+ fi
+ fi
else :
thelabel@#(txt,origin)
fi
enddef ;
+string laboff_ ; laboff_ := "" ;
+string laboff_c ; laboff_c := "" ;
+string laboff_l ; laboff_l := ".lft" ;
+string laboff_r ; laboff_r := ".rt" ;
+string laboff_b ; laboff_b := ".bot" ;
+string laboff_t ; laboff_t := ".top" ;
+string laboff_lt ; laboff_lt := ".ulft" ;
+string laboff_rt ; laboff_rt := ".urt" ;
+string laboff_lb ; laboff_lb := ".llft" ;
+string laboff_rb ; laboff_rb := ".lrt" ;
+string laboff_tl ; laboff_tl := ".ulft" ;
+string laboff_tr ; laboff_tr := ".urt" ;
+string laboff_bl ; laboff_bl := ".llft" ;
+string laboff_br ; laboff_br := ".lrt" ;
+
+vardef textextstr(expr s, a) =
+ save ss ; string ss ;
+ ss := "laboff_" & a ;
+ ss := scantokens ss ;
+ ss := "textext" & ss & "(" & ditto & s & ditto & ")" ;
+ scantokens ss
+enddef ;
+
pair laboff.origin ; laboff.origin = (infinity,infinity) ;
pair laboff.raw ; laboff.raw = (infinity,infinity) ;
diff --git a/metapost/context/mp-tool.mp b/metapost/context/mp-tool.mp
index 59988d5f3..d259a240c 100644
--- a/metapost/context/mp-tool.mp
+++ b/metapost/context/mp-tool.mp
@@ -12,6 +12,7 @@
%C details.
% a cleanup is needed, like using image and alike
+% use a few more "newinternal"'s
%D This module is rather preliminary and subjected to
%D changes.
@@ -57,6 +58,8 @@ string semicolor ; semicolor := char 59 ;
% When somehow the first one gets no HiRes, then make sure
% that the format matches the mem sizes in the config file.
+% eerste " " er uit
+
vardef ddecimal primary p =
" " & decimal xpart p &
" " & decimal ypart p
@@ -185,10 +188,11 @@ def pop_boundingbox text p =
enddef;
vardef boundingbox primary p =
- llcorner p --
- lrcorner p --
- urcorner p --
- ulcorner p -- cycle
+ if (path p) or (picture p) :
+ llcorner p -- lrcorner p -- urcorner p -- ulcorner p
+ else :
+ origin
+ fi -- cycle
enddef;
vardef inner_boundingbox primary p =
@@ -219,18 +223,44 @@ enddef;
%D Some missing functions can be implemented rather
%D straightforward:
-def tand (expr x) = (sind(x)/cosd(x)) enddef ;
+numeric Pi ; Pi := 3.1415926 ;
+
def sqr (expr x) = (x*x) enddef ;
def log (expr x) = (if x=0: 0 else: mlog(x)/mlog(10) fi) enddef ;
def ln (expr x) = (if x=0: 0 else: mlog(x)/256 fi) enddef ;
def exp (expr x) = ((mexp 256)**x) enddef ;
-def pow (expr x) = (x**power) enddef ;
def inv (expr x) = (if x=0: 0 else: x**-1 fi) enddef ;
+
+def pow (expr x,p) = (x**p) enddef ;
+
def asin (expr x) = (x+(x**3)/6+3(x**5)/40) enddef ;
def acos (expr x) = (asin(-x)) enddef ;
def atan (expr x) = (x-(x**3)/3+(x**5)/5-(x**7)/7) enddef ;
+def tand (expr x) = (sind(x)/cosd(x)) enddef ;
+
+%D Here are Taco Hoekwater's alternatives:
+
+pi := 3.1415926 ; radian := 180/pi ; % 2pi*radian = 360 ;
+
+def tand (expr x) = (sind(x)/cosd(x)) enddef ;
+def cotd (expr x) = (cosd(x)/sind(x)) enddef ;
+
+def sin (expr x) = (sind(x*radian)) enddef ;
+def cos (expr x) = (cosd(x*radian)) enddef ;
+def tan (expr x) = (sin(x)/cos(x)) enddef ;
+def cot (expr x) = (cos(x)/sin(x)) enddef ;
+
+def asin (expr x) = angle((1+-+x,x)) enddef ;
+def acos (expr x) = angle((x,1+-+x)) enddef ;
-numeric Pi ; Pi := 3.14159 ;
+def invsin (expr x) = ((asin(x))/radian) enddef ;
+def invcos (expr x) = ((acos(x))/radian) enddef ;
+
+def acosh (expr x) = ln(x+(x+-+1)) enddef ;
+def asinh (expr x) = ln(x+(x++1)) enddef ;
+
+vardef sinh primary x = save xx ; xx = exp xx ; (xx-1/xx)/2 enddef ;
+vardef cosh primary x = save xx ; xx = exp xx ; (xx+1/xx)/2 enddef ;
%D We provide two macros for drawing stripes across a shape.
%D The first method (with the n suffix) uses another method,
@@ -376,17 +406,22 @@ enddef;
% TODO TODO TODO TODO, not yet ok
primarydef p xsized w =
- (p if bbwidth(p)>0 : scaled (w/bbwidth(p)) fi)
+ (p if (bbwidth (p)>0) and (w>0) : scaled (w/bbwidth (p)) fi)
enddef ;
primarydef p ysized h =
- (p if bbheight(p)>0 : scaled (h/bbheight(p)) fi)
+ (p if (bbheight(p)>0) and (h>0) : scaled (h/bbheight(p)) fi)
enddef ;
-primarydef p xysized wh =
- (p if (bbwidth(p)>0) and (bbheight(p)>0) :
- xscaled (xpart wh/bbwidth(p)) yscaled (ypart wh/bbheight(p))
- fi)
+primarydef p xysized s =
+ begingroup ;
+ save wh, w, h ; pair wh ; numeric w, h ;
+ wh := paired (s) ; w := bbwidth(p) ; h := bbheight(p) ;
+ (p if (w>0) and (h>0) :
+ if xpart wh > 0 : xscaled (xpart wh/w) fi
+ if ypart wh > 0 : yscaled (ypart wh/h) fi
+ fi)
+ endgroup
enddef ;
primarydef p sized wh =
@@ -447,10 +482,24 @@ path unitdiamond, fulldiamond ;
unitdiamond := (.5,0)--(1,.5)--(.5,1)--(0,.5)--cycle ;
fulldiamond := unitdiamond shifted - center unitdiamond ;
-%D shorter
+%D More robust:
+
+% let normalscaled = scaled ;
+% let normalxscaled = xscaled ;
+% let normalyscaled = yscaled ;
+%
+% def scaled expr s = normalscaled (s) enddef ;
+% def xscaled expr s = normalxscaled (s) enddef ;
+% def yscaled expr s = normalyscaled (s) enddef ;
+
+%D Shorter
primarydef p xyscaled q =
- p xscaled (xpart paired(q)) yscaled (ypart paired(q))
+ begingroup ; save qq ; pair qq ; qq = paired(q) ;
+ ( p
+ if xpart qq<>0 : xscaled (xpart qq) fi
+ if ypart qq<>0 : yscaled (ypart qq) fi )
+ endgroup
enddef ;
%D Experimenteel, zie folder-3.tex.
@@ -594,16 +643,9 @@ vardef paired (expr d) =
if pair d : d else : (d,d) fi
enddef ;
-%primarydef p enlarged d =
-% begingroup ; save dd ; pair dd ;
-% dd := if pair d : d else : (d,d) fi ;
-% (llcorner p shifted (-xpart dd,-ypart dd) --
-% lrcorner p shifted (+xpart dd,-ypart dd) --
-% urcorner p shifted (+xpart dd,+ypart dd) --
-% ulcorner p shifted (-xpart dd,+ypart dd) --
-% cycle)
-% endgroup
-%enddef;
+vardef tripled (expr d) =
+ if color d : d else : (d,d,d) fi
+enddef ;
primarydef p enlarged d =
(p llmoved d -- p lrmoved d -- p urmoved d -- p ulmoved d -- cycle)
@@ -642,25 +684,32 @@ primarydef p ulmoved d =
enddef ;
primarydef p leftenlarged d =
- (llcorner p shifted (-d,0) -- lrcorner p --
- urcorner p -- ulcorner p shifted (-d,0) -- cycle)
+ ((llcorner p) shifted (-d,0) -- lrcorner p --
+ urcorner p -- (ulcorner p) shifted (-d,0) -- cycle)
enddef ;
primarydef p rightenlarged d =
- (llcorner p -- lrcorner p shifted (d,0) --
- urcorner p shifted (d,0) -- ulcorner p -- cycle)
+ (llcorner p -- (lrcorner p) shifted (d,0) --
+ (urcorner p) shifted (d,0) -- ulcorner p -- cycle)
enddef ;
primarydef p topenlarged d =
(llcorner p -- lrcorner p --
- urcorner p shifted (0,-d) -- ulcorner p shifted (0,-d) -- cycle)
+ (urcorner p) shifted (0,d) -- (ulcorner p) shifted (0,d) -- cycle)
enddef ;
primarydef p bottomenlarged d =
- (llcorner p shifted (0,d) -- lrcorner p shifted (0,d) --
+ (llcorner p shifted (0,-d) -- lrcorner p shifted (0,-d) --
urcorner p -- ulcorner p -- cycle)
enddef ;
+%D Saves typing:
+
+vardef bottomboundary primary p = (llcorner p -- lrcorner p) enddef ;
+vardef rightboundary primary p = (lrcorner p -- urcorner p) enddef ;
+vardef topboundary primary p = (urcorner p -- ulcorner p) enddef ;
+vardef leftboundary primary p = (ulcorner p -- llcorner p) enddef ;
+
%D Nice too:
primarydef p superellipsed s =
@@ -709,7 +758,11 @@ primarydef p randomized s =
elseif pair p :
p randomshifted s
elseif color p :
- if pair s :
+ if color s :
+ (uniformdeviate redpart s * redpart p,
+ uniformdeviate greenpart s * greenpart p,
+ uniformdeviate bluepart s * bluepart p)
+ elseif pair s :
((xpart s + uniformdeviate (ypart s - xpart s)) * p)
else :
(uniformdeviate s * p)
@@ -719,6 +772,68 @@ primarydef p randomized s =
fi)
enddef ;
+%D Not perfect (alternative for interpath)
+
+vardef interpolated(expr s, p, q) =
+ save m ; m := max(length(p),length(q)) ;
+ (if path p :
+ for i=0 upto m-1 :
+ s[point (i /m) along p,
+ point (i /m) along q] .. controls
+ s[postcontrol (i /m) along p,
+ postcontrol (i /m) along q] and
+ s[precontrol ((i+1)/m) along p,
+ precontrol ((i+1)/m) along q] ..
+ endfor
+ if cycle p :
+ cycle
+ else :
+ s[point infinity of p,
+ point infinity of q]
+ fi
+ else :
+ a[p,q]
+ fi)
+enddef ;
+
+%D Interesting too:
+
+% primarydef p parallel s =
+% begingroup ; save q, b ; path q ; numeric b ;
+% b := xpart (lrcorner p - llcorner p) ;
+% q := p if b>0 : scaled ((b+2s)/b) fi ;
+% (q shifted (center p-center q))
+% endgroup
+% enddef ;
+
+%primarydef p parallel s =
+% begingroup ; save q, w,h ; path q ; numeric w, h ;
+% w := bbwidth(p) ; h := bbheight(p) ;
+% q := p if (w>0) and (h>0) :
+% xyscaled ((w+2*xpart paired(s))/w,(h+2*ypart paired(s))/h) fi ;
+% (q shifted (center p-center q))
+% endgroup
+%enddef ;
+
+vardef punked primary p =
+ (point 0 of p for i=1 upto length(p)-1 : -- point i of p endfor
+ if cycle p : -- cycle else : -- point length(p) of p fi)
+enddef ;
+
+vardef curved primary p =
+ (point 0 of p for i=1 upto length(p)-1 : .. point i of p endfor
+ if cycle p : .. cycle else : .. point length(p) of p fi)
+enddef ;
+
+primarydef p blownup s =
+ begingroup
+ save _p_ ; path _p_ ; _p_ := p xysized
+ (bbwidth (p)+2(xpart paired(s)),
+ bbheight(p)+2(ypart paired(s))) ;
+ (_p_ shifted (center p - center _p_))
+ endgroup
+enddef ;
+
%D Rather fundamental.
% vardef rightpath expr p =
@@ -774,13 +889,17 @@ def draworiginoptions (text t) = def _ori_opt_ = t enddef ; enddef ;
def drawboundoptions (text t) = def _bnd_opt_ = t enddef ; enddef ;
def drawpathoptions (text t) = def _pth_opt_ = t enddef ; enddef ;
-drawlineoptions (withpen pencircle scaled 1 withcolor .5white) ;
-drawpointoptions (withpen pencircle scaled 4 withcolor black) ;
-drawcontroloptions(withpen pencircle scaled 2.5 withcolor black) ;
-drawlabeloptions () ;
-draworiginoptions (withpen pencircle scaled 1 withcolor .5white) ;
-drawboundoptions (dashed evenly _ori_opt_) ;
-drawpathoptions (withpen pencircle scaled 5 withcolor .8white) ;
+def resetdrawoptions =
+ drawlineoptions (withpen pencircle scaled 1pt withcolor .5white) ;
+ drawpointoptions (withpen pencircle scaled 4pt withcolor black) ;
+ drawcontroloptions(withpen pencircle scaled 2.5pt withcolor black) ;
+ drawlabeloptions () ;
+ draworiginoptions (withpen pencircle scaled 1pt withcolor .5white) ;
+ drawboundoptions (dashed evenly _ori_opt_) ;
+ drawpathoptions (withpen pencircle scaled 5pt withcolor .8white) ;
+enddef ;
+
+resetdrawoptions ;
%D Path.
@@ -1062,10 +1181,17 @@ enddef ;
% this cuts of a piece from both ends
+% tertiarydef pat cutends len =
+% begingroup ; save tap ; path tap ;
+% tap := pat cutbefore (point len on pat) ;
+% (tap cutafter (point -len on tap))
+% endgroup
+% enddef ;
+
tertiarydef pat cutends len =
begingroup ; save tap ; path tap ;
- tap := pat cutbefore (point len on pat) ;
- (tap cutafter (point -len on tap))
+ tap := pat cutbefore (point (xpart paired(len)) on pat) ;
+ (tap cutafter (point -(ypart paired(len)) on tap))
endgroup
enddef ;
@@ -1105,7 +1231,7 @@ vardef thefreelabel (expr str, loc, ori) =
q := freesquare xyscaled (urcorner s - llcorner s) ;
l := point xpart (p intersectiontimes (ori--loc shifted (loc-ori))) of q ;
setbounds s to boundingbox s enlarged -freelabeloffset ; % new
- draw boundingbox s shifted -l withpen pencircle scaled .5pt withcolor red ;
+ %draw boundingbox s shifted -l withpen pencircle scaled .5pt withcolor red ;
(s shifted -l)
enddef ;
@@ -1215,9 +1341,9 @@ def pushcurrentpicture =
currentpicture := nullpicture ;
enddef ;
-def popcurrentpicture =
+def popcurrentpicture text t = % optional text
if currentpicturedepth > 0 :
- addto currentpicturestack[currentpicturedepth] also currentpicture ;
+ addto currentpicturestack[currentpicturedepth] also currentpicture t ;
currentpicture := currentpicturestack[currentpicturedepth] ;
currentpicturedepth := currentpicturedepth - 1 ;
fi ;
@@ -1321,13 +1447,13 @@ vardef colorcircle (expr size, red, green, blue) =
pushcurrentpicture ;
- fill r withcolor red ;
- fill g withcolor green ;
- fill b withcolor blue ;
+ fill r withcolor red ;
+ fill g withcolor green ;
+ fill b withcolor blue ;
fill c withcolor white-red ;
fill m withcolor white-green ;
fill y withcolor white-blue ;
- fill w withcolor white ;
+ fill w withcolor white ;
for i = r,g,b,c,m,y : draw i withcolor .5white ; endfor ;
@@ -1346,19 +1472,53 @@ enddef ;
% nice: currentpicture := inverted currentpicture ;
-vardef inverted expr p =
- save pp ; picture pp ; pp := nullpicture ;
- for i within p :
- addto pp
- if stroked i or filled i :
- if filled i : contour else : doublepath fi pathpart i
- dashed dashpart i withpen penpart i
- else :
- also i
- fi
- withcolor white-(redpart i, greenpart i, bluepart i) ;
- endfor ;
- pp
+primarydef p uncolored c =
+ image
+ (for i within p :
+ addto currentpicture
+ if stroked i or filled i :
+ if filled i : contour else : doublepath fi pathpart i
+ dashed dashpart i withpen penpart i
+ else :
+ also i
+ fi
+ withcolor c-(redpart i, greenpart i, bluepart i) ;
+ endfor ; )
+enddef ;
+
+vardef inverted primary p =
+ (p uncolored white)
+enddef ;
+
+primarydef p softened c =
+ image
+ (save cc ; color cc ; cc := tripled(c) ;
+ for i within p :
+ addto currentpicture
+ if stroked i or filled i :
+ if filled i : contour else : doublepath fi pathpart i
+ dashed dashpart i withpen penpart i
+ else :
+ also i
+ fi
+ withcolor (redpart cc * redpart i,
+ greenpart cc * greenpart i,
+ bluepart cc * bluepart i) ;
+ endfor ;)
+enddef ;
+
+vardef grayed primary p =
+ image
+ (for i within p :
+ addto currentpicture
+ if stroked i or filled i :
+ if filled i : contour else : doublepath fi pathpart i
+ dashed dashpart i withpen penpart i
+ else :
+ also i
+ fi
+ withcolor tripled(.30redpart i+.59greenpart i+.11bluepart i) ;
+ endfor ; )
enddef ;
% yes or no: "text" infont "cmr12" at 24pt ;
@@ -1386,7 +1546,8 @@ def condition primary b = if b : "true" else : "false" fi enddef ;
primarydef p stretched s =
begingroup
- save pp ; path pp ; pp := p scaled s ;
+% save pp ; path pp ; pp := p scaled s ;
+ save pp ; path pp ; pp := p xyscaled s ;
(pp shifted ((point 0 of p) - (point 0 of pp)))
endgroup
enddef ;
@@ -1401,10 +1562,15 @@ def yshifted expr dy = shifted(0,dy) enddef ;
% right: str = readfrom ("abc" & ".def" ) ;
% wrong: str = readfrom "abc" & ".def" ;
+% Every 62th read fails so we need to try again!
+
def readfile (expr name) =
if (readfrom (name) <> EOF) :
- scantokens("input " & name & " ")
+ scantokens("input " & name & " ") ;
+ elseif (readfrom (name) <> EOF) :
+ scantokens("input " & name & " ") ;
fi
+ closefrom (name) ;
enddef ;
% permits redefinition of end in macro
@@ -1413,17 +1579,28 @@ inner end ;
% real fun
+let normalwithcolor = withcolor ;
+
+def remapcolors =
+ def withcolor primary c = normalwithcolor remappedcolor(c) enddef ;
+enddef ;
+
+def normalcolors =
+ let withcolor = normalwithcolor ;
+enddef ;
+
def resetcolormap =
color color_map[][][] ;
+ normalcolors ;
enddef ;
resetcolormap ;
-%color_map_resolution := 1000 ;
+% color_map_resolution := 1000 ;
%
-%def r_color primary c = round(color_map_resolution*redpart c) enddef ;
-%def g_color primary c = round(color_map_resolution*greenpart c) enddef ;
-%def b_color primary c = round(color_map_resolution*bluepart c) enddef ;
+% def r_color primary c = round(color_map_resolution*redpart c) enddef ;
+% def g_color primary c = round(color_map_resolution*greenpart c) enddef ;
+% def b_color primary c = round(color_map_resolution*bluepart c) enddef ;
def r_color primary c = redpart c enddef ;
def g_color primary c = greenpart c enddef ;
@@ -1441,21 +1618,13 @@ def remappedcolor(expr c) =
fi
enddef ;
-let normalwithcolor = withcolor ;
-
-def remapcolors =
- def withcolor primary c = normalwithcolor remappedcolor(c) enddef ;
-enddef ;
-
-def normalcolors =
- let withcolor = normalwithcolor ;
-enddef ;
-
def refill suffix c = do_repath (1) (c) enddef ;
def redraw suffix c = do_repath (2) (c) enddef ;
def recolor suffix c = do_repath (0) (c) enddef ;
-def do_repath (expr mode) (suffix c) text t =
+color refillbackground ; refillbackground := (1,1,1) ;
+
+def do_repath (expr mode) (suffix c) text t = % can it be stroked and filled at the same time ?
begingroup ;
if mode=0 : save withcolor ; remapcolors ; fi ;
save _c_, _f_, _b_ ; picture _c_ ; color _f_ ; path _b_ ;
@@ -1469,12 +1638,12 @@ def do_repath (expr mode) (suffix c) text t =
elseif stroked i :
addto c doublepath pathpart i
dashed dashpart i withpen penpart i
- withcolor (redpart i, greenpart i, bluepart i)
+ withcolor _f_ % (redpart i, greenpart i, bluepart i)
if mode=2 : t fi ;
elseif filled i :
addto c contour pathpart i
- withcolor (redpart i, greenpart i, bluepart i)
- if mode=1 : t if _f_ = background : withcolor background fi fi ;
+ withcolor _f_
+ if (mode=1) and (_f_<>refillbackground) : t fi ;
fi ;
endfor ;
setbounds c to _b_ ;
@@ -1586,25 +1755,26 @@ vardef dostraightened(expr sign, p) =
pp := pp -- point i of p ;
fi ;
endfor ;
- save n ; numeric n ;
- n := length(pp) ;
+ save n, ok ; numeric n ; boolean ok ;
+ n := length(pp) ; ok := false ;
for i=0 upto n : % evt hier ook round
- if unitvector(point i of pp -
- point if i=0 : n else : i-1 fi of pp) <>
- sign * unitvector(point if i=n : 0 else : i+1 fi of pp -
- point i of pp) :
- point i of pp --
- fi
-%
-% to test:
-%
-% if round(unitvector(point i of pp)) <>
-% sign * round(unitvector(point if i=n : 0 else : i+1 fi of pp)) :
-% point i of pp --
-% fi
-%
+
+%% if unitvector(point i of pp -
+%% point if i=0 : n else : i-1 fi of pp) <>
+%% sign * unitvector(point if i=n : 0 else : i+1 fi of pp -
+%% point i of pp) :
+%% if ok : -- else : hide ( ok := true ; ) fi point i of pp
+%% fi
+
+ if unitvector(round(point i of pp -
+ point if i=0 : n else : i-1 fi of pp)) <>
+ sign * unitvector(round(point if i=n : 0 else : i+1 fi of pp -
+ point i of pp)) :
+ if ok : -- else : ok := true ; fi point i of pp
+ fi
+
endfor
- cycle
+ if ok and (cycle p) : -- cycle fi
else :
p
fi
@@ -1645,6 +1815,96 @@ vardef anchored@#(expr p, z) =
+ (1-labxf@#-labyf@#)*llcorner p))
enddef ;
+% epsed(1.2345)
+
+vardef epsed (expr e) =
+ e if e>0 : + eps elseif e<0 : - eps fi
+enddef ;
+
+% handy
+
+def withgray primary g =
+ withcolor (g,g,g)
+enddef ;
+
+% for metafun
+
+if unknown darkred : color darkred ; darkred := .625(1,0,0) fi ;
+if unknown darkyellow : color darkyellow ; darkyellow := .625(1,1,0) fi ;
+if unknown darkgray : color darkgray ; darkgray := .625(1,1,1) fi ;
+if unknown lightgray : color lightgray ; lightgray := .875(1,1,1) fi ;
+
+% an improeved plain mp macro
+
+vardef center primary p =
+ if pair p : p else : .5[llcorner p, urcorner p] fi
+enddef;
+
+% new, yet undocumented
+
+vardef rangepath (expr p, d, a) =
+ (if length p>0 :
+ (d*unitvector(direction 0 of p) rotated a)
+ shifted point 0 of p
+ -- p --
+ (d*unitvector(direction length(p) of p) rotated a)
+ shifted point length(p) of p
+ else :
+ p
+ fi)
+enddef ;
+
+% under construction
+
+vardef straightpath(expr a, b, method) =
+ if (method<1) or (method>6) :
+ (a--b)
+ elseif method = 1 :
+ (a --
+ if xpart a > xpart b :
+ if ypart a > ypart b :
+ (xpart b,ypart a) --
+ elseif ypart a < ypart b :
+ (xpart a,ypart b) --
+ fi
+ elseif xpart a < xpart b :
+ if ypart a > ypart b :
+ (xpart a,ypart b) --
+ elseif ypart a < ypart b :
+ (xpart b,ypart a) --
+ fi
+ fi
+ b)
+ elseif method = 3 :
+ (a --
+ if xpart a > xpart b :
+ (xpart b,ypart a) --
+ elseif xpart a < xpart b :
+ (xpart a,ypart b) --
+ fi
+ b)
+ elseif method = 5 :
+ (a --
+ if ypart a > ypart b :
+ (xpart b,ypart a) --
+ elseif ypart a < ypart b :
+ (xpart a,ypart b) --
+ fi
+ b)
+ else :
+ (reverse straightpath(b,a,method-1))
+ fi
+enddef ;
+
+% handy for myself
+
+def addbackground text t =
+ begingroup ; save p ; picture p ;
+ p := currentpicture ; currentpicture := nullpicture ;
+ fill boundingbox p t ; draw p ;
+ endgroup ;
+enddef ;
+
% done
endinput ;
diff --git a/pdftex/config/il2-ams-cmr.map b/pdftex/config/context/il2-ams-cmr.map
index 64bf96bf8..64bf96bf8 100644
--- a/pdftex/config/il2-ams-cmr.map
+++ b/pdftex/config/context/il2-ams-cmr.map
diff --git a/pdftex/config/original-adobe-euro.map b/pdftex/config/context/original-adobe-euro.map
index 7a1137ebb..7a1137ebb 100644
--- a/pdftex/config/original-adobe-euro.map
+++ b/pdftex/config/context/original-adobe-euro.map
diff --git a/pdftex/config/original-ams-cmr.map b/pdftex/config/context/original-ams-cmr.map
index 9c739da11..9c739da11 100644
--- a/pdftex/config/original-ams-cmr.map
+++ b/pdftex/config/context/original-ams-cmr.map
diff --git a/pdftex/config/original-ams-euler.map b/pdftex/config/context/original-ams-euler.map
index 91328a197..91328a197 100644
--- a/pdftex/config/original-ams-euler.map
+++ b/pdftex/config/context/original-ams-euler.map
diff --git a/pdftex/config/context/original-ams-logo.map b/pdftex/config/context/original-ams-logo.map
new file mode 100644
index 000000000..83a0d6892
--- /dev/null
+++ b/pdftex/config/context/original-ams-logo.map
@@ -0,0 +1,8 @@
+logo8 < logo8.pfb
+logo9 < logo9.pfb
+logo10 < logo10.pfb
+logobf10 < logobf10.pfb
+logod10 < logod10.pfb
+logosl8 < logosl8.pfb
+logosl9 < logosl9.pfb
+logosl10 < logosl10.pfb
diff --git a/pdftex/config/original-context-symbol.map b/pdftex/config/context/original-context-symbol.map
index 942798c57..942798c57 100644
--- a/pdftex/config/original-context-symbol.map
+++ b/pdftex/config/context/original-context-symbol.map
diff --git a/pdftex/config/context/original-vogel-symbol.map b/pdftex/config/context/original-vogel-symbol.map
new file mode 100644
index 000000000..fe1fa3b2f
--- /dev/null
+++ b/pdftex/config/context/original-vogel-symbol.map
@@ -0,0 +1 @@
+fmvr8x Marvosym < fmvr8x.pfb
diff --git a/pdftex/config/ec-youngryu-px.map b/pdftex/config/context/original-youngryu-px.map
index f9f19415e..f9f19415e 100644
--- a/pdftex/config/ec-youngryu-px.map
+++ b/pdftex/config/context/original-youngryu-px.map
diff --git a/pdftex/config/ec-youngryu-tx.map b/pdftex/config/context/original-youngryu-tx.map
index 5f2c6010d..5f2c6010d 100644
--- a/pdftex/config/ec-youngryu-tx.map
+++ b/pdftex/config/context/original-youngryu-tx.map
diff --git a/pdftex/config/pl0-ams-cmr.map b/pdftex/config/context/pl0-ams-cmr.map
index 70807f50c..70807f50c 100644
--- a/pdftex/config/pl0-ams-cmr.map
+++ b/pdftex/config/context/pl0-ams-cmr.map
diff --git a/pdftex/config/original-bh-lucida.map b/pdftex/config/original-bh-lucida.map
deleted file mode 100644
index 6ef0c1797..000000000
--- a/pdftex/config/original-bh-lucida.map
+++ /dev/null
@@ -1,49 +0,0 @@
-% These are the original B&H fonts as provided by Y&Y.
-
-lbl <lbl.pfb texnansi.enc
-lbr <lbr.pfb texnansi.enc
-lbd <lbd.pfb texnansi.enc
-lbdi <lbdi.pfb texnansi.enc
-lbi <lbi.pfb texnansi.enc
-lbrsc <lbrsc.pfb texnansi.enc
-lbdsc <lbdsc.pfb texnansi.enc
-lbsl <lbsl.pfb texnansi.enc
-lbc <lbc.pfb texnansi.enc
-lbkr <lbkr.pfb texnansi.enc
-lbki <lbki.pfb texnansi.enc
-
-lfr <lfr.pfb texnansi.enc
-lfd <lfd.pfb texnansi.enc
-lfdi <lfdi.pfb texnansi.enc
-lfi <lfi.pfb texnansi.enc
-
-lbh <lbh.pfb texnansi.enc
-
-lsr <lsr.pfb texnansi.enc
-lsd <lsd.pfb texnansi.enc
-lsdi <lsdi.pfb texnansi.enc
-lsi <lsi.pfb texnansi.enc
-lsb <lsb.pfb texnansi.enc
-lsbi <lsbi.pfb texnansi.enc
-
-lstr <lstr.pfb texnansi.enc
-lstb <lstb.pfb texnansi.enc
-lstbo <lstbo.pfb texnansi.enc
-lsto <lsto.pfb texnansi.enc
-
-lbtr <lbtr.pfb texnansi.enc
-lbtb <lbtb.pfb texnansi.enc
-lbtbo <lbtbo.pfb texnansi.enc
-lbto <lbto.pfb texnansi.enc
-
-lbmdo <lbmdo.pfb
-lbmo <lbmo.pfb
-lbma <lbma.pfb
-lbmad <lbmad.pfb
-lbme <lbme.pfb
-lbmr <lbmr.pfb
-lbmd <lbmd.pfb
-lbmdi <lbmdi.pfb
-lbmi <lbmi.pfb
-lbms <lbms.pfb
-lbmsd <lbmsd.pfb
diff --git a/pdftex/config/original-micropress-informal.map b/pdftex/config/original-micropress-informal.map
deleted file mode 100644
index 2661f1cb1..000000000
--- a/pdftex/config/original-micropress-informal.map
+++ /dev/null
@@ -1,7 +0,0 @@
-ifrm10cm 4 < ifrg.pfb cm.enc
-ifrb10cm 4 < ifb.pfb cm.enc
-ifro10cm 4 < ifo.pfb cm.enc
-ifbo10cm 4 < ifbo.pfb cm.enc
-ifex10 4 < ifex10.pfb
-ifmi10 4 < ifmi10.pfb
-ifsy10 4 < ifsy10.pfb
diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex
index e98e14217..b3e10792d 100644
--- a/tex/context/base/colo-ini.tex
+++ b/tex/context/base/colo-ini.tex
@@ -170,6 +170,16 @@
11: culoarea este convertita la gri
\stopmessages
+%D We use a couple of local registers. That way we don't have
+%D to group when converting colors. By the way, this is not
+%D really faster. We can sqeeze half a second runtime for 50K
+%D switches on a 1G machine, but the macros will become rather
+%D ugly then. To mention one such improvement: no colon
+%D after the key character (.25 sec).
+
+\newdimen\colordimen
+\newcount\colorcount
+
%D \macros
%D {definecolor}
%D
@@ -194,51 +204,64 @@
%D \stoptypen
%D
%D Gray scales are specified with the \type{s} parameter,
-%D where the is derived from screen.
+%D where the \type {s} is derived from {\em screen}.
+%D
+%D Starting with \PDF\ 1.4 (2001) \CONTEXT\ supports
+%D transparent colors. The transparency factor is represented
+%D by a \type {t} and the transparency method by an \type {a}
+%D (alternative). Later we will implement more control
+%D (probably by symbolic methods. So, currently the data is
+%D stored as follows:
+%D
+%D \starttypen
+%D \setvalue{\??cr name}{R:r:g:b:a:t}
+%D \setvalue{\??cr name}{C:c:m:y:k:a:t}
+%D \setvalue{\??cr name}{S:s:a:t}
+%D \stoptypen
-\def\colorlist{}
+\let\colorlist\empty
\def\@@cl@@z{0}
\def\@@cl@@o{1}
+\def\@@resetcolorparameters
+ {\let\@@cl@@r\@@cl@@z\let\@@cl@@g\@@cl@@z\let\@@cl@@b\@@cl@@z
+ \let\@@cl@@c\@@cl@@z\let\@@cl@@m\@@cl@@z\let\@@cl@@y\@@cl@@z
+ \let\@@cl@@k\@@cl@@z\let\@@cl@@s\@@cl@@z
+ \let\@@cl@@t\@@cl@@z\let\@@cl@@a\@@cl@@z}
+
+\def\@@cl@@A{\@@cl@@a} % a hook for symbolic conversion, see below
+
+\def\colorZpattern{S:\@@cl@@z:\@@cl@@A:\@@cl@@t}
+\def\colorSpattern{S:\@@cl@@s:\@@cl@@A:\@@cl@@t}
+\def\colorCpattern{C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t}
+\def\colorRpattern{R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t}
+
\def\definecolor%
{\dodoubleargument\dodefinecolor}
-\def\dodefinecolor[#1][#2]%
- {% beware
-\saveglobal % ? \dodoglobal
- \addtocommalist{#1}\colorlist
-\restoreglobal
+\def\dodefinecolor[#1][#2]%
+ {\addtocommalist{#1}\colorlist
\doifassignmentelse{#2}
- {\let\@@cl@@r=\@@cl@@z\let\@@cl@@g=\@@cl@@z\let\@@cl@@b=\@@cl@@z
- \let\@@cl@@c=\@@cl@@z\let\@@cl@@m=\@@cl@@z\let\@@cl@@y=\@@cl@@z
- \let\@@cl@@k=\@@cl@@z\let\@@cl@@s=\@@cl@@z
+ {\@@resetcolorparameters
\getparameters[\??cl @@][#2]%
\doifelse{\@@cl@@r\@@cl@@g\@@cl@@b}{\@@cl@@z\@@cl@@z\@@cl@@z}
{\doifelse{\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k}{\@@cl@@z\@@cl@@z\@@cl@@z\@@cl@@z}
{\doifelse{\@@cl@@s}{\@@cl@@z}
{\showmessage{\m!colors}{8}{{[#2]},#1}%
- \redoglobal\setevalue{\??cr#1}{S:\@@cl@@z}}
- {\redoglobal\setevalue{\??cr#1}{S:\@@cl@@s}}}
- {\redoglobal\setevalue{\??cr#1}{C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k}}}
- {\redoglobal\setevalue{\??cr#1}{R:\@@cl@@r:\@@cl@@g:\@@cl@@b}}}
+ \setevalue{\??cr#1}{\colorZpattern}}
+ {\setevalue{\??cr#1}{\colorSpattern}}}
+ {\setevalue{\??cr#1}{\colorCpattern}}}
+ {\setevalue{\??cr#1}{\colorRpattern}}}
{\doifdefinedelse{\??cr#2}
- {\redoglobal\setevalue{\??cr#1}{\getvalue{\??cr#2}}}
+ {\setevalue{\??cr#1}{\getvalue{\??cr#2}}}
{\showmessage{\m!colors}{3}{#1}}}%
- \dodoglobal\setvalue{#1}{\color[#1]}}
+ \unexpanded\setvalue{#1}{\color[#1]}} % \unexpanded toegevoegd
%D The names of colors are stored in a comma separated list
-%D only for the purpose of showing them with \type{\showcolor}.
-%D
-%D Colors can be defined global by using \type{\doglobal},
-%D like in
-%D
-%D \startbuffer
-%D \doglobal\definecolor [SomeKindOfRed] [r=.8,g=.05,b=.05]
-%D \stopbuffer
-%D
+%D only for the purpose of showing them with \type {\showcolor}.
+%D
%D \typebuffer
-%D
%D \haalbuffer
%D
%D This color shows up as \color[SomeKindOfRed]{some kind
@@ -265,7 +288,7 @@
%D \setupcolor[rgb]
%D \stoptypen
-\def\colorstyle{}
+\let\colorstyle\empty
\def\setupcolor%
{\dosingleargument\dosetupcolor}
@@ -273,13 +296,14 @@
\def\dosetupcolor[#1]%
{\doifnot{#1}{\colorstyle}
{\def\colorstyle{#1}%
- \def\dodosetupcolor##1%
- {\makeshortfilename[\f!colorprefix\truefilename{##1}]%
- \readsysfile{\shortfilename}%
- {\showmessage{\m!colors}{4}{\colorstyle}}
- {\showmessage{\m!colors}{5}{\colorstyle}}}%
\processcommalist[#1]\dodosetupcolor}}
+\def\dodosetupcolor#1%
+ {\makeshortfilename[\f!colorprefix\truefilename{#1}]%
+ \readsysfile\shortfilename
+ {\showmessage\m!colors4\colorstyle}
+ {\showmessage\m!colors5\colorstyle}}
+
%D When typesetting for paper, we prefer using the \kap{CMYK}
%D color space, but for on||screen viewing we prefer \kap{RGB}
%D (the previous implementation supported only this scheme).
@@ -303,19 +327,91 @@
\newif\ifRGBsupported
\newif\ifCMYKsupported
-\newif\ifconverttoGRAY % obsolete
\newif\ifpreferGRAY
\newif\ifGRAYprefered
\newif\ifreduceCMYK
-%D needs:
+%D The last boolean controls reduction of \kap{CMYK} to
+%D \kap{CMY} colors. When set to true, the black component
+%D is added to the other ones.
+%D
+%D Prefering gray is not the same as converting to gray.
+%D Conversion treats each color components in a different way,
+%D while prefering is just a reduction and thus a
+%D space||saving option.
+
+%D The next (internal) switch suppresses duplicate messages.
+
+\newif\ifconverttoGRAY
+
+%D This module also needs:
% \newif\ifMPgraphics
% \newif\ifinpagebody
-%D The last boolean controls reduction of \kap{CMYK} to
-%D \kap{CMY} colors. When set to true, the black component
-%D is added to the other ones.
+%D \macros
+%D {startcolormode,stopcolormode,permitcolormode}
+%D
+%D We use \type{\stopcolormode} to reset the color in
+%D whatever color space and do so by calling the corresponding
+%D special. Both commands can be used for fast color
+%D switching, like in colored verbatim,
+
+\newif\ifpermitcolormode \permitcolormodetrue
+
+%D Since color is used frequently today (at least by the
+%D author of this module) it makes sense to optimize switching
+%D to the max.
+%D
+%D \starttypen
+%D \def\startcolormode#1%
+%D {\ifincolor\ifpermitcolormode
+%D \doifcolorelse{#1}
+%D {\getcurrentcolorspecs{#1}%
+%D \expandafter\dostartcolormode\currentcolorspecs\od}
+%D {\nostartcolormode}%
+%D \fi\fi}
+%D \stoptypen
+%D
+%D So, the more readable alternatives like the one above are
+%D gone now.
+
+\beginETEX \ifcsname
+
+\def\dowithcolor#1#2% #1=\action #2=color
+ {\ifincolor\ifpermitcolormode
+ \ifcsname\??cr\currentpalet#2\endcsname
+ \@EAEAEA#1\csname\??cr\currentpalet#2\endcsname\od
+ \else\ifcsname\??cr#2\endcsname
+ \@EAEAEA#1\csname\??cr#2\endcsname\od
+ \fi\fi
+ \fi\fi}
+
+\endETEX
+
+\beginTEX
+
+\def\dowithcolor#1#2% #1=\action #2=color
+ {\ifincolor\ifpermitcolormode
+ \@EA\ifx\csname\??cr\currentpalet#2\endcsname\relax
+ \@EA\ifx\csname\??cr#2\endcsname\relax \else
+ \@EAEAEA#1\csname\??cr#2\endcsname\od
+ \fi
+ \else
+ \@EAEAEA#1\csname\??cr\currentpalet#2\endcsname\od
+ \fi\fi
+ \fi\fi}
+
+\endTEX
+
+\def\startcolormode % includes \ifincolor\ifpermitcolormode
+ {\dowithcolor\execcolorRCS}
+
+\def\stopcolormode
+ {\ifincolor\ifpermitcolormode
+ \dostoptransparency
+ \dostopcolormode
+ \fi\fi}
%D Color modes are entered using the next set of commands.
%D The \type{\stop} alternatives are implemented in a way
@@ -324,10 +420,11 @@
%D The, for this module redundant, check if we are in color
%D mode is needed when we use these macros in other modules.
-\def\dostartcolormodeR#1:#2:#3\od%
- {\bgroup
- %\def\@@cl@@r{#1}\def \@@cl@@g{#2}\def \@@cl@@b{#3}%
- \edef\@@cl@@r{#1}\edef\@@cl@@g{#2}\edef\@@cl@@b{#3}%
+\def\execcolorRCS#1:%
+ {\csname execcolor#1\endcsname}
+
+\def\execcolorR#1:#2:#3:%
+ {\edef\@@cl@@r{#1}\edef\@@cl@@g{#2}\edef\@@cl@@b{#3}%
\ifpreferGRAY\ifx\@@cl@@r\@@cr@@g\ifx\@@cl@@r\@@cl@@b
\GRAYpreferedtrue
\fi\fi\fi
@@ -343,12 +440,10 @@
\convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b
\dostartgraycolormode\@@cl@@s
\fi\fi\fi
- \egroup}
-
-\def\dostartcolormodeC#1:#2:#3:#4\od%
- {\bgroup
- %\def\@@cl@@c{#1}\def \@@cl@@m{#2}\def \@@cl@@y{#3}\def \@@cl@@k{#4}%
- \edef\@@cl@@c{#1}\edef\@@cl@@m{#2}\edef\@@cl@@y{#3}\edef\@@cl@@k{#4}%
+ \exectransparency}
+
+\def\execcolorC#1:#2:#3:#4:%
+ {\edef\@@cl@@c{#1}\edef\@@cl@@m{#2}\edef\@@cl@@y{#3}\edef\@@cl@@k{#4}%
\ifpreferGRAY\ifx\@@cl@@k\@@cl@@z\ifx\@@cl@@c\@@cr@@m\ifx\@@cl@@c\@@cl@@y
\GRAYpreferedtrue
\fi\fi\fi\fi
@@ -358,10 +453,8 @@
\else\ifCMYKsupported
\ifreduceCMYK
\convertCMYKtoCMY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \else
- \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
\fi
+ \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
\else\ifRGBsupported
\convertCMYKtoRGB\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
\dostartrgbcolormode\@@cl@@r\@@cl@@g\@@cl@@b
@@ -369,38 +462,77 @@
\convertCMYKtoGRAY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
\dostartgraycolormode\@@cl@@s
\fi\fi\fi
- \egroup}
+ \exectransparency}
+
+\def\execcolorS#1:%
+ {\dostartgraycolormode{#1}%
+ \exectransparency}
-\def\dostartcolormodeS#1\od%
- {\dostartgraycolormode{#1}}
+%D Transparency is handled similar for all three color modes. We
+%D can turn transparency off with the following switch:
-%D Prefering gray is not the same as converting to gray. Conversion treats
-%D each color components in a different way, while prefering is just a
-%D reduction and thus a space||saving option.
+\newif\iftransparancysupported \transparancysupportedtrue % todo
-%D \macros
-%D {startcolormode,stopcolormode,permitcolormode}
-%D
-%D We use \type{\stopcolormode} to reset the color in
-%D whatever color space and do so by calling the corresponding
-%D special. Both commands can be used for fast color
-%D switching, like in colored verbatim,
+\def\exectransparency
+ {\iftransparancysupported
+ \expandafter\doexectransparency
+ \else
+ \expandafter\noexectransparency
+ \fi}
-\newif\ifpermitcolormode \permitcolormodetrue
+\def\doexectransparency#1:#2\od
+ {\global\@EA\chardef\csname\@@currenttransparent\endcsname % nasty
+ \ifcase#1\space
+ \zerocount
+ \else
+ \plusone
+ \dostarttransparency{#1}{#2}%
+ \fi}
-\def\dostartcolormode#1:%
- {\getvalue{dostartcolormode#1}}
+\def\noexectransparency#1\od
+ {}
-\def\startcolormode#1%
- {\ifincolor\ifpermitcolormode
- \doifcolorelse{#1}
- {\getcurrentcolorspecs{#1}%
- \expandafter\dostartcolormode\currentcolorspecs\od}
- {\dostopcolormode}%
- \fi\fi}
+%D Todo: minimize resets.
+
+\def\conditionalstoptransparancy
+ {\ifcase\csname\@@currenttransparent\endcsname\or
+ \dostoptransparency
+ \fi}
+
+%D We now use the \type {\@@cl@@A} hook to implement
+%D symbolic names. These are converted into numbers
+%D at definition time (which saves runtime).
+
+\def\definetransparency
+ {\dodoubleargument\dodefinetransparency}
-\def\stopcolormode%
- {\ifincolor\ifpermitcolormode\dostopcolormode\fi\fi}
+%\def\dodefinetransparency[#1][#2]%
+% {\@EA\chardef\csname\??cl-#1\endcsname#2\relax
+% \ifundefined{\??cl-#2}#2\else\csname\??cl-#2\endcsname\fi}
+
+\def\dodefinetransparency[#1][#2]%
+ {\@EA\chardef\csname\??cl-#1\endcsname#2\relax}
+
+\def\transparencynumber#1%
+ {\the\executeifdefined{\??cl-#1}\zerocount}
+
+\definetransparency [none] [0] \definetransparency [0] [0]
+\definetransparency [normal] [1] \definetransparency [1] [1]
+\definetransparency [multiply] [2] \definetransparency [2] [2]
+\definetransparency [screen] [3] \definetransparency [3] [3]
+\definetransparency [overlay] [4] \definetransparency [4] [4]
+\definetransparency [softlight] [5] \definetransparency [5] [5]
+\definetransparency [hardlight] [6] \definetransparency [6] [6]
+\definetransparency [colordodge] [7] \definetransparency [7] [7]
+\definetransparency [colorburn] [8] \definetransparency [8] [8]
+\definetransparency [darken] [9] \definetransparency [9] [9]
+\definetransparency [lighten] [10] \definetransparency [10] [10]
+\definetransparency [difference] [11] \definetransparency [11] [11]
+\definetransparency [exclusion] [12] \definetransparency [12] [12]
+
+%D Now we hook 'm into the patterns:
+
+\def\@@cl@@A{\transparencynumber\@@cl@@a}
%D \macros
%D {startregistercolor,stopregistercolor,permitcolormode}
@@ -412,9 +544,42 @@
\def\startregistercolor[#1]%
{\permitcolormodefalse\startcolor[#1]\permitcolormodetrue}
-\def\stopregistercolor%
+\def\stopregistercolor
{\permitcolormodefalse\stopcolor\permitcolormodetrue}
+%D We use these macros for implementing text colors
+%D (actually, the first application was in foreground
+%D colors).
+%D
+%D \starttypen
+%D \starttextcolor[red]
+%D \dorecurse{10}{\input tufte \color[green]{oeps} \par}
+%D \stoptextcolor
+%D \stoptypen
+%D
+%D This is more efficient than the alternative:
+%D
+%D \starttypen
+%D \setupbackgrounds[text][foregroundcolor=red]
+%D \startregistercolor[red]
+%D \dorecurse{10}{\input tufte \color[green]{oeps} \par}
+%D \stopregistercolor
+%D \stoptypen
+
+\let\maintextcolor\empty
+
+\def\starttextcolor[#1]% to be translated
+ {\bgroup
+ \let\starttextcolor\relax
+ \let\stoptextcolor \relax
+ \startregistercolor[#1]%
+ \def\maintextcolor{#1}}
+
+\def\stoptextcolor % also goes ok with \page after
+ {\let\maintextcolor\empty % this one because the top of
+ \stopregistercolor % page sets the color right (side
+ \egroup} % effect)
+
%D We use some reserved names for local color components.
%D Consistent use of these scratch variables saves us
%D unneccessary hash entries.
@@ -459,38 +624,23 @@
%D in three digits precision.
\def\realcolorvalue#1%
- {\ifnum #1<10 0.00\the#1%
- \else\ifnum#1<100 0.0\the#1%
- \else\ifnum#1<1000 0.\the#1%
- \else 1\fi\fi\fi}
-
-% \def\doconvertCMYKtoRGB#1\k#2\to#3%
-% {\scratchdimen=#1\s!pt
-% \advance\scratchdimen by #2\s!pt\relax
-% \ifdim\scratchdimen>1\s!pt
-% \scratchdimen=-1\s!pt
-% \else
-% \scratchdimen=-\scratchdimen
-% \fi
-% \advance\scratchdimen by 1\s!pt
-% \multiply\scratchdimen by 1000
-% \scratchcounter=\scratchdimen
-% \advance\scratchcounter by \!!medcard
-% \divide\scratchcounter by \!!maxcard
-% \edef#3{\realcolorvalue\scratchcounter}}
+ {\ifnum#1<10 0.00\the#1\else
+ \ifnum#1<100 0.0\the#1\else
+ \ifnum#1<1000 0.\the#1\else
+ 1\fi\fi\fi}
\def\doconvertCMYKtoRGB#1\k#2\to#3%
- {\ifdim#2\s!pt<#1\s!pt % k>color
- \scratchdimen=1\s!pt
- \advance\scratchdimen -#1\s!pt
- \advance\scratchdimen -#2\s!pt
- \multiply\scratchdimen by 1000
- \scratchcounter=\scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard
- \edef#3{\realcolorvalue\scratchcounter}%
- \else
- \edef#3{0}%
+ {\ifdim#2\s!pt<#1\s!pt
+ \colordimen1\s!pt
+ \advance\colordimen -#1\s!pt
+ \advance\colordimen -#2\s!pt
+ \multiply\colordimen 1000
+ \colorcount\colordimen
+ \advance\colorcount \medcard
+ \divide\colorcount \maxcard
+ \edef#3{\realcolorvalue\colorcount}%
+ \else % k >= color
+ \let#3\@@cl@@z
\fi}
\def\convertCMYKtoRGB#1#2#3#4%
@@ -499,20 +649,20 @@
\doconvertCMYKtoRGB#3\k#4\to\@@cl@@b}
\def\doconvertRGBtoCMYK#1\to#2%
- {\scratchdimen=#1\s!pt
- \multiply\scratchdimen by 1000
- \scratchcounter=\scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard
- \scratchcounter=-\scratchcounter
- \advance\scratchcounter by 1000
- \edef#2{\realcolorvalue\scratchcounter}}
+ {\colordimen#1\s!pt
+ \multiply\colordimen 1000
+ \colorcount\colordimen
+ \advance\colorcount \medcard
+ \divide\colorcount \maxcard
+ \colorcount-\colorcount
+ \advance\colorcount 1000
+ \edef#2{\realcolorvalue\colorcount}}
\def\convertRGBtoCMYK#1#2#3%
{\doconvertRGBtoCMYK#1\to\@@cl@@c
\doconvertRGBtoCMYK#2\to\@@cl@@m
\doconvertRGBtoCMYK#3\to\@@cl@@y
- \let\@@cl@@k=\@@cl@@z}
+ \let\@@cl@@k\@@cl@@z}
%D The following switch is mainly meant for (hidden)
%D documentation purposes.
@@ -525,42 +675,42 @@
\def\bGRAYfactor{\ifweightGRAY110\else\nGRAYfactor\fi}
\def\convertRGBtoGRAY#1#2#3%
- {\scratchdimen=#1\s!pt
- \scratchdimen=\rGRAYfactor\scratchdimen
- \scratchcounter=\scratchdimen
- \scratchdimen=#2\s!pt
- \scratchdimen=\gGRAYfactor\scratchdimen
- \advance\scratchcounter by \scratchdimen
- \scratchdimen=#3\s!pt
- \scratchdimen=\bGRAYfactor\scratchdimen
- \advance\scratchcounter by \scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard
- \edef\@@cl@@s{\realcolorvalue\scratchcounter}}
+ {\colordimen#1\s!pt
+ \colordimen\rGRAYfactor\colordimen
+ \colorcount\colordimen
+ \colordimen#2\s!pt
+ \colordimen\gGRAYfactor\colordimen
+ \advance\colorcount \colordimen
+ \colordimen#3\s!pt
+ \colordimen\bGRAYfactor\colordimen
+ \advance\colorcount \colordimen
+ \advance\colorcount \medcard
+ \divide\colorcount \maxcard
+ \edef\@@cl@@s{\realcolorvalue\colorcount}}
\def\convertCMYKtoGRAY#1#2#3#4%
{\convertCMYKtoRGB{#1}{#2}{#3}{#4}%
\convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b}
\def\doconvertCMYKtoCMY#1\k#2\to#3%
- {\scratchdimen=#1\s!pt
- \advance\scratchdimen by #2\s!pt\relax
- \ifdim\scratchdimen>1\s!pt
- \scratchdimen=1\s!pt
- \else
- \scratchdimen=\scratchdimen
+ {\colordimen#1\s!pt
+ \advance\colordimen #2\s!pt\relax
+ \ifdim\colordimen>1\s!pt
+ \colordimen1\s!pt
+ %\else
+ % \colordimen\colordimen
\fi
- \multiply\scratchdimen by 1000
- \scratchcounter=\scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard
- \edef#3{\realcolorvalue\scratchcounter}}
+ \multiply\colordimen 1000
+ \colorcount\colordimen
+ \advance\colorcount \medcard
+ \divide\colorcount \maxcard
+ \edef#3{\realcolorvalue\colorcount}}
\def\convertCMYKtoCMY#1#2#3#4%
{\doconvertCMYKtoCMY#1\k#4\to\@@cl@@c
\doconvertCMYKtoCMY#2\k#4\to\@@cl@@m
\doconvertCMYKtoCMY#3\k#4\to\@@cl@@y
- \let\@@cl@@k=\@@cl@@z}
+ \let\@@cl@@k\@@cl@@z}
%D Before we present the color macros, we first define the
%D setup command. This command takes care of setting up the
@@ -575,27 +725,34 @@
\def\dosetupcolors[#1]%
{\getparameters[\??cl][#1]%
- \doifelse{\@@clreductie}{\v!ja}
- {\reduceCMYKtrue}
- {\reduceCMYKfalse}%
- \doifelse{\@@clrgb}{\v!nee}
- {\ifRGBsupported \showmessage{\m!colors} {9}{\v!rgb}\RGBsupportedfalse\fi}
- {\ifRGBsupported\else\showmessage{\m!colors}{10}{\v!rgb}\RGBsupportedtrue \fi}%
- \doifelse{\@@clcmyk}{\v!nee}
- {\ifCMYKsupported \showmessage{\m!colors} {9}{\v!cmyk}\CMYKsupportedfalse\fi}
- {\ifCMYKsupported\else\showmessage{\m!colors}{10}{\v!cmyk}\CMYKsupportedtrue \fi}%
- \doifelse{\@@clmpcmyk}{\v!nee}
- {\ifMPcmyk \showmessage{\m!colors} {9}{\v!mp\v!cmyk}\MPcmykfalse\fi}
- {\ifMPcmyk\else\showmessage{\m!colors}{10}{\v!mp\v!cmyk}\MPcmyktrue \fi}%
+ \doifelse\@@clreductie\v!ja
+ \reduceCMYKtrue
+ \reduceCMYKfalse
+ \doifelse\@@clrgb\v!nee
+ {\ifRGBsupported \showmessage\m!colors {9}\v!rgb\RGBsupportedfalse\fi}
+ {\ifRGBsupported\else\showmessage\m!colors{10}\v!rgb\RGBsupportedtrue \fi}%
+ \doifelse\@@clcmyk\v!nee
+ {\ifCMYKsupported \showmessage\m!colors {9}\v!cmyk\CMYKsupportedfalse\fi}
+ {\ifCMYKsupported\else\showmessage\m!colors{10}\v!cmyk\CMYKsupportedtrue \fi}%
+ \doifelse\@@clmpcmyk\v!nee
+ {\ifMPcmyk \showmessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykfalse\fi}
+ {\ifMPcmyk\else\showmessage\m!colors{10}{\v!mp\v!cmyk}\MPcmyktrue \fi}%
+% \processaction
+% [\@@clconversie]
+% [ \v!ja=>\preferGRAYtrue,
+% \v!nee=>\preferGRAYfalse,
+% \v!altijd=>\preferGRAYtrue
+% \RGBsupportedfalse
+% \CMYKsupportedfalse,
+% \s!default=>\preferGRAYfalse,
+% \s!unknown=>\preferGRAYfalse]%
+%
+ \preferGRAYfalse
\processaction
[\@@clconversie]
[ \v!ja=>\preferGRAYtrue,
- \v!nee=>\preferGRAYfalse,
- \v!altijd=>\preferGRAYtrue
- \RGBsupportedfalse
- \CMYKsupportedfalse,
- \s!default=>\preferGRAYfalse,
- \s!unknown=>\preferGRAYfalse]%
+ \v!altijd=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]%
+%
\ifRGBsupported
\converttoGRAYfalse
\forcegrayMPcolorsfalse
@@ -607,7 +764,7 @@
\reduceMPcolorstrue
\fi
\else
- \ifconverttoGRAY\else\showmessage{\m!colors}{11}{}\fi
+ \ifconverttoGRAY\else\showmessage\m!colors{11}\empty\fi
\converttoGRAYtrue
\forcegrayMPcolorstrue
\convertMPcolorsfalse
@@ -615,13 +772,13 @@
\fi\fi
\processaction
[\@@clstatus]
- [\v!globaal=>\ifincolor\else\showmessage{\m!colors}{1}{\colorstyle}\fi
+ [\v!globaal=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
\incolortrue\localcolorfalse,
- \v!lokaal=>\ifincolor\else\showmessage{\m!colors}{2}{\colorstyle}\fi
+ \v!lokaal=>\ifincolor\else\showmessage\m!colors2\colorstyle\fi
\incolortrue\localcolortrue,
- \v!start=>\ifincolor\else\showmessage{\m!colors}{1}{\colorstyle}\fi
+ \v!start=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
\incolortrue\localcolorfalse
- \let\@@clstatus=\v!globaal,
+ \let\@@clstatus\v!globaal,
\v!stop=>\incolorfalse\localcolorfalse
\forcegrayMPcolorstrue]}
@@ -632,14 +789,6 @@
%D command. Later on we will explain the use of palets. We
%D define ourselves a color conditional first.
-% \let\currentpalet\empty
-%
-% \def\doifcolorelse#1%
-% {\doifdefinedelse{\??cr\currentpalet#1}}
-%
-% \def\getcurrentcolorspecs#1%
-% {\edef\currentcolorspecs{\getvalue{\??cr\currentpalet#1}}}
-
\let\currentpalet\empty
\beginETEX \ifcsname
@@ -651,11 +800,13 @@
\expandafter\secondoftwoarguments
\fi}
-\def\getcurrentcolorspecs#1%
- {\edef\currentcolorspecs%
- {\csname\??cr
- \ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi
- #1\endcsname}}
+% no longer needed
+%
+% \def\getcurrentcolorspecs#1%
+% {\edef\currentcolorspecs%
+% {\csname\??cr
+% \ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi
+% #1\endcsname}}
\endETEX
@@ -668,11 +819,13 @@
\expandafter\firstoftwoarguments
\fi}
-\def\getcurrentcolorspecs#1%
- {\edef\currentcolorspecs%
- {\csname\??cr\@EA
- \ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi
- #1\endcsname}}
+% no longer needed
+%
+% \def\getcurrentcolorspecs#1%
+% {\edef\currentcolorspecs%
+% {\csname\??cr\@EA
+% \ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi
+% #1\endcsname}}
\endTEX
@@ -682,15 +835,19 @@
%D Simple color support, that is without nesting, is provided
%D by:
-\def\localstartcolor[#1]%
+\def\localstartcolor
{\ifincolor
\localcolortrue
- \doglobalstartcolor[#1]%
+ \expandafter\doglobalstartcolor
+ \else
+ \expandafter\noglobalstartcolor
\fi}
-\def\localstopcolor%
+\def\localstopcolor
{\ifincolor
\doglobalstopcolor
+ \else
+ \noglobalstopcolor
\fi}
%D \macros
@@ -701,14 +858,18 @@
%D
%D \showsetup{\y!startcolor}
-\def\startcolor[#1]%
+\def\startcolor
{\ifincolor
- \doglobalstartcolor[#1]%
+ \expandafter\doglobalstartcolor
+ \else
+ \expandafter\noglobalstartcolor
\fi}
\def\stopcolor%
{\ifincolor
\doglobalstopcolor
+ \else
+ \noglobalstopcolor
\fi}
%D This macros call the global color switching ones. Starting
@@ -717,73 +878,93 @@
\newcount\colorlevel
-\setvalue{\??cl0C}{} % saved color
-\setvalue{\??cl0S}{} % stop command
+\letvalue{\??cl0C}\empty % saved color
+\letvalue{\??cl0S}\empty % stop command
%D We keep a positive color stack for foreground colors, and
%D a negative one for backgrounds. Not that brilliant a
%D solution, but it suits. The signs are swapped when the
%D page ornaments are typeset.
-\def\@@colorplus {+}
-\def\@@colorminus{-}
+\let\@@colorplus \plusone
+\let\@@colorminus\minusone
+
+\def\@@currentcolorname {\??cl\the\colorlevel C}
+\def\@@currentcolorstop {\??cl\the\colorlevel S}
+\def\@@currenttransparent{\??cl\the\colorlevel T}
-\def\dodoglobalstartcolor[#1]%
- {\xdef\currentcolor{\getvalue{\??cl\the\colorlevel C}}%
- \global\advance\colorlevel by \@@colorplus1
- \setxvalue{\??cl\the\colorlevel C}{#1}%
+\def\dodoglobalstartcolor
+ {\global\@EA\let\@EA\currentcolor\csname\@@currentcolorname\endcsname
+ \global\advance\colorlevel \@@colorplus
+ \global\@EA\let\csname\@@currentcolorname\endcsname\@@askedcolor
%\debuggerinfo{\m!colors}
- % {start #1 at level \the\colorlevel}%
- \doifelsenothing{#1}
- {\setxvalue{\??cl\the\colorlevel C}{\currentcolor}%
- \setgvalue{\??cl\the\colorlevel S}{\donoglobalstopcolor}}
- {\doifelse{#1}{\currentcolor}
- {\setgvalue{\??cl\the\colorlevel S}{\donoglobalstopcolor}}
- {\doifcolorelse{#1}
- {\docolormark{#1}%
- \setgvalue{\??cl\the\colorlevel S}{\dodoglobalstopcolor}%
- \startcolormode{#1}}
- {\setgvalue{\??cl\the\colorlevel S}{\donoglobalstopcolor}%
- \showmessage{\m!colors}{3}{#1}}}}}
+ % {start \@@askedcolor\space at level \the\colorlevel}%
+ \ifx\@@askedcolor\empty
+ \global\@EA\let\csname\@@currentcolorname\endcsname\currentcolor
+ \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
+ \else\ifx\@@askedcolor\currentcolor
+ \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
+ \else
+ \doifcolorelse\@@askedcolor
+ {\docolormark\@@askedcolor
+ \global\@EA\let\csname\@@currentcolorstop\endcsname\dodoglobalstopcolor
+ \startcolormode\@@askedcolor}
+ {\global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
+ \showmessage\m!colors3\@@askedcolor}%
+ \fi\fi}
\def\doglobalstartcolor[#1]%
- {\ifnum\colorlevel=0
- \doifelsenothing{#1}
- {\setgvalue{\??cl\the\colorlevel S}{}}
- {\dodoglobalstartcolor[#1]}%
+ {\edef\@@askedcolor{#1}%
+ \ifcase\colorlevel\relax
+ \ifx\@@askedcolor\empty
+ \global\@EA\let\csname\@@currentcolorstop\endcsname\empty
+ \else
+ \dodoglobalstartcolor
+ \fi
\else
- \dodoglobalstartcolor[#1]%
+ \dodoglobalstartcolor
\fi
\ignorespaces}
-\def\donoglobalstopcolor%
- {\ifnum\colorlevel=0 \else
- \xdef\currentcolor{\getvalue{\??cl\the\colorlevel C}}%
- %\debuggerinfo{\m!colors}
- % {stop \currentcolor\normalspace at level \the\colorlevel}%
- \global\advance\colorlevel by \@@colorminus1
- \fi}
+\def\noglobalstartcolor[#1]%
+ {}
-\def\dodoglobalstopcolor%
- {\ifnum\colorlevel=0 \else
+\def\dodoglobalstopcolor
+ {\ifcase\colorlevel \else
\donoglobalstopcolor
- \xdef\previouscolor{\getvalue{\??cl\the\colorlevel C}}%
- \ifnum\colorlevel=0
- \docolormark{}%
- \stopcolormode
+ \global\@EA\let\@EA\previouscolor\csname\@@currentcolorname\endcsname
+ \ifcase\colorlevel\relax
+ \docolormark\empty
+ \dostoptransparency
+ \dostopcolormode
\else % let's do a bit redundant testing here
- \docolormark{\previouscolor}%
- \doifelsenothing{\previouscolor}
- {\dostopcolormode}
- {\doifcolorelse{\previouscolor}
- {\doifnot{\currentcolor}{\previouscolor}
- {\startcolormode{\previouscolor}}}
- {\dostopcolormode}}%
+ \docolormark\previouscolor
+ \ifx\previouscolor\empty
+ \dostoptransparency
+ \dostopcolormode
+ \else
+ \doifcolorelse\previouscolor
+ {\ifx\currentcolor\previouscolor\else
+ \startcolormode\previouscolor
+ \fi}
+ {\dostoptransparency
+ \dostopcolormode}%
+ \fi
\fi
\fi}
-\def\doglobalstopcolor%
- {\getvalue{\??cl\the\colorlevel S}}
+\def\donoglobalstopcolor
+ {\ifcase\colorlevel \else
+ \global\@EA\let\@EA\currentcolor\csname\@@currentcolorname\endcsname
+ %\debuggerinfo{\m!colors}
+ % {stop \currentcolor\normalspace at level \the\colorlevel}%
+ \global\advance\colorlevel \@@colorminus
+ \fi}
+
+\def\doglobalstopcolor
+ {\csname\@@currentcolorstop\endcsname}
+
+\let\noglobalstopcolor\relax
%D We don't use grouping and save each stop alternative. This
%D permits be especially useful in for instance local color
@@ -856,7 +1037,7 @@
\doifdefinedelse{newmark}
{\newmark\colormark}
- {\def\colormark#1{}}
+ {\let\colormark\gobbleoneargument}
%D Using this mark mechanism with lots of colors has one
%D major drawback: \TEX's memory tends to overflow when
@@ -864,16 +1045,16 @@
%D the processing time grows considerably. We therefore support
%D local as well as global color switching.
%D
-%D Of the next macros, \type{\popcolor} is to be used after
-%D the actual \type{\shipout} and \type{\startcolorpage} and
-%D \type{\stopcolorpage} are called when entering and leaving
-%D the \type{\pagebody} builder. In case of emergencies
-%D \type{\pushcolor} can be used to undo the current color,
+%D Of the next macros, \type {\popcolor} is to be used after
+%D the actual \type {\shipout} and \type {\startcolorpage} and
+%D \type {\stopcolorpage} are called when entering and leaving
+%D the \type {\pagebody} builder. In case of emergencies
+%D \type {\pushcolor} can be used to undo the current color,
%D for instance when insertions are appended to the page.
%D
%D Out of efficiency we only use marks when needed. The next
%D macro tries to find out if indeed a mark should be set.
-%D This macro uses the boolean \type{\ifinpagebody}, which can
+%D This macro uses the boolean \type {\ifinpagebody}, which can
%D be defined and set in the module that handles the pagebody.
\def\docolormark#1%
@@ -884,9 +1065,11 @@
\let\lastcolormark=\empty
\def\dodocolormark#1%
- {\doifnot{#1}{\lastcolormark}
- {\xdef\lastcolormark{#1}%
- \expandafter\setmark\expandafter\colormark\expandafter{\lastcolormark}}}
+ {\edef\newcolormark{#1}%
+ \ifx\newcolormark\lastcolormark\else
+ \global\let\lastcolormark\newcolormark
+ \@EA\setmark\@EA\colormark\@EA{\lastcolormark}%
+ \fi}
%D \macros
%D {pushcolor, popcolor}
@@ -895,10 +1078,12 @@
%D to resetting the color to black, while popping restores the
%D color state to that of before the break.
-\def\pushcolor%
+\def\topofpagecolor{\getbotmark\colormark} % see postponing
+
+\def\pushcolor
{\stopcolormode}
-\def\popcolor%
+\def\popcolor
{\doifsomething{\getbotmark\colormark}
{%\debuggerinfo{\m!colors}{popping \getbotmark\colormark}%
\startcolormode{\getbotmark\colormark}}}
@@ -914,38 +1099,23 @@
%D
%D Local use can be forced with the next two macros. Nesting
%D is still supported but colors are no longer marked.
-
-%D \starttypen
-%D \def\startcolorpage%
-%D {\bgroup
-%D \let\docolormark=\gobbleoneargument
-%D \edef\savedcolorlevel{\the\colorlevel}%
-%D \ifnum\colorlevel>0
-%D \stopcolormode
-%D \fi
-%D \global\colorlevel=1000\relax} % a save offset
-%D
-%D \def\stopcolorpage%
-%D {\global\colorlevel=\savedcolorlevel\relax
-%D \egroup}
-%D \stoptypen
-
-%D The next alternative makes (simple) color separation more
+%D
+%D The next implementation makes (simple) color separation more
%D easy. It also supports nested colors in page backgrounds
%D and texts.
\def\startcolorpage%
{\bgroup
- \def\@@colorplus{-}%
- \def\@@colorminus{+}%
- \let\docolormark=\gobbleoneargument
+ \let\@@colorplus \minusone
+ \let\@@colorminus\plusone
+ \let\docolormark\gobbleoneargument
\edef\savedcolorlevel{\the\colorlevel}%
- \global\colorlevel=0 % before \localstartcolor of
- \localstartcolor[black]} % course, ugly bug removed
+ \global\colorlevel\zerocount % before \localstartcolor of
+ \localstartcolor[black]} % course, ugly bug removed
\def\stopcolorpage%
{\localstopcolor
- \global\colorlevel=\savedcolorlevel\relax
+ \global\colorlevel\savedcolorlevel
\egroup}
%D \macros
@@ -962,13 +1132,11 @@
\unexpanded\def\color[#1]%
{\groupedcommand
- {\startcolor[#1]}
- {\stopcolor}}
+ {\startcolor[#1]}\stopcolor}
\unexpanded\def\graycolor[#1]% not \gray because this is a color
{\groupedcommand
- {\RGBsupportedfalse\CMYKsupportedfalse\startcolor[#1]}
- {\stopcolor}}
+ {\RGBsupportedfalse\CMYKsupportedfalse\startcolor[#1]}\stopcolor}
\let\grey\graycolor
@@ -997,68 +1165,65 @@
%D \startvoorbeeld
%D \haalbuffer
%D \stopvoorbeeld
+%D
+%D We can speed the following macros a bit up, but this
+%D hardly pays off; they are only used in the manual.
\def\realcolorformat#1%
- {\ifnum#1<10 0.00\the#1%
- \else\ifnum#1<100 0.0\the#1%
- \else\ifnum#1<1000 0.\the#1%
- \else 1.000\fi\fi\fi}
+ {\ifnum#1<10 0.00\the#1\else
+ \ifnum#1<100 0.0\the#1\else
+ \ifnum#1<1000 0.\the#1\else
+ 1.000\fi\fi\fi}
\def\colorformatseparator{ }
\def\dodoformatcolor#1%
- {\scratchdimen=#1\s!pt\relax
- \ifdim\scratchdimen>1\s!pt
- \scratchdimen=1\s!pt
+ {\colordimen#1\s!pt\relax
+ \ifdim\colordimen>1\s!pt
+ \colordimen1\s!pt
\fi
- \multiply\scratchdimen by 1000
- \scratchcounter=\scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard \relax
- \realcolorformat\scratchcounter}
+ \multiply\colordimen 1000
+ \colorcount\colordimen
+ \advance\colorcount \medcard
+ \divide\colorcount \maxcard \relax
+ \realcolorformat\colorcount}
-\def\doformatcolorR#1:#2:#3\od%
+\def\doformatcolorR#1:#2:#3:#4:#5\od
{\dodoformatcolor{#1}\colorformatseparator
\dodoformatcolor{#2}\colorformatseparator
\dodoformatcolor{#3}}
-\def\doformatcolorC#1:#2:#3:#4\od%
+\def\doformatcolorC#1:#2:#3:#4:#5:#6\od
{\dodoformatcolor{#1}\colorformatseparator
\dodoformatcolor{#2}\colorformatseparator
\dodoformatcolor{#3}\colorformatseparator
\dodoformatcolor{#4}}
-\def\doformatcolorS#1\od%
+\def\doformatcolorS#1:#2:#3\od
{\dodoformatcolor{#1}}
\def\doformatcolor#1:%
{\getvalue{doformatcolor#1}}
-\def\colorvalue#1%
- {\doifcolorelse{#1}
- {\getcurrentcolorspecs{#1}%
- \expandafter\doformatcolor\currentcolorspecs\od}
- {}}
+\def\colorvalue
+ {\dowithcolor\doformatcolor}
-\def\doformatgrayR#1:#2:#3\od%
+\def\doformatgrayR#1:#2:#3:#4:#5\od
{\convertRGBtoGRAY{#1}{#2}{#3}%
\dodoformatcolor\@@cl@@s}
-\def\doformatgrayC#1:#2:#3:#4\od%
+\def\doformatgrayC#1:#2:#3:#4:#5:#6\od
{\convertCMYKtoGRAY{#1}{#2}{#3}{#4}%
\dodoformatcolor\@@cl@@s}
-\def\doformatgrayS#1\od%
+\def\doformatgrayS#1:#2:#3\od
{\dodoformatcolor{#1}}
\def\doformatgray#1:%
{\getvalue{doformatgray#1}}
-\def\grayvalue#1%
- {\doifcolorelse{#1}
- {\getcurrentcolorspecs{#1}%
- \expandafter\doformatgray\currentcolorspecs\od}
- {}}
+\def\grayvalue%
+ {\dowithcolor\doformatgray}
%D \macros
%D {localstartraster,localstopraster,
@@ -1073,18 +1238,17 @@
%D color support we offer both 'global' and 'local' commands.
\def\localstartraster[#1]%
- %{\doifinstringelse{.}{#1} % no, we also want 0 and 1
{\doifelsenothing{#1}
{\dostartgraymode{\@@rsraster}}
{\dostartgraymode{#1}}}
-\def\localstopraster%
+\def\localstopraster
{\dostopgraymode}
-\def\startraster%
+\def\startraster
{\localstartraster}
-\def\stopraster%
+\def\stopraster
{\localstopraster}
%D In this documentation we will not go into too much details
@@ -1166,7 +1330,7 @@
\setevalue{\??pa#1}{\getvalue{\??pa#1}##1}%
\doifdefinedelse{\??cr##2}
{\setevalue{\??cr#1:##1}{\getvalue{\??cr##2}}}
- {\setevalue{\??cr#1:##1}{S:0}}}%
+ {\setevalue{\??cr#1:##1}{S:0:0:0}}}%
\def\dododefinepalet##1%
{\dodododefinepalet[##1]}%
\processcommalist[#2]\dododefinepalet}
@@ -1187,12 +1351,18 @@
{\dosingleempty\dosetuppalet}
\def\dosetuppalet[#1]%
- {\doifelsenothing{#1}
- {\let\currentpalet\empty}
- {\doifelsevaluenothing{\??pa#1}
- {\showmessage{\m!colors}{7}{#1}%
- \let\currentpalet\empty}
- {\def\currentpalet{#1:}}}}
+ {\edef\currentpalet{#1}%
+ \ifx\currentpalet\empty
+ % seems to be a reset
+ \else
+ % fast enough for tex and etex
+ \@EA\ifx\csname\??pa\currentpalet\endcsname\relax
+ \showmessage\m!colors7\currentpalet
+ \let\currentpalet\empty
+ \else
+ \def\currentpalet{#1:}%
+ \fi
+ \fi}
%D \macros
%D {showpalet}
@@ -1246,10 +1416,10 @@
\v!gray=>\edef\currentcolorspace{S},
\v!s=>\edef\currentcolorspace{S},
\s!unknown=>\edef\currentcolorspace{R}]%
- \scratchcounter=0
+ \colorcount=0
\def\dododefinecolorgroup##1%
- {\advance\scratchcounter by 1
- \setevalue{\??cr#1:\the\scratchcounter}{\currentcolorspace:##1}}%
+ {\advance\colorcount 1
+ \setevalue{\??cr#1:\the\colorcount}{\currentcolorspace:##1:0:0}}%
\processcommalist[#3]\dododefinecolorgroup
\else
\doifinstringelse{:}{#2}
@@ -1430,7 +1600,7 @@
\csname\??cr\@EA
\ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi
#1\endcsname
- :::::\end
+ :::::::\end
\else
#1%
\fi}
@@ -1445,29 +1615,66 @@
\csname\??cr
\ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi
#1\endcsname
- :::::\end
+ :::::::\end
\else
#1%
\fi}
\endETEX
-\def\doMPcolor#1:#2:#3:#4:#5:#6\end
- {\if #1R(#2,#3,#4)%
- \else\if#1C\ifMPcmyk cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi
- \else\if#1S(#2,#2,#2)%
- \else (0,0,0)%
+%D Before we had transparancy available, the following
+%D conversion macro was available:
+%D
+%D \starttypen
+%D \def\doMPcolor#1:#2:#3:#4:#5:#6:#7:#8\end
+%D {\if #1R(#2,#3,#4)%
+%D \else\if#1C\ifMPcmyk cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi
+%D \else\if#1S(#2,#2,#2)%
+%D \else (0,0,0)%
+%D \fi\fi\fi}
+%D \stoptypen
+%D
+%D In order to be useful, this macro is to be fully
+%D expandabele. The next alternative also handles transparant
+%D colors. We could have packaged everything in one macro, but
+%D splitting it up is not only more readable, but also faster
+%D (because less arguments have to be skipped)
+
+\def\doMPcolor#1:%
+ {\if#1R%
+ \@EA\doMPrgb
+ \else\if#1C\ifMPcmyk
+ \@EA\@EAEAEA\@EA\doMPcmykY
+ \else
+ \@EA\@EAEAEA\@EA\doMPcmykN
+ \fi\else\if#1S%
+ \@EA\@EAEAEA\@EA\doMPgray
+ \else
+ \@EA\@EAEAEA\@EA\doMPblack
\fi\fi\fi}
+\def\transparentMP{transparent}
+\def\cmykspecialMP{cmyk}
+
+\def\doMPtransparent#1#2:#3:#4\end
+ {\ifcase#2\space(#1)\else\transparentMP(#2,#3,(#1))\fi}
+
+\def\doMPgray #1:{\doMPtransparent{#1,#1,#1}}
+\def\doMPrgb #1:#2:#3:{\doMPtransparent{#1,#2,#3}}
+\def\doMPcmykY#1:#2:#3:#4:{\doMPtransparent{\cmykspecialMP(#1,#2,#3,#4)}}
+\def\doMPcmykN#1:#2:#3:#4:{\doMPtransparent{1-#1-#4,1-#2-#4,1-#3-#4}}
+
+\def\doMPblack#1:#2:#3:#4:#5:#6:#7\end{(0,0,0)}
+
%D \macros
%D {PDFcolor,FDFcolor}
%D
%D Similar alternatives are avaliable for \PDF:
\def\PDFcolor#1%
- {\@EA\@EA\@EA\doPDFcolor\csname\??cr#1\endcsname:::::\end}
+ {\@EA\@EA\@EA\doPDFcolor\csname\??cr#1\endcsname:::::::\end}
-\def\doPDFcolor#1:#2:#3:#4:#5:#6\end%
+\def\doPDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
{\if #1R#2 #3 #4 rg%
\else\if#1C#2 #3 #4 #5 k%
\else\if#1S#2 g%
@@ -1475,9 +1682,9 @@
\fi\fi\fi}
\def\FDFcolor#1%
- {\@EA\@EA\@EA\doFDFcolor\csname\??cr#1\endcsname:::::\end}
+ {\@EA\@EA\@EA\doFDFcolor\csname\??cr#1\endcsname:::::::\end}
-\def\doFDFcolor#1:#2:#3:#4:#5:#6\end%
+\def\doFDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
{[\if #1R#2 #3 #4%
\else\if#1C#2 #3 #4 #5%
\else\if#1S#2%
diff --git a/tex/context/base/colo-rgb.tex b/tex/context/base/colo-rgb.tex
index 20e72ff9f..5f5a21638 100644
--- a/tex/context/base/colo-rgb.tex
+++ b/tex/context/base/colo-rgb.tex
@@ -188,8 +188,10 @@
\definecolor [verde] [green]
\definecolor [blu] [blue]
- \definecolor [cyan] [cyan]
- \definecolor [magenta] [magenta]
+ \definecolor [azzurro] [cyan]
+ \definecolor [turchino] [cyan]
+ \definecolor [ciano] [cyan]
+ \definecolor [cremisi] [magenta]
\definecolor [giallo] [yellow]
\definecolor [bianco] [white]
@@ -208,11 +210,11 @@
\definecolor [blumedio] [middleblue]
\definecolor [bluchiaro] [lightblue]
- \definecolor [cyanscuro] [darkcyan]
- \definecolor [cyanchiaro] [middlecyan]
+ \definecolor [azzurroscuro] [darkcyan]
+ \definecolor [azzurrochiaro] [middlecyan]
- \definecolor [magentascuro] [darkmagenta]
- \definecolor [magentachiaro] [middlemagenta]
+ \definecolor [cremisiscuro] [darkmagenta]
+ \definecolor [cremisichiaro] [middlemagenta]
\definecolor [gialloscuro] [darkyellow]
@@ -253,15 +255,15 @@
\definecolor [cianinchis] [darkcyan]
\definecolor [cianmediu] [middlecyan]
- \definecolor [magentainchis] [darkmagenta]
- \definecolor [magentamediu] [middlemagenta]
+ \definecolor [magentainchis] [darkmagenta]
+ \definecolor [magentamediu] [middlemagenta]
\definecolor [galbeninchis] [darkyellow]
- \definecolor [galbenmediu] [middleyellow]
+ \definecolor [galbenmediu] [middleyellow]
- \definecolor [griinchis] [darkgray]
- \definecolor [grimediu] [middlegray]
- \definecolor [grideschis] [lightgray]
+ \definecolor [griinchis] [darkgray]
+ \definecolor [grimediu] [middlegray]
+ \definecolor [grideschis] [lightgray]
\stopinterface
@@ -443,7 +445,10 @@
\definecolorgroup [verde] [green]
\definecolorgroup [blu] [blue]
\definecolorgroup [ciano] [cyan]
+ \definecolorgroup [azzurro] [cyan]
+ \definecolorgroup [turchino][cyan]
\definecolorgroup [magenta] [magenta]
+ \definecolorgroup [cremisi] [magenta]
\definecolorgroup [giallo] [yellow]
\definecolorgroup [rosso*] [red*]
\definecolorgroup [verde*] [green*]
diff --git a/tex/context/base/cont-fil.tex b/tex/context/base/cont-fil.tex
index ccd78f287..c76490924 100644
--- a/tex/context/base/cont-fil.tex
+++ b/tex/context/base/cont-fil.tex
@@ -21,6 +21,14 @@
\definefilesynonym [finance] [financ]
+\definefilesynonym [con-01] [contml] % will go away
+
+%definefilesynonym [sch-base] [sch-00]
+%definefilesynonym [sch-make] [sch-01]
+
+\definefilesynonym [xml-format] [xml-01]
+\definefilesynonym [xml-pretty] [xml-02]
+
\definefilesynonym [fig-base] [fig-00]
\definefilesynonym [fig-make] [fig-01]
\definefilesynonym [fig-fake] [fig-02]
diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex
index deffcd932..a8183398a 100644
--- a/tex/context/base/cont-log.tex
+++ b/tex/context/base/cont-log.tex
@@ -101,7 +101,7 @@
%D The \METAFONT\ and \METAPOST\ logos adapt themselves to the
%D current fontsize, an ugly but usefull hack.
-\def\setMFPfont%
+\unexpanded\def\setMFPfont%
{\font\logofont=logo%
\ifnum\fam=\bffam bf\else
\ifnum\fam=\slfam sl\else
@@ -121,10 +121,10 @@
%
% \def\setMFPfont{\symbolicfont{MetaLogo}}
-\def\symbolicfont#1{\definedfont[\glyphfontfile{#1} sa *]}
+\let\logofont\nullfont
-\def\setMFPfont% more sensitive for low level changes
- {\font\logofont=logo%
+\unexpanded\def\setMFPfont% more sensitive for low level changes
+ {\font\logofont=logo%
\ifx\fontalternative\c!bf\else
\ifx\fontalternative\c!sl\else
\ifx\fontalternative\c!sl\else
@@ -144,13 +144,13 @@
{\discretionary{\vrule\!!height.33em\!!depth-.27em\!!width.33em}{}{}}
\unexpanded\def\MetaFont%
- {{\setMFPfont META\MetaHyphen FONT}}
+ {{\setMFPfont META\MetaHyphen FONT}}
\unexpanded\def\MetaPost%
- {{\setMFPfont META\MetaHyphen POST}}
+ {{\setMFPfont META\MetaHyphen POST}}
\unexpanded\def\MetaFun%
- {MetaFun}
+ {MetaFun}
%D \macros
%D {TEX, METAFONT, METAPOST, METAFUN,
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 68a2c17a6..91a53f04d 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,75 +11,118 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% manual : offsetbox alignbox
-
-\unprotect
-
-\def\savefont % do we also need to store the encoding ?
- {\edef\savedfont{\the\font}%
- \pushmacro\savedfont
- \pushmacro\characterregime
- \pushmacro\charactermapping
- \pushmacro\characterencoding}
-
-\def\restorefont%
- {\popmacro\characterencoding
- \popmacro\charactermapping
- \popmacro\characterregime
- \popmacro\savedfont
- \savedfont}
+% manual : offsetbox alignbox
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks and new features.
+\unprotect
+
\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!}
-\def\setraggedparagraphmode#1#2%
- {\ifinpagebody
- \ifdubbelzijdig
- \ifodd\realfolio#1\else#2\fi
- \else
- #2\relax
- \fi
- \else\ifinner
- \ifdubbelzijdig
- \gettwopassdata{\s!paragraph}%
- \iftwopassdatafound
- \ifodd\twopassdata#1\else#2\fi
- \else
- \ifodd\realfolio#1\else#2\fi
- \fi
- \doparagraphreference
- \else
- #2\relax
+% wrong names
+
+\newif\ifpagechanged \let\lastchangedpage\empty
+
+\def\checkpagechange#1%
+ {\gettwopassdata\s!paragraph
+ \pagechangedfalse
+ \iftwopassdatafound
+ \ifnum\twopassdata>0\getvalue{\s!paragraph:p:#1}\relax
+ \pagechangedtrue
\fi
+ \fi
+ \ifpagechanged
+ \global\letvalue{\s!paragraph:p:#1}\twopassdata
+ \global\let\lastchangedpage\twopassdata
\else
- #2\relax
- \fi\fi}
+ \global\let\lastchangedpage\realfolio
+ \fi
+ \doparagraphreference}
+
+\def\changedpage#1%
+ {\getvalue{\s!paragraph:p:#1}}
-% no, too buggy, leads to top of page crap
+\def\startfixed{\dosingleempty\dostartfixed}
+
+\long\def\dostartfixed[#1]%
+ {\expanded{\dowithnextbox{\noexpand\dodofixed{\ifhmode0\else1\fi}{#1}}}%
+ \vbox\bgroup
+ \setlocalhsize}
+
+\def\stopfixed%
+ {\egroup}
+
+\def\dodofixed#1#2%
+ {\ifcase#1\relax
+ \processaction
+ [#2]
+ [ \v!hoog=>\bbox{\box\nextbox},
+ \v!laag=>\tbox{\box\nextbox},
+ \v!midden=>\vcenter{\box\nextbox},
+ \v!laho=>\vcenter{\box\nextbox},
+ \s!unknown=>\tbox{\box\nextbox},
+ \s!default=>\tbox{\box\nextbox}]%
+ \else
+ \startbaselinecorrection
+ \noindent\box\nextbox
+ \stopbaselinecorrection
+ \fi}
+
+% \startitemize
%
-%\def\flushsidefloats%
-% {\par
-% \dochecksidefloat
-% \scratchcounter=-\hangafter
-% \dorecurse{\scratchcounter}{\strut\hfill\strut\par}}
-
-\def\flushsidefloats%
- {\par
- \!!heighta=\sidefloatvsize
- \advance\!!heighta by -\pagetotal
- \ifdim\!!heighta>\zeropoint
- % to be checked for interference
- \witruimte
- % will be option
- \getnoflines\!!heighta
- \!!heighta=\noflines\lineheight
- % so far for option
- \kern\!!heighta
- \fi
- \global\sidefloatvsize=\nofloatvsize
- \global\floatflagfalse}
+% \item \externalfigure[koe][height=2cm]
+% \item \externalfigure[koe][height=2cm]
+% \item \externalfigure[koe][height=2cm]
+% \item \externalfigure[koe][height=2cm]
+%
+% \page
+%
+% \item \startfixed \externalfigure[koe][height=2cm]\stopfixed
+% \item \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
+% \item \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
+% \item \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
+%
+% \page
+%
+% \item test \startfixed \externalfigure[koe][height=2cm]\stopfixed
+% \item test \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
+% \item test \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
+% \item test \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
+%
+% \page
+%
+% \item test \par \startfixed \externalfigure[koe][height=2cm]\stopfixed
+% \item test \par \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
+% \item test \par \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
+% \item test \par \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
+%
+% \stopitemize
+
+% \def\docalculatefigurenorm#1#2%
+% {\dodocalculatefigurenorm{#1}[#2\empty\empty]}
+%
+% \def\dodocalculatefigurenorm#1[#2#3#4]#5#6#7%
+% {\ExpandFirstAfter\processaction
+% [#2#3#4]
+% [ \v!max=>\global#1=#6\relax,
+% \v!kolom=>\global#1=#6\relax,
+% \v!tekst=>\global#1=#6\relax,
+% \v!passend=>\global#1=#7\relax,
+% \v!ruim=>\global#1=#7\relax
+% \global\advance #1 -4\@@exkorps\relax,
+% #2*\v!kolom=>\global#1=#6\relax
+% \ifbinnenkolommen
+% \global\advance#1 \intercolumnwidth
+% \global\multiply#1 #2\relax
+% \global\advance#1 -\intercolumnwidth
+% \fi,
+% #2*\v!tekst=>\global#1=\zetbreedte
+% \global\advance#1 \papierbreedte,
+% \s!default=>\doifsomething{#5}{\global#1=#5\relax},
+% \s!unknown=>\global#1=\@@exkorps\relax
+% \global\divide#1 \!!ten\relax
+% \global\multiply#1 #2#3#4\relax]}
\def\thinrule%
{\strut
@@ -87,17 +130,17 @@
\chardef\ruletype=1
\processaction
[\@@dlvariant]
- [ \v!a=>\chardef\ruletype=0,% no line
+ [ \v!a=>\chardef\ruletype=0,% no line
%\v!b=>\chardef\ruletype=1,% height/depth
- \v!c=>\chardef\ruletype=2,% topheight/botdepth
+ \v!c=>\chardef\ruletype=2,% topheight/botdepth
% 11=>\chardef\ruletype=1,% fallback for backgrounds
0=>\chardef\ruletype=0,% compatible with backgrounds
% 1=>\chardef\ruletype=1,% compatible with backgrounds
2=>\chardef\ruletype=2]% compatible with backgrounds
\doifsomething{\@@dllijndikte}
{\linewidth=\@@dllijndikte}%
- \ifdim\linewidth=\zeropoint
- \chardef\ruletype=0
+ \ifdim\linewidth=\zeropoint
+ \chardef\ruletype=0
\else
\doifnot{\@@dlkader}{\v!aan}{\chardef\ruletype=0\relax}%
\fi
@@ -110,19 +153,19 @@
\fi
\freezedimensionwithunit\@@dlhoogte{\ht\strutbox}%
\freezedimensionwithunit\@@dldiepte{\dp\strutbox}%
- \divide\linewidth 2
+ \divide\linewidth 2
\doifelse{\@@dlachtergrond}{\v!kleur}
{\startcolor[\@@dlachtergrondkleur]%
\dimen0=\@@dlhoogte
\dimen2=\@@dldiepte
- \ifnum\ruletype=2 % prevent overshoot due to rounding
+ \ifnum\ruletype=2 % prevent overshoot due to rounding
\advance\dimen0 by -.5\linewidth
\advance\dimen2 by -.5\linewidth
\fi
\leaders\hrule\!!height\dimen0\!!depth\dimen2\hfill
\stopcolor
- \ifcase\ruletype
- % no rule
+ \ifcase\ruletype
+ % no rule
\or
\startcolor[\@@dlkleur]%
\hfillneg
@@ -145,7 +188,7 @@
\carryoverpar\egroup}
\setupthinrules
- [\c!kader=\v!aan, % compatible with textbackgrounds
+ [\c!kader=\v!aan, % compatible with textbackgrounds
\c!variant=\v!b,
\c!achtergrondkleur=,
\c!achtergrond=,
@@ -177,46 +220,13 @@
{\carryoverpar\egroup}
{\@@dlna\egroup}}
-\def\dodousemodules#1#2%
- {\setfalse\moduleisloaded
- \doifelsenothing{#1}
- {\def\next
- {\dododousemodules\f!moduleprefix {#2}%
- \dododousemodules\f!privateprefix{#2}%
- \dododousemodules\f!styleprefix {#2}%
- \dododousemodules\f!xstyleprefix {#2}%
- \dododousemodules\f!thirdprefix {#2}}}
- {\def\next
- {\dododousemodules{#1-}{#2}}}%
- \next
- \ifconditional\moduleisloaded\else
- \showmessage{\m!systems}{6}{#2}%
- \fi}
-
-\def\dousemodules[#1][#2]%
- {\ifsecondargument
- \doifelsenothing{#2}
- {\let\next\relax}
- {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
- \else
- \def\next{\usemodules[][#1]}%
- \fi
- \next}
-
-\def\usemodules%
- {\dodoubleempty\dousemodules}
-
-\let\usemodule\usemodules
-
-% \usemodule[t][speech]
-
\def\complexTableTB[#1]{\TABLEnoalign{\blanko[#1]}}
\def\simpleTableTB {\TABLEnoalign{\blanko}}
\def\TabulateTB
{\complexorsimpleTable{TB}}
-\def\doTableinterline% #1
+\def\doTableinterline% #1
{\ifnum\currentTABLEcolumn>\maxTABLEcolumn
\chuckTABLEautorow
\else\ifnum\currentTABLEcolumn=0
@@ -227,7 +237,7 @@
\setTABLEerror\TABLEmissingcolumn
\handleTABLEerror
\fi\fi
- \complexorsimpleTable} % {#1}
+ \complexorsimpleTable} % {#1}
\def\TableHL{\doTableinterline{HL}}
\def\TableTB{\doTableinterline{TB}}
@@ -236,63 +246,22 @@
\appendtoks\let\TB\TabulateTB\to\everytabulate
% \starttabulate
-% \NC text \NC text \NC \NR
+% \NC text \NC text \NC \NR
% \TB[small]
-% \NC text \NC text \NC \NR
+% \NC text \NC text \NC \NR
% \TB[4*big]
-% \NC text \NC text \NC \NR
+% \NC text \NC text \NC \NR
% \stoptabulate
-%
+%
% \starttable[|||]
-% \VL text \VL text \VL \AR
+% \VL text \VL text \VL \AR
% \TB[small]
-% \VL text \VL text \VL \AR
+% \VL text \VL text \VL \AR
% \TB[4*big]
-% \VL text \VL text \VL \AR
+% \VL text \VL text \VL \AR
% \stoptable
-% Quite experimental !
-
-% the split is needed when for instance the float goes into
-% a multi page field and the list of figs becomes larger than
-% one page: cycle between 'only flush when object ref ok'
-% and 'one/many page fig list'; see "uguide finometer"
-
-\def\placefloatcaption
- {\dodoubleempty\doplacefloatcaption}
-
-\def\doplacefloatcaption[#1][#2]#3%
- {\setfloatcaption[#1][#2]{#3}%
- \placefloatcaptiontext[#1]%
- \placefloatcaptionreference[#1]}
-
-\def\setfloatcaption
- {\dodoubleempty\dodosetfloatcaption} % beware, name clash
-
-\def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
- {\doifelsevalue{\??kj#1\c!nummer}{\v!ja} % also handle trialtypesetting
- {\verhoognummer[#1]%
- \maakhetnummer[#1]%
- \global\let\flhetnummer\hetnummer
- \setgvalue{@fl@r@#1}%
- {\dofloatreference
- \redofloatorder{#1}%
- \doschrijfnaarlijst{#1}{\flhetnummer}{#3}{#1}%
- \doglobal\convertargument#3\to\flasciititle % \asciititle is global
- \doifsomething{#2}{\rawreference{\s!flt}{#2}{{\flhetnummer}{\flasciititle}}}%
- \global\letvalue{@fl@r@#1}\relax}% nills
- \setgvalue{@fl@t@#1}%
- {\doattributes{\??kj#1}\c!kopletter\c!kopkleur
- {\labeltexts{#1}{\flhetnummer}}%
- \doattributes{\??kj#1}\c!letter\c!kleur
- {\tfskip#3}}}
- {\global\letvalue{@fl@r@#1}\relax
- \global\letvalue{@fl@t@#1}\relax}}
-
-\def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}}
-\def\placefloatcaptionreference[#1]{\getvalue{@fl@r@#1}}
-
-% still needed for uguide
+% still needed for uguide
\let\placefloatlabel \placefloatcaption
\let\placefloatlabeltext \placefloatcaptiontext
@@ -301,7 +270,7 @@
\def\checkframedtext%
{\ifinsidefloat
\localhsize\hsize
- \else\ifdim\sidefloatvsize>\zeropoint % will be proper handle
+ \else\ifdim\sidefloatvsize>\zeropoint % will be proper handle
% \strut % rather clean way to invoke the sidefloat OTR
% \setbox0=\lastbox % and get the widths set, so from now on we
% \setlocalhsize % can have framed texts alongside sidefloats
@@ -316,85 +285,11 @@
{\def\currentcol{0}\increment\maximumrow
\setupTABLE[\v!rij][\maximumrow][#1]#3}
-\def\obeyfollowingtoken{{}} % end \cs scanning
+\def\obeyfollowingtoken{{}} % end \cs scanning
\def\gobbleparameters{\doquadrupleempty\dogobbleparameters}
\def\dogobbleparameters[#1][#2][#3][#4]{}
-% faster, and looks okay
-
-\dostepwiserecurse{0}{255}{1}
- {\@EA\chardef\csname-\recurselevel\endcsname=\recurselevel}
-
-\newtoks\withminorcharacters
-\newtoks\withlowercharacters
-\newtoks\withuppercharacters
-
-% \thewithcharacter#1 % self
-
-\dostepwiserecurse{0}{31}{1}
- {\expanded
- {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
- \noexpand\to\withminorcharacters}}
-
-\dostepwiserecurse{32}{127}{1}
- {\expanded
- {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
- \noexpand\to\withlowercharacters}}
-
-\dostepwiserecurse{128}{255}{1}
- {\expanded
- {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
- \noexpand\to\withuppercharacters}}
-
-\def\doassigncatcodes#1%
- {\def\withcharacter##1{\catcode##1#1}%
- \the\withminorcharacters
- \the\withlowercharacters
- \ifeightbitcharacters\the\withuppercharacters\fi}
-
-\def\makeallother%
- {\doassigncatcodes\@@other}
-
-\makeallothertoks\emptytoks
-
-\chardef\obeyedlccode=`. % so <32 and >127 chars become .
-
-\def\obeylccodes%
- {\def\withcharacter##1{\lccode##1##1}%
- \the\withlowercharacters
- \def\withcharacter##1{\lccode##1\obeyedlccode}%
- \the\withminorcharacters
- \ifeightbitcharacters\the\withuppercharacters\fi}
-
-\definesystemvariable{en}
-
-\def\setupenv{\dodoubleargument\rawgetparameters[\??en]}
-
-\def\doifenvelse#1{\doifdefinedelse{\??en#1}}
-
-% \def\envvar#1#2{\ifundefined{\??en#1}#2\else\getvalue{\??en}\fi}
-
-\def\env#1{\getvalue{\??en#1}}
-
-\beginTEX
-
-\def\envvar#1#2%
- {\@EA\ifx\csname\??en#1\endcsname\relax
- #2\else\csname\??en#1\endcsname
- \fi}
-
-\endTEX
-
-\beginETEX \ifcsname
-
-\def\envvar#1#2%
- {\ifcsname\??en#1\endcsname
- \csname\??en#1\endcsname\else#2%
- \fi}
-
-\endETEX
-
\def\setvariables%
{\dodoubleargument\dosetvariables}
@@ -407,26 +302,7 @@
\let\currentvariableclass\empty
-% in both (otr) modules !
-
-\def\doifrightpageelse#1#2%
- {\ifdubbelzijdig
- \gettwopassdata{\s!paragraph}%
- \iftwopassdatafound
- \ifodd\twopassdata#1\else#2\fi
- \else
- \ifodd\realfolio#1\else#2\fi
- \fi
- \else
- #1% was #2
- \fi}
-
-\def\signalrightpage%
- {\ifdubbelzijdig
- \doparagraphreference
- \fi}
-
-%D To be documented, \type {\includemenu[menu]}.
+%D To be documented, \type {\includemenu[menu]}.
%D To be documented, \type {\emphbf} cum suis.
%D A prelude to strategies. Note for myself: overloads
@@ -484,10 +360,15 @@
\def\doifstrategyvariable #1#2{\doifstrategyvariableelse{#1}{#2}{}}
\def\doifnotstrategyvariable#1#2{\doifstrategyvariableelse{#1}{}{#2}}
-
-%D New: only at start of columns; may change ! Rather
-%D interwoven and therefore to be integrated when the multi
-%D column modules are merged.
+
+\let\definieerkolomgroep\definecolumnset
+\let\stelkolomgroepin \setupcolumnset
+\let\startkolomgroep \startcolumnset
+\let\stopkolomgroep \stopcolumnset
+
+%D New: only at start of columns; may change ! Rather
+%D interwoven and therefore to be integrated when the multi
+%D column modules are merged.
% already taken care of: \definesystemvariable{ks}
@@ -547,23 +428,23 @@
\prevdepth\dp\strutbox
\egroup}
\vbox\bgroup
- %\topskipcorrection % becomes an option !
- \EveryPar{\begstrut\EveryPar{}}} % also !
+ %\topskipcorrection % becomes an option !
+ \EveryPar{\begstrut\EveryPar{}}} % also !
\def\startcolumnspan%
{\dosingleempty\dostartcolumnspan}
\def\stopcolumnspan%
{\egroup}
-
-%D For Ton. Do be documented.
+
+%D For Ton. To be documented.
\def\plaatsexterndocument[#1]%
{\def\doexternaldocument[##1][##2][##3]%
{\readlocfile{##2}{}{}}%
\getvalue{\v!file:::#1}}
-
-%D Far from complete.
+
+%D Far from complete.
\def\startgeheel%
{\startregelcorrectie
@@ -571,12 +452,12 @@
\def\stopgeheel
{\stopregelcorrectie}
-
-%D No more news.
+
+%D No more news.
\protect
-%D A few local optimizations and new features, if defined:
+%D A few local optimizations and new features, if defined:
\readfile {cont-loc} {} {}
diff --git a/tex/context/base/cont-sys.ori b/tex/context/base/cont-sys.ori
index 4da61099c..a571c8c60 100644
--- a/tex/context/base/cont-sys.ori
+++ b/tex/context/base/cont-sys.ori
@@ -71,9 +71,9 @@
%
% Enabling \CONTEXT\ navigation symbols as well as \euro's.
-\usesymbols [nav,eur]
+\usesymbols [nav,mvs]
-\setupsymbolset [navigation 1]
+\setupsymbolset [navigation 1] % not that clever
\setupinteraction [\c!symboolset=navigation 1]
diff --git a/tex/context/base/cont-usr.ori b/tex/context/base/cont-usr.ori
index e11370510..38dbab706 100644
--- a/tex/context/base/cont-usr.ori
+++ b/tex/context/base/cont-usr.ori
@@ -30,10 +30,11 @@
\definefilesynonym [lang-da.pat] [dkhyph.tex]
\definefilesynonym [lang-de.pat] [dehyphn.tex]
\definefilesynonym [lang-en.pat] [ushyph1.tex]
+\definefilesynonym [lang-es.pat] [eshyph.tex]
\definefilesynonym [lang-fi.pat] [fihyph.tex]
\definefilesynonym [lang-fr.pat] [frhyph.tex]
-\definefilesynonym [lang-hu.pat] [huhyph.tex]
\definefilesynonym [lang-hr.pat] [hrhyph.tex]
+\definefilesynonym [lang-hu.pat] [huhyph.tex]
\definefilesynonym [lang-it.pat] [ithyph.tex]
\definefilesynonym [lang-la.pat] [lahyph7.tex]
\definefilesynonym [lang-nl.pat] [nehyph.tex]
@@ -41,10 +42,11 @@
\definefilesynonym [lang-pl.pat] [plhyph.tex]
\definefilesynonym [lang-pt.pat] [pthyph.tex]
\definefilesynonym [lang-ro.pat] [rohyph.tex]
+\definefilesynonym [lang-ru.pat] [ruenhyph.tex]
\definefilesynonym [lang-sk.pat] [skhyph.tex]
-\definefilesynonym [lang-es.pat] [eshyph.tex]
\definefilesynonym [lang-sv.pat] [sehyph.tex]
\definefilesynonym [lang-tr.pat] [trhyph.tex]
+\definefilesynonym [lang-ua.pat] [ukrenhyp.tex]
\definefilesynonym [lang-uk.pat] [ukhyphen.tex]
\definefilesynonym [lang-us.pat] [ushyph1.tex]
@@ -86,9 +88,11 @@
% \installlanguage [\s!da] [\c!status=\v!start] % danish
% \installlanguage [\s!de] [\c!status=\v!start] % german
% \installlanguage [\s!en] [\c!status=\v!start] % english us
+% \installlanguage [\s!es] [\c!status=\v!start] % spanish
% \installlanguage [\s!fi] [\c!status=\v!start] % finnish
% \installlanguage [\s!fr] [\c!status=\v!start] % french
% \installlanguage [\s!hr] [\c!status=\v!start] % croatian
+% \installlanguage [\s!hu] [\c!status=\v!start] % hungarian
% \installlanguage [\s!it] [\c!status=\v!start] % italian
% \installlanguage [\s!la] [\c!status=\v!start] % latin
% \installlanguage [\s!nl] [\c!status=\v!start] % dutch
@@ -96,11 +100,11 @@
% \installlanguage [\s!pl] [\c!status=\v!start] % polish
% \installlanguage [\s!pt] [\c!status=\v!start] % portuguese
% \installlanguage [\s!ro] [\c!status=\v!start] % romanian
-% \installlanguage [\s!hu] [\c!status=\v!start] % hungarian
+% \installlanguage [\s!ru] [\c!status=\v!start] % russian
% \installlanguage [\s!sk] [\c!status=\v!start] % slovak
-% \installlanguage [\s!es] [\c!status=\v!start] % spanish
% \installlanguage [\s!sv] [\c!status=\v!start] % swedish
% \installlanguage [\s!tr] [\c!status=\v!start] % turkish
+% \installlanguage [\s!ua] [\c!status=\v!start] % ukrainian
% \installlanguage [\s!uk] [\c!status=\v!start] % english uk
% \installlanguage [deo] [\c!status=\v!start] % old german
@@ -114,9 +118,11 @@
% \setupcurrentlanguage[\s!da]
% \setupcurrentlanguage[\s!de]
% \setupcurrentlanguage[\s!en]
+% \setupcurrentlanguage[\s!es]
% \setupcurrentlanguage[\s!fi]
% \setupcurrentlanguage[\s!fr]
% \setupcurrentlanguage[\s!hr]
+% \setupcurrentlanguage[\s!hu]
% \setupcurrentlanguage[\s!it]
% \setupcurrentlanguage[\s!la]
% \setupcurrentlanguage[\s!nl]
@@ -124,11 +130,11 @@
% \setupcurrentlanguage[\s!pl]
% \setupcurrentlanguage[\s!pt]
% \setupcurrentlanguage[\s!ro]
-% \setupcurrentlanguage[\s!hu]
+% \setupcurrentlanguage[\s!ru]
% \setupcurrentlanguage[\s!sk]
-% \setupcurrentlanguage[\s!es]
% \setupcurrentlanguage[\s!sv]
% \setupcurrentlanguage[\s!tr]
+% \setupcurrentlanguage[\s!ua]
%D Local font settings can go here. Normally suitable
%D defaults are already preloaded, almost certainly the
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 923836a70..356139e4e 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -11,9 +11,11 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% dec 07 2001 : cont-en.efmt : 4,035,912
+
\catcode`\{=1 \catcode`\}=2
-\def\contextversion{2001.8.28}
+\def\contextversion{2002.1.11}
%D Welcome to the main module. When this module is ran through
%D \type{initex} or \type{tex -i} or \type{whatevertex} using
@@ -27,7 +29,13 @@
%D manipulation macros. The first one loads \PLAIN\ \TEX, as
%D minimal as possible.
-\input syst-tex.tex
+%input syst-tex.tex
+
+\input syst-pln.tex % stripped plain
+\input syst-prm.tex % saved primitives (will be extended)
+
+\input math-pln.tex % basic plain math
+
\input syst-etx.tex
\input syst-gen.tex
\input syst-ext.tex
@@ -85,6 +93,10 @@
\input verb-ini.tex % replaces supp-ver
+%D The following modules are not sequentially dependent,
+%D i.e. they have ugly dependencies, which will be cleaned
+%D up by adding more overloading.
+
%D When loading the font, color and special modules, we need a
%D bit more advanced file handling as well as some general
%D variables, so next we load:
@@ -121,6 +133,7 @@
\input spec-mis.tex
\input spec-ini.tex
+\input spec-def.tex
%D For the moment we load a lot of languages. In the future
%D we'll have to be more space conservative.
@@ -163,7 +176,7 @@
\input core-tab.tex
\input core-nav.tex
\input core-ref.tex
-\input core-obj.tex
+\input core-obj.tex
\input core-buf.tex
\input core-lst.tex
\input core-num.tex
@@ -251,11 +264,16 @@
\input core-fig.tex % after page body
\input core-par.tex
-%D Only the basic XML parser is part of the core.
+%D Only the basic XML parser and remapper are part of the core.
+%D These macrosa re loaded last since they overload and|/|or
+%D extend previously defined ones.
\input xtag-ini.tex
\input xtag-ext.tex
-%input xtag-map.tex
+\input xtag-map.tex
+\input xtag-exp.tex
+\input xtag-pre.tex
+\input xtag-xsd.tex
%input xtag-ent.tex
%D The next two modules implement some additional
@@ -375,11 +393,7 @@
%D Let's quit this file when doing a \type {cont-..} generation.
-\doifparentfileelse{context}
- {\let\next\relax}
- {\let\next\endinput}
-
-\next
+\doifparentfileelse{context}{\let\next\relax}{\let\next\endinput} \next
%D Unless we're generating a \type {cont-..} format, we also
%D do the following.
diff --git a/tex/context/base/core-buf.tex b/tex/context/base/core-buf.tex
index e68c48f76..ecf42b81f 100644
--- a/tex/context/base/core-buf.tex
+++ b/tex/context/base/core-buf.tex
@@ -129,34 +129,6 @@
\unprotect
-% PAS OP!
-
-\def\checknummer#1%
- {\bgroup
-%\message{\the\blocklevel}\wait
- \ifdoingblocks
- \doifelsevalue{\s!number#1\c!blokwijze}{\v!nee}
- {\dochecknummer{#1}}
- {\setblockcounters % dit kan sneller omdat de waarden
- \dochecknummer{#1}}% % en het type bekend zijn
- \else
- \dochecknummer{#1}%
- \fi
- \egroup}
-
-\def\maakvoorafgaandenummer[#1]%
- {\bgroup
-%\message{\the\blocklevel}\wait
- \ifdoingblocks
- \doifelsevalue{\s!number#1\c!blokwijze}{\v!nee}
- {\domaakvoorafgaandenummer[#1]}%
- {\setblockcounters % dit kan sneller omdat de waarden
- \domaakvoorafgaandenummer[#1]}% % en het type bekend zijn
- \else
- \domaakvoorafgaandenummer[#1]%
- \fi
- \egroup}
-
\def\resetbuffer%
{\dosingleempty\doresetbuffer}
@@ -247,9 +219,9 @@
\getvalue{#4}}%
\doifelsenothing{#2}
{\message{<\TEXbufferfile{\jobname}>}%
- \immediate\openout\tmpblocks=\TEXbufferfile{\jobname}}
+ \immediate\openout\tmpblocks\TEXbufferfile{\jobname}}
{\message{<\TEXbufferfile{#2}>}%
- \immediate\openout\tmpblocks=\TEXbufferfile{#2}}%
+ \immediate\openout\tmpblocks\TEXbufferfile{#2}}%
\ifsegmentatebuffer
\immediate\write\tmpblocks{\string\startbufferparagraph}%
\fi
@@ -280,21 +252,24 @@
{\dodobuffer\jobname}
{\processcommalist[#2]\dodobuffer}}
-\def\haalbuffer%
- {\dodoubleempty\dohaalbuffer}
+\def\processTEXbuffer%
+ {\dodoubleempty\doprocessTEXbuffer}
-\def\dohaalbuffer[#1][#2]%
+\def\doprocessTEXbuffer[#1][#2]%
{\ifsecondargument
- \dodohaalbuffer[#1][#2]%
+ \dodoprocessTEXbuffer[#1][#2]%
\else
- \dodohaalbuffer[][#1]%
+ \dodoprocessTEXbuffer[][#1]%
\fi}
-\def\dodohaalbuffer[#1][#2]%
+\def\dodoprocessTEXbuffer[#1][#2]%
{\getvalue{\??bu#1\c!voor}%
\dobuffer{16}[#2]\readjobfile
\getvalue{\??bu#1\c!na}}
+\let\getbuffer \processTEXbuffer % handy
+\let\haalbuffer\processTEXbuffer % will move to mult-com.tex
+
\def\typebuffer%
{\dodoubleempty\dotypebuffer}
@@ -323,7 +298,7 @@
\setevalue{\e!start#1}%
{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
\setevalue{\e!haal#1}%
- {\noexpand\dodohaalbuffer[#1][def-\nofdefinedbuffers]}%
+ {\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}%
\setevalue{\e!type#1}%
{\noexpand\dodotypebuffer[#1][def-\nofdefinedbuffers]}%
\fi}
@@ -576,14 +551,32 @@
\def\writeoutblocks%
{\immediate\write\outblocks}
-\def\processnextblocklineAB#1#2#3%
+% readable
+%
+% \def\processnextblocklineAB#1#2#3%
+% {\convertargument#1 \to\next
+% \doifinstringelse{\endofblockA}{\next}
+% {\def\next{#2}}
+% {\doifinstringelse{\endofblockB}{\next}
+% {\def\next{#2}}
+% {\def\next{#3}}}%
+% \next}
+%
+% faster
+%
+% \def\processnextblocklineAB#1#2#3%
+% {\convertargument#1 \to\next % space is essential
+% \doifinstringelse\endofblockA\next
+% {#2}{\doifinstringelse\endofblockB\next{#2}{#3}}}
+%
+% even more
+
+\def\processnextblocklineAB#1% #2#3%
{\convertargument#1 \to\next
- \doifinstringelse{\endofblockA}{\next}
- {\def\next{#2}}
- {\doifinstringelse{\endofblockB}{\next}
- {\def\next{#2}}
- {\def\next{#3}}}%
- \next}
+ \doifinstringelse\endofblockA\next
+ \firstoftwoarguments
+ {\doifinstringelse\endofblockB\next
+ \firstoftwoarguments\secondoftwoarguments}}
\bgroup
\obeylines
@@ -599,18 +592,32 @@
{\skipblocklineAB}}
\egroup
-\def\processnextblockline#1#2#3%
+% \def\processnextblockline#1#2#3%
+% {\convertargument#1 \to\next
+% \ifx\next\emptybufferline
+% \ifsegmentatebuffer \emptybufferlinetrue \fi
+% \def\next{#3}%
+% \else
+% \emptybufferlinefalse
+% \doifinstringelse{\endofblock}{\next}
+% {\def\next{#2}}
+% {\def\next{#3}}%
+% \fi
+% \next}
+%
+% faster
+
+\def\processnextblockline#1% #2#3%
{\convertargument#1 \to\next
\ifx\next\emptybufferline
\ifsegmentatebuffer \emptybufferlinetrue \fi
- \def\next{#3}%
+ \expandafter\secondoftwoarguments% #3%
\else
\emptybufferlinefalse
- \doifinstringelse{\endofblock}{\next}
- {\def\next{#2}}
- {\def\next{#3}}%
- \fi
- \next}
+ \doifinstringelse\endofblock\next
+ {\expandafter\firstoftwoarguments }% #2}
+ {\expandafter\secondoftwoarguments}% #3}%
+ \fi}
\bgroup
\obeylines
diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex
index 4396e4366..927a94f0f 100644
--- a/tex/context/base/core-con.tex
+++ b/tex/context/base/core-con.tex
@@ -55,8 +55,36 @@
\def\romannumerals#1%
{\romannumeral#1}
+%D For some years we had \unknown
+%D
+%D \starttypen
+%D \def\Romannumerals#1%
+%D {\uppercase\expandafter{\romannumeral#1}}
+%D \stoptypen
+%D
+%D \unknown but we need to be fully expandable in order to get
+%D the utility output file right, so now we have th efollowing
+%D solution. It was Patrick Gundlach who first noticed this
+%D ommision.
+
\def\Romannumerals#1%
- {\uppercase\expandafter{\romannumeral#1}}
+ {\expandafter\doRomannumerals\number#1\relax}
+
+\def\doRomannumerals#1#2\relax % spaces after ifcase prevent \relax
+ {\ifnum#1#2<10
+ \ifcase0#1#2 \or I\or II\or III\or IV\or V\or VI\or VII\or VIII\or IX\fi
+ \else\ifnum#1#2<100
+ \ifcase0#1 \or X\or XX\or XXX\or XL\or L\or LX\or LXX\or LXXX\or XC\fi
+ \doRomannumerals#2\relax
+ \else\ifnum#1#2<1000
+ \ifcase0#1 \or C\or CC\or CCC\or CD\or D\or DC\or DCC\or DCCC\or CM\fi
+ \doRomannumerals#2\relax
+ \else\ifnum#1#2<4000
+ \ifcase0#1 \or M\or MM\or MMM\fi
+ \doRomannumerals#2\relax
+ \else
+ \uppercase\expandafter{\romannumeral#1#2}%
+ \fi\fi\fi\fi}
%D \macros
%D {character,Character}
@@ -185,10 +213,10 @@
%D possible, and because \TEX\ already uses up some of those,
%D we save the original meanings.
-\let\normaltime = \time
-\let\normalyear = \year
-\let\normalmonth = \month
-\let\normalday = \day
+\savenormalmeaning\time
+\savenormalmeaning\year
+\savenormalmeaning\month
+\savenormalmeaning\day
%D \macros
%D {month,MONTH}
@@ -432,7 +460,7 @@
%D We can also typeset arbitrary dates, using the previous
%D command.
%D
-%D \typebyffer
+%D \typebuffer
%D
%D The date is specified by one character keys. When no date
%D is given, we get the current date.
@@ -443,35 +471,75 @@
\def\kenmerkdatumpatroon{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000
+% \def\complexcurrentdate[#1]%
+% {\bgroup
+% \let\labellanguage\currentlanguage
+% \def\betweendates{\let\betweendates\space}%
+% \lowercase{\edef\!!stringa{#1}}% permits usage in \kap
+% \@EA\processallactionsinset\@EA
+% [\!!stringa]
+% [ \v!dag=>\betweendates\the\normalday,
+% \v!maand=>\betweendates\month\normalmonth,
+% \v!jaar=>\betweendates\the\normalyear,
+% \ =>\ , % optimization -)
+% d=>\the\normalday,
+% m=>\the\normalmonth,
+% j=>\the\normalyear,
+% y=>\the\normalyear,
+% w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
+% dd=>\ifnum\normalday >9 \else0\fi\the\normalday,
+% mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth,
+% jj=>\expandafter\gobbletwoarguments\the\normalyear,
+% yy=>\expandafter\gobbletwoarguments\the\normalyear,
+% \v!weekdag=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
+% % \v!MAAND=>\betweendates\MONTH\normalmonth,
+% % \v!WEEKDAG=>\betweendates
+% % \bgroup
+% % \let\labeltext=\LABELTEXT
+% % \dayoftheweek\normalday\normalmonth\normalyear
+% % \egroup,
+% \v!kenmerk=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]},
+% \s!unknown=>\commalistelement
+% \def\betweendates{\let\betweendates\space}]%
+% \egroup}
+
+\newsignal\datesignal
+
+\def\dobetweendates%
+ {\ifdim\lastskip=\datesignal\relax\else
+ \unskip\space
+ \hskip\datesignal\relax
+ \fi}
+
\def\complexcurrentdate[#1]%
{\bgroup
- \let\labellanguage=\currentlanguage
- \def\betweendates{\let\betweendates\space}%
+ \let\labellanguage\currentlanguage
+ \def\betweendates{\let\betweendates\dobetweendates}%
\lowercase{\edef\!!stringa{#1}}% permits usage in \kap
\@EA\processallactionsinset\@EA
[\!!stringa]
- [ dd=>\ifnum\normalday>9 \else0\fi\the\normalday,
- mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth,
- jj=>\expandafter\gobbletwoarguments\the\normalyear,
- yy=>\expandafter\gobbletwoarguments\the\normalyear,
+ [ \v!dag=>\betweendates\the\normalday,
+ \v!maand=>\betweendates\month\normalmonth,
+ \v!jaar=>\betweendates\the\normalyear,
+ \ =>\unskip\ \hskip\datesignal,% optimization -)
d=>\the\normalday,
m=>\the\normalmonth,
j=>\the\normalyear,
y=>\the\normalyear,
w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
- \v!kenmerk=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]},
- \v!dag=>\betweendates\the\normalday,
- \v!maand=>\betweendates\month\normalmonth,
-% \v!MAAND=>\betweendates\MONTH\normalmonth,
- \v!jaar=>\betweendates\the\normalyear,
+ dd=>\ifnum\normalday >9 \else0\fi\the\normalday,
+ mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth,
+ jj=>\expandafter\gobbletwoarguments\the\normalyear,
+ yy=>\expandafter\gobbletwoarguments\the\normalyear,
\v!weekdag=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
-% \v!WEEKDAG=>\betweendates
-% \bgroup
-% \let\labeltext=\LABELTEXT
-% \dayoftheweek\normalday\normalmonth\normalyear
-% \egroup,
- \s!unknown=>\commalistelement
- \def\betweendates{\let\betweendates\space}]%
+ \v!kenmerk=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]},
+ \s!unknown=>\unskip
+ \commalistelement
+ \hskip\datesignal
+ \def\betweendates{\let\betweendates\dobetweendates}]%
+ \ifdim\lastskip=\datesignal\relax
+ \unskip
+ \fi
\egroup}
\def\simplecurrentdate%
@@ -496,9 +564,34 @@
\fi
\egroup}
-\def\date%
+\def\date
{\dodoubleempty\dodate}
+%D \macros
+%D {currenttime}
+%D
+%D The currenttime is actually the jobtime. You can specify
+%D a pattern similar to the previous date macro using the
+%D keys \type {h}, \type {m} and a separator.
+
+\def\calculatecurrenttime
+ {\DoDiv\time by60to\scratchcounter\edef\currenthour {\the\scratchcounter}%
+ \DoMod\time by60to\scratchcounter\edef\currentminute{\the\scratchcounter}}
+
+\appendtoks \calculatecurrenttime \to \everyjob
+
+\def\currenttimespecification{h,:,m}
+
+\def\complexcurrenttime[#1]%
+ {\calculatecurrenttime
+ \processallactionsinset[#1]
+ [h=>\currenthour,m=>\currentminute,\s!unknown=>\commalistelement]}
+
+\def\simplecurrenttime
+ {\expanded{\complexcurrenttime[\currenttimespecification]}}
+
+\definecomplexorsimple\currenttime
+
%D Because we're dealing with dates, we also introduce a few
%D day loops:
%D
@@ -555,17 +648,21 @@
{\advance\scratchcounter by 1
\setvalue{\??cv#1\the\scratchcounter}{##1}}%
\processcommalist[#2]\docommando
- \setvalue{\??cv#1}##1{\getvalue{\??cv#1##1}}}
+ \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}}
{\setvalue{\??cv#1}{#2}}}
\def\defineconversion%
{\dodoubleargument\dodefineconversion}
\def\convertnumber#1%
- {\getvalue{\??cv#1}}
+ {\csname\??cv#1\endcsname}
\def\doifconversiondefinedelse#1%
- {\doifdefinedelse{\??cv#1}}
+ {\ifundefined{\??cv#1}%
+ \@EA\secondoftwoarguments
+ \else
+ \@EA\firstoftwoarguments
+ \fi}
%D As longs as symbols are linked to levels or numbers, we can
%D also use the conversion mechanism, but in for instance the
diff --git a/tex/context/base/core-dat.tex b/tex/context/base/core-dat.tex
index 50aeb3bd9..f1211ad53 100644
--- a/tex/context/base/core-dat.tex
+++ b/tex/context/base/core-dat.tex
@@ -81,55 +81,55 @@
%D A database file |<|in most cases such a base is generated
%D from another one|>| is structured as follows:
%D
-%D \starttyping
+%D \starttypen
%D \startrecord{tag}
%D \memberofgroup{grouplist}
%D \setrecordentry{name}{...}
%D ....
%D \stoprecord
-%D \stoptyping
+%D \stoptypen
%D
%D The interface to such a database is defined as follows:
%D
-%D \starttyping
+%D \starttypen
%D \definerecord[class][settings]
%D \setuprecord[class][settings]
%D \definerecordentry[class][name]
-%D \stoptyping
+%D \stoptypen
%D
%D and processed by
%D
-%D \starttyping
+%D \starttypen
%D \processrecords[file list][tag and/or group list]
-%D \stoptyping
+%D \stoptypen
%D
%D The actual processing is done by a macro assigned to \type
%D {command}:
%D
-%D \starttyping
+%D \starttypen
%D \setuprecord[class][command=\DoWithRecord]
-%D \stoptyping
+%D \stoptypen
%D
%D Given that one can ask for a field with
%D
-%D \starttyping
+%D \starttypen
%D \getrecordentry{name}
-%D \stoptyping
+%D \stoptypen
%D
%D such a command can look like:
%D
-%D \starttyping
+%D \starttypen
%D \def\DoWithRecord#1%
%D {\startpacked
%D \let\\=\quad
%D name: \getrecordentry{name}~\getrecordentry{family name}\par
%D address: \getrecordentry{postal address}\par
%D \stoppacked}
-%D \stoptyping
+%D \stoptypen
%D
%D The argument passed is the tag. The database can look like:
%D
-%D \starttyping
+%D \starttypen
%D \startrecord{hagenj}
%D \memberofgroup{a,b}
%D \setrecordentry{naam}{Hans}
@@ -143,27 +143,27 @@
%D \setrecordentry{family name}{Otten}
%D \setrecordentry{postal address}{A.F. Otten\\Prinsengracht 17\\Hasselt NL}
%D \stoprecord
-%D \stoptyping
+%D \stoptypen
%D
%D The definition of this database looks like:
%D
-%D \starttyping
+%D \starttypen
%D \definerecord[address][command=\DoWithRecord]
%D
%D \definerecordentry[address][name]
%D \definerecordentry[address][family name]
%D \definerecordentry[address][postal address]
-%D \stoptyping
+%D \stoptypen
%D
%D The actual processing is now done by (for instance):
%D
-%D \starttyping
+%D \starttypen
%D \processrecords[datafile][hagenj]
%D \processrecords[datafile][hagenj,offenaf]
%D \processrecords[datafile][all]
%D \processrecords[datafile][a]
%D \processrecords[datafile][b]
-%D \stoptyping
+%D \stoptypen
%D
%D Of course one can reassing the command used to handle the
%D records in between.
@@ -277,7 +277,7 @@
%D experiments with \type {%} before each entry and changing
%D the category code of the comment char. Because \TEX\ scans
%D the line anyway |<|this is needed because the end of line
-%D character can be non standard|> this is not faster.
+%D character can be non standard|>| this is not faster.
%D
%D Although this mechanism could have been combined with the
%D block moving mechaism, the current implementation is
diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex
index f5d34c0b0..5e88257cf 100644
--- a/tex/context/base/core-des.tex
+++ b/tex/context/base/core-des.tex
@@ -415,8 +415,13 @@
{\ignorespaces}
{\strut\getvalue{\??dd#1\c!tekst}\fixedspace}}
+% \def\showdnnummer#1%
+% {\voorafgaandenummer
+% \nummer[\getvalue{\??dd#1\??dd\c!nummer}]}
+
\def\showdnnummer#1%
- {\voorafgaandenummer%
+ {\preparethenumber{\??dd#1}\voorafgaandenummer\preparednumber
+ \preparednumber
\nummer[\getvalue{\??dd#1\??dd\c!nummer}]}
\def\showdnsubnummer#1%
@@ -483,10 +488,9 @@
{\let\normalkap\relax % sorry, uppercase causes troubles
\doattributes % \nocase primitive needed
{\??dd#1}\c!kopletter\c!kopkleur
-{\getvalue{\??dd#1\c!commando}%
- {\showdntext{#2#1}%
- \domakednnummer{#1}{#2}{#3}}%
-}%
+ {\getvalue{\??dd#1\c!commando}% hook for taco
+ {\showdntext{#2#1}%
+ \domakednnummer{#1}{#2}{#3}}}%
\iflocation\ifcase\definitiekoppeling \else
\edef\localconnection{\getvalue{\??dd#1\c!koppeling}:\internaldoornummer}%
\doifreferencefoundelse{\localconnection}
@@ -498,9 +502,8 @@
\hbox
{\edef\!!stringa{\showdnpuretext{#2#1}}% nog eens testen binnen \expanded
\expanded{\doattributes{\??dd#1}\noexpand\c!kopletter\noexpand\c!kopkleur
-{\noexpand\getvalue{\??dd#1\c!commando}%
- {\!!stringa}}%
-}%
+ {\noexpand\getvalue{\??dd#1\c!commando}%
+ {\!!stringa}}}%
\doifnot{#5}{-}{\rawreference{\s!num}{#5}{}}}%
\fi}
@@ -581,7 +584,8 @@
\c!monster,\c!hang,\c!uitlijnen,\c!voor,\c!tussen,\c!na,
\c!niveaus,\c!wijze,\c!blokwijze,\c!scheider,\c!marge,
\c!springvolgendein,\c!afsluiter,\c!sectienummer,\c!nummer]%
- \ConvertToConstant\doifinstringelse{=}{#4}
+% \ConvertToConstant\doifinstringelse{=}{#4}
+ \doifassignmentelse{#4}
{\getparameters[\??dd#3#1]%
[\c!tekst=#1,\??dd\c!nummer=#1,\c!conversie=,
\c!links=,\c!rechts=,\c!koppeling=,\c!koppelwijze=\v!lokaal,#4]}%
@@ -710,7 +714,7 @@
\def\dodoorlabel[#1][#2]%
{\getvalue{\s!number#1\c!voor}%
\bgroup
- \doif{\getvalue{\s!number#1\c!plaats}}{\v!marge}
+ \doifvalue{\s!number#1\c!plaats}{\v!marge}
{\setvalue{\s!number#1\c!plaats}{\v!inmarge}}%
\doattributes{\s!number#1}\c!kopletter\c!kopkleur
{\getvalue{\e!volgende#1}[#2]}%
@@ -722,22 +726,12 @@
\def\dodoorlabelen[#1][#2]%
{\definieernummer
- [#1]
- [\c!voor=,
- \c!na=,
- \c!kopletter=,
- \c!wijze=\@@nrwijze,
- #2]%
- \setvalue{#1}%
- {\dodoubleempty\dodoorlabel[#1]}%
- \setvalue{\s!reset#1}%
- {\resetnummer[#1]}%
- \setvalue{\e!verhoog#1}%
- {\verhoognummer[#1]}%
- \setvalue{\e!volgende#1}%
- {\dodoubleempty\dovolgendedoorlabel[#1]}%
- \setvalue{\c!huidige#1}%
- {\huidigenummer[#1]}}
+ [#1][\c!voor=,\c!na=,\c!kopletter=,\c!wijze=\@@nrwijze,#2]%
+ \setvalue {#1}{\dodoubleempty\dodoorlabel[#1]}%
+ \setvalue{\s!reset #1}{\resetnummer[#1]}%
+ \setvalue{\e!verhoog #1}{\verhoognummer[#1]}%
+ \setvalue{\e!volgende#1}{\dodoubleempty\dovolgendedoorlabel[#1]}%
+ \setvalue{\c!huidige #1}{\huidigenummer[#1]}}
\def\doorlabelen%
{\dodoubleargumentwithset\dodoorlabelen}
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index 86c22ee9c..dd8e9772d 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% error in calculations : .25% (too much: 1.5pt over full page)
+
\writestatus{loading}{Context Core Macros / Figure Inclusion}
\unprotect
@@ -96,15 +98,15 @@
\startmessages italian library: figures
title: figure
- 1: la figura -- non è stata trovata
+ 1: figura -- non trovata
2: la figura -- non è preimpostata
3: dimensioni della figura -- prese da --
4: dimensioni di -- caricate dal file di immagini stesso
5: dimensioni di -- caricate dal file di immagini --
- 6: dimensioni di -- calcolate TeXUtil
+ 6: dimensioni di -- calcolate da TeXUtil
7: bisogna rigenerare il file di immagini --
8: oggetto-figura -- riutilizzato
- 9: la figura -- non gestito
+ 9: figura -- non gestita
10: la figura -- ha dimensioni nulle
\stopmessages
@@ -212,6 +214,10 @@
\edef\externalfigurelog{\externalfigurelog[#1]\space}%
\fi}
+\let\@@efcurrenttype\empty
+\let\@@efcurrentpath\empty
+\let\@@efcurrentfile\empty
+
\def\analyzefigurefiles%
{\let\externalfigurelog\empty
\let\@@efcurrenttype\empty
@@ -295,8 +301,8 @@
\removelastskip}%
\global\setbox\foundexternalfigure=\hbox
{\raise\dp\foundexternalfigure\box\foundexternalfigure}%
- #3=\!!zeropoint
- #4=\!!zeropoint
+ #3=\zeropoint
+ #4=\zeropoint
#5=\wd\foundexternalfigure
#6=\ht\foundexternalfigure
\else
@@ -314,7 +320,7 @@
\@@eftrace{analyzing \@@efcurrentfile\space
on \@@efcurrentpath\space
as \@@efcurrenttype}%
- \!!widthb=\!!zeropoint % ?
+ \!!widthb=\zeropoint % ?
\doifdefinedelse{\@@dogetfiguresize\@@efcurrenttype}
{\executedtrue
\getvalue{\@@dogetfiguresize\@@efcurrenttype}%
@@ -322,20 +328,32 @@
{\!!widtha}{\!!heighta}{\!!widthb}{\!!heightb}}
{\executedfalse}%
\ifexecuted
- \ifdim\!!widtha=\!!zeropoint\relax\ifdim\!!heighta=\!!zeropoint\relax
- \ifdim\!!widthb=\!!zeropoint\relax\ifdim\!!heightb=\!!zeropoint\relax
+ \donetrue
+ \ifdim\!!widtha=\zeropoint\relax\ifdim\!!heighta=\zeropoint\relax
+ \ifdim\!!widthb=\zeropoint\relax\ifdim\!!heightb=\zeropoint\relax
\showmessage{\m!figures}{10}{\@@efcurrentfile}%
\@@eftrace{zero}%
+ \donefalse
\fi\fi
\fi\fi
- \doif{\@@efcurrenttype}{\c!mps}
- {\ifcase\EPScreator\executedfalse\fi}%
+ \doifelse{\@@efcurrenttype}{\c!mps}
+ {\ifcase\EPScreator
+ \executedfalse
+ \else
+ % zero width mp graphic can be useful -)
+ \fi}
+ {\ifdone
+ % non zero dimensions
+ \else
+ % zero dimensions
+ \executedfalse
+ \fi}%
\fi
\ifexecuted
\chardef\figurestatus=3
\doifelse{\@@efcurrenttype}{\c!eps}
{\ifcase\EPScreator
- \@@eftrace{found}%
+ \@@eftrace{found}%
\else
\let\@@efcurrenttype\c!mps
\@@eftrace{mps found}%
@@ -578,8 +596,8 @@
{\doifsomething{\@@efschaal}
{\doapplyfigurescale\figwid\@@epw\figxsca
\doapplyfigurescale\fighei\@@eph\figysca
- \global\figwid=\!!zeropoint
- \global\fighei=\!!zeropoint
+ \global\figwid=\zeropoint
+ \global\fighei=\zeropoint
\doifelsenothing{\@@efmaxbreedte}
{\doifsomething{\@@efmaxhoogte}
{\ifdim\@@eph>\@@efmaxhoogte
@@ -597,8 +615,8 @@
{\ifdim\fighei>\@@efmaxhoogte \global\fighei=\@@efmaxhoogte #3\relax\fi}}
\def\setdimensionfiguresize%
- {\ifdim\figwid>\!!zeropoint\relax
- \ifdim\fighei>\!!zeropoint\relax
+ {\ifdim\figwid>\zeropoint\relax
+ \ifdim\fighei>\zeropoint\relax
\dosetdimensionfiguresize%
{\docalculatefigurescale\fighei\@@eph\figysca
\docalculatefigurescale\figwid\@@epw\figxsca}%
@@ -613,7 +631,7 @@
{\docalculatefigurescales\figwid\@@epw\fighei\@@eph}%
\fi
\else
- \ifdim\fighei>\!!zeropoint\relax
+ \ifdim\fighei>\zeropoint\relax
\dosetdimensionfiguresize%
{\docalculatefigurescales\fighei\@@eph\figwid\@@epw}%
{\docalculatefigurescales\fighei\@@eph\figwid\@@epw}%
@@ -658,15 +676,36 @@
\chardef\figurefilemode=0
\fi}
+%D The next one is for instance used in symbols:
+
\def\resetexternalfigures%
{\setupexternalfigures
[\c!optie=,\c!maxbreedte=,\c!maxhoogte=,
\c!kader=\v!uit,\c!achtergrond=]}
-% will move:
+%D Since we only need to reset some parameters, we can
+%D better use a faster alternative:
+
+\def\resetexternalfigures%
+ {\getparameters[\??ef]
+ [\c!optie=,\c!maxbreedte=,\c!maxhoogte=,
+ \c!kader=\v!uit,\c!achtergrond=]}
+
+%D This one dropped the runtime of the \MAPS\ bibliography
+%D from over 110 seconds down to less than 105 seconds. The
+%D tremendously faster (but uglier) implementation is:
+
+\def\resetexternalfigures%
+ {\let\@@efoptie \empty
+ \let\@@efmaxbreedte\empty
+ \let\@@efmaxhoogte \empty
+ \let\@@efkader \v!uit
+ \let\@@efchtergrond\empty}
+
+% The following code will move:
\appendtoks \resetexternalfigures \to \everyoverlay
-\appendtoks \resetexternalfigures \to \everypagebody
+\appendtoks \resetexternalfigures \to \everybeforepagebody % not really needed
%appendtoks \resetexternalfigures \to \everysymbol
@@ -785,7 +824,7 @@
\multiply\scratchdimen by #3\relax
\fi
\scratchdimen=-\scratchdimen % beter hier - dan in driver
- \edef#2{\number\scratchdimen}%
+ \edef#2{\scratchdimen}%
\scratchdimen=#3pt
\divide\scratchdimen by \!!ten
\edef#4{\@EA\withoutpt\@EA{\the\scratchdimen}}}
@@ -822,10 +861,13 @@
% where the second one inherited some characteristics from
% the factor=max one some 30 pages back. Sigh.
+% this macro will be cleaned up when the tuf format has
+% become replaced by its xml counterpart
+
\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
{\mindermeldingen
- \global\figwid=\!!zeropoint \figxsca=1 % see note *
- \global\fighei=\!!zeropoint \figysca=1 % see note *
+ \global\figwid=\zeropoint \figxsca=1 % see note *
+ \global\fighei=\zeropoint \figysca=1 % see note *
\global\setbox\foundexternalfigure=\box\voidb@x
\edef\expandedfigurename{#3}% needed e.g. in [\get...] cases
\expandafter\beforesplitstring\expandedfigurename\at.\to\@@effilename
@@ -847,8 +889,6 @@
[\??ef]
[\c!type=\s!unknown,\c!methode=\@@eftype,\c!symbool=\v!nee,
\c!object=\@@exobject,\c!preset=\v!ja,
-% old \c!achtergrond=,\c!achtergrondkleur=,\c!achtergrondraster=\@@rsraster,
-% old \c!hoek=,\c!straal=.5\korpsgrootte,\c!kader=\v!uit,
\c!pagina=0,\c!sturing=\v!nee,\c!preview=\v!nee,\c!herhaal=\v!nee,
\c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte,
\c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,
@@ -867,6 +907,9 @@
\let\@@efextension\c!tmp
\fi
\let\@@eftype\c!tex}%
+%\@EA\doifnumberelse\@EA{\@@efextension} % new, test first
+%{\def\@@eftype{\c!mps}}
+%{%
\processaction
[\@@efextension]
[ \c!tex=>\let\@@eftype\c!tex,
@@ -875,6 +918,7 @@
\edef\@@effilename{\@@effilepref\@@effilename},
\c!avi=>\presetfigureavi,
\c!mov=>\presetfiguremov]%
+%}%
\edef\figuretypes{\figuretypes,\c!tex}%
\ifx\@@eftype\c!tex
% Since tex code can have positional stuff and worse,
@@ -882,12 +926,12 @@
% up in files, therefore:
\let\@@efobject\v!nee
\fi
+ \edef\@@efobjectname{\@@effilename-\@@eftype-\@@efextension-\@@efpagina}%
\doifelse{\@@efobject}{\v!nee}
{\donefalse}
{\doifspecialavailableelse\dostartscaling
{\doifobjectssupportedelse
- {\edef\@@efobjectname{\@@effilename-\@@eftype-\@@efextension-\@@efpagina}%
- \doifobjectfoundelse{FIG}{\@@efobjectname}{\donetrue}{\donefalse}}
+ {\doifobjectfoundelse{FIG}{\@@efobjectname}{\donetrue}{\donefalse}}
{\donefalse}}
{\donefalse}}%
% redo message, only filename
@@ -953,8 +997,8 @@
\analyzefigurefiles}}%
\let\@@epe=\@@eftype
\edef\@@efextension{\figureextension{\@@eftype}}% dirty trick
- \global\figwid=\!!zeropoint \figxsca=1
- \global\fighei=\!!zeropoint \figysca=1
+ \global\figwid=\zeropoint \figxsca=1
+ \global\fighei=\zeropoint \figysca=1
\doif{\v!kader}{\@@exoptie}
{\let\@@efkader=\v!aan}%
\fi
@@ -973,16 +1017,16 @@
\doifnot{\@@efsymbool}{\v!ja}
{\showmessage{\m!figures}{8}{\@@effullname}}%
\fi
- \ifdim\@@epw=\!!zeropoint \chardef\figurestatus=1 \fi
- \ifdim\@@eph=\!!zeropoint \chardef\figurestatus=1 \fi
+ \ifdim\@@epw=\zeropoint \chardef\figurestatus=1 \fi
+ \ifdim\@@eph=\zeropoint \chardef\figurestatus=1 \fi
\ifnum\figurestatus=1 % unknown dimensions, take width or height or scale
\setnaturalfiguresize
-\xdef\naturalfigurewidth{\the\figwid}%
-\xdef\naturalfigureheight{\the\fighei}%
+ \xdef\naturalfigurewidth{\the\figwid}%
+ \xdef\naturalfigureheight{\the\fighei}%
\let\@@efkader=\v!uit
\else
-\global\let\naturalfigurewidth\@@epw
-\global\let\naturalfigureheight\@@eph
+ \global\let\naturalfigurewidth\@@epw
+ \global\let\naturalfigureheight\@@eph
\setfactorfiguresize
\setscalefiguresize
\setdimensionfiguresize
@@ -999,16 +1043,13 @@
\fi
\doif{\v!leeg}{\@@exoptie}
{\skipexternalfigurestrue
- \let\@@efkader=\v!uit}%
+ \let\@@efkader=\v!uit}% ? ?
\doifelsenothing{\@@efpagina} % NIEUW ??
{\let\@@efoptions\empty}
{\let\@@efoptions\@@efpagina}%
- \doif{\@@efpreview}{\v!ja}
- {\addtocommalist\v!preview\@@efoptions}%
- \doif{\@@efsturing}{\v!ja}
- {\addtocommalist\v!sturing\@@efoptions}%
- \doif{\@@efherhaal}{\v!ja}
- {\addtocommalist\v!herhaal\@@efoptions}%
+ \doif{\@@efpreview}{\v!ja}{\addtocommalist\v!preview\@@efoptions}%
+ \doif{\@@efsturing}{\v!ja}{\addtocommalist\v!sturing\@@efoptions}%
+ \doif{\@@efherhaal}{\v!ja}{\addtocommalist\v!herhaal\@@efoptions}%
\doif{\@@eftype}{\c!mps}
{\ifcase\EPSspecial\else\ifinobject\else
\@@eftrace{special mps, object forced}%
@@ -1023,18 +1064,18 @@
\ifdone
\doifobjectfoundelse{FIG}{\@@efobjectname}
{}
- {\bgroup
- \figwid=\@@epw % local ?
- \fighei=\@@eph % local ?
- \scratchdimen=\@@epx\scratchdimen=-\scratchdimen
- \edef\@@epx{\number\scratchdimen}%
- \scratchdimen=\@@epy\scratchdimen=-\scratchdimen
- \edef\@@epy{\number\scratchdimen}%
- \scratchdimen=\@@epw\edef\@@epw{\number\scratchdimen}%
- \scratchdimen=\@@eph\edef\@@eph{\number\scratchdimen}%
+ {\bgroup % to be cleaned up
+ \figwid\@@epw % local ?
+ \fighei\@@eph % local ?
+ \scratchdimen\@@epx\scratchdimen-\scratchdimen
+ \edef\@@epx{\the\scratchdimen}%
+ \scratchdimen\@@epy\scratchdimen-\scratchdimen
+ \edef\@@epy{\the\scratchdimen}%
+ %\scratchdimen\@@epw\edef\@@epw{\the\scratchdimen}%
+ %\scratchdimen\@@eph\edef\@@eph{\the\scratchdimen}%
\setbox0=\vbox to \fighei
{\vfill
- \ifdim\wd\foundexternalfigure=\!!zeropoint
+ \ifdim\wd\foundexternalfigure=\zeropoint
\doinsertfile
{\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel}
{100}{100}
@@ -1042,7 +1083,7 @@
{\@@epw}{\@@eph}
{\@@efoptions}%
\else\ifskipexternalfigures
- \ruledhbox{\fakebox\foundexternalfigure}
+ \ruledhbox{\fakebox\foundexternalfigure}%
\else
\box\foundexternalfigure
\fi\fi}%
@@ -1067,17 +1108,33 @@
{\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel}
{\scax}{\scay}
{\figx}{\figy}
- {\number\figwid}{\number\fighei}
+ {\figwid}{\fighei}
{\@@efoptions}}%
\xdef\noffigurepages{\number\nofinsertpages}%
\else
- \dimen0=\scax pt\divide\dimen0 by 100\edef\scax{\@EA\withoutpt\the\dimen0}%
- \dimen0=\scay pt\divide\dimen0 by 100\edef\scay{\@EA\withoutpt\the\dimen0}%
+ \dimen0=\scax pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}%
+ \dimen0=\scay pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}%
\schaal[sx=\scax,sy=\scay]{\dowithfigure{\box\foundexternalfigure}}%
\xdef\noffigurepages{\number\nofinsertpages}%
- \fi\fi}%
- \global\wd\foundexternalfigure=\figwid}
+ \fi\fi
+ \global\let\appliedfigurexscale\scax
+ \global\let\appliedfigureyscale\scay}%
+ \global\wd\foundexternalfigure=\figwid
+ \the\externalfigurepostprocessors}
+
+\newtoks\externalfigurepostprocessors
+
+\gdef\appliedfigurexscale{1}
+\gdef\appliedfigureyscale{1}
+% will go internal
+
+\def\appliedfigurefilename {\@@effilename}
+\def\appliedfigurefilepath {\@@efcurrentpath}
+\def\appliedfigureshortname {\@@efcurrentpath/\@@effilename}
+\def\appliedfigurefullname {\@@efcurrentfile}
+\def\appliedfigureidentifier{\@@efobjectname}
+\def\appliedfigureoptions {\@@efoptie}
%D In \PDF\ one can specify an alternative graphic. This means
%D that for instance a low resolution graphic can be used for
@@ -1114,16 +1171,26 @@
\let\naturalfigurewidth =\!!zeropoint
\let\figureheight =\!!zeropoint
\let\figurewidth =\!!zeropoint
-\def\noffigurepages {1}
-\def\getfiguredimensions%
- {\dodoubleempty\dogetfiguredimensions}
+\def\noffigurepages{\nofinsertpages}
-\gdef\noffigurepages{\nofinsertpages}
+\def\getfiguredimensions
+ {\dodoubleempty\dogetfiguredimensions}
\def\dogetfiguredimensions[#1][#2]%
{{\let\immediate\relax % very dirty but prevents flushing, will change
\setbox0=\hbox{\externalfigure[#1][#2,\c!scherm=,\c!object=\v!nee]}}}
+
+% use the next one when the object must be forgotten (xobj
+% nums can migrate to the next object; maybe it should
+% always be done; todo ....
+
+\def\getfiguredimensionsonly
+ {\dodoubleempty\dogetfiguredimensionsonly}
+
+\def\dogetfiguredimensionsonly[#1][#2]%
+ {\dogetfiguredimensions[#1][#2]%
+ \doresetobjects}
\presetlocalframed[\??ef]
@@ -1153,24 +1220,14 @@
\else
\settrue\externalfigurelevel
\ifskipexternalfigures
- \localframed
- [\??ef]
- [\c!breedte=\figurewidth,
- \c!hoogte=\figureheight,
- \c!kader=\v!aan]
- {\ttx name: #2 \\ file: #3 \\ skipped}%
+ \externalfigurereplacement{name: #2 \\ file: #3 \\ skipped}%
\else\ifcase\figurestatus
- \localframed
- [\??ef]
- [\c!breedte=\figurewidth,
- \c!hoogte=\figureheight,
- \c!kader=\v!aan]
- {\ttx name: #2 \\ file: #3 \\ unknown}%
+ \externalfigurereplacement{name: #2 \\ file: #3 \\ unknown}%
\else
\doifelse{\@@efreset}{\v!ja}
- {\ht\foundexternalfigure=\figureheight
- \dp\foundexternalfigure=\!!zeropoint
- \wd\foundexternalfigure=\figurewidth
+ {\ht\foundexternalfigure\figureheight
+ \dp\foundexternalfigure\zeropoint
+ \wd\foundexternalfigure\figurewidth
\box\foundexternalfigure}
{\localframed
[\??ef]
@@ -1184,6 +1241,16 @@
\popmacro\figurewidth
\egroup}
+\def\externalfigurereplacement#1%
+ {\localframed
+ [\??ef]
+ [\c!breedte=\figurewidth,
+ \c!hoogte=\figureheight,
+ \c!achtergrond=\v!raster,
+ \c!achtergrondraster=.5,
+ \c!kader=\ifincolor\v!uit\else\v!aan\fi]
+ {\ttx#1}}
+
\def\getexternalfigure#1%
{\getvalue{\??ef\??ef#1}}
@@ -1220,7 +1287,8 @@
{\dosetuseexternalfigure[#1][#2][#3][#4]}}}
\def\dosetuseexternalfigure[#1][#2][#3][#4]%
- {\doifinstringelse{=}{#3}
+% {\doifinstringelse{=}{#3}
+ {\doifassignmentelse{#3}
{\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[\dopresetfigure][#1][#2][#3][#4]}}
{\doifelsenothing{#3} % catch [1][2][leeg][leeg]
{\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[\dopresetfigure][#1][#2][#3][#4]}}
@@ -1249,13 +1317,14 @@
{\bgroup
\mindermeldingen
\def\presetfigure[##1][##2]%
- {\useexternalfigure
- [\s!figurepreset][##1]
- [\c!kader=\v!aan,\c!breedte=6cm][##2]%
+ {%\useexternalfigure
+ % [\s!figurepreset][##1]
+ % [\c!kader=\v!aan,\c!breedte=6cm][##2]%
\getvalue{\e!start\v!figuur\e!tekst}[\v!links][]
{\v!geen}
{\hbox
- {\getvalue{\s!figurepreset}%
+% {\getvalue{\s!figurepreset}%
+{\externalfigure[##1][\c!kader=\v!aan,\c!breedte=6cm][##2]%
\tfskip
\framed[\c!breedte=\figurewidth,\c!hoogte=\figureheight]{}}}%
{\tfa ##1}%
@@ -1294,12 +1363,15 @@
{\vbox
{\divide\hsize by \total
\advance\hsize by -1em
- \useexternalfigure
- [\s!figurepreset][##1]
+ %\useexternalfigure
+ % [\s!figurepreset][##1]
+ % [\c!kader=\v!aan,\c!factor=\v!max,\c!breedte=\hsize][##2]%
+ \externalfigure
+ [##1]
[\c!kader=\v!aan,\c!factor=\v!max,\c!breedte=\hsize][##2]%
- \getvalue{\s!figurepreset}}%
+ }%\getvalue{\s!figurepreset}}%
\doglobal\addtocommalist{##1}\allfigures
- \getvalue{\s!figurepreset}%
+ %\getvalue{\s!figurepreset}%
\doglobal\increment\figurecounter
\ifnum\figurecounter=\total
\doglobal\newcounter\figurecounter
@@ -1309,7 +1381,7 @@
\fi
\next}%
\pushendofline
- \tabskip=\!!zeropoint \!!plus 1fill
+ \tabskip\zeropoint \!!plus 1fill
\halign to \hsize
{&\hss##\hss\cr\readjobfile{\@@exfile}{}{}\crcr % was \readlocfile
\figurecaptions}
@@ -1330,8 +1402,7 @@
\def\dopagefigure[#1][#2]%
{\bgroup
\pagina
- \getfiguredimensions
- [#1][#2]
+ \setbox\scratchbox=\hbox{\externalfigure[#1][#2]}%
\getparameters
[\??ex][\c!offset=\!!zeropoint,#2]
\scratchdimen=\@@exoffset
@@ -1347,9 +1418,7 @@
[\c!kopwit=\@@exoffset, \c!rugwit=\@@exoffset,
\c!hoofd=\!!zeropoint, \c!voet=\!!zeropoint,
\c!hoogte=\v!midden, \c!breedte=\v!midden]
- \externalfigure
- [#1]
- [#2,\c!breedte=\textwidth,\c!hoogte=\textheight]
+ \box\scratchbox
\pagina
\egroup}
@@ -1471,7 +1540,7 @@
\processcommalist[#1]\docommando}%
\global\setbox\colorbarbox=\vbox
{\hskip2em\box\colorbarbox}%
- \global\wd\colorbarbox=\!!zeropoint}
+ \global\wd\colorbarbox\zeropoint}
\def\placestartfigure[#1][#2][#3]#4\placestopfigure[#5]%
{\hbox
@@ -1636,7 +1705,7 @@
{\bgroup
\getparameters[\??cp][#1]%
\dowithnextbox
- {\ifdim\@@cpbreedte>\!!zeropoint
+ {\ifdim\@@cpbreedte>\zeropoint
\dimen0=\@@cpbreedte
\dimen4=\@@cphoffset
\else
@@ -1647,7 +1716,7 @@
\dimen0=\@@cpsx\dimen0
\fi
\relax % sure
- \ifdim\@@cphoogte>\!!zeropoint
+ \ifdim\@@cphoogte>\zeropoint
\dimen2=\@@cphoogte
\dimen6=\ht\nextbox
\advance\dimen6 by -\@@cpvoffset
@@ -1663,16 +1732,16 @@
\fi
\setbox\nextbox=\hbox
{\hskip-\dimen4\lower\dimen6\box\nextbox}%
- \wd\nextbox=\!!zeropoint
- \ht\nextbox=\!!zeropoint
- \dp\nextbox=\!!zeropoint
+ \wd\nextbox\zeropoint
+ \ht\nextbox\zeropoint
+ \dp\nextbox\zeropoint
\setbox\nextbox=\hbox
- {\dostartclipping{\@@cpmp}{\number\dimen0}{\number\dimen2}%
+ {\dostartclipping{\@@cpmp}{\dimen0}{\dimen2}%
\box\nextbox
\dostopclipping}%
\wd\nextbox=\dimen0
\ht\nextbox=\dimen2
- \dp\nextbox=\!!zeropoint
+ \dp\nextbox=\zeropoint
\box\nextbox
\egroup}%
\hbox}
diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex
index 279e8f3f2..012772586 100644
--- a/tex/context/base/core-fil.tex
+++ b/tex/context/base/core-fil.tex
@@ -146,40 +146,49 @@
\let\next\relax
\else
\makeshortfilename[#1\truefilename{#2}]%
- \doifundefinedelse{\shortfilename\v!aan}
- {\setgvalue{\shortfilename\v!aan}{}%
+ \doifelseflagged\shortfilename
+ {\showmessage\m!systems7{#2}%
+ \settrue\moduleisloaded
+ \let\next\relax}
+ {\doglobal\setflag\shortfilename
\def\next
{\startreadingfile
- \readsysfile{\shortfilename}%
- {\showmessage{\m!systems}{5}{#2}%
- \settrue\moduleisloaded}%
- {}%
- \stopreadingfile}}
- {\showmessage{\m!systems}{7}{#2}%
- \settrue\moduleisloaded
- \let\next\relax}%
+ \readsysfile\shortfilename
+ {\showmessage\m!systems5{#2}\settrue\moduleisloaded}
+ \donothing
+ \stopreadingfile}}%
\fi
\next}
-
-\def\dodousemodules#1%
- {\setfalse\moduleisloaded
- \dododousemodules\f!moduleprefix {#1}%
- \dododousemodules\f!privateprefix{#1}%
- \dododousemodules\f!styleprefix {#1}%
- \dododousemodules\f!xstyleprefix {#1}%
- \dododousemodules\f!thirdprefix {#1}%
+
+\def\dodousemodules#1#2%
+ {\setfalse\moduleisloaded
+ \doifelsenothing{#1}
+ {\dododousemodules\f!moduleprefix {#2}%
+ \dododousemodules\f!privateprefix{#2}%
+ \dododousemodules\f!styleprefix {#2}%
+ \dododousemodules\f!xstyleprefix {#2}%
+ \dododousemodules\f!thirdprefix {#2}}
+ {\dododousemodules{#1-}{#2}}%
\ifconditional\moduleisloaded\else
- \showmessage{\m!systems}{6}{#1}%
+ \showmessage{\m!systems}{6}{#2}%
\fi}
-\def\dousemodules[#1]%
- {\doifelsenothing{#1}
- {\let\next\relax}
- {\def\next{\processcommalist[#1]\dodousemodules}}
+\def\dousemodules[#1][#2]%
+ {\ifsecondargument
+ \doifelsenothing{#2}
+ {\let\next\relax}
+ {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
+ \else
+ \def\next{\usemodules[][#1]}%
+ \fi
\next}
-\def\usemodules%
- {\dosingleargument\dousemodules}
+\def\usemodules
+ {\dodoubleempty\dousemodules}
+
+\let\usemodule\usemodules
+
+% \usemodule[t][speech]
%D We also support a singular call, which saves us for
%D frustrations when we do a typo.
@@ -199,34 +208,22 @@
\newif\ifprotectbuffers
-\def\bufferprefix%
- {\ifprotectbuffers\jobname-\fi}
-
-% also
-
-\def\TEXbufferfile#1%
- {\bufferprefix#1.\f!temporaryextension}
-
-%D We also redefine:
+\def\bufferprefix{\ifprotectbuffers\jobname-\fi}
-\def\MPgraphicfile%
- {\bufferprefix mp\ifMPrun run\else graph\fi}
+% The following filenames are defined here:
-\def\convertMPcolorfile%
- {\bufferprefix metacmyk.tmp}
+\def\TEXbufferfile #1{\bufferprefix#1.\f!temporaryextension}
+\def\MPgraphicfile {\bufferprefix mp\ifMPrun run\else graph\fi}
+\def\convertMPcolorfile{\bufferprefix metacmyk.tmp}
-%D Temporarilly here:
+%D The next few macros ar eused for some internal (rather
+%D old already) extensions.
-\def\definieerfilegroep%
+\def\definieerfilegroep
{\dodoubleargument\dodefinieerfilegroep}
\def\dodefinieerfilegroep[#1][#2]%
- {\getparameters
- [\??fp#1]
- [\c!file=#1,
- \c!voor=,
- \c!na=,
- #2]%
+ {\getparameters[\??fp#1][\c!file=#1,\c!voor=,\c!na=,#2]%
\setvalue{\e!start#1}{\dostartfilegroep[#1]}}
\def\dostartfilegroep%
@@ -235,34 +232,38 @@
\def\dodostartfilegroep[#1][#2]%
{\getvalue{\??fp#1\c!voor}%
\setvalue{\e!stop#1}{\dostopfilegroep[#1][#2]}%
- \edef\!!stringa{\getvalue{\??fp#1\c!file}-#2}%
- \@EA\dolaadfilegroep\@EA[\!!stringa]%
+ \expanded{\dolaadfilegroep[\getvalue{\??fp#1\c!file}-#2]}%
\getvalue{\e!start#1#2}}
\def\dolaadfilegroep[#1-#2#3#4#5]%
- {\readsysfile{#1-#2#3#4}{}{}}
+ {\readsysfile{#1-#2#3#4}\donothing\donothing}
\def\dostopfilegroep[#1][#2]%
{\getvalue{\e!stop#1#2}%
\getvalue{\??fp#1\c!na}}
-% usage:
-%
-% \fetchruntimecommand\showaccents{\f!encodingprefix ...}
+%D To save memory, we implement some seldomly used commands
+%D in a lazy way. Nota bene: such runtime definitions are
+%D global.
+%D
+%D \starttypen
+%D \fetchruntimecommand\showaccents{\f!encodingprefix ...}
+%D \stoptypen
\def\fetchruntimecommand#1#2%
{\def#1{\dofetchruntimecommand#1{#2}}}
\def\dofetchruntimecommand#1#2%
- {\doifundefined{@@@#2@@@}{\let#1\undefined\doinputonce{#2}}%
+ {\doifnotflagged{#2}
+ {\let#1\undefined
+ \readfile{#2}\donothing\donothing
+ \doglobal\setflag{#2}}%
\ifx#1\undefined
\writestatus{\m!systems}{command \string#1 not found in file #2}%
\def#1{{\infofont[unknown command \string#1]}}%
\fi
#1}
-%D This will be perfected / changed / weeded.
+%D This module will be perfected / changed / weeded.
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex
index f57b835bc..806f6af44 100644
--- a/tex/context/base/core-fld.tex
+++ b/tex/context/base/core-fld.tex
@@ -12,6 +12,8 @@
%C details.
% \appendtocommalist versus \addtocommalist
+%
+% * as default trigger in radiofields ?
\writestatus{loading}{Context Field Macros}
@@ -140,6 +142,7 @@
{\@@FieldName}
{\@@FieldWidth}
{\@@FieldHeight}
+ {\@@FieldDefault}
{\@@fdoptie}
{\@@FieldRoot}
{\@@FieldValues}
@@ -197,7 +200,7 @@
\let\tracefields\tracefieldstrue
-\def\doshowfields[#1]%
+\def\doshowfields[#1]% todo: tabulate van maken
{\bgroup
\switchtobodyfont[8pt,tt]
\doifsomething{#1}{\def\collectedfields{#1}}
@@ -438,16 +441,35 @@
\let\definepopupfield=\definechoicefield
\let\definecombofield=\definechoicefield
+%\def\definecheckfield#1#2#3#4#5%
+% {\doifelsenothing{#4}
+% {\definedefaultsymbols
+% \def\@@FieldValues{defaultyes}}
+% {\def\@@FieldValues{#4}}%
+% \doifelsenothing{#5}
+% {\dogetcommacommandelement2\from\@@FieldValues\to\@@FieldDefault
+% \dogetcommacommandelement1\from\@@FieldDefault\to\@@FieldDefault}
+% {\def\@@FieldDefault{#5}}%
+% \setfield{#1}{#2}{}{}{\@@FieldKids}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{\@@FieldValues}{\@@FieldDefault}}
+
+%D Since these fields have an on/off state only, we pass 1/0
+%D to the driver as default values.
+
\def\definecheckfield#1#2#3#4#5%
{\doifelsenothing{#4}
{\definedefaultsymbols
\def\@@FieldValues{defaultyes}}
{\def\@@FieldValues{#4}}%
\doifelsenothing{#5}
- {\dogetcommacommandelement2\from\@@FieldValues\to\@@FieldDefault
- \dogetcommacommandelement1\from\@@FieldDefault\to\@@FieldDefault}
- {\def\@@FieldDefault{#5}}%
- \setfield{#1}{#2}{}{}{\@@FieldKids}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{\@@FieldValues}{\@@FieldDefault}}
+ {\def\@@FieldDefault{2}}
+ {\dogetcommacommandelement1\from\@@FieldValues\to\@@FieldDefault
+ \doifinstringelse{#5}{\@@FieldDefault}
+ {\def\@@FieldDefault{1}}
+ {\def\@@FieldDefault{0}}}%
+ \setfield
+ {#1}{#2}{}{}{\@@FieldKids}{#3}%
+ {\@@FieldMode\@@FieldFree\@@FieldAuto}%
+ {\@@FieldValues}{\@@FieldDefault}}
\let\definepushfield=\definecheckfield
@@ -464,8 +486,8 @@
\fi
\def\docommando##1%
{\doifelse{##1}{\SavedFieldDefault}
- {\def\@@FieldDefault{*}}
- {\let\@@FieldDefault=\empty}%
+ {\def\@@FieldDefault{##1}}%
+ {\let\@@FieldDefault\empty}%
\setfield{##1}{#2}{#1}{}{}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{\@@FieldDefault}}%
\processcommalist[#4]\docommando
\else
@@ -488,10 +510,6 @@
{\definedefaultsymbols
\def\@@FieldValues{defaultyes}}
{\def\@@FieldValues{#3}}%
- \doifelse{\@@FieldDefault}{*}
- {\@EA\dogetcommalistelement\@EA1\@EA\from\@@FieldValues\to\@@FieldDefault}
- {\@EA\dogetcommalistelement\@EA2\@EA\from\@@FieldValues\to\@@FieldDefault}%
- \@EA\dogetcommalistelement\@EA1\@EA\from\@@FieldDefault\to\@@FieldDefault
\changefield{##1}%
\fi}%
\processcommalist[#1]\docommando
@@ -582,13 +600,13 @@
\fi
\ifx\@@FieldType\empty
\writestatus{\m!fields}{unknown field #2}%
- \else\ifcase\@@FieldFree
+ \else\ifcase\@@FieldFree\relax
\doifdefinedelse{\strippedcsname\setupfield\@@FieldGroup}
{\let\dosetupfield=#1\getvalue{\strippedcsname\setupfield\@@FieldGroup}}
{#1[\@@FieldName][\v!label,\v!kader,\v!horizontaal][][][]}%
\def\@@FieldFree{1}%
\changefield{#2}%
- \else\ifcase\@@FieldAuto
+ \else\ifcase\@@FieldAuto\relax
\writestatus{\m!fields}{field #2 already typeset}%
\else
\writestatus{\m!fields}{field #2 automatically copied}%
@@ -604,9 +622,9 @@
\ifx\@@FieldRoot\empty \else
\let\@@SavedFieldName=\@@FieldName
\getfield\@@FieldRoot
- \ifcase\@@FieldFree
+ \ifcase\@@FieldFree\relax
\dosetfieldstatus\@@FieldMode\@@FieldParent\@@FieldKids\@@FieldRoot
- \iflocation\getvalue{preset\@@FieldType record}\fi
+ \dopresetrecord
\def\@@FieldFree{1}%
\changefield\@@FieldName
\fi
@@ -622,11 +640,14 @@
%\addtocommalist\@@FieldParent\@@FieldKids
\appendtocommalist\@@FieldParent\@@FieldKids
\dosetfieldstatus\@@FieldMode\@@FieldParent\@@FieldKids\@@FieldRoot
- \iflocation\getvalue{preset\@@FieldType field}\fi
+ \dopresetfield
\let\@@FieldMode=\fieldchildmode
\fi
\dosetfieldstatus\@@FieldMode\@@FieldParent\@@FieldKids\@@FieldRoot
- \iflocation\getvalue{preset\@@FieldType field}\fi}
+ \dopresetfield}
+
+\def\dopresetfield {\iflocation\getvalue{preset\@@FieldType field}\fi}
+\def\dopresetrecord{\iflocation\getvalue{preset\@@FieldType record}\fi}
\def\dodefinethefieldset[#1][#2]%
{\dodefinefieldset{#1}{#2}}
@@ -753,8 +774,8 @@
\c!focusin=,\c!focusuit=,
\c!veldoffset=\!!zeropoint,\c!veldachtergrondkleur=,
\c!veldkaderkleur=,#5]%
- \dimen0=\framedwidth \edef\@@FieldWidth {\number\dimen0}%
- \dimen0=\framedheight\edef\@@FieldHeight{\number\dimen0}%
+ \dimen0=\framedwidth \edef\@@FieldWidth {\the\dimen0}%
+ \dimen0=\framedheight\edef\@@FieldHeight{\the\dimen0}%
\vfill
\hbox{\lower\@@fdveldoffset\hbox{\typesetfield}}
\vss}}%
@@ -785,7 +806,7 @@
{\presetlocalframed[\??fd]%
\localframed
[\??fd]
- [\c!n=1,\c!strut=\v!nee,\c!kleur=,\c!letter=,\c!optie=,
+ [\c!n=12,\c!strut=\v!nee,\c!kleur=,\c!letter=,\c!optie=,
\c!klikin=,\c!klikuit=,\c!gebiedin=,\c!gebieduit=,
\c!focusin=,\c!focusuit=,
\c!natoets=,\c!formatteer=,\c!valideer=,\c!bereken=,
@@ -797,8 +818,8 @@
\fi
\dopresetfieldsymbol\@@FieldValue
\setbox0=\hbox{\dogetfieldsymbol{\@@FieldValue}}%
- \dimen0=\wd0 \edef\@@FieldWidth {\number\dimen0}%
- \dimen0=\ht0 \edef\@@FieldHeight{\number\dimen0}%
+ \dimen0=\wd0 \edef\@@FieldWidth {\the\dimen0}%
+ \dimen0=\ht0 \edef\@@FieldHeight{\the\dimen0}%
\vbox to \ht0
{\vfill\hbox to \wd0{\typesetfield\hfill}\vss}}}
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
index cec75eb9e..da173f0cd 100644
--- a/tex/context/base/core-fnt.tex
+++ b/tex/context/base/core-fnt.tex
@@ -16,6 +16,19 @@
\unprotect
%D \macros
+%D {compound}
+%D
+%D We will overload the already active \type {|} so we have
+%D to save its meaning in order to be able to use this handy
+%D macro.
+%D
+%D \starttypen
+%D so test\compound{}test can be used instead of test||test
+%D \stoptypen
+
+\bgroup \catcode`\|=\@@active \gdef\compound#1{|#1|} \egroup
+
+%D \macros
%D {kap,KAP,Kap,Kaps,nokap,userealcaps,usepseudocaps}
%D
%D We already introduced \type{\kap} as way to capitalize
@@ -155,6 +168,17 @@
\ifx\uppercased\undefined \let\uppercased\uppercase \fi
\ifx\lowercased\undefined \let\lowercased\lowercase \fi
+% pretty tricky stuff:
+%
+% \usemodule[abr-01] \TEX \METAPOST \PPCHTEX \LATEX
+% \usemodule[abr-02] \TEX \METAPOST \PPCHTEX \LATEX
+
+\def\uppercased#1%
+ {{\forceunexpanded\xdef\@@globalcrap{\uppercase{#1}}}\@@globalcrap}
+
+\def\lowercased#1%
+ {{\forceunexpanded\xdef\@@globalcrap{\lowercase{#1}}}\@@globalcrap}
+
\setupcapitals
[\c!titel=\v!ja,
\c!sc=\v!nee]
@@ -289,7 +313,7 @@
% {\bgroup
% \the\everyuppercase
% \uppercase{\def\textstring{#1}}%
-% \ifdim\stretchedspaceamount>\!!zeropoint
+% \ifdim\stretchedspaceamount>\zeropoint
% \def\textkern%
% {\kern\stretchedspaceamount}%
% \def\textskip%
@@ -318,7 +342,7 @@
\def\stretchedsomecase#1#2%
{\bgroup
#1{\def\textstring{#2}}%
- \ifdim\stretchedspaceamount>\!!zeropoint
+ \ifdim\stretchedspaceamount>\zeropoint
\def\textkern##1%
{\determinemidwordbreak{##1}{\stretchedbreaktokens}%
\kern\stretchedspaceamount##1\domidwordbreak}%
@@ -430,8 +454,8 @@
\def\dododounderbar#1#2#3%
{\startmathmode
\setbox0=\hbox{#3}%
- \setbox2=\getvalue{underbarmethod\@@onvariant}{\wd0}{#1}{#2}%
- \wd0=\!!zeropoint
+ \setbox2=\hbox{\color[\@@onlijnkleur]{\getvalue{underbarmethod\@@onvariant}{\wd0}{#1}{#2}}}%
+ \wd0=\zeropoint
\ht2=\ht0
\dp2=\dp0
\box0\box2
@@ -455,7 +479,7 @@
\setbox0=\hbox
{\dodounderbar{\hskip\fontdimen2\font}}%
\nobreak
- \hskip\!!zeropoint\!!minus\fontdimen4\font
+ \hskip\zeropoint\!!minus\fontdimen4\font
\discretionary{}{}{\box0}%
\egroup}
@@ -504,7 +528,7 @@
\setbox0=\hbox
{\dooverstrike{\hskip\fontdimen2\font}}%
\nobreak
- \hskip\!!zeropoint\!!minus\fontdimen4\font
+ \hskip\zeropoint\!!minus\fontdimen4\font
\discretionary{}{}{\box0}%
\egroup}
@@ -569,17 +593,53 @@
\unexpanded\def\high{\dohighlow\raise{14}{.86}{0}}
\unexpanded\def\low {\dohighlow\lower{16}{.48}{0}}
-\unexpanded\def\lohi#1#2%
+% \unexpanded\def\lohi#1#2%
+% {\dontleavehmode
+% \hbox
+% {\setbox4=\hbox{\dohighlow\lower{16}{.48}{.1}{#1}}%
+% \setbox6=\hbox{\dohighlow\raise{14}{.86}{.1}{#2}}%
+% \ifdim\wd4<\wd6
+% \wd4=\zeropoint\box4\box6
+% \else
+% \wd6=\zeropoint\box6\box4
+% \fi}}
+
+\unexpanded\def\lohi%
+ {\dosingleempty\dolohi}
+
+\def\dolohi[#1]#2#3%
{\dontleavehmode
\hbox
- {\setbox4=\hbox{\dohighlow\lower{16}{.48}{.1}{#1}}%
- \setbox6=\hbox{\dohighlow\raise{14}{.86}{.1}{#2}}%
+ {\setbox4=\hbox{\dohighlow\lower{16}{.48}{.1}{#2}}%
+ \setbox6=\hbox{\dohighlow\raise{14}{.86}{.1}{#3}}%
+ \doif{#1}{\v!links}
+ {\ifdim\wd4<\wd6
+ \setbox4\hbox to \wd6{\hss\box4}%
+ \else
+ \setbox6\hbox to \wd4{\hss\box6}%
+ \fi}%
\ifdim\wd4<\wd6
- \wd4=\!!zeropoint\box4\box6
+ \wd4=\zeropoint\box4\box6
\else
- \wd6=\!!zeropoint\box6\box4
+ \wd6=\zeropoint\box6\box4
\fi}}
+%D You can provide an optional keyword \type {left}, in which
+%D case the super and subscripts will be aligned in a way that
+%D permits placement at the left of a word (which means that
+%D it will be right aligned).
+%D
+%D \startbuffer
+%D \lohi{aha}{ah} test \lohi{aha}{ah} test
+%D \lohi[links]{aha}{ah} test \lohi[links]{aha}{ah} test
+%D \lohi{aha}{ah} test\lohi{aha}{ah} test
+%D \lohi[links]{aha}{ah}test \lohi[links]{aha}{ah}test
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \haalbuffer
+
%D \macros
%D {setupinitial,placeinitial,checkinitial}
%D
@@ -621,7 +681,8 @@
[\c!variant=a,
\c!lijndikte=\linewidth,
\c!onderoffset=1.5pt,
- \c!bovenoffset=2.5pt]
+ \c!bovenoffset=2.5pt,
+ \c!lijnkleur=]
%D ? ? ?
diff --git a/tex/context/base/core-gen.tex b/tex/context/base/core-gen.tex
index 0c411a621..f9866284a 100644
--- a/tex/context/base/core-gen.tex
+++ b/tex/context/base/core-gen.tex
@@ -115,24 +115,43 @@
\edef\negv!middel{-\v!middel}
\edef\negv!klein {-\v!klein }
+%\def\assigndimension#1#2#3#4#5%
+% {\edef\!!stringa{#1}%
+% \ifx\!!stringa\nopv!geen #2=\zeropoint\else
+% \ifx\!!stringa\posv!groot #2=#5\else
+% \ifx\!!stringa\posv!middel#2=#4\else
+% \ifx\!!stringa\posv!klein #2=#3\else
+% \ifx\!!stringa\negv!groot #2=-#5\else
+% \ifx\!!stringa\negv!middel#2=-#4\else
+% \ifx\!!stringa\negv!klein #2=-#3\else
+% #2=#1\fi\fi\fi\fi\fi\fi\fi}
+%
+%\def\assignalfadimension#1#2#3#4#5%
+% {\edef\!!stringa{#1}%
+% \ifx\!!stringa\posv!groot \edef#2{#5}\else
+% \ifx\!!stringa\posv!middel\edef#2{#4}\else
+% \ifx\!!stringa\posv!klein \edef#2{#3}\else
+% \ifx\!!stringa\nopv!geen \edef#2{0}\else
+% \edef#2{#1}\fi\fi\fi\fi}
+
\def\assigndimension#1#2#3#4#5%
{\edef\!!stringa{#1}%
- \ifx\!!stringa\nopv!geen #2=\zeropoint\else
- \ifx\!!stringa\posv!groot #2=#5\else
- \ifx\!!stringa\posv!middel#2=#4\else
- \ifx\!!stringa\posv!klein #2=#3\else
- \ifx\!!stringa\negv!groot #2=-#5\else
- \ifx\!!stringa\negv!middel#2=-#4\else
- \ifx\!!stringa\negv!klein #2=-#3\else
- #2=#1\fi\fi\fi\fi\fi\fi\fi}
+ #2=\ifx\!!stringa\nopv!geen \zeropoint\else
+ \ifx\!!stringa\posv!groot #5\else
+ \ifx\!!stringa\posv!middel #4\else
+ \ifx\!!stringa\posv!klein #3\else
+ \ifx\!!stringa\negv!groot -#5\else
+ \ifx\!!stringa\negv!middel-#4\else
+ \ifx\!!stringa\negv!klein -#3\else
+ #1\fi\fi\fi\fi\fi\fi\fi}
\def\assignalfadimension#1#2#3#4#5%
{\edef\!!stringa{#1}%
- \ifx\!!stringa\posv!groot \edef#2{#5}\else
- \ifx\!!stringa\posv!middel\edef#2{#4}\else
- \ifx\!!stringa\posv!klein \edef#2{#3}\else
- \ifx\!!stringa\nopv!geen \edef#2{0}\else
- \edef#2{#1}\fi\fi\fi\fi}
+ \edef#2{\ifx\!!stringa\posv!groot #5\else
+ \ifx\!!stringa\posv!middel#4\else
+ \ifx\!!stringa\posv!klein #3\else
+ \ifx\!!stringa\nopv!geen 0\else
+ #1\fi\fi\fi\fi}}
%D \macros
%D {assignvalue}
@@ -172,12 +191,19 @@
%D Or faster:
+%\def\assignvalue#1#2#3#4#5%
+% {\edef\!!stringa{#1}%
+% \ifx\!!stringa\posv!groot \edef#2{#5}\else
+% \ifx\!!stringa\posv!middel\edef#2{#4}\else
+% \ifx\!!stringa\posv!klein \edef#2{#3}\else
+% \edef#2{#1}\fi\fi\fi}
+
\def\assignvalue#1#2#3#4#5%
{\edef\!!stringa{#1}%
- \ifx\!!stringa\posv!groot \edef#2{#5}\else
- \ifx\!!stringa\posv!middel\edef#2{#4}\else
- \ifx\!!stringa\posv!klein \edef#2{#3}\else
- \edef#2{#1}\fi\fi\fi}
+ \edef#2{\ifx\!!stringa\posv!groot #5\else
+ \ifx\!!stringa\posv!middel#4\else
+ \ifx\!!stringa\posv!klein #3\else
+ #1\fi\fi\fi}}
%D \macros
%D {assignwidth}
diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex
index b5868d718..0d179ed7a 100644
--- a/tex/context/base/core-grd.tex
+++ b/tex/context/base/core-grd.tex
@@ -69,20 +69,21 @@
\definecolor[GridTextColor][blue]
\def\setbaselinecorrections%
- {\setbox0=\hbox{\setstrut\strut}%
- \setbox2=\hbox{(}%
- \dimen0=\ht0\advance\dimen0 by -\ht2
- \ifdim\dimen0<\zeropoint\dimen0=\zeropoint\fi
- \dimen2=\dp0\advance\dimen2 by -\dp2
- \ifdim\dimen2<\zeropoint\dimen2=\zeropoint\fi
- \edef\thetopbaselinecorrection{\the\dimen0}%
- \edef\thebotbaselinecorrection{\the\dimen2}}
-
-\def\dotopbaselinecorrection%
- {\kern\thetopbaselinecorrection}
-
-\def\dobotbaselinecorrection%
- {\kern\thebotbaselinecorrection}
+ {\setbox0\hbox{\setstrut\strut}%
+ \setbox2\hbox{(}%
+ \dimen0\ht0\advance\dimen0 -\ht2
+ \ifdim\dimen0<\zeropoint\dimen0\zeropoint\fi
+ \dimen2\dp0\advance\dimen2 -\dp2
+ \ifdim\dimen2<\zeropoint\dimen2\zeropoint\fi
+ \edef\thetopbaselinecorrection {\the\dimen0}\dimen0-\dimen0
+ \edef\thebotbaselinecorrection {\the\dimen2}\dimen2-\dimen2
+ \edef\thenegtopbaselinecorrection{\the\dimen0}%
+ \edef\thenegbotbaselinecorrection{\the\dimen2}}
+
+\def\dotopbaselinecorrection {\kern\thetopbaselinecorrection}
+\def\dobotbaselinecorrection {\kern\thebotbaselinecorrection}
+\def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection}
+\def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection}
\def\showbaselinecorrection%
{\def\dobaselinecorrection% visualization is not watertight!
@@ -533,20 +534,42 @@
\newbox\fuzzysnapbox
\newbox\fuzzysnapsplit
+%\def\dosyncfuzzyvskip%
+% {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
+% \bgroup
+% \endgraf
+% \forgetall
+% \vbox{\strut}
+% \kern-2\lineheight
+% \nobreak
+% \vskip\lineheight
+% \egroup
+% \fi\fi\fi}
+
+%\def\fuzzyvskip#1%
+% {\iffuzzysnapdone
+% \endfuzzysnapping
+% \vskip#1\relax
+% \dosyncfuzzyvskip % NEW
+% \global\fuzzysnapdonefalse
+% \else
+% \vskip#1\relax
+% \beginfuzzysnapping
+% \global\fuzzysnapdonetrue
+% \fi}
+
\def\dosyncfuzzyvskip%
{\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
- \hbox{\strut}
-% \nobreak
- \kern-2\lineheight
- \nobreak
- \vskip\lineheight % on behalf of testing
+ \bgroup
+ \endgraf\forgetall\vbox{\strut}\nobreak\vskip\lineheight
+ \egroup
\fi\fi\fi}
\def\fuzzyvskip#1%
{\iffuzzysnapdone
+ \dosyncfuzzyvskip % NEWER
\endfuzzysnapping
\vskip#1\relax
- \dosyncfuzzyvskip % NEW
\global\fuzzysnapdonefalse
\else
\vskip#1\relax
@@ -657,11 +680,11 @@
\def\adaptfuzzypagegoal%
{\ifgridsnapping\iffuzzysnapping\ifcase\fuzzysnappedleft\or % see dopagecontents
- \scratchdimen=\pagegoal
- \advance\scratchdimen by -.5\openlineheight
- \global\pagegoal=\scratchdimen
- \global\advance\vsize by -.5\openlineheight
- \global\chardef\fuzzysnappedleft=0
+ \scratchdimen\pagegoal
+ \advance\scratchdimen -.5\openlineheight
+ \global\pagegoal\scratchdimen
+ \global\advance\vsize -.5\openlineheight
+ \global\chardef\fuzzysnappedleft0
\fi\fi\fi}
\protect
diff --git a/tex/context/base/core-hlp.tex b/tex/context/base/core-hlp.tex
index afede5acd..7347f40ab 100644
--- a/tex/context/base/core-hlp.tex
+++ b/tex/context/base/core-hlp.tex
@@ -43,14 +43,18 @@
{\let\synchronizepagehelpdata\relax}
\def\resetpagehelpdata%
- {\let\synchronizepagehelpdata\resetpagehelpdata
- \global\let\pagehelpdata\empty
- \definereference[HideHelp][]} % hm
+ {\iflocation
+ \let\synchronizepagehelpdata\resetpagehelpdata
+ \global\let\pagehelpdata\empty
+ \resetreference[HideHelp]%
+ \fi}
\let\synchronizepagehelpdata\resetpagehelpdata
+\resetreference[HideHelp]
+
\def\getpagehelpdata%
- {\iflocation
+ {\iflocation\ifcase\nofhelpdataentries\else
\let\pagehelpdata\empty
\ifconditional\somehelpdatadefined
\definetwopasslist{hlp:\realfolio}%
@@ -66,10 +70,12 @@
\useJSscripts[fld]%
\definereference[HideHelp][JS(Hide_Fields)]% for the moment
\fi
- \fi}
+ \fi\fi}
\def\setpagehelpdata[#1]%
- {\iflocation\expanded{\dosetpagehelpdata{#1}}\fi}
+ {\iflocation\ifcase\nofhelpdataentries\else
+ \expanded{\dosetpagehelpdata{#1}}%
+ \fi\fi}
\def\dosetpagehelpdata#1%
{\doglobal\increment\nofhelpdataentries
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index 2ff563e1f..eeb0a44b2 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -179,7 +179,8 @@
\fi
\iflocation
\hbox
- {\setupinteraction[\c!breedte=\!!zeropoint]%
+ {%\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\doganaareenpagina\??lk\gotobegincharacter\firstlink\hss
\ifnum\noflinks>2
\hskip\@@lkafstand
@@ -240,22 +241,8 @@
\fi
\iflocation
\hbox
- {\setupinteraction[\c!breedte=\!!zeropoint]%
-%
-% \doganaareenpagina\??lk\gotobegincharacter\firstlink\hss
-% \ifnum\noflinks>2
-% \hskip\@@lkafstand
-% \doganaareenpagina\??lk\gobackwardcharacter\prevlink\hss
-% \fi
-% \hskip\@@lkafstand
-% #2\relax
-% \hskip\@@lkafstand
-% \ifnum\noflinks>2
-% \doganaareenpagina\??lk\goforwardcharacter\nextlink\hss
-% \hskip\@@lkafstand
-% \fi
-% \doganaareenpagina\??lk\gotoendcharacter\lastlink}%
-%
+ {%\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
#2\relax
\hskip\@@lkafstand
\doganaareenpagina\??lk\gotobegincharacter\firstlink\hss
@@ -267,7 +254,6 @@
\hskip\@@lkafstand
\fi
\doganaareenpagina\??lk\gotoendcharacter\lastlink}%
-%
\else
\hbox{#2}%
\fi
@@ -276,43 +262,41 @@
\let\setupinteractionscreens\empty
\def\berekeninteractiescherm%
- {\doifelse{\@@scbreedte}{\v!passend}
- {\!!widtha=\linkerrandbreedte
- \advance\!!widtha by \linkerrandafstand
-% \advance\!!widtha by \paginascheiding
- \advance\!!widtha by \linkermargebreedte
- \advance\!!widtha by \linkermargeafstand
- \ifdim\rugwit>\!!widtha\ifdim\rugwit>\!!zeropoint\relax
- \advance\rugwit by -\!!widtha
+ {\doifelse\@@scbreedte\v!passend
+ {\!!widtha\linkerrandbreedte
+ \advance\!!widtha \linkerrandafstand
+ \advance\!!widtha \linkermargebreedte
+ \advance\!!widtha \linkermargeafstand
+ \ifdim\rugwit>\!!widtha\ifdim\rugwit>\zeropoint\relax
+ \advance\rugwit -\!!widtha
\fi\fi
- \advance\!!widtha by \zetbreedte
- \advance\!!widtha by \rechtermargeafstand
- \advance\!!widtha by \rechtermargebreedte
-% \advance\!!widtha by \paginascheiding
- \advance\!!widtha by \rechterrandafstand
- \advance\!!widtha by \rechterrandbreedte
- \scratchdimen=\@@scrugwit
- \advance\scratchdimen by \@@scrugoffset
- \advance\!!widtha by 2\scratchdimen}
- {\doifelse{\@@scbreedte}{\v!max}
- {\!!widtha=\printpapierbreedte}
- {\!!widtha=\@@scbreedte}}%
- \doifelse{\@@schoogte}{\v!passend}
- {\!!heighta=\bovenhoogte
- \advance\!!heighta by \bovenafstand
- \ifdim\kopwit>\!!heighta\ifdim\kopwit>\!!zeropoint\relax
- \advance\kopwit by -\!!heighta
+ \advance\!!widtha \zetbreedte
+ \advance\!!widtha \rechtermargeafstand
+ \advance\!!widtha \rechtermargebreedte
+ \advance\!!widtha \rechterrandafstand
+ \advance\!!widtha \rechterrandbreedte
+ \scratchdimen\@@scrugwit
+ \advance\scratchdimen \@@scrugoffset
+ \advance\!!widtha 2\scratchdimen}
+ {\doifelse\@@scbreedte\v!max
+ {\!!widtha\printpapierbreedte}
+ {\!!widtha\@@scbreedte}}%
+ \doifelse\@@schoogte\v!passend
+ {\!!heighta\bovenhoogte
+ \advance\!!heighta \bovenafstand
+ \ifdim\kopwit>\!!heighta\ifdim\kopwit>\zeropoint\relax
+ \advance\kopwit -\!!heighta
\fi\fi
- \advance\!!heighta by \zethoogte
- \advance\!!heighta by \onderafstand
- \advance\!!heighta by \onderhoogte
- \scratchdimen=\@@sckopwit
- \advance\scratchdimen by \@@sckopoffset
- \advance\!!heighta by 2\scratchdimen}
- {\doifelse{\@@schoogte}{\v!max}
- {\!!heighta=\printpapierhoogte}
- {\!!heighta=\@@schoogte}}%
- \doif{\@@scwachttijd}{\v!geen}{\def\@@scwachttijd{0}}}
+ \advance\!!heighta \zethoogte
+ \advance\!!heighta \onderafstand
+ \advance\!!heighta \onderhoogte
+ \scratchdimen\@@sckopwit
+ \advance\scratchdimen \@@sckopoffset
+ \advance\!!heighta 2\scratchdimen}
+ {\doifelse\@@schoogte\v!max
+ {\!!heighta\printpapierhoogte}
+ {\!!heighta\@@schoogte}}%
+ \doif\@@scwachttijd\v!geen{\let\@@scwachttijd\zerocountervalue}}
\def\initializeidentity% The macro is not to be changed;
{\iflocation % only the \@@ia-variables may be set!
@@ -346,26 +330,22 @@
\def\initializepaper%
{\bgroup
- %\doif\@@pcstatus\v!start\locationfalse
- %\doifsomething
- % {\@@pplinks\@@pprechts\@@ppboven\@@pponder}\locationfalse
- \ifx\@@pplinks \empty \else\locationfalse\fi
- \ifx\@@pprechts\empty \else\locationfalse\fi
- \ifx\@@ppboven \empty \else\locationfalse\fi
- \ifx\@@pponder \empty \else\locationfalse\fi
- \ifx\@@pcstatus\v!start \locationfalse\fi
+ \ifx\@@pplinks \empty
+ \ifx\@@pprechts\empty
+ \ifx\@@ppboven \empty
+ \ifx\@@pponder \empty
+ \ifx\@@pcstatus\v!start
+ \locationfalse\fi\else
+ \locationfalse\fi\else
+ \locationfalse\fi\else
+ \locationfalse\fi\else
+ \locationfalse\fi
\iflocation % without screen settings
\egroup
- \dosetuppaper
- {\papersize}
- {\the\papierbreedte}
- {\the\papierhoogte}%
+ \dosetuppaper\papersize\papierbreedte\papierhoogte
\else
\egroup
- \dosetuppaper
- {\printpapersize}
- {\the\printpapierbreedte}
- {\the\printpapierhoogte}%
+ \dosetuppaper\printpapersize\printpapierbreedte\printpapierhoogte
\fi}
\appendtoks \initializepaper \to \everyshipout
@@ -373,11 +353,11 @@
\def\doinitializepaper%
{\bgroup
\berekeninteractiescherm
- \ifdim\!!widtha>\papierbreedte\ifdim\!!widtha>\!!zeropoint
- \papierbreedte=\!!widtha
+ \ifdim\!!widtha>\papierbreedte\ifdim\!!widtha>\zeropoint
+ \papierbreedte\!!widtha
\fi\fi
- \ifdim\!!heighta>\papierhoogte\ifdim\!!heighta>\!!zeropoint
- \papierhoogte=\!!heighta
+ \ifdim\!!heighta>\papierhoogte\ifdim\!!heighta>\zeropoint
+ \papierhoogte\!!heighta
\fi\fi
\dosetuppaper
{\printpapersize}
@@ -387,31 +367,59 @@
\let\@@pcscreendata\empty
+% \def\dosetupinteractionscreens% met a, b en \number
+% {\doifnot{\@@pcstatus}{\v!start}
+% {\bgroup
+% \berekeninteractiescherm
+% \processaction
+% [\@@scoptie]
+% [ \v!max=>\!!counte=1,
+% \v!bookmark=>\!!counte=2,
+% \s!unknown=>\!!counte=0,
+% \s!default=>\!!counte=0]%
+% \edef\temp%
+% {{\number\rugoffset}{\number\kopoffset}%
+% {\number\!!widtha}{\number\!!heighta}%
+% {\the\!!counte}}%
+% \doifnot{\the\!!widtha\the\!!heighta}{\@@pcscreendata}
+% {\xdef\@@pcscreendata{\the\!!widtha\the\!!heighta}%
+% \showmessage{\m!interactions}{1} % niet waterdicht
+% {\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}%
+% % need to be split: dimensions for each page
+% % and mode per document and only once !
+% \dosetupscreen
+% {\rugoffset}{\kopoffset}
+% {\!!widtha}{\!!heighta}
+% {\the\!!counte}%
+% \egroup}}
+
\def\dosetupinteractionscreens% met a, b en \number
- {\doifnot{\@@pcstatus}{\v!start}
- {\bgroup
- \berekeninteractiescherm
- \processaction
- [\@@scoptie]
- [ \v!max=>\!!counte=1,
- \v!bookmark=>\!!counte=2,
- \s!unknown=>\!!counte=0,
- \s!default=>\!!counte=0]%
- \edef\temp%
- {{\number\rugoffset}{\number\kopoffset}%
- {\number\!!widtha}{\number\!!heighta}%
- {\the\!!counte}}%
- \doifnot{\the\!!widtha\the\!!heighta}{\@@pcscreendata}
- {\xdef\@@pcscreendata{\the\!!widtha\the\!!heighta}%
- \showmessage{\m!interactions}{1} % niet waterdicht
- {\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}%
- % need to be split: dimensions for each page
- % and mode per document and only once !
- \dosetupscreen
- {\number\rugoffset}{\number\kopoffset}
- {\number\!!widtha}{\number\!!heighta}
- {\the\!!counte}%
- \egroup}}
+ {\doifnot\@@pcstatus\v!start\dodosetupinteractionscreens}
+
+\setvalue{\??sc\c!optie\v!max }{1} % tzt share with driver
+\setvalue{\??sc\c!optie\v!bookmark}{2} % tzt share with driver
+
+\def\dodosetupinteractionscreens% met a, b en \number
+ {\bgroup
+ \berekeninteractiescherm
+ % slow, called each page
+ % \processaction
+ % [\@@scoptie]
+ % [ \v!max=>\!!counte=1,
+ % \v!bookmark=>\!!counte=2,
+ % \s!unknown=>\!!counte=0,
+ % \s!default=>\!!counte=0]%
+ % fast, tzt installable
+ \!!counte=0\getvalue{\??sc\c!optie\@@scoptie}\relax
+ %
+ \doifnot{\the\!!widtha\the\!!heighta}\@@pcscreendata
+ {\xdef\@@pcscreendata{\the\!!widtha\the\!!heighta}%
+ \showmessage{\m!interactions}{1} % niet waterdicht
+ {\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}%
+ % need to be split: dimensions for each page
+ % and mode per document and only once !
+ \dosetupscreen\rugoffset\kopoffset\!!widtha\!!heighta{\the\!!counte}%
+ \egroup}
\def\dostelinteractieschermin[#1]%
{\getparameters[\??sc][#1]%
@@ -435,7 +443,7 @@
% \hoofdstuk{het eerste hoofdstuk}
%
-% \bookmark {de eerste bookmark} % optional overuled hoofdstuk
+% \bookmark {de eerste bookmark} % optional overruled hoofdstuk
%
% .... text ....
%
@@ -453,7 +461,13 @@
\appendtoks\flushpostponedbookmark\to\everypar
\appendtoks\flushpostponedbookmark\to\neverypar
-\let\flushpostponedbookmark\relax
+\newtoks\postponedbookmarks
+
+%\let\flushpostponedbookmark\relax
+
+\def\flushpostponedbookmark%
+ {\the\postponedbookmarks
+ \global\postponedbookmarks\emptytoks}
\def\simplebookmark#1%
{\ifx\flushpostponedbookmark\relax \else
@@ -462,21 +476,25 @@
\writestatus{system}{clashing bookmarks: \ascii}% ECHTE MESSAGE MAKEN
\egroup
\fi
- \gdef\flushpostponedbookmark%
- {\global\let\flushpostponedbookmark\relax
- \schrijfnaarlijst[\@@bookmark]{}{#1}}}
+% \gdef\flushpostponedbookmark%
+% {\global\let\flushpostponedbookmark\relax
+% \schrijfnaarlijst[\@@bookmark]{}{#1}}}
+ \doglobal\prependtoks
+ \schrijfnaarlijst[\@@bookmark]{}{#1}%
+ \to\postponedbookmarks}
\def\complexbookmark[#1]#2%
- {\schrijfnaarlijst[#1]{}{#2}}
+% {\schrijfnaarlijst[#1]{}{#2}}
+ {\doglobal\appendtoks\schrijfnaarlijst[#1]{}{#2}\to\postponedbookmarks}
\definecomplexorsimple\bookmark
-%\def\insertbookmark[#1]#2%
-% {\bgroup
-% \doifreferencefoundelse{#1}
-% {\doinsertbookmark{0}{0}{#2}{\currentrealreference}}{1}
-% {\unknownreference{#1}}%
-% \egroup}
+% \def\insertbookmark[#1]#2%
+% {\bgroup
+% \doifreferencefoundelse{#1}
+% {\doinsertbookmark{0}{0}{#2}{\currentrealreference}}{1}
+% {\unknownreference{#1}}%
+% \egroup}
\newif\iftracebookmarks \tracebookmarksfalse
@@ -654,7 +672,7 @@
\def\doblokkeerinteractiemenu[#1][#2][#3]%
{\def\dodoblokkeerinteractiemenu##1%
{\doifelse{#3}{}
- {\setevalue{\??am##1\c!blokkade}{}}
+ {\letvalue{\??am##1\c!blokkade}\empty}
{\edef\interactieblokkade{\getvalue{\??am##1\c!blokkade}}
\def\docommando####1%
{#1{####1}{\interactieblokkade}}% #1 = \remove or \add
@@ -676,82 +694,169 @@
\newif\iflocationdummy
\newif\ifskippedmenuitem
-\def\dosetlocationbox#1[#2]#3#4%
+% \def\dosetlocationbox#1[#2]#3#4%
+% {\global\skippedmenuitemfalse
+% \setbox\locationbox=\hbox
+% {% anders cyclische aanroep !
+% \resetgoto
+% \iflocationdummy
+% \edef\locationboxborder{\getvalue{#1\c!kader}}%
+% \edef\locationboxbackground{\getvalue{#1\c!achtergrond}}%
+% \else
+% \edef\locationboxborder{\v!uit}%
+% \edef\locationboxbackground{}%
+% \fi
+% \localframed[#1]
+% [\c!kader=\locationboxborder,
+% \c!achtergrond=\locationboxbackground,
+% #2]
+% {\dolocationattributes{#1}\c!letter\c!kleur{#3}}}%
+% \hbox{#4{\box\locationbox}}}
+%
+% \def\setlocationboxyes#1[#2]#3[#4]%
+% {\ifx\currentouterreference\empty
+% \ifrealreferencepage\!!doneatrue\else\!!doneafalse\fi
+% %\doifelse{\currentrealreference}{\realfolio}
+% % {\!!doneatrue}{\!!doneafalse}%
+% \else
+% \!!doneafalse
+% \fi
+% \if!!donea
+% %\ifcase0\getvalue{#1\c!zelfdepagina}\relax
+% \ifcase0\getvalue{\??am\??am\getvalue{#1\c!zelfdepagina}}\relax
+% \bgroup
+% \locationdummytrue
+% \setevalue{#1\c!kleur}{\getvalue{#1\c!contrastkleur}}%
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}%
+% \egroup
+% \or
+% \locationdummytrue
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}%
+% \or
+% \locationdummyfalse
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}%
+% \or
+% \locationdummyfalse
+% \global\skippedmenuitemtrue
+% \fi
+% \else
+% \locationdummytrue
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}%
+% \fi}
+%
+% \def\setlocationboxnop#1[#2]#3[#4]%
+% %{\ifcase\getvalue{#1\c!onbekendeverwijzing}\relax
+% {\ifcase\getvalie{\??am\??am\getvalue{#1\c!onbekendeverwijzing}}\relax
+% \locationdummytrue
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{}%
+% \or
+% \locationdummytrue
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}%
+% \or
+% \locationdummyfalse
+% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}%
+% \or
+% \locationdummyfalse
+% \global\skippedmenuitemtrue
+% \fi}
+%
+% \def\setlocationbox#1[#2]#3[#4]%
+% {\doifreferencepermittedelse{#4}{\csname#1\c!blokkade\endcsname}
+% {\setlocationboxyes{#1}[#2]{#3}[#4]}
+% {\setlocationboxnop{#1}[#2]{#3}[#4]}}
+
+\newif\iflocationempty
+\newif\iflocationclick
+
+% ja : kader/achtergrond met tekst
+% leeg : kader/achtergrond maar geen tekst
+% nee : alleen ruimte reserveren
+% geen : helemaal weglaten
+%
+% \setupinteractionmenu[right][samepage=yes, unknownreference=yes]
+% \setupinteractionmenu[right][samepage=empty,unknownreference=empty]
+% \setupinteractionmenu[right][samepage=no, unknownreference=no]
+% \setupinteractionmenu[right][samepage=none, unknownreference=none]
+%
+% \startinteractionmenu[right]
+% \but [firstpage] first \\
+% \but [lastpage] last \\
+% \but [somepage] crap \\
+% \stopinteractionmenu
+
+\def\dosetlocationboxcontent#1[#2]#3[#4]%
{\global\skippedmenuitemfalse
\setbox\locationbox=\hbox
- {% anders cyclische aanroep !
- \resetgoto
- \iflocationdummy
- \edef\locationboxborder{\getvalue{#1\c!kader}}%
- \edef\locationboxbackground{\getvalue{#1\c!achtergrond}}%
- \else
- \edef\locationboxborder{\v!uit}%
- \edef\locationboxbackground{}%
- \fi
- \localframed[#1]
- [\c!kader=\locationboxborder,
- \c!achtergrond=\locationboxbackground,
- #2]
+ {\resetgoto % anders cyclische aanroep !
+ \localframed[#1][#2]
{\dolocationattributes{#1}\c!letter\c!kleur{#3}}}%
- \hbox{#4{\box\locationbox}}}
+ \iflocationclick
+ \hbox{\gotolocation{#4}{\box\locationbox}}%
+ \else
+ \hbox{\box\locationbox}%
+ \fi}
+
+\let\dosetlocationboxyes\dosetlocationboxcontent
+
+\def\dosetlocationboxempty#1[%
+ {\dosetlocationboxcontent{#1}[\c!leeg=\v!ja}
+
+\def\dosetlocationboxno#1[%
+ {\dosetlocationboxcontent{#1}[\c!leeg=\v!ja,\c!kader=,\c!achtergrond=,}
-\def\setlocationboxyes#1[#2]#3[#4]%
- {\ifx\currentouterreference\empty
+\def\dosetlocationboxnone#1[#2]#3[#4]%
+ {\global\skippedmenuitemtrue}
+
+\def\setlocationboxyes#1%
+ {\locationclicktrue
+ \ifx\currentouterreference\empty
\ifrealreferencepage\!!doneatrue\else\!!doneafalse\fi
- %\doifelse{\currentrealreference}{\realfolio}
- % {\!!doneatrue}{\!!doneafalse}%
\else
\!!doneafalse
\fi
\if!!donea
- \ifcase0\getvalue{#1\c!zelfdepagina}\relax
- \bgroup
- \locationdummytrue
- \setevalue{#1\c!kleur}{\getvalue{#1\c!contrastkleur}}%
- \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}%
- \egroup
+ \ifcase\csname\??am\??am\csname#1\c!zelfdepagina\endcsname\endcsname\relax
+ \copycsname#1\c!kleur\endcsname\csname#1\c!contrastkleur\endcsname
+ \@EAEAEA\dosetlocationboxyes
\or
- \locationdummytrue
- \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}%
+ \@EAEAEA\dosetlocationboxempty
\or
- \locationdummyfalse
- \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}%
+ \@EAEAEA\dosetlocationboxno
\or
- \locationdummyfalse
- \global\skippedmenuitemtrue
+ \@EAEAEA\dosetlocationboxnone
\fi
\else
- \locationdummytrue
- \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}%
- \fi}
+ \@EA\dosetlocationboxcontent
+ \fi{#1}}
-\def\setlocationboxnop#1[#2]#3[#4]%
- {\ifcase\getvalue{#1\c!onbekendeverwijzing}\relax
- \locationdummytrue
- \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{}%
+\def\setlocationboxnop#1%
+ {\locationclickfalse
+ \ifcase\csname\??am\??am\csname#1\c!onbekendeverwijzing\endcsname\endcsname\relax
+ \@EA\dosetlocationboxyes
\or
- \locationdummytrue
- \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}%
+ \@EA\dosetlocationboxempty
\or
- \locationdummyfalse
- \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}%
+ \@EA\dosetlocationboxno
\or
- \locationdummyfalse
- \global\skippedmenuitemtrue
- \fi}
+ \@EA\dosetlocationboxnone
+ \fi{#1}}
\def\setlocationbox#1[#2]#3[#4]%
- {\doifreferencepermittedelse{#4}{\getvalue{#1\c!blokkade}}
+ {\bgroup % really needed !
+ \edef\permittedreferences{\csname#1\c!blokkade\endcsname}%
+ \doifreferencepermittedelse{#4}
{\setlocationboxyes{#1}[#2]{#3}[#4]}
- {\setlocationboxnop{#1}[#2]{#3}[#4]}}
+ {\setlocationboxnop{#1}[#2]{#3}[#4]}%
+ \egroup}
+\def\setlocationboxraw#1[#2]#3[#4]%
+ {\localframed[#1][#2]{\dolocationattributes{#1}\c!letter\c!kleur{#3}}}
+
\def\dodosetlocationcommanditem#1#2#3[#4]#5\\%
{\bgroup
\leavevmode
\doifelse{#5}{[]}
- {\doifinstringelse{=}{#4}
- {#3}
- {\setlocationbox{\??am#1}[]{#3}[#4]}}
+ {\doifassignmentelse{#4}{#3}{\setlocationbox{\??am#1}[]{#3}[#4]}}
{#3}%
\ifskippedmenuitem \else
\getvalue{\??am#1#2}%
@@ -789,41 +894,93 @@
\newtoks\everysetmenucommands
+% \def\setamboxcommands#1#2%
+% {\def\@@amboxcommand##1\\%
+% {\bgroup
+% \leavevmode\ignorespaces##1\unskip\relax
+% \ifskippedmenuitem \else
+% \getvalue{\??am#1#2}%
+% \fi
+% \egroup
+% \ignorespaces}%
+% \doglobal\newcounter\currentamposition %%% experiment
+% \def\currentmenu{#1}% to be sure
+% % here, but could go into \everysetmenucommands
+% \def\raw[##1]##2\\%
+% {\@@amboxcommand\naarbox{\ignorespaces##2\unskip}[##1]\\}%
+% \def\but[##1]##2\\%
+% {\@@amboxcommand\do@@amposition{#1}{##1}{\setlocationbox{\??am#1}[]{\ignorespaces##2\unskip}[##1]}\\}%
+% \def\got[##1]##2\\% pas op! offset
+% {\@@amboxcommand\setlocationbox{\??am#1}[\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##2\unskip}[##1]\\}%
+% \def\nop##1\\%
+% {\@@amboxcommand\phantom{\localframed[\??am#1][]{}}\\}%
+% \def\txt##1\\%
+% {\@@amboxcommand\localframed[\??am#1][\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##1\unskip}\\}%
+% \def\rul##1\\% ook \do@@amposition !
+% {\@@amboxcommand\localframed[\??am#1][]{\ignorespaces##1\unskip}\\}%
+% \def\com##1\\%
+% {\ignorespaces##1\unskip\ignorespaces}%
+% \the\everysetmenucommands}
+
\def\setamboxcommands#1#2%
- {\def\@@amboxcommand##1\\%
- {\bgroup
- \leavevmode\ignorespaces##1\unskip\relax
- \ifskippedmenuitem \else
- \getvalue{\??am#1#2}%
- \fi
- \egroup
- \ignorespaces}%
- \doglobal\newcounter\currentamposition %%% experiment
- \def\currentmenu{#1}% to be sure
- % here, but could go into \everysetmenucommands
- \def\raw[##1]##2\\%
- {\@@amboxcommand\naarbox{\ignorespaces##2\unskip}[##1]\\}%
- \def\but[##1]##2\\%
- {\@@amboxcommand\do@@amposition{#1}{##1}{\setlocationbox{\??am#1}[]{\ignorespaces##2\unskip}[##1]}\\}%
- \def\got[##1]##2\\% pas op! offset
- {\@@amboxcommand\setlocationbox{\??am#1}[\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##2\unskip}[##1]\\}%
- \def\nop##1\\%
- {\@@amboxcommand\phantom{\localframed[\??am#1][]{}}\\}%
- \def\txt##1\\%
- {\@@amboxcommand\localframed[\??am#1][\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##1\unskip}\\}%
- \def\rul##1\\% ook \do@@amposition !
- {\@@amboxcommand\localframed[\??am#1][]{\ignorespaces##1\unskip}\\}%
- \def\com##1\\%
- {\ignorespaces##1\unskip\ignorespaces}%
+ {\def\currentmenu{#1}% % kan nog eerder
+ \def\currentsubmenu{#2}% % ? ?
+ \doglobal\newcounter\currentamposition
\the\everysetmenucommands}
+\def\menu@@amboxcommand#1\\%
+ {\bgroup
+ \leavevmode\ignorespaces#1\unskip\relax
+ \ifskippedmenuitem \else
+ \getvalue{\??am\currentmenu\currentsubmenu}%
+ \fi
+ \egroup
+ \ignorespaces}
+
+\appendtoks
+ \let\@@amboxcommand\menu@@amboxcommand
+\to \everysetmenucommands
+
+\def\menu@raw[#1]#2\\%
+ {\@@amboxcommand\naarbox{\ignorespaces#2\unskip}[#1]\\}%
+
+\def\menu@but[#1]#2\\%
+ {\@@amboxcommand\do@@amposition\currentmenu{#1}{\setlocationbox{\??am\currentmenu}[]{\ignorespaces#2\unskip}[#1]}\\}%
+
+\def\menu@got[#1]#2\\% pas op! offset
+ {\@@amboxcommand\setlocationbox{\??am\currentmenu}[\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces#2\unskip}[#1]\\}%
+
+\def\menu@nop#1\\%
+ {\@@amboxcommand\phantom{\localframed[\??am\currentmenu][]{}}\\}%
+
+\def\menu@txt#1\\%
+ {\@@amboxcommand\localframed[\??am\currentmenu][\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces#1\unskip}\\}%
+
+\def\menu@rul#1\\% ook \do@@amposition !
+ {\@@amboxcommand\localframed[\??am\currentmenu][]{\ignorespaces#1\unskip}\\}%
+
+\def\menu@com#1\\%
+ {\ignorespaces#1\unskip\ignorespaces}%
+
+\appendtoks
+ \let\raw\menu@raw
+ \let\but\menu@but
+ \let\got\menu@got
+ \let\nop\menu@nop
+ \let\txt\menu@txt
+ \let\rul\menu@rul
+ \let\com\menu@com
+\to \everysetmenucommands
+
\ifx\do@@amposition\undefined
\let\do@@amposition\gobbletwoarguments % hook for positional thingies
\fi
\let\currentmenu\empty
-\def\@@amhbox#1#2#3#4%
+% beware : never change the concept of pbgoffset
+
+\def\@@amhbox#1#2#3#4%
{\def\currentmenu{#3}%
\testinteractiemenu{#3}%
\iflocationmenupermitted
@@ -832,10 +989,10 @@
\def\dolocationcommand##1%
{\dosetlocationcommanditem{#3}{##1}}%
\dimen0=\zetbreedte
- \advance\dimen0 by \pagebackgroundhoffset
- \advance\dimen0 by \pagebackgroundhoffset
- \advance\dimen0 by -\getvalue{\??am#3\c!linkeroffset}%
- \advance\dimen0 by -\getvalue{\??am#3\c!rechteroffset}%
+ \advance\dimen0 \pagebackgroundhoffset
+ \advance\dimen0 \pagebackgroundhoffset
+ \advance\dimen0 -\getvalue{\??am#3\c!linkeroffset}%
+ \advance\dimen0 -\getvalue{\??am#3\c!rechteroffset}%
\setbox0=\hbox to \dimen0
{\forgetall
\executeamboxcommands{#3}{#4}\c!links\c!midden\c!rechts}%
@@ -857,21 +1014,22 @@
\bgroup
\showcomposition
\dimen0=\teksthoogte
- \advance\dimen0 by \pagebackgroundvoffset
- \advance\dimen0 by \pagebackgroundvoffset
- \advance\dimen0 by \pagebackgrounddepth
- \advance\dimen0 by -\getvalue{\??am#3\c!bovenoffset}%
- \advance\dimen0 by -\getvalue{\??am#3\c!onderoffset}%
+ \advance\dimen0 \pagebackgroundvoffset
+ \advance\dimen0 \pagebackgroundvoffset
+ \advance\dimen0 \pagebackgrounddepth
+ \advance\dimen0 -\getvalue{\??am#3\c!bovenoffset}%
+ \advance\dimen0 -\getvalue{\??am#3\c!onderoffset}%
\setbox0=\vbox to \dimen0
{\forgetall % Voor't geval de afstand
- \stelblankoin[\v!standaard]% % (tijdelijk) is aangepast.
+ %\stelblankoin[\v!standaard]% % (tijdelijk) is aangepast.
+ \restorestandardblank
\hsize#2\relax
\executeamboxcommands{#3}{#4}\c!voor\c!tussen\c!na}%
\setbox0=\vbox{\hbox{\do@@ammenuposition{#3}{\box0}}}%
\setbox0=\vbox
{\vskip-\pagebackgroundvoffset
\vskip\getvalue{\??am#3\c!bovenoffset}%
- \ht0=\!!zeropoint
+ \ht0=\zeropoint
\box0
\vskip\pagebackgroundvoffset}% overbodig
\ht0=\teksthoogte
@@ -935,7 +1093,7 @@
\setbox2=\vbox to #2
{\getvalue{\??am##1#3}\interactiemenu[##1]\getvalue{\??am##1#4}}%
\doifelsevalue{\??am##1\c!afstand}{\v!overlay}
- {\dimen2=\!!zeropoint
+ {\dimen2=\zeropoint
\offinterlineskip
\dp2=\zeropoint
\ht2=\zeropoint}%
@@ -999,7 +1157,7 @@
\unprotected\def\includemenu[#1]%
{\doifvalue{\??am#1\c!status}{\v!lokaal}
{\bgroup
- \doassign[\??am#1][\c!status=\v!start]%
+ \setvalue{\??am#1\c!status}{\v!start}%
\let\@@amvbox\local@@ambox
\let\@@amhbox\local@@ambox
\getvalue{\??am\c!menu#1}%
@@ -1008,92 +1166,149 @@
%D We also need an explicit position control some day. I'll
%D do that when I need it. [The stacking order.]
+% \newif\ifextendedmenu
+%
+% \def\dodefinieerinteractiemenu[#1][#2][#3]%
+% {\ConvertToConstant\doifelse{#3}{}
+% {\setvalue{\??am\c!menu#1}%
+% {\extendedmenufalse\dointeractiemenu{#1}{#2}}%
+% \setvalue{\@@dodolijstelement#1}%
+% {\def\dosomelijstelement{\dodomenulijstelement{#1}}}} % of #2 ?
+% {\setvalue{\??am\c!menu#1}%
+% {\extendedmenufalse\dointeractiemenu{#1}{}}%
+% \setvalue{\@@dodolijstelement#1}%
+% {\def\dosomelijstelement{\dodomenulijstelement{#1}}}%
+% \presetlocalframed[\??am#1]%
+% \letvalue{\??am#1\c!blokkade}\empty
+% \edef\!!stringe{\getvalue{\??am#2}}%
+% \addtocommalist{#1}\!!stringe
+% \letvalue{\??am#2}=\!!stringe
+% \doifnot{#1}{#2}
+% {\copyparameters[\??am#1][\??am#2]
+% [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen,
+% \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader,
+% \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster,
+% \c!letter,\c!kleur,\c!contrastkleur,\c!zelfdepagina,\c!onbekendeverwijzing,
+% \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}%
+% % \ConvertToConstant\doifinstringelse{=}{#3}
+% \doifassignmentelse{#3}
+% {\getparameters[\??am#1][\c!plaats=#2,#3]}%
+% {\doifnot{#2}{#3}
+% {\copyparameters[\??am#1][\??am#3]
+% [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen,
+% \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader,
+% \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster,
+% \c!letter,\c!kleur,\c!zelfdepagina,\c!onbekendeverwijzing,
+% \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}%
+% \getparameters[\??am#1][\c!plaats=#2]}}}
+%
+%\def\dodostelinteractiemenuin[#1][#2]%
+% {\def\docommando##1%
+% {\getparameters[\??am##1][#2]%
+% \dododostelinteractiemenuin{\??am##1\c!onbekendeverwijzing}%
+% \dododostelinteractiemenuin{\??am##1\c!zelfdepagina}}%
+% \processcommalist[#1]\docommando}
+%
+%\def\dostelinteractiemenuin[#1][#2]%
+%% {\ConvertToConstant\doifinstringelse{=}{#2}
+% {\doifassignmentelse{#2}
+% {\dodostelinteractiemenuin[#1][#2]}
+% {\dodefinieerinteractiemenu[#1][#2][]}}
+
+% \def\dododostelinteractiemenuin#1%
+% {\processaction
+% [\getvalue{#1}]
+% [ \v!ja=>\setvalue{#1}{0},
+% \v!leeg=>\setvalue{#1}{1},
+% \v!nee=>\setvalue{#1}{2},
+% \v!geen=>\setvalue{#1}{3},
+% \s!default=>\setvalue{#1}{1}]}
+
+% for the moment we will support the old method
+%
+% \stelinteractiemenuin[right][{abc[xyz]},...]
+% \stelinteractiemenuin[right][key=val,...]
+
\newif\ifextendedmenu
-\def\dodefinieerinteractiemenu[#1][#2][#3]%
- {\ConvertToConstant\doifelse{#3}{}
- {\setvalue{\??am\c!menu#1}%
- {\extendedmenufalse\dointeractiemenu{#1}{#2}}%
- \setvalue{\@@dodolijstelement#1}%
- {\def\dosomelijstelement{\dodomenulijstelement{#1}}}} % of #2 ?
- {\setvalue{\??am\c!menu#1}%
- {\extendedmenufalse\dointeractiemenu{#1}{}}%
- \setvalue{\@@dodolijstelement#1}%
- {\def\dosomelijstelement{\dodomenulijstelement{#1}}}%
- \presetlocalframed[\??am#1]%
- \letvalue{\??am#1\c!blokkade}\empty
- \edef\!!stringe{\getvalue{\??am#2}}%
- \addtocommalist{#1}\!!stringe
- \letvalue{\??am#2}=\!!stringe
- \doifnot{#1}{#2}
- {\copyparameters[\??am#1][\??am#2]
- [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen,
- \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader,
- \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster,
- \c!letter,\c!kleur,\c!contrastkleur,\c!zelfdepagina,\c!onbekendeverwijzing,
- \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}%
- \ConvertToConstant\doifinstringelse{=}{#3}
- {\getparameters[\??am#1][\c!plaats=#2,#3]}%
- {\doifnot{#2}{#3}
- {\copyparameters[\??am#1][\??am#3]
- [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen,
- \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader,
- \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster,
- \c!letter,\c!kleur,\c!zelfdepagina,\c!onbekendeverwijzing,
- \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}%
- \getparameters[\??am#1][\c!plaats=#2]}}}
-
\def\definieerinteractiemenu%
{\dotripleempty\dodefinieerinteractiemenu}
+\def\dodefinieerinteractiemenu[#1][#2]% compatibility hack
+ {\doifinstringelse{[}{#2}
+ {\dodostelinteractielijstmenuinx}
+ {\dododefinieerinteractiemenu }%
+ [#1][#2]}
+
+% [name] [location]
+% [name] [location] [pars]
+
+\def\dododefinieerinteractiemenu[#1][#2][#3]%
+ {% main settings
+ \letvalue{\??am\c!menu#1}\empty
+ % \setvalue{\??am\c!menu#1}%
+ % {\extendedmenufalse\dointeractiemenu{#1}{}}%
+ \setvalue{\@@dodolijstelement#1}%
+ {\def\dosomelijstelement{\dodomenulijstelement{#1}}}%
+ \presetlocalframed[\??am#1]%
+ % register location
+ \expanded{\addtocommalist{#1}\@EA\noexpand\csname\??am#2\endcsname}%
+ % inherit settings
+ \doifnot{#1}{#2}
+ {\copyparameters[\??am#1][\??am#2]
+ [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen,
+ \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader,
+ \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster,
+ \c!letter,\c!kleur,\c!contrastkleur,\c!zelfdepagina,\c!onbekendeverwijzing,
+ \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}%
+ % additional settings
+ \getparameters[\??am#1][\c!plaats=#2,\c!blokkade=,#3]}
+
+\def\stelinteractiemenuin
+ {\dodoubleargument\dostelinteractiemenuin}
+
+\def\dostelinteractiemenuin[#1][#2% compatibillity hack
+ {\doifnextcharelse\bgroup
+ {\dodostelinteractielijstmenuiny[#1][#2}
+ {\dodostelinteractiemenuin [#1][#2}}
+
+\def\dodostelinteractielijstmenuinx[#1][#2][#3]% compatibillity hack
+ {\setvalue{\??am\c!menu#1}{\extendedmenufalse\dointeractiemenu{#1}{#2}}}
+
+\def\dodostelinteractielijstmenuiny[#1][#2]% compatibillity hack
+ {\setvalue{\??am\c!menu#1}%
+ {\extendedmenufalse\dointeractiemenu{#1}{#2}}}
+
+\def\dodostelinteractiemenuin[#1][#2]%
+ {\def\docommando##1{\getparameters[\??am##1][#2]}%
+ \processcommalist[#1]\docommando}
+
+\setvalue{\??am\??am\v!ja }{0}
+\setvalue{\??am\??am\v!leeg}{1}
+\setvalue{\??am\??am\v!nee }{2}
+\setvalue{\??am\??am\v!geen}{3}
+\setvalue{\??am\??am }{1} % default
+
+\processbetween{\e!interactiemenu}\dostartinteractiemenu
+
+\def\dostartinteractiemenu#1%
+ {\dodostartinteractiemenu#1\dodostopinteractiemenu}
+
+\def\dodostartinteractiemenu[#1]#2\dodostopinteractiemenu
+ {\setvalue{\??am\c!menu#1}{\extendedmenutrue\dointeractiemenu{#1}{#2}}}
+
\def\dodomenulijstelement#1#2#3#4#5#6#7%
{\setbox0=\hbox
{\let\gotolocation\gobbleoneargument % hack to catch last []
+%\locationclickfalse % ipv ^
\docheckrealreferencepage{#7}%
\setlocationboxyes
{\??am#1}% % needed !
[]% no settings
- {\doifelsenothing{\??li#2\c!maxbreedte}
- {#5}
- {\limitatetext
- {#5}
- {\getvalue{\??li#2\c!maxbreedte}}
- {\unknown}}}% % needed !
+ {\limitatetext{#5}{\getvalue{\??li#2\c!maxbreedte}}{\unknown}}% % needed !
[]}% normally the destination, catch by gobble
\@@amboxcommand\do@@amposition{#1}{#7}% beware, we pass the pagenumber
{\ignorespaces\linklisttoelement{#2}{#3}{#6}{#7}{\box0}\unskip}\\}
-
-\processbetween{\e!interactiemenu}\dostartinteractiemenu
-
-\def\dostartinteractiemenu#1%
- {\dodostartinteractiemenu#1\dodostopinteractiemenu}
-
-\def\dodostartinteractiemenu[#1]#2\dodostopinteractiemenu%
- {\setvalue{\??am\c!menu#1}{\extendedmenutrue\dointeractiemenu{#1}{#2}}}
-
-\def\dododostelinteractiemenuin#1%
- {\processaction
- [\getvalue{#1}]
- [ \v!ja=>\setvalue{#1}{0},
- \v!leeg=>\setvalue{#1}{1},
- \v!nee=>\setvalue{#1}{2},
- \v!geen=>\setvalue{#1}{3},
- \s!default=>\setvalue{#1}{1}]}
-
-\def\dodostelinteractiemenuin[#1][#2]%
- {\def\docommando##1%
- {\getparameters[\??am##1][#2]%
- \dododostelinteractiemenuin{\??am##1\c!onbekendeverwijzing}%
- \dododostelinteractiemenuin{\??am##1\c!zelfdepagina}}%
- \processcommalist[#1]\docommando}
-
-\def\dostelinteractiemenuin[#1][#2]%
- {\ConvertToConstant\doifinstringelse{=}{#2}
- {\dodostelinteractiemenuin[#1][#2]}
- {\dodefinieerinteractiemenu[#1][#2][]}}
-
-\def\stelinteractiemenuin%
- {\dodoubleargument\dostelinteractiemenuin}
% \scherm moet worden als \pagina
@@ -1109,24 +1324,61 @@
\definecomplexorsimple\scherm
-\def\domenubutton[#1][#2]#3[#4]%
- {\bgroup
- \locationdummytrue
- \iffirstargument
+% \def\domenubutton[#1][#2]#3[#4]%
+% {\bgroup
+% \locationdummytrue
+% \iffirstargument
+% \ifsecondargument
+% \setlocationbox{\??am#1}[#2]{#3}[#4]%
+% \else
+% \doifassignmentelse{#1}
+% {\setlocationbox\??bt[#1]{#3}[#4]}
+% {\setlocationbox{\??am#1}[]{#3}[#4]}%
+% \fi
+% \else
+% \setlocationbox\??bt[]{#3}[#4]%
+% \fi
+% \egroup}
+
+\unexpanded\def\menubutton
+ {\dodoubleempty\domenubutton}
+
+\def\domenubutton[#1]%
+ {\iffirstargument
\ifsecondargument
- \setlocationbox{\??am#1}[#2]{#3}[#4]%
+ \@EAEAEA\domenubuttonB
\else
- \ConvertToConstant\doifinstringelse{=}{#1}
- {\setlocationbox{\??bt}[#1]{#3}[#4]}
- {\setlocationbox{\??am#1}[]{#3}[#4]}%
+ \doifassignmentelse{#1}
+ {\@EAEAEA\domenubuttonC}
+ {\@EAEAEA\domenubuttonD}%
\fi
\else
- \setlocationbox{\??bt}[]{#3}[#4]%
- \fi
+ \@EA\domenubuttonA
+ \fi[#1]}
+
+\def\domenubuttonA[#1][#2]#3[#4]% normal button, no parameters
+ {\bgroup
+ %\locationdummytrue
+ \setlocationbox\??bt[]{#3}[#4]%
\egroup}
-\unexpanded\def\menubutton%
- {\dodoubleempty\domenubutton}
+\def\domenubuttonB[#1][#2]#3[#4]% menu button, with parameters
+ {\bgroup
+ %\locationdummytrue
+ \setlocationbox{\??am#1}[#2]{#3}[#4]%
+ \egroup}
+
+\def\domenubuttonC[#1][#2]#3[#4]% normal button, with parameters
+ {\bgroup
+ %\locationdummytrue
+ \setlocationbox\??bt[#1]{#3}[#4]%
+ \egroup}
+
+\def\domenubuttonD[#1][#2]#3[#4]% menu button, no parameters
+ {\bgroup
+ %\locationdummytrue
+ \setlocationbox{\??am#1}[]{#3}[#4]%
+ \egroup}
\def\domenubox[#1][#2]#3%
{\bgroup
@@ -1136,8 +1388,14 @@
\domenubutton[#1][#2]#3[]%
\egroup}
-\def\menubox%
+\def\menubox
{\dodoubleempty\domenubox}
+
+\def\domenubox[#1][#2]#3%
+ {\bgroup
+ \let\setlocationbox\setlocationboxraw
+ \domenubutton[#1][#2]#3[]%
+ \egroup}
% Hier volgen de synchronisatiemacro's:
@@ -1192,7 +1450,8 @@
\setvalue{synchronisatie\v!pagina}[#1]%
{\bgroup
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\setbox0=\hbox
{\localframed[\??ba][]%
{\dolocationattributes\??ba\c!letter\c!kleur{\strut\@@batekst}}}%
@@ -1232,13 +1491,14 @@
\boven\top11\hss\boven\first11\hss\boven\bot11\relax
\fi
\fi}%
- \wd2=\!!zeropoint\box2
+ \wd2=\zeropoint\box2
\box0\relax}%
\egroup}
\setvalue{synchronisatie\v!lokaal}[#1]%
{\bgroup
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\def\blackrule{\hbox{\vrule\!!height.5em\!!width.5em}}%
%\gotodestination
% {}{##1}{\syncprefix:#1}{0}
@@ -1282,7 +1542,8 @@
\def\interactiebalka%
{\iflocation
\bgroup
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\setupblackrules[\c!hoogte=\v!max,\c!diepte=\v!max]% maten ??
\!!widthb=\@@ibbreedte\relax
\advance\!!widthb by -2.75em\relax
@@ -1312,7 +1573,7 @@
\for \teller=1 \to \lastpage \step \!!counta \do
{\gotorealpage{}{}{\teller}{\copy0}}%
\hss}%
- \global\wd\meterbox=\!!zeropoint\relax
+ \global\wd\meterbox=\zeropoint\relax
\egroup
\fi
\egroup
@@ -1332,7 +1593,7 @@
\ifnum\realpageno>1\relax
\!!counta=\realpageno
\advance\!!counta by -2\relax
- \hskip\!!zeropoint\!!plus\!!counta sp\relax % cm gives overflow
+ \hskip\zeropoint\!!plus\!!counta sp\relax % cm gives overflow
\doganaareenpagina\??ib\blackrule\prevpage
\fi
\color[\@@ibcontrastkleur]{\blackrule[\c!breedte=.5em]}%
@@ -1341,7 +1602,7 @@
\!!counta=\lastpage\relax
\advance\!!counta by -\realpageno
\advance\!!counta by -1\relax
- \hskip\!!zeropoint\!!plus\!!counta sp\relax % cm gives overflow
+ \hskip\zeropoint\!!plus\!!counta sp\relax % cm gives overflow
\fi}%
\hss
\doganaareenpagina\??ib\blackrule\lastpage}%
@@ -1385,7 +1646,8 @@
\ifnum\nofsubpages>1
\hbox
\bgroup
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\ifbalksymbool % beter: 3 chars assign en 3*box
\setupsymbolset[\@@iasymboolset]%
\setbox0=\hbox{\symbol[\v!vorige]}%
@@ -1435,7 +1697,8 @@
\ifdim\!!widtha<\@@ibafstand\relax
\interactiebalkf
\else
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\noindent
\hbox to \@@ibbreedte
\bgroup
@@ -1480,7 +1743,8 @@
\def\interactiebalkf% !! KAN WORDEN GECOMBINEERD MET D !!
{\iflocation\ifshowingsubpage
\ifnum\nofsubpages>1
- \setupinteraction[\c!breedte=\!!zeropoint]%
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
\noindent
\hbox to \@@ibbreedte
\bgroup
@@ -1590,7 +1854,7 @@
\fi}
\def\checkinteractiebalk#1#2#3%
- {\ifdim\@@ibbreedte=\!!zeropoint\def\@@ibbreedte{#1}\fi
+ {\ifdim\@@ibbreedte=\zeropoint\def\@@ibbreedte{#1}\fi
\doifnothing{\@@ibhoogte}{\def\@@ibhoogte{#2}}%
\doifnothing{\@@ibdiepte}{\def\@@ibdiepte{#3}}}
@@ -1665,10 +1929,7 @@
{\addtocommalist{##2}\processedprofiles
##1\relax
\ifcase#1\relax
- \dobeginofprofile
- {##2}
- {\number\papierbreedte}{\number\papierhoogte}
- {\profilepage}%
+ \dobeginofprofile{##2}\papierbreedte\papierhoogte\profilepage
\else
\doendofprofile
\fi}}%
@@ -1719,9 +1980,7 @@
\data
{\dolocationattributes\??ia\c!letter\c!kleur{#1\presetgoto}}%
\start
- \dostartgotoprofile
- {\number\buttonwidth}{\number\buttonheight}
- {#2}%
+ \dostartgotoprofile\buttonwidth\buttonheight{#2}%
\stop
\dostopgotoprofile
\dostopgoto}%
@@ -2003,46 +2262,47 @@
\def\horizontalpositionbar\pos#1\min#2\max#3\token#4\\%
{\hbox to \hsize
- {\hskip\!!zeropoint\!!plus #1\!!fill
- \hskip\!!zeropoint\!!plus-#2\!!fill
+ {\hskip\zeropoint\!!plus #1\!!fill
+ \hskip\zeropoint\!!plus-#2\!!fill
#4\relax
- \hskip\!!zeropoint\!!plus #3\!!fill
- \hskip\!!zeropoint\!!plus-#1\!!fill}}
+ \hskip\zeropoint\!!plus #3\!!fill
+ \hskip\zeropoint\!!plus-#1\!!fill}}
\def\verticalpositionbar\pos#1\min#2\max#3\token#4\\%
{\vbox to \vsize
- {\vskip\!!zeropoint\!!plus #1\!!fill
- \vskip\!!zeropoint\!!plus-#2\!!fill
+ {\vskip\zeropoint\!!plus #1\!!fill
+ \vskip\zeropoint\!!plus-#2\!!fill
\hbox{#4}\relax
- \vskip\!!zeropoint\!!plus #3\!!fill
- \vskip\!!zeropoint\!!plus-#1\!!fill}}
+ \vskip\zeropoint\!!plus #3\!!fill
+ \vskip\zeropoint\!!plus-#1\!!fill}}
\def\horizontalgrowingbar\pos#1\min#2\max#3\height#4\depth#5\\%
{\hbox to \hsize
{\scratchcounter=#1\relax
\advance\scratchcounter by -#2\relax
\advance\scratchcounter by 1\relax
- \leaders\vrule\hskip\!!zeropoint\!!plus \scratchcounter\!!fill
- \vrule\!!width\!!zeropoint\!!height#4\!!depth#5\relax
- \hskip\!!zeropoint\!!plus #3\!!fill
- \hskip\!!zeropoint\!!plus-#1\!!fill}}
+ \leaders\vrule\hskip\zeropoint\!!plus \scratchcounter\!!fill
+ \vrule\!!width\zeropoint\!!height#4\!!depth#5\relax
+ \hskip\zeropoint\!!plus #3\!!fill
+ \hskip\zeropoint\!!plus-#1\!!fill}}
\def\verticalgrowingbar\pos#1\min#2\max#3\width#4\\%
{\vbox to \vsize
{\scratchcounter=#1\relax
\advance\scratchcounter by -#2\relax
\advance\scratchcounter by 1\relax
- \leaders\hrule\vskip\!!zeropoint\!!plus\scratchcounter\!!fill
- \hrule\!!width#4\!!height\!!zeropoint\!!depth\!!zeropoint
- \vskip\!!zeropoint\!!plus #3\!!fill
- \vskip\!!zeropoint\!!plus-#1\!!fill}}
+ \leaders\hrule\vskip\zeropoint\!!plus\scratchcounter\!!fill
+ \hrule\!!width#4\!!height\zeropoint\!!depth\zeropoint
+ \vskip\zeropoint\!!plus #3\!!fill
+ \vskip\zeropoint\!!plus-#1\!!fill}}
\newbox\commentbox
-\def\flushcomments%
- {\ifvoid\commentbox\else
- \inmarge{\hbox{\raise\ht\strutbox\box\commentbox}}%
- \fi}
+\def\doflushcomments%
+ {\inmarge{\hbox{\raise\ht\strutbox\box\commentbox}}}
+
+\def\flushcomments% in everypar so indirect
+ {\ifvoid\commentbox\else \doflushcomments \fi}
\def\stelcommentaarin%
{\dodoubleargument\getparameters[\??cc]}
@@ -2054,13 +2314,13 @@
{\dodoubleempty\docommentaar}
\def\dodocommentaar#1%
- {\!!widtha=\@@ccbreedte
- \!!heighta=\@@cchoogte
+ {\!!widtha\@@ccbreedte
+ \!!heighta\@@cchoogte
\doifelse{\@@ccoptie}{\v!max}
{\def\@@ccoptie{1}}{\def\@@ccoptie{0}}%
- \doPDFinsertcomment
- {\@@cctitel}{\number\!!widtha}{\number\!!heighta}
- {\@@cckleur}{\@@ccoptie}{\@@ccsymbool}{#1}}
+ \doinsertcomment
+ \@@cctitel\!!widtha\!!heighta
+ \@@cckleur\@@ccoptie\@@ccsymbool{#1}}
%\def\dopreparecommentaar#1#2%
% {\doifassignmentelse{#1}
@@ -2085,7 +2345,7 @@
%\def\docommentaar[#1][#2]#3%
% {\bgroup
% \dopreparecommentaar{#1}{#2}%
-% \hbox to \!!zeropoint
+% \hbox to \zeropoint
% {\hskip-\@@ccmarge
% \raise\ht\strutbox\hbox{\dodocommentaar{#3}}}%
% \egroup
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index ba1e65a4a..6eb40f6c5 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -1,19 +1,20 @@
-% todo : start=2
-
%D \module
-%D [ file=core-itm,
+%D [ file=core-itm, % updated
%D version=1997.03.31,
%D title=\CONTEXT\ Core Macros,
-%D subtitle=Itemize,
+%D subtitle=itemgroups,
%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.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% new: text + lefttext=(,righttext=)
+% start=
-\writestatus{loading}{Context Core Macros / Itemize}
+\writestatus{loading}{Context Core Macros / itemgroup}
\startmessages dutch library: layouts
9: momenteel maximaal -- niveaus in opsommingen
@@ -43,394 +44,327 @@
9: acum nu se supota mai mult de -- nivele de adancime la iteratii
\stopmessages
-\unprotect
+\unprotect
-% - meerdere niveaus (moet niet moeilijk zijn)
% - instellingen in macro
-% - \defineitemize
% - [0] voor start op 0
+% - start=2
-\newif\ifsubsom \subsomfalse
-\newif\ifsymsom \symsomfalse
-\newif\ifkopsom \kopsomfalse
-\newif\ifsomintro \somintrofalse
-\newif\ifsomautointro \somautointrofalse
+\newif\ifsubitem \subitemfalse
+\newif\ifsymbolitem \symbolitemfalse
+\newif\ifheaditem \headitemfalse
+\newif\ifitemintro \itemintrofalse
+\newif\ifautoitemintro \autoitemintrofalse
\newif\ifoptimizeitems \optimizeitemstrue
\newif\ifpackeditems \packeditemsfalse
\newif\iffirstlist \firstlistfalse
\newif\ifparagraphitems \paragraphitemsfalse
-
-\newcounter \itemcolumndepth
-
-\definetwopasslist{\s!list}
+\newif\iftextitems \textitemsfalse
\newcounter\noflists
\newcounter\itemlevel
+\newcounter\itemcolumndepth
+\newcounter\maxitemlevel
+
+\definetwopasslist\s!list
+
+\let\currentitemgroup\empty
+
+\def\itemreferences{0}
+
+% #1=level #2=parameter
-\def\dolistreference%
- {\immediatewriteutilitycommand%
+\def\getitemparameter #1#2{\csname\??op\currentitemgroup#1#2\endcsname}
+\def\setitemparameter #1#2{\@EA\def\csname\??op\currentitemgroup#1#2\endcsname}
+\def\letitemparameter #1#2{\@EA\let\csname\??op\currentitemgroup#1#2\endcsname}
+
+\def\doitemattributes #1{\doattributes{\??op\currentitemgroup#1}}
+
+\def\@@globalitemsymbol #1{\??op\currentitemgroup\c!symbool\s!global#1}
+\def\@@localitemsymbol #1{\??op\currentitemgroup\c!symbool\s!local #1}
+\def\@@currentitemsymbol#1{\??op\currentitemgroup\c!symbool #1}
+
+\def\@@itemcounter {\s!itemcount} % {\s!itemcount\currentitemgroup}
+
+\def\doitembreak#1{\iftextitems\else\dosomebreak#1\fi}
+
+\def\dolistreference
+ {\immediatewriteutilitycommand
{\twopassentry%
{\s!list}%
{\currentlist}%
{\currentlist:\noflistelements}}}
-\def\setnextitemlevel#1%
- {\doifundefined{\??op#1\c!breedte}
- {\edef\itemreferences{\itemreferences,#1}%
- \copyparameters
- [\??op#1][\??oo]
- [\c!breedte,\c!factor,\c!afstand,
- \c!letter,\c!marletter,\c!symletter,\c!kopletter,
- \c!kleur,\c!markleur,\c!symkleur,\c!kopkleur,
- \c!kopvoor,\c!kopna,\c!voor,\c!tussen,\c!na,
- \c!afsluiter,\c!plaatsafsluiter,\c!inspringen,
- \c!n,\c!binnen,\c!symbool,\c!marge]%
- \makecounter{\s!itemcount#1}%
- \setvalue{\??op\c!symbool\s!global#1}{#1}}}
-
-\def\maxitemlevel{0}
-\def\itemreferences{0}
+\def\initializeitemgroupslevel#1%
+ {\ifundefined{\@@globalitemsymbol{#1}}%
+ \edef\itemreferences{\itemreferences,#1}%
+ \makecounter{\@@itemcounter#1}%
+ \setevalue{\@@globalitemsymbol{#1}}{#1}%
+ \fi}
+
+\def\initializeitemgrouplevel#1% safeguard
+ {\ifundefined{\??op\currentitemgroup#1\c!breedte}%
+ \doinitializeitemgrouplevel{#1}%
+ \fi}
-\def\dostelopsommingenin[#1]% % still undocumented
+\def\doinitializeitemgrouplevel#1%
+ {\copyparameters
+ [\??op\currentitemgroup#1][\??oo]
+ [\c!breedte,\c!factor,\c!afstand,\c!uitlijnen,
+ \c!letter,\c!marletter,\c!symletter,\c!kopletter,
+ \c!kleur,\c!markleur,\c!symkleur,\c!kopkleur,
+ \c!kopvoor,\c!kopna,\c!voor,\c!tussen,\c!na,
+ \c!afsluiter,\c!plaatsafsluiter,\c!inspringen,
+ \c!n,\c!binnen,\c!symbool,\c!marge,\c!items,
+ \c!start,\c!linkertekst,\c!rechtertekst]}
+
+\def\setupitemgroups
+ {\dosingleargument\dosetupitemgroups}
+
+\def\dosetupitemgroups[#1]% still undocumented
{\getparameters[\??oo][\c!niveaus=4,#1]%
+ % will change (remove)
\ifnum\@@ooniveaus>\maxitemlevel
\edef\maxitemlevel{\@@ooniveaus}%
- \dorecurse{\maxitemlevel}{\setnextitemlevel\recurselevel}%
+ \dorecurse\maxitemlevel{\initializeitemgroupslevel\recurselevel}%
\fi}
-\def\stelopsommingenin%
- {\dosingleargument\dostelopsommingenin}
-
\def\doitemreference#1,#2,#3\\%
{\ifnum\itemlevel>#1
- \ifnum#1>0
- \tempsymbool
- \fi
- \getvalue{\??op\c!symbool#2}%
+ \ifnum#1>0 \tempsymbol \fi
+ \getvalue{\@@currentitemsymbol{#2}}%
\doitemreference#2,#3\\%
\fi}
-\def\itemreference%
+\def\itemreference
{\expandafter\doitemreference\itemreferences,,\\}
-\def\itemuse#1%
- {\getvalue{\??op\itemlevel#1}}%
-
-\def\packitems%
- {\ifnum\itemlevel=0 \else\packeditemstrue\fi}
+\def\packitems
+ {\ifnum\itemlevel=0 \else \packeditemstrue \fi}
-\def\dostelopsomminginvariable[#1][#2]% niveau instellingen
+\def\dosetupitemgroupvariable[#1]% [#2]% niveau instellingen
{\doifelsenothing{#1}
- {\getparameters[\??op\itemlevel][#2]}%
- {\getparameters[\??op#1][#2]}}
+ {\getparameters[\??op\currentitemgroup\itemlevel]}% [#2]}%
+ {\getparameters[\??op\currentitemgroup#1]}}% [#2]}}
\newconditional\inlinelistitem \setfalse\inlinelistitem
-\def\dododostelopsomminginconstant[#1][#2#3#4]% * permits [2]
+\def\dododosetupitemgroupconstant[#1][#2#3#4]% * permits [2]
{\processaction
[#2#3#4]
[ \v!opelkaar*=>\packitems,
- \v!vanelkaar*=>\packeditemsfalse,
- \v!intro*=>\somintrotrue,
- \v!autointro*=>\somautointrotrue,
- \v!ruim*=>{\doassign[\??op#1][\c!factor=1]},
- #2#3*\v!ruim*=>{\doassign[\??op#1][\c!factor=#2#3]},
- #2*\v!ruim*=>{\doassign[\??op#1][\c!factor=#2]},
- \v!marge*=>{\doassign[\??op#1][\c!breedte=-2em]}, % signal
- \v!inmarge*=>{\doassign[\??op#1][\c!breedte=-2em]}, % signal
- \v!opmarge*=>\doifnot{#1}{1}{\doassign[\??op#1][\c!breedte=0em]}, % signal
+ \v!intro*=>\itemintrotrue,
+ \v!autointro*=>\autoitemintrotrue,
+ \v!ruim*=>\setitemparameter{#1}\c!factor{1},
+ #2#3*\v!ruim*=>\setitemparameter{#1}\c!factor{#2#3},
+ #2*\v!ruim*=>\setitemparameter{#1}\c!factor{#2},
+ \v!tekst*=>\textitemstrue
+ \settrue\inlinelistitem
+ \dosetuppackeditemgroup{#1}%
+ \packitems,
\v!kolommen*=>\packitems,
-\v!intekst*=>\settrue\inlinelistitem, % new
+ \v!marge*=>\setitemparameter{#1}\c!breedte{-2em}, % signal
+ \v!inmarge*=>\setitemparameter{#1}\c!breedte{-2em}, % signal
+ \v!opmarge*=>\doifnot{#1}{1}{\setitemparameter{#1}\c!breedte{0em}}, % signal
+ \v!intekst*=>\settrue\inlinelistitem, % new
\v!los*=>\optimizeitemsfalse,
- \v!alinea*=>{\paragraphitemstrue
- \packitems},
- \v!aansluitend*=>{\getparameters[\??op#1]
- [\c!kopvoor=,\c!kopna=,
- \c!voor=,\c!tussen=,\c!na=]%
- \packitems},
- \v!aanelkaar*=>{\doassign[\??op#1][\c!factor=-1]},
- #2#3*\v!aanelkaar*=>{\doassign[\??op#1][\c!factor=-#2#3]},
- #2*\v!aanelkaar*=>{\doassign[\??op#1][\c!factor=-#2]},
- \v!afsluiter*=>{\doassign[\??op#1][\c!plaatsafsluiter=\v!ja]},
- \v!standaard*=>{\getparameters[\??op#1]
- [\c!breedte=1.5em,
- \c!factor=0,
- \c!afstand=.5em,
- \c!kopvoor=,
- \c!kopna=\blanko,
- \c!voor=\blanko,
- \c!tussen=\blanko,
- \c!na=\blanko,
- \c!binnen=]}]}
-
-\def\dostelopsomminginconstant[#1][#2]%
- {\def\dodostelopsomminginconstant##1%
- {\dododostelopsomminginconstant[#1][##1*]}%
-% \processcommalist[#2]\dodostelopsomminginconstant}
- \processcommacommand[#2]\dodostelopsomminginconstant} % expansion of #2 is handy for xml
-
-\def\dodododostelopsommingin[#1][#2]%
- {\ConvertToConstant\doifinstringelse{=}{#2}
- {\dostelopsomminginvariable[#1][#2]}
- {\setvalue{\??op#1}{\dostelopsomminginconstant[#1][#2]}}}%
-
-\def\dododostelopsommingin[#1][#2]%
+ \v!alinea*=>\paragraphitemstrue
+ \packitems,
+ \v!aansluitend*=>\dosetuppackeditemgroup{#1}%
+ \packitems,
+ \v!aanelkaar*=>\setitemparameter{#1}\c!factor{-1},
+ #2#3*\v!aanelkaar*=>\setitemparameter{#1}\c!factor{-#2#3},
+ #2*\v!aanelkaar*=>\setitemparameter{#1}\c!factor{-#2},
+ \v!afsluiter*=>\setitemparameter{#1}\c!plaatsafsluiter\v!ja,
+ \v!vanelkaar*=>\packeditemsfalse,
+ \v!standaard*=>\dosetupstandarditemgroup{#1}]}
+
+\def\dosetupstandarditemgroup#1%
+ {\getparameters
+ [\??op\currentitemgroup#1]
+ [\c!breedte=1.5em,
+ \c!factor=0,
+ \c!afstand=.5em,
+ \c!kopvoor=,
+ \c!kopna=\blanko,
+ \c!voor=\blanko,
+ \c!tussen=\blanko,
+ \c!na=\blanko,
+ \c!binnen=]}
+
+\def\dosetuppackeditemgroup#1%
+ {\letitemparameter{#1}\c!kopvoor\empty
+ \letitemparameter{#1}\c!kopna \empty
+ \letitemparameter{#1}\c!voor \empty
+ \letitemparameter{#1}\c!na \empty
+ \letitemparameter{#1}\c!tussen \empty}
+
+\def\dosetupitemgroupconstant[#1][#2]%
+ {\def\dodosetupitemgroupconstant##1%
+ {\dododosetupitemgroupconstant[#1][##1*]}%
+ \processcommacommand[#2]\dodosetupitemgroupconstant} % expansion of #2 is handy for xml
+
+\def\dododododosetupitemgroup[#1][#2]%
+ {\doifassignmentelse{#2}
+ {\dosetupitemgroupvariable[#1][#2]}
+ {\setitemparameter{#1}\empty{\dosetupitemgroupconstant[#1][#2]}}}%
+
+\def\dodododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifnot{#2}{}
- {\doifelse{#1}{\v!elk}
- {\dorecurse{\maxitemlevel}{\ExpandFirstAfter\dodododostelopsommingin[\recurselevel][#2]}}
- {\ExpandFirstAfter\dodododostelopsommingin[#1][#2]}}}
+ {\doifelse{#1}\v!elk
+ {\dorecurse\maxitemlevel{\ExpandFirstAfter\dododododosetupitemgroup[\recurselevel][#2]}}
+ {\ExpandFirstAfter\dododododosetupitemgroup[#1][#2]}}}
-\def\dodostelopsommingin[#1][#2]%
+\def\dododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifelse{#2}{}
- {\ifnum\itemlevel=0\relax
- \dododostelopsommingin[\v!elk][#1]%
+ {\ifcase\itemlevel\relax
+ \dodododosetupitemgroup[\v!elk][#1]%
\else
- \dododostelopsommingin[\itemlevel][#1]%
+ \dodododosetupitemgroup[\itemlevel][#1]%
\fi}
{\doifelsenothing{#1}
- {\dododostelopsommingin[\itemlevel][#2]}
- {\dododostelopsommingin[#1][#2]}}}
-
-\def\dostelopsommingin[#1][#2][#3]%
- {\dodostelopsommingin[#1][#2]%
- \ConvertToConstant\doifnot{#3}{} % anders wordt #2 overruled
- {\dodostelopsommingin[#1][#3]}}
-
-\def\stelopsommingin%
- {\dotripleempty\dostelopsommingin}
-
-%\def\doadvanceitem%
-% {\ifsubsom\else\ifsymsom\else
-% \pluscounter{\s!itemcount\itemlevel}%
-% \fi\fi}
-
-\def\doadvanceitem%
- {\ifsubsom\else\ifsymsom\else
- \scratchcounter=0\getvalue{\??op\itemlevel\c!start}\relax
- \ifcase\scratchcounter
- \pluscounter{\s!itemcount\itemlevel}%
- \else
- \setcounter{\s!itemcount1}{\scratchcounter}%
- \setvalue{\??op\itemlevel\c!start}{0}%
- \fi
+ {\dodododosetupitemgroup[\itemlevel][#2]}
+ {\dodododosetupitemgroup[#1][#2]}}}
+
+\def\dodosetupitemgroup[#1][#2][#3][#4]%
+ {\pushmacro\currentitemgroup
+ \def\currentitemgroup{#1}%
+ \dododosetupitemgroup[#2][#3]%
+ \ConvertToConstant\doifnot{#4}{} % anders wordt #2 overruled
+ {\dododosetupitemgroup[#2][#4]}%
+ \popmacro\currentitemgroup}
+
+\def\dosetupitemgroup[#1][#2][#3][#4]%
+ {\def\docommando##1{\dodosetupitemgroup[##1][#2][#3][#4]}%
+ \processcommalist[#1]\docommando}
+
+\def\setupitemgroup
+ {\doquadrupleempty\dosetupitemgroup}
+
+\def\doadvanceitem
+ {\ifsubitem\else\ifsymbolitem\else
+ \pluscounter{\@@itemcounter\itemlevel}%
\fi\fi}
+% \def\setitemlevel#1%
+% {\ifnum\itemlevel>0\relax
+% \firstlisttrue
+% \doifnotinset\v!verder{#1}
+% {\resetcounter{\@@itemcounter\itemlevel}}%
+% \def\tempnumber%
+% {\countervalue{\@@itemcounter\itemlevel}}%
+% \doifelse{\getitemparameter\itemlevel\c!plaatsafsluiter}\v!ja
+% {\def\tempsymbol{\getitemparameter\itemlevel\c!afsluiter}}
+% {\let\tempsymbol\empty}%
+% \fi}
+
\def\setitemlevel#1%
{\ifnum\itemlevel>0\relax
\firstlisttrue
- \doifnotinset{\v!verder}{#1}
- {\resetcounter{\s!itemcount\itemlevel}}%
+ \doifnotinset\v!verder{#1}
+ {\doifinset{0}{#1}{\setitemparameter\itemlevel\c!start{0}}%
+ \doifsomething{\getitemparameter\itemlevel\c!start}
+ {\setcounter{\@@itemcounter\itemlevel}{\getitemparameter\itemlevel\c!start}%
+ \minuscounter{\@@itemcounter\itemlevel}%
+ \letitemparameter\itemlevel\c!start\empty}}%
\def\tempnumber%
- {\countervalue{\s!itemcount\itemlevel}}%
- \doifelsevalue{\??op\itemlevel\c!plaatsafsluiter}{\v!ja}
- {\def\tempsymbool{\getvalue{\??op\itemlevel\c!afsluiter}}}
- {\def\tempsymbool{}}%
- \fi}
+ {\countervalue{\@@itemcounter\itemlevel}}%
+ \doifelse{\getitemparameter\itemlevel\c!plaatsafsluiter}\v!ja
+ {\def\tempsymbol{\getitemparameter\itemlevel\c!afsluiter}}
+ {\let\tempsymbol\empty}%
+ \fi}
% PAS OP: ook 'opelkaar' en zo worden getest, nog eens afvangen!
+\def\unknownitemsymbol{?}
+
\def\setitemmark#1% % en pas op: resets \docommando
- {\doifsymboldefinedelse{#1}
- {\setxvalue{\??op\c!symbool\s!global\itemlevel}{#1}%
- \setgvalue{\??op\c!symbool\s!local\itemlevel}{?}%
- \def\listitem{\symbol[#1]}%
+ {\doifelsenothing{#1}
+ {\edef\currentitemsymbol{\itemlevel}}
+ {\edef\currentitemsymbol{#1}}%
+ \doifsymboldefinedelse\currentitemsymbol
+ {\setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol \itemlevel}{\unknownitemsymbol}%
+ \def\listitem{\symbol[\currentitemsymbol]}%
\let\docommando\gobbleoneargument}
- {\doifconversiondefinedelse{#1}
- {\setxvalue{\??op\c!symbool\s!global\itemlevel}{#1}%
- \setgvalue{\??op\c!symbool\s!local\itemlevel}%
- {\convertnumber{#1}{\countervalue{\s!itemcount\itemlevel}}}%
+ {\doifconversiondefinedelse\currentitemsymbol
+ {\setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol \itemlevel}%
+ {\convertnumber{\currentitemsymbol}{\countervalue{\@@itemcounter\itemlevel}}}%
+ \iftextitems
+ \doifsomething{\getitemparameter\itemlevel\c!linkertekst}
+ {\let\tempsymbol\empty}%
+ \fi
\def\listitem%
- {\getvalue{\??op\itemlevel\c!links}% new
- \getvalue{\??op\c!symbool\s!local\itemlevel}\tempsymbool
- \getvalue{\??op\itemlevel\c!rechts}}% new
+ {\getitemparameter\itemlevel
+ {\iftextitems\c!linkertekst\else\c!links\fi}%
+ \getvalue{\@@localitemsymbol\itemlevel}\tempsymbol
+ \getitemparameter\itemlevel
+ {\iftextitems\c!rechtertekst\else\c!rechts\fi}}%
\let\docommando\gobbleoneargument}
{\let\listitem\empty}}}
-%\def\calculatelistwidth#1#2%
-% {#2=\getvalue{\??op#1\c!afstand}\relax
-% \multiply#2 by \getvalue{\??op#1\c!factor}\relax
-% \advance#2 by \getvalue{\??op#1\c!breedte}\relax}
-
\def\calculatelistwidth#1#2%
- {#2=\getvalue{\??op#1\c!afstand}\relax
- \ifnum\getvalue{\??op#1\c!factor}>0
- \ifdim#2=\!!zeropoint #2=.5em\fi
+ {#2=\getitemparameter{#1}\c!afstand\relax
+ \ifnum\getitemparameter{#1}\c!factor>0
+ \ifdim#2=\zeropoint #2=.5em\fi
\fi
- \multiply#2 by \getvalue{\??op#1\c!factor}\relax
- \advance#2 by \getvalue{\??op#1\c!breedte}\relax}
+ \multiply#2 \getitemparameter{#1}\c!factor
+ \advance #2 \getitemparameter{#1}\c!breedte\relax}
-% The next conditionals deal with \item \startitemize. It
-% looks like a hack to skip back, but that way we preserve
-% the indentation and bullet placement. It's a rather
-% untested feature.
+% The next conditionals deal with \item \startitemgroup. It
+% looks like a hack to skip back, but that way we preserve
+% the indentation and bullet placement. It's a rather
+% untested feature.
\newconditional\concatnextitem \setfalse\concatnextitem
\newconditional\autoconcatnextitem \settrue \autoconcatnextitem
-\newsignal \itemsignal
-
-% \def\dodostartopsomming[#1][#2]%
-% {\setfalse\inlinelistitem % new, no indent (leftskip)
-% \setfalse\concatnextitem % new, concat
-% \ifhmode
-% \ifconditional\autoconcatnextitem % new, concat
-% \ifdim\lastskip=\itemsignal % new, concat
-% \settrue\concatnextitem % new, concat
-% \fi % new, concat
-% \fi % new, concat
-% \par
-% \fi
-% \ifnum\itemlevel=\maxitemlevel\relax
-% \showmessage{\m!layouts}{9}{\maxitemlevel}%
-% \def\itemincrement{0}%
-% \else
-% \def\itemincrement{1}%
-% \fi
-% \doglobal\increment(\itemlevel,\itemincrement)%
-% \begingroup
-% \ifnum\itemlevel=1 % NIEUW
-% \doadaptleftskip{\getvalue{\??op1\c!marge}}%
-% \dosetraggedcommand{\@@oouitlijnen}\raggedcommand
-% \fi
-% \dosetraggedcommand{\getvalue{\??op\itemlevel\c!uitlijnen}}\raggedcommand
-% \doifvaluesomething{\??op\itemlevel\c!inspringen}
-% {\expanded{\stelinspringenin[\getvalue{\??op\itemlevel\c!inspringen}]}}%
-% \doifinset{\v!kolommen}{#1}%
-% {\ifbinnenkolommen\else\ifnum\itemcolumndepth=0
-% \global\let\itemcolumndepth\itemlevel
-% \getvalue{\??op\itemlevel\c!voor}%
-% \processfirstactioninset
-% [#1]
-% [ \v!een=>\!!counta=1\relax,
-% \v!twee=>\!!counta=2\relax,
-% \v!drie=>\!!counta=3\relax,
-% \v!vier=>\!!counta=4\relax,
-% \v!vijf=>\!!counta=5\relax,
-% \s!unknown=>\@EA\!!counta\getvalue{\??op\itemlevel\c!n}]%
-% \startkolommen
-% [\c!n=\!!counta, % netter \??op\itemlevel\c!n
-% \c!hoogte=,
-% \c!lijn=\v!uit,
-% \c!balanceren=\v!ja,
-% \c!uitlijnen=\v!nee]%
-% \fi\fi}%
-% \doifinsetelse{\v!intro}{#1}
-% {\somintrotrue}
-% {\somintrofalse}%
-% \doglobal\increment\noflists
-% \let\currentlist=\noflists
-% \newcounter\noflistelements
-% \kopsomfalse
-% \subsomfalse
-% \symsomfalse
-% \let\marsymbol=\relax
-% \global\let\somdestination=\empty
-% \def\symsymbol{}%
-% \def\som%
-% {\dosom}%
-% \def\but[##1]%
-% {\gdef\somdestination{##1}%
-% \dosom}%
-% \def\nop%
-% {\sym{\strut}\strut}%
-% \definecomplexorsimple\its
-% \setvalue{\v!mar}##1%
-% {\def\marsymbol%
-% {\llap
-% {\doattributes{\??op\itemlevel}\c!marletter\c!markleur{##1}%
-% \hskip\leftskip\hskip\linkermargeafstand}}%
-% \dosom}%
-% \setvalue{\v!kop}%
-% {\kopsomtrue\dokop}%
-% \setvalue{\v!sub}%
-% {\subsomtrue\dosom}%
-% \setvalue{\v!sym}##1%
-% {\def\symsymbol%
-% {\doattributes{\??op\itemlevel}\c!symletter\c!symkleur{##1}}%
-% \symsomtrue
-% \dosom}%
-% % \setvalue{\v!its}%
-% % {\getvalue{\v!sym}%
-% % {\calculatelistwidth{\itemlevel}{\dimen0}%
-% % \hbox to \dimen0
-% % {\dorecurse{\getvalue{\??op\itemlevel\c!items}}
-% % {\listitem\hss}%
-% % \unskip
-% % \hskip\getvalue{\??op\itemlevel\c!afstand}}}}%
-% \setvalue{\v!its}%
-% {\getvalue{\v!ran}%
-% {\dorecurse{\getvalue{\??op\itemlevel\c!items}}{\listitem\hss}%
-% \unskip}}%
-% \setvalue{\v!ran}##1%
-% {\getvalue{\v!sym}%
-% {\calculatelistwidth{\itemlevel}{\dimen0}%
-% \hbox to \dimen0
-% {##1\hskip\getvalue{\??op\itemlevel\c!afstand}}}}%
-% \setitemlevel{#1}%
-% \getvalue{\??op\itemlevel}%
-% \doifelsenothing{#1} % iffirstargument
-% {\edef\@@opsymbool{\getvalue{\??op\itemlevel\c!symbool}}%
-% \setgvalue{\??op\c!symbool\s!global\itemlevel}{}%
-% \setgvalue{\??op\v!verder\itemlevel}{}%
-% \setitemmark{\@@opsymbool}%
-% \dostelopsomminginvariable[\itemlevel][#2]}
-% {\dostelopsomminginconstant[\itemlevel][#1]%
-% \dostelopsomminginvariable[\itemlevel][#2]%
-% \doifinsetelse{\v!verder}{#1}% \noexpand, else problems in non-etex with chinese
-% %{\edef\@@opsymbool{\getvalue{\??op\c!symbool\s!global\itemlevel}}%
-% {\edef\@@opsymbool{\noexpand\getvalue{\??op\c!symbool\s!global\itemlevel}}%
-% \getvalue{\??op\v!verder\itemlevel}}
-% %{\edef\@@opsymbool{\getvalue{\??op\itemlevel\c!symbool}}%
-% {\edef\@@opsymbool{\noexpand\getvalue{\??op\itemlevel\c!symbool}}%
-% \setgvalue{\??op\v!verder\itemlevel}%
-% {\dostelopsomminginconstant[\itemlevel][#1]%
-% \dostelopsomminginvariable[\itemlevel][#2]}}%
-% \def\docommando{\setitemmark}% \setitemmark resets \docommando
-% \processcommalist[#1,\@@opsymbool]\docommando}%
-% \ifsomautointro\ifnum\prevgraf<3
-% \somintrotrue
-% \fi\fi
-% \ifparagraphitems
-% \ifnum\itemlevel>1 \doassign[\??op\itemlevel][\c!tussen=]\fi
-% \else\ifpackeditems
-% \doassign[\??op\itemlevel][\c!tussen=]%
-% \fi\fi
-% \calculatelistwidth{\itemlevel}{\dimen0}%
-% \ifdim\dimen0>\!!zeropoint\relax
-% \ifconditional\inlinelistitem\else
-% \advance\leftskip by \dimen0\relax
-% \fi
-% \fi}
-
-\def\dodostartopsomming[#1][#2]%
+\newsignal \itemsignal
+
+\def\startitemgroup
+ {\dotripleempty\dostartitemgroup}
+
+\def\dostartitemgroup[#1][#2][#3]%
+ {\bgroup
+ \def\currentitemgroup{#1}%
+ \ifthirdargument
+ \dodostartitemgroup[#2][#3]%
+ \else
+ \doifassignmentelse{#2}
+ {\dodostartitemgroup[][#2]}
+ {\dodostartitemgroup[#2][]}%
+ \fi}
+
+\def\dodostartitemgroup[#1][#2]%
{\setfalse\inlinelistitem % new, no indent (leftskip)
\setfalse\concatnextitem % new, concat
- \ifhmode
- \ifconditional\autoconcatnextitem % new, concat
- \ifdim\lastskip=\itemsignal % new, concat
- \settrue\concatnextitem % new, concat
- \fi % new, concat
- \fi % new, concat
- \par
+ \ifhmode
+ \ifconditional\autoconcatnextitem % new, concat
+ \ifdim\lastskip=\itemsignal % new, concat
+ \settrue\concatnextitem % new, concat
+ \fi % new, concat
+ \fi % new, concat
+ \iftextitems\else\doifnotinset\v!tekst{#1}\par\fi % suboptimal
\fi
\ifnum\itemlevel=\maxitemlevel\relax
- \showmessage{\m!layouts}{9}{\maxitemlevel}%
+ \showmessage\m!layouts9\maxitemlevel
\def\itemincrement{0}%
\else
\def\itemincrement{1}%
\fi
\doglobal\increment(\itemlevel,\itemincrement)%
+ \initializeitemgrouplevel\itemlevel % safeguard
\begingroup
\ifnum\itemlevel=1 % NIEUW
- \doadaptleftskip{\getvalue{\??op1\c!marge}}%
-% \dosetraggedcommand{\@@oouitlijnen}\raggedcommand
+ \doadaptleftskip{\getitemparameter1\c!marge}%
\fi
- \dosetraggedcommand{\getvalue{\??op\itemlevel\c!uitlijnen}}\raggedcommand
- \doifvaluesomething{\??op\itemlevel\c!inspringen}
- {\expanded{\stelinspringenin[\getvalue{\??op\itemlevel\c!inspringen}]}}%
- \doifinset{\v!kolommen}{#1}%
+ \dosetraggedcommand{\getitemparameter\itemlevel\c!uitlijnen}\raggedcommand
+ \doifsomething{\getitemparameter\itemlevel\c!inspringen}
+ {\expanded{\stelinspringenin[\getitemparameter\itemlevel\c!inspringen]}}%
+ \doifinset\v!kolommen{#1}%
{\ifbinnenkolommen\else\ifnum\itemcolumndepth=0
\global\let\itemcolumndepth\itemlevel
- \getvalue{\??op\itemlevel\c!voor}%
+ \getitemparameter\itemlevel\c!voor
\processfirstactioninset
[#1]
[ \v!een=>\!!counta=1\relax,
@@ -438,234 +372,250 @@
\v!drie=>\!!counta=3\relax,
\v!vier=>\!!counta=4\relax,
\v!vijf=>\!!counta=5\relax,
- \s!unknown=>\@EA\!!counta\getvalue{\??op\itemlevel\c!n}]%
-% new
-\edef\columneditemleftskip{\the\leftskip}%
-\def\postprocesscolumnbox##1%
- {\scratchdimen=\columneditemleftskip
- \divide\scratchdimen by \nofcolumns
- \hbox{\hskip\columneditemleftskip\hbox{\box##1}}}%
-\scratchdimen=-\columneditemleftskip
-\multiply\scratchdimen by \nofcolumns
-\advance\scratchdimen by \columneditemleftskip
-\advance\scratchdimen by \hsize
-\edef\columntextwidth{\the\scratchdimen}%
-\leftskip\!!zeropoint
-% so far
+ \s!unknown=>\@EA\!!counta\getitemparameter\itemlevel\c!n]%
+ % new
+ \edef\columneditemleftskip{\the\leftskip}%
+ \def\postprocesscolumnbox##1%
+ {\scratchdimen=\columneditemleftskip
+ \divide\scratchdimen \nofcolumns
+ \hbox{\hskip\columneditemleftskip\hbox{\box##1}}}%
+ \scratchdimen=-\columneditemleftskip
+ \multiply\scratchdimen \nofcolumns
+ \advance\scratchdimen \columneditemleftskip
+ \advance\scratchdimen \hsize
+ \edef\columntextwidth{\the\scratchdimen}%
+ \leftskip\zeropoint
+ % so far
\startkolommen
- [\c!n=\!!counta, % netter \??op\itemlevel\c!n
+ [\c!n=\!!counta, % netter \??op\itemlevel\c!n
\c!hoogte=,
\c!lijn=\v!uit,
\c!balanceren=\v!ja,
\c!uitlijnen=\v!nee]%
\fi\fi}%
- \doifinsetelse{\v!intro}{#1}
- {\somintrotrue}
- {\somintrofalse}%
+ \doifinsetelse\v!intro{#1}\itemintrotrue\itemintrofalse
\doglobal\increment\noflists
- \let\currentlist=\noflists
+ \let\currentlist\noflists
\newcounter\noflistelements
- \kopsomfalse
- \subsomfalse
- \symsomfalse
- \let\marsymbol=\relax
- \global\let\somdestination=\empty
- \def\symsymbol{}%
- \def\som%
- {\dosom}%
- \def\but[##1]%
- {\gdef\somdestination{##1}%
- \dosom}%
- \def\nop%
- {\sym{\strut}\strut}%
- \definecomplexorsimple\its
- \setvalue{\v!mar}##1%
- {\def\marsymbol%
- {\llap
- {\doattributes{\??op\itemlevel}\c!marletter\c!markleur{##1}%
- \hskip\leftskip\hskip\linkermargeafstand}}%
- \dosom}%
- \setvalue{\v!kop}%
- {\kopsomtrue\dokop}%
- \setvalue{\v!sub}%
- {\subsomtrue\dosom}%
- \setvalue{\v!sym}##1%
- {\def\symsymbol%
- {\doattributes{\??op\itemlevel}\c!symletter\c!symkleur{##1}}%
- \symsomtrue
- \dosom}%
-% \setvalue{\v!its}%
-% {\getvalue{\v!sym}%
-% {\calculatelistwidth{\itemlevel}{\dimen0}%
-% \hbox to \dimen0
-% {\dorecurse{\getvalue{\??op\itemlevel\c!items}}
-% {\listitem\hss}%
-% \unskip
-% \hskip\getvalue{\??op\itemlevel\c!afstand}}}}%
- \setvalue{\v!its}%
- {\getvalue{\v!ran}%
- {\dorecurse{\getvalue{\??op\itemlevel\c!items}}{\listitem\hss}%
- \unskip}}%
- \setvalue{\v!ran}##1%
- {\getvalue{\v!sym}%
- {\calculatelistwidth{\itemlevel}{\dimen0}%
- \hbox to \dimen0
- {##1\hskip\getvalue{\??op\itemlevel\c!afstand}}}}%
+ \headitemfalse
+ \subitemfalse
+ \symbolitemfalse
+ \let\marsymbol\relax
+ \global\let\somdestination\empty
+ \let\symsymbol\empty
+ \the\itemgroupcommands
\setitemlevel{#1}%
- \getvalue{\??op\itemlevel}%
+ \getitemparameter\itemlevel\empty
\doifelsenothing{#1} % iffirstargument
- {\edef\@@opsymbool{\getvalue{\??op\itemlevel\c!symbool}}%
- \setgvalue{\??op\c!symbool\s!global\itemlevel}{}%
- \setgvalue{\??op\v!verder\itemlevel}{}%
- \setitemmark{\@@opsymbool}%
- \dostelopsomminginvariable[\itemlevel][#2]}
- {\dostelopsomminginconstant[\itemlevel][#1]%
- \dostelopsomminginvariable[\itemlevel][#2]%
- \doifinsetelse{\v!verder}{#1}% \noexpand, else problems in non-etex with chinese
- %{\edef\@@opsymbool{\getvalue{\??op\c!symbool\s!global\itemlevel}}%
- {\edef\@@opsymbool{\noexpand\getvalue{\??op\c!symbool\s!global\itemlevel}}%
- \getvalue{\??op\v!verder\itemlevel}}
- %{\edef\@@opsymbool{\getvalue{\??op\itemlevel\c!symbool}}%
- {\edef\@@opsymbool{\noexpand\getvalue{\??op\itemlevel\c!symbool}}%
- \setgvalue{\??op\v!verder\itemlevel}%
- {\dostelopsomminginconstant[\itemlevel][#1]%
- \dostelopsomminginvariable[\itemlevel][#2]}}%
- \def\docommando{\setitemmark}% \setitemmark resets \docommando
+ {\edef\@@opsymbool{\getitemparameter\itemlevel\c!symbool}%
+ \global\letvalue{\@@globalitemsymbol\itemlevel}\empty
+ \global\letitemparameter\itemlevel\v!verder\empty
+ \setitemmark\@@opsymbool
+ \dosetupitemgroupvariable[\itemlevel][#2]}
+ {\dosetupitemgroupconstant[\itemlevel][#1]%
+ \dosetupitemgroupvariable[\itemlevel][#2]%
+ \doifinsetelse\v!verder{#1}% \noexpand, else problems in non-etex with chinese
+ {\edef\@@opsymbool{\noexpand\getvalue{\@@globalitemsymbol\itemlevel}}%
+ \getitemparameter\itemlevel\v!verder}
+ {\edef\@@opsymbool{\noexpand\getitemparameter{\itemlevel}{\c!symbool}}%
+ \global\setitemparameter\itemlevel\v!verder
+ {\dosetupitemgroupconstant[\itemlevel][#1]%
+ \dosetupitemgroupvariable[\itemlevel][#2]}}%
+ \def\docommando##1% \setitemmark resets \docommando
+ {\doifnot{##1}{0}{\setitemmark{##1}}}%
\processcommalist[#1,\@@opsymbool]\docommando}%
- \ifsomautointro\ifnum\prevgraf<3
- \somintrotrue
+ \ifautoitemintro\ifnum\prevgraf<3
+ \itemintrotrue
\fi\fi
- \ifparagraphitems
- \ifnum\itemlevel>1 \doassign[\??op\itemlevel][\c!tussen=]\fi
- \else\ifpackeditems
- \doassign[\??op\itemlevel][\c!tussen=]%
+ \ifparagraphitems
+ \ifnum\itemlevel>1
+ \letitemparameter\itemlevel\c!tussen\empty
+ \fi
+ \else\ifpackeditems
+ \letitemparameter\itemlevel\c!tussen\empty
\fi\fi
- \calculatelistwidth{\itemlevel}{\dimen0}%
- \ifdim\dimen0>\!!zeropoint\relax
-\ifconditional\inlinelistitem\else
- \advance\leftskip by \dimen0\relax
-\fi
+ \calculatelistwidth\itemlevel{\dimen0}%
+ \ifdim\dimen0>\zeropoint\relax
+ \ifconditional\inlinelistitem\else
+ \advance\leftskip \dimen0\relax
+ \fi
\fi}
-\def\dostartopsomming[#1][#2]%
- {\ifsecondargument
- \dodostartopsomming[#1][#2]%
+\def\stopitemgroup
+ {\iftextitems
+ \removeunwantedspaces\space\ignorespaces
\else
- \doifassignmentelse{#1}
- {\dodostartopsomming[][#1]}
- {\dodostartopsomming[#1][]}%
- \fi}
-
-\def\startopsomming%
- {\bgroup
- \dodoubleempty\dostartopsomming}
-
-\def\stopopsomming%
- {\par
+ \par
+ \fi
\ifnum\itemcolumndepth=0 \dolistreference \fi % beware !
\iffirstlist \else \endgroup \fi % toegevoegd, eerste \som opent groep
\ifnum\itemcolumndepth=\itemlevel\relax
\stopkolommen
\doglobal\newcounter\itemcolumndepth
- \getvalue{\??op\itemlevel\c!na}%
+ \getitemparameter\itemlevel\c!na
\else
\ifnum\itemlevel=1
- \dosomebreak\allowbreak % toegevoegd
- \getvalue{\??op1\c!na}%
- \doif{\@@oospringvolgendein}{\v!nee}{\noindentation}%
+ \doitembreak\allowbreak % toegevoegd
+ \getitemparameter1\c!na
+ \doif\@@oospringvolgendein\v!nee\noindentation
\fi
\fi
\endgroup
\doglobal\decrement(\itemlevel,\itemincrement)%
\egroup}
+
+\newtoks\itemgroupcommands
+
+\def\itemgroupitem
+ {\doitemgroupitem}
+
+\def\itemgroupbutton[#1]%
+ {\gdef\somdestination{#1}%
+ \itemgroupitem}
+
+\def\itemgroupdummy
+ {\itemgroupsymbol{\strut}\strut}
+
+\def\itemgroupsubitem
+ {\subitemtrue\itemgroupitem}
+
+\def\itemgroupsymbol#1%
+ {\def\symsymbol{\doitemattributes\itemlevel\c!symletter\c!symkleur{#1}}%
+ \symbolitemtrue
+ \itemgroupitem}
+
+\def\itemgroupedge#1%
+ {\itemgroupsymbol
+ {\calculatelistwidth\itemlevel{\dimen0}%
+ \hbox to \dimen0
+ {#1\hskip\getitemparameter\itemlevel\c!afstand}}}
+
+\def\itemgrouphead
+ {\headitemtrue\doitemgrouphead}
+
+\def\itemgroupitems
+ {\dosingleempty\doitemgroupitems}
+
+\def\doitemgroupitems[#1]%
+ {\itemgroupedge
+ {\dorecurse{0\getitemparameter\itemlevel\c!items}{\listitem\hss}%
+ \unskip}}
+
+\def\itemgroupmargin#1%
+ {\def\marsymbol%
+ {\llap
+ {\doitemattributes\itemlevel\c!marletter\c!markleur{#1}%
+ \hskip\leftskip\hskip\linkermargeafstand}}%
+ \itemgroupitem}
+
+\appendtoks \let\item \itemgroupitem \to \itemgroupcommands
+\appendtoks \let\itm \itemgroupitem \to \itemgroupcommands
+\appendtoks \let\but \itemgroupbutton \to \itemgroupcommands
+\appendtoks \let\nop \itemgroupdummy \to \itemgroupcommands
+\appendtoks \letvalue\v!sub \itemgroupsubitem \to \itemgroupcommands
+\appendtoks \letvalue\v!sym \itemgroupsymbol \to \itemgroupcommands
+\appendtoks \letvalue\v!ran \itemgroupedge \to \itemgroupcommands
+\appendtoks \letvalue\v!kop \itemgrouphead \to \itemgroupcommands
+\appendtoks \letvalue\v!its \itemgroupitems \to \itemgroupcommands
+\appendtoks \letvalue\v!mar \itemgroupmargin \to \itemgroupcommands
+
+\def\itembreak % -10
+ {\flushfootnotes\penalty-5\relax}
-\def\sombreak%
- {\flushfootnotes\penalty-5\relax} % -10
-
-\def\somnobreak%
- {\flushfootnotes\penalty+5\ifbinnenkolommen\else00\fi\relax} % +5
+\def\itemnobreak % +5
+ {\flushfootnotes\penalty+5\ifbinnenkolommen\else00\fi\relax}
-\def\dolistitem% evt aantal items opslaan per niveau, scheelt zoeken
- {\par
+\def\dolistitem % evt aantal items opslaan per niveau, scheelt zoeken
+ {\iftextitems
+ % begin of item
+ \else
+ \par
+ \fi
\ignorespaces
\increment\noflistelements
- \ifnum\itemcolumndepth=0\relax\ifoptimizeitems
- \ifnum\noflistelements=1 % tgv bv kolommen/nesting
- \findtwopassdata{\s!list}{\noflists:}% % wordt soms de volgorde
- \fi % verstoord, vandaar \find
+ \ifnum\itemcolumndepth=0 \ifoptimizeitems
+ \ifnum\noflistelements=1 % tgv bv kolommen/nesting
+ \findtwopassdata\s!list{\noflists:}% % wordt soms de volgorde
+ \fi % verstoord, vandaar \find
\iftwopassdatafound
\ifnum\twopassdata=3
\ifnum\noflistelements>1
- \dosomebreak\somnobreak
+ \doitembreak\itemnobreak
\fi
\else\ifnum\twopassdata>3
\ifnum\noflistelements=2
- \ifsomintro
- \dosomebreak\nobreak
+ \ifitemintro
+ \doitembreak\nobreak
\else
- \dosomebreak\somnobreak
+ \doitembreak\itemnobreak
\fi
\else\ifnum\twopassdata=\noflistelements\relax
- \dosomebreak\somnobreak
+ \doitembreak\itemnobreak
\else\ifnum\noflistelements>2
- \dosomebreak\sombreak
+ \doitembreak\itembreak
\else
- \ifsomintro\else\dosomebreak\sombreak\fi
+ \ifitemintro\else\doitembreak\itembreak\fi
\fi\fi\fi
\fi\fi
\fi
\fi\fi
\noindent
- \ifkopsom
- \setbox8=\hbox
- {\doattributes{\??op\itemlevel}\c!kopletter\c!kopkleur{\listitem}}%
- \else\ifsymsom
- \setbox8=\hbox{\symsymbol}%
- \else
- \setbox8=\hbox
- {\doattributes{\??op\itemlevel}\c!letter\c!kleur{\listitem}}%
- \fi\fi
- \doifsomething{\somdestination}
- %{\setbox8=\hbox{\naar{\copy8}[\somdestination]}}%
- {\setbox8=\hbox{\naar{\box8}[\somdestination]}}%
- \global\let\somdestination=\empty
- \dimen2=\getvalue{\??op\itemlevel\c!breedte}\relax
-% new, prevents loops when symbol is (not yet found) graphic
-\ht8=\strutheight
-\dp8=\strutdepth
-% so that content differs per run (esp mp graphics afterwards)
- \ifdim\dimen2<\!!zeropoint\relax
- \llap{\ifsubsom\llap{+}\fi\box8\hskip\linkermargeafstand}%
+ \setbox8=\hbox
+ {\ifheaditem
+ \doitemattributes\itemlevel\c!kopletter\c!kopkleur{\listitem}%
+ \else\ifsymbolitem
+ \symsymbol
+ \else
+ \doitemattributes\itemlevel\c!letter\c!kleur{\listitem}%
+ \fi\fi}%
+ \doifsomething\somdestination
+ {\setbox8=\hbox{\naar{\box8}[\somdestination]}}%
+ \global\let\somdestination\empty
+ \dimen2=\getitemparameter\itemlevel\c!breedte\relax
+ % new, prevents loops when symbol is (not yet found) graphic
+ \ht8=\strutheight
+ \dp8=\strutdepth
+ % so that content differs per run (esp mp graphics afterwards)
+ \ifdim\dimen2<\zeropoint\relax
+ \llap{\ifsubitem\llap{+}\fi\box8\hskip\linkermargeafstand}%
\else
- \ifdim\dimen2=\!!zeropoint\relax
+ \ifdim\dimen2=\zeropoint\relax
\calculatelistwidth{1}{\dimen0}%
\else
\calculatelistwidth{\itemlevel}{\dimen0}%
\fi
-\ifconditional\inlinelistitem
- \hbox to \dimen0{\ifsubsom\llap{+}\fi\box8\hfill}%
-\else
- \llap{\hbox to \dimen0{\ifsubsom\llap{+}\fi\box8\hfill}}%
-\fi
+ \iftextitems
+ \hbox{\ifsubitem+\fi\box8\hskip\fontdimen2\font}\nobreak
+ \else
+ \ifconditional\inlinelistitem
+ \hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}%
+ \else
+ \llap{\hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}}%
+ \fi
+ \fi
\fi
- \setevalue{\??op\c!symbool\itemlevel}%
- {\getvalue{\??op\c!symbool\s!local\itemlevel}}% still problems with \uchar ?
- %{\noexpand\getvalue{\??op\c!symbool\s!local\itemlevel}}% no, spoils subrefs
- \kopsomfalse
- \subsomfalse
- \symsomfalse
+ \setevalue{\@@currentitemsymbol\itemlevel}%
+ {\getvalue{\@@localitemsymbol\itemlevel}}% still problems with \uchar ?
+ %{\noexpand\getvalue{\@@localitemsymbol\itemlevel}}% no, spoils subrefs
+ \headitemfalse
+ \subitemfalse
+ \symbolitemfalse
\EveryPar{\ignorespaces}%
\ignorespaces}
-\def\complexdosom[#1]%
- {\par
+\def\complexdoitemgroupitem[#1]%
+ {\iftextitems
+ % begin of item
+ \else
+ \par
+ \fi
\ignorespaces
- \ifconditional\concatnextitem % new, concat
- \dosomebreak\nobreak % new, concat
- \fi % new, concat
+ \ifconditional\concatnextitem % new, concat
+ \doitembreak\nobreak % new, concat
+ \fi % new, concat
\doadvanceitem
\ifnum\itemcolumndepth=0\relax\ifnum\noflistelements>0\relax
- \dosomebreak\nobreak
+ \doitembreak\nobreak
\fi\fi
\iffirstlist
\firstlistfalse
@@ -673,96 +623,87 @@
\ifcase\itemlevel
\or % 1
\ifnum\itemcolumndepth=0\relax
- \ifsomintro\dosomebreak\nobreak\fi
- \getvalue{\??op1\c!voor}%
- \ifsomintro\dosomebreak\nobreak\fi
+ \ifitemintro\doitembreak\nobreak\fi
+ \getitemparameter1\c!voor
+ \ifitemintro\doitembreak\nobreak\fi
\fi
\else % 2 en hoger
\ifparagraphitems \else
\let\previtemlevel=\itemlevel
\decrement\previtemlevel
- \getvalue{\??op\previtemlevel\c!tussen}% = itemlevel-1
+ \getitemparameter\previtemlevel\c!tussen % = itemlevel-1
\fi
\fi
\else
- \itemuse\c!tussen
+ \getitemparameter\itemlevel\c!tussen
\fi
- \ifconditional\concatnextitem % new, concat
- \vskip-\lastskip % new, concat
- \vskip-\lineheight % new, concat
- \nobreak % new, concat
- \fi % new, concat
+ \ifconditional\concatnextitem % new, concat
+ \vskip-\lastskip % new, concat
+ \vskip-\lineheight % new, concat
+ \nobreak % new, concat
+ \fi % new, concat
\ignorespaces
\dolistitem
\ifpackeditems
\stelwitruimtein[\v!geen]%
\fi
- \itemuse\c!binnen
+ \getitemparameter\itemlevel\c!binnen
\marsymbol
- \let\marsymbol=\relax
+ \let\marsymbol\relax
\doifsomething{#1}
- {\doifnot{\itemreference}{?}
+ {\doifnot\itemreference\unknownitemreference
{\bgroup
\protectconversion
- \rawreference{\s!lst}{#1}{\itemreference}%
+ \rawreference\s!lst{#1}\itemreference
\egroup}}%
- \strut % added 11-08-99
- \setfalse\concatnextitem % new, concat
- \hskip\itemsignal % new, concat
+ \strut % added 11-08-99
+ \setfalse\concatnextitem % new, concat
+ \hskip\itemsignal % new, concat
\ignorespaces}
-\def\complexsom[#1]#2\par% todo: no two pass data
- {\startopsomming[#1]
- \complexdosom[]\ignorespaces\begstrut#2\unskip\endstrut\par
- \stopopsomming}
-
-\definecomplexorsimpleempty\som
-\definecomplexorsimpleempty\dosom
-
-% \def\complexdokop[#1]#2\par%
-% {\ifpackeditems\else\itemuse\c!kopvoor\fi
-% \dosomebreak{\pagina[\v!voorkeur]}% geen \goodbreak ! \allowbreak testen
-% \complexdosom[#1]{\doattributes{\??op\itemlevel}\c!kopletter\c!kopkleur
-% {\ignorespaces#2}}\par
-% \ifpackeditems\else\itemuse\c!kopna\fi
-% \dosomebreak\nobreak
-% \noindentation}
-
-\def\complexdokop[#1]#2\par% % beter in \complexdosom hangen met een if
- {\iffirstlist\else\dosomebreak\allowbreak\fi
- \ifpackeditems\else\itemuse\c!kopvoor\fi
- \iffirstlist\ifsomintro\else\ifcase\itemlevel % incr in \complexdosom
- %\dosomebreak{\pagina[\v!voorkeur]}% geen \goodbreak ! \allowbreak testen
- \dosomebreak\allowbreak
+\def\complexitem[#1]#2\par% todo: no two pass data
+ {\startitemgroup[#1]
+ \complexdoitemgroupitem[]\ignorespaces\begstrut#2\unskip\endstrut\par
+ \stopitemgroup}
+
+\definecomplexorsimpleempty\item
+\definecomplexorsimpleempty\doitemgroupitem
+
+\def\complexdoitemgrouphead[#1]#2\par% % beter in \complexdosom hangen met een if
+ {\iffirstlist\else\doitembreak\allowbreak\fi
+ \ifpackeditems\else\getitemparameter\itemlevel\c!kopvoor\fi
+ \iffirstlist\ifitemintro\else\ifcase\itemlevel % incr in \complexdosom
+ \doitembreak\allowbreak
\fi\fi\fi
- \complexdosom[#1]{\doattributes{\??op\itemlevel}\c!kopletter\c!kopkleur
- {\ignorespaces#2}}\par
- \dosomebreak\nobreak
- \ifpackeditems\else\itemuse\c!kopna\fi
- \dosomebreak\nobreak
+ \complexdoitemgroupitem[#1]{\doitemattributes\itemlevel\c!kopletter\c!kopkleur
+ {\ignorespaces#2}}%
+ \iftextitems
+ \removeunwantedspaces\space\ignorespaces
+ \else
+ \par
+ \fi
+ \doitembreak\nobreak
+ \ifpackeditems\else\getitemparameter\itemlevel\c!kopna\fi
+ \doitembreak\nobreak
\noindentation}
-\def\complexkop[#1]#2\par#3\par%
- {\startopsomming[#1]%
- \complexdokop[]\ignorespaces#2\par#3\par
- \stopopsomming}
+\def\complexhead[#1]#2\par#3\par
+ {\startitemgroup[#1]%
+ \complexdoitemgrouphead[]\ignorespaces#2\par#3\par
+ \stopitemgroup}
-\definecomplexorsimpleempty\kop
-\definecomplexorsimpleempty\dokop
+\definecomplexorsimpleempty\head
+\definecomplexorsimpleempty\doitemgrouphead
\def\sym#1%
{\noindent
- \setbox0=\hbox{#1}%
- \ifdim\wd0<1em\relax
- \setbox0=\hbox to 1.5em{#1\hfil}%
- \else
- \setbox0=\hbox spread 1em{#1\hfil}%
- \fi
- \hangindent=\wd0\relax
+ \setbox0\hbox{#1}%
+ \setbox0\hbox\ifdim\wd0<1em to 1.5\else spread 1\fi em{#1\hfil}%
+ \hangindent\wd0\relax
\box0
\ignorespaces}
-\stelopsommingenin % undocumented
+\setupitemgroups % undocumented
[\c!niveaus=6,
\c!marge=\!!zeropoint,
\c!springvolgendein=\v!ja,
@@ -770,7 +711,7 @@
\c!factor=0,
\c!afstand=.5em,
\c!uitlijnen=\v!normaal,
- \c!inspringen=, % untouched if empty
+ \c!inspringen=, % untouched if empty
\c!kleur=,
\c!letter=, % kan tzt weg
\c!marletter=\c!type, % \c! ???
@@ -789,6 +730,34 @@
\c!binnen=,
\c!n=2,
\c!items=4,
- \c!symbool=\itemlevel]
+ \c!linkertekst=(,
+ \c!rechtertekst=),
+ \c!start=1,
+ \c!symbool=\itemlevel] % \v!niveau
+
+\def\defineitemgroup
+ {\dodoubleempty\dodefineitemgroup}
+
+\def\dodefineitemgroup[#1][#2]%
+ {\doifsomething{#1}
+ {\pushmacro\currentitemgroup
+ \def\currentitemgroup{#1}%
+ \setvalue{\e!start#1}{\startitemgroup[#1]}%
+ \setvalue{\e!stop#1}{\stopitemgroup}%
+ \setvalue{\e!stel#1\e!in}{\setupitemgroup[#1]}%
+\getparameters[\??ig#1][\c!niveaus=3,#2]%
+\ifnum\getvalue{\??ig#1\c!niveaus}<\maxitemlevel\relax
+ \letvalue{\??ig#1\c!niveaus}\maxitemlevel
+\fi
+ \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[]}
+
+\defineitemgroup [\e!itemize] [\c!niveaus=6]
-\protect \endinput
+\protect \endinput
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
index c942e4f44..0e0b13532 100644
--- a/tex/context/base/core-job.tex
+++ b/tex/context/base/core-job.tex
@@ -218,8 +218,8 @@
\def\doexecutefileonce#1%
{\beforesplitstring#1\at.\to\currentfile
- \ExpandBothAfter\doifnotinset{\currentfile}{\loadedfiles}%
- {\ExpandFirstAfter\addtocommalist{\currentfile}\loadedfiles
+ \fullexpandtwoargsafter\doifnotinset{\currentfile}{\loadedfiles}%
+ {\fullexpandoneargafter\addtocommalist{\currentfile}\loadedfiles
\doexecutefile{#1}}}
\def\doexecutefile#1%
@@ -235,18 +235,18 @@
\def\omgeving #1 % at outermost level only
{\def\startomgeving ##1 {}%
- \let\stopomgeving=\relax
+ \let\stopomgeving\relax
\startreadingfile
\processfile{#1}% \readlocfile{#1}{}{}%
\stopreadingfile}
-\let\environment\omgeving % for the moment
+\def\environment{\omgeving} % for the moment, no \let !
\newcounter\filelevel
\def\!!donextlevel#1#2#3#4#5#6\\%
{\beforesplitstring#6\at.\to#1
- \ifnum\filelevel=0
+ \ifcase\filelevel\relax
\starttekst
\def\projekt ##1 {#2{##1}}%
\def\omgeving ##1 {#3{##1}}%
@@ -254,7 +254,7 @@
\def\onderdeel ##1 {#5{##1}}%
\fi
\increment\filelevel\relax
- \ExpandFirstAfter\addtocommalist{#1}\loadedfiles}
+ \fullexpandoneargafter\addtocommalist{#1}\loadedfiles}
\def\doprevlevel%
{\ifnum\filelevel=1
@@ -305,15 +305,15 @@
{\def\partialenvironments{}%
\def\docommando##1%
{\beforesplitstring##1\at.\to\someevironment
- \ExpandFirstAfter\addtocommalist{\someevironment}\partialenvironments}%
+ \fullexpandoneargafter\addtocommalist{\someevironment}\partialenvironments}%
\processcommalist[#1]\docommando
- \ExpandBothAfter\doifcommonelse
+ \fullexpandtwoargsafter\doifcommonelse % no longer next needed
{\currentproject,\currentproduct,
\currentcomponent,\currentenvironment}
{\partialenvironments}
- {\let\stopdeelomgeving=\relax
- \let\next=\relax}
- {\let\next=\skipdeelomgeving}%
+ {\let\stopdeelomgeving\relax
+ \let\next\relax}
+ {\let\next\skipdeelomgeving}%
\next}
\def\startproduct{\startprodukt}
diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex
index dd399e460..03cd5bfbe 100644
--- a/tex/context/base/core-lst.tex
+++ b/tex/context/base/core-lst.tex
@@ -17,6 +17,8 @@
% \getlistlevel[hoofdstuk]\test{0} \test
+% can be made faster if needed
+
\def\getlistlevel[#1]#2#3% [list] \variable \default
{\doifdefinedelse{\??ko#1\c!sectie}
{\edef#2{\getvalue{\??ko#1\c!sectie}}%
@@ -160,7 +162,9 @@
\@@livariantb
-\def\dostellijstin[#1][#2]%
+\def\setlistparameter#1#2{\@EA\def\csname\??li#1#2\endcsname}
+
+\def\dostellijstin[#1][#2]% slow -)
{\def\docommando##1%
{\getparameters[\??li##1][#2]%
\preparepaginaprefix{\??li##1}}%
@@ -217,8 +221,11 @@
\v!deel\v!nummer=\v!ja, % nodig ? % v
\c!label=\v!nee,
\c!afstand=\!!zeropoint,
- \c!scheider=]%
- \ConvertToConstant\doifinstringelse{=}{#2}
+ \c!scheider=\@@koscheider,
+ \c!afsluiter=,
+ \c!expansie=]%
+% \ConvertToConstant\doifinstringelse{=}{#2}
+ \doifassignmentelse{#2}
{\getparameters[\??li#1][#2]}
{\ConvertToConstant\doifnot{#2}{}
{\copyparameters % interactie ?
@@ -261,14 +268,14 @@
\doendoflist
\dosetlistmode}
-\def\dosetlistmode%
+\def\dosetlistmode
{\iflijstgeplaatst
- \expandafter \enablemode
+ \setsystemmode \v!lijst
\else
- \expandafter \disablemode
- \fi [\systemmodeprefix\v!lijst]}
+ \resetsystemmode\v!lijst
+ \fi}
-\def\plaatslijst%
+\def\plaatslijst
{\dodoubleempty\doplaatslijst}
\def\dodovolledigelijst[#1][#2][#3]% enkelvoud, meervoud, instellingen
@@ -291,6 +298,12 @@
{#1=#3\relax}
{#1=#2\relax}}
+% \let\dohandlelistnumber\firstofoneargument
+%
+% can be anything, so no \expanded{\separatednumber{#1}} !
+
+\def\dohandlelistnumber#1{\separatednumber{#1}}
+
\def\dosetlistsymbol#1#2% kan sneller, default case afvangen
{\processaction
[\getvalue{\??li#1\c!symbool}]
@@ -300,19 +313,24 @@
1=>\def\listsymbol%
{\strut$\bullet$},
2=>\def\listsymbol%
- {\vrule\!!width1em\!!height1ex\!!depth\!!zeropoint},
+ {\vrule\!!width1em\!!height1ex\!!depth\zeropoint},
3=>\def\listsymbol% very slow
{{\doassigndimen{\dimen0}{\getvalue{\??li#1\c!breedte}}{1.5em}%
\doassigndimen{\dimen2}{\getvalue{\??li#1\c!hoogte}}{1ex}%
\doassigndimen{\dimen4}{\getvalue{\??li#1\c!diepte}}{0pt}%
\vrule\!!width\dimen0\!!height\dimen2\!!depth\dimen4}},
\s!unknown=>\def\listsymbol{\getvalue{\??li#1\c!symbool}},
- \s!default=>\doifelsevalue{\??li#1\c!prefix}{\v!nee}
- {\aftersplitstring#2\at.\to\splitlistsymbol}
- {\def\splitlistsymbol{#2}}% geen \edef ivm enz
+ \s!default=>\doifelsevalue{\??li#1\c!prefix}{\v!nee} % ook nog eerste
+ {\edef\splitlistsymbol{\removefirstprefix{#2}}}
+ {\doifelsevalue{\??li#1\c!prefix}{\v!geen}
+ {\edef\splitlistsymbol{\removeallprefixes{#2}}}%
+ {\def\splitlistsymbol{#2}}}% geen \edef ivm enz
\def\listsymbol% kan iets efficienter met \ifdone
{\doifvalue{\??li#1\c!label}{\v!ja}{\leftlabeltext{#1}}%
- \strut\splitlistsymbol\getvalue{\??li#1\c!scheider}%
+ \strut
+ \def\numberseparator{\getvalue{\??li#1\c!scheider}}%
+ \@EA\dohandlelistnumber\@EA{\splitlistsymbol}%
+ \getvalue{\??li#1\c!afsluiter}%
\doifvalue{\??li#1\c!label}{\v!ja}{\rightlabeltext{#1}}}]}
\def\@@dodolijstelement{dodolijstelement}
@@ -356,11 +374,11 @@
\def\dodolijstelement#1#2#3#4#5#6%
{\getvalue{\@@dodolijstelement\getvalue{\??li#1\c!variant}}%
%\showcomposition
- \let\@@iabreedte=\!!zeropoint % moet boolean worden
+ \let\@@iabreedte\!!zeropoint % moet boolean worden
\bgroup
\edef\lijstelementen%
{\getvalue{\??li#1\c!paginaovergangen}}%
- \ExpandSecondAfter\doifinset{#3}{\lijstelementen}%
+ \ExpandBothAfter\doifinset{#3}{\lijstelementen}%
{\showmessage{\m!systems}{14}{#3}%
\pagina}%
\egroup
@@ -372,7 +390,9 @@
\def\dolistattributes#1#2#3%
{\doifvaluesomething{\??li#1#3}
- {\setupinteraction[\c!kleur=,\c!contrastkleur=]}%
+ %{\setupinteraction[\c!kleur=,\c!contrastkleur=]}%
+ {\resetinteractionparameter\c!kleur
+ \resetinteractionparameter\c!contrastkleur}%
\doattributes{\??li#1}{#2}{#3}}
\def\dodocommandlijstelement#1#2#3#4#5#6%
@@ -430,17 +450,17 @@
\def\dodofixdlijstelementABC#1#2#3#4#5#6% weeden
{\endgraf
- \leftskip=\getvalue{\??li#1\c!marge}% na de \endgraf !
+ \leftskip\getvalue{\??li#1\c!marge}% na de \endgraf !
\getvalue{\??li#1\c!voor}%
- \!!widthc=\getvalue{\??li#1\c!afstand}%
+ \!!widthc\getvalue{\??li#1\c!afstand}%
\doifelsevalue{\??li#1\c!breedte}{\v!passend}
- {\!!widtha=\!!zeropoint}
+ {\!!widtha\zeropoint}
{\doifelsenothing{#3}
{\doifelsevalue{\??li#1\c!titeluitlijnen}{\v!ja}
- {\!!widtha=\!!zeropoint
- \!!widthc=\!!zeropoint}
- {\!!widtha=\getvalue{\??li#1\c!breedte}}}
- {\!!widtha=\getvalue{\??li#1\c!breedte}}}%
+ {\!!widtha\zeropoint
+ \!!widthc\zeropoint}
+ {\!!widtha\getvalue{\??li#1\c!breedte}}}
+ {\!!widtha\getvalue{\??li#1\c!breedte}}}%
\getvalue{\??li\c!variant\getvalue{\??li#1\c!variant}}%
\endgraf
\def\makelijstelement##1##2%
@@ -449,12 +469,12 @@
\linklisttoelement{#1}{#2}{#5}{#6}{\box0}}%{\copy0}}%
{\hbox{##2}}}%
\doifvalue{\??li#1\c!interactie}{\v!tekst} % not supported
- {\doassign[\??li#1][\c!interactie=\v!alles]}%
+ {\setlistparameter{#1}\c!interactie\v!alles}%
\makelijstelement\v!alles
{\hbox to \hsize
{\dostartattributes{\??li#1}\c!letter\c!kleur{}% new
- \!!widthb=\hsize
- \setbox2=\hbox \ifdim\!!widtha>\!!zeropoint to \!!widtha \fi
+ \!!widthb\hsize
+ \setbox2=\hbox \ifdim\!!widtha>\zeropoint to \!!widtha \fi
{\makelijstelement\v!sectienummer
{\dolistattributes{#1}\c!nummerletter\c!nummerkleur
{\getvalue{\??li#1\c!nummercommando}{\listsymbol}}%
@@ -462,7 +482,7 @@
\setbox4=\hbox
{\doifvalue{\??li#1\c!paginanummer}{\v!ja}
{\doifsomething{#5} % \lijstwidth is new ; temp hack
- {\hbox \ifdim\lijstwidth>\!!zeropoint to \lijstwidth\fi
+ {\hbox \ifdim\lijstwidth>\zeropoint to \lijstwidth\fi
{\hfill
\makelijstelement\v!paginanummer
{\dolistattributes{#1}\c!paginaletter\c!paginakleur
@@ -479,15 +499,15 @@
\ifvoid4
% we kunnen gewoon afbreken aan het eind
\else
- \ifdim\lijstskip>\!!zeropoint\relax
+ \ifdim\lijstskip>\zeropoint\relax
\rightskip=\lijstskip\!!plus10em\relax
\parfillskip=-\rightskip
\fi
\fi
\else
- \dimen2=\!!zeropoint
+ \dimen2=\zeropoint
\fi
- \parindent=\!!zeropoint\relax
+ \parindent\zeropoint\relax
\leavevmode
\box2\relax
\hskip\dimen2
@@ -496,6 +516,7 @@
{\let\\=\newlineinlist
\dontconvertfont
\getvalue{\??li#1\c!tekstcommando}{#4}}%
+%\carryoverpar % new otherwise wrong linespacing
\egroup
\ifvoid4
\ifdim\!!widtha<\hsize
@@ -526,9 +547,9 @@
\noindent\leavevmode % leavevmode ? ? ?
\fi
\doifvalue{\??li#1\c!interactie}{\v!tekst} % not supported
- {\doassign[\??li#1][\c!interactie=\v!sectienummer]}%
+ {\setlistparameter{#1}\c!interactie\v!sectienummer}%
\doifvalue{\??li#1\c!interactie}{\v!alles} % not supported
- {\doassign[\??li#1][\c!interactie=\v!sectienummer]}%
+ {\setlistparameter{#1}\c!interactie\v!sectienummer}%
\def\makelijstelement##1##2%
{\doifelsevalue{\??li#1\c!interactie}{##1}
{\setbox0=\hbox{\showcontrastlocation{\??ia}{#6}{##2}}%
@@ -626,9 +647,7 @@
\@EA\doschrijfnaarlijst\@EA{#1}{\firstlistelement}{#3}{\v!kop}}}
\def\dotussenlijst#1#2#3#4% pas op: wordt ook elders gedefinieerd
- {\doiftoclevelelse[#3]
- {#2}
- {}}
+ {\doiftoclevelelse[#3]{#2}{}}
\def\schrijftussenlijst[#1]#2%
{\@EA\doschrijftussenlijst\@EA{#1}{#2}} % #2 weg en \expanded
@@ -643,20 +662,22 @@
\def\utilitylistwidth {0pt}
\def\utilitylistheight {0pt}
+\def\dolijstelementX#1#2#3#4#5#6%
+ {\doiftoclevelelse[#5]
+ {\doglobal\increment\utilitylistlength
+ \hbox
+ {\doattributes
+ {\??li#1}\c!tekstletter\c!tekstkleur
+ {\let\\=\newlineinlist
+ \dontconvertfont
+ \getvalue{\??li#1\c!tekstcommando}{#4}}}%
+ \global\utilitydonetrue}
+ {}}
+
\def\dobepaallijstkenmerken[#1][#2]%
{\begingroup
\doglobal\newcounter\utilitylistlength
- \def\dolijstelement##1##2##3##4##5##6%
- {\doiftoclevelelse[##5]
- {\doglobal\increment\utilitylistlength
- \hbox
- {\doattributes
- {\??li##1}\c!tekstletter\c!tekstkleur
- {\let\\=\newlineinlist
- \dontconvertfont
- \getvalue{\??li##1\c!tekstcommando}{##4}}}%
- \global\utilitydonetrue}
- {}}%
+ \let\dolijstelement\dolijstelementX
\dostellijstin[#1][#2]%
\dogetcommalistelement1\from#1\to\commalistelement
\dosettoclevel{\getvalue{\??li\commalistelement\c!criterium}}%
@@ -817,7 +838,7 @@
\def\dostelsamengesteldelijstin[#1][#2]%
{\getparameters[\??ih#1][#2]%
- \ExpandFirstAfter\stellijstin[\getvalue{\??ih#1\c!lijst}][#2]}
+ \expanded{\stellijstin[\getvalue{\??ih#1\c!lijst}]}[#2]}
\def\stelsamengesteldelijstin%
{\dodoubleargument\dostelsamengesteldelijstin}
@@ -854,18 +875,18 @@
\getparameters[\??ih#1][#2]%
\dosettoclevel{\getvalue{\??ih#1\c!criterium}}%
\edef\samengesteldelijst{\getvalue{\??ih#1\c!lijst}}%
- \stripspaces\from\samengesteldelijst\to\samengesteldelijst
+ %\stripspaces\from\samengesteldelijst\to\samengesteldelijst
\doifelsevalue{\??ih#1\c!niveau}{\v!huidige} % criterium=vorige,niveau=huidige
{\!!counta=0\@@koniveau} % hm: \@@koniveau
- {\ExpandFirstAfter\doifnumberelse{\getvalue{\??ih#1\c!niveau}}% in verband
+ {\fullexpandoneargafter\doifnumberelse{\getvalue{\??ih#1\c!niveau}}% in verband
{\!!counta=\getvalue{\??ih#1\c!niveau}% met de vorige implementatie
\advance\!!counta by 1 % accepteren we ook nummers (0==deel)
\getfromcommacommand[\samengesteldelijst][\!!counta]%
\edef\maximumlijst{\commalistelement}}%
{\edef\maximumlijst{\getvalue{\??ih#1\c!niveau}}}%
\!!counta=\getvalue{\??se\getvalue{\??ko\maximumlijst\c!sectie}\c!niveau}}%
- \let\!!stringa=\samengesteldelijst
- \let\samengesteldelijst=\empty
+ \let\!!stringa\samengesteldelijst
+ \let\samengesteldelijst\empty
\def\docommando##1%
{\ifnum\getvalue{\??se\getvalue{\??ko##1\c!sectie}\c!niveau}>\!!counta
\else
@@ -890,14 +911,14 @@
\doplaatssamengesteldelijst[#1][#2]}
\def\dodefinieersamengesteldelijst[#1][#2][#3]%
- {\setvalue{\??ih#1\c!lijst}{#2}%
+ {\makerawcommalist[#2]\samengesteldelijst % for fast processing
+ \letvalue{\??ih#1\c!lijst}\samengesteldelijst
\getcommalistsize[#2]%
\getfromcommalist[#2][\commalistsize]%
\doeassign[\??ih#1][\c!niveau=\commalistelement]%
\getparameters
[\??ih#1]
- [\c!criterium=\v!lokaal,
- #3]%
+ [\c!criterium=\v!lokaal,#3]%
\setvalue{\e!stel#1\e!in}%
{\dodoubleempty\dostelsamengesteldelijstin[#1]}%
\setvalue{\e!plaats#1}%
diff --git a/tex/context/base/core-mak.tex b/tex/context/base/core-mak.tex
index 63f69a90e..56d4cdb23 100644
--- a/tex/context/base/core-mak.tex
+++ b/tex/context/base/core-mak.tex
@@ -40,7 +40,7 @@
\def\doplaats%
{\dodoubleempty\dodoplaats}
-\def\dodoplaats[#1][#2]%
+\def\dodoplaats[#1][#2]% correctie moet mooier
{\bgroup
\dowithnextbox
{\setlocalhsize
diff --git a/tex/context/base/core-mar.tex b/tex/context/base/core-mar.tex
index e7f497f89..ab1207c42 100644
--- a/tex/context/base/core-mar.tex
+++ b/tex/context/base/core-mar.tex
@@ -15,6 +15,9 @@
\unprotect
+\prependtoks \getallmarks \to \everybeforepagebody % TEX
+\prependtoks \setallmarks \to \everyafterpagebody % ETEX
+
% voor 'interne' doeleinden zijn beschikbaar:
%
% \fetchmark[naam][plaats]
@@ -23,15 +26,46 @@
% ook nog reset koppelen aan sectie
+%\def\hoofdmarkering#1%
+% {\csname\??mk#1\c!koppeling\endcsname}
+%
+%\def\fastresetmarker#1%
+% {\doifdefined{\??mk\hoofdmarkering{#1}}
+% {\expandafter\resetmark\csname\??mk\hoofdmarkering{#1}\endcsname}}
+
+\beginTEX
+
+\def\hoofdmarkering#1%
+ {\@EA\ifx\csname\??mk#1\c!koppeling\endcsname\else
+ \csname\??mk#1\c!koppeling\endcsname
+ \fi}
+
+\def\fastresetmarker#1%
+ {\@EA\ifx\csname\??mk#1\c!koppeling\endcsname\else
+ \@EA\resetmark\csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
\def\hoofdmarkering#1%
- {\getvalue{\??mk#1\c!koppeling}}
+ {\ifcsname\??mk#1\c!koppeling\endcsname
+ \csname\??mk#1\c!koppeling\endcsname
+ \fi}
-\def\dodoresetmarkering#1%
- {\doifdefined{\??mk\hoofdmarkering{#1}}
- {\expandafter\resetmark\csname\??mk\hoofdmarkering{#1}\endcsname}}
+\def\fastresetmarker#1%
+ {\ifcsname\??mk#1\c!koppeling\endcsname
+ \@EA\resetmark\csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname
+ \fi}
+
+\endETEX
+
+\def\fastresetmarkerlist[#1]%
+ {\expanded{\rawprocesscommalist[#1]}\fastresetmarker}
\def\doresetmarkering[#1]%
- {\processcommalist[#1]\dodoresetmarkering}
+ {\processcommalist[#1]\fastresetmarker}
\def\resetmarkering%
{\dosingleargument\doresetmarkering}
@@ -50,9 +84,9 @@
\def\dododefinieermarkering[#1][#2]%
{\stelmarkeringin[#1]
- [% \c!expansie=\v!nee, % saves a macro
- \c!scheider={ --- }, % watch the spaces
- \c!status=\v!start]%
+ [\c!expansie=\v!nee, % saves a macro
+ \c!scheider={ --- }, % watch the spaces
+ \c!status=\v!start]%
\ontkoppelmarkering[#1]% % no coupling with sections
\setevalue{\??mk#1\c!koppeling}{#2}%
\expandafter\newmark\csname\??mk#2\endcsname
@@ -69,15 +103,38 @@
\let\geenmarkering=\relax
%\def\fetchmark[#1][#2]% geen \def, anders problemen in \doif...
-% {\def\dofetchmark{\getvalue{\??mk#2}}%
+% {\def\dofetchmark{\csname\??mk#2\endcsname}%
% \expandafter\dofetchmark\csname\??mk\hoofdmarkering{#1}\endcsname}
-\def\dofetchmark#1#2% needed because we need to expand
- {\getvalue{\??mk#2}#1}
+%\def\dofetchmark#1#2% needed because we need to expand
+% {\csname\??mk#2\endcsname#1}
+%
+%\def\fetchmark[#1][#2]% never \unexpanded
+% {\expandafter\dofetchmark\csname\??mk\hoofdmarkering{#1}\endcsname{#2}}
+
+\def\fetchmark[#1][#2]% never \unexpanded
+ {\@EA\@EA\csname\??mk#2\endcsname
+ \csname\??mk\hoofdmarkering{#1}\endcsname}
+
+\beginTEX
+
+\def\fetchmark[#1][#2]% never \unexpanded
+ {\@EA\ifx\csname\??mk#1\c!koppeling\endcsname\else
+ \@EA\@EA\csname\??mk#2\endcsname
+ \csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
\def\fetchmark[#1][#2]% never \unexpanded
- %{\getvalue{\getvalue{\??mk#2}\??mk\hoofdmarkering{#1}}}
- {\expandafter\dofetchmark\csname\??mk\hoofdmarkering{#1}\endcsname{#2}}
+ {\ifcsname\??mk#1\c!koppeling\endcsname
+ \@EA\@EA\csname\??mk#2\endcsname
+ \csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname
+ \fi}
+
+\endETEX
\def\fetchtwomarks[#1]%
{\doifsomething{\fetchmark[#1][\v!eerste]}
@@ -98,7 +155,7 @@
{\bgroup
\def\geenmarkering##1{\unknown\ }%
\setfullsectionnumber{\??mk#1}%
- \processaction
+ \processaction % slow
[#2]
[ \v!beide=>{\fetchtwomarks[#1]},
\v!alles=>{\fetchallmarks[#1]},
@@ -112,17 +169,60 @@
\unexpanded\def\haalmarkering%
{\dodoubleargument\dohaalmarkering}
+\let\setsomemark\setmark
+
+\beginTEX
+
+\def\domarking[#1]#2%
+ {\@EA\ifx\csname\??mk#1\c!koppeling\endcsname\else
+ \bgroup
+ \doifelsevalue{\??mk#1\c!expansie}\v!ja
+ \expandmarkstrue\expandmarksfalse
+ \@EA\setsomemark\csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname{#2}%
+ \egroup
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
\def\domarking[#1]#2%
- {\bgroup
- \doifelsevalue{\??mk#1\c!expansie}{\v!ja}
- {\expandmarkstrue}
- {\expandmarksfalse}%
-% \honorunexpanded
-% \getvalue{\??mk\hoofdmarkering{#1}}{#2}%
- \expandafter\setmark\csname\??mk\hoofdmarkering{#1}\endcsname{#2}%
- \egroup}
+ {\ifcsname\??mk#1\c!koppeling\endcsname
+ \bgroup
+ \doifelsevalue{\??mk#1\c!expansie}\v!ja
+ \expandmarkstrue\expandmarksfalse
+ \@EA\setsomemark\csname\??mk\csname\??mk#1\c!koppeling\endcsname\endcsname{#2}%
+ \egroup
+ \fi}
+
+\endETEX
\def\marking%
{\dosingleargument\domarking}
+%D Used in placing text lines.
+
+\def\doifelsemarking#1%
+ {\ifundefined{\??mk#1\c!koppeling}%
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+%D And then \unknown\ we had a chaptertitle packaged in a
+%D makeup environment. And we don't want to loose marks there!
+
+\newbox\collectedmarks
+
+\def\flushmarks % use with care to avoid empty pages
+ {\ifvoid\collectedmarks\else\unhbox\collectedmarks\fi}
+
+\def\postponemarks
+ {\let\setsomemark\postponemark}
+
+\def\postponemark#1#2%
+ {%\writestatus{marks}{postponing \string#1 => #2}%
+ \global\setbox\collectedmarks\hbox
+ {\unhbox\collectedmarks\setmark{#1}{#2}}}
+
\protect \endinput
diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex
index 0a5807c30..ef197eb20 100644
--- a/tex/context/base/core-mat.tex
+++ b/tex/context/base/core-mat.tex
@@ -122,14 +122,14 @@
\fi
\maakhetnummer[\v!formule]%
\setbox0=\hbox{\ignorespaces#2\unskip}%
- \ifdim\wd0>\!!zeropoint
+ \ifdim\wd0>\zeropoint
\edef\hetsubnummer{#2}%
\else
\let\hetsubnummer\empty
\fi
\doifsomething{#1}{\rawreference{\s!for}{#1}{\hetnummer\hetsubnummer}}%
\setbox0=\hbox{\ignorespaces#4\unskip}%
- \ifdim\wd0>\!!zeropoint
+ \ifdim\wd0>\zeropoint
\edef\hetsubnummer{#4}%
\fi
\doifsomething{#3}{\rawreference{\s!for}{#3}{\hetnummer\hetsubnummer}}%
@@ -138,8 +138,9 @@
{\dostartattributes\??fm\c!nummerletter\c!nummerkleur
\strut
\@@fmlinks
+ \preparethenumber\??fm\hetnummer\preparednumber
\labeltexts\v!formule
- {\ignorespaces\hetnummer\ignorespaces\hetsubnummer\unskip}%
+ {\ignorespaces\preparednumber\ignorespaces\hetsubnummer\unskip}%
\@@fmrechts
\dostopattributes}%
\fi
@@ -197,6 +198,7 @@
\c!variant=\s!default,
\c!uitlijnen=,
\c!strut=\v!nee,
+ \c!scheider=\@@koscheider,
\c!afstand=1em]
\def\currentformula {}
@@ -453,7 +455,10 @@
\def\dispplaatsformule[#1]#2$$#3$$%
{\dodoplaatsformule[#1]{#2}\dostartformula{}#3\dostopformula}
-\def\dodoplaatsformule[#1]#2%
+\let\normalreqno\eqno
+\let\normalleqno\leqno
+
+\def\dodoplaatsformule[#1]#2% messy, needs a clean up
{\doifelse{#1}{-}
{\setfalse\handleformulanumber}
{\doifelse{#2}{-}
@@ -461,7 +466,7 @@
{\settrue\handleformulanumber}}%
\ifconditional\handleformulanumber
\def\formulenummer%
- {\global\let\subformulenummer\doformulenummer
+ {%\global\let\subformulenummer\doformulenummer % no, bug
\doformulenummer[#1][#2]}%
\def\subformulenummer%
{\setfalse\incrementformulanumber
@@ -469,14 +474,33 @@
\gdef\doplaceformulanumber%
{\global\let\doplaceformulanumber\empty
\doifelse{\@@fmplaats}{\v!links}
- {\leqno{\doformulenummer[#1][#2][]{}}}
- {\eqno {\doformulenummer[#1][#2][]{}}}}%
+ {\normalleqno{\doformulenummer[#1][#2][]{}}}
+ {\normalreqno{\doformulenummer[#1][#2][]{}}}}%
\else
\def\formulenummer{\doformulenummer[#1][#2]}%
\global\let\subformulenummer\doformulenummer
\global\let\doplaceformulanumber\empty
\fi}
+%D We need a hook into the plain math alignment macros
+%D
+%D \starttypen
+%D \displaylines
+%D \eqalignno
+%D \eqalignno
+%D \stoptypen
+%D
+%D Otherwise we get a missing \type {$$} error reported.
+
+\def\resetdisplaymatheq
+ {\let\normalleqno\relax \let\leqno\relax
+ \let\normalreqno\relax \let\eqno \relax
+ \let\doplaceformulanumber\relax}
+
+\let\normaldispl@y\displ@y
+
+\def\displ@y{\resetdisplaymatheq\normaldispl@y}
+
%D Here we implement a basic math alignment mechanism. Numbers
%D are also handled. The macros \type {\startinnermath} and
%D \type {\stopinnermath} can be overloaded in specialized
@@ -504,6 +528,10 @@
{\hsize\displaywidth
\global\let\@eqno \empty \def\eqno {\gdef\@eqno }%
\global\let\@leqno\empty \def\leqno{\gdef\@leqno}%
+ % added
+ \let\normalreqno\eqno
+ \let\normalleqno\leqno
+ % added
\doplaceformulanumber
\mathhbox to \displaywidth\bgroup
\mathinnerstrut
diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex
index 7f22ee895..3b27f592c 100644
--- a/tex/context/base/core-mis.tex
+++ b/tex/context/base/core-mis.tex
@@ -1,5 +1,5 @@
%D \module
-%D [ file=core-01a,
+%D [ file=core-mis,
%D version=1998.01.29,
%D title=\CONTEXT\ Core Macros,
%D subtitle=Miscelaneous,
@@ -728,20 +728,34 @@
{\bgroup
\dosingleempty\dostartcitaat}
+\def\leftquotation {\getvalue{\??la\currentlanguage\c!leftquotation }}
+\def\rightquotation{\getvalue{\??la\currentlanguage\c!rightquotation}}
+
+\def\leftquote {\getvalue{\??la\currentlanguage\c!leftquote }}
+\def\rightquote {\getvalue{\??la\currentlanguage\c!rightquote}}
+
+\def\leftquotationmark%
+ {\setbox\scratchbox=\hbox{\leftquotation}%
+ \doif{\@@ciplaats}{\v!marge}{\hskip-\wd\scratchbox}%
+ \box\scratchbox}
+
+\def\rightquotationmark%
+ {\hsmash{\rightquotation}}
+
\def\dostartcitaat[#1]%
{\@@civoor
\doifelsenothing{#1}
- {\let\dostopcitaat=\relax}
- {\startsmaller[#1]
- \let\dostopcitaat=\stopsmaller}%
+ {\let\dostopcitaat\relax}
+ {\startsmaller[#1]%
+ \let\dostopcitaat\stopsmaller}%
\dostartattributes\??ci\c!letter\c!kleur{}%
- \setbox0=\hbox{\getvalue{\??la\currentlanguage\c!leftquotation}}%
- \hskip-\wd0
- \box0\relax
+ \leftquotationmark
\ignorespaces}
\def\stopcitaat%
- {\unskip\hsmash{\getvalue{\??la\currentlanguage\c!rightquotation}}%
+ {\removeunwantedspaces
+ \removelastskip
+ \rightquotationmark
\dostopattributes
\dostopcitaat
\@@cina
@@ -754,7 +768,7 @@
#2%
\fi
\ifhmode % else funny pagebeaks
- \penalty\!!tenthousand\hskip\!!zeropoint % == \prewordbreak
+ \penalty\!!tenthousand\hskip\zeropoint % == \prewordbreak
\fi
\strut % new, needed below
\getvalue{\??la\currentlanguage#1}%
@@ -763,18 +777,18 @@
\unexpanded\def\citaat%
{\groupedcommand
{\dohandlequotation\c!leftquotation\relax}
- {\dohandlequotation\c!rightquotation\unskip}}
+ {\dohandlequotation\c!rightquotation\removelastskip}}
\unexpanded\def\citeer%
{\doifelse{\@@ciletter}{\v!normaal}
- {\let\next=\doquotedcite}
- {\let\next=\doattributedcite}%
+ {\let\next\doquotedcite}
+ {\let\next\doattributedcite}%
\next}
\def\doquotedcite%
{\groupedcommand
- {\dohandlequotation\c!leftquote\relax}
- {\dohandlequotation\c!rightquote\unskip}}
+ {\dohandlequotation\c!leftquote \relax}
+ {\dohandlequotation\c!rightquote\removelastskip}}
\def\doattributedcite%
{\groupedcommand
@@ -787,14 +801,15 @@
\unexpanded\def\citaat%
{\dohandlequotation\c!leftquotation\relax
- \groupedcommand{}{\dohandlequotation\c!rightquotation\unskip}}
+ \groupedcommand{}{\dohandlequotation\c!rightquotation\removelastskip}}
\def\doquotedcite%
{\dohandlequotation\c!leftquote\relax
- \groupedcommand{}{\dohandlequotation\c!rightquote\unskip}}
+ \groupedcommand{}{\dohandlequotation\c!rightquote\removelastskip}}
\stelciterenin
- [\c!letter=\v!normaal,
+ [\c!plaats=\v!marge,
+ \c!letter=\v!normaal,
\c!kleur=,
\c!voor=\startsmaller,
\c!na=\stopsmaller]
@@ -816,24 +831,27 @@
\ignorespaces}
\def\stopspeech
- {\dohandlequotation\c!rightspeech\unskip
+ {\dohandlequotation\c!rightspeech\removelastskip
\doglobal\decrement\speechlevel\relax
\ifcase\speechlevel\relax \global\setfalse\insidespeech \fi}
-\def\dohandlespeech%
- {\relax \ifcase\speechlevel
- \or\ifconditional\insidespeech
+\def\dohandlespeech% indirect since called in everypar
+ {\relax % still needed?
+ \ifcase\speechlevel\or\dodohandlespeech\fi}
+
+\def\dodohandlespeech%
+ {\ifconditional\insidespeech
\dohandlequotation\c!middlespeech\relax
\else
\global\settrue\insidespeech
- \fi\fi}
+ \fi}
\unexpanded\def\speech%
{\doglobal\increment\speechlevel\relax
\dohandlequotation\c!leftspeech\relax
\groupedcommand
{\ignorespaces}
- {\dohandlequotation\c!rightspeech\unskip
+ {\dohandlequotation\c!rightspeech\removelastskip
\doglobal\decrement\speechlevel\relax}}
\appendtoks \dohandlespeech \to \everypar
@@ -876,7 +894,6 @@
\definecomplexorsimpleempty\toevoegen
-
\def\dorooster[#1]%
{\begingroup
\getparameters[\??rt]
@@ -1427,6 +1444,8 @@
[\??ld#1]
[\c!n=1,
\c!afstand=\bodyfontsize,
+ \c!voor=,
+ \c!na=,
\c!tussen={\blanko[\v!middel]},
\c!breedte=\hsize,
\c!hoogte=\vsize,
@@ -1452,14 +1471,16 @@
{\setuppairedbox[#1][#2]% % and don't change them
\copyparameters
[\??ld][\??ld#1]
- [\c!n,\c!afstand,\c!tussen,
+ [\c!n,\c!afstand,\c!tussen,\c!voor,\c!na,
\c!breedte,\c!hoogte,\c!maxbreedte,\c!maxhoogte,
\c!korps,\c!uitlijnen,\c!plaats]%
+ \@@ldvoor\bgroup
\beforefirstpairedbox
\dowithnextbox
{\betweenbothpairedboxes
\dowithnextbox
{\afterbothpairedboxes
+ \egroup\@@ldna
\egroup}
\vbox\bgroup
\insidesecondpairedbox
@@ -1593,7 +1614,7 @@
\global\totcombinatie=#2\relax
\xdef\maxhorcombinatie{\the\horcombinatie}%
\multiply\totcombinatie by \horcombinatie
- \tabskip=\!!zeropoint
+ \tabskip\zeropoint
\doifelse{\@@cobreedte}{\v!passend}
{\halign}
{\halign to \@@cobreedte}%
@@ -1874,8 +1895,8 @@
\dimen4=\@@xysx\wd\nextbox
\dimen6=\dimen0\advance\dimen6 by \dimen2
\setbox\nextbox=\vbox to \dimen6
- {\ht\nextbox=\!!zeropoint
- \dp\nextbox=\!!zeropoint
+ {\ht\nextbox=\zeropoint
+ \dp\nextbox=\zeropoint
\vfill % erbij
\dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}%
\ht\nextbox=\dimen0
diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex
index 6e5e1f97d..e1ecb0322 100644
--- a/tex/context/base/core-nav.tex
+++ b/tex/context/base/core-nav.tex
@@ -46,58 +46,64 @@
%D forces page destinations (instead of named ones). We set
%D this switch here.
-\def\setupinteraction%
+\def\setinteractionparameter#1#2% use with case, no checking done
+ {\setvalue{\??ia#1}{#2}} % pass #2, can be \blabla
+
+\def\resetinteractionparameter#1% use with case, no checking done
+ {\letvalue{\??ia#1}\empty}
+
+\def\setupinteraction
{\dosingleargument\dodosetupinteraction}
\def\dodosetupinteraction[#1]% % \dosetupinteraction == special
{\getparameters[\??ia][#1]%
- \doifelse{\@@iastatus}{\v!start}
+ \doifelse\@@iastatus\v!start
{\iflocation\else
- \showmessage{\m!interactions}{2}{\ifusepagedestinations\space(PAGE)\fi}%
+ \showmessage\m!interactions2{\ifusepagedestinations\space(PAGE)\fi}%
\global\locationtrue
\fi}
{\iflocation
- \showmessage{\m!interactions}{3}{\ifusepagedestinations\space(PAGE)\fi}%
+ \showmessage\m!interactions3{\ifusepagedestinations\space(PAGE)\fi}%
\global\locationfalse
\fi}%
\iflocation
- \enablemode [\systemmodeprefix\v!interactie]%
+ \setsystemmode \v!interactie
\else
- \disablemode[\systemmodeprefix\v!interactie]%
+ \resetsystemmode\v!interactie
\fi
- \dosetuppageview{\@@iafocus}%
- \doifsomething{\@@iabereken}
+ \dosetuppageview\@@iafocus
+ \doifsomething\@@iabereken
{\doregistercalculationset\@@iabereken}%
- \doifelse{\@@iastrut}{\v!ja}
- {\locationstruttrue}
- {\locationstrutfalse}%
- \doifelse{\@@iaklik}{\v!ja}
- {\highlighthyperlinkstrue}
- {\highlighthyperlinksfalse}%
- \doifelse{\@@iasplitsen}{\v!ja}
- {\locationsplittrue}
- {\locationsplitfalse}%
- \doifelse{\@@iascherm}{\v!nieuw}
- {\gotonewwindowtrue}
- {\gotonewwindowfalse}%
- \doifelse{\@@iapagina}{\v!ja}
+ \doifelse\@@iastrut\v!ja
+ \locationstruttrue
+ \locationstrutfalse
+ \doifelse\@@iaklik\v!ja
+ \highlighthyperlinkstrue
+ \highlighthyperlinksfalse
+ \doifelse\@@iasplitsen\v!ja
+ \locationsplittrue
+ \locationsplitfalse
+ \doifelse\@@iascherm\v!nieuw
+ \gotonewwindowtrue
+ \gotonewwindowfalse
+ \doifelse\@@iapagina\v!ja
{\global\usepagedestinationstrue}
{\global\usepagedestinationsfalse}}
%D We have to make sure of some settings:
-\def\dolocationstartup%
+\def\dolocationstartup
{\iflocation
\dosetupinteraction
\handlereferenceactions\@@iaopenactie \dosetupopenaction
\handlereferenceactions\@@iasluitactie\dosetupcloseaction
\setupinteractionscreens
- \global\let\dolocationstartup=\relax
+ \global\let\dolocationstartup\relax
\fi}
\appendtoks \dolocationstartup \to \everyshipout
-\def\dolocationpagecheck%
+\def\dolocationpagecheck
{\iflocation
\handlereferenceactions\@@iaopenpaginaactie \doPDFsetupopenpageaction
\handlereferenceactions\@@iasluitpaginaactie\doPDFsetupclosepageaction
@@ -131,8 +137,8 @@
\newif\iflocationsplit
\def\resetgoto%
- {\global\let\@@ia@@hoogte=\!!zeropoint
- \global\let\@@ia@@diepte=\!!zeropoint}
+ {\global\let\@@ia@@hoogte\!!zeropoint
+ \global\let\@@ia@@diepte\!!zeropoint}
\resetgoto
@@ -142,8 +148,8 @@
\xdef\@@ia@@hoogte{\the\ht\strutbox}%
\xdef\@@ia@@diepte{\the\dp\strutbox}%
\else
- \global\let\@@ia@@hoogte=\@@iahoogte
- \global\let\@@ia@@diepte=\@@iadiepte
+ \global\let\@@ia@@hoogte\@@iahoogte
+ \global\let\@@ia@@diepte\@@iadiepte
\fi}
%D In the macros that deal with making areas into hyperlinks,
diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex
index 692b5dc4b..69b796925 100644
--- a/tex/context/base/core-new.tex
+++ b/tex/context/base/core-new.tex
@@ -8,22 +8,20 @@
%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 / New Ones}
\unprotect
-%D To be placed elsewhere.
-
% Some kind of new feature, for the moment a private one.
%
% \enablemode[screen,paper,bound]
%
% \doifmodeelse {paper} {this} {that}
% \doifmode {paper,screen} {this}
-% \doifnotmode {paper,bound} {that}
+% \doifnotmode {paper,bound} {that}
%
% \startmode [list]
% \stopmode
@@ -31,43 +29,145 @@
% \startnotmode [list]
% \stopnotmode
%
-% system modes have a * as prefix
+% system modes have a * as prefix
%
-% to be implemented: mode naar texutil/scherm + message
+% to be implemented: mode naar texutil/scherm + message
% : geen #2 en nesting (\startregels)
-\def\systemmodeprefix{*}
-
-\let\currentmode=\empty
+%D Sometimes, we want to prevent a mode for being set. Think
+%D of situations where a style enables a mode, but an outer
+%D level style does not want that. Preventing can be
+%D considered a permanent disabling on forehand.
+% \def\systemmodeprefix{*}
+%
+% \let\currentmode \empty
+% \let\preventedmodes\empty
+%
+% \def\preventmode[#1]%
+% {\expanded{\addtocommalist{#1}\noexpand\preventedmodes}}
+%
% \def\enablemode[#1]%
-% {\expandafter\addtocommalist\expandafter{#1}\currentmode}
+% {\expanded
+% {\doifnotinset{#1}{\preventedmodes}
+% {\noexpand\addtocommalist{#1}\noexpand\currentmode}}}
%
% \def\disablemode[#1]%
-% {\expandafter\removefromcommalist\expandafter{#1}\currentmode}
+% {\expanded{\removefromcommalist{#1}\noexpand\currentmode}}
+%
+% \def\doifmodeelse{\unprotect\dodoifmodeelse}
+% \def\doifmode {\unprotect\dodoifmode }
+% \def\doifnotmode {\unprotect\dodoifnotmode }
+% \def\startmode {\unprotect\dostartmode }
+% \def\startnotmode{\unprotect\dostartnotmode}
+%
+% \long\def\dodoifmodeelse#1%
+% {\protect\expanded{\doifcommonelse{#1}{\currentmode}}}
+%
+% \long\def\dodoifmode#1%
+% {\protect\expanded{\doifcommon {#1}{\currentmode}}}
%
-% this one fails in removing system modes
+% \long\def\dodoifnotmode#1%
+% {\protect\expanded{\doifnotcommon {#1}{\currentmode}}}
+%
+% \let\stopmode \relax
+% \let\stopnotmode\relax
+%
+% \long\def\dostartmode[#1]%
+% {\protect
+% \expanded{\doifnotcommon{#1}{\currentmode}}{\gobbleuntil\stopmode}}
+%
+% \long\def\dostartnotmode[#1]%
+% {\protect
+% \expanded{\doifcommon {#1}{\currentmode}}{\gobbleuntil\stopnotmode}}
+%
+% \def\doifallmodeselse{\unprotect\dodoifallmodeselse}
+% \def\doifallmodes {\unprotect\dodoifallmodes}
+% \def\doifnotallmodes {\unprotect\dodoifnotallmodes}
+% \def\startallmodes {\unprotect\dostartallmodes}
+% \def\startnotallmodes{\unprotect\dostartnotallmodes}
+%
+% \long\def\dodoifallmodeselse#1%
+% {\protect\expanded{\doifallcommonelse{#1}{\currentmode}}}
+%
+% \long\def\dodoifallmodes#1%
+% {\protect\expanded{\doifallcommon {#1}{\currentmode}}}
+%
+% \long\def\dodoifnotallmodes#1%
+% {\protect\expanded{\doifnotallcommon {#1}{\currentmode}}}
+%
+% \let\stopallmodes \relax
+% \let\stopnotallmodes\relax
+%
+% \long\def\dostartallmodes[#1]%
+% {\protect
+% \expanded{\doifnotallcommon{#1}{\currentmode}}{\gobbleuntil\stopallmodes}}
+%
+% \long\def\dostartnotallmodes[#1]%
+% {\protect
+% \expanded{\doifallcommon {#1}{\currentmode}}{\gobbleuntil\stopnotallmodes}}
-% \def\enablemode[#1]%
-% {\expanded{\addtocommalist{#1}\noexpand\currentmode}}
+% faster
-%D Sometimes, we want to prevent a mode for being set. Think
-%D of situations where a style enables a mode, but an outer
-%D level style does not want that. Preventing can be
-%D considered a permanent disabling on forehand.
+\def\@mode@{@md@}
+
+\def\systemmodeprefix{*}
+
+\def\disabledmode {0}
+\def\enabledmode {1}
+\def\preventedmode {2}
+
+% fast internal ones
+
+\def\setmode #1{\@EA\let\csname\@mode@#1\endcsname\enabledmode }
+\def\resetmode#1{\@EA\let\csname\@mode@#1\endcsname\disabledmode}
+
+\def\setsystemmode #1{\@EA\let\csname\@mode@\systemmodeprefix#1\endcsname\enabledmode }
+\def\resetsystemmode#1{\@EA\let\csname\@mode@\systemmodeprefix#1\endcsname\disabledmode}
+
+% user ones
+
+\def\preventmode{\unprotect\dopreventmode}
+\def\enablemode {\unprotect\doenablemode }
+\def\disablemode{\unprotect\dodisablemode}
-\let\preventedmodes\empty
+\def\dopreventmode[#1]{\protect\rawprocesscommalist[#1]\dodopreventmode}
+\def\doenablemode [#1]{\protect\rawprocesscommalist[#1]\dodoenablemode }
+\def\dodisablemode[#1]{\protect\rawprocesscommalist[#1]\dododisablemode}
-\def\preventmode[#1]%
- {\expanded{\addtocommalist{#1}\noexpand\preventedmodes}}
+\def\dodopreventmode#1%
+ {\@EA\let\csname\@mode@#1\endcsname\preventedmode}
-\def\enablemode[#1]%
- {\expanded
- {\doifnotinset{#1}{\preventedmodes}
- {\noexpand\addtocommalist{#1}\noexpand\currentmode}}}
+\def\dodoenablemode#1%
+ {\ifcase0\csname\@mode@#1\endcsname\relax
+ \@EA\let\csname\@mode@#1\endcsname\enabledmode
+ \fi}
+
+\def\dododisablemode#1%
+ {\ifcase0\csname\@mode@#1\endcsname\or
+ \@EA\let\csname\@mode@#1\endcsname\disabledmode
+ \fi}
+
+% check macros
+
+\newif\ifcheckedmode
+
+\def\dodocheckformode#1%
+ {\ifcase0\csname\@mode@#1\endcsname\or\checkedmodetrue\fi}
-\def\disablemode[#1]%
- {\expanded{\removefromcommalist{#1}\noexpand\currentmode}}
+\def\docheckformode#1#2#3% will be sped up with a quit
+ {\protect\checkedmodefalse\rawprocesscommalist[#3]\dodocheckformode
+ \ifcheckedmode\@EA#1\else\@EA#2\fi}
+
+\def\dodocheckforallmodes#1%
+ {\ifcase0\csname\@mode@#1\endcsname\relax
+ \checkedmodefalse\or\or\checkedmodefalse\fi}
+
+\def\docheckforallmodes#1#2#3% will be sped up with a quit
+ {\protect\checkedmodetrue\rawprocesscommalist[#3]\dodocheckforallmodes
+ \ifcheckedmode\@EA#1\else\@EA#2\fi}
+
+% simple ones
\def\doifmodeelse{\unprotect\dodoifmodeelse}
\def\doifmode {\unprotect\dodoifmode}
@@ -75,25 +175,58 @@
\def\startmode {\unprotect\dostartmode}
\def\startnotmode{\unprotect\dostartnotmode}
-\long\def\dodoifmodeelse#1#2#3%
- {\protect\ExpandBothAfter\doifcommonelse{#1}{\currentmode}{#2}{#3}}
+\def\dodoifmodeelse
+ {\docheckformode\firstoftwoarguments\secondoftwoarguments}
+
+\def\dodoifmode
+ {\docheckformode\firstofoneargument\gobbleoneargument}
+
+\def\dodoifnotmode
+ {\docheckformode\gobbleoneargument\firstofoneargument}
-\long\def\dodoifmode#1#2%
- {\protect\ExpandBothAfter\doifcommonelse{#1}{\currentmode}{#2}{}}
+\long\def\dostartmode[#1]%
+ {\docheckformode\donothing\dostopmode{#1}}
-\long\def\dodoifnotmode#1#2%
- {\protect\ExpandBothAfter\doifcommonelse{#1}{\currentmode}{}{#2}}
+\long\def\dostartnotmode[#1]%
+ {\docheckformode\dostopnotmode\donothing{#1}}
-\long\def\dostartmode[#1]#2\stopmode%
- {\dodoifmode{#1}{#2}}
+\let\stopmode \donothing
+\let\stopnotmode\donothing
-\long\def\dostartnotmode[#1]#2\stopnotmode%
- {\dodoifnotmode{#1}{#2}}
+\long\def\dostopmode #1\stopmode {}
+\long\def\dostopnotmode#1\stopnotmode{}
+
+\def\doifallmodeselse{\unprotect\dodoifallmodeselse}
+\def\doifallmodes {\unprotect\dodoifallmodes}
+\def\doifnotallmodes {\unprotect\dodoifnotallmodes}
+\def\startallmodes {\unprotect\dostartallmodes}
+\def\startnotallmodes{\unprotect\dostartnotallmodes}
+
+\def\doifallmodeselse
+ {\docheckforallmodes\firstoftwoarguments\secondoftwoarguments}
+
+\def\doifallmodes
+ {\docheckforallmodes\firstofoneargument\gobbleoneargument}
+
+\def\doifnotallmodes
+ {\docheckforallmodes\gobbleoneargument\firstofoneargument}
+
+\long\def\dostartallmodes[#1]%
+ {\docheckallformodes\donothing\dostopallmodes{#1}}
+
+\long\def\dostartnotallmodes[#1]%
+ {\docheckforallmodes\dostopallmodes\donothing{#1}}
+
+\let\stopallmodes \donothing
+\let\stopnotallmodes\donothing
+
+\long\def\dostopallmodes #1\stopallmodes {}
+\long\def\dostopnotallmodes#1\stopnotallmodes{}
-% new
+% new
%
% \startnointerference
-% all kind of code
+% all kind of code
% \stopnointerference
\newbox\nointerferencebox
@@ -106,37 +239,14 @@
{\egroup
\setbox\nointerferencebox\box\voidb@x}
-% new
-
-\def\doifallmodeselse{\unprotect\dodoifallmodeselse}
-\def\doifallmodes {\unprotect\dodoifallmodes}
-\def\doifnotallmodes {\unprotect\dodoifnotallmodes}
-\def\startallmodes {\unprotect\dostartallmodes}
-\def\startnotallmodes{\unprotect\dostartnotallmodes}
-
-\long\def\dodoifallmodeselse#1#2#3%
- {\protect\ExpandBothAfter\doifallcommonelse{#1}{\currentmode}{#2}{#3}}
-
-\long\def\dodoifallmodes#1#2%
- {\protect\ExpandBothAfter\doifallcommonelse{#1}{\currentmode}{#2}{}}
-
-\long\def\dodoifnotallmodes#1#2%
- {\protect\ExpandBothAfter\doifallcommonelse{#1}{\currentmode}{}{#2}}
-
-\long\def\dostartallmodes[#1]#2\stopallmodes
- {\dodoifallmodes{#1}{#2}}
-
-\long\def\dostartnotallmodes[#1]#2\stopnotallmodes
- {\dodoifnotallmodes{#1}{#2}}
-
-% will go to ...
+% will go to ...
\def\alignedbox%
{\dodoubleempty\doalignedbox[]}
\def\doalignedbox[#1][#2]%
{\bgroup
- \let\iftraceboxplacement\iftracelayers
+ %\let\iftraceboxplacement\iftracelayers % ugly
\dowithnextbox
{\let\next\middlebox
\processaction
@@ -173,8 +283,8 @@
{\box\nextbox}
{\alignedbox[\@@oxplaats]\hbox{\box\nextbox}}}}%
\wd\nextbox\@@oxbreedte
- \ht\nextbox\@@oxhoogte
- \dp\nextbox\@@oxdiepte
+ \ht\nextbox\@@oxhoogte
+ \dp\nextbox\@@oxdiepte
\box\nextbox
\egroup}#1}
@@ -184,7 +294,7 @@
%\ruledhbox{\offsetbox[x=-1cm,y=-1cm,location=c]
% {\framed[width=4cm,height=4cm]{x}}}
-% actually this is pretty old, but temporary moved here
+% actually this is pretty old, but temporary moved here
\installdiscretionaries || \@@kpteken
@@ -242,45 +352,45 @@
\enableactivediscretionaries
-%D new and beta
+%D new and beta
% \def\defineshortcut%
% {\dodoubleargument\dodefineshortcut}
-%
+%
% \bgroup
-%
-% \catcode`\<=\@@active
-%
+%
+% \catcode`\<=\@@active
+%
% \gdef\dodefineshortcut[#1][#2]%
% {\ifsecondargument
-% \catcode`\<=\@@active
+% \catcode`\<=\@@active
% \def<{\ifmmode\expandafter\normalless\else\expandafter\doshortcut\fi}%
% \getparameters[\??te#1][\c!commandos=,\c!commando=,\c!letter=,\c!kleur=,#2]%
% \else
-% \defineshortcut[][#1]%
+% \defineshortcut[][#1]%
% \fi}
-%
+%
% \egroup
-%
-% \def\doshortcut%
+%
+% \def\doshortcut%
% {\bgroup
% \catcode`\>=\@@other
% \dodoshortcut}
-%
-% \def\dodoshortcut#1>%
+%
+% \def\dodoshortcut#1>%
% {\def\shortcut{#1}%
% \dododoshortcut#1:\end}
-%
-% \def\dododoshortcut#1:#2\end
+%
+% \def\dododoshortcut#1:#2\end
% {\doifelsenothing{#2}
% {\doifundefinedelse{\??te\c!commandos}
-% {\shortcut}
+% {\shortcut}
% {\@EA\dodododoshortcut\@EA\??te\@EA:\shortcut:\end}}
% {\doifundefinedelse{\??te#1\c!commandos}
-% {\shortcut}
+% {\shortcut}
% {\dodododoshortcut\??te#1:#2\end}}%
% \egroup}
-%
+%
% \def\dodododoshortcut#1:#2:\end
% {\getvalue{#1\c!commandos}%
% \doattributes{#1}\c!letter\c!kleur{\getvalue{#1\c!commando}{#2}}}
@@ -294,9 +404,9 @@
{\dododefineshortcut[<>][#2][#3]}
{\dododefineshortcut[#1][#2][#3]}%
\else\ifsecondargument
- \dododefineshortcut[<>][#1][#2]%
+ \dododefineshortcut[<>][#1][#2]%
\else
- \dododefineshortcut[<>][][#1]%
+ \dododefineshortcut[<>][][#1]%
\fi\fi}
\def\dododefineshortcut[#1#2][#3][#4]% #1 is the trigger, #2 the delimiter/tag
@@ -306,26 +416,26 @@
[\??te\string#2#3]
[\c!commandos=,\c!commando=,\c!letter=,\c!kleur=,#4]}
-\def\doshortcut#1%
+\def\doshortcut#1%
{\ifmmode
\getvalue{\??te\??te#1}%
\else
\bgroup
\catcode`#1=\@@other
- \def\dodoshortcut##1#1%
+ \def\dodoshortcut##1#1%
{\def\shorttag{\??te#1}%
\def\shortcut{##1}%
\dododoshortcut##1:\end}%
\@EA\dodoshortcut
\fi}
-
-\def\dododoshortcut#1:#2\end
+
+\def\dododoshortcut#1:#2\end
{\doifelsenothing{#2}
{\doifundefinedelse{\shorttag\c!commandos}
- {\shortcut}
+ {\shortcut}
{\@EA\dodododoshortcut\@EA\shorttag\@EA:\shortcut:\end}}
{\doifundefinedelse{\shorttag#1\c!commandos}
- {\shortcut}
+ {\shortcut}
{\dodododoshortcut\shorttag#1:#2\end}}%
\egroup}
@@ -335,40 +445,64 @@
%D \defineshortcut [\c!letter=\v!type]
%D \defineshortcut [b] [\c!letter=\v!vet]
-%D \defineshortcut [e] [\c!letter=\em]
+%D \defineshortcut [e] [\c!letter=\em]
%D \defineshortcut [t] [\c!letter=\v!type]
%D \defineshortcut [c] [\c!letter=\v!kap]
%D \defineshortcut [k] [\c!letter=\v!kap]
%D \defineshortcut [u] [\c!letter=\v!type,\c!commando=\hyphenatedurl]
-%D
+%D
%D \startregels
-%D test <ziezo> test
-%D test test <t:ziezo>
-%D test test <b:ziezo>
-%D test test <w:ziezo>
-%D zus<>zo zus<:>zo zus<::>zo
-%D test test <t:ziezo> dat (ziezo)
-%D test test <t::ziezo> dat (:ziezo)
-%D test test <t:ziezo:> dat (ziezo:)
-%D test test <t:zi:ezo:> dat (zi:ezo:)
-%D well, <u:http://www.pragma-ade.nl> looks fuzzy
+%D test <ziezo> test
+%D test test <t:ziezo>
+%D test test <b:ziezo>
+%D test test <w:ziezo>
+%D zus<>zo zus<:>zo zus<::>zo
+%D test test <t:ziezo> dat (ziezo)
+%D test test <t::ziezo> dat (:ziezo)
+%D test test <t:ziezo:> dat (ziezo:)
+%D test test <t:zi:ezo:> dat (zi:ezo:)
+%D well, <u:http://www.pragma-ade.nl> looks fuzzy
%D $10<20$
%D \stopregels
-%D
+%D
%D \defineshortcut [<>] [i] [\c!letter=\it]
%D \defineshortcut [()] [b] [\c!letter=\bf]
%D \defineshortcut [++] [s] [\c!letter=\sl]
%D \defineshortcut [//] [u] [\c!letter=\underbars]
%D \defineshortcut [--] [a] [\c!letter=\overstrike]
-%D
+%D
%D \startregels
-%D it seems <i:to work> well
-%D it seems (b:to work) well
-%D it seems +s:to work+ well
-%D it seems /u:to work/ well
-%D it seems -a:to work- well
+%D it seems <i:to work> well
+%D it seems (b:to work) well
+%D it seems +s:to work+ well
+%D it seems /u:to work/ well
+%D it seems -a:to work- well
%D \stopregels
-\protect
+\def\setupenv{\dodoubleargument\rawgetparameters[\??en]}
+
+\def\doifenvelse#1{\doifdefinedelse{\??en#1}} % speed up
+
+\def\env#1{\csname\??en#1\endcsname}
+
+\beginTEX
+
+\def\envvar#1#2%
+ {\@EA\ifx\csname\??en#1\endcsname\relax
+ #2\else\csname\??en#1\endcsname
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\envvar#1#2%
+ {\ifcsname\??en#1\endcsname
+ \csname\??en#1\endcsname\else#2%
+ \fi}
+
+\endETEX
+
+\protect
\endinput
diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex
index 69e62dc5b..e86f8352a 100644
--- a/tex/context/base/core-not.tex
+++ b/tex/context/base/core-not.tex
@@ -202,7 +202,22 @@
\setfootnotehsize
\setrigidcolumnhsize\hsize\@@vnkolomafstand\@@vnn
\setbox0=\vbox\bgroup}
- \def\stoppopfootnotes {\egroup\rigidcolumnbalance0\egroup}}
+ \def\stoppopfootnotes {\egroup
+ \setbox0=\vbox
+ {\unvbox0\setbox0\lastbox
+ \ifvbox0\unvbox\else\box\fi0}%
+ \rigidcolumnbalance0\egroup}}
+
+% \def\settextfootnotes%
+% {\def\startpushfootnote {\startvboxtohbox
+% \dostartattributes\??vn\c!letter\c!kleur{}}%
+% \def\stoppushfootnote {\hskip\@@vnkolomafstand % plus.5em minus.5em
+% \dostopattributes
+% \stopvboxtohbox}%
+% \def\startpopfootnotes {\vbox\bgroup % \doifdimenelse
+% \doifnotinset{\@@vnbreedte}{\v!passend,\v!ruim}
+% {\setfootnotehsize}}%
+% \def\stoppopfootnotes {\convertvboxtohbox\egroup}}
\def\settextfootnotes%
{\def\startpushfootnote {\startvboxtohbox
@@ -210,10 +225,32 @@
\def\stoppushfootnote {\hskip\@@vnkolomafstand % plus.5em minus.5em
\dostopattributes
\stopvboxtohbox}%
- \def\startpopfootnotes {\vbox\bgroup % \doifdimenelse
+ \def\startpopfootnotes {\vbox\bgroup
\doifnotinset{\@@vnbreedte}{\v!passend,\v!ruim}
- {\setfootnotehsize}}%
- \def\stoppopfootnotes {\convertvboxtohbox\egroup}}
+ {\setfootnotehsize}%
+ \beginofshapebox}%
+ \def\stoppopfootnotes {\endofshapebox
+ \reshapebox
+ {\ifhbox\shapebox\unhbox\else\box\fi\shapebox
+ \endgraf}%
+ \flushshapebox
+ \egroup}}
+
+%D The formatting depends on the width of the table, so we
+%D have to set \type {n} to zero.
+%D
+%D \starttypen
+%D \startbuffer
+%D \bTABLE
+%D \bTR \bTD one \footnote{\dorecurse{10}{abcd }} \eTD \bTD two \eTD \eTR
+%D \bTR \bTD three fout five six seven eight nine \eTD \bTD ten \eTD \eTR
+%D \eTABLE
+%D \stopbuffer
+%D
+%D \startlocalfootnotes[n=0,location={text,none}]
+%D \placelegend[n=2]{\getbuffer}{\placelocalfootnotes}
+%D \stoplocalfootnotes
+%D \stoptypen
%D The numbers that accompany a footnote are generated using
%D the standard \CONTEXT\ numbering mechanism, and thereby can
@@ -281,6 +318,24 @@
\unexpanded\def\footnote {\dodoubleempty\dofootnote[1]}
\unexpanded\def\footnotetext{\dodoubleempty\dofootnote[0]}
+%\def\dofootnote[#1][#2]%
+% {\unskip
+% \ifcase#1\relax
+% \global\footnotesymbolfalse
+% \else
+% \global\footnotesymboltrue
+% \fi
+% \ifvisible
+% \ifreshapingbox
+% \let\next\gobbletwoarguments
+% \else
+% \let\next\dodofootnote
+% \fi
+% \else
+% \let\next\gobbletwoarguments
+% \fi
+% \next{#2}}
+
\def\dofootnote[#1][#2]%
{\unskip
\ifcase#1\relax
@@ -290,14 +345,13 @@
\fi
\ifvisible
\ifreshapingbox
- \let\next=\gobbletwoarguments
+ \@EAEAEA\gobbletwoarguments
\else
- \let\next=\dodofootnote
+ \@EAEAEA\dodofootnote
\fi
\else
- \let\next=\gobbletwoarguments
- \fi
- \next{#2}}
+ \@EA\gobbletwoarguments
+ \fi{#2}}
%D \macros
%D {footnotesenabled}
@@ -332,31 +386,67 @@
{}
\fi}
-\def\dodofootnote#1%
+% \def\dodofootnote#1%
+% {\iffootnotesenabled
+% \doglobal\increment\internalfootreference
+% \doifelse{\@@vnwijze}{\v!per\v!pagina}
+% {\settrue\pagewisefootnotes}
+% {\setfalse\pagewisefootnotes}%
+% \doifelse{#1}{-}
+% {\let\footnotenumber\empty}
+% {\ifconditional\pagewisefootnotes
+% \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
+% {\ifnum\currentrealreference>\lastfootnotepage\relax
+% \global\let\lastfootnotepage\currentrealreference
+% \resetnummer[\v!voetnoot]%
+% \fi}
+% {}%
+% \fi
+% \verhoognummer[\v!voetnoot]%
+% \maakhetnummer[\v!voetnoot]%
+% \rawreference{\s!fnt}{#1}{\hetnummer}%
+% \let\footnotenumber\hetnummer}%
+% \expandafter\dostartfootnote
+% \else
+% \expandafter\gobbleoneargument
+% \fi}
+
+\def\dodofootnote%
{\iffootnotesenabled
- \doglobal\increment\internalfootreference
- \doifelse{\@@vnwijze}{\v!per\v!pagina}
- {\settrue\pagewisefootnotes}
- {\setfalse\pagewisefootnotes}%
- \doifelse{#1}{-}
- {\let\footnotenumber=\empty}
- {\ifconditional\pagewisefootnotes
- \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
- {\ifnum\currentrealreference>\lastfootnotepage\relax
- \global\let\lastfootnotepage\currentrealreference
- \resetnummer[\v!voetnoot]%
- \fi}
- {}%
- \fi
- \verhoognummer[\v!voetnoot]%
- \maakhetnummer[\v!voetnoot]%
- \rawreference{\s!fnt}{#1}{\hetnummer}%
- \let\footnotenumber=\hetnummer}%
- \expandafter\dostartfootnote
+ \iftrialtypesetting
+ \@EAEAEA\nododofootnote
+ \else
+ \@EAEAEA\dododofootnote
+ \fi
\else
- \expandafter\gobbleoneargument
+ \@EA\gobbletwoarguments
\fi}
+\def\nododofootnote#1%
+ {\doifnot{#1}{-}{\kern.5em}% quick hack, approximation
+ \gobbleoneargument}
+
+\def\dododofootnote#1%
+ {\doglobal\increment\internalfootreference
+ \doifelse{\@@vnwijze}{\v!per\v!pagina}
+ {\settrue\pagewisefootnotes}
+ {\setfalse\pagewisefootnotes}%
+ \doifelse{#1}{-}
+ {\let\footnotenumber\empty}
+ {\ifconditional\pagewisefootnotes
+ \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
+ {\ifnum\currentrealreference>\lastfootnotepage\relax
+ \global\let\lastfootnotepage\currentrealreference
+ \resetnummer[\v!voetnoot]%
+ \fi}
+ {}%
+ \fi
+ \verhoognummer[\v!voetnoot]%
+ \maakhetnummer[\v!voetnoot]%
+ \rawreference{\s!fnt}{#1}{\hetnummer}%
+ \let\footnotenumber\hetnummer}%
+ \dostartfootnote}
+
%D The main typesetting routine is more or less the same as the
%D \PLAIN\ \TEX\ one, except that we only handle one type while
%D \PLAIN\ also has something \type{\v...}. In most cases
@@ -417,13 +507,16 @@
\fi
\startpushfootnote
{\ifx\footnotenumber\empty \else
+\preparethenumber\??vn\footnotenumber\preparednumber
\iflocation
\naarbox{\@@vnnummercommando
- {\footnotenumber\domovednote\v!volgendepagina\v!vorigepagina}}%
+% {\footnotenumber\domovednote\v!volgendepagina\v!vorigepagina}}%
+{\preparednumber\domovednote\v!volgendepagina\v!vorigepagina}}%
[\s!fnt:f:\internalfootreference]%
\else
\@@vnnummercommando
- {\footnotenumber\domovednote\v!volgendepagina\v!vorigepagina}%
+% {\footnotenumber\domovednote\v!volgendepagina\v!vorigepagina}%
+{\preparednumber\domovednote\v!volgendepagina\v!vorigepagina}%
\fi
\fi
\iflocation
@@ -510,12 +603,16 @@
\dofootnoterule % alleen in ..mode
\bgroup
\setfootnotebodyfont
- \setbox0=\hbox
+ \setbox0=\hbox
{\startpopfootnotes
\setfootnotebodyfont
- % this should be checked, smells like a mix-up
- % does not split: \ifcase\@@vnn\unvbox\else\box\fi\footins
- \ifcase\@@vnn\box\else\unvbox\fi\footins
+% % this should be checked, smells like a mix-up
+% % does not split: \ifcase\@@vnn\unvbox\else\box\fi\footins
+% \ifcase\@@vnn
+ \box\footins
+% \else
+% \unvbox\footins
+% \fi
% this is too ugly actually
\stoppopfootnotes}%
\localframed
@@ -524,7 +621,7 @@
\c!hoogte=\v!passend,
\c!strut=\v!nee,
\c!offset=\v!overlay]
- {\ifdim\dp0=\!!zeropoint % this hack is needed because \vadjust
+ {\ifdim\dp0=\zeropoint % this hack is needed because \vadjust
\hbox{\lower\dp\strutbox\box0}% % in margin number placement
\else % hides the (always) present depth
\box0
@@ -570,7 +667,9 @@
{\ifinner
%\message{[postponed footnote]}%
\global\setbox\postponedfootnotes=\vbox\bgroup
- \unvbox\postponedfootnotes
+ \ifvoid\postponedfootnotes\else
+ \unvbox\postponedfootnotes
+ \fi
\let\next=\gobbletwoarguments
\else
%\message{[inserted footnote]}%
@@ -609,14 +708,33 @@
\fi
\fi}
+% \def\flushfootnotes%
+% {\ifinpagebody \else
+% \ifinner \else
+% \ifendnotes \else
+% \ifvoid\postponedfootnotes \else
+% %\ifvmode % less interference, but also less secure
+% \doflushfootnotes
+% %\fi
+% \fi
+% \fi
+% \fi
+% \fi}
+%
+% more efficient
+
\def\flushfootnotes%
- {\ifinpagebody \else \ifinner \else
- \ifendnotes \else \ifvoid\postponedfootnotes \else
- %\ifvmode % less interference, but also less secure
- \doflushfootnotes
- %\fi
- \fi\fi
- \fi\fi}
+ {\ifvoid\postponedfootnotes \else
+ \ifinner \else
+ \ifendnotes \else
+ \ifinpagebody \else
+ %\ifvmode % less interference, but also less secure
+ \doflushfootnotes
+ %\fi
+ \fi
+ \fi
+ \fi
+ \fi}
%D This is a nasty and new secondary footnote flusher. It
%D can be hooked into \type {\everypar} like:
@@ -625,8 +743,11 @@
%D \appendtoks \synchronizefootnotes \to \everypar
%D \stoptypen
-\def\synchronizefootnotes%
- {\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi}
+\def\dosynchronizefootnotes%
+ {\insert\footins{\unvbox\footins}}
+
+\def\synchronizefootnotes% indirect because of everypar
+ {\ifvoid\footins\else\dosynchronizefootnotes\fi}
\def\placefootnotesintext#1%
{\ifdim\ht#1>\zeropoint
@@ -670,10 +791,21 @@
%D \setupfootnotes[location={text,none}]
%D \stoptypen
+%\def\placefootnotesasnone#1% is grouped already
+% {\ifdim\ht#1>\zeropoint
+% \@@vnvoor
+% \setfootnotebodyfont \unvbox#1\endgraf
+% \@@vnna
+% \fi}
+
\def\placefootnotesasnone#1% is grouped already
{\ifdim\ht#1>\zeropoint
\@@vnvoor
- \setfootnotebodyfont \unvbox#1\endgraf
+ \setfootnotebodyfont
+ \startpopfootnotes % make sure that fake height is killed
+ \unvbox#1\endgraf
+ \stoppopfootnotes
+ \setbox0=\lastbox \ifvbox0 \unvbox0\else\box0\fi % enable columns
\@@vnna
\fi}
@@ -694,12 +826,14 @@
{\def\localfootinsert##1% was \gdef, but never reset!
{%\message{[local footnote]}%
\global\setbox\localpostponedfootnotes=\vbox\bgroup
- \unvbox\localpostponedfootnotes
+ \ifvoid\localpostponedfootnotes \else
+ \unvbox\localpostponedfootnotes
+ \fi
\let\next}}
\def\dostartlocalfootnotes[#1]%
- {\let\autopostponefootnotes=\postponefootnotes
- \let\postponefootnotes=\collectlocalfootnotes
+ {\let\autopostponefootnotes\postponefootnotes
+ \let\postponefootnotes\collectlocalfootnotes
\def\defaultfootnotewidth%
{\ifdim\hsize<\zetbreedte\hsize\else\zetbreedte\fi}%
\setupfootnotes[#1]%
@@ -713,13 +847,17 @@
\def\stoplocalfootnotes%
{\restorenumber[\v!voetnoot]%
- \egroup}
+ \egroup
+ \setupfootnotes\relax} % really needed, else wrong main settings
\def\doplacelocalfootnotes[#1]%
{\bgroup
\setupfootnotes[#1]%
- \placefootnotesintext\localpostponedfootnotes
- \egroup}
+ \ExpandBothAfter\doifinsetelse{\v!geen}{\@@vnplaats}
+ {\placefootnotesasnone\localpostponedfootnotes}%
+ {\placefootnotesintext\localpostponedfootnotes}%
+ \egroup
+ \setupfootnotes\relax}
\def\placelocalfootnotes%
{\dosingleempty\doplacelocalfootnotes}
@@ -846,8 +984,7 @@
\c!breedte=\defaultfootnotewidth,
\c!hoogte=\teksthoogte,
\c!nummercommando=\high,
+ \c!scheider=\@@koscheider,
\c!n=1]
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex
index 995daf146..2ffc6ffae 100644
--- a/tex/context/base/core-ntb.tex
+++ b/tex/context/base/core-ntb.tex
@@ -14,6 +14,8 @@
%D This is an unfinished, preliminary module. At least two
%D runs are needed to get the table fixed.
+% optie=rek beschrijven
+
\writestatus{loading}{Context Core Macros / Natural Tables}
%D As always, this is the nth version. Much time went in
@@ -57,7 +59,7 @@
\endstrut
\else
\par
- \ifdim\prevdepth<\!!zeropoint % =-1000pt ?
+ \ifdim\prevdepth<\zeropoint % =-1000pt ?
\vskip-\dp\strutbox
\else
\removebottomthings
@@ -69,7 +71,7 @@
%\def\@@tbl{tbl} \def\tblcell{m} \def\tblnone{n}
\def\@@tbl{tbl} \def\tblcell{1} \def\tblnone{2}
-\def\@@tblprefix{tbl:}
+\def\@@tblprefix{tbl:} \let\@@rawtblprefix\@@tblprefix
%D This should be done more efficient:
@@ -122,6 +124,7 @@
\newif\ifautoTBLhsize \autoTBLhsizetrue
\newif\ifautoTBLrowspan \autoTBLrowspantrue
\newif\ifautoTBLemptycell \autoTBLemptycelltrue
+\newif\ifautoTBLcheckwidth \autoTBLcheckwidthtrue
\newif\ifappendTBLsetups \appendTBLsetupstrue
\newif\iftraceTABLE \traceTABLEfalse
@@ -143,13 +146,14 @@
{\ifthirdargument
\processaction
[#1]
- [ \v!rij=>{\dosetupTABLExy[\c!y][#2][#3]},
- \v!kolom=>{\dosetupTABLExy[\c!x][#2][#3]},
- r=>{\dosetupTABLExy[\c!y][#2][#3]},
- c=>{\dosetupTABLExy[\c!x][#2][#3]},
- y=>{\dosetupTABLExy[\c!y][#2][#3]},
- x=>{\dosetupTABLExy[\c!x][#2][#3]},
- \s!unknown=>{\dosetupTABLEzz[#1][#2][#3]}]%
+ [ \v!rij=>{\dosetupTABLExy[\c!y][#2][#3]},
+ \v!kolom=>{\dosetupTABLExy[\c!x][#2][#3]},
+ r=>{\dosetupTABLExy[\c!y][#2][#3]},
+ c=>{\dosetupTABLExy[\c!x][#2][#3]},
+ y=>{\dosetupTABLExy[\c!y][#2][#3]},
+ x=>{\dosetupTABLExy[\c!x][#2][#3]},
+ \v!start=>{\dosetupTABLExy[#1][#2][#3]},
+ \s!unknown=>{\dosetupTABLEzz[#1][#2][#3]}]%
\else\ifsecondargument
\processaction
[#1]
@@ -159,6 +163,7 @@
c=>{\dosetupTABLExy[\c!x][\v!elk][#2]},
y=>{\dosetupTABLExy[\c!y][\v!elk][#2]},
x=>{\dosetupTABLExy[\c!x][\v!elk][#2]},
+ \v!start=>{\dosetupTABLExy[#1][\v!elk][#2]},
\s!unknown=>{\dosetupTABLEzz[\c!x][#1][#2]}]%
\else
\getparameters[\@@tbl\@@tbl][#1]%
@@ -269,7 +274,7 @@
\increment\row}%
% check max column
\decrement\col
- \ifnum\col>\maximumcol
+ \ifnum\col>\maximumcol\relax
\let\maximumcol\col
\fi
% set values
@@ -283,7 +288,8 @@
\long\def\parseTH[#1]#2\eTH%
% {\parseTD[#1,\c!letter=\v!vet,\c!karakteruitlijnen=\v!nee]#2\eTD}
- {\parseTD[#1,\c!kleur=\tbltblkopkleur,\c!letter=\tbltblkopletter,\c!karakteruitlijnen=\v!nee]#2\eTD}
+ {\parseTD[#1,\c!kleur=\tbltblkopkleur,\c!letter=\tbltblkopletter,%
+ \c!karakteruitlijnen=\v!nee]#2\eTD}
\newtoks\TBLhead
\newtoks\TBLbody
@@ -314,6 +320,11 @@
\chardef\TBLpass=0
+\def\presetallTABLEparameters% each odd|even level
+ {\executeifdefined{\@@rawtblprefix\v!start\v!elk}\relax
+ \executeifdefined{\@@rawtblprefix\v!start\v!oddeven\TBLlevel}\relax
+ \executeifdefined{\@@rawtblprefix\v!start\number\TBLlevel}\relax}
+
\def\bTABLE%
{\dosingleempty\dobTABLE}
@@ -324,10 +335,11 @@
\getparameters
[\@@tbl\@@tbl]
[\c!uitlijnen={\v!rechts,\v!ruim,\v!hoog},#1]%
+ \presetallTABLEparameters
\ExpandFirstAfter\processallactionsinset
[\tbltbloptie]
[\v!rek=>\autoTBLspreadtrue]%
- \linewidth=\tbltbllijndikte % needs to be frozen
+ \linewidth=\tbltbllijndikte % needs to be frozen
\dontcomplain
\def\currentcol{0}%
\def\maximumrowspan{1}%
@@ -353,7 +365,7 @@
{\doifelsetbltag\xrow\xcol
{\exitloop}
{\increment\xcol \relax
- \ifnum\xcol>\maximumcol \exitloop \fi}}%
+ \ifnum\xcol>\maximumcol\relax \exitloop \fi}}%
\doifelsetbltag\xrow\xcol
{\exitloop}
{\let\xxrow\xrow \let\xxcol\xcol \increment\xrow \relax
@@ -403,35 +415,24 @@
\expanded{\doTBL{\row}{\col}}}%
\eTBL}%
\endTBL
-\ifnum\TBLlevel>1
- \vskip-\dp\strutbox
-\fi
+% wrong ! ! ! better to have an auto-offset-overlay
+% \ifnum\TBLlevel>1
+% \vskip-\dp\strutbox
+% \fi
\egroup
\popTBL}
\def\spanTBL#1#2%
{\scratchcounter=\gettblcol{#1}{#2}\relax
\ifnum\scratchcounter>0
- \advance\scratchcounter by -1
+ \advance\scratchcounter -1
\dorecurse{\scratchcounter}{\appendtoks\spantblcol\to\tbltoks}%
- \dorecurse{\scratchcounter}
- {\appendtoks
- \skiptblcol
- \to\tbltoks}%
- \appendtoks
- \nexttblcol
- \to\tbltoks
+ \dorecurse{\scratchcounter}{\appendtoks\skiptblcol\to\tbltoks}%
+ \appendtoks\nexttblcol\to\tbltoks
\fi}
-\def\bTBL%
- {\appendtoks
- \begintblrow
- \to\tbltoks}
-
-\def\eTBL%
- {\appendtoks
- \endtblrow
- \to\tbltoks}
+\def\bTBL{\appendtoks\begintblrow\to\tbltoks}
+\def\eTBL{\appendtoks\endtblrow \to\tbltoks}
% We use aligments to handle the empty (skipped) columns, so
% that we don't have to (re|)|calculate these.
@@ -458,7 +459,7 @@
{\doglobal\newcounter\colTBL
\doglobal\newcounter\rowTBL
\doglobal\decrement\rowTBL
- \tabskip\!!zeropoint
+ \tabskip\zeropoint
\halign\bgroup\ignorespaces##\unskip&&\ignorespaces##\unskip\cr}
\def\endtbl%
@@ -497,13 +498,13 @@
\edef\minimalcellheight{\the\ht\scratchbox}%
\dorecurse{\maximumcol}
{\settblaut\recurselevel\!!zeropoint
-% new
-\let\xcol\recurselevel
-\dorecurse{\maximumrow}
- {\settblwd \recurselevel\xcol\!!zeropoint
- \settblht \recurselevel\xcol\!!zeropoint}%
-% till here
- \settblwid\recurselevel\!!zeropoint}%
+ % new
+ \let\xcol\recurselevel
+ \dorecurse{\maximumrow}
+ {\settblwd \recurselevel\xcol\!!zeropoint
+ \settblht \recurselevel\xcol\!!zeropoint}%
+ % till here
+ \settblwid\recurselevel\!!zeropoint}%
\dorecurse{\maximumrow}
{\settblhei\recurselevel\maxdimen}%
\chardef\TBLpass=1
@@ -533,6 +534,10 @@
\setbox\scratchbox=\vbox{\the\tbltoks}%
\fi
\else\ifautoTBLrowspan\ifnum\maximumrowspan>1 % max ?
+% added jan 2002 because nx=* did no longer work
+ \checktblwidthsone % trial run
+ \checktblwidthstwo % real run
+%
\let\handleTBLcell\dohandleTBLcellC
\setbox\scratchbox=\vbox{\the\tbltoks}%
\fi\fi\fi
@@ -540,7 +545,7 @@
\let\handleTBLcell\dohandleTBLcellD
\chardef\TBLpass=2
\def\makeTBL##1##2% meer in cellD
- {\dimen2=\!!zeropoint
+ {\dimen2=\zeropoint
\pushmacro\colTBL
\dorecurse{\gettblcol{##1}{##2}}
{\advance\dimen2 by \gettblwid\colTBL
@@ -561,7 +566,7 @@
\def\makeTBL##1##2%
{% height
\pushmacro\rowTBL
- \scratchdimen=\!!zeropoint
+ \scratchdimen=\zeropoint
\def\rowTBL{##1}%
\ifnum\gettblcol{##1}{##2}=\maximumcol\relax
% case: nc=maxcolumns
@@ -577,7 +582,7 @@
\popmacro\rowTBL
% width
\pushmacro\colTBL
- \scratchdimen=\!!zeropoint
+ \scratchdimen=\zeropoint
\dorecurse{\gettblcol{##1}{##2}}
{\advance\scratchdimen by \gettblwid\colTBL
\increment\colTBL}%
@@ -593,7 +598,7 @@
{\lower\ht\scratchbox\hbox{\raise\scratchdimen\box\scratchbox}}%
\ht\scratchbox=\scratchdimen
\fi
- \dp\scratchbox=\!!zeropoint
+ \dp\scratchbox=\zeropoint
\box\scratchbox}%
\iftraceTABLE\showtbltoks\fi
\vbox{\the\tbltoks}}
@@ -607,7 +612,7 @@
\!!counta=0
\dorecurse{\maximumcol}
{\scratchdimen=\gettblaut\recurselevel\relax
- \ifdim\scratchdimen>\!!zeropoint\relax
+ \ifdim\scratchdimen>\zeropoint\relax
\advance\!!dimena by -\scratchdimen
\else
\scratchdimen=\gettblwid\recurselevel\relax
@@ -615,7 +620,7 @@
\ifcase#1\else\settblwid\recurselevel\!!zeropoint\fi
\advance\!!counta by 1
\else
- \ifdim\scratchdimen>\!!zeropoint\relax
+ \ifdim\scratchdimen>\zeropoint\relax
\advance\!!dimena by -\scratchdimen
\else
% eigenlijk moet dit alleen als de kolom wordt overspannen door een
@@ -627,12 +632,12 @@
\ifcase\!!counta \else \divide\!!dimena by \!!counta \fi
\dorecurse{\maximumcol}
{\scratchdimen=\gettblwid\recurselevel\relax
- \ifcase#1
- \ifdim\scratchdimen<\!!dimena % take natural width
+ \ifcase#1\relax
+ \ifdim\scratchdimen<\!!dimena % take natural width
\settblaut\recurselevel{\the\scratchdimen}%
\fi
\else
- \ifdim\scratchdimen=\!!zeropoint\relax % auto set width
+ \ifdim\scratchdimen=\zeropoint\relax % auto set width
\settblwid\recurselevel{\the\!!dimena}%
\fi
\fi}%
@@ -643,7 +648,7 @@
% \!!counta=0
% \dorecurse{\maximumcol}
% {\scratchdimen=\gettblaut\recurselevel\relax
-% \ifdim\scratchdimen>\!!zeropoint\relax
+% \ifdim\scratchdimen>\zeropoint\relax
% \advance\!!dimena by -\scratchdimen
% \else
% \advance\!!counta by 1
@@ -651,7 +656,7 @@
% \ifcase\!!counta \else \divide\!!dimena by \!!counta \fi
% \dorecurse{\maximumcol}
% {\scratchdimen=\gettblaut\recurselevel\relax
-% \ifdim\scratchdimen=\!!zeropoint\relax
+% \ifdim\scratchdimen=\zeropoint\relax
% \settblaut\recurselevel{\the\!!dimena}%
% \fi
% \settblwid\recurselevel{\the\!!dimena}%
@@ -741,13 +746,45 @@
\setsecondpasscharacteralign\checkalignment{\strut#2\unskip}%
\ignorespaces}
+% \long\def\dohandleTBLcellA#1#2[#3]#4%
+% {\setbox\scratchbox=\hbox
+% {\setupTBLcell{#1}{#2}%
+% \localframed
+% [\@@tbl\@@tbl]
+% [#3,\c!achtergrond=,\c!kader=\v!uit]% 25% faster
+% {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}%
+% \scratchdimen=\gettblwid\colTBL\relax
+% \ifdim\wd\scratchbox>\scratchdimen
+% \settblwid\colTBL{\the\wd\scratchbox}% auto set
+% \fi
+% \let\rowTBLx\rowTBL\increment\rowTBLx
+% \scratchdimen=\gettblhei\rowTBLx\relax
+% \ifdim\ht\scratchbox<\scratchdimen
+% \settblhei\rowTBLx{\the\ht\scratchbox}% auto set
+% \fi
+% \settblht{#1}{#2}{\the\ht\scratchbox}%
+% \settblwd{#1}{#2}{\the\wd\scratchbox}%
+% \ifdim\wd\scratchbox<.75\hsize
+% \ifdim\ht\scratchbox>2\openlineheight % honor width since this can be a
+% \scratchdimen=\gettblaut\colTBL\relax % figure or so
+% \ifdim\wd\scratchbox>\scratchdimen
+% \settblaut\colTBL{\the\wd\scratchbox}%
+% %\message{[forcing width of \colTBL\space(\the\wd\scratchbox/\the\hsize)]}%
+% \fi
+% \fi
+% \fi
+% \setbox2=\null
+% \wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox
+% \box2}
+
\long\def\dohandleTBLcellA#1#2[#3]#4%
{\setbox\scratchbox=\hbox
{\setupTBLcell{#1}{#2}%
\localframed
[\@@tbl\@@tbl]
[#3,\c!achtergrond=,\c!kader=\v!uit]% 25% faster
- {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}%
+ {\trialtypesettingtrue
+ \bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}%
\scratchdimen=\gettblwid\colTBL\relax
\ifdim\wd\scratchbox>\scratchdimen
\settblwid\colTBL{\the\wd\scratchbox}% auto set
@@ -759,15 +796,18 @@
\fi
\settblht{#1}{#2}{\the\ht\scratchbox}%
\settblwd{#1}{#2}{\the\wd\scratchbox}%
- \ifdim\wd\scratchbox<.75\hsize
- \ifdim\ht\scratchbox>2\openlineheight % honor width since this can be a
- \scratchdimen=\gettblaut\colTBL\relax % figure or so
- \ifdim\wd\scratchbox>\scratchdimen
- \settblaut\colTBL{\the\wd\scratchbox}%
- %\message{[forcing width of \colTBL\space(\the\wd\scratchbox/\the\hsize)]}%
+ \ifautoTBLcheckwidth
+ \ifdim\wd\scratchbox<.75\hsize
+ \ifdim\ht\scratchbox>2\openlineheight % honor width since this can be a
+ \scratchdimen=\gettblaut\colTBL\relax % figure or so
+ \ifdim\wd\scratchbox>\scratchdimen
+ \settblaut\colTBL{\the\wd\scratchbox}%
+ % to be translated
+ \writestatus{TABLE}{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}%
+ \fi
\fi
\fi
- \fi
+ \fi
\setbox2=\null
\wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox
\box2}
@@ -778,7 +818,8 @@
\localframed
[\@@tbl\@@tbl]
[#4,#1,\c!kader=\v!uit,\c!achtergrond=]
- {\bTBLCELL#5\eTBLCELL}}%
+ {\trialtypesettingtrue
+ \bTBLCELL#5\eTBLCELL}}%
\setbox2=\null
\wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox
\ifautoTBLrowspan
@@ -793,11 +834,11 @@
\long\def\dohandleTBLcellB#1#2[#3]#4%
{\scratchdimen=\gettblaut\colTBL\relax
- \ifdim\scratchdimen>\!!zeropoint\relax
+ \ifdim\scratchdimen>\zeropoint\relax
\let\tblwidthkey\c!breedte \edef\tblwidth{\the\scratchdimen}%
\else
\scratchdimen=\gettblwid\colTBL\relax
- \ifdim\scratchdimen>\!!zeropoint\relax
+ \ifdim\scratchdimen>\zeropoint\relax
\ifnum\gettblcol{#1}{#2}=\maximumcol\relax
\scratchdimen=\hsize
\fi
@@ -817,14 +858,15 @@
[\@@tbl\@@tbl]
[#3,\c!breedte=\widthTBL,
\c!achtergrond=,\c!kader=\v!uit]% 25% faster
- {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}}
+ {\trialtypesettingtrue
+ \bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}}
\long\def\dohandleTBLcellE#1#2[#3]#4%
{\setupTBLcell{#1}{#2}%
\getparameters[\@@tbl\@@tbl][#3]% to get the color right, the way we
\color % handle color here prevents interference due to whatsit nodes
[\tbltblkleur] % as well as permits local colors to take precedence
- {\ifdim\heightTBL=\!!zeropoint\relax % case: nc=maxcolumns
+ {\ifdim\heightTBL=\zeropoint\relax % case: nc=maxcolumns
\localframed
[\@@tbl\@@tbl]
[\c!kleur=,\c!breedte=\widthTBL]
@@ -904,11 +946,11 @@
\fi
\doglobal\decrement\TBLlevel\relax}
-\chardef\resetTABLEmode=0
+\newconditional\resetTABLEmode \settrue\resetTABLEmode
\def\resetallTABLEparameters% moet genest wel werken
{\ifnum\TBLlevel>1 % in ieder geval
- \ifcase\resetTABLEmode
+ \ifconditional\resetTABLEmode
\presetlocalframed % breedte hoogte diepte offset
[\@@tbl\@@tbl]% % achtergrond, achtergrondraster, achtergrondkleur
% not ok yet
@@ -918,8 +960,8 @@
\c!kaderkleur=black,
\c!kleur=,
\c!letter=,
-\c!kopletter=,
-\c!kopkleur=,
+ \c!kopletter=,
+ \c!kopkleur=,
\c!strut=\v!nee,
\c!karakteruitlijnen=\v!nee,
\c!uitlijnkarakter={,},
diff --git a/tex/context/base/core-num.tex b/tex/context/base/core-num.tex
index 45ce75092..bcab02ef6 100644
--- a/tex/context/base/core-num.tex
+++ b/tex/context/base/core-num.tex
@@ -31,43 +31,49 @@
\newif\ifnummeren
+\def\@@thenumber#1{\s!number\csname\s!number#1\c!nummer\endcsname}
+
\def\dostelnummerin[#1][#2]%
- {\@EA\let\@EA\savedstartnumber\csname\s!number#1\c!start\endcsname
- \getparameters[\s!number#1][\c!start=,#2]%
- \doifelsevaluenothing{\s!number#1\c!start}
- {\letvalue{\s!number#1\c!start}=\savedstartnumber}
- {\setcounter{\s!number#1}{\getvalue{\s!number#1\c!start}}}}
+ {\@EA\let\@EA\savedstartnumber\csname\@@thenumber{#1}\c!start\endcsname
+ \getparameters[\@@thenumber{#1}][\c!start=,#2]%
+ \doifelsevaluenothing{\@@thenumber{#1}\c!start}
+ {\letvalue{\@@thenumber{#1}\c!start}=\savedstartnumber}
+ {\setcounter{\@@thenumber{#1}}{\getvalue{\@@thenumber{#1}\c!start}}}}
-\def\stelnummerin%
+\def\stelnummerin
{\dodoubleargument\dostelnummerin}
\def\dodefinieernummer[#1][#2]% ook overal class als localframed
+ {\doifassignmentelse{#2}
+ {\dododefinieernummer[#1][#2]}
+ {\doifelsenothing{#2} % can break on not yet defined macros in #2
+ {\dododefinieernummer[#1][#2]}
+ {\setvalue{\s!number#1\c!nummer}{#2}}}}
+
+\def\dododefinieernummer[#1][#2]%
{\getparameters
[\s!number#1]
- [\s!check=,
+ [\c!nummer=#1,
+ \s!check=,
\c!wijze=\@@nrwijze,
- \c!wijze\c!lokaal=\getvalue{\s!number#1\c!wijze},
+ \c!wijze\c!lokaal=\getvalue{\@@thenumber{#1}\c!wijze},
\c!sectienummer=\v!ja,
- \c!tekst=,
- \c!plaats=, % was: \c!zetwijze
+ \c!tekst=, % weg hier
+ \c!plaats=, % weg hier, was trouwens \c!zetwijze
\c!conversie=\v!cijfers,
\c!start=0,
#2]%
- \makecounter{\s!number#1}%
- \setcounter{\s!number#1}{\getvalue{\s!number#1\c!start}}}
-
-% \c!nummer=#1 ; nogal veel copieen nodig
-%
-% \def\@@thenumber#1{\s!number\getvalue{\s!number#1\c!nummer}}
+ \makecounter{\@@thenumber{#1}}%
+ \setcounter{\@@thenumber{#1}}{\getvalue{\@@thenumber{#1}\c!start}}}
\def\definieernummer%
{\dodoubleempty\dodefinieernummer}
\def\setnummer[#1]#2%
- {\setcounter{\s!number#1}{#2}}
+ {\setcounter{\@@thenumber{#1}}{#2}}
\def\resetnummer[#1]%
- {\setcounter{\s!number#1}{0\getvalue{\s!number#1\c!start}}}
+ {\setcounter{\@@thenumber{#1}}{0\csname\@@thenumber{#1}\c!start\endcsname}}
\def\dodoreset#1%
{\getvalue{\s!reset#1}}%
@@ -78,40 +84,57 @@
\def\reset%
{\dosingleargument\doreset}
-\def\verhoognummer[#1]%
- {\checknummer{#1}%
- \ifnummeren
- \else
- \resetcounter{\s!number#1}%
- \fi
- \pluscounter{\s!number#1}}
+%\def\verhoognummer[#1]%
+% {\checknummer{#1}%
+% \ifnummeren
+% \else
+% \resetcounter{\@@thenumber{#1}}%
+% \fi
+% \pluscounter{\@@thenumber{#1}}}
\def\savenumber[#1]%
- {\savecounter{\s!number#1}}
+ {\savecounter{\@@thenumber{#1}}}
\def\restorenumber[#1]%
- {\restorecounter{\s!number#1}}
+ {\restorecounter{\@@thenumber{#1}}}
% nieuw, maar kan dit (i.v.m. (sub)page?)
+% \def\verhoognummer[#1]%
+% {\checknummer{#1}%
+% \ifnummeren
+% \pluscounter{\@@thenumber{#1}}%
+% \else
+% \setcounter{\@@thenumber{#1}}{0\csname\@@thenumber{#1}\c!start\endcsname}%
+% \fi}
+
\def\verhoognummer[#1]%
- {\checknummer{#1}%
+ {\doifelsevalue{\@@thenumber{#1}\c!wijze}{\v!per\v!pagina}
+ {\checkpagechange{#1}%
+ \ifpagechanged\resetcounter{\@@thenumber{#1}}\fi}
+ {\checknummer{#1}}%
\ifnummeren
- \pluscounter{\s!number#1}%
+ \pluscounter{\@@thenumber{#1}}%
\else
- \setcounter{\s!number#1}{0\getvalue{\s!number#1\c!start}}%
+ \setcounter{\@@thenumber{#1}}{0\getvalue{\@@thenumber{#1}\c!start}}%
\fi}
+% \defineenumeration [test] [way=bypage,text=\lastchangedpage]
+%
+% \starttext \dorecurse{10}{\test \input tufte \par} \stoptext
+
\def\verlaagnummer[#1]%
- {\minuscounter{\s!number#1}}
+ {\minuscounter{\@@thenumber{#1}}}
\def\nummer[#1]%
{\convertnumber
- {\getvalue{\s!number#1\c!conversie}}
- {\countervalue{\s!number#1}}}
+ {\getvalue{\@@thenumber{#1}\c!conversie}}
+ {\countervalue{\@@thenumber{#1}}}}
\def\ruwenummer[#1]%
- {\countervalue{\s!number#1}}
+ {\countervalue{\@@thenumber{#1}}}
+
+\ifx\checknummer\undefined \let\checknummer\gobbleoneargument \fi
% ook de pag nummers hierheen halen ivm \@@nrwijze
diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex
index ffbd9ad34..c8d978a34 100644
--- a/tex/context/base/core-obj.tex
+++ b/tex/context/base/core-obj.tex
@@ -86,13 +86,16 @@
\newif\ifinobject
+\def\objectplaceholder{NOT YET FLUSHED}%
+
\def\presetobject#1#2%
- {\doifundefined{\r!object#1::#2}
- {\setxvalue{\r!object#1::#2}{NOT YET FLUSHED}}}
+ {\ifundefined{\r!object#1::#2}%
+ \@EA\let\csname\r!object#1::#2\endcsname\objectplaceholder
+ \fi}
-\def\dosetobject#1#2#3% evt \initializepaper naar \everyshipout
- {\initializepaper
- \ifundefined{\r!object#2::#3}%
+\def\dosetobject#1#2#3% \initializepaper this will move to \everyshipout
+ {\initializepaper
+ \ifundefined{\r!object#2::#3}%
\expandafter\dodosetobject
\else
\expandafter\gobblefivearguments
@@ -106,105 +109,62 @@
\def\objectoffset{1cm}
-% \def\dodosetobject#1#2#3%
-% {\bgroup
-% \inobjecttrue
-% \dowithnextbox
-% {\bgroup
-% \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox
-% \setxvalue{\r!object#2::#3}%
-% {\noexpand\dohandleobject{#2}{#3}
-% {\ifhbox\nextbox\hbox\else\vbox\fi}
-% %{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}%
-% {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}%
-% \expanded % fix the dimensions since \dostartobject may use \nextbox
-% {\dostartobject
-% {#2}{#3}
-% {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}%
-% \ifcase#1\relax\else\ifdim\objectoffset>\!!zeropoint\relax
-% \scratchdimen=\objectoffset
-% \edef\next%
-% {\wd\nextbox\the\wd\nextbox
-% \ht\nextbox\the\ht\nextbox
-% \dp\nextbox\the\dp\nextbox}%
-% \setbox\nextbox=\vbox spread 2\scratchdimen
-% {\forgetall
-% \vss
-% \hbox spread 2\scratchdimen{\hss\box\nextbox\hss}%
-% \vss}%
-% \setbox\nextbox=\hbox
-% {\hskip-\scratchdimen\lower\scratchdimen\box\nextbox}%
-% \next
-% \fi\fi
-% \box\nextbox
-% \dostopobject
-% \egroup
-% \egroup}}
-
\def\dodosetobject#1#2#3%
{\bgroup
\inobjecttrue
- \dowithnextbox
- {\bgroup
- \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox
- \setxvalue{\r!object#2::#3}%
- {\noexpand\dohandleobject{#2}{#3}
- {\ifhbox\nextbox\hbox\else\vbox\fi}
- %{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}%
- {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}%
- \expanded % fix the dimensions since \dostartobject may use \nextbox
- {\dostartobject
- {#2}{#3}
- {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}%
- \ifcase#1\relax
- \box\nextbox
- \else\ifdim\objectoffset>\!!zeropoint
- \scratchdimen=\objectoffset
- \edef\width {\the\wd\nextbox}%
- \edef\height{\the\ht\nextbox}%
- \edef\depth {\the\dp\nextbox}%
- \setbox\nextbox=
- \vbox spread 2\scratchdimen
- {\forgetall
- \vss
- \hbox spread 2\scratchdimen{\hss\box\nextbox\hss}%
- \vss}%
- \setbox\nextbox=\hbox
- {\hskip-\scratchdimen\lower\scratchdimen\box\nextbox}%
- \wd\nextbox=\width
- \ht\nextbox=\height
- \dp\nextbox=\depth
- \box\nextbox
- \else
- \box\nextbox
- \fi\fi
- \dostopobject
- \egroup
- \egroup}}
+ \dowithnextbox{\dododosetobject{#1}{#2}{#3}\egroup}}
+
+\def\dododosetobject#1#2#3%
+ {\dontshowcomposition % rather fuzzy in \setxvalue ... \hbox
+ \@EA\xdef\csname\r!object#2::#3\endcsname
+ {\noexpand\dohandleobject{#2}{#3}%
+ {\ifhbox\nextbox\hbox\else\vbox\fi}%
+ %{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}%
+ {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}%
+ \expanded % freeze the dimensions since \dostartobject may use \nextbox
+ {\dostartobject
+ {#2}{#3}{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}%
+ \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint
+ \scratchdimen\objectoffset
+ \edef\width {\the\wd\nextbox}%
+ \edef\height{\the\ht\nextbox}%
+ \edef\depth {\the\dp\nextbox}%
+ \setbox\nextbox\vbox spread 2\scratchdimen
+ {\forgetall
+ \vss\hbox spread 2\scratchdimen{\hss\box\nextbox\hss}\vss}%
+ \setbox\nextbox\hbox
+ {\hskip-\scratchdimen\lower\scratchdimen\box\nextbox}%
+ \wd\nextbox\width
+ \ht\nextbox\height
+ \dp\nextbox\depth
+ \fi \fi
+ \box\nextbox
+ \dostopobject}
\def\dogetobject#1#2#3#4#5#6%
{\initializepaper
\bgroup
\forgetall
\dontshowcomposition
- \setbox0=\vbox
+ \setbox\scratchbox\vbox
{\doinsertobject{#1}{#2}}%
- \setbox0=#3%
+ \setbox\scratchbox#3%
{\vbox to #5\s!sp
- {\ifdim\ht0>#5\s!sp % or \ifdim\wd0>#4\s!sp
- \vss\hbox to #4\s!sp{\hss\box0\hss}\vss
+ {\ifdim\ht\scratchbox>#5\s!sp
+ % or \ifdim\wd\scratchbox>#4\s!sp
+ \vss\hbox to #4\s!sp{\hss\box\scratchbox\hss}\vss
\else
- \vss\box0
+ \vss\box\scratchbox
\fi}}%
- \wd0=#4\s!sp
- \ht0=#5\s!sp
- \dp0=#6\s!sp
- \box0
+ \wd\scratchbox#4\s!sp
+ \ht\scratchbox#5\s!sp
+ \dp\scratchbox#6\s!sp
+ \box\scratchbox
\egroup}
\def\getobject#1#2%
{\let\dohandleobject\dogetobject
- \getvalue{\r!object#1::#2}}
+ \csname\r!object#1::#2\endcsname}
%D If needed one can ask for the dimensions of an object with:
%D
@@ -225,7 +185,7 @@
\let\objectwidth \!!zeropoint
\let\objectheight\!!zeropoint
\let\objectdepth \!!zeropoint
- \getvalue{\r!object#1::#2}}
+ \csname\r!object#1::#2\endcsname}
%D Apart from this kind of objects, that have typeset content,
%D we can have low level driver specific objects. Both types
@@ -246,20 +206,27 @@
\newif\ifobjectreferencing \objectreferencingtrue
\def\checkobjectreferences%
- {\bgroup
- \setbox0=\hbox
- {\doutilities{objectreferences}{\jobname}{}{}{}}%
- \global\let\checkobjectreferences=\relax
- \egroup}
-
-\def\setobjectreferences%
+ {\startnointerference
+ \doutilities{objectreferences}\jobname\empty\empty\empty
+ \global\let\checkobjectreferences\relax
+ \stopnointerference}
+
+% \def\setobjectreferences
+% {\def\objectreference##1##2##3%
+% {\doifundefinedelse{\r!driver##1::##2}
+% {\setxvalue{\r!driver##1::##2}{##3}}
+% {\showmessage{\m!references}{31}{[##1 ##2=>##3]}}}}
+
+\def\setobjectreferences
{\def\objectreference##1##2##3%
- {\doifundefinedelse{\r!driver##1::##2}
- {\setxvalue{\r!driver##1::##2}{##3}}
- {\showmessage{\m!references}{31}{[##1 ##2=>##3]}}}}
+ {\ifundefined{\r!driver##1::##2}%
+ \setxvalue{\r!driver##1::##2}{##3}%
+ \else
+ \showmessage{\m!references}{31}{[##1 ##2=>##3]}%
+ \fi}}
-\def\resetobjectreferences%
- {\let\objectreference=\gobblethreearguments}
+\def\resetobjectreferences
+ {\let\objectreference\gobblethreearguments}
\resetobjectreferences
@@ -267,7 +234,7 @@
{\checkobjectreferences
\ifobjectreferencing
\bgroup
- \edef\dowritereference%
+ \edef\dowritereference% why not immediate ?
{\writeutilitycommand{\objectreference{#1}{#2}{#3}}}%
\dowritereference
\egroup
@@ -278,12 +245,21 @@
\def\defaultobjectreference#1#2{0}
+% \def\dogetobjectreference#1#2#3%
+% {\checkobjectreferences
+% \doifdefinedelse{\r!driver#1::#2}
+% {\@EA\xdef\@EA#3\@EA{\csname\r!driver#1::#2\endcsname}}
+% {\showmessage{\m!references}{30}{[#1 #2=>\defaultobjectreference{#1}{#2}]}%
+% \xdef#3{\defaultobjectreference{#1}{#2}}}}
+
\def\dogetobjectreference#1#2#3%
{\checkobjectreferences
- \doifdefinedelse{\r!driver#1::#2}
- {\@EA\xdef\@EA#3\@EA{\csname\r!driver#1::#2\endcsname}}
- {\showmessage{\m!references}{30}{[#1 #2=>\defaultobjectreference{#1}{#2}]}%
- \xdef#3{\defaultobjectreference{#1}{#2}}}}
+ \ifundefined{\r!driver#1::#2}%
+ \showmessage{\m!references}{30}{[#1 #2=>\defaultobjectreference{#1}{#2}]}%
+ \xdef#3{\defaultobjectreference{#1}{#2}}%
+ \else
+ \global\@EA\let\@EA#3\csname\r!driver#1::#2\endcsname
+ \fi}
\def\setobject {\global\objectreferencingfalse\dosetobject1}
\def\settightobject{\global\objectreferencingfalse\dosetobject0}
@@ -299,12 +275,43 @@
%D \doifobjectreferencefoundelse{class}{object}{do then}{do else}
%D \stoptypen
-\def\doifobjectfoundelse#1#2#3#4%
- {\doifundefinedelse{\r!object#1::#2}{#4}{#3}}
+\beginTEX
+
+\def\doifobjectfoundelse#1#2%
+ {\@EA\ifx\csname\r!object#1::#2\endcsname\relax
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\def\doifobjectreferencefoundelse#1#2%
+ {\checkobjectreferences
+ \@EA\ifx\csname\r!driver#1::#2\endcsname\relax
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\endTEX
+
+\beginETEX
-\def\doifobjectreferencefoundelse#1#2#3#4%
+\def\doifobjectfoundelse#1#2%
+ {\ifcsname\r!object#1::#2\endcsname
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\def\doifobjectreferencefoundelse#1#2%
{\checkobjectreferences
- \doifundefinedelse{\r!driver#1::#2}{#4}{#3}}
+ \ifcsname\r!driver#1::#2\endcsname
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\endETEX
%D \macros
%D {doifobjectssupportedelse}
@@ -322,11 +329,11 @@
\newif\ifobjectssupported \objectssupportedtrue
-\def\doifobjectssupportedelse#1#2%
+\def\doifobjectssupportedelse
{\ifobjectssupported
- \doifspecialavailableelse\doinsertobject{#1}{#2}%
+ \@EA\doifspecialavailableelse\@EA\doinsertobject
\else
- #2%
+ \@EA\secondoftwoarguments
\fi}
%D There is a conceptual problem here. Objects are not possible
@@ -335,6 +342,4 @@
%D support objects while we still want to be able to use the
%D \DVI\ output.
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex
index b6279d7db..b67c1e4e1 100644
--- a/tex/context/base/core-par.tex
+++ b/tex/context/base/core-par.tex
@@ -105,6 +105,10 @@
\setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}%
\fi}
+\long\def\directskipparagraph#1%
+ {\doglobal\increment\totalnofparagraphs
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}}
+
\def\dopushparagraphs#1%
{\global\let\mostrecentparagraphtotal=\totalnofparagraphs
\ifx#1\undefined
diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex
index 6d00fb8db..65773bcf4 100644
--- a/tex/context/base/core-pos.tex
+++ b/tex/context/base/core-pos.tex
@@ -101,7 +101,8 @@
{\dosetpositionnm\@@posp{#2}%
\dosetpositionpt\@@posx{#3}%
\dosetpositionpt\@@posy{#4}%
- \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy}}%
+ %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy}}%
+ \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy}}%
\def\setpospxywhd#1#2#3#4#5#6#7%
{\dosetpositionnm\@@posp{#2}%
@@ -110,7 +111,9 @@
\dosetpositionpt\@@posw{#5}%
\dosetpositionpt\@@posh{#6}%
\dosetpositionpt\@@posd{#7}%
- \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}%
+ %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}%
+ \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}%
+
\def\setpospxyplus#1#2#3#4#5#6#7#8%
{\dosetpositionnm\@@posp{#2}%
@@ -119,7 +122,8 @@
\dosetpositionpt\@@posw{#5}%
\dosetpositionpt\@@posh{#6}%
\dosetpositionpt\@@posd{#7}%
- \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}}
+ %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}}
+ \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}}
%D We need to initialize.
@@ -235,6 +239,17 @@
\@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,0,0,0,0\relax
\fi}
+\beginETEX
+
+\def\doMPxyhdwlr#1#2% evt kan \s!unknown leeg zijn
+ {\@EA\@EA\@EA#1\csname\POSprefix
+ \ifcsname\POSprefix#2\endcsname#2\else\s!unknown\fi\endcsname
+ ,0,0,0,0\relax}
+
+\setvalue{\POSprefix\s!unknown}{0,0,0}
+
+\endETEX
+
%D \macros
%D {MPplus, MPrest, MPv, MPvv}
%D
@@ -263,6 +278,17 @@
\@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,,,,,,,,,\relax{#3}%
\fi}
+% \beginETEX
+%
+% \def\MPdoplus#1#2#3#4%
+% {\ifcsname\POSprefix#2\endcsname
+% \@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,,,,,,,,,\relax{#3}%
+% \else
+% #4%
+% \fi}
+%
+% \endETEX
+
\def\doMPplus#1,#2,#3,#4,#5,#6,%
{\dodoMPplus}
@@ -304,7 +330,7 @@
{\ifpositioning \else
\global\positioningtrue
\dosetpositionpapersize
- {\number\printpapierbreedte}
+ {\number\printpapierbreedte}%
{\number\printpapierhoogte }%
\fi
\doglobal\increment\currentpositions}
@@ -320,12 +346,12 @@
{\initializenextposition
\def\currentposition{#1}%
\dosetpositionwhd
- {#1}
- {\number\wd\nextbox}
- {\number\ht\nextbox}
+ {\currentposition}% {#1}%
+ {\number\wd\nextbox}%
+ {\number\ht\nextbox}%
{\number\dp\nextbox}%
\setbox\positionbox=\box\nextbox
- \dopositionaction{#1}%
+ \dopositionaction\currentposition % {#1}%
\box\positionbox
\hss}}}
@@ -335,13 +361,13 @@
{\initializenextposition
\def\currentposition{#1}%
\dosetpositionplus
- {#1}
- {\number\wd\nextbox}
- {\number\ht\nextbox}
- {\number\dp\nextbox}
+ {\currentposition}% {#1}%
+ {\number\wd\nextbox}%
+ {\number\ht\nextbox}%
+ {\number\dp\nextbox}%
{#2}%
\setbox\positionbox=\box\nextbox
- \dopositionaction{#1}%
+ \dopositionaction\currentposition % {#1}%
\box\positionbox
\hss}}}
@@ -402,8 +428,15 @@
%D \doifpositionelse {identifier} {found action} {not found action}
%D \stoptypen
+% \def\doifpositionelse#1%
+% {\doifdefinedelse{\POSprefix#1}}
+
\def\doifpositionelse#1%
- {\doifdefinedelse{\POSprefix#1}}
+ {\ifundefined{\POSprefix#1}%
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
%D We have now arrived at a few macros that would make sense as
%D support macros, but ended up in the core.
@@ -442,14 +475,14 @@
% \rlap{#2\box0}}}
\def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces}
-\def\epos#1{\ifhmode\unskip\fi\hpos{e:#1}{\strut}}
+\def\epos#1{\removelastspace\hpos{e:#1}{\strut}}
\def\fpos#1%
{\setpositionplus{b:#1}{\parposcounter}\hbox{\strut}%
\ignorespaces}
\def\tpos#1%
- {\ifhmode\unskip\fi
+ {\removelastspace
\setpositionplus{e:#1}{\parposcounter}\hbox{\strut}}
\def\ffpos#1%
@@ -457,7 +490,7 @@
\ignorespaces}
\def\ttpos#1%
- {\ifhmode\unskip\fi
+ {\removelastspace
\setpositionbox{e:#1}\hbox{\strut}}
\def\wpos#1%
@@ -486,11 +519,17 @@
% we can check for used entries, and if not, then not add one
\def\registerparoptions%
- {\ifinpagebody \else \ifpositioning \ifpositioningpar
- \ifmmode \else \ifinformula \else
- \doregisterparoptions
- \fi \fi
- \fi \fi \fi}
+ {\ifpositioningpar
+ \ifpositioning
+ \ifinpagebody \else
+ \ifmmode \else
+ \ifinformula \else
+ \doregisterparoptions
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
\def\doregisterparoptions%
{\doglobal\increment\parposcounter
@@ -542,13 +581,13 @@
\fi\fi
\fi}%
\dimen 0=\MPx{#1}%
- \dimen 2=\MPx{#1}\advance\dimen 2 by \MPw{#1}%
- \dimen 4=\MPy{#1}\advance\dimen 4 by -\MPd{#1}%
- \dimen 6=\MPy{#1}\advance\dimen 6 by \MPh{#1}%
+ \dimen 2=\MPx{#1}\advance\dimen 2 \MPw{#1}%
+ \dimen 4=\MPy{#1}\advance\dimen 4 -\MPd{#1}%
+ \dimen 6=\MPy{#1}\advance\dimen 6 \MPh{#1}%
\dimen10=\MPx{#2}%
- \dimen12=\MPx{#2}\advance\dimen12 by \MPw{#2}%
- \dimen14=\MPy{#2}\advance\dimen14 by -\MPd{#2}%
- \dimen16=\MPy{#2}\advance\dimen16 by \MPh{#2}%
+ \dimen12=\MPx{#2}\advance\dimen12 \MPw{#2}%
+ \dimen14=\MPy{#2}\advance\dimen14 -\MPd{#2}%
+ \dimen16=\MPy{#2}\advance\dimen16 \MPh{#2}%
%\message{\the\dimen 0-\the\dimen 2,\the\dimen 4-\the\dimen 6}\wait
%\message{\the\dimen10-\the\dimen12,\the\dimen14-\the\dimen16}\wait
\check04\check24\check26\check06\ifdone\egroup#3\else\egroup#4\fi
@@ -600,12 +639,12 @@
\def\placepositionanchors% todo : depth pagebox
{\ifpositioning
- \setbox\scratchbox=\vbox to \teksthoogte
+ \setbox\scratchbox\vbox to \teksthoogte
{\topskipcorrection
\hbox{\strut\dopositionaction\headanchor}%
\vfill
\hbox{\strut\dopositionaction\tailanchor}}%
- \dp\scratchbox=\zeropoint
+ \dp\scratchbox\zeropoint
\hpos\textanchor{\box\scratchbox}%
\else
\vskip\teksthoogte
@@ -618,33 +657,36 @@
\def\headanchor{head:\realfolio} % virtual position
\def\tailanchor{tail:\realfolio} % virtual position
-\def\presetpositionanchors% compatibility hack
+\def\presetpositionanchors% compatibility hack (still needed?)
{\ifpositioning
- \bgroup
- \dimen0=\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi
- \dimen2=\MPy\textanchor
- \dimen4=\dimen2
- \advance\dimen2 \MPh\textanchor % space is essential
- \advance\dimen2 -\dimen0
- \advance\dimen4 \dp\strutbox
- \dimen6=\MPx\textanchor
- \dimen8=\MPw\textanchor
- \setxvalue{\POSprefix\headanchor}%
- {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen2},%
- \withoutpt{\the\dimen8},\withoutpt{\the\dimen0},\withoutpt{\the\dp\strutbox}}%
- \setxvalue{\POSprefix\tailanchor}%
- {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen4},%
- \withoutpt{\the\dimen8},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}%
- % \showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait
- \egroup
+ \dopresetpositionanchors
\fi}
+\def\dopresetpositionanchors
+ {\bgroup
+ \dimen0=\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi
+ \dimen2=\MPy\textanchor
+ \dimen4=\dimen2
+ \advance\dimen2 \MPh\textanchor % space is essential
+ \advance\dimen2 -\dimen0
+ \advance\dimen4 \dp\strutbox
+ \dimen6=\MPx\textanchor
+ \dimen8=\MPw\textanchor
+ \setxvalue{\POSprefix\headanchor}%
+ {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen2},%
+ \withoutpt{\the\dimen8},\withoutpt{\the\dimen0},\withoutpt{\the\dp\strutbox}}%
+ \setxvalue{\POSprefix\tailanchor}%
+ {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen4},%
+ \withoutpt{\the\dimen8},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}%
+ %\showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait
+ \egroup}
+
\def\showanchor#1%
{\expanded{\writestatus{#1}
{\MPp{#1}\string|\MPx{#1}\string|\MPy{#1}\string|%
\MPw{#1}\string|\MPh{#1}\string|\MPd{#1}}}}
-%D We set these anchors befor and after each page.
+%D We set these anchors before and after each page.
\appendtoks \presetpositionanchors \to \beforeeverypage
\appendtoks \presetpositionanchors \to \aftereverypage
@@ -699,7 +741,7 @@
%D
%D \typebuffer[graphic]
-\def\MPanchoridentifier{mp-anchor}
+\def\MPanchoridentifier{mp-anchor} % {MPA} % {mp-anchor}
\def\MPoverlayposprefix{MO::}
\long\def\defineMPpositiongraphic#1%
@@ -772,7 +814,7 @@
{\handlepositionaction\dohandlepositionboxes\with{#1}{#2}{#3}\on{#2}}
\def\doinsertpositionboxes#1#2#3% pos tag setups
- {\ifnum\MPp{#1}=\realpageno
+ {\ifnum\MPp{#1}=\realpageno\relax
% \doifdefined{\MPoverlayposprefix#1}
% {\getvalue{\MPoverlayposprefix#1}{#1}{#2}{#3}}%
\executeifdefined{\MPoverlayposprefix#1}%
@@ -832,7 +874,7 @@
\def\doMPpositiongraphic##1##2{\getvalue{MPG:##1}}% temp hack
\setbox\positiongraphicbox=\hbox
{\doifdefinedelse{MPM:#1} % method
- {\ignorespaces\getvalue{MPM:#1}\unskip}
+ {\ignorespaces\getvalue{MPM:#1}\removelastspace}
{\getvalue{MPG:#1}}}%
\smashbox\positiongraphicbox
\box\positiongraphicbox
@@ -857,7 +899,7 @@
{\handlepositionaction\dohandleMPpositiongraphic\with{#1}{#2}{#3}\on{#2}}
\def\doinsertMPpositiongraphic#1#2#3% pos tag setups
- {\ifnum\MPp{#1}=\realpageno % extra saveguard
+ {\ifnum\MPp{#1}=\realpageno\relax % extra saveguard
\def\currentposition{#1}\MPpositiongraphic{#2}{#3}%
\fi}
@@ -891,9 +933,9 @@
\def\doinsertMPpositiongraphicrange#1#2#3#4% pos tag setups
{\donefalse
- \ifnum\MPp{#1}=\realpageno \donetrue
- \else\ifnum\MPp{#2}=\realpageno \donetrue
- \else\ifnum\MPp{#1}<\realpageno\ifnum\MPp{#2}>\realpageno \donetrue
+ \ifnum\MPp{#1}=\realpageno\relax \donetrue
+ \else\ifnum\MPp{#2}=\realpageno\relax \donetrue
+ \else\ifnum\MPp{#1}<\realpageno\relax\ifnum\MPp{#2}>\realpageno\donetrue
\fi\fi\fi\fi \ifdone
\def\currentposition{#1}\MPpositiongraphic{#3}{#4}%
\fi}
@@ -987,30 +1029,30 @@
boxlineradius := \MPvar{lineradius} ;
\stopuseMPgraphic
-\startMPpositionmethod{mpos:par}
- \doifpositionelse{w:\MPvar{self}}
- {\startMPpositiongraphic{mpos:par}%
- {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
- initialize_area_par(\MPpos{b:\MPvar{self}},
- \MPpos{e:\MPvar{self}},
- \MPpos{w:\MPvar{self}}) ;
- \includeMPgraphic{mpos:par:setup} ;
- \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ;
- anchor_par(\MPanchor{b:\MPvar{self}}) ;
- \stopMPpositiongraphic}
- {\startMPpositiongraphic{mpos:par}%
- {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
- initialize_par(\MPpos{b:\MPvar{self}},
- \MPpos{e:\MPvar{self}},
- \MPpos{text:\realfolio},
- \MPpos{p:\parcounter},
- \MPvv {p:\parcounter}{0,0,0,0,0,0}) ;
- \includeMPgraphic{mpos:par:setup} ;
- \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ;
- anchor_par(\MPanchor{b:\MPvar{self}}) ;
- \stopMPpositiongraphic}%
- \MPpositiongraphic{mpos:par}{}%
-\stopMPpositionmethod
+% \startMPpositionmethod{mpos:par}
+% \doifpositionelse{w:\MPvar{self}}
+% {\startMPpositiongraphic{mpos:par}%
+% {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+% initialize_area_par(\MPpos{b:\MPvar{self}},
+% \MPpos{e:\MPvar{self}},
+% \MPpos{w:\MPvar{self}}) ;
+% \includeMPgraphic{mpos:par:setup} ;
+% \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ;
+% anchor_par(\MPanchor{b:\MPvar{self}}) ;
+% \stopMPpositiongraphic}
+% {\startMPpositiongraphic{mpos:par}%
+% {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+% initialize_par(\MPpos{b:\MPvar{self}},
+% \MPpos{e:\MPvar{self}},
+% \MPpos{text:\realfolio},
+% \MPpos{p:\parcounter},
+% \MPvv {p:\parcounter}{0,0,0,0,0,0}) ;
+% \includeMPgraphic{mpos:par:setup} ;
+% \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ;
+% anchor_par(\MPanchor{b:\MPvar{self}}) ;
+% \stopMPpositiongraphic}%
+% \MPpositiongraphic{mpos:par}{}%
+% \stopMPpositionmethod
%D Less readable but shorter.
@@ -1116,7 +1158,7 @@
\dodostarttextbackground}
\def\dopresettextbackground#1%
- {\ExpandFirstAfter\processaction
+ {\ExpandFirstAfter\processaction % \EFA niet echt nodig
[\getvalue{\??td#1\c!plaats}]
[ \v!tekst=>\let\dodostarttextbackground\dostarttextbackgroundtxt
\let\dodostoptextbackground \dostoptextbackgroundtxt,
@@ -1273,15 +1315,29 @@
\def\setuptextbackground%
{\dodoubleargument\dosetuptextbackground}
+%\def\dosetuptextbackground[#1][#2]%
+% {\ifsecondargument
+% \getparameters[\??td#1][#2]%
+% \def\currenttextbackground{#1}%
+% \doifvalue{\??td#1\c!status}{\v!start}{\checktextbackgrounds}%
+% \else
+% \setuptextbackground[][#1]%
+% \fi}
+
\def\dosetuptextbackground[#1][#2]%
{\ifsecondargument
- \getparameters[\??td#1][#2]%
- \def\currenttextbackground{#1}%
- \doifvalue{\??td#1\c!status}{\v!start}{\checktextbackgrounds}%
+ \doifelsenothing{#1}
+ {\dodosetuptextbackground{#2}\empty}
+ {\processcommalist[#1]{\dodosetuptextbackground{#2}}}%
\else
- \setuptextbackground[][#1]%
+ \dodosetuptextbackground{#1}\empty
\fi}
+\def\dodosetuptextbackground#1#2%
+ {\getparameters[\??td#2][#1]%
+ \def\currenttextbackground{#2}%
+ \doifvalue{\??td#2\c!status}{\v!start}{\checktextbackgrounds}}
+
\let\currenttextbackground\empty
\def\checktextbackgrounds
diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex
index 8c17146a7..7fe973205 100644
--- a/tex/context/base/core-ref.tex
+++ b/tex/context/base/core-ref.tex
@@ -8,18 +8,13 @@
%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 / Cross Referencing}
-% DUE TO NEW/FUTURE FEATURES THIS MODULE IS UNDER RECONSTRUCTION !
-%
-% uitprinten
-% engels maken
-% rommel voorlopig naar core-int/core-nav
-% programma, profiel etc als methode
-% \macro toevoegen
+% todo : unknown/illegal reference no arg
+% todo : +n pages check on 'samepage' (contrastcolor)
% Makes more sense to build action data first, especially now
% openaction etc are supported.
@@ -37,9 +32,9 @@
% rt!list -> \definereference
% rt!exec -> \definereference
%
-% but for the moment will not do so, if only because
-% the current implementation permits us to determine
-% the page state and is also more efficient
+% but for the moment will not do so, if only because
+% the current implementation permits us to determine
+% the page state and is also more efficient
\unprotect
@@ -150,17 +145,13 @@
\def\textreference {\dosingleargument\dotextreference}
\def\pagereference {\dosingleargument\dopagereference}
-\def\reference {\dosingleargument\doreference}
+\def\reference {\dosingleargument\doreference }
%D These are implemented in a low level form as:
-% \def\dotextreference[#1]#2{\rawtextreference{\s!txt}{#1}{#2}}
-% \def\dopagereference [#1]{\rawpagereference{\s!pag}{#1}}
-% \def\doreference [#1]#2{\rawreference {\s!ref}{#1}{#2}}
-
-\def\dotextreference[#1]{\rawtextreference\s!txt{#1}} % #2
+\def\dotextreference[#1]{\rawtextreference\s!txt{#1}} % #2
\def\dopagereference[#1]{\rawpagereference\s!pag{#1}}
-\def\doreference [#1]{\rawreference \s!ref{#1}} % #2
+\def\doreference [#1]{\rawreference \s!ref{#1}} % #2
%D Actually there is not much difference between a text and a
%D full reference, but it's the concept that counts. The low
@@ -171,18 +162,14 @@
\the\everyreference
\makesectionformat
\writereference{#2}
- {\sectionformat::\noexpand\pagenumber}
- {\noexpand\realfolio}
- {}%
+ {\sectionformat::\noexpand\pagenumber}{\noexpand\realfolio}{}%
\egroup}
\def\rawtextreference#1#2#3%
{\bgroup
\the\everyreference
\writereference{#2}
- {}
- {\noexpand\realfolio}
- {#3}%
+ {}{\noexpand\realfolio}{#3}%
\egroup}
\def\rawreference#1#2#3%
@@ -190,9 +177,7 @@
\the\everyreference
\makesectionformat
\writereference{#2}
- {\sectionformat::\noexpand\pagenumber}
- {\noexpand\realfolio}
- {#3}%
+ {\sectionformat::\noexpand\pagenumber}{\noexpand\realfolio}{#3}%
\egroup}
%D As we can see, these macros depend on three other ones,
@@ -209,8 +194,8 @@
\newevery \everyreference \relax
-%D This is really needed, since for instance Polish has a
-%D different alphabet and needs accented entries in registers.
+%D This is really needed, since for instance Polish has a
+%D different alphabet and needs accented entries in registers.
\appendtoks
\def\dohandleaccent #1#2{\string#1\string#2}%
@@ -256,21 +241,32 @@
\newcount\crossreferencenumber \crossreferencenumber=1
+% \def\writereference#1#2#3#4%
+% {\ifreferencing
+% \doifsomething{#1}
+% {\def\dowritereference##1%
+% {\xdef\lastreference{##1}%
+% \@EA\dodowritereference\lastreference\empty\empty\end
+% {#2}{#3}{#4}}%
+% \processcommalist[#1]\dowritereference}%
+% \fi}
+
\def\writereference#1#2#3#4%
{\ifreferencing
- \doifsomething{#1}
- {\def\dowritereference##1%
- {\xdef\lastreference{##1}%
- \@EA\dodowritereference\lastreference\empty\empty\end
- {#2}{#3}{#4}}%
- \processcommalist[#1]\dowritereference}%
+ \edef\!!stringa{#1}%
+ \ifx\!!stringa\empty \else
+ \def\dowritereference##1%
+ {\def\lastreference{##1}%
+ \@EA\dodowritereference\lastreference\empty\empty\end{#2}{#3}{#4}}%
+ \rawprocesscommalist[\!!stringa]\dowritereference
+ \fi
\fi}
\def\dodowritereference#1#2#3\end#4#5#6%
{\bgroup
- \global\advance\crossreferencenumber by 1
+ \global\advance\crossreferencenumber 1
\if#1-\if#2:%
- \let\referenceprefix=\empty
+ \let\referenceprefix\empty
\xdef\lastreference{#3}%
\else
\xdef\lastreference{#1#2#3}%
@@ -278,10 +274,10 @@
\xdef\lastreference{#1#2#3}%
\fi
\ifx\lastreference\empty \else
- \doiffirstreferenceoccurance{\lastreference}
+ \doiffirstreferenceoccurance\lastreference
{\thisisdestination{\referenceprefix\lastreference}}%
- \@EA\referentieinfo\@EA>\@EA{\lastreference}%
- \edef\dododowritereference%
+ \referentieinfo>\lastreference
+ \edef\dododowritereference
{\writeutilitycommand
{\mainreference{\referenceprefix}{\lastreference}{#4}{#5}{#6}}}%
\dododowritereference
@@ -315,8 +311,8 @@
%D such a pain, that another approach is feasible. By setting
%D the \type {autofile} variable to \type {yes} or \type
%D {page}, you can access the reference directly. The latter
-%D case nills the prefix method, thereby saving some memory.
-%D
+%D case nills the prefix method, thereby saving some memory.
+%D
%D \starttabulatie[||||]
%D \NC filename::tag \NC page(filename::pnum) \NC tag \NC\NR
%D \NC $\star$ \NC \NC \NC\NR
@@ -326,28 +322,51 @@
\chardef\autocrossfilereferences=0
+% \def\setreferences% some day, filename will be stored in ref record
+% {\the\everyreference % we're grouped anyway
+% \def\mainreference##1##2##3##4##5%
+% {\doifundefinedelse{\r!cross\fileprefix##1##2}
+% {\ifcase\autocrossfilereferences
+% \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
+% \or
+% \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
+% \doifundefinedelse{\r!cross##1##2}
+% {\expanded{\definereference[##1##2][\fileprefix##1##2]}}
+% {\showmessage{\m!references}{2}{[##1][##2],##4 (auto \currentutilityfilename)}}%
+% \or
+% \doifundefinedelse{\r!cross##1##2}
+% {\expanded{\definereference[##1##2][\noexpand\v!pagina(\fileprefix##4)]}}
+% {\showmessage{\m!references}{2}{[##1][##2],##4 (auto \currentutilityfilename)}}%
+% \fi}
+% {\ifcase0##4\else
+% \showmessage{\m!references}{2}{[##1][##2],##4 (\currentutilityfilename)}%
+% \fi}}}
+
+% optimizing this one makes sense when we have docs with 10K
+% refs.
+
\def\setreferences% some day, filename will be stored in ref record
{\the\everyreference % we're grouped anyway
- \def\mainreference##1##2##3##4##5%
- {\doifundefinedelse{\r!cross\fileprefix##1##2}
- {\ifcase\autocrossfilereferences
- \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
- \or
- \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
- \doifundefinedelse{\r!cross##1##2}
- {\expanded{\definereference[##1##2][\fileprefix##1##2]}}
- {\showmessage{\m!references}{2}{[##1][##2],##4 (auto \currentutilityfilename)}}%
- \or
- \doifundefinedelse{\r!cross##1##2}
- {\expanded{\definereference[##1##2][\noexpand\v!pagina(\fileprefix##4)]}}
- {\showmessage{\m!references}{2}{[##1][##2],##4 (auto \currentutilityfilename)}}%
- \fi}
- {\ifcase0##4\else
- \showmessage{\m!references}{2}{[##1][##2],##4 (\currentutilityfilename)}%
- \fi}}}
-
-\def\resetreferences%
- {\let\mainreference=\gobblefivearguments}
+ \def\mainreference##1##2##3##4##5% can be made faster by indirect calls
+ {\ifundefined{\r!cross\fileprefix##1##2}% \ifcsname\r!cross\fileprefix##1##2\endcsname
+ \ifcase\autocrossfilereferences
+ \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
+ \or
+ \setglobalcrossreference{##1##2}{##3}{##4}{##5}%
+ \doifundefinedelse{\r!cross##1##2}
+ {\expanded{\definereference[##1##2][\fileprefix##1##2]}}
+ {\showmessage\m!references2{[##1][##2],##4 (auto \currentutilityfilename)}}%
+ \or
+ \doifundefinedelse{\r!cross##1##2}
+ {\expanded{\definereference[##1##2][\noexpand\v!pagina(\fileprefix##4)]}}
+ {\showmessage\m!references2{[##1][##2],##4 (auto \currentutilityfilename)}}%
+ \fi
+ \else\ifcase0##4\else
+ \showmessage\m!references2{[##1][##2],##4 (\currentutilityfilename)}%
+ \fi\fi}}
+
+\def\resetreferences
+ {\let\mainreference\gobblefivearguments}
\resetreferences
@@ -365,12 +384,12 @@
\newtoks\everycheckreferences
-%D When we load references, the file name is stored in a
-%D list.
+%D When we load references, the file name is stored in a
+%D list.
-\let\loadedreferences\empty
+\let\loadedreferences\empty
-%D We only load references ones.
+%D We only load references ones.
\newconditional\jobreferencesloaded
@@ -390,14 +409,14 @@
% \def\usereferences[#1]%
% {\bgroup
-% \checkreferences % Load job ones first!
+% \checkreferences % Load job ones first!
% \setbox0=\hbox
% {\doonlyonce{references:#1}{\doutilities{references}{#1}{}{}{}}}%
% \egroup}
\def\usereferences[#1]%
{\bgroup\setbox\scratchbox=\hbox\bgroup
- \checkreferences
+ \checkreferences
\doifparentfileelse{#1}
{\ifconditional\jobreferencesloaded\else
\doutilities{references}{#1}{}{}{}%
@@ -449,20 +468,24 @@
\newcount\crossreferenceorder
+% these are used often so we sped them up
+
\def\setlocalcrossreference#1#2#3#4%
- {\toks0={#4}%
- \setevalue{\r!cross\fileprefix#1}{\rt!cross{#2}{#3}{\the\toks0}{0}}}
+ {\scratchtoks{#4}%
+ \@EA\edef\csname\r!cross\fileprefix#1\endcsname
+ {\rt!cross{#2}{#3}{\the\scratchtoks}{0}}}
\def\setglobalcrossreference#1#2#3#4%
- {\toks0={#4}%
- \global\advance\crossreferenceorder by 1
- \setxvalue{\r!cross\fileprefix#1}{\rt!cross{#2}{#3}{\the\toks0}{\the\crossreferenceorder}}}
+ {\scratchtoks{#4}%
+ \global\advance\crossreferenceorder 1
+ \@EA\xdef\csname\r!cross\fileprefix#1\endcsname
+ {\rt!cross{#2}{#3}{\the\scratchtoks}{\the\crossreferenceorder}}}
\def\setlocalsystemreference#1#2#3%
- {\setevalue{\r!cross\fileprefix#2}{#1{#3}}}
+ {\@EA\edef\csname\r!cross\fileprefix#2\endcsname{#1{#3}}}
\def\setglobalsystemreference#1#2#3%
- {\setxvalue{\r!cross\fileprefix#2}{#1{#3}}}
+ {\@EA\xdef\csname\r!cross\fileprefix#2\endcsname{#1{#3}}}
% Maybe I need this some day.
@@ -475,7 +498,7 @@
% \getvalue{\r!cross\fileprefix#2}%
% \egroup}
-\def\copycrossreference#1#2#3% file from to
+\def\copycrossreference#1#2#3% file from to / slow
{\bgroup
\doifelse{#1}{}
{\let\fileprefix\empty}
@@ -492,8 +515,8 @@
\def\setoutercrossreference#1#2#3#4%
{\toks0={#4}%
- \setxvalue{\r!cross\fileprefix}{\rt!cross{}{}{1}{0}}%
- \setxvalue{\r!cross\fileprefix#1}{\rt!cross{#2}{#3}{\the\toks0}{0}}}
+ \@EA\xdef\csname\r!cross\fileprefix \endcsname{\rt!cross{}{}{1}{0}}%
+ \@EA\xdef\csname\r!cross\fileprefix#1\endcsname{\rt!cross{#2}{#3}{\the\toks0}{0}}}
%D In practice accessing a reference comes down to:
%D
@@ -514,10 +537,10 @@
%D When we filter the content, next macros are set when we
%D meet a normal cross reference:
-\let\currentrealreference=\empty
-\let\currentpagereference=\empty
-\let\currenttextreference=\empty
-\let\currentsubtextreference=\empty
+\let\currentrealreference =\empty
+\let\currentpagereference =\empty
+\let\currenttextreference =\empty
+\let\currentsubtextreference =\empty
\let\currentsubsubtextreference=\empty
%D System references only have one component:
@@ -531,9 +554,12 @@
%\def\getreferenceelements#1%
% {\edef\referenceelements{\getvalue{\r!cross\referenceprefix#1}}%
% \expandafter\dogetreferenceelements\referenceelements{}{}{}{}}
+%
+%\def\getreferenceelements#1% only one level expansion permitted!
+% {\@EA\@EA\@EA\dogetreferenceelements\csname\r!cross\referenceprefix#1\endcsname{}{}{}{}}
\def\getreferenceelements#1% only one level expansion permitted!
- {\@EA\@EA\@EA\dogetreferenceelements\csname\r!cross\referenceprefix#1\endcsname{}{}{}{}}
+ {\@EA\@EA\@EA\dogetreferenceelements\csname\r!cross\referenceprefix#1\endcsname\empty\empty\empty\empty}
%D In the following step, the \type{\ifx#1} test is needed
%D because we can access this macro directly, and therefore
@@ -590,9 +616,9 @@
\ifx\referencepagenumber\undefined
- \def\referencepagenumber[#1]{?}
+ \def\referencepagenumber[#1]{?}
-\fi
+\fi
%D Text references can contain more than one entry and
%D therefore we check for
@@ -644,24 +670,51 @@
%D meaning of the original cross reference. In fact,
%D \type{\rt!cross} is toggled to \type{\rt!done}.
-\def\doiffirstreferenceoccurance#1#2%
- {\ifcheckduplicatereferences
- \doifundefinedelse{\r!cross\referenceprefix#1}
- {#2}
- {\getreferenceelements{#1}%
- \ifnum\currentreferencetype=\rt!cross
- #2%
- \bgroup
- \def\rt!cross##1##2##3##4%
- {\setgvalue{\r!cross\referenceprefix#1}%
- {\rt!done{##1}{##2}{##3}{##4}}}%
- \getvalue{\r!cross\referenceprefix#1}%
- \egroup
- \fi}%
+% \def\doiffirstreferenceoccurance#1#2%
+% {\ifcheckduplicatereferences
+% \doifundefinedelse{\r!cross\referenceprefix#1}
+% {#2}
+% {\getreferenceelements{#1}%
+% \ifnum\currentreferencetype=\rt!cross
+% #2%
+% \bgroup
+% \def\rt!cross##1##2##3##4%
+% {\setgvalue{\r!cross\referenceprefix#1}%
+% {\rt!done{##1}{##2}{##3}{##4}}}%
+% \getvalue{\r!cross\referenceprefix#1}%
+% \egroup
+% \fi}%
+% \else
+% #2%
+% \fi}
+
+\def\rt!crossdone#1#2#3#4{\rt!done{#1}{#2}{#3}{#4}}
+
+\def\dohandleduplicatereference#1%
+ {\bgroup
+ \let\rt!cross\rt!crossdone
+ \@EA\xdef\csname\r!cross\referenceprefix#1\endcsname
+ {\csname\r!cross\referenceprefix#1\endcsname}%
+ \egroup}
+
+\def\checkfirstreferenceoccurance#1#2%
+ {\ifcsname\r!cross\referenceprefix#1\endcsname
+ \getreferenceelements{#1}%
+ \ifnum\currentreferencetype=\rt!cross
+ \dohandleduplicatereference{#1}%
+ #2%
+ \fi
\else
#2%
\fi}
+\def\doiffirstreferenceoccurance
+ {\ifcheckduplicatereferences
+ \@EA\checkfirstreferenceoccurance
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
%D We still have to test for the existence of a reference, but
%D before we come to that, we first look into the way a
%D reference can be accessed. It will be no surprise that
@@ -873,178 +926,266 @@
\def\dodefinereference[#1][#2]%
{\ifsecondargument
\doifelsenothing{#2}
- {\global\letbeundefined{\specialREFidentifier#1}}
- {\setgvalue{\specialREFidentifier#1}{#2}}%
+ {\resetreference[#1]}%
+ {\@EA\gdef\csname\specialREFidentifier#1\endcsname{#2}}%
\else\iffirstargument
- \global\letbeundefined{\specialREFidentifier#1}%
+ \resetreference[#1]%
\fi\fi}
\def\definereference%
{\dodoubleempty\dodefinereference}
+\def\resetreference[#1]%
+ {\global\letbeundefined{\specialREFidentifier#1}}
+
\beginTEX
-\def\dodoifreferencefoundelse#1#2#3%
- {\checkreferences
- \bgroup
- \let\unharmedreferenceprefix=\referenceprefix
- \bgroup
- \splitofffullreference{#1}%
- \ifx\currentreferencespecial\specialREFidentifier
- \@EA\ifx\csname\specialREFidentifier\currentreferenceoperation\endcsname\relax
- \global\referencefoundfalse
- \else
- \global\referencefoundtrue
- \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
- {\csname\specialREFidentifier\currentreferenceoperation\endcsname}%
- \fi
+% \def\dodoifreferencefoundelse#1#2#3%
+% {\checkreferences
+% \bgroup
+% \let\unharmedreferenceprefix=\referenceprefix
+% \bgroup
+% \splitofffullreference{#1}%
+% \ifx\currentreferencespecial\specialREFidentifier
+% \@EA\ifx\csname\specialREFidentifier\currentreferenceoperation\endcsname\relax
+% \global\referencefoundfalse
+% \else
+% \global\referencefoundtrue
+% \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
+% {\csname\specialREFidentifier\currentreferenceoperation\endcsname}%
+% \fi
+% \else
+% \global\referencefoundtrue
+% \fi
+% \ifreferencefound
+% \ifx\currentreferencespecial\empty
+% \ifx\currentouterreference\empty
+% \docheckinnerreference
+% \ifreferencefound \else
+% \checkglobalfilereferences
+% \fi
+% \else
+% \docheckouterreference
+% \fi
+% \ifreferencefound
+% \ifx\currentreferencearguments\empty
+% \getreferenceelements\currentfullreference
+% \else
+% \getreferenceelements\currentinnerreference
+% \fi
+% \fi
+% \else
+% \docheckspecialreference
+% \fi
+% \fi
+% \ifreferencefound \else
+% \let\referenceprefix=\empty
+% \@EA\ifx\csname\specialREFidentifier#1\endcsname\relax\else
+% \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
+% {\csname\specialREFidentifier#1\endcsname}%
+% \ifx\currentreferencespecial\empty
+% \ifx\currentouterreference\empty
+% \docheckinnerreference
+% \ifreferencefound \else
+% \checkglobalfilereferences
+% \fi
+% \else
+% \docheckouterreference
+% \fi
+% \ifreferencefound
+% % \getreferenceelements\currentfullreference
+% \ifx\currentreferencearguments\empty
+% \getreferenceelements\currentfullreference
+% \else
+% \getreferenceelements\currentinnerreference
+% \fi
+% \fi
+% \else
+% \docheckspecialreference
+% \fi
+% \fi
+% \fi
+% \iftracereferences
+% \doshowcurrentreference\space
+% \writestatus{\m!references}{\currentreferenceshow}%
+% \fi
+% \ifreferencefound#2\else#3\fi
+% \egroup
+% \egroup}
+
+\newcount\nofexpandedreferences
+
+\def\dodoexpandreferences#1REF(#2#3)#4\relax
+ {\ifx#2\relax
+ \@EA\ifx\csname\specialREFidentifier#1\endcsname\relax
+ \global\advance\nofexpandedreferences 1
+ \@EA\xdef\csname REF::\number\nofexpandedreferences\endcsname{#1}%
\else
- \global\referencefoundtrue
- \fi
- \ifreferencefound
- \ifx\currentreferencespecial\empty
- \ifx\currentouterreference\empty
- \docheckinnerreference
- \ifreferencefound \else
- \checkglobalfilereferences
- \fi
- \else
- \docheckouterreference
- \fi
- \ifreferencefound
- \ifx\currentreferencearguments\empty
- \getreferenceelements\currentfullreference
- \else
- \getreferenceelements\currentinnerreference
- \fi
- \fi
- \else
- \docheckspecialreference
- \fi
+ \edef\expandedreference{\csname\specialREFidentifier#1\endcsname,}%
\fi
- \ifreferencefound \else
- \let\referenceprefix=\empty
- \@EA\ifx\csname\specialREFidentifier#1\endcsname\relax\else
- \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
- {\csname\specialREFidentifier#1\endcsname}%
- \ifx\currentreferencespecial\empty
- \ifx\currentouterreference\empty
- \docheckinnerreference
- \ifreferencefound \else
- \checkglobalfilereferences
- \fi
- \else
- \docheckouterreference
- \fi
- \ifreferencefound
- \getreferenceelements\currentfullreference
- \fi
- \else
- \docheckspecialreference
- \fi
- \fi
- \fi
- \iftracereferences
- \doshowcurrentreference\space
- \writestatus{\m!references}{\currentreferenceshow}%
+ \else
+ \@EA\ifx\csname\specialREFidentifier#2#3\endcsname\relax
+ % not set
+ \else
+ \edef\expandedreference{\csname\specialREFidentifier#2#3\endcsname,}%
\fi
- \ifreferencefound#2\else#3\fi
- \egroup
- \egroup}
+ \fi}
\endTEX
\beginETEX \ifcsname
-\def\dodoifreferencefoundelse#1#2#3%
- {\checkreferences
- \bgroup
- \let\unharmedreferenceprefix=\referenceprefix
- \bgroup
- \splitofffullreference{#1}%
- \ifx\currentreferencespecial\specialREFidentifier
- \ifcsname\specialREFidentifier\currentreferenceoperation\endcsname
- \global\referencefoundtrue
- \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
- {\csname\specialREFidentifier\currentreferenceoperation\endcsname}%
- \else
- \global\referencefoundfalse
+% \def\dodoifreferencefoundelse#1#2#3%
+% {\checkreferences
+% \bgroup
+% \let\unharmedreferenceprefix=\referenceprefix
+% \bgroup
+% \splitofffullreference{#1}%
+% \ifx\currentreferencespecial\specialREFidentifier
+% \ifcsname\specialREFidentifier\currentreferenceoperation\endcsname
+% \global\referencefoundtrue
+% \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
+% {\csname\specialREFidentifier\currentreferenceoperation\endcsname}%
+% \else
+% \global\referencefoundfalse
+% \fi
+% \else
+% \global\referencefoundtrue
+% \fi
+% \ifreferencefound
+% \ifx\currentreferencespecial\empty
+% \ifx\currentouterreference\empty
+% \docheckinnerreference
+% \ifreferencefound \else
+% \checkglobalfilereferences
+% \fi
+% \else
+% \docheckouterreference
+% \fi
+% \ifreferencefound
+% \ifx\currentreferencearguments\empty
+% \getreferenceelements\currentfullreference
+% \else
+% \getreferenceelements\currentinnerreference
+% \fi
+% \fi
+% \else
+% \docheckspecialreference
+% \fi
+% \fi
+% \ifreferencefound \else
+% \let\referenceprefix=\empty
+% \ifcsname\specialREFidentifier#1\endcsname
+% \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
+% {\csname\specialREFidentifier#1\endcsname}%
+% \ifx\currentreferencespecial\empty
+% \ifx\currentouterreference\empty
+% \docheckinnerreference
+% \ifreferencefound \else
+% \checkglobalfilereferences
+% \fi
+% \else
+% \docheckouterreference
+% \fi
+% \ifreferencefound
+% % \getreferenceelements\currentfullreference
+% \ifx\currentreferencearguments\empty
+% \getreferenceelements\currentfullreference
+% \else
+% \getreferenceelements\currentinnerreference
+% \fi
+% \fi
+% \else
+% \docheckspecialreference
+% \fi
+% \fi
+% \fi
+% \iftracereferences
+% \doshowcurrentreference\space
+% \writestatus{\m!references}{\currentreferenceshow}%
+% \fi
+% \ifreferencefound#2\else#3\fi
+% \egroup
+% \egroup}
+
+\newcount\nofexpandedreferences
+
+\def\dodoexpandreferences#1REF(#2#3)#4\relax
+ {\ifx#2\relax
+ \ifcsname\specialREFidentifier#1\endcsname
+ \edef\expandedreference{\csname\specialREFidentifier#1\endcsname,}%
+ \else
+ \global\advance\nofexpandedreferences 1
+ \@EA\xdef\csname REF::\number\nofexpandedreferences\endcsname{#1}%
+ \fi
+ \else
+ \ifcsname\specialREFidentifier#2#3\endcsname
+ \edef\expandedreference{\csname\specialREFidentifier#2#3\endcsname,}%
+ \else
+ % not set
+ \fi
+ \fi}
+
+\endETEX
+
+\def\doexpandreferences#1,%
+ {\if]#1\else
+ \let\expandedreference\empty
+ \dodoexpandreferences#1REF(\relax)\relax
+ \@EAEAEA\doexpandreferences\@EA\expandedreference
+ \fi}
+
+\def\expandreferences#1%
+ {\global\nofexpandedreferences0
+ \doexpandreferences#1,],}
+
+\def\dodoifreferencefoundelse#1%
+ {\@EA\splitofffullreference\@EA{#1}%
+ \ifx\currentreferencespecial\empty
+ \ifx\currentouterreference\empty
+ \docheckinnerreference
+ \ifreferencefound \else
+ \checkglobalfilereferences
\fi
\else
- \global\referencefoundtrue
+ \docheckouterreference
\fi
\ifreferencefound
- \ifx\currentreferencespecial\empty
- \ifx\currentouterreference\empty
- \docheckinnerreference
- \ifreferencefound \else
- \checkglobalfilereferences
- \fi
- \else
- \docheckouterreference
- \fi
- \ifreferencefound
- \ifx\currentreferencearguments\empty
- \getreferenceelements\currentfullreference
- \else
- \getreferenceelements\currentinnerreference
- \fi
- \fi
+ \ifx\currentreferencearguments\empty
+ \getreferenceelements\currentfullreference
\else
- \docheckspecialreference
- \fi
- \fi
- \ifreferencefound \else
- \let\referenceprefix=\empty
- \ifcsname\specialREFidentifier#1\endcsname
- \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level
- {\csname\specialREFidentifier#1\endcsname}%
- \ifx\currentreferencespecial\empty
- \ifx\currentouterreference\empty
- \docheckinnerreference
- \ifreferencefound \else
- \checkglobalfilereferences
- \fi
- \else
- \docheckouterreference
- \fi
- \ifreferencefound
- \getreferenceelements\currentfullreference
- \fi
- \else
- \docheckspecialreference
- \fi
+ \getreferenceelements\currentinnerreference
\fi
\fi
- \iftracereferences
- \doshowcurrentreference\space
- \writestatus{\m!references}{\currentreferenceshow}%
- \fi
- \ifreferencefound#2\else#3\fi
- \egroup
- \egroup}
-
-\endETEX
+ \else
+ \docheckspecialreference
+ \fi
+ \iftracereferences
+ \doshowcurrentreference\space
+ \writestatus\m!references\currentreferenceshow
+ \fi}
-%D Although this can be considered a hack, we provide the
+%D Although this can be considered a hack, we provide the
%D option to locate unknown references in other (loaded) files.
-%D This can be dangerous, since there can be conflicting
-%D definitions.
+%D This can be dangerous, since there can be conflicting
+%D definitions.
-\newconditional\autoglobalfilereferences
+\newconditional\autoglobalfilereferences
-\def\checkglobalfilereferences%
- {\ifconditional\autoglobalfilereferences
- \processcommacommand[\loadedreferences]\docheckglobalfilereference
+\def\checkglobalfilereferences% sloooow
+ {\ifconditional\autoglobalfilereferences
+% \processcommacommand[\loadedreferences]\docheckglobalfilereference
+ \rawprocesscommalist[\loadedreferences]\docheckglobalfilereference
\fi}
-\def\docheckglobalfilereference#1%
- {\doifdefined{\r!cross#1::\currentinnerreference}
- {\def\currentouterreference{#1}%
- \edef\currentfullreference%
- {\currentouterreference::\currentinnerreference}%
- \global\referencefoundtrue
- \quitcommalist}}
+\def\docheckglobalfilereference#1%
+ {\ifundefined{\r!cross#1::\currentinnerreference}\else
+ \def\currentouterreference{#1}%
+ \edef\currentfullreference%
+ {\currentouterreference::\currentinnerreference}%
+ \global\referencefoundtrue
+ \quitcommalist
+ \fi}
%D For most situations, we could use:
%D
@@ -1078,50 +1219,117 @@
% Aanpassen: eerst alle refs scannen en componenten opslaan in
% lijst, dan de chain doorlopen. Momenteel mag alleen laatste
% laatste undefined zijn, eigenlijk moet dat overal kunnen met
-% 'geen' zonder melding. Is wel trager.
-
-\def\doifreferencefoundelse#1#2#3%
- {\doresetgotowhereever
- \global\secondaryreferencefalse
- {\the\everyreference\xdef\primaryreference{#1}}%
- \global\nofsecondaryreferences=0
- \def\dopreprocessreference##1,%
- {\if]##1\else
- \ifsecondaryreference
- \ifenablereferencechains \iflocation
- {\the\everyreference\xdef\secondaryreference{##1}}%
- %\global\advance\nofsecondaryreferences by 1
- \@EA\dodoifreferencefoundelse\@EA{\secondaryreference}
- {\global\advance\nofsecondaryreferences by 1
- #2}
- {%\global\advance\nofsecondaryreferences by -1
- \dostartnoto#3\dostopnoto}%
- \fi \fi
- \else
- {\the\everyreference\xdef\primaryreference{##1}}%
- \global\secondaryreferencetrue
- \fi
- \expandafter\dopreprocessreference
- \fi}%
- \dopreprocessreference#1,],%
+% 'geen' zonder melding. Is wel trager. Dus niet.
+%
+% \def\doifreferencefoundelse#1#2#3% \@EA niet nodig
+% {\doresetgotowhereever
+% \global\secondaryreferencefalse
+% {\the\everyreference\xdef\primaryreference{#1}}%
+% \global\nofsecondaryreferences=0
+% \def\dopreprocessreference##1,%
+% {\if]##1\else
+% \ifsecondaryreference
+% \ifenablereferencechains \iflocation
+% {\the\everyreference\xdef\secondaryreference{##1}}%
+% %\global\advance\nofsecondaryreferences by 1
+% \@EA\dodoifreferencefoundelse\@EA{\secondaryreference}
+% {\global\advance\nofsecondaryreferences by 1
+% #2}
+% {%\global\advance\nofsecondaryreferences by -1
+% \dostartnoto#3\dostopnoto}%
+% \fi \fi
+% \else
+% {\the\everyreference\xdef\primaryreference{##1}}%
+% \global\secondaryreferencetrue
+% \fi
+% \expandafter\dopreprocessreference
+% \fi}%
+% \dopreprocessreference#1,],%
+% \global\secondaryreferencefalse
+% \@EA\dodoifreferencefoundelse\@EA{\primaryreference}{#2}{#3}%
+% \doresetgotowhereever} % to prevent problems with direct goto's
+
+\def\doifreferencefoundelse#1#2#3% REF \cs
+ {\checkreferences
+ \bgroup
+ \the\everyreference
+ \let\referenceprefix\empty
+ \expandreferences{#1}%
+ \egroup
+ \doresetgotowhereever
+ \global\nofsecondaryreferences 0
+ \ifcase\nofexpandedreferences\relax % #1 can be number -)
+ % no ref
+ \or
+ % one ref
+ \or
+ % two refs
+ \ifenablereferencechains \iflocation
+ \global\secondaryreferencetrue
+ \xdef\secondaryreference{\csname REF::2\endcsname}%
+ \bgroup
+ \let\unharmedreferenceprefix\referenceprefix
+ %\bgroup
+ \dodoifreferencefoundelse\secondaryreference
+ \global\nofsecondaryreferences 1
+ \ifreferencefound
+ #2%
+ \else
+ \dostartnoto#3\dostopnoto
+ \fi
+ %\egroup
+ \egroup
+ \fi \fi
+ \else
+ % more than two refs
+ \ifenablereferencechains \iflocation
+ \global\secondaryreferencetrue
+ \scratchcounter2
+ \loop
+ \xdef\secondaryreference{\csname REF::\number\scratchcounter\endcsname}%
+ \bgroup
+ \let\unharmedreferenceprefix\referenceprefix
+ %\bgroup
+ \dodoifreferencefoundelse\secondaryreference
+ \global\advance\nofsecondaryreferences 1
+ \ifreferencefound
+ #2%
+ \else
+ \global\advance\nofsecondaryreferences -1
+ \dostartnoto#3\dostopnoto
+ \fi
+ %\egroup
+ \egroup
+ \ifnum\scratchcounter<\nofexpandedreferences\relax
+ \advance\scratchcounter 1
+ \repeat
+ \fi \fi
+ \fi
\global\secondaryreferencefalse
- \@EA\dodoifreferencefoundelse\@EA{\primaryreference}{#2}{#3}%
+ \xdef\primaryreference{\csname REF::1\endcsname}%
+ \bgroup
+ \let\unharmedreferenceprefix\referenceprefix
+ %\bgroup
+ \dodoifreferencefoundelse\primaryreference
+ \ifreferencefound#2\else#3\fi
+ %\egroup
+ \egroup
\doresetgotowhereever} % to prevent problems with direct goto's
%D Somewhere else we will properly define \type {\dostartgoto};
-%D the noto alternative takes care of undefined references in
+%D the noto alternative takes care of undefined references in
%D a sequence
\ifx\dostartnoto\undefined
- \def\dostartnoto#1\dostopnoto%
+ \def\dostartnoto#1\dostopnoto
{\ifsecondaryreference\else{#1}\fi}
\fi
\ifx\dostartgoto\undefined
- \def\dostartgoto\data#1\start#2\stop#3\dostopgoto%
+ \def\dostartgoto\data#1\start#2\stop#3\dostopgoto
{\ifsecondaryreference\else{#1}\fi}
\fi
@@ -1137,10 +1345,11 @@
{\checkreferences
\bgroup
\edef\currentfullreference{#1}%
- \doifdefinedelse{\r!cross\currentfullreference}
- {\getreferenceelements\currentfullreference
- \global\referencefoundtrue #2}
- {\global\referencefoundfalse #3}%
+ \ifundefined{\r!cross\currentfullreference}%
+ \global\referencefoundfalse #3%
+ \else\getreferenceelements\currentfullreference
+ \global\referencefoundtrue #2%
+ \fi
\egroup}
%D The inner case is simple. Only two cases have to be taken
@@ -1151,22 +1360,76 @@
%D \naar{some text}[prefix:reference]
%D \stoptypen
+%\def\docheckinnerreference%
+% {\global\let\predefinedreference=\currentinnerreference
+% \ifx\currentreferencearguments\empty
+% \doifdefinedelse{\r!cross\referenceprefix\currentfullreference}
+% {\global\referencefoundtrue}
+% {\let\referenceprefix\empty
+% \doifdefinedelse{\r!cross\currentfullreference}
+% {\global\referencefoundtrue}
+% {\global\referencefoundfalse}}%
+% \else % [SomeThing{with,me}]
+% \let\referenceprefix\empty
+% \doifdefinedelse{\r!cross\currentinnerreference}
+% {\global\referencefoundtrue}
+% {\global\referencefoundfalse}%
+% \fi
+% \doifpredefinedreferenceelse{\global\referencefoundfalse}{}}
+
+\beginETEX
+
+\def\docheckinnerreference%
+ {\global\let\predefinedreference=\currentinnerreference
+ \ifx\currentreferencearguments\empty
+ \ifcsname\r!cross\referenceprefix\currentfullreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \let\referenceprefix\empty
+ \ifcsname\r!cross\currentfullreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \global\referencefoundfalse
+ \fi
+ \fi
+ \else % [SomeThing{with,me}]
+ \let\referenceprefix\empty
+ \ifcsname\r!cross\currentinnerreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \global\referencefoundfalse
+ \fi
+ \fi
+ \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing}
+
+\endETEX
+
+\beginTEX
+
\def\docheckinnerreference%
{\global\let\predefinedreference=\currentinnerreference
\ifx\currentreferencearguments\empty
- \doifdefinedelse{\r!cross\referenceprefix\currentfullreference}
- {\global\referencefoundtrue}
- {\let\referenceprefix\empty
- \doifdefinedelse{\r!cross\currentfullreference}
- {\global\referencefoundtrue}
- {\global\referencefoundfalse}}%
+ \@EA\ifx\csname\r!cross\referenceprefix\currentfullreference\endcsname\relax
+ \let\referenceprefix\empty
+ \ifcsname\r!cross\currentfullreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \global\referencefoundfalse
+ \fi
+ \else
+ \global\referencefoundtrue
+ \fi
\else % [SomeThing{with,me}]
\let\referenceprefix\empty
- \doifdefinedelse{\r!cross\currentinnerreference}
- {\global\referencefoundtrue}
- {\global\referencefoundfalse}%
+ \ifcsname\r!cross\currentinnerreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \global\referencefoundfalse
+ \fi
\fi
- \doifpredefinedreferenceelse{\global\referencefoundfalse}{}}
+ \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing}
+
+\endTEX
%D References to other files however are treated strict or
%D tolerant, depending on their loading and availability:
@@ -1216,6 +1479,30 @@
\docheckouterreference
\fi}
+\def\docheckouterreference%
+ {\let\referenceprefix\empty
+ \let\unharmedreferenceprefix\empty
+ \xdef\predefinedreference
+ {\currentouterreference::\currentinnerreference}%
+ \ifx\innerreference\empty
+ \global\referencefoundtrue % no checking done
+ \else
+ \@EA\ifx\csname\r!cross\currentouterreference::\endcsname\relax
+ \ifstrictouterreferences
+ \global\referencefoundfalse
+ \else
+ \global\referencefoundtrue % no checking done
+ \fi
+ \else
+ \ifcsname\r!cross\currentfullreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \dodocheckouterreference
+ \fi
+ \fi
+ \fi
+ \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing}
+
\endTEX
\beginETEX \ifcsname
@@ -1231,42 +1518,55 @@
% already \global\referencefoundtrue % no checking done
\fi\fi}
-\endETEX
-
\def\docheckouterreference%
- {\let\referenceprefix=\empty
- \let\unharmedreferenceprefix=\empty
- \xdef\predefinedreference%
+ {\let\referenceprefix\empty
+ \let\unharmedreferenceprefix\empty
+ \xdef\predefinedreference
{\currentouterreference::\currentinnerreference}%
\ifx\innerreference\empty
\global\referencefoundtrue % no checking done
\else
- \doifdefinedelse{\r!cross\currentouterreference::}
- {\doifdefinedelse{\r!cross\currentfullreference}
- {\global\referencefoundtrue}
- {\dodocheckouterreference}}
- {\ifstrictouterreferences
- \global\referencefoundfalse
- \else
- \global\referencefoundtrue % no checking done
- \fi}%
+ \ifcsname\r!cross\currentouterreference::\endcsname
+ \ifcsname\r!cross\currentfullreference\endcsname
+ \global\referencefoundtrue
+ \else
+ \dodocheckouterreference
+ \fi
+ \else
+ \ifstrictouterreferences
+ \global\referencefoundfalse
+ \else
+ \global\referencefoundtrue % no checking done
+ \fi
+ \fi
\fi
- \doifpredefinedreferenceelse{\global\referencefoundfalse}{}}
+ \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing}
+
+\endETEX
%D Special references are only tested when some test routine is
%D defined.
\def\docheckspecialreference%
- {\let\referenceprefix=\empty
- \let\unharmedreferenceprefix=\empty
+ {\let\referenceprefix\empty
+ \let\unharmedreferenceprefix\empty
\xdef\predefinedreference%
{\currentreferencespecial::\currentreferenceoperation}%
- \doifdefinedelse{\s!do\v!test\currentreferencespecial}
- {\getvalue{\s!do\v!test\currentreferencespecial}
- {\global\referencefoundtrue}
- {\global\referencefoundfalse}}
- {\global\referencefoundtrue}%
- \doifpredefinedreferenceelse{\global\referencefoundfalse}{}}
+% \doifdefinedelse{\s!do\v!test\currentreferencespecial}
+% {\getvalue{\s!do\v!test\currentreferencespecial}%
+% {\global\referencefoundtrue}
+% {\global\referencefoundfalse}}
+% {\global\referencefoundtrue}%
+ \executeifdefined{\s!do\v!test\currentreferencespecial}
+ {\global\referencefoundtrue\gobbletwoarguments}
+ {\global\referencefoundtrue}{\global\referencefoundfalse}%
+% \ifcsname\s!do\v!test\currentreferencespecial\endcsname
+% \csname\s!do\v!test\currentreferencespecial\endcsname
+% {\global\referencefoundtrue}{\global\referencefoundfalse}%
+% \else
+% \global\referencefoundtrue
+% \fi
+ \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing}
%D An unknown reference is reported on the screen, in the log
%D file and, when enabled, in the left margin of the text.
@@ -1285,11 +1585,8 @@
{\predefinereference
\showmessage{\m!references}{#1}{[\unharmedreferenceprefix][#2]}}}
-\def\unknownreference%
- {\reportreferenceerror1}
-
-\def\illegalreference%
- {\reportreferenceerror4}
+\def\unknownreference{\reportreferenceerror1}
+\def\illegalreference{\reportreferenceerror4}
%D Although not actually needed, we default the unharmed
%D reference prefix to the normal one.
@@ -1308,28 +1605,35 @@
%D being defined, we set such an unknown reference to an empty
%D one after the first encounter.
-\let\predefinedreference=\s!unknown
+\let\predefinedreference\s!unknown
-%\def\predefinereference%
-% {\setgvalue{\r!cross\predefinedreference}{\rt!cross{}{}{}{}}}
+% \def\predefinereference%
+% {\setgvalue{\r!cross\predefinedreference}{\rt!cross{}{}{}{}}%
+% \setgvalue{\r!cross\unharmedreferenceprefix\predefinedreference}{\rt!cross{}{}{}{}}}
-%\def\predefinereference%
-% {\setgvalue{\r!cross\unharmedreferenceprefix\predefinedreference}{\rt!cross{}{}{}{}}}
+\def\dummypredefinedreference{\r!cross{}{}{}{}}
\def\predefinereference%
- {\setgvalue{\r!cross\predefinedreference}{\rt!cross{}{}{}{}}%
- \setgvalue{\r!cross\unharmedreferenceprefix\predefinedreference}{\rt!cross{}{}{}{}}}
+ {\global\@EA\let\csname\r!cross\predefinedreference \endcsname\dummypredefinedreference
+ \global\@EA\let\csname\r!cross\unharmedreferenceprefix\endcsname\dummypredefinedreference}
%D Testing on existance then becomes:
-\def\checkpredefinedreference#1#2#3#4% #3 can expand tricky
- {{#1}{#2}{#4}}
+% \def\checkpredefinedreference#1#2#3#4% #3 can expand tricky
+% {{#1}{#2}{#4}}
+%
+% \def\doifpredefinedreferenceelse#1#2% \referenceprefix added
+% {\bgroup
+% \let\rt!cross\checkpredefinedreference
+% \doifelse{\getvalue{\r!cross\referenceprefix\predefinedreference}}{{}{}{}}
+% {\egroup#1}{\egroup#2}}
-\def\doifpredefinedreferenceelse#1#2% \referenceprefix added
- {\bgroup
- \let\rt!cross\checkpredefinedreference
- \doifelse{\getvalue{\r!cross\referenceprefix\predefinedreference}}{{}{}{}}
- {\egroup#1}{\egroup#2}}
+\def\doifpredefinedreferenceelse% \referenceprefix added
+ {\@EA\ifx\csname\r!cross\referenceprefix\predefinedreference\endcsname\dummypredefinedreference
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
%D Sometimes we want to temporary put a reference out of
%D order. An example can be found in the menu macros.
@@ -1340,20 +1644,42 @@
%D
%D The second argument can be a comma seperated list.
-\def\doifreferencepermittedelse#1#2#3#4% ref set found notfound
+% \def\doifreferencepermittedelse#1#2#3#4% ref set found notfound
+% {\doifreferencefoundelse{#1}
+% {\ifx\currentinnerreference\empty
+% \ifx\currentouterreference\empty
+% #3%
+% \else
+% \doifinstringelse{\currentouterreference::}{#2}{#4}{#3}%
+% \fi
+% \else\ifx\currentouterreference\empty
+% \doifinstringelse{\currentinnerreference}{#2}{#4}{#3}%
+% \else
+% \doifinstringelse{\currentouterreference::\currentinnerreference}{#2}{#4}{#3}%
+% \fi\fi}
+% {#4\unknownreference{#1}}}
+
+\let\permittedreferences\empty
+
+\def\doifreferencepermittedelse#1#2#3% ref found notfound
{\doifreferencefoundelse{#1}
- {\ifx\currentinnerreference\empty
- \ifx\currentouterreference\empty
- #3%
- \else
- \doifinstringelse{\currentouterreference::}{#2}{#4}{#3}%
- \fi
- \else\ifx\currentouterreference\empty
- \doifinstringelse{\currentinnerreference}{#2}{#4}{#3}%
- \else
- \doifinstringelse{\currentouterreference::\currentinnerreference}{#2}{#4}{#3}%
- \fi\fi}
- {#4\unknownreference{#1}}}
+ {\donetrue
+ \ifx\permittedreferences\empty \else
+ \docheckifreferencepermitted{#1}%
+ \fi
+ \ifdone#2\else#3\fi}
+ {#3\unknownreference{#1}}}
+
+\def\docheckifreferencepermitted#1%
+ {\ifx\currentinnerreference\empty
+ \ifx\currentouterreference\empty \else
+ \doifinstring{\currentouterreference::}\permittedreferences\donefalse
+ \fi
+ \else\ifx\currentouterreference\empty
+ \doifinstring{\currentinnerreference}\permittedreferences\donefalse
+ \else
+ \doifinstring{\currentouterreference::\currentinnerreference}\permittedreferences\donefalse
+ \fi\fi}
%D Apart from cross references supplied by the user, \CONTEXT\
%D generates cross references itself. Most of them are not
@@ -1393,17 +1719,13 @@
%D \type{\iflocation} signals if we're in interactive mode.
\def\thisisdestination#1% destination
- {\iflocation
- \ifusepagedestinations \else
- \dostartthisislocation{#1}%
- \dostopthisislocation
- \fi
- \fi}
+ {\iflocation \ifusepagedestinations \else
+ \dostartthisislocation{#1}\dostopthisislocation
+ \fi \fi}
\def\thisisrealpage#1% pagenumber
{\iflocation
- \dostartthisisrealpage{#1}%
- \dostopthisisrealpage
+ \dostartthisisrealpage{#1}\dostopthisisrealpage
\fi}
%D The previous tho macros were easy ones, opposite to their
@@ -1436,9 +1758,7 @@
{#5}%
\start
\the\everyreference % we are (have to be) grouped !
- \dostartgotolocation
- {\number\buttonwidth}{\number\buttonheight}
- {#1}{#2}{#3}{#4}%
+ \dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{#4}%
\stop
\dostopgotolocation
\dostopgoto
@@ -1453,9 +1773,7 @@
\data
{#4}%
\start
- \dostartgotorealpage
- {\number\buttonwidth}{\number\buttonheight}
- {#1}{#2}{#3}%
+ \dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{#3}%
\stop
\dostopgotorealpage
\dostopgoto
@@ -1463,22 +1781,22 @@
{#4}%
\fi}
-%D \macros
+%D \macros
%D {setreferencefilename}
-%D
+%D
%D This command can be used in the special drivers to
%D uppercase filenames. This is needed when one wants to
%D produce \CDROM's conforming to ISO9660. We consider is the
%D savest to enable this feature by default. We cannot handle
%D uppercase here, since the suffix is handled in the special
-%D driver. Conversion is taken care of by:
-%D
+%D driver. Conversion is taken care of by:
+%D
%D \starttypen
%D \setreferencefilename somefilename\to\SomeFileName
-%D \stoptypen
+%D \stoptypen
% \def\setreferencefilename#1\to#2%
-% {\doifelse{\@@converteerfile}{\v!ja} % boolean is sneller
+% {\doifelse{\@@converteerfile}{\v!ja} % boolean is sneller
% {\uppercasestring#1\to#2}
% {\edef#2{#1}}}
@@ -1486,9 +1804,9 @@
\def\setreferencefilename#1\to#2%
{\ifcase\referencefilecase
- \edef#2{#1}%
+ \edef#2{#1}%
\or
- \uppercasestring#1\to#2%
+ \uppercasestring#1\to#2%
\or
\lowercasestring#1\to#2%
\else
@@ -1507,9 +1825,6 @@
\def\thisissomeinternal#1#2% tag reference
{\doifsomething{#2}{\thisisdestination{#1:#2}}}
-% \def\gotosomeinternal#1#2#3#4%
-% {\gotodestination{}{}{#1:#2}{#3}{#4}}
-
\def\gotosomeinternal#1#2% #3#4
{\gotodestination{}{}{#1:#2}}
@@ -1531,19 +1846,30 @@
\newcount\locationcount
\newif\iftraceinternalreferences
+\newif\ifinternalnamedreferences \internalnamedreferencestrue
\def\nextinternalreference%
{\the\locationcount}
-\def\thisisnextinternal#1%
- {\global\advance\locationcount by 1
- \thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}}
+% \def\thisisnextinternal#1%
+% {\global\advance\locationcount \plusone
+% \thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}}
+%
+% \def\gotonextinternal#1#2% #3#4
+% {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}}
-% \def\gotonextinternal#1#2#3#4%
-% {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}{#3}{#4}}
+\def\thisisnextinternal#1%
+ {\global\advance\locationcount 1
+ \ifinternalnamedreferences
+ \thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}%
+ \fi}
-\def\gotonextinternal#1#2% #3#4
- {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}}
+\def\gotonextinternal#1#2#3#4%
+ {\ifinternalnamedreferences
+ \gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}{#3}{#4}%
+ \else
+ \gotorealpage{}{}{#3}{#4}%
+ \fi}
%D We already went through a lot of problems to sort out what
%D kind of reference we're dealing with. Sorting out the user
@@ -1552,45 +1878,41 @@
%D already taken care of in the test routine, but we still have
%D to direct the request to the right routine.
-\def\gotolocation#1#2%
+\def\gotolocation% #1#2%
{\ifx\currentreferencespecial\empty
\ifx\currentouterreference\empty
\ifnum\currentreferencetype<2
- \gotoinnerlocation{#1}{#2}%
+ \@EA\@EAEAEA\@EA\gotoinnerlocation
\else
- \gotosystemlocation{#1}{#2}%
+ \@EA\@EAEAEA\@EA\gotosystemlocation
\fi
\else
- \gotoouterlocation{#1}{#2}%
+ \@EAEAEA\gotoouterlocation
\fi
\else
- \gotospeciallocation{#1}{#2}%
- \fi}
+ \@EA\gotospeciallocation
+ \fi} % {#1}{#2}
%D An inner reference refers to some place in the document
%D itself.
-\def\gotoinnerlocation#1#2%
- {\gotodestination
- {}{}
- {\referenceprefix\currentinnerreference}{\currentrealreference}
- {#2}}
+\def\gotoinnerlocation#1% #2%
+ {\gotodestination\empty\empty
+ {\referenceprefix\currentinnerreference}\currentrealreference} % {#2}
%D The outer location refers to another document, specified as
%D file or \URL.
\def\gotoouterlocation#1#2% % page checken!
{\bgroup
- \let\referenceprefix=\empty
- \setouterlocation{\currentouterreference}%
+ \let\referenceprefix\empty
+ \setouterlocation\currentouterreference
\ifx\currentinnerreference\empty
\gotorealpage
- {\otherURL}{\otherfile}{1}
- {#2}%
+ \otherURL\otherfile1{#2}%
\else
\gotodestination
- {\otherURL}{\otherfile}{\currentinnerreference}{\currentrealreference}
- {#2}%
+ \otherURL\otherfile\currentinnerreference\currentrealreference{#2}%
\fi
\egroup}
@@ -1625,9 +1947,8 @@
%D \type{summarize}) and \type{\currentreference} (here
%D being \type {10,23,56}) to perform its task.
-\def\gotospeciallocation%
- {\executeifdefined
- {goto\currentreferencespecial location}\gobbleoneargument}
+\def\gotospeciallocation
+ {\executeifdefined{goto\currentreferencespecial location}\gobbleoneargument}
%D Such special macros can be defined by:
@@ -1652,8 +1973,8 @@
%D A system location is not always a location, but for the
%D consistency we also consider actions as such.
-\def\gotosystemlocation%
- {\getvalue{\r!syst\the\currentreferencetype}}
+\def\gotosystemlocation
+ {\csname\r!syst\the\currentreferencetype\endcsname}
\def\definesystemreferencehandler#1#2%
{\setgvalue{\r!syst\the#1}{#2}}
@@ -1670,32 +1991,52 @@
\definesystemreferencehandler \rt!list \handlelistreference
\def\handleexecreference#1%
- {\checkexecutecommand{\currentdatareference}{\currentreferencearguments}%
- \executecommand{\currentdatareference}{\currentreferencearguments}}
+ {\checkexecutecommand\currentdatareference\currentreferencearguments
+ \executecommand\currentdatareference\currentreferencearguments}
\def\handlepagereference#1%
- {\gotorealpage{}{}{\currentdatareference}}
+ {\gotorealpage\empty\empty\currentdatareference}
\def\handlelistreference#1% is deze nog echt nodig?
- {\gotodestination{}{}{\currentdatareference}{\getvalue{\currentdatareference}}}
+ {\gotodestination\empty\empty\currentdatareference{\getvalue{\currentdatareference}}}
%D \macros
%D {setexecutecommandcheck}
%D
-%D In case a command action needs to do some checking in
-%D advance, one can assign an check function by:
+%D In case a command action needs to do some checking in
+%D advance, one can assign an check function by:
%D
-%D \starttypen
+%D \starttypen
%D \setexecutecommandcheck{startsound}\checksoundtrack
-%D \stoptypen
+%D \stoptypen
\def\setexecutecommandcheck#1#2% #2 permits \first \second
{\setvalue{\s!do\s!do#1}{#2}}
-\def\checkexecutecommand#1#2%
- {\def\docheckexecutecommand##1%
- {\doifdefined{\s!do\s!do#1}{\getvalue{\s!do\s!do#1}{##1}}}%
- \processcommacommand[#2]\docheckexecutecommand}
+% \def\checkexecutecommand#1#2%
+% {\def\docheckexecutecommand##1%
+% {\doifdefined{\s!do\s!do#1}{\getvalue{\s!do\s!do#1}{##1}}}%
+% \processcommacommand[#2]\docheckexecutecommand}
+
+\beginETEX
+
+\def\checkexecutecommand#1#2% evt geen #1 en #2
+ {\ifx#2\empty \else \ifcsname\s!do\s!do#1\endcsname
+ \@EA\let\@EA\docheckexecutecommand\csname\s!do\s!do#1\endcsname
+ \rawprocesscommalist[#2]\docheckexecutecommand
+ \fi \fi }
+
+\endETEX
+
+\beginTEX
+
+\def\checkexecutecommand#1#2% evt geen #1 en #2
+ {\ifx#2\empty \else \@EA\ifx\csname\s!do\s!do#1\endcsname\relax \else
+ \@EA\let\@EA\docheckexecutecommand\csname\s!do\s!do#1\endcsname
+ \rawprocesscommalist[#2]\docheckexecutecommand
+ \fi \fi }
+
+\endTEX
%D Command references (in dutch, english, german of
%D whatever interface language) are translated into a bit
@@ -1746,9 +2087,7 @@
\data
{#3}%
\start
- \dostartexecutecommand
- {\number\buttonwidth}{\number\buttonheight}
- {#1}{#2}%
+ \dostartexecutecommand\buttonwidth\buttonheight{#1}{#2}%
\stop
\dostopexecutecommand
\dostopgoto
@@ -1781,7 +2120,7 @@
%D document). By setting the \type{interaction} variable, one
%D can influences the way interactive references are set.
-% \newif\ifreferencestrut % some day an option
+% \newif\ifreferencestrut % some day an option
\def\setupreferencing%
{\dosingleargument\dosetupreferencing}
@@ -1796,10 +2135,10 @@
\v!start=>\referencingtrue]%
\processaction
[\@@rfinteractie]
- [ \v!alles=>\let\dowantedreference=\docompletereference,
- \v!label=>\let\dowantedreference=\dolabelonlyreference,
- \v!tekst=>\let\dowantedreference=\dotextonlyreference,
- \v!symbool=>\let\dowantedreference=\dosymbolreference]%
+ [ \v!alles=>\let\dowantedreference\docompletereference,
+ \v!label=>\let\dowantedreference\dolabelonlyreference,
+ \v!tekst=>\let\dowantedreference\dotextonlyreference,
+ \v!symbool=>\let\dowantedreference\dosymbolreference]%
\chardef\autocrossfilereferences=0
\processaction
[\@@rfautofile]
@@ -1807,27 +2146,12 @@
\v!pagina=>\chardef\autocrossfilereferences=2]%
\chardef\referencefilecase=0
\processaction[\@@rfconverteerfile]
- [ \v!ja=>\chardef\referencefilecase=1,
- \v!groot=>\chardef\referencefilecase=1,
+ [ \v!ja=>\chardef\referencefilecase=1,
+ \v!groot=>\chardef\referencefilecase=1,
\v!klein=>\chardef\referencefilecase=2]%
- % \doifelse{\@@rfstrut}{\v!ja} % some day an option
- % {\referencetruttrue}{\referencestrutfalse}%
- %
- % This is a typical example where \ifx\@@rfprefix\s!unknown fails:
- %
- \doifnot{\@@rfprefix}{\s!unknown} % retain the current value
- {\ifx\@@rfprefix\empty
- \let\referenceprefix=\empty
- \else\ifx\@@rfprefix\incrementreferenceprefix
- \advance\prefixcounter by 1
- \edef\referenceprefix{\the\prefixcounter:}%
- \let\@@rfprefix\s!unknown
- \else\ifx\@@rfprefix\decrementreferenceprefix
- \let\referenceprefix=\empty
- \let\@@rfprefix\s!unknown
- \else
- \edef\referenceprefix{\@@rfprefix:}%
- \fi\fi\fi}%
+ %\doifelse{\@@rfstrut}{\v!ja} % some day an option
+ % {\referencetruttrue}{\referencestrutfalse}%
+ \setupreferenceprefix[\@@rfprefix]%
\doifelse{\@@rfglobaal}{\v!ja}
{\settrue \autoglobalfilereferences}
{\setfalse\autoglobalfilereferences}}
@@ -1835,6 +2159,23 @@
\def\incrementreferenceprefix{+}
\def\decrementreferenceprefix{-}
+\def\setupreferenceprefix[#1]%
+ {\edef\@@rfprefix{#1}%
+ \ifx\@@rfprefix\empty
+ \let\referenceprefix\empty
+ \else\ifx\@@rfprefix\incrementreferenceprefix
+ \advance\prefixcounter 1 % should be global
+ \edef\referenceprefix{\the\prefixcounter:}%
+ \let\@@rfprefix\s!unknown
+ \else\ifx\@@rfprefix\decrementreferenceprefix
+ \let\referenceprefix\empty
+ \let\@@rfprefix\s!unknown
+ \else\ifx\@@rfprefix\s!unknown
+ % forget about it
+ \else
+ \edef\referenceprefix{\@@rfprefix:}%
+ \fi\fi\fi\fi}
+
%D \macros
%D {handlereferenceactions,
%D collectreferenceactions}
@@ -1930,9 +2271,9 @@
% \expandafter\doinatreference\expandafter\currenttextreference
% \fi}
-% we need to bypass math tokens
+% we need to bypass math tokens
-\let\normalover \over
+% \let\normalover \over
\definecommand in {\doinatreference\currenttextreference}
\definecommand op {\doinatreference\currentpagereference}
@@ -1943,7 +2284,7 @@
\bgroup
\def\thecurrentsubtextreference%
{\limitatetext{\currentsubtextreference}{\@@rfbreedte}{\unknown}}%
- %\leaveoutervmode % no
+ %\leaveoutervmode % no
\@@rflinks
\doifreferencefoundelse{#1}
{\let\crlf\space
@@ -2001,32 +2342,36 @@
{\def\dododoinatreference{\dodododoinatreference{#1}}%
\futurelet\next\dododoinatreference}
-\def\dodododoinatreference#1#2#3[#4]%
- {\ifx\next\bgroup
- \dododododoinatreference{#1\ignorespaces#3}{#2}[#4]%
- \else
- \dododododoinatreference{#1}{#2#3}[#4]%
- \fi}
+% overloaded
+%
+% \def\dodododoinatreference#1#2#3[#4]%
+% {\ifx\next\bgroup
+% \dododododoinatreference{#1\ignorespaces#3}{#2}[#4]%
+% \else
+% \dododododoinatreference{#1}{#2#3}[#4]%
+% \fi}
%D We arrived at the last step. Before we do the typesetting,
%D we forget all previous (paragraph bound) settings and make
%D sure that we remain in horizontal mode. Next we choose
%D among the several representations.
-\def\dododododoinatreference#1#2[#3]%
- {\dontleavehmode
- \bgroup
- \forgetall
- %\leaveoutervmode
- \doifreferencefoundelse{#3}
- {\bgroup
- \let\ignorespaces\empty % rather dirty but ok
- \doifelsenothing{#1}
- {\egroup\dosymbolreference{#1}{#2}[#3]}
- {\egroup\dowantedreference{#1}{#2}[#3]}}
- {\dounknownreference{#1}{#2}[#3]}%
- \referentieinfo{<}{#3}%
- \egroup}
+% overloaded
+%
+% \def\dododododoinatreference#1#2[#3]%
+% {\dontleavehmode
+% \bgroup
+% \forgetall
+% %\leaveoutervmode
+% \doifreferencefoundelse{#3}
+% {\bgroup
+% \let\ignorespaces\empty % rather dirty but ok
+% \doifelsenothing{#1}
+% {\egroup\dosymbolreference{#1}{#2}[#3]}
+% {\egroup\dowantedreference{#1}{#2}[#3]}}
+% {\dounknownreference{#1}{#2}[#3]}%
+% \referentieinfo{<}{#3}%
+% \egroup}
%D The previously discussed setup macro lets us specify the
%D representation of references. A symbol reference does not
@@ -2038,7 +2383,7 @@
\def\dosymbolreference#1#2[#3]%
{\bgroup
\setupsymbolset[\@@iasymboolset]%
- \ifhmode\unskip\fi
+ \removelastskip
\ifx\currentreferencespecial\empty
\ifx\currentouterreference\empty
\ifnum0\currentrealreference=0
@@ -2073,13 +2418,14 @@
% {\doifsomething{#2}{\donaarspace{#2}[#3]~}\donaarfixed{#1}[#3]}
% {\donaarfixed{\dotextprefix{#2}#1}[#3]}}
%
-% better:
+
+% better:
\def\docompletereference#1#2[#3]%
{\iflocationsplit
- \doifsomespaceelse{#2}
- {\donaarspace{\dotextprefix{#2}#1}[#3]}
- {\donaarfixed{\dotextprefix{#2}#1}[#3]}%
+ \doifsomespaceelse{#2}
+ {\donaarspace{\dotextprefix{#2}#1}[#3]}
+ {\donaarfixed{\dotextprefix{#2}#1}[#3]}%
\else
\donaarfixed{\dotextprefix{#2}#1}[#3]%
\fi}
@@ -2098,26 +2444,26 @@
%D {definereferenceformat}
%D
%D The next few macros were made for for David Arnold and Taco
-%D Hoekwater. They can be used for predefining reference
-%D texts, and thereby stimulate efficiency.
+%D Hoekwater. They can be used for predefining reference
+%D texts, and thereby stimulate efficiency.
%D
%D [more documentation will be added]
%D
-%D \starttypen
+%D \starttypen
%D \definereferenceformat[informula] [left=(,right=),text=formula]
%D \definereferenceformat[informulas] [left=(,right=),text=formulas]
%D \definereferenceformat[andformula] [left=(,right=),text=and]
%D \definereferenceformat[andformulas][left=(,right=),text=and]
-%D
-%D \informula [b] and \informula [for:c]
-%D the \informula {formulas}[b] \informula {and} [for:c]
-%D the \informulas {formulas}[b] \informula {and} [for:c]
-%D the \informulas [b] \informula {en} [for:c]
-%D the \informulas [b] \andformula [for:c]
+%D
+%D \informula [b] and \informula [for:c]
+%D the \informula {formulas}[b] \informula {and} [for:c]
+%D the \informulas {formulas}[b] \informula {and} [for:c]
+%D the \informulas [b] \informula {en} [for:c]
+%D the \informulas [b] \andformula [for:c]
%D \stoptypen
-%D
-%D Instead of a text, one can specify a label, which should
-%D be defined with \type {\setuplabeltext}.
+%D
+%D Instead of a text, one can specify a label, which should
+%D be defined with \type {\setuplabeltext}.
\def\definereferenceformat%
{\dodoubleargument\dodefinereferenceformat}
@@ -2126,8 +2472,8 @@
{\iffirstargument
\getparameters[\??rf#1]
[\c!links=, % of the number
- \c!rechts=, % of the number
- \c!tekst=, % before the number
+ \c!rechts=, % of the number
+ \c!tekst=, % before the number
\c!label=, % can be {left}{right}
\c!commando=\in,
#2]%
@@ -2137,22 +2483,20 @@
\def\noexecutelabelreferenceformat#1%
{\doifvaluesomething{\??rf#1\c!tekst}
- {\gdef\textofreference{\getvalue{\??rf#1\c!tekst}}}%
- \getvalue{\??rf#1\c!commando}}
+ {\gdef\textofreference{\csname\??rf#1\c!tekst\endcsname}}%
+ \csname\??rf#1\c!commando\endcsname}
\def\doexecutelabelreferenceformat#1%
- {\getvalue{\??rf#1\c!commando}%
- {\leftlabeltext {\getvalue{\??rf#1\c!label}}}%
- {\rightlabeltext{\getvalue{\??rf#1\c!label}}}}
+ {\csname\??rf#1\c!commando\endcsname
+ {\leftlabeltext {\csname\??rf#1\c!label\endcsname}}%
+ {\rightlabeltext{\csname\??rf#1\c!label\endcsname}}}
\def\doexecutereferenceformat#1%
- {\gdef\leftofreference {\getvalue{\??rf#1\c!links }}%
- \gdef\rightofreference{\getvalue{\??rf#1\c!rechts}}%
+ {\gdef\leftofreference {\csname\??rf#1\c!links \endcsname}%
+ \gdef\rightofreference{\csname\??rf#1\c!rechts\endcsname}%
\global\let\textofreference\empty % otherwise ~ added
\doifelsevaluenothing{\??rf#1\c!label}
- {\let\next\noexecutelabelreferenceformat}
- {\let\next\doexecutelabelreferenceformat}%
- \next{#1}}
+ \noexecutelabelreferenceformat\doexecutelabelreferenceformat{#1}}
\let\leftofreference \relax
\let\rightofreference\relax
@@ -2178,16 +2522,24 @@
\let\rightofreference\empty % and once more
\def\textofreference {#2}% % temporary value
\ifx\textofreference\empty % simple expansion
- \doifelsenothing{#1}
- {\egroup\dosymbolreference{#1}{\textofreference}[#3]}
- {\egroup\dowantedreference{#1}{\textofreference}[#3]}%
+ %\doifelsenothing{#1}
+ % {\egroup\dosymbolreference{#1}{\textofreference}[#3]}
+ % {\egroup\dowantedreference{#1}{\textofreference}[#3]}%
+ \doifelsenothing{#1}%
+ {\egroup\dosymbolreference}%
+ {\egroup\dowantedreference}%
+ {#1}{\textofreference}[#3]%
\else
- \doifelsenothing{#1}
- {\egroup\dosymbolreference{#1}{#2}[#3]}
- {\egroup\dowantedreference{#1}{#2}[#3]}%
+ %\doifelsenothing{#1}
+ % {\egroup\dosymbolreference{#1}{#2}[#3]}
+ % {\egroup\dowantedreference{#1}{#2}[#3]}%
+ \doifelsenothing{#1}%
+ {\egroup\dosymbolreference}%
+ {\egroup\dowantedreference}%
+ {#1}{#2}[#3]%
\fi}
{\dounknownreference{#1}{#2}[#3]}%
- \referentieinfo{<}{#3}%
+ \referentieinfo<{#3}%
\global\let\leftofreference \empty
\global\let\rightofreference\empty
\global\let\textofreference \empty
@@ -2236,13 +2588,13 @@
\newcount\similarreference % 0=noppes 1=create/refer 2,3,..=refer
\def\donaarspace#1[#2]%
- {\iflocationsplit
+ {\iflocationsplit
\ifsecondaryreference\setbox0=\hbox\fi % due to space insertion
{\let\donaarspace=\donaarfixed
\iflocation
\def\processisolatedword##1%
{\ifisolatedwords\ifsharesimilarreferences
- \global\advance\similarreference by 1
+ \global\advance\similarreference 1
\fi\fi
\hbox{\gotolocation{#2}{##1\presetgoto}}}%
\doattributes\??ia\c!letter\c!kleur
@@ -2414,20 +2766,18 @@
\def\setupurl%
{\dodoubleargument\getparameters[\??ur]}
-\unexpanded\def\url[#1]%
+\unexpanded\def\url[#1]% slow
{\bgroup
\processaction
-% [\@@rfurlvariant]
[\@@urvariant]
[ \v!geen=>\chardef\urlsplitmode=0,
\v!beide=>\chardef\urlsplitmode=1,
\v!na=>\chardef\urlsplitmode=2,
\v!voor=>\chardef\urlsplitmode=3]%
-% \doifelse{\@@rfurlspatie}{\v!ja}
\doifelse{\@@urspatie}{\v!ja}
{\setbetweenisolatedwords%
{\scratchskip\currentspaceskip
- \hskip\!!zeropoint\!!plus.2\scratchskip}}
+ \hskip\zeropoint\!!plus.2\scratchskip}}
{\setbetweenisolatedwords\allowbreak}%
\def\doexternaldocument[##1][##2][##3]{\hyphenatedurl{##1}}%
\dostartattributes\??ur\c!letter\c!kleur{}%
@@ -2468,30 +2818,34 @@
%D spacing when using very long \URL's.
%D Many macro definitions ago we called for the auxiliary macro
-%D \type{\setouterlocation} and now is the time to define this
+%D \type {\setouterlocation} and now is the time to define this
%D one.
\newconditional\forceURLlocation
+\def\setouterfilelocation[#1][#2][#3]%
+ {\edef\otherURL{#1}%
+ \edef\otherfile{#2}}%
+
\def\setouterlocation#1%
- {\doifdefinedelse{\v!file:::#1}
- {\def\doexternaldocument[##1][##2][##3]%
- {\edef\otherURL{##1}%
- \edef\otherfile{##2}}%
- \getvalue{\v!file:::#1}}
- {\ifconditional\forceURLlocation
- \edef\otherURL {#1}%
- \let\otherfile\empty
- \else
- \let\otherURL\empty
- \edef\otherfile{#1}%
- \fi}%
+ {\ifundefined{\v!file:::#1}%
+ \ifconditional\forceURLlocation
+ \edef\otherURL{#1}%
+ \let\otherfile\empty
+ \else
+ \let\otherURL\empty
+ \edef\otherfile{#1}%
+ \fi
+ \else
+ \let\doexternaldocument\setouterfilelocation
+ \csname\v!file:::#1\endcsname
+ \fi
\setfalse\forceURLlocation
- \doifparentfileelse{\otherfile}
- {\let\otherURL=\empty
- \let\otherfile=\empty
- \global\let\otherlabel=\empty
- \let\otherprefix=\empty}
+ \doifparentfileelse\otherfile
+ {\let\otherURL\empty
+ \let\otherfile\empty
+ \global\let\otherlabel\empty
+ \let\otherprefix\empty}
{\xdef\otherlabel{#1}%
\edef\otherprefix{#1::}}}
@@ -2506,36 +2860,27 @@
\definecomplexorsimple\uit
-\def\simpleuit%
+\def\simpleuit
{\bgroup
- \doifdefinedelse{\v!file:::\otherlabel}
- {\def\doexternaldocument[##1][##2][##3]{##3}%
- \getvalue{\v!file:::\otherlabel}}
+ \ifundefined{\v!file:::\otherlabel}%
{\tttf[\otherlabel]}%
+ \else
+ \def\doexternaldocument[##1][##2][##3]{##3}%
+ \csname\v!file:::\otherlabel\endcsname
\egroup}
\def\complexuit[#1]%
- {\doifinstringelse{::}{#1}
- {\docomplexuit[#1]}
- {\docomplexuit[#1::]}}
-
-% \def\docomplexuit[#1::#2]%
-% {\bgroup
-% \doifdefinedelse{\v!file:::#1}
-% {\def\doexternaldocument[##1][##2][##3]%
-% {\naar{##3}[#1::#2]}%
-% \getvalue{\v!file:::#1}}
-% {\tttf[#1]}%
-% \egroup}
+ {\doifinstringelse{::}{#1}{\docomplexuit[#1]}{\docomplexuit[#1::]}}
\def\docomplexuit[#1::#2]%
{\dontleavehmode % added, but probably not needed
\bgroup
- \doifdefinedelse{\v!file:::#1}
- {\def\doexternaldocument[##1][##2][##3]%
- {\naar{##3}[#1::#2]}%
- \getvalue{\v!file:::#1}}
+ \ifundefined{\v!file:::#1}%
{\tttf[#1]}%
+ \else
+ \def\doexternaldocument[##1][##2][##3]{\naar{##3}[#1::#2]}%
+ \csname\v!file:::#1\endcsname
+ \fi
\egroup}
%D We also support:
@@ -2564,11 +2909,11 @@
{\doifreferencefoundelse
{\currentreferenceoperation::\currentreferencearguments}}
-\def\handlespecialallocationFILEandURL%
- {\let\currentouterreference=\currentreferenceoperation
- \let\currentinnerreference=\currentreferencearguments
- \let\currentreferenceoperation=\empty
- \let\currentreferencearguments=\empty
+\def\handlespecialallocationFILEandURL
+ {\let\currentouterreference\currentreferenceoperation
+ \let\currentinnerreference\currentreferencearguments
+ \let\currentreferenceoperation\empty
+ \let\currentreferencearguments\empty
\gotoouterlocation}
%D Now we have file references as special ones, it's rather
@@ -2583,7 +2928,7 @@
%D
%D An better alternative, slower but error aware, is
-\definespecialtest\v!actie%
+\definespecialtest\v!actie
{\doifreferencefoundelse\currentreferenceoperation}
\definespeciallocation\v!actie
@@ -2623,16 +2968,16 @@
\def\programma#1[#2]%
{\bgroup
- \doifdefinedelse{\v!programma:::#2}
- {\def\doprogramma##1##2%
- {\doifelsenothing{#1}
- {\naar{##2}[\v!programma(#2)]}
- {\naar{#1}[\v!programma(#2)]}}%
- \getvalue{\v!programma:::#2}}
+ \ifundefined{\v!programma:::#2}%
{\tttf[#2]}%
+ \else
+ \def\doprogramma##1##2%
+ {\naar{\doifelsenothing{#1}{##2}{#1}}[\v!programma(#2)]}%
+ \csname\v!programma:::#2\endcsname
+ \fi
\egroup}
-% needs an update: program(abc{arg})
+% needs an update: program(abc{arg})
\definespeciallocation\v!programma#1#2%
{\bgroup
@@ -2640,16 +2985,14 @@
\doifdefinedelse{\v!programma:::\currentreferenceoperation}
{\def\doprogramma##1##2{\def\@@programfile{##1}}%
\getvalue{\v!programma:::\currentreferenceoperation}}
- {\let\@@programfile=\currentreferenceoperation}%
+ {\let\@@programfile\currentreferenceoperation}%
\convertcommand\@@programfile\to\ascii
\dostartgoto
\data
{#2}%
\start
- \dostartrunprogram
- {\number\buttonwidth}{\number\buttonheight}
- {\@@prgebied\ascii}
- {\currentreferencearguments}%
+ \dostartrunprogram\buttonwidth\buttonheight
+ {\@@prgebied\ascii}\currentreferencearguments
\stop
\dostoprunprogram
\dostopgoto
@@ -2742,35 +3085,35 @@
% {#2}%
% \fi}
-\definespeciallocation\v!pagina#1#2% page(n) page(+n) page(-n)
+\definespeciallocation\v!pagina#1#2% page(n) page(+n) page(-n)
{\iflocation
\ifx\currentouterreference\empty
\splitoffreference\currentreferenceoperation
\else
- \let\currentinnerreference=\currentreferenceoperation
+ \let\currentinnerreference\currentreferenceoperation
\fi
\ifx\currentouterreference\empty
- \doifinstringelse{+}{\currentinnerreference}
- {\scratchcounter=\realpageno
- \advance\scratchcounter by \currentinnerreference
+ \doifinstringelse+\currentinnerreference
+ {\scratchcounter\realpageno
+ \advance\scratchcounter \currentinnerreference
\edef\currentinnerreference{\the\scratchcounter}}
- {\doifinstringelse{-}{\currentinnerreference}
- {\scratchcounter=\realpageno
- \advance\scratchcounter by \currentinnerreference
- \edef\currentinnerreference{\the\scratchcounter}}
- {}}%
- \doifnonzeropositiveelse{\currentinnerreference}
- {}
+ {\doifinstringelse-\currentinnerreference
+ {\scratchcounter\realpageno
+ \advance\scratchcounter \currentinnerreference
+ \edef\currentinnerreference{\the\scratchcounter}}
+ \donothing}%
+ \doifnonzeropositiveelse\currentinnerreference
+ \donothing
{\edef\currentinnerreference{1}}%
- \gotorealpage{}{}{\currentinnerreference}{#2}%
+ \gotorealpage\empty\empty\currentinnerreference{#2}%
\else
\setouterlocation\currentouterreference
- \doifnonzeropositiveelse{\currentinnerreference}
- {}
+ \doifnonzeropositiveelse\currentinnerreference
+ \donothing
{\doifdefinedelse{\v!pagina:::\currentinnerreference}
{\edef\currentinnerreference{\getvalue{\v!pagina:::\currentinnerreference}}}
{\edef\currentinnerreference{1}}}%
- \gotorealpage{\otherURL}{\otherfile}{\currentinnerreference}{#2}%
+ \gotorealpage\otherURL\otherfile\currentinnerreference{#2}%
\fi
\else
{#2}%
@@ -2855,7 +3198,7 @@
\def\docoupledocument[#1][#2][#3][#4]%
{\ifthirdargument
\begingroup
- \def\dolijstelement##1##2##3##4##5##6% 2=aut 6=pag / 2 goes into text ref slot
+ \def\dolijstelement##1##2##3##4##5##6% 2=aut 6=pag / 2 goes into text ref slot
{\global\utilitydonetrue %{Watch the braces here below!}
\setglobalcrossreference{{##1::\strippedlistentry[##5]}}{}{##6}{##2}}%
\def\usereferences[##1]%
@@ -2863,7 +3206,7 @@
\dogebruikexterndocument[#1][#2][#4]%
\doglobal\addtocommalist{#1}\crossdocumentreferences
\def\docommando##1%
- {\setxvalue{\??rf##1\c!status}{\v!start}% for fast checking
+ {\setxvalue{\??rf##1\c!status}{\v!start}% for fast checking
\doglobal\addtocommalist{##1}\crossdocumentelements}%
\processcommalist[#3]\docommando
\ifutilitydone
@@ -2883,6 +3226,11 @@
{\setevalue{#1\c!kleur}{\getvalue{#1\c!contrastkleur}}}%
\fi\fi}
+\def\checkcontrastreference#1%
+ {\ifnum\currentreferencetype=\rt!page\relax\ifnum\currentdatareference=\realpageno
+ \copycsname#1\c!kleur\endcsname\csname#1\c!contrastkleur\endcsname
+ \fi\fi}
+
%D Buttons are just what their names says: things that can be
%D clicked (pushed) on. They are similar to \type{\goto},
%D except that the text argument is not interpreted.
@@ -2907,23 +3255,23 @@
%D
%D \showsetup{\y!stelbuttonsin}
-\def\dostelbuttonsin[#1]%
- {\getparameters[\??bt][#1]%
- \dododostelinteractiemenuin{\??bt\c!onbekendeverwijzing}%
- \dododostelinteractiemenuin{\??bt\c!zelfdepagina}}
+%\def\dostelbuttonsin[#1]%
+% {\getparameters[\??bt][#1]%
+% \dododostelinteractiemenuin{\??bt\c!onbekendeverwijzing}%
+% \dododostelinteractiemenuin{\??bt\c!zelfdepagina}}
-\def\stelbuttonsin%
- {\dosingleargument\dostelbuttonsin}
+\def\stelbuttonsin
+ {\dodoubleargument\getparameters[\??bt]}
\definecomplexorsimpleempty\button
-\def\complexbutton%
+\def\complexbutton
{\docomplexbutton\??bt}
\presetlocalframed[\??bt]
\long\def\docomplexbutton#1[#2]#3#4% get rid of possible space before [#4]
- {\dodocomplexbutton#1[#2]{#3}#4} % #4 == [
+ {\dodocomplexbutton#1[#2]{#3}#4} % #4 == [
% \def\dodocomplexbutton#1[#2]#3[#4]%
% {\bgroup
@@ -2952,14 +3300,14 @@
% \fi
% \egroup}
-\long\def\dodocomplexbutton#1[#2]#3[#4]% #3 can contain [] -> {#3} later
+\long\def\dodocomplexbutton#1[#2]#3[#4]% #3 can contain [] -> {#3} later
{\bgroup
\doifvalue{#1\c!status}{\v!stop}{\locationfalse}%
\iflocation
\resetgoto
\ConvertConstantAfter\doifelse{#3}{\v!geen}{\hphantom}{\hbox}
- {\doifelsenothing{#4}
- {\setlocationboxnop#1[#2]{#3}[#4]}
+ {\doifelsenothing{#4}
+ {\setlocationboxnop#1[#2]{#3}[#4]}
{\doifreferencefoundelse{#4}
{\setlocationboxyes#1[#2]{#3}[#4]}
{\unknownreference{#4}%
@@ -2993,36 +3341,36 @@
\def\dointeractiebuttons[#1][#2]% er is een verdeel macro \fractie
{\iflocation
\bgroup
- \doif{\@@ibstatus}{\v!stop}{\locationfalse}%
+ \doif\@@ibstatus\v!stop\locationfalse
\iflocation
\ifsecondargument
\checkinteractiebalk{1.5em}\v!ruim\!!zeropoint % brrrrr
\setbox2=\hbox
{\setupsymbolset[\@@iasymboolset]%
\localframed[\??ib][#1,\c!achtergrond=]{\symbol[\v!vorigepagina]}}%
- \!!heighta=\ht2 % needed because we default to nothing
+ \!!heighta\ht2 % needed because we default to nothing
\stelinteractiebalkin[#1,\c!strut=\v!nee]%
- \setupinteraction[\c!breedte=\!!zeropoint]%
- %\!!counta=1
- \!!counta=0 % new
+ %\setupinteraction[\c!breedte=\!!zeropoint]%
+ \setinteractionparameter\c!breedte\!!zeropoint
+ \!!counta=0 % new, was 1
\processallactionsinset
[#2]
- [ \v!pagina=>\advance\!!counta by 4,
- \v!sub\v!pagina=>\advance\!!counta by 4,
- \s!unknown=>\advance\!!counta by 1]%
+ [ \v!pagina=>\advance\!!counta 4,
+ \v!sub\v!pagina=>\advance\!!counta 4,
+ \s!unknown=>\advance\!!counta 1]%
\ifdim\@@ibbreedte=\!!zeropoint\relax
- \!!widtha=2em
- \advance\!!widtha by \@@ibafstand % new
- \!!widthb=\!!counta\!!widtha
- \advance\!!widthb by -\@@ibafstand % new
+ \!!widtha2em
+ \advance\!!widtha \@@ibafstand % new
+ \!!widthb\!!counta\!!widtha
+ \advance\!!widthb -\@@ibafstand % new
\else
- \!!widtha=\@@ibbreedte
- \!!widthb=\@@ibafstand % new
- \multiply\!!widthb by \!!counta % new
- \advance\!!widthb by -\@@ibafstand % new
- \advance\!!widtha by -\!!widthb % new
- \divide\!!widtha by \!!counta
- \!!widthb=\@@ibbreedte
+ \!!widtha\@@ibbreedte
+ \!!widthb\@@ibafstand % new
+ \multiply\!!widthb \!!counta % new
+ \advance\!!widthb -\@@ibafstand % new
+ \advance\!!widtha -\!!widthb % new
+ \divide\!!widtha \!!counta
+ \!!widthb\@@ibbreedte
\fi
\def\goto##1%
{\setnostrut
@@ -3054,25 +3402,25 @@
\egroup
\fi}
-%D \macros
+%D \macros
%D {overlaybutton}
%D
%D For converience we provide:
%D
-%D \starttypen
+%D \starttypen
%D \overlaybutton[reference]
%D \stoptypen
%D
-%D This command can be used to define overlays an/or can be
-%D used in the whatevertext areas, like:
+%D This command can be used to define overlays an/or can be
+%D used in the whatevertext areas, like:
%D
-%D \starttypen
+%D \starttypen
%D \defineoverlay[PrevPage][\overlaybutton{PrevPage}]
%D \setupbackgrounds[page][background=PrevPage]
%D \setuptexttexts[\overlaybutton{NextPage}]
%D \stoptypen
%D
-%D For practical reasons, this macro accepts square brackets
+%D For practical reasons, this macro accepts square brackets
%D as well as braces.
\definecomplexorsimple\overlaybutton
@@ -3080,29 +3428,44 @@
\def\simpleoverlaybutton#1%
{\complexoverlaybutton[#1]}
-\def\complexoverlaybutton% no text, next argument is [reference]
- {\button
- [\c!kader=\v!uit,\c!achtergrond=,
- \c!breedte=\overlaywidth,\c!hoogte=\overlayheight]%
- {}}
+% \def\complexoverlaybutton% no text, next argument is [reference]
+% {\button
+% [\c!kader=\v!uit,\c!achtergrond=,
+% \c!breedte=\overlaywidth,\c!hoogte=\overlayheight]%
+% {}}
+
+\def\complexoverlaybutton[#1]%
+ {\iflocation
+ \doifreferencefoundelse{#1}
+ {\overlayfakebox {#1}}
+ {\unknownreference{#1}}%
+ \fi}
+
+\def\overlayfakebox#1%
+ {\hbox
+ {\setbox\scratchbox\null
+ \wd\scratchbox\overlaywidth
+ \ht\scratchbox\overlayheight
+ \locationstrutfalse
+ \gotolocation{#1}{\box\scratchbox\presetgoto}}}
%D \macros
%D {dotextprefix}
%D
-%D In previous macros we used \type {\dotextprefix} to
-%D generate a space between a label and a number.
+%D In previous macros we used \type {\dotextprefix} to
+%D generate a space between a label and a number.
%D
-%D \starttypen
+%D \starttypen
%D \dotextprefix{text}
-%D \stoptypen
+%D \stoptypen
%D
%D Only when \type {text} is not empty, a space is inserted.
\def\dotextprefix#1%
{\bgroup
- \global\labeltextdonefalse % this is an ugly dependancy,
- \setbox\scratchbox=\hbox{#1}% to be solved some day
- \ifdim\wd\scratchbox>\!!zeropoint
+ \global\labeltextdonefalse % this is an ugly dependancy,
+ \setbox\scratchbox=\hbox{#1}% to be solved some day
+ \ifdim\wd\scratchbox>\zeropoint
\unhbox\scratchbox
\iflabeltextdone\else\@@rfscheider\fi
\else
@@ -3124,8 +3487,8 @@
%\c!urlspatie=\v!nee,
%\c!urlletter=,
%\c!urlkleur=,
- \c!converteerfile=\v!nee,
- %\c!strut=\v!nee, % some day an option
+ \c!converteerfile=\v!nee,
+ %\c!strut=\v!nee, % some day an option
\c!prefix=,
\c!breedte=.75\zetbreedte,
\c!links=\citaat\bgroup,
@@ -3157,6 +3520,4 @@
% \c!zelfdepagina=\v!ja,
% \c!onbekendeverwijzing=\v!ja]
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex
index d1149426e..31de1741b 100644
--- a/tex/context/base/core-reg.tex
+++ b/tex/context/base/core-reg.tex
@@ -121,21 +121,19 @@
% \GotoPar}
%\def\doregister#1%
-% {\def\currentregister{#1}%
-% \complexorsimpleempty\doregister}
-
-%\def\doregister#1%
% {\chardef\registerpagestatus=1
% \def\currentregister{#1}%
-% \complexorsimpleempty\doregister}
+% \doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja}
+% {\def\next{\dosingleempty\dodoregister}}
+% {\def\next{\dosingleempty\donoregister}}%
+% \next}
\def\doregister#1%
{\chardef\registerpagestatus=1
\def\currentregister{#1}%
\doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja}
- {\def\next{\dosingleempty\dodoregister}}
- {\def\next{\dosingleempty\donoregister}}%
- \next}
+ {\dosingleempty\dodoregister}
+ {\dosingleempty\donoregister}}
\def\donoregister[#1]%
{\dodoregister[#1]{}}
@@ -145,6 +143,9 @@
\ifvmode\nobreak\fi
\GotoPar}
+\def\writetoregister[#1]% to be documented
+ {\doregister{#1}}
+
\def\startregister%
{\dodoubleargument\dostartregister}
@@ -439,7 +440,7 @@
\dohandleregisterentry{#2}%
\global\firstsubsubentryfalse}}
-\def\dosetpageregister#1%
+\def\dosetpageregister#1% \currentregister gebruiken
{\dosetreglevel{\getvalue{\??id#1\c!criterium}}%
\global\let\currentregisterentry\empty
\global\firstsubentrytrue
@@ -461,8 +462,8 @@
{\edef\alllistreferences%
{\getvalue{\??id#1\??id\currentregisterentry}}%
\beforesplitstring\alllistreferences\at::\to\internallistreference
- \aftersplitstring\alllistreferences\at::\to\alllistreferences}
- {\let\alllistreferences=\empty
+ \aftersplitstring \alllistreferences\at::\to\alllistreferences}
+ {\let\alllistreferences\empty
\def\internallistreference{0}}}
\def\dosetlinkregister#1% is die page reference echt nodig?
@@ -471,10 +472,8 @@
\global\let\currentregisterentry\empty
\global\firstsubentrytrue % not needed
\global\firstsubsubentrytrue % not needed too
- \setvalue{#1\s!entrya}##1%
- {\dosetlinkregisterentrya{#1}{##1}}%
- \setvalue{#1\s!entry}##1%
- {\dosetpageregisterletter{#1}{##1}}}
+ \setvalue{#1\s!entrya}##1{\dosetlinkregisterentrya{#1}{##1}}%
+ \setvalue{#1\s!entry }##1{\dosetpageregisterletter{#1}{##1}}}
\def\dosetlinkregisterentrya#1#2%
{\global\utilitydonetrue
@@ -490,20 +489,20 @@
\getcommacommandsize[\alllistreferences]%
\getfromcommacommand[\alllistreferences][1]%
\ifnum\commalistsize=1
- \let\firstlistreference=\empty
- \let\midlistreference=\commalistelement
- \let\lastlistreference=\empty
+ \let\firstlistreference\empty
+ \let\midlistreference\commalistelement
+ \let\lastlistreference\empty
\else
- \let\firstlistreference=\commalistelement
+ \let\firstlistreference\commalistelement
\getfromcommacommand[\alllistreferences][\commalistsize]%
- \let\lastlistreference=\commalistelement
+ \let\lastlistreference\commalistelement
\ifnum\commalistsize=2
- \let\midlistreference=\empty
+ \let\midlistreference\empty
\else
- \!!counta=\commalistsize
- \divide\!!counta by 2
+ \!!counta\commalistsize
+ \divide\!!counta 2
\getfromcommacommand[\alllistreferences][\!!counta]%
- \let\midlistreference=\commalistelement
+ \let\midlistreference\commalistelement
\fi
\fi
% aangepast
@@ -685,71 +684,212 @@
% [ \v!midden=>\docommando\nextlistreference\v!volgende,
% \v!rechts=>\docommando\prevlistreference\v!vorige
% \docommando\nextlistreference\v!volgende]}}
+%
+% \def\doprocesslinkregister[#1][#2]#3%
+% {\hbox
+% {\doprocesspageregister[#2]{}{#3}%
+% \let\firstlistreference=\empty
+% \let\lastlistreference=\empty
+% \let\selflistreference=\empty
+% \let\prevlistreference=\empty
+% \let\nextlistreference=\empty
+% \getalllistreferences{#1}{#3}%
+% \doifnot{\alllistreferences}{}
+% {\def\dodocommando[##1-##2]%
+% {\ifx\firstlistreference\empty
+% \def\firstlistreference{##1-##2}%
+% \fi
+% \def\lastlistreference{##1-##2}%
+% \ifnum##1<\nextinternalreference\relax
+% \def\prevlistreference{##1-##2}%
+% \else\ifnum##1>\nextinternalreference\relax
+% \def\nextlistreference{##1-##2}%
+% \def\dodocommando[####1-####2]%
+% {\def\lastlistreference{####1-####2}}%
+% \else
+% \def\selflistreference{##1-##2}%
+% \fi\fi}%
+% \def\docommando##1%
+% {\dodocommando[##1]}%
+% \processcommacommand[\alllistreferences]\docommando}%
+% \ifx\prevlistreference\empty
+% \let\prevlistreference=\lastlistreference
+% \fi
+% \ifx\nextlistreference\empty
+% \let\nextlistreference=\firstlistreference
+% \fi
+% \ifx\prevlistreference\selflistreference
+% \let\prevlistreference=\empty
+% \let\nextlistreference=\empty
+% \fi
+% \def\dodocommando[##1-##2]%
+% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}%{\copy0}}%
+% \def\docommando##1##2%
+% {\bgroup
+% \ifx##1\empty
+% \doifvalue{\??id#1\c!onbekendeverwijzing}{\v!leeg}
+% {\hskip1em}%
+% \else
+% \setbox0=\hbox to 1em{\hss\showlocation{\symbol[##2]}\hss}%
+% \expandafter\dodocommando\expandafter[##1]%
+% \fi
+% \egroup}%
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [\v!midden=>\docommando\prevlistreference\v!vorige,
+% \v!links=>\docommando\prevlistreference\v!vorige
+% \docommando\nextlistreference\v!volgende]%
+% \doifreferencefoundelse{\s!lin:\internallistreference}
+% {\gotosomeinternal
+% {\s!lin}{\internallistreference}{\currentrealreference}
+% {\showlocation{\limitedregisterentry{#1}{#3}}}}
+% {\hbox{\limitedregisterentry{#1}{#3}}}%
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [ \v!midden=>\docommando\nextlistreference\v!volgende,
+% \v!rechts=>\docommando\prevlistreference\v!vorige
+% \docommando\nextlistreference\v!volgende]}}
+%
+% better:
+
+% \def\dodocommandoprolinrefA[#1-#2]%
+% {\ifx\firstlistreference\empty
+% \def\firstlistreference{#1-#2}%
+% \fi
+% \def\lastlistreference{#1-#2}%
+% \ifnum#1<\nextinternalreference\relax
+% \def\prevlistreference{#1-#2}%
+% \else\ifnum#1>\nextinternalreference\relax
+% \def\nextlistreference{#1-#2}%
+% \def\dodocommandoprolinrefA[##1-##2]%
+% {\def\lastlistreference{##1-##2}}%
+% \else
+% \def\selflistreference{#1-#2}%
+% \fi\fi}
+%
+% more efficient :
+
+\def\dodocommandoprolinrefAA[#1-#2]%
+ {\def\lastlistreference{#1-#2}}
+
+\def\dodocommandoprolinrefA[#1-#2]%
+ {\def\lastlistreference{#1-#2}%
+ \ifx\firstlistreference\empty
+ \let\firstlistreference\lastlistreference
+ \fi
+ \ifnum#1<\nextinternalreference\relax
+ \let\prevlistreference\lastlistreference
+ \else\ifnum#1>\nextinternalreference\relax
+ \let\nextlistreference\lastlistreference
+ \let\dodocommandoprolinrefA\dodocommandoprolinrefAA
+ \else
+ \let\selflistreference\lastlistreference
+ \fi\fi}
+
+\def\docommandoprolinrefA#1%
+ {\dodocommandoprolinrefA[#1]}
+
+\def\dodocommandoprolinrefB[#1-#2]%
+ {\gotonextinternal{\s!ind}{#1}{#2}{\box0}}
+
+\def\docommandoprolinrefB#1#2#3%
+ {\bgroup
+ \ifx#2\empty
+ \doifvalue{\??id#1\c!onbekendeverwijzing}\v!leeg{\hskip1em}%
+ \else
+ \setbox0=\hbox to 1em{\hss\showlocation{\symbol[#3]}\hss}%
+ \expandafter\dodocommandoprolinrefB\expandafter[#2]%
+ \fi
+ \egroup}
+
+%\def\doprocesslinkregister[#1][#2]#3%
+% {\hbox
+% {\doprocesspageregister[#2]{}{#3}%
+% \let\firstlistreference\empty
+% \let\lastlistreference\empty
+% \let\selflistreference\empty
+% \let\prevlistreference\empty
+% \let\nextlistreference\empty
+% \getalllistreferences{#1}{#3}%
+% \ifx\alllistreferences\empty \else
+% \expanded{\rawprocesscommalist[\alllistreferences]}\docommandoprolinrefA
+% \fi
+% \ifx\prevlistreference\empty
+% \let\prevlistreference\lastlistreference
+% \fi
+% \ifx\nextlistreference\empty
+% \let\nextlistreference\firstlistreference
+% \fi
+% \ifx\prevlistreference\selflistreference
+% \let\prevlistreference\empty
+% \let\nextlistreference\empty
+% \fi
+% % can be a bit faster is one proces only
+% % can even be resolved at definition time
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [\v!midden=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige,
+% \v!links=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige
+% \docommandoprolinrefB{#1}\nextlistreference\v!volgende]%
+% \doifreferencefoundelse{\s!lin:\internallistreference}
+% {\gotosomeinternal
+% {\s!lin}{\internallistreference}{\currentrealreference}
+% {\showlocation{\limitedregisterentry{#1}{#3}}}}
+% {\hbox{\limitedregisterentry{#1}{#3}}}%
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [ \v!midden=>\docommandoprolinrefB{#1}\nextlistreference\v!volgende,
+% \v!rechts=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige
+% \docommandoprolinrefB{#1}\nextlistreference\v!volgende]}}
\def\doprocesslinkregister[#1][#2]#3%
{\hbox
{\doprocesspageregister[#2]{}{#3}%
- \let\firstlistreference=\empty
- \let\lastlistreference=\empty
- \let\selflistreference=\empty
- \let\prevlistreference=\empty
- \let\nextlistreference=\empty
+ \let\firstlistreference\empty
+ \let\lastlistreference\empty
+ \let\selflistreference\empty
+ \let\prevlistreference\empty
+ \let\nextlistreference\empty
\getalllistreferences{#1}{#3}%
- \doifnot{\alllistreferences}{}
- {\def\dodocommando[##1-##2]%
- {\ifx\firstlistreference\empty
- \def\firstlistreference{##1-##2}%
- \fi
- \def\lastlistreference{##1-##2}%
- \ifnum##1<\nextinternalreference\relax
- \def\prevlistreference{##1-##2}%
- \else\ifnum##1>\nextinternalreference\relax
- \def\nextlistreference{##1-##2}%
- \def\dodocommando[####1-####2]%
- {\def\lastlistreference{####1-####2}}%
- \else
- \def\selflistreference{##1-##2}%
- \fi\fi}%
- \def\docommando##1%
- {\dodocommando[##1]}%
- \processcommacommand[\alllistreferences]\docommando}%
+ \ifx\alllistreferences\empty \else
+ \expanded{\rawprocesscommalist[\alllistreferences]}\docommandoprolinrefA
+ \fi
\ifx\prevlistreference\empty
- \let\prevlistreference=\lastlistreference
+ \let\prevlistreference\lastlistreference
\fi
\ifx\nextlistreference\empty
- \let\nextlistreference=\firstlistreference
+ \let\nextlistreference\firstlistreference
\fi
\ifx\prevlistreference\selflistreference
- \let\prevlistreference=\empty
- \let\nextlistreference=\empty
+ \let\prevlistreference\empty
+ \let\nextlistreference\empty
+ \fi
+ \setalignmentswitch{\getvalue{\??id#1\c!plaats}}%
+ \ifcase\alignmentswitch
+ % links
+ \docommandoprolinrefB{#1}\prevlistreference\v!vorige
+ \docommandoprolinrefB{#1}\nextlistreference\v!volgende
+ \or
+ % midden
+ \docommandoprolinrefB{#1}\prevlistreference\v!vorige
+ \or
+ % rechts
\fi
- \def\dodocommando[##1-##2]%
- {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}%{\copy0}}%
- \def\docommando##1##2%
- {\bgroup
- \ifx##1\empty
- \doifvalue{\??id#1\c!onbekendeverwijzing}{\v!leeg}
- {\hskip1em}%
- \else
- \setbox0=\hbox to 1em{\hss\showlocation{\symbol[##2]}\hss}%
- \expandafter\dodocommando\expandafter[##1]%
- \fi
- \egroup}%
- \processaction
- [\getvalue{\??id#1\c!plaats}]
- [\v!midden=>\docommando\prevlistreference\v!vorige,
- \v!links=>\docommando\prevlistreference\v!vorige
- \docommando\nextlistreference\v!volgende]%
\doifreferencefoundelse{\s!lin:\internallistreference}
{\gotosomeinternal
- {\s!lin}{\internallistreference}{\currentrealreference}
+ \s!lin \internallistreference \currentrealreference
{\showlocation{\limitedregisterentry{#1}{#3}}}}
{\hbox{\limitedregisterentry{#1}{#3}}}%
- \processaction
- [\getvalue{\??id#1\c!plaats}]
- [ \v!midden=>\docommando\nextlistreference\v!volgende,
- \v!rechts=>\docommando\prevlistreference\v!vorige
- \docommando\nextlistreference\v!volgende]}}
+ \ifcase\alignmentswitch
+ % links
+ \or
+ % midden
+ \docommandoprolinrefB{#1}\nextlistreference\v!volgende
+ \or
+ % rechts
+ \docommandoprolinrefB{#1}\prevlistreference\v!vorige
+ \docommandoprolinrefB{#1}\nextlistreference\v!volgende
+ \fi}}
% \def\dodolinkedregister[#1][#2]#3% page auto link
% {\bgroup
@@ -769,20 +909,20 @@
% \ifvmode\nobreak\fi
% \GotoPar}
-\def\dodolinkedregister[#1][#2]#3% page auto link
- {\bgroup
+\def\dodolinkedregister[#1][#2]#3% page auto link
+ {\bgroup
\chardef\registerpagestatus=1
\def\currentregister{#1}%
\iflocation
\ifautoregisterhack
- \def\next{\doprocessautoregister[#1][#2]{#3}}%
+ \def\next{\doprocessautoregister[#1][#2]}%
\else
- \def\next{\doprocesslinkregister[#1][#2]{#3}}%
+ \def\next{\doprocesslinkregister[#1][#2]}%
\fi
\else
- \def\next{\doprocesspageregister[#2]{}{#3}}%
+ \def\next{\doprocesspageregister[#2]{}}%
\fi
- \next
+ \next{#3}%
\egroup
\ifvmode\nobreak\fi
\GotoPar}
@@ -811,7 +951,10 @@
\pagereference[-:\s!lin:\internallistreference]%
\pluscounter{autolink:#1}%
\bgroup
- \setupinteraction[\c!kleur=,\c!contrastkleur=,\c!letter=]% kan sneller
+ %\setupinteraction[\c!kleur=,\c!contrastkleur=,\c!letter=]% kan sneller
+ \resetinteractionparameter\c!kleur
+ \resetinteractionparameter\c!contrastkleur
+ \resetinteractionparameter\c!letterkleur
\naarbox
{\limitedregisterentry{#1}{\begstrut#2}}%
[JS(SetRegisterEntry{\v!register,\countervalue{autolink:#1},#2,{\alllistreferences}})]%
@@ -933,7 +1076,8 @@
\c!plaats=\v!midden,
\c!maxbreedte=,
\c!nummer=\v!nee,
- \c!onbekendeverwijzing=\v!leeg]%
+ \c!onbekendeverwijzing=\v!leeg,
+ \c!expansie=]%
\presetheadtext[#1=\Word{#1}]%
\setvalue{#1}%
{\doregister{#1}}%
@@ -976,12 +1120,12 @@
{\doutilities{#1}{\jobname}{#1}{}{}}%
\endgroup
\ifregistergeplaatst
- \enablemode [\systemmodeprefix\v!register]%
+ \setsystemmode \v!register
\else
- \disablemode[\systemmodeprefix\v!register]%
+ \resetsystemmode\v!register
\fi}
-\def\bepaalregisterkenmerken%
+\def\bepaalregisterkenmerken
{\dodoubleempty\dobepaalregisterkenmerken}
\definieerregister
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index cca5ac4d5..06642fe3f 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -13,8 +13,6 @@
\writestatus{loading}{Context Core Macros / Ruled Stuff Handling}
-% to test: [#1]#2[#3] in \startlocalframed
-
\unprotect
%D \macros
@@ -30,7 +28,7 @@
%D preset value of .4pt equals the default hard coded \TEX\
%D rule width.
-\newdimen\linewidth
+\newdimen\linewidth
\def\dosetuplinewidth[#1]%
{\assigndimension{#1}{\linewidth}{0.2pt}{0.4pt}{0.6pt}}
@@ -45,6 +43,15 @@
% \def\setuprules%
% {\dosingleargument\dosetuprules}
+%D \macros
+%D {ruledlinewidth, inheritruledlinewidth}
+%D
+%D Inside framed boxed we will use a private dimensions. As
+%D an option one can let the linewidth inherit its value from
+%D this one.
+
+\newdimen\ruledlinewidth \newif\ifinheritruledlinewidth
+
%D \TEX\ lacks support for color and even gray scales. The next
%D macros can provide a sort of poor mans gray scales as well
%D as give access to more suitable methods of rendering. Such a
@@ -199,25 +206,22 @@
{\vrule\!!width#1\!!height#2\!!depth#3}%
\def\dofilledroundbox\width#1\height#2\depth#3\radius#4\\%
- {\ovalbox{#1}{#2}{#3}{\linewidth}{#4}{\v!uit}{\v!aan}}
+ {\ovalbox{#1}{#2}{#3}{\ruledlinewidth}{#4}{\v!uit}{\v!aan}}
-\def\ovalbox#1#2#3#4#5#6#7%
+\def\ovalbox#1#2#3#4#5#6#7% direct #1 etc passeren
{\bgroup
- \scratchdimen=#1\edef\ovalwid{\number\scratchdimen}%
- \scratchdimen=#2\edef\ovalhei{\number\scratchdimen}%
- \scratchdimen=#3\edef\ovaldep{\number\scratchdimen}%
- \scratchdimen=#4\edef\ovallin{\number\scratchdimen}%
- \scratchdimen=#5\edef\ovalrad{\number\scratchdimen}%
- \doifelse{#6}{\v!aan} % will be a macro that handles
- {\def\ovalstr{1}} % start, stop, ja, nee, aan, uit
- {\def\ovalstr{0}}% % and something \doif
- \doifelse{#7}{\v!aan}
+ \scratchdimen#1\edef\ovalwid{\the\scratchdimen}%
+ \scratchdimen#2\edef\ovalhei{\the\scratchdimen}%
+ \scratchdimen#3\edef\ovaldep{\the\scratchdimen}%
+ \scratchdimen#4\edef\ovallin{\the\scratchdimen}%
+ \scratchdimen#5\edef\ovalrad{\the\scratchdimen}%
+ \doifelse{#6}\v!aan % will be a macro that handles
+ {\def\ovalstr{1}} % start, stop, ja, nee, aan, uit
+ {\def\ovalstr{0}}% % and something \doif
+ \doifelse{#7}\v!aan
{\def\ovalfil{1}}
{\def\ovalfil{0}}%
- \doovalbox
- {\ovalwid}{\ovalhei}{\ovaldep}
- {\ovallin}{\ovalrad}
- {\ovalstr}{\ovalfil}%
+ \doovalbox\ovalwid\ovalhei\ovaldep\ovallin\ovalrad\ovalstr\ovalfil
\egroup}
%D The oval box is drawn using a special macro, depending on
@@ -226,20 +230,29 @@
%D It won't be a surprise that we not only provide gray boxes,
%D but also colored ones. Here it is:
+% \def\setcolorbox\width#1\height#2\depth#3\color#4\corner#5\radius#6\\%
+% {\ifincolor
+% \doifcolorelse{#4}{\color[#4]%
+% {\dofilledbox \width#1\height#2\depth#3\corner#5\radius#6\\}}
+% {\dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\}%
+% \else
+% \dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\%
+% \fi}
+
\def\setcolorbox\width#1\height#2\depth#3\color#4\corner#5\radius#6\\%
- {\ifincolor
- \doifcolorelse{#4}{\color[#4]%
+ {\hbox{\ifincolor
+ \doifcolorelse{#4}{\localcolortrue\color[#4]%
{\dofilledbox \width#1\height#2\depth#3\corner#5\radius#6\\}}
{\dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\}%
\else
\dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\%
- \fi}
+ \fi}}
\def\colorbox%
{\setcolorbox}
%D \macros
-%D {defineoverlay,doifoverlayelse,
+%D {defineoverlay,doifoverlayelse,overlayoffset,
%D overlaywidth, overlayheight, overlaydepth,
%D overlaycolor, overlaylinecolor, overlaylinewidth}
%D
@@ -299,12 +312,21 @@
\def\overlaywidth {\the\vsize\space} % We preset the variables
\def\overlayheight {\the\hsize\space} % to some reasonable default
\let\overlaydepth \!!zeropoint % values. The attributes
-\let\overlaycolor \empty % of the frame can be (are)
-\let\overlaylinewidth \!!zeropoint % set somewhere else.
+\let\overlayoffset \!!zeropoint % of the frame can be (are)
+\let\overlaycolor \empty % set somewhere else.
+\let\overlaylinewidth \!!zeropoint %
\let\overlaylinecolor \empty %
+%D The next register is used to initialize overlays.
+
\newtoks\everyoverlay
+%D An example of an initialization is the following (overlays
+%D can contain text and be executed under an regime where
+%D interlineskip is off).
+
+\appendtoks \oninterlineskip \to \everyoverlay
+
\def\defineoverlay%
{\dodoubleargument\dodefineoverlay}
@@ -313,40 +335,72 @@
{\setvalue{\??ov##1}{\executedefinedoverlay##1\\#2\\}}%
\processcommalist[#1]\docommando}
+% \long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9%
+% {\bgroup
+% \scratchdimen=#3%
+% \edef\overlaywidth{\the\scratchdimen\space}%
+% \scratchdimen=#4%
+% \advance\scratchdimen by #5%
+% \edef\overlayheight{\the\scratchdimen\space}%
+% \scratchdimen=#5%
+% \edef\overlaydepth{\the\scratchdimen\space}%
+% \edef\overlaycolor{#6}%
+% \edef\overlayoffset{\backgroundoffset\space}% we steal this one
+% \prependtoks
+% \hsize\overlaywidth
+% \vsize\overlayheight
+% \to\everyoverlay
+% %\writestatus
+% % {overlay}
+% % {#1\space w=\overlaywidth/h+d=\overlayheight/d=\overlaydepth]}%
+% \setbox0=\hbox{\lower\overlaydepth\hbox{\the\everyoverlay#2}}%
+% \dimen0=\wd0 \advance\dimen0 by -\overlaywidth
+% \dimen2=\ht0 \advance\dimen2 by -#4% not \overlayheight
+% \wd0=\overlaywidth
+% \ht0=\overlayheight
+% \dp0=\overlaydepth
+% \setbox0=\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box0}%
+% \wd0=\overlaywidth
+% \ht0=\overlayheight
+% \dp0=\overlaydepth
+% \box0
+% \egroup}
+
+\prependtoks
+ \hsize\overlaywidth
+ \vsize\overlayheight
+\to\everyoverlay
+
\long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9%
{\bgroup
- \scratchdimen=#3%
+ \scratchdimen#3%
\edef\overlaywidth{\the\scratchdimen\space}%
- \scratchdimen=#4%
- \advance\scratchdimen by #5%
+ \scratchdimen#4%
+ \advance\scratchdimen #5%
\edef\overlayheight{\the\scratchdimen\space}%
- \scratchdimen=#5%
+ \scratchdimen#5%
\edef\overlaydepth{\the\scratchdimen\space}%
\edef\overlaycolor{#6}%
- \prependtoks
- \hsize\overlaywidth
- \vsize\overlayheight
- \to\everyoverlay
+ \let\overlayoffset\backgroundoffset % we steal this one
%\writestatus
% {overlay}
% {#1\space w=\overlaywidth/h+d=\overlayheight/d=\overlaydepth]}%
- \setbox0=\hbox{\lower\overlaydepth\hbox{\the\everyoverlay#2}}%
- \dimen0=\wd0 \advance\dimen0 by -\overlaywidth
- \dimen2=\ht0 \advance\dimen2 by -#4% not \overlayheight
- \wd0=\overlaywidth
- \ht0=\overlayheight
- \dp0=\overlaydepth
- \setbox0=\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box0}%
- \wd0=\overlaywidth
- \ht0=\overlayheight
- \dp0=\overlaydepth
- \box0
+ \setbox\scratchbox\hbox{\lower\overlaydepth\hbox{\the\everyoverlay#2}}%
+ \dimen0\wd\scratchbox \advance\dimen0 -\overlaywidth
+ \dimen2\ht\scratchbox \advance\dimen2 -#4% not \overlayheight
+ %\wd\scratchbox\overlaywidth
+ %\ht\scratchbox\overlayheight
+ %\dp\scratchbox\overlaydepth
+ \setbox\scratchbox\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box\scratchbox}%
+ \wd\scratchbox\overlaywidth
+ \ht\scratchbox\overlayheight
+ \dp\scratchbox\overlaydepth
+ \box\scratchbox
\egroup}
%D The empty case is:
-\def\executeoverlay#1#2#3#4#5#6#7%
- {}
+\let\executeoverlay\gobblesevenarguments
%D For testing we provide:
@@ -387,25 +441,36 @@
{\bgroup
\def\currentbackground{#1}%
\the\everybackgroundbox
+% \setbox\extraframebox=\hbox
+% {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments
+% {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}%
+% \setbox\extraframebox=\hbox
+% {\vbox{\moveleft\dimen0\box\extraframebox}}%
\setbox\extraframebox=\hbox
- {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments
- {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}%
- \setbox\extraframebox=\hbox
- {\vbox{\moveleft\dimen0\box\extraframebox}}%
+ {\vbox{\moveleft\dimen0\hbox
+ {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments
+ {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}}}%
\wd\extraframebox=\zeropoint % \backgroundwidth
\ht\extraframebox=\backgroundheight
\dp\extraframebox=\backgrounddepth
\box\extraframebox % \hskip-\backgroundwidth
\egroup}
+\let\backgroundoffset\!!zeropoint
+\let\backgrounddepth \!!zeropoint
+\def\backgroundwidth {\the\hsize}
+\def\backgroundheight{\the\vsize}
+
\def\dobackgroundbox#1\background#2\color#3\raster#4\offset#5\corner
#6\radius#7\depth#8\\%
{\vbox
{\forgetall\boxmaxdepth\maxdimen
\dimen0=#5\relax
- \dimen2=\wd#1\advance\dimen2 by 2\dimen0
- \dimen4=\ht#1\advance\dimen4 by \dimen0
- \dimen6=\dp#1\advance\dimen6 by \dimen0\advance\dimen6 by #8\relax
+ \dimen2=\wd#1\advance\dimen2 2\dimen0
+ \dimen4=\ht#1\advance\dimen4 \dimen0
+ \dimen6=\dp#1\advance\dimen6 \dimen0
+ \advance\dimen6 #8\relax
+ \edef\backgroundoffset{\the\dimen0}%
\edef\backgroundwidth {\the\wd#1}%
\edef\backgroundheight{\the\ht#1}%
\edef\backgrounddepth {\the\dp#1}%
@@ -435,9 +500,9 @@
\def\dooutlinebox#1\color#2\offset#3\corner#4\radius#5\depth#6\toggle#7\\%
{\vbox % rules on top of box
{\dimen0=#3\relax
- \dimen2=\wd#1\advance\dimen2 by 2\dimen0
- \dimen4=\ht#1\advance\dimen4 by \dimen0
- \dimen6=\dp#1\advance\dimen6 by \dimen0\advance\dimen6 by #6\relax
+ \dimen2=\wd#1\advance\dimen2 2\dimen0
+ \dimen4=\ht#1\advance\dimen4 \dimen0
+ \dimen6=\dp#1\advance\dimen6 \dimen0\advance\dimen6 by #6\relax
\ifdim\dimen6<\zeropoint
\advance\dimen4 by \dimen6 \dimen8=-\dimen6 \dimen6=\zeropoint
\else
@@ -492,18 +557,18 @@
\def\@@frame@@{@@frame@@}
-\setvalue{t\@@frame@@\v!aan\v!aan}{\hrule\!!height\linewidth\kern-\linewidth}
-\setvalue{t\@@frame@@\v!uit\v!aan}{\hrule\!!height\linewidth\kern-\linewidth}
- \setvalue{t\@@frame@@\v!aan}{\hrule\!!height\linewidth\kern-\linewidth}
-\setvalue{b\@@frame@@\v!aan\v!aan}{\kern-\linewidth\hrule\!!height\linewidth}
-\setvalue{b\@@frame@@\v!uit\v!aan}{\kern-\linewidth\hrule\!!height\linewidth}
- \setvalue{b\@@frame@@\v!aan}{\kern-\linewidth\hrule\!!height\linewidth}
-\setvalue{l\@@frame@@\v!aan\v!aan}{\vrule\!!width\linewidth\kern-\linewidth}
-\setvalue{l\@@frame@@\v!uit\v!aan}{\vrule\!!width\linewidth\kern-\linewidth}
- \setvalue{l\@@frame@@\v!aan}{\vrule\!!width\linewidth\kern-\linewidth}
-\setvalue{r\@@frame@@\v!aan\v!aan}{\kern-\linewidth\vrule\!!width\linewidth}
-\setvalue{r\@@frame@@\v!uit\v!aan}{\kern-\linewidth\vrule\!!width\linewidth}
- \setvalue{r\@@frame@@\v!aan}{\kern-\linewidth\vrule\!!width\linewidth}
+\setvalue{t\@@frame@@\v!aan\v!aan}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+\setvalue{t\@@frame@@\v!uit\v!aan}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+ \setvalue{t\@@frame@@\v!aan}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+\setvalue{b\@@frame@@\v!aan\v!aan}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+\setvalue{b\@@frame@@\v!uit\v!aan}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+ \setvalue{b\@@frame@@\v!aan}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+\setvalue{l\@@frame@@\v!aan\v!aan}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+\setvalue{l\@@frame@@\v!uit\v!aan}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+ \setvalue{l\@@frame@@\v!aan}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+\setvalue{r\@@frame@@\v!aan\v!aan}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+\setvalue{r\@@frame@@\v!uit\v!aan}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+ \setvalue{r\@@frame@@\v!aan}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
%D I condidered using the low level support command
%D \type{\ruledhbox}, but this would slow down processing by a
@@ -515,7 +580,7 @@
%D {\ovalbox}.
\def\dostrokedroundbox\width#1\height#2\depth#3\radius#4\toggle#5\left#6\\%
- {\doif{#5}{\v!aan}{\ovalbox{#1}{#2}{#3}{\linewidth}{#4}{\v!aan}{\v!uit}}}
+ {\doif{#5}{\v!aan}{\ovalbox{#1}{#2}{#3}{\ruledlinewidth}{#4}{\v!aan}{\v!uit}}}
%D The next few macros are probably the most misused ones in
%D \CONTEXT. They deal with putting rules around boxes, provide
@@ -572,16 +637,16 @@
{\copylocalframed[#1][\??oi]}
\def\copylocalframed[#1]#2[#3]%
- {\copyparameters[#1][#3]
- [\c!breedte,\c!hoogte,\c!offset,\c!leeg,
- \c!straal,\c!hoek,\c!diepte,\c!kader,\c!kaderkleur,
- \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader,
- \c!lijndikte,\c!kaderoffset,\c!voorgrondkleur,\c!achtergrond,
- \c!achtergrondoffset,\c!achtergrondraster,\c!achtergrondkleur,
+ {\copyparameters[#1][#3]%
+ [\c!breedte,\c!hoogte,\c!offset,\c!leeg,\c!lijndikte,%
+ \c!straal,\c!hoek,\c!diepte,\c!kader,\c!kaderkleur,%
+ \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader,%
+ \c!lijndikte,\c!kaderoffset,\c!voorgrondkleur,\c!achtergrond,%
+ \c!achtergrondoffset,\c!achtergrondraster,\c!achtergrondkleur,%
\c!uitlijnen,\c!onder,\c!boven,\c!strut,\c!plaats]%
- \copyparameters[#1\c!achtergrond][#1]
+ \copyparameters[#1\c!achtergrond][#1]%
[\c!straal,\c!hoek,\c!diepte]%
- \copyparameters[#1\c!kader][#1]
+ \copyparameters[#1\c!kader][#1]%
[\c!straal,\c!hoek,\c!diepte]}
\def\setupframed%
@@ -601,7 +666,7 @@
\newif\ifinframed
-\def\localframed%
+\def\localframed
{\bgroup
\dodoubleempty\startlocalframed}
@@ -617,6 +682,9 @@
%D terms of the main offset. However, see for instance page
%D backgrounds, when \type {#2} sets the offset to \type
%D {overlay}, both offsets become invalid.
+%D
+%D Because it is used so often the he next macro is (and
+%D looks) rather optimized.
\def\startlocalframed[#1][#2]%
{\bgroup
@@ -624,11 +692,11 @@
\edef\@@framed{#1}%
% % this piece of pre expansion is needed (sometimes used in frameoffset)
% \doifvaluesomething{\@@framed\c!lijndikte}
-% {\linewidth=\getvalue{\@@framed\c!lijndikte}}%
+% {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}}%
% this piece of pre expansion is needed (sometimes used circular)
\scratchdimen\getvalue{\@@framed\c!kaderoffset}%
\setevalue{\@@framed\c!kaderoffset}{\the\scratchdimen}%
- \doifnotvalue{\@@framed\c!achtergrondoffset}{\v!kader}
+ \doifnotvalue{\@@framed\c!achtergrondoffset}\v!kader
{\scratchdimen\getvalue{\@@framed\c!achtergrondoffset}%
\setevalue{\@@framed\c!achtergrondoffset}{\the\scratchdimen}}%
% we need to register the (outer) color
@@ -644,12 +712,13 @@
\edef\localformat{\getvalue{\@@framed\c!uitlijnen}}%
\edef\localstrut{\getvalue{\@@framed\c!strut}}%
\doifvaluesomething{\@@framed\c!lijndikte}
- {\linewidth=\getvalue{\@@framed\c!lijndikte}}%
+ {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}\relax
+ \ifinheritruledlinewidth\linewidth\ruledlinewidth\fi}%
\ifx\localformat\empty
\boxhasformatfalse
\else
\boxhasformattrue
- \dosetraggedcommand{\localformat}%
+ \dosetraggedcommand\localformat
\edef\beforeframedbox{\raggedtopcommand\getvalue{\@@framed\c!boven}}%
\edef\afterframedbox {\getvalue{\@@framed\c!onder}\raggedbottomcommand}%
\fi
@@ -657,12 +726,12 @@
\boxhasoffsetfalse
\boxhasstrutfalse
\boxisoverlaidfalse
- \@@localoffset=\linewidth
+ \@@localoffset\ruledlinewidth
\else\ifx\localoffset\v!overlay
\boxhasoffsetfalse
\boxhasstrutfalse
\boxisoverlaidtrue
- \@@localoffset=\zeropoint
+ \@@localoffset\zeropoint
\else
\boxhasoffsettrue
\boxhasstruttrue
@@ -673,22 +742,22 @@
\else
\let\defaultframeoffset\localoffset
\fi
- \@@localoffset=\localoffset
- \advance\@@localoffset by \linewidth
+ \@@localoffset\localoffset
+ \advance\@@localoffset by \ruledlinewidth
\fi\fi
\ifx\localwidth\v!passend
\ifboxhasformat
\boxhaswidthtrue
- \!!widtha=\hsize
+ \!!widtha\hsize
\else
\boxhaswidthfalse
\fi
\else\ifx\localwidth\v!ruim
\boxhaswidthtrue
- \!!widtha=\hsize
+ \!!widtha\hsize
\else
\boxhaswidthtrue
- \!!widtha=\localwidth
+ \!!widtha\localwidth
\fi\fi
\ifx\localheight\v!passend
\boxhasheightfalse % no longer: \boxhasstrutfalse
@@ -696,12 +765,12 @@
\boxhasheightfalse
\else
\boxhasheighttrue
- \!!heighta=\localheight
+ \!!heighta\localheight
\fi\fi
\ifdim\!!widtha=\hsize
- \parindent=\zeropoint
+ \parindent\zeropoint
\setlocalhsize
- \!!widtha=\localhsize
+ \!!widtha\localhsize
\fi
\advance\!!widtha -2\@@localoffset
\advance\!!heighta -2\@@localoffset
@@ -710,61 +779,78 @@
\fi
\ifboxhasstrut
\setstrut
- \let\localbegstrut=\begstrut
- \let\localendstrut=\endstrut
- \let\localstrut =\strut
+ \let\localbegstrut\begstrut
+ \let\localendstrut\endstrut
+ \let\localstrut \strut
\else
- \let\localbegstrut=\pseudobegstrut % was: \relax
- \let\localendstrut=\pseudoendstrut % was: \relax
- \let\localstrut =\pseudostrut % was: \relax
+ \let\localbegstrut\pseudobegstrut % was: \relax
+ \let\localendstrut\pseudoendstrut % was: \relax
+ \let\localstrut \pseudostrut % was: \relax
%\ifboxhasheight\ifdim\!!heighta<\ht\strutbox % saveguard
- % \let\localbegstrut=\relax % but not that
- % \let\localstrut =\relax % save afterall
+ % \let\localbegstrut\relax % but not that
+ % \let\localstrut \relax % save afterall
%\fi\fi
\fi
\ifboxhasheight
- \let\\=\vboxednewline
+ \let\\\vboxednewline
\ifboxhaswidth
- \let\hairline=\vboxedhairline
+ \let\hairline\vboxedhairline
\ifboxhasformat
- \let\next=\doformatboxSomeFormat
+ \let\next\doformatboxSomeFormat
\else
- \let\next=\doformatboxNoFormat
+ \let\next\doformatboxNoFormat
\fi
\else
- \let\hairline=\hboxedhairline
+ \let\hairline\hboxedhairline
\ifboxhasformat
- \let\next=\doformatboxHeight
+ \let\next\doformatboxHeight
\else
- \let\next=\doformatboxVSize
+ \let\next\doformatboxVSize
\fi
\fi
\else
\ifboxhaswidth
\ifboxhasformat
- \let\hairline=\vboxedhairline
- \let\\=\vboxednewline
- \let\next=\doformatboxWidth
+ \let\hairline\vboxedhairline
+ \let\\\vboxednewline
+ \let\next\doformatboxWidth
\else
- \let\hairline=\hboxedhairline
- \let\\=\hboxednewline
- \let\next=\doformatboxHSize
+ \let\hairline\hboxedhairline
+ \let\\\hboxednewline
+ \let\next\doformatboxHSize
\fi
\else
- \let\hairline=\hboxedhairline
- \let\\=\hboxednewline
- \let\next=\doformatboxNoSize
+ \let\hairline\hboxedhairline
+ \let\\\hboxednewline
+ \let\next\doformatboxNoSize
\fi
\fi
- \def\dowithframedbox%
- {\let\postprocessframebox\undefined %new
- \aftergroup\stoplocalframed}%
\edef\framedwidth % a new feature
{\ifdim\!!widtha >\zeropoint\the\!!widtha \else\zeropoint\fi}%
\edef\framedheight% a new feature
{\ifdim\!!heighta>\zeropoint\the\!!heighta\else\zeropoint\fi}%
- \afterassignment\dowithframedbox
- \setbox\framebox=\next}
+ % first alternative
+ %\def\dowithframedbox%
+ % {\let\postprocessframebox\undefined %new
+ % \aftergroup\stoplocalframed}%
+ % \afterassignment\dowithframedbox
+ % \setbox\framebox=\next}
+ % second alternative
+ %\dowithnextbox
+ % {\setbox\framebox=\box\nextbox
+ % \let\postprocessframebox\undefined %new
+ % \stoplocalframed}
+ % \next}
+ % third alternative
+ \afterassignment\dodowithframebox
+ \setbox\framebox\next}
+
+\def\dowithframebox
+ {\let\postprocessframebox\undefined
+ \stoplocalframed}
+
+\def\dodowithframebox
+ {\aftergroup\dowithframebox}
\let\afterframedbox \relax
\let\beforeframedbox\relax
@@ -803,15 +889,17 @@
\resetshapeframebox
\fi
\ifboxhaswidth
- \wd\framebox=\!!widtha
+ \wd\framebox\!!widtha
\fi
\ifboxhasheight
- \ht\framebox=\!!heighta
+ \ht\framebox\!!heighta
\fi
- \doifvalue{\@@framed\c!leeg}{\v!ja}
- {\setbox0=\null
- \wd0=\wd\framebox \ht0=\ht\framebox \dp0=\dp\framebox
- \setbox\framebox=\box0\relax}%
+ \doifvalue{\@@framed\c!leeg}\v!ja
+ {\setbox\scratchbox\null
+ \wd\scratchbox\wd\framebox
+ \ht\scratchbox\ht\framebox
+ \dp\scratchbox\dp\framebox
+ \setbox\framebox\box\scratchbox}%
\stopregistercolor
\docolorframebox
\ifboxhasoffset
@@ -824,15 +912,12 @@
\postprocessframebox\framebox
\fi
\edef\overlaylinecolor{\getvalue{\@@framed\c!kaderkleur}}%
- \edef\overlaylinewidth{\the\linewidth}%
- \doifnotvalue{\@@framed\c!kader}{\v!overlay} % faster -)
- {\doframedbox}%
- \doifvaluesomething{\@@framed\c!achtergrond}
- {\dobackedbox}%
- \doifelsevalue{\@@framed\c!plaats}{\v!laag}
+ \edef\overlaylinewidth{\the\ruledlinewidth}%
+ \doifnotvalue {\@@framed\c!kader }\v!overlay\doframedbox
+ \doifvaluesomething{\@@framed\c!achtergrond}\dobackedbox
+ \doifelsevalue{\@@framed\c!plaats}\v!laag
{\doinlineframedbox}
- {\doifvalue{\@@framed\c!plaats}{\v!diepte}
- {\doloweredframedbox}}%
+ {\doifvalue{\@@framed\c!plaats}\v!diepte\doloweredframedbox}%
\box\framebox
\egroup
\egroup}
@@ -1027,7 +1112,7 @@
{\kern#1\hbox{\kern#1\box\framebox\kern#1}\kern#1}}
\def\dooffsetframebox{\dowidenframebox\localoffset}
-\def\dolocateframebox{\dowidenframebox\linewidth }
+\def\dolocateframebox{\dowidenframebox\ruledlinewidth}
%D Let's hope that the next few examples show us enough of
%D what needs to be done by the auxiliary macros.
@@ -1426,15 +1511,26 @@
%D When typesetting the framed box inline, we have to keep the
%D baseline intact outside as well as inside the framed box.
+%\def\doinlineframedbox%
+% {\getboxheight\dimen2\of\box\framebox
+% \advance\dimen2 by -\ht\strutbox
+% \dimen0=.5\dimen2
+% \ifboxhasoffset
+% \advance\dimen0 by \getvalue{\@@framed\c!offset}%
+% \fi
+% \advance\dimen0 by 2\ruledlinewidth
+% \setbox\framebox=\hbox{\lower\dimen0\box\framebox}%
+% \ht\framebox\ht\strutbox
+% \dp\framebox\dp\strutbox
+% \box\framebox}
+
\def\doinlineframedbox%
- {\getboxheight\dimen2\of\box\framebox
- \advance\dimen2 by -\ht\strutbox
- \dimen0=.5\dimen2
+ {\scratchdimen\dp\strutbox
+ \advance\scratchdimen \ruledlinewidth
\ifboxhasoffset
- \advance\dimen0 by \getvalue{\@@framed\c!offset}%
+ \advance\scratchdimen \getvalue{\@@framed\c!offset}%
\fi
- \advance\dimen0 by 2\linewidth
- \setbox\framebox=\hbox{\lower\dimen0\box\framebox}%
+ \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
\ht\framebox\ht\strutbox
\dp\framebox\dp\strutbox
\box\framebox}
@@ -1443,9 +1539,9 @@
%D line.
\def\doloweredframedbox%
- {\getboxheight\dimen2\of\box\framebox
- \advance\dimen2 by -\dp\strutbox
- \ht\framebox\dimen2
+ {\getboxheight\scratchdimen\of\box\framebox
+ \advance\scratchdimen -\dp\strutbox
+ \ht\framebox\scratchdimen
\dp\framebox\dp\strutbox
\box\framebox}
@@ -1473,12 +1569,12 @@
{\bgroup
\dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi
\dimen4=\dimen2
- \advance\dimen4 by \linewidth
+ \advance\dimen4 \ruledlinewidth
\setbox0=\vbox
- {\advance\hsize by 2\dimen4
+ {\advance\hsize 2\dimen4
\vskip\dimen2
\hrule
- \!!height\linewidth
+ \!!height\ruledlinewidth
\!!depth\zeropoint
\!!width\hsize
\vskip\dimen2}%
@@ -1494,15 +1590,15 @@
\ifboxhasheight
\dimen4=\localheight \divide\dimen4 by 2
\dimen6=\dimen4
- \advance\dimen4 by \dp\strutbox
- \advance\dimen6 by -\dp\strutbox
- \advance\dimen4 by -2\linewidth
- \advance\dimen6 by 2\linewidth
+ \advance\dimen4 \dp\strutbox
+ \advance\dimen6 -\dp\strutbox
+ \advance\dimen4 -2\ruledlinewidth
+ \advance\dimen6 2\ruledlinewidth
\else
\dimen4=\ht\strutbox
- \advance\dimen4 by \dimen2
+ \advance\dimen4 \dimen2
\dimen6=\dp\strutbox
- \advance\dimen6 by \dimen2
+ \advance\dimen6 \dimen2
\fi
\unskip
\setbox0=\hbox
@@ -1510,7 +1606,7 @@
\vrule
\!!height\dimen4
\!!depth\dimen6
- \!!width\linewidth
+ \!!width\ruledlinewidth
\hskip\dimen2}%
\ht0=\ht\strutbox
\dp0=\dp\strutbox
@@ -1594,16 +1690,18 @@
%D \showsetup{\y!blackrule}
\def\doblackrule[#1]%
- {\bgroup
+ {\hbox\bgroup
\getparameters[\??bj][#1]%
\setstrut
- \doif{\@@bjbreedte}{\v!max}{\def\@@bjbreedte{1em}}%
- \doif{\@@bjhoogte} {\v!max}{\def\@@bjhoogte{\ht\strutbox}}%
- \doif{\@@bjdiepte} {\v!max}{\def\@@bjdiepte{\dp\strutbox}}%
- \vrule
- \!!width\@@bjbreedte
- \!!height\@@bjhoogte
- \!!depth\@@bjdiepte
+ \doif\@@bjbreedte\v!max{\def\@@bjbreedte{1em}}%
+ \doif\@@bjhoogte \v!max{\def\@@bjhoogte{\ht\strutbox}}%
+ \doif\@@bjdiepte \v!max{\def\@@bjdiepte{\dp\strutbox}}%
+ \localstartcolor[\@@bjkleur]%
+ \vrule
+ \!!width \@@bjbreedte
+ \!!height\@@bjhoogte
+ \!!depth \@@bjdiepte
+ \localstopcolor
\egroup}
\unexpanded\def\blackrule%
@@ -1639,26 +1737,28 @@
%D tokens.
\def\doblackrules[#1]%
- {\bgroup
+ {\hbox\bgroup
\getparameters[\??bj][#1]%
- \!!widtha=\@@bjbreedte
- \!!widthb=\@@bjafstand
- \doif{\@@bjvariant}{\c!b}
- {\scratchcounter=\@@bjn
+ \!!widtha\@@bjbreedte
+ \!!widthb\@@bjafstand
+ \doif\@@bjvariant\c!b
+ {\scratchcounter\@@bjn
\ifnum\scratchcounter=1
- \!!widthb=\zeropoint
+ \!!widthb\zeropoint
\else
- \advance\scratchcounter by -1
- \advance\!!widtha by -\scratchcounter\!!widthb
- \divide\!!widtha by \@@bjn
+ \advance\scratchcounter -1
+ \advance\!!widtha -\scratchcounter\!!widthb
+ \divide \!!widtha \@@bjn
\fi}%
- \dorecurse{\@@bjn}
- {\vrule
- \!!width\!!widtha
- \!!height\@@bjhoogte
- \!!depth\@@bjdiepte
- \hskip\!!widthb}%
- \unskip
+ \localstartcolor[\@@bjkleur]%
+ \dorecurse\@@bjn
+ {\vrule
+ \!!width \!!widtha
+ \!!height\@@bjhoogte
+ \!!depth \@@bjdiepte
+ \hskip\!!widthb}%
+ \unskip
+ \localstopcolor
\egroup}
\unexpanded\def\blackrules%
@@ -2114,7 +2214,7 @@
\def\dosetupframedtexts[#1][#2]%
{\ifsecondargument
\def\docommando##1{\getparameters[\??kd##1][#2]}%
- \processcommalist[#1]\docommando % new
+ \processcommacommand[#1]\docommando % new, #1 may be macro
\else
\getparameters[\??kd\v!framedtext][#1]%
\fi}
@@ -2126,7 +2226,8 @@
{\bgroup\dotripleempty\dodostartframedtext}
\def\dodostartframedtext[#1][#2][#3]%
- {\doifinstringelse{=}{#2}
+% {\doifinstringelse{=}{#2}
+ {\doifassignmentelse{#2}
{\dododostartframedtext[#1][][#2]}
{\dododostartframedtext[#1][#2][#3]}}
@@ -2522,8 +2623,9 @@
\setupfillinlines[#1]%
\advance\rightskip by \@@ivmarge
\parfillskip\zeropoint
- \def\par%
- {\unskip\hfill
+ \def\par % very dangerous
+ {\let\par\endgraf % -)
+ \unskip\hfill
\dimen0=\@@ivbreedte
\advance\dimen0 by -\@@ivafstand
\ifdim\dimen0>\@@ivmarge\else\expandafter\rlap\fi
@@ -2756,7 +2858,8 @@
\c!hoogte=1ex,
\c!diepte=\!!zeropoint,
\c!variant=\c!a,
- \c!afstand=.25ex]
+ \c!afstand=.25ex,
+ \c!kleur=]
\setupmarginrules
[\c!niveau=0,
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex
index c2c43d8d6..d12c2ab02 100644
--- a/tex/context/base/core-sec.tex
+++ b/tex/context/base/core-sec.tex
@@ -11,6 +11,9 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% this module needs a clean up, currently some manipulations
+% take place multiple times
+
\writestatus{loading}{Context Core Macros / Sectioning}
\startmessages dutch library: structures
@@ -57,54 +60,93 @@
\unprotect
-\def\dodochecknummer#1#2#3%
+% from now on, internaly numbers are separated by a period
+% and postprocessed on demand
+
+\def\numberseparator{.} % reasonable default
+
+\def\gobbleuntilrelax#1\relax{}
+
+\def\separatednumber #1{\doseparatednumber #1.\empty\relax}
+\def\removefirstprefix#1{\doremovefirstprefix#1.\empty\relax}
+\def\removeallprefixes#1{\doremoveallprefixes#1.\empty\relax}
+
+\def\doseparatednumber#1.#2%
+ {#1%
+ \ifx#2\empty
+ \@EA\gobbleuntilrelax
+ \else \numberseparator
+ \@EA\doseparatednumber
+ \fi#2}
+
+\def\doremoveallprefixes#1.#2%
+ {\ifx#2\empty
+ #1\@EA\gobbleuntilrelax
+ \else
+ \@EA\doremoveallprefixes
+ \fi#2}
+
+\def\doremovefirstprefix#1.#2%
+ {\ifx#2\empty
+ #1\@EA\gobbleuntilrelax
+ \else
+ \@EA\noremovefirstprefix
+ \fi#2}
+
+\def\noremovefirstprefix#1.\empty\relax
+ {#1}
+
+% we need to expand in order to get something separatable
+
+\def\dohandleheadnumber#1%
+ {\expanded{\separatednumber{#1}}}
+
+\def\dodochecknummer#1#2#3% will become ugly after speed up
{\bgroup
- \doifinstringelse{.0}{.#2} % waarom \instring en \@koscheider
- {\doifnot{#3}{\v!per}
+ \doifinstringelse{.0}{.#2}
+ {\doifnot{#3}\v!per
{%\debuggerinfo{\m!systems}{number #1 #3 becomes \getnumbervariable{#1\c!wijze}}%
- \setevalue{\s!number#1\c!wijze}{#3}% geen \xdef, gaat mis met \subpage
+ \setevalue{\@@thenumber{#1}\c!wijze}{#3}% geen \xdef, gaat mis met \subpage
\dochecknummer{#1}}} % tricky and ugly
- {\doifnotvalue{\s!number#1\s!check}{#2}
- {\setcounter{\s!number#1}{0\getvalue{\s!number#1\c!start}}%
- \setxvalue{\s!number#1\c!wijze\c!lokaal}%
- {\getvalue{\s!number#1\c!wijze}}%
- \setxvalue{\s!number#1\s!check}%
+ {\doifnotvalue{\@@thenumber{#1}\s!check}{#2}
+ {\setcounter{\@@thenumber{#1}}{0\getvalue{\@@thenumber{#1}\c!start}}%
+ \setxvalue{\@@thenumber{#1}\c!wijze\c!lokaal}%
+ {\getvalue{\@@thenumber{#1}\c!wijze}}%
+ \setxvalue{\@@thenumber{#1}\s!check}%
{#2}}}%
\egroup}
\def\dochecknummer#1%
- {\edef\currentsection{\getvalue{\??by\getvalue{\s!number#1\c!wijze}}}%
- \doifsomething{\currentsection}
- {\dodochecknummer
- {#1}
- {\getvalue{\currentsection\c!nummer}}
- {\v!per\previoussection{\currentsection}}}}
+ {\edef\currentsection{\csname\??by\csname\@@thenumber{#1}\c!wijze\endcsname\endcsname}%
+ \ifx\currentsection\empty\else
+ \dodochecknummer
+ {#1}%
+ {\csname\currentsection\c!nummer\endcsname}%
+ {\v!per\previoussection\currentsection}%
+ \fi}
\def\checknummer#1%
{\bgroup
- \ifnum\blocklevel>0
- \doifelsevalue{\s!number#1\c!blokwijze}{\v!nee}
- {\dochecknummer{#1}}
- {\setblockcounters % dit kan sneller omdat de waarden
- \dochecknummer{#1}}% % en het type bekend zijn
- \else
- \dochecknummer{#1}%
+ %\ifcase\blocklevel\else
+ \ifdoingblocks
+ \doifnotvalue{\@@thenumber{#1}\c!blokwijze}\v!nee\setblockcounters
\fi
+ \dochecknummer{#1}%
\egroup}
-\def\domaakvoorafgaandenummer[#1]%
+\def\domaakvoorafgaandenummer[#1]% will become ugly after speed up
{\bgroup % added
\global\let\voorafgaandenummer\empty
\ifsectienummer
- \doifvalue{\??sb\@@sectieblok\c!nummer}{\v!ja} % added
- {\doifelsevalue{\s!number#1\c!sectienummer}{\v!ja}
- {\donetrue}{\donefalse}%
- \doifvalue{\s!number#1\c!sectienummer}{\v!nummer}
+ \doifvalue{\??sb\@@sectieblok\c!nummer}\v!ja % added
+ {\doifelsevalue{\@@thenumber{#1}\c!sectienummer}\v!ja
+ \donetrue\donefalse
+ \doifvalue{\@@thenumber{#1}\c!sectienummer}\v!nummer
{\donetrue\let\@@sectionconversion\gobbleoneargument}%
\ifdone
\edef\currentsection%
- {\getvalue{\??by\getvalue{\s!number#1\c!wijze\c!lokaal}}}%
- \doifnot{\currentsection}{\zerosection}
+ {\getvalue{\??by\getvalue{\@@thenumber{#1}\c!wijze\c!lokaal}}}%
+ \doifnot{\currentsection}\zerosection
{\doifnot{\@@sectionvalue{\currentsection}}{0}
{\xdef\voorafgaandenummer%
{\getvalue{\currentsection\c!nummer}.}}}%
@@ -114,22 +156,20 @@
\def\maakvoorafgaandenummer[#1]%
{\bgroup
- \ifnum\blocklevel>0
- \doifelsevalue{\s!number#1\c!blokwijze}{\v!nee}
- {\domaakvoorafgaandenummer[#1]}%
- {\setblockcounters % dit kan sneller omdat de waarden
- \domaakvoorafgaandenummer[#1]}% % en het type bekend zijn
- \else
- \domaakvoorafgaandenummer[#1]%
+ %\ifnum\blocklevel>0
+ %\ifcase\blocklevel\else
+ \ifdoingblocks
+ \doifnotvalue{\@@thenumber{#1}\c!blokwijze}\v!nee\setblockcounters
\fi
+ \domaakvoorafgaandenummer[#1]%
\egroup}
% \def\maakhetnummer[#1]%
% {\maakvoorafgaandenummer[#1]%
% \xdef\hetnummer%
% {\voorafgaandenummer\nummer[#1]}}%
-%
-% hack needed for chinese and oldstyle in normal tex, will change
+%
+% hack needed for chinese and oldstyle in normal tex, will change
\def\maakhetnummer[#1]%
{\bgroup
@@ -139,14 +179,21 @@
{\voorafgaandenummer\nummer[#1]}%
\egroup}
+\def\preparethenumber#1#2#3% {\??id#1} \number \result
+ {\doifelsevaluenothing{#1\c!scheider}
+ {\let\numberseparator\empty
+ \let#3#2}
+ {\unexpanded\def\numberseparator{\getvalue{#1\c!scheider}}%
+ \edef#3{\@EA\separatednumber\@EA{#2}}}}
+
\def\lossenummer[#1]%
{\maakhetnummer[#1]%
\hetnummer}
\def\huidigenummer[#1]%
- {%\getvalue{\getvalue{\s!number#1\c!zetwijze}}%
- \getvalue{\getvalue{\s!number#1\c!plaats}}%
- {\dotextprefix{\getvalue{\s!number#1\c!tekst}}\lossenummer[#1]}}
+ {%\getvalue{\getvalue{\@@thenumber{#1}\c!zetwijze}}%
+ \getvalue{\getvalue{\@@thenumber{#1}\c!plaats}}%
+ {\dotextprefix{\getvalue{\@@thenumber{#1}\c!tekst}}\lossenummer[#1]}}
\def\volgendenummer[#1][#2][#3]%
{\verhoognummer[#1]%
@@ -157,30 +204,30 @@
\newcount\nofsections
-\def\zerosection{\v!tekst}
-\def\firstsection{}
-\def\lastsection{}
-\let\@@sectie\empty
-\let\@@koppeling\empty
+\let\zerosection \v!tekst
+\let\firstsection\empty
+\let\lastsection \empty
+\let\@@sectie \empty
+\let\@@koppeling \empty
\makecounter{\??se\v!tekst}
-\setevalue{\??se\v!tekst\c!voor}{}
-\setevalue{\??se\v!tekst\c!na }{}
+\letvalue{\??se\v!tekst\c!voor}\empty
+\letvalue{\??se\v!tekst\c!na }\empty
-\setevalue{\v!tekst\c!nummer}{0}
-\setevalue{\v!tekst\s!format}{}
+\setvalue{\v!tekst\c!nummer}{0}
+\letvalue{\v!tekst\s!format}\empty
-\setevalue{\??sk\v!tekst}{}
-\setevalue{\??sk }{}
+\letvalue{\??sk\v!tekst}\empty
+\letvalue{\??sk }\empty
-\setvalue{\??by }{\v!tekst}
-\setvalue{\??by\v!tekst }{\v!tekst}
-\setvalue{\??by\v!alles }{\v!tekst}
-\setvalue{\??by\v!per }{\v!tekst}
-\setvalue{\??by\v!per\v!tekst }{\v!tekst}
-\setvalue{\??by\v!per\v!alles }{\v!tekst}
-\setvalue{\??by\v!per\v!pagina}{\v!tekst} % see footnotes
+\letvalue{\??by }\v!tekst
+\letvalue{\??by\v!tekst }\v!tekst
+\letvalue{\??by\v!alles }\v!tekst
+\letvalue{\??by\v!per }\v!tekst
+\letvalue{\??by\v!per\v!tekst }\v!tekst
+\letvalue{\??by\v!per\v!alles }\v!tekst
+\letvalue{\??by\v!per\v!pagina}\v!tekst % see footnotes
%%%%%%%%% old
@@ -202,7 +249,7 @@
\getparameters[\??se#1][#2]%
\fi
\doifelsevalue{\??se#1\c!vorigenummer}{\v!ja}
- {\setvalue{#1\c!nummer}{\@@longsectionnumber{#1}}}
+ {\setvalue{#1\c!nummer}{\@@longsectionnumber {#1}}}
{\setvalue{#1\c!nummer}{\@@shortsectionnumber{#1}}}}
\def\stelsectiein%
@@ -251,7 +298,7 @@
\setevalue{\??by#1}{#1}%
\setevalue{\??by\v!per#1}{#1}%
\makecounter{\??se#1}%
- \def\lastsection{#1}%
+ \edef\lastsection{#1}%
\setvalue{\??sk#1}%
{#1}%
\setvalue{\??se#1\c!markering}%
@@ -259,22 +306,19 @@
\stelsectiein[#1]
[\c!vorigenummer=\v!ja]}}%
-\def\previoussection#1%
- {\getvalue{\??se#1\c!voor}}
-
-\def\nextsection#1%
- {\getvalue{\??se#1\c!na}}
+\def\previoussection#1{\csname\??se#1\c!voor\endcsname}
+\def\nextsection #1{\csname\??se#1\c!na \endcsname}
\def\@@setsectionnumber#1#2%
{\setgvalue{\??se#1\s!start}{}% % signal i.p.v. boolean
\setcounter{\??se#1}{#2}%
- \resetsectioncounters[#1]%
+ \resetsectioncounters{#1}%
\checkpagecounter}
\def\@@nextsectionnumber#1%
{\setgvalue{\??se#1\s!start}{}% % signal i.p.v. boolean
\pluscounter{\??se#1}%
- \resetsectioncounters[#1]%
+ \resetsectioncounters{#1}%
\checkpagecounter}
\def\@@sectionvalue#1% % nog niet overal doorgevoerd
@@ -304,25 +348,49 @@
% Omdat een markering kan worden herdefinieerd moeten we
% eerst testen of er wel een keten||afhankelijkheid is.
-% we het huidge (eigen) nummer kunnen ophalen
+% \def\doresetsectionmarks#1%
+% {\doifdefined{\??se#1\c!markering} % skip zero level
+% {\fastresetmarkerlist[\getvalue{\??se#1\c!markering}]}%
+% \donexttracklevel{#1}}
+%
+% \def\resetsectionmarks#1%
+% {\doifdefinedelse{\??se#1}
+% {\let\donexttrackcommando\doresetsectionmarks
+% \donexttracklevel{#1}}%
+% {\fastresetmarker[\hoofdmarkering{#1}]}} % redundant \hoofdmarkering
+
+\def\doresetsectionmarks#1%
+ {\ifundefined{\??se#1\c!markering}\else % skip zero level
+ \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]%
+ \fi
+ \donexttracklevel{#1}}
+
+\def\resetsectionmarks#1%
+ {\ifundefined{\??se#1}%
+ \fastresetmarker[\hoofdmarkering{#1}]% % redundant \hoofdmarkering
+ \else
+ \let\donexttrackcommando\doresetsectionmarks
+ \donexttracklevel{#1}%
+ \fi}
-\def\resetsectionmarks[#1]%
- {\doifdefinedelse{\??se#1}
- {\def\donexttrackcommando##1%
- {\doifdefined{\??se##1\c!markering} % skip zero level
- {\def\docommando####1%
- {\ExpandFirstAfter\resetmarkering[####1]}%
- \processcommacommand[\getvalue{\??se##1\c!markering}]\docommando}%
- \donexttracklevel{##1}}%
- \donexttracklevel{#1}}%
- {\ExpandFirstAfter\resetmarkering[\hoofdmarkering{#1}]}}
+% packaged:
+%
+% \def\resetsectioncounters#1%
+% {\def\donexttrackcommando##1%
+% {\resetcounter{\??se##1}%
+% \donexttracklevel{##1}}%
+% \donexttracklevel{#1}}
+%
+% nicer
-\def\resetsectioncounters[#1]%
- {\def\donexttrackcommando##1%
- {\resetcounter{\??se##1}%
- \donexttracklevel{##1}}%
+\def\doresetsectioncounters#1%
+ {\resetcounter{\??se#1}%
\donexttracklevel{#1}}
+\def\resetsectioncounters % #1
+ {\let\donexttrackcommando\doresetsectioncounters
+ \donexttracklevel} % #1
+
% bij checken kan geen prefix worden bekeken, anders vallen
% er titels buiten de inhoudsopgave
@@ -333,7 +401,7 @@
{\@@sectiontype:\getvalue{\lastsection\s!format}}}
\def\dobacktracklevel#1%
- {\doifnot{\previoussection{#1}}{\zerosection}
+ {\doifnot{\previoussection{#1}}\zerosection
{\dobacktrackcommando{\previoussection{#1}}}}
\def\donexttracklevel#1%
@@ -385,63 +453,139 @@
\def\dontsetlevel#1%
{\let\currentlevel\somesavedlevel
\alllevelsfalse}
-
-\def\dosetlevel#1% opvoeren met \ifcsname
- {\let\dosetlevel\dontsetlevel % local lists will be real local
- \bgroup
- \doifelse{#1}{\v!vorige}
+
+% \def\dosetlevel#1% opvoeren met \ifcsname
+% {\let\dosetlevel\dontsetlevel % local lists will be real local
+% \bgroup
+% \doifelse{#1}{\v!vorige}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty
+% \def\dobacktrackcommando##1%
+% {\ifnum\countervalue{\??se##1}>0
+% \global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}%
+% \else
+% \dobacktracklevel{##1}%
+% \fi}%
+% \dobacktrackcommando\lastsection}
+% {\doifelse{\getvalue{\??by#1}}{\v!tekst}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty}
+% {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
+% {\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format
+% {\edef\@@sectie{#1}}%
+% \doifdefinedelse{\??se\@@sectie}
+% {\global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{\@@sectie\s!format}}}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty
+% \def\dobacktrackcommando##1%
+% {\@EA\ifx\csname\??se##1\c!start\endcsname\relax
+% \dobacktracklevel{##1}%
+% \else
+% \ifnum\countervalue{\??se##1}>0
+% \global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{##1\s!format}}%
+% \else
+% \dobacktracklevel{##1}%
+% \fi
+% \fi}%
+% \dobacktrackcommando\lastsection}}}%
+% \egroup}
+
+\def\dosetcurrentlevel#1%
+ {\global\alllevelsfalse
+ \xdef\currentlevel{\getvalue{\lastsection\s!format}}}
+
+\def\dosetpreviouslevel#1%
+ {\global\alllevelstrue
+ \global\let\currentlevel\empty
+ \def\dobacktrackcommando##1%
+ {\ifnum\countervalue{\??se##1}>0
+ \global\alllevelsfalse
+ \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}%
+ \else
+ \dobacktracklevel{##1}%
+ \fi}%
+ \dobacktrackcommando\lastsection}
+
+\def\dosettextlevel#1%
+ {\global\alllevelstrue
+ \global\let\currentlevel\empty}
+
+\def\dosetotherlevel#1%
+ {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
+ {\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format
+ {\edef\@@sectie{#1}}%
+ \doifdefinedelse{\??se\@@sectie}
+ {\global\alllevelsfalse
+ \xdef\currentlevel{\getvalue{\@@sectie\s!format}}}
{\global\alllevelstrue
\global\let\currentlevel\empty
\def\dobacktrackcommando##1%
- {\ifnum\countervalue{\??se##1}>0
- \global\alllevelsfalse
- \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}%
- \else
+ {\@EA\ifx\csname\??se##1\c!start\endcsname\relax
\dobacktracklevel{##1}%
+ \else
+ \ifnum\countervalue{\??se##1}>0
+ \global\alllevelsfalse
+ \xdef\currentlevel{\getvalue{##1\s!format}}%
+ \else
+ \dobacktracklevel{##1}%
+ \fi
\fi}%
- \dobacktrackcommando\lastsection}
- {\doifelse{\getvalue{\??by#1}}{\v!tekst}
- {\global\alllevelstrue
- \global\let\currentlevel\empty}
- {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
- {\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format
- {\edef\@@sectie{#1}}%
- \doifdefinedelse{\??se\@@sectie}
- {\global\alllevelsfalse
- \xdef\currentlevel{\getvalue{\@@sectie\s!format}}}
- {\global\alllevelstrue
- \global\let\currentlevel\empty
- \def\dobacktrackcommando##1%
- {\@EA\ifx\csname\??se##1\c!start\endcsname\relax
- \dobacktracklevel{##1}%
- \else
- \ifnum\countervalue{\??se##1}>0
- \global\alllevelsfalse
- \xdef\currentlevel{\getvalue{##1\s!format}}%
- \else
- \dobacktracklevel{##1}%
- \fi
- \fi}%
- \dobacktrackcommando\lastsection}}}%
+ \dobacktrackcommando\lastsection}}
+
+% \def\dosetlevel#1% opvoeren met \ifcsname
+% {\let\dosetlevel\dontsetlevel % local lists will be real local
+% \bgroup
+% \doifelse{#1}{\v!huidige}
+% {\dosetcurrentlevel{#1}}
+% {\doifelse{#1}{\v!vorige}
+% {\dosetpreviouslevel{#1}}
+% {\doifelsevalue{\??by#1}{\v!tekst}
+% {\dosettextlevel{#1}}
+% {\dosetotherlevel{#1}}}}%
+% \egroup}
+
+\def\dosetlevel#1% beware: this one is \let
+ {\let\dosetlevel\dontsetlevel % local lists will be real local
+ \bgroup
+ \edef\askedlevel{#1}%
+ \ifx\askedlevel\v!huidige
+ \dosetcurrentlevel\askedlevel
+ \else\ifx\askedlevel\v!vorige
+ \dosetpreviouslevel\askedlevel
+ \else
+ \edef\byaskedlevel{\csname\??by\askedlevel\endcsname}%
+ \ifx\byaskedlevel\v!tekst
+ \dosettextlevel\askedlevel
+ \else
+ \dosetotherlevel\askedlevel
+ \fi
+ \fi\fi
\egroup}
-\def\dosettoclevel{\dosetlevel}
-\def\dosetreglevel{\dosetlevel}
-\def\dosetblklevel{\dosetlevel}
+% \def\dosettoclevel{\dosetlevel}
+% \def\dosetreglevel{\dosetlevel}
+% \def\dosetblklevel{\dosetlevel}
-% cleaner
+\let\dosettoclevel\dosetlevel
+\let\dosetreglevel\dosetlevel
+\let\dosetblklevel\dosetlevel
+
+% cleaner
%
% \def\doifnextlevelelse[#1::#2]#3#4%
% {\ifalllevels
% #3%
% \else
-% \doifelse{\@@sectiontype}{#1}
+% \doifelse{\@@sectiontype}{#1}
% {\doifinstringelse{=\currentlevel:}{=:#2:}
% {\doifinstringelse{=\currentlevel:0}{=:#2:}{#4}{#3}}
% {#4}}
% {#4}%
% \fi}
-%
+%
% \def\doifprevlevelelse[#1::#2]#3#4%
% {\ifalllevels
% #3%
@@ -451,13 +595,13 @@
% {#4}%
% \fi}
%
-% faster
-%
+% faster
+%
% \def\doifnextlevelelse[#1::#2]%
-% {\ifalllevels
-% \donetrue
+% {\ifalllevels
+% \donetrue
% \else
-% \doifelse{\@@sectiontype}{#1}
+% \doifelse{\@@sectiontype}{#1}
% {\doifinstringelse{=\currentlevel:}{=:#2:}
% {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
% \donefalse}
@@ -468,7 +612,7 @@
% \else
% \expandafter\secondoftwoarguments
% \fi}
-%
+%
% \def\doifprevlevelelse[#1::#2]%
% {\ifalllevels
% \donetrue
@@ -482,7 +626,7 @@
% \else
% \expandafter\secondoftwoarguments
% \fi}
-%
+%
% meaner
%
% \stellijstin
@@ -494,48 +638,91 @@
\def\dosavesomelevel[#1:0:0:0:#2]%
{\def\somesavedlevel{:#1}}
-\def\doifnextlevelelse[#1::#2]%
+% \def\doifnextlevelelse[#1::#2]%
+% {\dosavesomelevel[#2:0:0:0:0]%
+% \ifalllevels
+% \donetrue
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}
+% {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
+% \donefalse}
+% \donefalse
+% \fi
+% \ifdone
+% \expandafter\firstoftwoarguments
+% \else
+% \expandafter\secondoftwoarguments
+% \fi}
+%
+% \def\doifprevlevelelse[#1::#2]%
+% {\dosavesomelevel[#2:0:0:0:0]%
+% \ifalllevels
+% \donetrue
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse}
+% \donefalse
+% \fi
+% \ifdone
+% \expandafter\firstoftwoarguments
+% \else
+% \expandafter\secondoftwoarguments
+% \fi}
+%
+% again faster:
+
+\def\doifnextlevelelse[#1::#2]% beware: this one is \let
{\dosavesomelevel[#2:0:0:0:0]%
- \ifalllevels
- \donetrue
- \else
- \doifelse{\@@sectiontype}{#1}
- {\doifinstringelse{=\currentlevel:}{=:#2:}
- {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
- \donefalse}
+ \ifalllevels
+ \donetrue
+ \else\ifnum\@@sectiontype=#1
+% \doifinstringelse{=\currentlevel:}{=:#2:}
+% {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
+% \donefalse
+ \def\levelstring{=:#2:}%
+ \doifincsnameelse{=\currentlevel:}\levelstring
+ {\doifincsnameelse{=\currentlevel:0}\levelstring\donefalse\donetrue}
\donefalse
- \fi
+ \else
+ \donefalse
+ \fi\fi
\ifdone
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\def\doifprevlevelelse[#1::#2]%
+\def\doifprevlevelelse[#1::#2]% beware: this one is \let
{\dosavesomelevel[#2:0:0:0:0]%
\ifalllevels
\donetrue
+ \else\ifnum\@@sectiontype=#1
+ \doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse
\else
- \doifelse{\@@sectiontype}{#1}
- {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse}
- \donefalse
- \fi
+ \donefalse
+ \fi\fi
\ifdone
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\def\doiftoclevelelse{\doifnextlevelelse}
-\def\doifreglevelelse{\doifprevlevelelse}
-\def\doifblklevelelse{\doifprevlevelelse}
+% \def\doiftoclevelelse{\doifnextlevelelse}
+% \def\doifreglevelelse{\doifprevlevelelse}
+% \def\doifblklevelelse{\doifprevlevelelse}
+
+\let\doiftoclevelelse\doifnextlevelelse
+\let\doifreglevelelse\doifprevlevelelse
+\let\doifblklevelelse\doifprevlevelelse
\def\@@longformatnumber#1%
{\getvalue{\previoussection{#1}\s!format}:\@@shortsectionnumber{#1}}
\def\@@longsectionnumber#1%
{\ifnum\countervalue{\??se\previoussection{#1}}>0
- \getvalue{\previoussection{#1}\c!nummer}\@@koscheider
+ %\getvalue{\previoussection{#1}\c!nummer}\@@koscheider
+ \getvalue{\previoussection{#1}\c!nummer}.%
\fi
\@@shortsectionnumber{#1}}
@@ -567,8 +754,8 @@
\def\doaroundsectieblok#1%
{\doifvaluesomething{\??sb#1\c!pagina}
{\ExpandFirstAfter\pagina[\getvalue{\??sb#1\c!pagina}]}%
- \resetsectioncounters[\zerosection]% was firstsection
- \resetsectionmarks[\zerosection]}
+ \resetsectioncounters\zerosection % was firstsection
+ \resetsectionmarks\zerosection}
\def\dostartsectieblok#1#2%
{\begingroup
@@ -576,20 +763,20 @@
\getvalue{\??sb#1}% % set name of section block
\getsectieblokomgeving{#1}% % special settings, grouped
%\expandafter\csname#2true\endcsname % obsolete
- \enablemode[\systemmodeprefix#1]% % can be used in conditionals
+ \setsystemmode{#1}% % can be used in conditionals
\getvalue{\??sb\@@sectieblok\c!voor}% this one is not to be moved!
- \showmessage{\m!structures}{1}{\@@sectieblokken}}
+ \showmessage\m!structures1\@@sectieblokken}
-\def\dostopsectieblok%
- {\showmessage{\m!structures}{2}{\@@sectieblokken}%
+\def\dostopsectieblok
+ {\showmessage\m!structures2\@@sectieblokken
\getvalue{\??sb\@@sectieblok\c!na}% don't move
- \doaroundsectieblok{\@@sectieblok}%
+ \doaroundsectieblok\@@sectieblok
\endgroup}
-\def\dostelsectieblokin[#1][#2]%
- {\getparameters[\??sb#1][#2]}
+\def\dostelsectieblokin[#1]% [#2]
+ {\getparameters[\??sb#1]}
-\def\stelsectieblokin%
+\def\stelsectieblokin
{\dodoubleargument\dostelsectieblokin}
\long\def\setsectieblokomgeving#1#2%
@@ -706,7 +893,7 @@
\def\dohandelpaginaafB#1%
{\doifinset{\getvalue{\??ko#1\c!pagina}}{\v!ja,\v!rechts,\v!links}
{\def\resetcurrentsectionmarks% toegevoegd, zie \pagina
- {\resetsectionmarks[\previoussection{\@@sectie}]}%
+ {\resetsectionmarks{\previoussection\@@sectie}}%
\pagina[\getvalue{\??ko#1\c!pagina}]%
\dohandelpaginaafBB{#1}\v!hoofd\c!hoofd
\dohandelpaginaafBB{#1}\v!tekst\c!tekst
@@ -724,7 +911,7 @@
\def\handelpaginaaf#1%
{\dohandelpaginaafAA{#1}%
- \ifnum\countervalue{\??se\previoussection{\@@sectie}}>0
+ \ifnum\countervalue{\??se\previoussection\@@sectie}>0
\ifnum\countervalue{\??se\@@sectie}>0
\dohandelpaginaafB{#1}%
\else
@@ -749,10 +936,10 @@
% \def\\{\crlf\strut\ignorespaces}}
\def\dolocalkopsetup#1% koppeling met standaard kopcommando / engels
- {\forgetall
- \doifvaluesomething{\??ko#1\c!uitlijnen}
+ {\forgetall % traag dus ...
+ \doifvaluesomething{\??ko#1\c!uitlijnen} % wordt al expanded in spa
{\expanded{\steluitlijnenin[\getvalue{\??ko#1\c!uitlijnen}]}}%
- \doifvaluesomething{\??ko#1\c!tolerantie}
+ \doifvaluesomething{\??ko#1\c!tolerantie} % wordt al expanded in spa
{\expanded{\steltolerantiein[\getvalue{\??ko#1\c!tolerantie}]}}%
\def\\{\crlf\strut\ignorespaces}}
@@ -780,12 +967,6 @@
% \hoofdstuk tekst
% \hoofdstuk <niets>
-\def\dodosomekop#1[#2]#3%
- {\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
- {\def\next{\doquadruplegroupempty\dododosomekop{#1}{#2}{#3}}}
- {\def\next{\fourthargumentfalse \dododosomekop{#1}{#2}{#3}{}}}%
- \next}
-
\def\finalsectionnumber%
{\ifundefined{\@@sectie\c!nummer}\else
\ifsomeheadconversion
@@ -795,16 +976,6 @@
\fi
\fi}
-\def\dododosomekop#1#2#3#4%
- {\iffourthargument
- \def\next%
- {\dodododosomekop{#1}[#2]{#1}{#3}{#4}}%
- \else
- \def\next%
- {\dodododosomekop{#1}[#2]{#1}{\finalsectionnumber}{#3}}%
- \fi
- \next}
-
\def\findsectionnumber#1#2#3% class file title
{\begingroup
\setsectieenkoppeling{#1}%
@@ -861,11 +1032,16 @@
\fi
\fi}}
- \def\writtenfullsectionnumber {\string\fullsectionnumber}
- \def\ignoredfullsectionnumber#1#2#3{#3}
- \let \storedfullsectionnumber \relax
-\unexpanded\def\naturalfullsectionnumber#1#2#3{\sectiebloklabel{#1}{\getvalue{\??cv#2}{#3}}}
-\unexpanded\def\limitedfullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}}
+ \def \writtenfullsectionnumber {\string\fullsectionnumber}
+ \def \ignoredfullsectionnumber#1#2#3{#3}
+ \let \storedfullsectionnumber \relax
+\unexpanded\def \naturalfullsectionnumber#1#2#3{\sectiebloklabel{#1}{\getvalue{\??cv#2}{#3}}}
+ \def\expandablefullsectionnumber#1#2#3{#3}
+\unexpanded\def \limitedfullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}}
+
+% under test:
+%
+% \def\expandablefullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}}
\def\setfullsectionnumber#1%
{\doifelsevalue{#1\c!kopconversie}{\v!ja}
@@ -874,18 +1050,59 @@
{\let\fullsectionnumber\limitedfullsectionnumber}}
{\let\fullsectionnumber\ignoredfullsectionnumber}}
-%\let\fullsectionnumber\naturalfullsectionnumber
\let\fullsectionnumber\limitedfullsectionnumber
% \dodododosomekop IS NON GROUPED, SO WE NEED TO RESTORE !!!!
%
% dit kan dus beter \everyaroundhead zijn
-\def\dodododosomekop#1[#2]#3#4#5% % pas met \ExpandFirstAfter op bij twee||taligheid
- {\flushingcolumnfloatsfalse % #3=#1=redundant
+\let\currentheadnumber\empty
+\let\currentheadtext \empty
+
+\def\dodosomekop#1[#2]#3% [ref] {title}
+ {\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
+ {\doquadruplegroupempty\dododosomekop{#1}{#2}{#3}}
+ {\fourthargumentfalse \dododosomekop{#1}{#2}{#3}{}}}
+
+\def\dododosomekop#1#2#3#4% [ref] {own} {title}
+ {\iffourthargument
+ \def\next{\dodododosomekop{#1}[#2]{#3}{#4}}%
+ \else
+ \def\next{\dodododosomekop{#1}[#2]{\finalsectionnumber}{#3}}%
+ \fi
+ \next}
+
+% clearer
+
+\def\dodosomekop#1[#2]#3% [ref] {title}
+ {\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
+ {\doquadruplegroupempty\dododosomekop{#1}[#2]{#3}}
+ %{\fourthargumentfalse \dododosomekop{#1}[#2]{#3}{}}}
+ {\dodododosomekop{#1}[#2]{\finalsectionnumber}{#3}}}
+
+\def\dododosomekop#1[#2]#3#4% [ref] {own} {title}
+ {\iffourthargument
+ \def\next{\dodododosomekop{#1}[#2]{#3}{#4}}%
+ \else % normal head or no own number given
+ \def\next{\dodododosomekop{#1}[#2]{\finalsectionnumber}{#3}}%
+ \fi
+ \next}
+
+% pas met \ExpandFirstAfter op bij twee||taligheid
+
+\ifx\dohandleheadnumber\undefined
+ \let\dohandleheadnumber\firstofoneargument
+\fi
+
+\unexpanded\def\\{\space}
+
+\def\dodododosomekop#1[#2]#3#4% [ref] {number} {title}
+ {\def\currenthead{#1}%
+ \unexpanded\def\\{\space}%
+ \def\numberseparator{\getvalue{\??ko\currenthead\c!scheider}}%
+ \flushingcolumnfloatsfalse % {number} can be \finalsectionnumber
\someheadconversionfalse
-% \let\fullsectionnumber\naturalfullsectionnumber
-\let\fullsectionnumber\limitedfullsectionnumber
+ \let\fullsectionnumber\limitedfullsectionnumber
\setsectieenkoppeling{#1}%
\doifelsevalue{\??ko#1\c!prefix}{}
{\kopprefixfalse}
@@ -905,7 +1122,7 @@
[ \v!ja=>\verhoognummertrue,
\v!nee=>\verhoognummerfalse,
\s!unknown=>{\ifx\currentproduct\empty
- \findsectionnumber{#1}\commalistelement{#5}%
+ \findsectionnumber{#1}\commalistelement{#4}%
\fi
\verhoognummertrue}]%
\edef\numberheaddistance {\getvalue{\??ko#1\c!afstand}}%
@@ -919,75 +1136,82 @@
\else
\kopnummerfalse
\fi
- \convertexpanded{\??ko#1}{#5}\asciititle
+ \convertexpanded{\??ko#1}{#4}\asciititle
+ %
+ \gdef\currentheadtext{#4}% scheelt args
+ \global\let\currentheadnumber\empty
+ %
\ifverhoognummer
\ifplaatskop
\checknexthead\handelpaginaaf{#1}%
\setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...]
\ifkopprefix
- \setupreferencing[\c!prefix=-]%
+ %\setupreferencing[\c!prefix=-]%
+ \setupreferenceprefix[-]%
\fi
\getvalue{\e!volgende\@@sectie}%
- \getvalue{\??ko#1\c!tussen}%
\ifkopnummer
-\setsomeheadconversion{#1}{#4}%
-\ifsomeheadconversion
- \let\fullsectionnumber\naturalfullsectionnumber
- \doplaatskopnummertekst
- {#1}
- {\setsectionlistreference{\@@sectie}{#1}%
- \ExpandFirstAfter\soortpagina[\@@koppeling]%
-% \let\fullsectionnumber\storedfullsectionnumber
- \let\fullsectionnumber\writtenfullsectionnumber
- \rawreference{\s!sec}{#2}{{\someheadconversion}{\asciititle}}%
- \resetsectionmarks[\@@sectie]%
- \stellijstin[\@@koppeling][\c!expansie=\getvalue{\??ko#1\c!expansie}]%
- \let\fullsectionnumber\writtenfullsectionnumber
- \doschrijfnaarlijst{\@@koppeling}{\someheadconversion}{#5}{\v!kop}}%
- {\someheadconversion}
- {#5}
- {\marking[#1]{#5}%
- \let\fullsectionnumber\storedfullsectionnumber
- \expanded{\marking[#1\v!nummer]{\someheadconversion}}}%
- \let\fullsectionnumber\ignoredfullsectionnumber
- \writesection{#1}{\someheadconversion}{#5}%
-\else
- \doplaatskopnummertekst
- {#1}
- {\setsectionlistreference{\@@sectie}{#1}%
- \ExpandFirstAfter\soortpagina[\@@koppeling]%
- \rawreference{\s!sec}{#2}{{#4}{\asciititle}}%
- \resetsectionmarks[\@@sectie]%
- \stellijstin[\@@koppeling][\c!expansie=\getvalue{\??ko#1\c!expansie}]%
- \doschrijfnaarlijst{\@@koppeling}{#4}{#5}{\v!kop}}
- {\sectiebloklabel{#3}{#4}}
- {#5}
- {\marking[#1]{#5}%
- \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} % rommelig omdat
- {\edef\finalsectionnumber{#4}} % #4 al is toegekend
- {\bepaalkopnummer[#1]}% migreert naar 3e argument
- \expanded{\marking[#1\v!nummer]{\finalsectionnumber}}}%
- \writesection{#1}{#4}{#5}%
- \fi
+ \setsomeheadconversion{#1}{#3}%
+ \let\fullsectionnumber\expandablefullsectionnumber
+ \xdef\currentheadnumber{\someheadconversion}%
+ \getvalue{\??ko#1\c!tussen}%
+ \ifsomeheadconversion
+ \let\fullsectionnumber\naturalfullsectionnumber
+ \doplaatskopnummertekst
+ {#1}
+ {\setsectionlistreference{\@@sectie}{#1}%
+ \soortpagina[\@@koppeling]%
+ \let\fullsectionnumber\writtenfullsectionnumber
+ \rawreference{\s!sec}{#2}{{\someheadconversion}{\asciititle}}%
+ \resetsectionmarks\@@sectie
+ \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}%
+ \let\fullsectionnumber\writtenfullsectionnumber
+ \doschrijfnaarlijst{\@@koppeling}{\someheadconversion}{#4}{\v!kop}}%
+ {\dohandleheadnumber\someheadconversion}% handle is new
+ {#4}
+ {\marking[#1]{#4}%
+ \let\fullsectionnumber\storedfullsectionnumber
+ \expanded{\marking[#1\v!nummer]{\someheadconversion}}}%
+ \let\fullsectionnumber\ignoredfullsectionnumber
+ \writesection{#1}{\someheadconversion}{#4}%
+ \else
+ \doplaatskopnummertekst
+ {#1}
+ {\setsectionlistreference{\@@sectie}{#1}%
+ \soortpagina[\@@koppeling]%
+ \rawreference{\s!sec}{#2}{{#3}{\asciititle}}%
+ \resetsectionmarks\@@sectie
+ \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}%
+ \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}}
+ {\sectiebloklabel{#1}{\dohandleheadnumber{#3}}}% handle is new
+ {#4}
+ {\marking[#1]{#4}%
+ \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} % rommelig omdat
+ {\edef\finalsectionnumber{#3}} % #3 al is toegekend
+ {\bepaalkopnummer[#1]}% migreert naar 3e argument
+ \expanded{\marking[#1\v!nummer]{\finalsectionnumber}}}%
+ \writesection{#1}{#3}{#4}%
+ \fi
\else
+ \getvalue{\??ko#1\c!tussen}%
\doplaatskoptekst
{#1}
{\setsectionlistreference{\@@sectie}{#1}%
- \ExpandFirstAfter\soortpagina[\@@koppeling]%
- \rawreference{\s!sec}{#2}{{#4}{\asciititle}}%
- \resetsectionmarks[\@@sectie]%
- \stellijstin[\@@koppeling][\c!expansie=\getvalue{\??ko#1\c!expansie}]%
- \doschrijfnaarlijst{\@@koppeling}{}{#5}{\v!kop}}
- {#5}
- {\marking[#1]{#5}%
- \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
- {\edef\finalsectionnumber{#4}}
+ \soortpagina[\@@koppeling]%
+ \rawreference{\s!sec}{#2}{{#3}{\asciititle}}%
+ \resetsectionmarks\@@sectie
+ \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}%
+ \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}}
+ {#4}
+ {\marking[#1]{#4}%
+ \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} % brrr
+ {\edef\finalsectionnumber{#3}}
{\bepaalkopnummer[#1]}%
\expanded{\marking[#1\v!nummer]{\finalsectionnumber}}}%
- \writesection{#1}{-}{#5}%
+ \writesection{#1}{-}{#4}%
\fi
\ifkopprefix
- \ExpandFirstAfter\setupreferencing[\c!prefix=\localkopprefix]%
+ \setupreferenceprefix[\localkopprefix]%
\fi
\dosomebreak\nobreak
\ifdisplaysectionhead\getvalue{\??ko#1\c!na}\fi
@@ -995,32 +1219,37 @@
\checknexthead\dohandelpaginaafB{#1}% toegevoegd ivm subpaginanr / tug sheets
\setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...]
\ifkopprefix
- \setupreferencing[\c!prefix=-]%
+ \setupreferenceprefix[-]%
\fi
\getvalue{\e!volgende\@@sectie}%
+ \ifkopnummer
+ \setsomeheadconversion{#1}{#3}%
+ \let\fullsectionnumber\expandablefullsectionnumber
+ \xdef\currentheadnumber{\someheadconversion}%
+ \fi
\getvalue{\??ko#1\c!tussen}%
\setsectionlistreference{\@@sectie}{#1}%
- \resetsectionmarks[\@@sectie]%
- \marking[#1]{#5}%
+ \resetsectionmarks\@@sectie
+ \marking[#1]{#4}%
\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
- {\edef\finalsectionnumber{#4}}
+ {\edef\finalsectionnumber{#3}}
{\bepaalkopnummer[#1]}%
\expanded{\marking[#1\v!nummer]{\finalsectionnumber}}%
- \ExpandFirstAfter\soortpagina[\@@koppeling]%
+ \soortpagina[\@@koppeling]%
\bgroup
- \stellijstin[\@@koppeling][\c!expansie=\getvalue{\??ko#1\c!expansie}]%
+ \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}%
\ifkopnummer
- \rawreference{\s!sec}{#2}{{#4}{\asciititle}}%
- \doschrijfnaarlijst{\@@koppeling}{#4}{#5}{\v!kop}%
- \writesection{#1}{#4}{#5}%
+ \rawreference{\s!sec}{#2}{{#3}{\asciititle}}%
+ \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}%
+ \writesection{#1}{#3}{#4}%
\else
- \rawreference{\s!sec}{#2}{{#4}{\asciititle}}%
- \doschrijfnaarlijst{\@@koppeling}{}{#5}{\v!kop}%
- \writesection{#1}{-}{#5}%
+ \rawreference{\s!sec}{#2}{{#3}{\asciititle}}%
+ \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}%
+ \writesection{#1}{-}{#4}%
\fi
\egroup
\ifkopprefix
- \ExpandFirstAfter\setupreferencing[\c!prefix=\localkopprefix]%
+ \setupreferenceprefix[\localkopprefix]%
\fi
\fi
\else
@@ -1030,10 +1259,10 @@
\getvalue{\??ko#1\c!tussen}%
\doplaatskoptekst
{#1}
- {\rawreference{\s!sec}{#2}{{#4}{\asciititle}}}
- {#5}
+ {\rawreference{\s!sec}{#2}{{#3}{\asciititle}}}
+ {#4}
{}%
- \writesection{#1}{-}{#5}%
+ \writesection{#1}{-}{#4}%
\dosomebreak\nobreak
\ifdisplaysectionhead\getvalue{\??ko#1\c!na}\fi
\else
@@ -1042,21 +1271,20 @@
\fi
\flushingcolumnfloatstrue
\someheadconversionfalse
-% \let\fullsectionnumber\naturalfullsectionnumber
-\let\fullsectionnumber\limitedfullsectionnumber
+ \let\fullsectionnumber\limitedfullsectionnumber
\ifdisplaysectionhead\else\expandafter\GotoPar\fi}
-\def\previoussectionformat{}
-\def\currentsectionformat{}
+\let\previoussectionformat\empty
+\let\currentsectionformat \empty
-\let\updatelistreferences=\relax
-\def\updatedlistreferences{}
+\let\updatelistreferences \relax
+\let\updatedlistreferences\empty
\def\setsectionlistreference#1#2%
{\ifnum\countervalue{\??se\previoussection{#1}}>0\relax
\xdef\previoussectionformat{\@@longformatnumber{\previoussection{#1}}}%
\else
- \xdef\previoussectionformat{}%
+ \global\let\previoussectionformat\empty
\fi
\xdef\currentsectionformat{\@@longformatnumber{#1}}}
@@ -1079,8 +1307,8 @@
\def\dostoplistreferences#1%
{\iflijstgeplaatst
- \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal)
- \global\let\updatedlistreferences=\updatedlistreferences % een noodverbandje
+ \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal)
+ \global\let\updatedlistreferences\updatedlistreferences % een noodverbandje
\gdef\updatelistreferences%
{\def\docommando####1%
%
@@ -1090,8 +1318,8 @@
% {\definereference[\e!vorige####1][\getvalue{\e!huidigelokale####1}]%
%
\processcommacommand[\updatedlistreferences]\docommando
- \global\let\updatelistreferences=\relax
- \global\let\updatedlistreferences=\empty}%
+ \global\let\updatelistreferences\relax
+ \global\let\updatedlistreferences\empty}%
\fi}
\def\stoplistreferences%
@@ -1103,12 +1331,13 @@
% \onderwerp{test} \strut \input tufte
% \onderwerp{test} \plaatslijst[...]
-\newif\ifheadnumbercontent
+\newif\ifheadnumbercontent % niet meer wijzigen / wordt mode
\def\doplaatskoptekst#1#2#3#4%
{\beginheadplacement{#1}%
\setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
{\headnumbercontentfalse
+ \resetsystemmode\v!sectienummer
\getvalue{\??ko#1\c!commando}
{} % no number
{\doattributes
@@ -1125,7 +1354,7 @@
\getvalue{\??ko#1\c!voorcommando}%
\ifdisplaysectionhead
\getvalue{\??ko#1\c!tekstcommando}%
- {\setstrut\begstrut#3\endstrut}
+ {\setstrut\begstrut#3\endstrut}%
\xdef\localheaddepth{\the\dp\strutbox}%
\else
\getvalue{\??ko#1\c!tekstcommando}{#3}%
@@ -1138,7 +1367,8 @@
{\beginheadplacement{#1}%
\setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
{\doiftextelse{#3}
- {\headnumbercontenttrue}{\headnumbercontentfalse}%
+ {\setsystemmode \v!sectienummer\headnumbercontenttrue }
+ {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
\getvalue{\??ko#1\c!commando}%
{\doattributes{\??ko#1}\c!letter\c!kleur
{\doattributes{\??ko#1}\c!nummerletter\c!nummerkleur
@@ -1184,10 +1414,13 @@
\mindermeldingen
\postponefootnotes
\iflocation\ifdisplaysectionhead\else\noninterferingmarks\fi\fi
- \setupinteraction
- [\c!letter=,
- \c!kleur=,
- \c!contrastkleur=]%
+ %\setupinteraction
+ % [\c!letter=,
+ % \c!kleur=,
+ % \c!contrastkleur=]%
+ \resetinteractionparameter\c!letter
+ \resetinteractionparameter\c!kleur
+ \resetinteractionparameter\c!contrastkleur
\strictouterreferencestrue % tzt instelling
\def\localkopsetup%
{\dolocalkopsetup{#1}}%
@@ -1198,8 +1431,7 @@
{\doifvaluenothing{\??ko#1\c!file}{\autocrossdocumentfalse}}
{\autocrossdocumentfalse}%
% no message needed here, should be a proper switch
- \let\unknownreference\relax
- %
+ % \let\unknownreference\gobbleoneargument
\ifdisplaysectionhead
\let\headlastlinewidth\!!zeropoint
\snaptogrid\hbox
@@ -1225,7 +1457,7 @@
\doflushfootnotes % new, here since we're in par mode
\iflocation
\ifautocrossdocument
- \hhboxindent=\ifcontinuoushead\headlastlinewidth\else\!!zeropoint\fi
+ \hhboxindent=\ifcontinuoushead\headlastlinewidth\else\zeropoint\fi
\unhhbox0\with{\naarbox{\box\hhbox}[\getvalue{\??ko#1\c!file}::#1]}%
\advance\lasthhboxwidth by \numberheaddistance
\xdef\headlastlinewidth{\the\lasthhboxwidth}%
@@ -1289,15 +1521,6 @@
\def\stelkopnummerin%
{\dodoubleargument\dostelkopnummerin}
-% \def\dokopnummer[#1]%
-% {\bgroup
-% \setsectieenkoppeling{#1}%
-% \doifnot{\finalsectionnumber}{0} % kan effienter
-% {\finalsectionnumber}%
-% \egroup}
-%
-% beter :
-
\def\huidigekopnummer{0}
\def\bepaalkopnummer[#1]%
@@ -1306,19 +1529,11 @@
\xdef\huidigekopnummer{\@@sectionvalue{\@@sectie}}%
\egroup}
-%\def\complexkopnummer[#1]%
-% {\bgroup
-% \setsectieenkoppeling{#1}%
-% \xdef\huidigekopnummer{\@@sectionvalue{\@@sectie}}%
-% \doifnot{\huidigekopnummer}{0}
-% {\finalsectionnumber}%
-% \egroup}
-
\def\complexkopnummer[#1]%
{\bgroup
\edef\huidigekopnummer{#1}%
- \doifinsetelse{-}{#1}
- {\removefromcommalist{-}\huidigekopnummer
+ \doifinsetelse{-}{#1} % br undocumented
+ {\removefromcommalist{-}\huidigekopnummer % br
\setsectieenkoppeling\huidigekopnummer
\stelsectiein[\@@sectie][\c!vorigenummer=\v!nee]}%
{\setsectieenkoppeling\huidigekopnummer}%
@@ -1358,7 +1573,7 @@
{\vbox
{\localkopsetup
\begstrut % but use one \strut here!
- \ifheadnumbercontent
+ \ifheadnumbercontent
\llap{\hbox to 5em{\hfill{#1}\hskip\linkermargeafstand}}%
\fi
{#2}}}
@@ -1391,7 +1606,8 @@
\c!tekstletter=\getvalue{\??ko#1\c!letter},
\c!nummerkleur=\getvalue{\??ko#1\c!kleur},
\c!tekstkleur=\getvalue{\??ko#1\c!kleur}]%
- \ConvertToConstant\doifinstringelse{=}{#2}
+% \ConvertToConstant\doifinstringelse{=}{#2}
+ \doifassignmentelse{#2}
{\getparameters
[\??ko#1]
[\c!sectie=\getvalue{\??ko\getvalue{\??ko#1\c!koppeling}\c!sectie},
@@ -1400,7 +1616,7 @@
\c!prefix=,
\c!voor=,
\c!na=,
- \c!afstand=,
+ \c!afstand=\!!zeropoint,
\c!pagina=,
\c!hoofd=,
\c!tekst=,
@@ -1417,6 +1633,7 @@
\c!verhoognummer=\v!ja,
\c!variant=\@@kovariant,
\c!commando=\@@plaatskop,
+ \c!scheider=\@@koscheider,
\c!uitlijnen=,
\c!tolerantie=,
\c!file=,
@@ -1431,7 +1648,7 @@
\c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer,
\c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein,
%\c!nummerletter,\c!tekstletter,
- %\c!expansie, % njet
+ %\c!expansie, % why njet ?
\c!uitlijnen,\c!tolerantie,\c!nummercommando,\c!tekstcommando]}}%
\getparameters[\??ko#1][#2]%
\doifsomething{\getvalue{\??ko#1\c!sectie}}
@@ -1452,8 +1669,9 @@
\c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer,
\c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein,
%\c!nummerletter,\c!tekstletter,
- %\c!expansie, % njet
+ %\c!expansie, % why njet ?
\c!uitlijnen,\c!tolerantie,\c!nummercommando,\c!tekstcommando]%
+\getparameters[\??ko#1][\c!expansie=]% iig een value, rather fuzzy
\definieermarkering[#1][#2]%
\definieermarkering[#1\v!nummer][#2\v!nummer]%
\doifundefined{\??li#1}{\definieerlijst[#1][#2]}}}%
@@ -1490,7 +1708,7 @@
\def\@@plaatskop{\plaatskopnormaal}
-\def\dostelkopvariantin[#1]%
+\def\dostelkopvariantin[#1]% will be installable ! ! ! ! ! !
{\displaysectionheadtrue
\processaction
[#1]
@@ -1504,12 +1722,10 @@
\def\dostelkoppenin[#1]%
{\getparameters[\??ko][#1]%
- \doifelse{\@@kosectienummer}{\v!ja}
- {\sectienummertrue}
- {\sectienummerfalse}%
- \dostelkopvariantin[\@@kovariant]}
+ \doifelse{\@@kosectienummer}\v!ja\sectienummertrue\sectienummerfalse
+ \dostelkopvariantin[\@@kovariant]} % not really needed here
-\def\stelkoppenin%
+\def\stelkoppenin
{\dosingleargument\dostelkoppenin}
\def\systemsuppliedchapter {\getvalue{\v!hoofdstuk}}
@@ -1688,8 +1904,7 @@
\stellijstin
[\v!deel]
- [\c!breedte=0em,
- \c!voor={\blanko\pagina[\v!voorkeur]},
+ [\c!voor={\blanko\pagina[\v!voorkeur]},
\c!na=\blanko,
\c!label=\v!ja,
\c!scheider=:,
@@ -1697,29 +1912,16 @@
\stellijstin
[\v!hoofdstuk]
- [\c!breedte=2em,
- \c!voor={\blanko\pagina[\v!voorkeur]},
+ [\c!voor={\blanko\pagina[\v!voorkeur]},
\c!na=]
-\stellijstin
- [\v!paragraaf]
- [\c!breedte=3em]
-
-\stellijstin
- [\v!sub\v!paragraaf]
- [\c!breedte=4em]
-
-\stellijstin
- [\v!sub\v!sub\v!paragraaf]
- [\c!breedte=5em]
-
-\stellijstin
- [\v!sub\v!sub\v!sub\v!paragraaf]
- [\c!breedte=6em]
-
-\stellijstin
- [\v!sub\v!sub\v!sub\v!sub\v!paragraaf]
- [\c!breedte=7em]
+\stellijstin [\v!deel] [\c!breedte=0em]
+\stellijstin [\v!hoofdstuk] [\c!breedte=2em]
+\stellijstin [\v!paragraaf] [\c!breedte=3em]
+\stellijstin [\v!sub\v!paragraaf] [\c!breedte=4em]
+\stellijstin [\v!sub\v!sub\v!paragraaf] [\c!breedte=5em]
+\stellijstin [\v!sub\v!sub\v!sub\v!paragraaf] [\c!breedte=6em]
+\stellijstin [\v!sub\v!sub\v!sub\v!sub\v!paragraaf] [\c!breedte=7em]
% hm
@@ -1737,7 +1939,8 @@
\c!tekstscheider=\tfskip,
\c!status=\v!start,
\c!commando=,
- \c!letter=, % \v!normaal, % empty, otherwise conflict
+ \c!strut=\v!ja, % nieuw
+ \c!letter=, % \v!normaal, % empty, otherwise conflict
\c!kleur=]
\protect \endinput
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index 36d1ac5f4..ad2bdc6b2 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -24,27 +24,30 @@
\appendtoks \settopskip \to \everybodyfont
\appendtoks \setmaxdepth \to \everybodyfont
\appendtoks \spacing 1\to \everybodyfont
-\appendtoks \stelinspringenin \to \everybodyfont
-\appendtoks \stelblankoin \to \everybodyfont
-\appendtoks \stelwitruimtein \to \everybodyfont
+\appendtoks \simplestelinspringenin \to \everybodyfont
+\appendtoks \simplestelblankoin \to \everybodyfont
+\appendtoks \simplestelwitruimtein \to \everybodyfont
%appendtoks \setupfootnotes \to \everybodyfont % not
-\appendtoks \stelspatieringin \to \everybodyfont % nieuw
+\appendtoks \simplestelspatieringin \to \everybodyfont % nieuw
\appendtoks \setdisplayskips \to \everybodyfont % nieuw
-\appendtoks \updateraggedskips \to \everyfontswitch % under test
+\appendtoks \updateraggedskips \to \everyfontswitch % under test
+
+\prependtoks \let\par\endgraf \to \everypagebody % see \fillinline
\def\stelfactorenin%
- {\stelwitruimtein
- \stelblankoin
+ {\simplestelwitruimtein
+ \simplestelblankoin
\settopskip
\setmaxdepth}
%D The dreadful sequence \type {\bgroup} \unknown\
-%D \type{\carryoverpar} \unknown\ \type{\egroup} is needed
+%D \type {\carryoverpar} \unknown\ \type {\egroup} is needed
%D when for instance sidefloats are used in combination with
%D something that starts with a group. This is because
%D otherwise the indentation as set (by the output routine)
-%D inside the group are forgotten afterwards.
+%D inside the group are forgotten afterwards. (I must
+%D not forget its existence).
\global\let\carriedoverpar\relax
@@ -57,6 +60,16 @@
\leftskip \the\leftskip
\rightskip \the\rightskip}}
+%D A quick way to determine left|/|middle|/|right states
+%D (experimental).
+
+\setvalue{\??as\v!links }{0}
+\setvalue{\??as\v!midden}{1}
+\setvalue{\??as\v!rechts}{2}
+
+\def\setalignmentswitch#1%
+ {\chardef\alignmentswitch=0\csname\??as#1\endcsname\relax}
+
%D There are two ways to influence the interline spacing. The
%D most general and often most consistent way is using
%D
@@ -112,16 +125,17 @@
\advance\scratchdimen by 0\@@itdiepte pt
\ifdim\scratchdimen>1pt
\showmessage{\m!layouts}{10}{\@@ithoogte,\@@itdiepte}%
- \let\@@ithoogte=\strutheightfactor
- \let\@@itdiepte=\strutdepthfactor
+ \let\@@ithoogte\strutheightfactor
+ \let\@@itdiepte\strutdepthfactor
\else
- \let\strutheightfactor=\@@ithoogte
- \let\strutdepthfactor=\@@itdiepte
+ \let\strutheightfactor\@@ithoogte
+ \let\strutdepthfactor \@@itdiepte
\fi
- \let\minimallinedistance=\@@itafstand
- \let\normallineheight=\@@itregel % let ! ! ! ! ! ivm ex
- \let\topskipfactor=\@@itboven
- \let\maxdepthfactor=\@@itonder
+ \let\minimallinedistance\@@itafstand
+ \let\normallineheight\@@itregel % let ! ! ! ! ! ivm ex
+ \let\topskipfactor\@@itboven
+ \let\maxdepthfactor\@@itonder
+ \let\baselinegluefactor\@@itrek
\setfontparameters % redundant, can be \setstrut, test first
\updateraggedskips} % yes indeed
{\processallactionsinset % \regelwit = dummy !
@@ -159,8 +173,8 @@
\newskip\blankoskip \blankoskip=\bigskipamount
\newskip\blankoskipamount
-\def\skipfactor {.75}
-\def\skipgluefactor {.25}
+\def\skipfactor {.75}
+\def\skipgluefactor{.25}
\def\normalskipamount%
{\openlineheight
@@ -180,6 +194,19 @@
\def\geenblanko%
{\removelastskip}
+\def\currentblanko%
+ {\v!groot}
+
+\def\oldprevdepth {\prevdepth}%
+\def\newprevdepth {-1001pt}
+\def\mindimen {1sp} % was: 0.00002pt
+
+\newif\iflokaalblankovast
+\newif\iflokaalblankoflexibel
+\newif\iffuzzyvskip
+
+%%%% pas op, wordt ook in core-pos gebruikt
+
\def\doassignsomeskip#1\to#2% ook nog \v!halveregel+fuzzysnap
{\doifelse{#1}{\v!regel}
{#2\openlineheight}
@@ -191,16 +218,16 @@
{\smallskipamount}{\medskipamount}{\bigskipamount}%
\fi}}
-\def\dosingleblanko#1%
- {\doassignsomeskip#1\to\blankoskipamount
- \global\advance\blankoskip by \blankoskipamount}
-
-\newif\iffuzzyvskip
+%%%% dus niet weg
-% old
+% replaced
%
+% \def\dosingleblanko#1%
+% {\doassignsomeskip#1\to\blankoskipamount
+% \global\advance\blankoskip \blankoskipamount}
+%
% \def\doblanko#1%
-% {\processallactionsinset
+% {\processallactionsinset % is maar een actie
% [#1]
% [ \v!groot=>\dosingleblanko\v!groot, % happens often
% \v!buiten=>\ifvmode\ifinner\blankobuitentrue\fi\fi,
@@ -215,37 +242,240 @@
% \v!blokkeer=>\global\blankoblokkeertrue,
% \v!forceer=>\global\blankoforceertrue,
% \v!regel=>\global\advance\blankoskip by \lineheight,
-% \v!halveregel=>\global\fuzzyvskiptrue\global\advance\blankoskip by .5\lineheight,
-% \s!unknown=>{\herhaalmetcommando[#1]\dosingleblanko}]}
-%
-% new, see below
+% \v!halveregel=>\ifgridsnapping\global\fuzzyvskiptrue\fi
+% \global\advance\blankoskip by .5\lineheight,
+% \s!unknown=>\doindirectblanko{#1}]}
+%
+% \def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if
+% {\global\blankoresetfalse
+% \global\blankoblokkeerfalse
+% \global\blankogeenwitfalse
+% \global\lokaalblankoflexibelfalse
+% \global\lokaalblankovastfalse
+% \global\blankoskip\zeropoint
+% \global\blankoforceerfalse
+% \blankobuitenfalse
+% \processcommalist[#1]\doblanko
+% \ifdim\blankoskip=\zeropoint\relax
+% \iflokaalblankoflexibel \dosingleblanko\currentblanko \fi
+% \iflokaalblankovast \dosingleblanko\currentblanko \fi
+% \fi
+% \ifblankobuiten
+% \else
+% \par
+% \ifvmode %in pos fonts gaat dit mis
+% \ifblankoforceer%\ifdim\prevdepth>\zeropoint\else
+% % -1000pt signals top of page or column (\ejectcolumn)
+% \vbox{\strut}\kern-\lineheight
+% \fi
+% \ifblankoblokkeer
+% \global\doeblankofalse
+% \edef\oldprevdepth{\the\prevdepth}%
+% \prevdepth=\newprevdepth
+% \else
+% \global\doeblankotrue
+% \fi
+% \ifblankoreset
+% \global\doeblankotrue
+% \ifdim\prevdepth=\newprevdepth
+% \prevdepth=\oldprevdepth
+% \fi
+% \fi
+% \ifdoeblanko
+% \ifdim\lastskip<\blankoskip\relax
+% % else when \blanko[2*groot] + \blanko[3*groot] with parskip
+% % equaling 1*groot, gives a groot=\parskip so adding a small
+% % value makes it distinguishable; can also be done at parskip
+% % setting time (better)
+% \global\advance\blankoskip by \mindimen\relax % = skip
+% % test this on 2* + 3* and parskip groot
+% \ifblankogeenwit
+% \global\advance\blankoskip by -\parskip
+% \else
+% \ifdim\lastskip=\parskip
+% \else % force this due to previous comment
+% \ifdim\parskip>\zeropoint\relax
+% \ifdim\blankoskip<\parskip\relax
+% \global\blankoskip\zeropoint
+% \else
+% \global\advance\blankoskip by -\parskip
+% \fi
+% \fi
+% \fi
+% \fi
+% \ifblankoflexibel \else
+% \blankoskip=1\blankoskip
+% \fi
+% \iflokaalblankovast
+% \blankoskip=1\blankoskip
+% \fi
+% \iflokaalblankoflexibel
+% \blankoskip=1\blankoskip
+% \!!plus\skipgluefactor\blankoskip
+% \!!minus\skipgluefactor\blankoskip
+% \fi
+% \ifdim\prevdepth=\newprevdepth
+% \else
+% \iffuzzyvskip
+% \removelastfuzzyvskip
+% \fuzzyvskip\blankoskip\relax
+% \else
+% \removelastskip
+% \vskip\blankoskip\relax
+% \fi
+% \fi
+% \else
+% \iffuzzyvskip
+% \removelastfuzzyvskip
+% \fuzzyvskip\blankoskip\relax
+% \fi
+% \fi
+% \fi
+% \fi
+% \fi
+% \global\fuzzyvskipfalse
+% \presetindentation}
+%
+% \def\complexdodoblanko[#1]%
+% {\flushfootnotes
+% \ifopelkaar
+% \ifinpagebody
+% \expanded{\docomplexdoblanko[#1]}% \expanded=nieuw
+% \else
+% \par
+% \fi
+% \else
+% \expanded{\docomplexdoblanko[#1]}% \expanded = nieuw
+% \fi}
+%
+% % old
+% %
+% % \def\doindirectblanko#1%
+% % {\ifundefined{\??bo#1}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\relax
+% % \expanded{\complexdodoblanko[#1]}%
+% % \else
+% % \expandafter\complexdoblanko\expandafter[\csname\??bo#1\endcsname]%
+% % \fi}
+% %
+% % \def\complexdoblanko[#1]% enables [force,8\bodyfontsize]
+% % {\doifinstringelse{,}{#1}
+% % {\expanded{\complexdodoblanko[#1]}}
+% % {\doifnumberelse{#1}
+% % {\expanded{\complexdodoblanko[#1]}}
+% % {\doindirectblanko{#1}}}}
+% %
+% % new, more robust
+% %
+% % \def\doindirectblanko#1%
+% % {\edef\ascii{#1}\convertcommand\ascii\to\ascii
+% % \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\rel
+% % \herhaalmetcommando[#1]\dosingleblanko
+% % \else
+% % \expandafter\complexdoblanko\expandafter[\csname\??bo\ascii\endcsname]%
+% % \fi}
+% %
+% % even more robust
+%
+% \def\doindirectblanko#1%
+% {\edef\ascii{#1}\convertcommand\ascii\to\ascii
+% \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname
+% \expanded{\herhaalmetcommando[#1]\noexpand\dosingleblanko}%
+% \else
+% \expandafter\complexdoblanko\expandafter[\csname\??bo\ascii\endcsname]%
+% \fi}
+
+% \def\TestBlank[#1]%
+% {blank : {\convertargument#1\to\ascii\tttf\ascii}\blanko[#1]}
+%
+% \defineblank[whatever][2*big,2*big]
+% \TestBlank[]
+% \TestBlank[big]
+% \TestBlank[2*big]
+% \TestBlank[big,big,2*big]
+% \TestBlank[big]
+% \TestBlank[whatever]
+% \TestBlank[2*big,whatever]
+% \TestBlank[3\lineheight]
+
+\def\addblankskip#1#2#3%
+ {\global\advance\blankoskip#1\ifgridsnapping#3\else#2\fi}
+
+\def\defineblankmethod[#1]#2{\setvalue{\??bo\??bo#1}{#2}}
+
+\defineblankmethod [\v!groot]{\addblankskip+\bigskipamount \openlineheight}
+\defineblankmethod [-\v!groot]{\addblankskip-\bigskipamount \openlineheight}
+\defineblankmethod [\v!middel]{\addblankskip+\medskipamount {.5\openlineheight}}
+\defineblankmethod [-\v!middel]{\addblankskip-\medskipamount {.5\openlineheight}}
+\defineblankmethod [\v!klein]{\addblankskip+\smallskipamount{.25\openlineheight}}
+\defineblankmethod [-\v!klein]{\addblankskip-\smallskipamount{.25\openlineheight}}
+\defineblankmethod [\v!wit]{\addblankskip+\parskip\openlineheight}
+\defineblankmethod [-\v!wit]{\addblankskip-\parskip\openlineheight}
+\defineblankmethod [\v!regel]{\addblankskip+\openlineheight\openlineheight}
+\defineblankmethod [-\v!regel]{\addblankskip-\openlineheight\openlineheight}
+
+\defineblankmethod [\v!formule ]{\global\advance\blankoskip\medskipamount}
+\defineblankmethod [\v!geenwit ]{\global\blankogeenwittrue}
+\defineblankmethod [\v!blokkeer ]{\global\blankoblokkeertrue}
+\defineblankmethod [\v!forceer ]{\global\blankoforceertrue}
+\defineblankmethod [\v!buiten ]{\ifvmode\ifinner\blankobuitentrue\fi\fi}
+\defineblankmethod [\v!reset ]{\global\blankoresettrue}
+\defineblankmethod [\v!flexibel ]{\global\lokaalblankoflexibeltrue}
+\defineblankmethod [\v!vast ]{\global\lokaalblankovasttrue}
+\defineblankmethod [\v!back ]{\geenblanko}
+\defineblankmethod [\v!halveregel]{\ifgridsnapping\global\fuzzyvskiptrue\fi
+ \global\advance\blankoskip .5\lineheight}
+% happens often
+
+\defineblankmethod [2*\v!groot]{\addblankskip+{2\bigskipamount}{2\openlineheight}}
+
+% ETEX ! ! !
\def\doblanko#1%
- {\processallactionsinset
- [#1]
- [ \v!groot=>\dosingleblanko\v!groot, % happens often
- \v!buiten=>\ifvmode\ifinner\blankobuitentrue\fi\fi,
- \v!reset=>\global\blankoresettrue,
- \v!flexibel=>\global\lokaalblankoflexibeltrue,
- \v!vast=>\global\lokaalblankovasttrue,
- \v!back=>\geenblanko,
- \v!wit=>\global\advance\blankoskip by \parskip,
- \v!formule=>\global\advance\blankoskip by \medskipamount,
- \v!geenwit=>\global\blankogeenwittrue,
- -\v!wit=>\global\advance\blankoskip by -\parskip,
- \v!blokkeer=>\global\blankoblokkeertrue,
- \v!forceer=>\global\blankoforceertrue,
- \v!regel=>\global\advance\blankoskip by \lineheight,
- \v!halveregel=>\global\fuzzyvskiptrue\global\advance\blankoskip by .5\lineheight,
- \s!unknown=>\doindirectblanko{#1}]}
-
-\def\oldprevdepth{\prevdepth}%
-\def\newprevdepth{-1001pt}
-
-\def\mindimen{0.00002pt} % beter 1sp
+ {\edef\ascii{#1}\convertcommand\ascii\to\ascii
+ \ifx\ascii\empty\else
+ \ifcsname\??bo\??bo\ascii\endcsname % internal def
+ \csname\??bo\??bo\ascii\endcsname
+ \else\ifcsname\??bo\ascii\endcsname % user def / slow
+ \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax
+ \else
+ \dorepeatwithcommand[#1]\redoblanko
+ \fi\fi
+ \fi}
-\newif\iflokaalblankovast
-\newif\iflokaalblankoflexibel
+\def\redoblanko#1%
+ {\edef\ascii{#1}\convertcommand\ascii\to\ascii
+ \ifx\ascii\empty\else
+ \ifcsname\??bo\??bo\ascii\endcsname % internal def
+ \csname\??bo\??bo\ascii\endcsname
+ \else\ifcsname\??bo\ascii\endcsname % user def / slow
+ \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax
+ \else
+ \global\advance\blankoskip#1\relax
+ \fi\fi
+ \fi}
+
+\def\blanko % the \relax is definitely needed due to the many \if's
+ {\relax\complexorsimple\doblanko}
+
+\def\simpledoblanko % ...
+ {\doifelse\currentwitruimte\v!geen
+ {\blanko[\currentblanko]}
+ {\blanko[\s!default]}}
+
+\def\complexdoblanko
+ {\flushfootnotes
+ \ifopelkaar
+ \ifinpagebody
+ \@EAEAEA\docomplexdoblanko
+ \else
+ \@EAEAEA\nocomplexdoblanko
+ \fi
+ \else
+ \@EA\docomplexdoblanko
+ \fi}
+
+\def\nocomplexdoblanko[#1]%
+ {\par}
\def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if
{\global\blankoresetfalse
@@ -253,33 +483,36 @@
\global\blankogeenwitfalse
\global\lokaalblankoflexibelfalse
\global\lokaalblankovastfalse
- \global\blankoskip=\zeropoint
+ \global\blankoskip\zeropoint
\global\blankoforceerfalse
\blankobuitenfalse
- \processcommalist[#1]\doblanko
-\ifdim\blankoskip=\zeropoint\relax
- \iflokaalblankoflexibel \dosingleblanko\currentblanko \fi
- \iflokaalblankovast \dosingleblanko\currentblanko \fi
-\fi
+ \expanded{\rawprocesscommalist[#1]}\doblanko
+ \ifdim\blankoskip=\zeropoint\relax
+ \iflokaalblankoflexibel
+ \doglobal\advance\blankoskip \currentblanko
+ \else\iflokaalblankovast
+ \doglobal\advance\blankoskip \currentblanko
+ \fi\fi
+ \fi
\ifblankobuiten
\else
\par
\ifvmode %in pos fonts gaat dit mis
- \ifblankoforceer%\ifdim\prevdepth>\!!zeropoint\else
+ \ifblankoforceer%\ifdim\prevdepth>\zeropoint\else
% -1000pt signals top of page or column (\ejectcolumn)
\vbox{\strut}\kern-\lineheight
- \fi%\fi
+ \fi
\ifblankoblokkeer
\global\doeblankofalse
\edef\oldprevdepth{\the\prevdepth}%
- \prevdepth=\newprevdepth
+ \prevdepth\newprevdepth
\else
\global\doeblankotrue
\fi
\ifblankoreset
\global\doeblankotrue
\ifdim\prevdepth=\newprevdepth
- \prevdepth=\oldprevdepth
+ \prevdepth\oldprevdepth
\fi
\fi
\ifdoeblanko
@@ -288,33 +521,33 @@
% equaling 1*groot, gives a groot=\parskip so adding a small
% value makes it distinguishable; can also be done at parskip
% setting time (better)
- \global\advance\blankoskip by \mindimen\relax % = skip
+ \global\advance\blankoskip \mindimen\relax % = skip
% test this on 2* + 3* and parskip groot
\ifblankogeenwit
- \global\advance\blankoskip by -\parskip
+ \global\advance\blankoskip -\parskip
\else
\ifdim\lastskip=\parskip
\else % force this due to previous comment
\ifdim\parskip>\zeropoint\relax
\ifdim\blankoskip<\parskip\relax
- \global\blankoskip=\zeropoint
+ \global\blankoskip\zeropoint
\else
- \global\advance\blankoskip by -\parskip
+ \global\advance\blankoskip -\parskip
\fi
\fi
\fi
\fi
-\ifblankoflexibel \else
- \blankoskip=1\blankoskip
-\fi
-\iflokaalblankovast
- \blankoskip=1\blankoskip
-\fi
-\iflokaalblankoflexibel
- \blankoskip=1\blankoskip
- \!!plus\skipgluefactor\blankoskip
- \!!minus\skipgluefactor\blankoskip
-\fi
+ \ifblankoflexibel \else
+ \blankoskip1\blankoskip
+ \fi
+ \iflokaalblankovast
+ \blankoskip1\blankoskip
+ \fi
+ \iflokaalblankoflexibel
+ \blankoskip1\blankoskip
+ \!!plus\skipgluefactor\blankoskip
+ \!!minus\skipgluefactor\blankoskip
+ \fi
\ifdim\prevdepth=\newprevdepth
\else
\iffuzzyvskip
@@ -337,60 +570,6 @@
\global\fuzzyvskipfalse
\presetindentation}
-\def\complexdodoblanko[#1]%
- {\flushfootnotes
- \ifopelkaar
- \ifinpagebody
- \expanded{\docomplexdoblanko[#1]}% \expanded=nieuw
- \else
- \par
- \fi
- \else
- \expanded{\docomplexdoblanko[#1]}% \expanded = nieuw
- \fi}
-
-% old
-%
-% \def\doindirectblanko#1%
-% {\ifundefined{\??bo#1}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\relax
-% \expanded{\complexdodoblanko[#1]}%
-% \else
-% \expandafter\complexdoblanko\expandafter[\csname\??bo#1\endcsname]%
-% \fi}
-%
-% \def\complexdoblanko[#1]% enables [force,8\bodyfontsize]
-% {\doifinstringelse{,}{#1}
-% {\expanded{\complexdodoblanko[#1]}}
-% {\doifnumberelse{#1}
-% {\expanded{\complexdodoblanko[#1]}}
-% {\doindirectblanko{#1}}}}
-%
-% new, more robust
-%
-% \def\doindirectblanko#1%
-% {\edef\ascii{#1}\convertcommand\ascii\to\ascii
-% \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\rel
-% \herhaalmetcommando[#1]\dosingleblanko
-% \else
-% \expandafter\complexdoblanko\expandafter[\csname\??bo\ascii\endcsname]%
-% \fi}
-%
-% even more robust
-
-\def\doindirectblanko#1%
- {\edef\ascii{#1}\convertcommand\ascii\to\ascii
- \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname
- \expanded{\herhaalmetcommando[#1]\noexpand\dosingleblanko}%
- \else
- \expandafter\complexdoblanko\expandafter[\csname\??bo\ascii\endcsname]%
- \fi}
-
-\def\complexdoblanko[#1]% enables [force,8\bodyfontsize]
- {\expanded{\complexdodoblanko[#1]}}
-
-\def\currentblanko%
- {\v!groot}
-
%D For a long time we had:
%D
%D \starttypen
@@ -415,31 +594,18 @@
%D [\v!groot]
%D \stoptypen
-\def\blanko% % the \relax is definitely needed due to the many \if's
+\def\blanko% the \relax is definitely needed due to the many \if's
{\relax\complexorsimple\doblanko}
-%\def\dostelblankoin#1%
-% {\bgroup % rommelig
-% \skip0=#1\relax
-% \xdef\globalblanko{\the\skip0}%
-% \egroup
-% \bigskipamount=\globalblanko
-% \smallskipamount=\globalblanko
-% \medskipamount=\globalblanko
-% \divide\medskipamount by 2\relax
-% \divide\smallskipamount by 4\relax}%
-
-\def\dostelblankoin#1%
+\def\dostelblankoin#1% amount are an plain inheritance
{\bigskipamount=#1\relax
- \ifblankoflexibel \else
- \bigskipamount=1\bigskipamount
+ \ifblankoflexibel \else
+ \bigskipamount=1\bigskipamount
\fi
- \smallskipamount=\bigskipamount
- \medskipamount=\bigskipamount
- \divide\medskipamount by 2
- \divide\smallskipamount by 4 }%
+ \medskipamount \bigskipamount \divide\medskipamount 2
+ \smallskipamount\bigskipamount \divide\smallskipamount 4 }%
-\def\complexstelblankoin[#1]%
+\def\complexstelblankoin[#1]% more \let's
{\ifgridsnapping
\blankoflexibelfalse
\else
@@ -450,36 +616,36 @@
\fi
\ExpandFirstAfter\processallactionsinset
[#1]
- [ \v!flexibel=>\dostelblankoin{\deblankoskip},
- \v!vast=>\dostelblankoin{\deblankoskip},
+ [ \v!flexibel=>\dostelblankoin\deblankoskip,
+ \v!vast=>\dostelblankoin\deblankoskip,
\v!regel=>\edef\deblankoskip{\regelafstand}%
- \dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!groot,
- \v!halveregel=>\scratchskip=.5\regelafstand
+ \dostelblankoin\deblankoskip
+ \let\deblanko\v!groot,
+ \v!halveregel=>\scratchskip.5\regelafstand
\edef\deblankoskip{\the\scratchskip}%
- \dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!middel,
+ \dostelblankoin\deblankoskip
+ \let\deblanko\v!middel,
\v!groot=>\ifgridsnapping
\edef\deblankoskip{\regelafstand}%
- \dostelblankoin{\deblankoskip}%
+ \dostelblankoin\deblankoskip
\fi
\def\currentblanko{\v!groot}%
- \let\deblanko=\v!groot,
+ \let\deblanko\v!groot,
\v!middel=>\def\currentblanko{\v!middel}%
- \let\deblanko=\v!middel,
+ \let\deblanko\v!middel,
\v!klein=>\def\currentblanko{\v!klein}%
- \let\deblanko=\v!klein,
- \v!normaal=>\dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!groot,
+ \let\deblanko\v!klein,
+ \v!normaal=>\dostelblankoin\deblankoskip
+ \let\deblanko\v!groot,
\v!standaard=>\edef\deblankoskip{\skipfactor\regelafstand}%
- \dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!groot,
- \s!default=>\dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!groot,
- \s!unknown=>\let\deblankoskip=\commalistelement
- \dostelblankoin{\deblankoskip}%
- \let\deblanko=\v!groot]%
- \stelwitruimtein}
+ \dostelblankoin\deblankoskip
+ \let\deblanko\v!groot,
+ \s!default=>\dostelblankoin\deblankoskip
+ \let\deblanko\v!groot,
+ \s!unknown=>\let\deblankoskip\commalistelement
+ \dostelblankoin\deblankoskip
+ \let\deblanko\v!groot]%
+ \simplestelwitruimtein}
% \definecomplexorsimpleempty\stelblankoin
%
@@ -493,7 +659,12 @@
\fi
\dostelblankoin{\deblankoskip}%
\let\deblanko\v!groot
- \stelwitruimtein}
+ \simplestelwitruimtein}
+
+\def\restorestandardblank% \v!standaard
+ {\edef\deblankoskip{\skipfactor\regelafstand}%
+ \dostelblankoin\deblankoskip
+ \let\deblanko\v!groot}
\def\dodefinieerblanko[#1][#2]%
{\def\docommando##1{\setvalue{\??bo##1}{#2}}%
@@ -533,22 +704,6 @@
{\doifoutervmode
{\ifindentfirstparagraph\else\noindentation\fi}}
-%\def\dostelinspringenin[#1]%
-% {\processallactionsinset
-% [#1]
-% [ \v!eerste=>\indentfirstparagraphtrue,
-% \v!volgende=>\indentfirstparagraphfalse,
-% \s!default=>\dodostelinspringenin,
-% \s!unknown=>\edef\currentvoorwit{\commalistelement}%
-% \dodostelinspringenin]}
-%
-%\def\dodostelinspringenin%
-% {\assigndimension{\currentvoorwit}{\voorwit}{1em}{1.5em}{2em}%
-% \parindent=\voorwit\relax}
-%
-%\def\stelinspringenin%
-% {\dosingleempty\dostelinspringenin}
-
\definecomplexorsimple\stelinspringenin
\def\complexstelinspringenin[#1]%
@@ -564,16 +719,16 @@
{\assigndimension{\currentvoorwit}{\voorwit}{1em}{1.5em}{2em}%
\parindent=\voorwit\relax}
-\def\doinspringen[#1]%
+\def\doinspringen[#1]% too many relaxes
{\processallactionsinset
[#1]
- [ \v!nee=>\parindent=\voorwit\relax\noindent,
- \v!niet=>\parindent=\voorwit\relax\noindent,
- \v!ja=>\parindent=\voorwit\relax, % geen \indent !
+ [ \v!nee=>\parindent\voorwit\relax\noindent,
+ \v!niet=>\parindent\voorwit\relax\noindent,
+ \v!ja=>\parindent\voorwit\relax, % geen \indent !
\v!eerste=>\indentfirstparagraphtrue,
\v!volgende=>\indentfirstparagraphfalse,
- \v!altijd=>\parindent=\voorwit\relax, % geen \indent !
- \v!nooit=>\parindent=\zeropoint\relax]}
+ \v!altijd=>\parindent\voorwit\relax, % geen \indent !
+ \v!nooit=>\parindent\zeropoint\relax]}
\def\inspringen%
{\dosingleargument\doinspringen}
@@ -589,24 +744,28 @@
\sfcode`\?#1 \sfcode`\!#1\relax
\sfcode`\:#1 \sfcode`\;#1\relax}
-\def\frenchspacing%
- {\dofrenchspacing{1000}} % \@m
+\def\frenchspacing {\dofrenchspacing{1000}}
+\def\newfrenchspacing{\dofrenchspacing{1050}}
+
+\def\nonfrenchspacing
+ {\sfcode`\.3000 \sfcode`\,1250
+ \sfcode`\?3000 \sfcode`\!3000
+ \sfcode`\:2000 \sfcode`\;1500 }
+
+\def\definespacingmethod[#1]#2{\setvalue{\??sg\??sg#1}{#2}}
-\def\newfrenchspacing%
- {\dofrenchspacing{1050}} % \@ml
+\definespacingmethod[\v!opelkaar]{\newfrenchspacing}
+\definespacingmethod[\v!ruim ]{\nonfrenchspacing}
\def\complexstelspatieringin[#1]%
- {\processaction
- [#1]
- [\v!opelkaar=>\newfrenchspacing,
- \v!ruim=>\nonfrenchspacing]%
+ {\executeifdefined{\??sg\??sg#1}\relax
\updateraggedskips}
-\def\simplestelspatieringin%
+\def\simplestelspatieringin
{\updateraggedskips}
\definecomplexorsimple\stelspatieringin
-
+
\bgroup
\catcode`\~=\@@active % eigenlijk is ~ al actief
\gdef\fixedspaces% % in Plain \TeX, maar we weten
@@ -614,9 +773,11 @@
\def~{\fixedspace}} % gebeurd, vandaar.
\egroup
-\def\space { }
-\def\fixedspace {\hskip.5em\relax}
-\def\nospace {\unskip\ignorespaces}
+\def\space { }
+\def\fixedspace {\hskip.5em\relax}
+\def\removelastspace {\ifhmode\unskip\fi}
+\def\nospace {\removelastspace\ignorespaces}
+\def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\fi}
\let\spatie \space
\let\hardespatie\fixedspace
@@ -629,55 +790,141 @@
{\nointerlineskip
\vskip#1 }
-\newskip\tussenwit \tussenwit=\zeropoint
+%D A couple of plain macros:
+
+\ifx\thinspace\undefined
+
+ \def\thinspace {\kern .16667em }
+ \def\negthinspace{\kern-.16667em }
+ \def\enspace {\kern .5em }
+
+\fi
+
+\ifx\quad\undefined
+
+ \def\enskip{\hskip.5em\relax}
+ \def\quad {\hskip 1em\relax}
+ \def\qquad {\hskip 2em\relax}
+
+\fi
+
+\ifx\smallskip\undefined
+
+ \def\smallskip{\vskip\smallskipamount}
+ \def\medskip {\vskip\medskipamount}
+ \def\bigskip {\vskip\bigskipamount}
+
+\fi
+
+\ifx\allowbreak\undefined
+
+ \def\break {\penalty-\@M}
+ \def\nobreak {\penalty \@M}
+ \def\allowbreak{\penalty \z@}
+ \def\filbreak {\par\vfil\penalty-200\vfilneg}
+ \def\goodbreak {\par\penalty-500 }
+
+\fi
+
+%D Made slightly more readable:
+
+\ifx\vglue\undefined
+
+ \def\vglue {\afterassignment\dovglue\scratchskip=}
+ \def\hglue {\afterassignment\dohglue\scratchskip=}
+ \def\topglue{\nointerlineskip\vglue-\topskip\vglue}
+
+ \def\dovglue
+ {\par
+ \scratchdimen\prevdepth
+ \hrule\!!height\zeropoint
+ \nobreak\vskip\scratchskip
+ \prevdepth\scratchdimen}
+
+ \def\dohglue
+ {\leavevmode
+ \scratchcounter\spacefactor
+ \vrule\!!width\zeropoint
+ \nobreak\hskip\scratchskip
+ \spacefactor\scratchcounter}
+
+\fi
+
+\ifx\eject\undefined
+
+ \def\eject{\par\break}
+
+\fi
+
+\ifx\supereject\undefined
+
+ \def\supereject{\par\penalty-\@MM}
+
+\fi
+
+\ifx\dosupereject\undefined
+
+ \def\dosupereject
+ {\ifnum\insertpenalties>\z@ % something is being held over
+ \line{}
+ \kern-\topskip
+ \nobreak
+ \vfill\supereject
+ \fi}
+
+\fi
+
+%D We adapt plain's \type {\removelastskip} a bit:
+
+\ifx\removelastskip\undefined
+
+ \def\removelastskip
+ {\ifvmode \ifdim\lastskip=\zeropoint \else
+ \vskip-\lastskip
+ \fi \fi}
+
+\fi
+
+\ifx\smallbreak\undefined
+
+\def\smallbreak
+ {\par
+ \ifdim\lastskip<\smallskipamount
+ \removelastskip
+ \penalty-50
+ \smallskip
+ \fi}
+
+\def\medbreak
+ {\par
+ \ifdim\lastskip<\medskipamount
+ \removelastskip
+ \penalty-100
+ \medskip
+ \fi}
+
+\def\bigbreak
+ {\par
+ \ifdim\lastskip<\bigskipamount
+ \removelastskip
+ \penalty-200
+ \bigskip
+ \fi}
+
+\fi
+
+\newskip\tussenwit \tussenwit\zeropoint
\def\blankokleinmaat {\smallskipamount}
\def\blankomiddelmaat {\medskipamount}
\def\blankogrootmaat {\bigskipamount}
-\def\currentwitruimte {\!!zeropoint}
+\def\currentwitruimte {\zeropoint}
\def\stelwitruimteopnieuwin%
{\expanded{\stelwitruimtein[\currentwitruimte]}}
\newif\ifwitruimteflexibel \witruimteflexibeltrue
-%\def\dodostelwitruimtein[#1]%
-% {%\witruimteflexibeltrue
-% \processallactionsinset
-% [#1]
-% [\v!herstel=>,
-% \v!vast=>\witruimteflexibelfalse,
-% \v!flexibel=>\witruimteflexibeltrue,
-% \v!regel=>\tussenwit=\baselineskip,
-% \v!halveregel=>\tussenwit=.5\baselineskip,
-% \s!default=>\doifnot{\currentwitruimte}{\v!geen}
-% {\stelwitruimteopnieuwin},
-% \s!unknown=>\@EA\assigndimension\@EA{\commalistelement} % \@EA is nodig
-% {\tussenwit}
-% {\blankokleinmaat}{\blankomiddelmaat}{\blankogrootmaat}]% % te vangen
-% \edef\currentwitruimte%
-% {\ifdim\tussenwit=\!!zeropoint
-% \v!geen
-% \else
-% \ifgridsnapping\the\baselineskip\else\the\tussenwit\fi
-% \fi}%
-% \ifgridsnapping
-% \witruimteflexibelfalse
-% \tussenwit=1\tussenwit
-% \ifdim\tussenwit>\!!zeropoint
-% \tussenwit=\baselineskip
-% \fi
-% \else
-% \ifwitruimteflexibel \else \tussenwit=1\tussenwit \fi
-% \fi
-% \parskip=\tussenwit}
-%
-%\def\dostelwitruimtein[#1]%
-% {\expanded{\dodostelwitruimtein[#1]}}
-%
-%\def\stelwitruimtein%
-% {\dosingleempty\dostelwitruimtein}
-
\definecomplexorsimple\stelwitruimtein
\def\complexstelwitruimtein[#1]%
@@ -690,17 +937,15 @@
[\v!herstel=>,
\v!vast=>\witruimteflexibelfalse,
\v!flexibel=>\witruimteflexibeltrue,
- \v!regel=>\tussenwit=\baselineskip,
- \v!halveregel=>\tussenwit=.5\baselineskip,
- \s!default=>\doifnot{\currentwitruimte}{\v!geen}
- {\stelwitruimteopnieuwin},
+ \v!regel=>\tussenwit\baselineskip,
+ \v!halveregel=>\tussenwit.5\baselineskip,
+ \s!default=>\doifnot\currentwitruimte\v!geen\stelwitruimteopnieuwin,
\s!unknown=>\@EA\assigndimension\@EA{\commalistelement} % \@EA is nodig
- {\tussenwit}
- {\blankokleinmaat}{\blankomiddelmaat}{\blankogrootmaat}]} % te vangen
+ \tussenwit\blankokleinmaat\blankomiddelmaat\blankogrootmaat]} % te vangen
\def\dodostelwitruimtein%
{\edef\currentwitruimte%
- {\ifdim\tussenwit=\!!zeropoint
+ {\ifdim\tussenwit=\zeropoint
\v!geen
\else
\ifgridsnapping\the\baselineskip\else\the\tussenwit\fi
@@ -708,7 +953,7 @@
\ifgridsnapping
\witruimteflexibelfalse
\tussenwit=1\tussenwit
- \ifdim\tussenwit>\!!zeropoint
+ \ifdim\tussenwit>\zeropoint
\tussenwit=\baselineskip
\fi
\else
@@ -717,12 +962,11 @@
\parskip=\tussenwit}
\def\simplestelwitruimtein% == snelle \stelwitruimtein[\s!default]
- {\doifnot{\currentwitruimte}{\v!geen}
- {\stelwitruimteopnieuwin}%
+ {\doifnot\currentwitruimte\v!geen\stelwitruimteopnieuwin
\dodostelwitruimtein}
\def\geenwitruimte%
- {\ifdim\parskip>\!!zeropoint\relax
+ {\ifdim\parskip>\zeropoint\relax
\ifdim\lastskip=-\parskip
\else
\vskip-\parskip
@@ -752,7 +996,7 @@
\def\witruimte%
{\par
- \ifdim\parskip>\!!zeropoint\relax
+ \ifdim\parskip>\zeropoint\relax
%\ifdim\lastskip>\parskip \else
% \removelastskip interferes with blanko blokkeer en klein
\vskip\parskip
@@ -790,10 +1034,10 @@
\vskip\noparskipsignal % waarschijnlijk ook in
\fi % blanko blokkeer
\bgroup
- \doifelse{#1}{\v!blanko}
- {\opelkaarfalse}
- {\opelkaartrue}%
- \blanko[\v!blokkeer]%
+ \doifelse{#1}\v!blanko
+ \opelkaarfalse
+ \opelkaartrue
+ \blanko[\v!blokkeer]
\stelwitruimtein[\v!geen]
\fi}
@@ -855,9 +1099,6 @@
\stopbaselinecorrection}%
\vbox}
-\def\removeunwantedspaces % too dumb macro
- {\ifhmode\unskip\unskip\unskip\unskip\fi}
-
\def\toonstruts%
{\setteststrut}
@@ -948,17 +1189,17 @@
\vskip-\openlineheight}
\def\settopskip% the extra test is needed for the lbr family
- {\topskip=\systemtopskipfactor\globalbodyfontsize
+ {\topskip\systemtopskipfactor\globalbodyfontsize
\ifgridsnapping \else
\ifr@ggedbottom\!!plus5\globalbodyfontsize\fi
\fi
\relax % the skip
\ifdim\topskip<\strutheightfactor\openlineheight
- \topskip=\strutheightfactor\openlineheight\relax
+ \topskip\strutheightfactor\openlineheight\relax
\fi}
\def\setmaxdepth%
- {\maxdepth=\systemmaxdepthfactor\globalbodyfontsize}
+ {\maxdepth\systemmaxdepthfactor\globalbodyfontsize}
\def\normalbaselines%
{\baselineskip\normalbaselineskip
@@ -966,21 +1207,20 @@
\lineskiplimit\normallineskiplimit}
\def\setnormalbaselines%
- {\lineheight=\normallineheight
- \openlineheight=\spacingfactor\lineheight
-\openstrutheight=\strutheightfactor\openlineheight
-\openstrutdepth =\strutdepthfactor \openlineheight
- \normalbaselineskip=
- \openlineheight
+ {\lineheight\normallineheight
+ \openlineheight\spacingfactor\lineheight
+ \openstrutheight\strutheightfactor\openlineheight
+ \openstrutdepth \strutdepthfactor \openlineheight
+ \normalbaselineskip\openlineheight
\!!plus\baselinegluefactor\openlineheight
\!!minus\baselinegluefactor\openlineheight
\normallineskip\minimallinedistance\relax % \!!onepoint\relax
- \normallineskiplimit\!!zeropoint\relax
+ \normallineskiplimit\zeropoint\relax
\normalbaselines}
\def\setspacingfactor#1\to#2\by#3\\%
- {\strutdimen=#2pt\relax
- \strutdimen=#3\strutdimen
+ {\strutdimen#2pt\relax
+ \strutdimen#3\strutdimen
\edef#1{\withoutpt{\the\strutdimen}}}
\def\spacing#1%
@@ -990,16 +1230,16 @@
\else
\edef\spacingfactor{#1}%
\fi
- \setspacingfactor\systemtopskipfactor\to\topskipfactor\by#1\\%
+ \setspacingfactor\systemtopskipfactor \to\topskipfactor \by#1\\%
\setspacingfactor\systemmaxdepthfactor\to\maxdepthfactor\by#1\\%
\setnormalbaselines
\setstrut}
-\def\setstrutdimen#1#2#3% % een strut is n.m maal ex
- {\strutdimen=\normallineheight % wat niet per se \lineheight
- \strutdimen=#2\strutdimen % is omdat een strut lokaal
- \strutdimen=#3\strutdimen % kan afwijken van de globale
- \edef#1{\the\strutdimen}} % strut
+\def\setstrutdimen#1#2#3% % een strut is n.m maal ex
+ {\strutdimen\normallineheight % wat niet per se \lineheight
+ \strutdimen#2\strutdimen % is omdat een strut lokaal
+ \strutdimen#3\strutdimen % kan afwijken van de globale
+ \edef#1{\the\strutdimen}} % strut
% plain definition:
%
@@ -1009,6 +1249,17 @@
%
% \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox}
+\ifx\strutbox\undefined
+
+ \newbox\strutbox
+
+ \setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}
+
+ %\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
+ \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox}
+
+\fi
+
\let\normalstrut=\strut
% The double \hbox construction enables us to \backtrack
@@ -1032,7 +1283,7 @@
\dosetstrut}
\def\setcharstrut#1%
- {\setbox\strutbox=\hbox{#1}%
+ {\setbox\strutbox\hbox{#1}%
\edef\strutheight{\the\ht\strutbox}%
\edef\strutdepth {\the\dp\strutbox}%
\dosetstrut}
@@ -1043,9 +1294,9 @@
%D Centered looks nicer:
\def\dosetstrut%
- {\let\strut=\normalstrut
- \setbox\strutbox=\normalhbox
- {\normalhbox to \!!zeropoint
+ {\let\strut\normalstrut
+ \setbox\strutbox\normalhbox
+ {\normalhbox to \zeropoint
{% \hss % new, will be option
\vrule
\!!width \strutwidth
@@ -1080,26 +1331,30 @@
\setstrut}
\def\begstrut%
- {\relax\ifdim\ht\strutbox=\!!zeropoint\else
+ {%relax\ifdim\ht\strutbox=\zeropoint\else
+ \relax\ifcase\ht\strutbox\else
\strut
- \normalpenalty\!!tenthousand
- \normalhskip\!!zeropoint
+ \normalpenalty\@M % \!!tenthousand
+ \normalhskip\zeropoint
\ignorespaces
\fi}
\def\endstrut%
- {\relax\ifhmode\ifdim\ht\strutbox=\!!zeropoint\else
+ {%relax\ifhmode\ifdim\ht\strutbox=\zeropoint\else
+ \relax\ifhmode\ifcase\ht\strutbox\else
\removeunwantedspaces
- \normalpenalty\!!tenthousand
- \normalhskip\!!zeropoint
+ \normalpenalty\@M % \!!tenthousand
+ \normalhskip\zeropoint
\strut
\fi\fi}
+\newbox\nostrutbox \setbox\nostrutbox\normalhbox{\normalhbox{}}
+
\def\setnostrut%
- {\setbox\strutbox=\normalhbox{\normalhbox{}}%
- \let\strut=\empty
- \let\endstrut=\empty
- \let\begstrut=\empty}
+ {\setbox\strutbox\copy\nostrutbox
+ \let\strut\empty
+ \let\endstrut\empty
+ \let\begstrut\empty}
% unsave:
%
@@ -1125,7 +1380,7 @@
\let\pseudoendstrut\removeunwantedspaces
\def\resetteststrut%
- {\let\strutwidth=\zeropoint
+ {\let\strutwidth\!!zeropoint
\setstrut}
\ifx\setfontparameters\undefined
@@ -1141,19 +1396,29 @@
%D why|>| this assignment gives troubles in for instance the
%D visual debugger.
-\ifx\undefined\normaloffinterlineskip
- \let\normaloffinterlineskip=\offinterlineskip % knuth's original
-\fi
+%D The plain ones:
+
+\def\offinterlineskip
+ {\baselineskip-1000\p@
+ \lineskip\zeropoint
+ \lineskiplimit\maxdimen}
+
+\def\nointerlineskip
+ {\prevdepth-1000\p@}
+
+\let\normaloffinterlineskip=\offinterlineskip % knuth's original
+
+%D My own one:
\def\offinterlineskip%
- {\ifdim\baselineskip>\!!zeropoint
+ {\ifdim\baselineskip>\zeropoint
\edef\oninterlineskip%
- {\baselineskip=\the\baselineskip
- \lineskip=\the\lineskip
- \lineskiplimit=\the\lineskiplimit
- \noexpand\let\noexpand\offinterlineskip=\noexpand\normaloffinterlineskip}%
+ {\baselineskip\the\baselineskip
+ \lineskip\the\lineskip
+ \lineskiplimit\the\lineskiplimit
+ \let\noexpand\offinterlineskip\noexpand\normaloffinterlineskip}%
\else
- \let\oninterlineskip=\setnormalbaselines
+ \let\oninterlineskip\setnormalbaselines
\fi
\normaloffinterlineskip}
@@ -1174,11 +1439,8 @@
% Bovendien definieren we enkele extra \fill's:
-\def\hfilll%
- {\hskip\!!zeropoint\!!plus1filll\relax}
-
-\def\vfilll%
- {\vskip\!!zeropoint\!!plus1filll\relax}
+\def\hfilll{\hskip\zeropoint\!!plus1filll\relax}
+\def\vfilll{\vskip\zeropoint\!!plus1filll\relax}
% De onderstaande hulpmacro's moeten nog eens instelbaar worden
% gemaakt.
@@ -1200,30 +1462,30 @@
\def\dosinglesmaller#1%
{\processaction
[#1]
- [ \v!links=>\global\advance\linkssmaller by \@@sllinks,
- \v!midden=>\global\advance\middensmaller by \@@slmidden,
- \v!rechts=>\global\advance\rechtssmaller by \@@slrechts,
- \s!unknown=>\global\advance\middensmaller by \commalistelement]}
+ [ \v!links=>\global\advance\linkssmaller \@@sllinks,
+ \v!midden=>\global\advance\middensmaller \@@slmidden,
+ \v!rechts=>\global\advance\rechtssmaller \@@slrechts,
+ \s!unknown=>\global\advance\middensmaller \commalistelement]}
\def\dosmaller[#1]%
{\processaction
[#1]
- [ \v!links=>\global\advance\linkssmaller by \@@sllinks,
- \v!midden=>\global\advance\middensmaller by \@@slmidden,
- \v!rechts=>\global\advance\rechtssmaller by \@@slrechts,
+ [ \v!links=>\global\advance\linkssmaller \@@sllinks,
+ \v!midden=>\global\advance\middensmaller \@@slmidden,
+ \v!rechts=>\global\advance\rechtssmaller \@@slrechts,
\s!unknown=>{\herhaalmetcommando[#1]\dosinglesmaller}]}
\def\complexstartsmaller[#1]%
{\par
\bgroup
- \global\linkssmaller=\!!zeropoint
- \global\rechtssmaller=\!!zeropoint
- \global\middensmaller=\!!zeropoint
+ \global\linkssmaller \zeropoint
+ \global\rechtssmaller\zeropoint
+ \global\middensmaller\zeropoint
\processcommalistwithparameters[#1]\dosmaller
- \advance\leftskip by \linkssmaller
- \advance\rightskip by \rechtssmaller
- \advance\leftskip by \middensmaller
- \advance\rightskip by \middensmaller}
+ \advance\leftskip \linkssmaller
+ \advance\rightskip \rechtssmaller
+ \advance\leftskip \middensmaller
+ \advance\rightskip \middensmaller}
\def\simplestartsmaller%
{\startsmaller[\v!midden]}
@@ -1261,12 +1523,12 @@
\def\dosetraggedvbox#1%
{\processaction
[#1]
- [ \v!links=>\def\raggedbox{\lbox},
- \v!rechts=>\def\raggedbox{\rbox},
- \v!midden=>\def\raggedbox{\cbox},
+ [ \v!links=>\let\raggedbox\lbox,
+ \v!rechts=>\let\raggedbox\rbox,
+ \v!midden=>\let\raggedbox\cbox,
\v!nee=>\def\raggedbox{\vbox\bgroup\raggedright\let\next=},
- \s!default=>\def\raggedbox{\vbox},
- \s!unknown=>\def\raggedbox{\vbox}]}
+ \s!default=>\let\raggedbox\vbox,
+ \s!unknown=>\let\raggedbox\vbox]}
\def\dosetraggedhbox#1%
{\processaction
@@ -1292,40 +1554,100 @@
\def\dosetraggedcommand#1%
{\expanded{\dodosetraggedcommand{#1}}}
-\def\dodosetraggedcommand#1%
- {\doifinsetelse{\v!ruim} {#1}{\!!doneatrue}{\!!doneafalse}%
- \doifinsetelse{\v!breed}{#1}{\!!donebtrue}{\!!donebfalse}%
- \let\raggedcommand\relax
+% \def\dodosetraggedcommand#1%
+% {\doifinsetelse{\v!ruim} {#1}{\!!doneatrue}{\!!doneafalse}%
+% \doifinsetelse{\v!breed}{#1}{\!!donebtrue}{\!!donebfalse}%
+% \let\raggedcommand\relax
+% \let\raggedtopcommand\empty
+% \let\raggedbottomcommand\empty
+% \!!donectrue
+% \ExpandFirstAfter\processallactionsinset
+% [#1]
+% [ \v!links=>\if!!donea \def\raggedcommand{\veryraggedleft}%
+% \else \def\raggedcommand{\raggedleft}%
+% \fi
+% \!!donecfalse, % {\v!links,\v!midden}
+% \v!rechts=>\if!!donea \def\raggedcommand{\veryraggedright}%
+% \else \def\raggedcommand{\raggedright}%
+% \fi
+% \!!donecfalse, % {\v!rechts,\v!midden}
+% \v!midden=>\if!!donec
+% \if!!doneb \def\raggedcommand{\raggedwidecenter}%
+% \else\if!!donea \def\raggedcommand{\veryraggedcenter}%
+% \else \def\raggedcommand{\raggedcenter}%
+% \fi\fi
+% \!!donecfalse % {\v!midden,\v!midden}
+% \else
+% \let\raggedbottomcommand\vfilll % bonus, pretty strong
+% \let\raggedtopcommand \vfilll % used with \framed for
+% \fi, % instance in tables
+% \v!hoog=>\let\raggedbottomcommand\vfilll, % and since we lack a
+% \v!laag=>\let\raggedtopcommand \vfilll, % proper keyword, but
+% \v!laho=>\let\raggedbottomcommand\vfilll % we do support the
+% \let\raggedtopcommand \vfilll, % ugly laho (lohi)
+% \v!nee=>\def\raggedcommand{\raggedright},
+% \v!ja=>\let\raggedcommand\notragged, % was \relax
+% \v!normaal=>\let\raggedcommand\notragged]} % was \relax
+%
+% much faster and important since TABLE uses them a lot:
+
+\def\dodosetraggedcommand#1%
+ {\let\raggedcommand\relax
\let\raggedtopcommand\empty
\let\raggedbottomcommand\empty
- \!!donectrue
- \ExpandFirstAfter\processallactionsinset
- [#1]
- [ \v!links=>\if!!donea \def\raggedcommand{\veryraggedleft}%
- \else \def\raggedcommand{\raggedleft}%
- \fi
- \!!donecfalse, % {\v!links,\v!midden}
- \v!rechts=>\if!!donea \def\raggedcommand{\veryraggedright}%
- \else \def\raggedcommand{\raggedright}%
- \fi
- \!!donecfalse, % {\v!rechts,\v!midden}
- \v!midden=>\if!!donec
- \if!!doneb \def\raggedcommand{\raggedwidecenter}%
- \else\if!!donea \def\raggedcommand{\veryraggedcenter}%
- \else \def\raggedcommand{\raggedcenter}%
- \fi\fi
- \!!donecfalse % {\v!midden,\v!midden}
- \else
- \let\raggedbottomcommand\vfilll % bonus, pretty strong
- \let\raggedtopcommand \vfilll % used with \framed for
- \fi, % instance in tables
- \v!hoog=>\let\raggedbottomcommand\vfilll, % and since we lack a
- \v!laag=>\let\raggedtopcommand \vfilll, % proper keyword, but
- \v!laho=>\let\raggedbottomcommand\vfilll % we do support the
- \let\raggedtopcommand \vfilll, % ugly laho (lohi)
- \v!nee=>\def\raggedcommand{\raggedright},
- \v!ja=>\let\raggedcommand\notragged, % was \relax
- \v!normaal=>\let\raggedcommand\notragged]} % was \relax
+ \doifsomething{#1}
+ {\doifinsetelse{\v!ruim} {#1}\!!doneatrue\!!doneafalse
+ \doifinsetelse{\v!breed}{#1}\!!donebtrue\!!donebfalse
+ \!!donectrue
+ \rawprocesscommalist[#1]\dododosetraggedcommand}}
+
+\def\dododosetraggedcommand#1%
+ {\executeifdefined{\@@ragged@@command\string#1}\relax}
+
+\def\@@ragged@@command{@@raggedcommand}
+
+\setvalue{\@@ragged@@command\v!links}%
+ {\if!!donea \def\raggedcommand{\veryraggedleft}%
+ \else \def\raggedcommand{\raggedleft}%
+ \fi
+ \!!donecfalse}
+
+\setvalue{\@@ragged@@command\v!rechts}%
+ {\if!!donea \def\raggedcommand{\veryraggedright}%
+ \else \def\raggedcommand{\raggedright}%
+ \fi
+ \!!donecfalse}
+
+\setvalue{\@@ragged@@command\v!midden}%
+ {\if!!donec
+ \if!!doneb \def\raggedcommand{\raggedwidecenter}%
+ \else\if!!donea \def\raggedcommand{\veryraggedcenter}%
+ \else \def\raggedcommand{\raggedcenter}%
+ \fi\fi
+ \!!donecfalse
+ \else
+ \let\raggedbottomcommand\vfilll % bonus, pretty strong
+ \let\raggedtopcommand \vfilll % used with \framed for
+ \fi} % instance in tables
+
+\setvalue{\@@ragged@@command\v!hoog}%
+ {\let\raggedbottomcommand\vfilll} % and since we lack a
+
+\setvalue{\@@ragged@@command\v!laag}%
+ {\let\raggedtopcommand\vfilll} % proper keyword, but
+
+\setvalue{\@@ragged@@command\v!laho}%
+ {\let\raggedbottomcommand\vfilll % we do support the
+ \let\raggedtopcommand\vfilll} % ugly laho (lohi)
+
+\setvalue{\@@ragged@@command\v!nee}%
+ {\def\raggedcommand{\raggedright}}
+
+\setvalue{\@@ragged@@command\v!ja}%
+ {\let\raggedcommand\notragged}
+
+\setvalue{\@@ragged@@command\v!normaal}%
+ {\let\raggedcommand\notragged}
% Nodig i.v.m. inspringen eerste alineas
@@ -1350,16 +1672,15 @@
% een \penalty v¢¢r witruimte worden geplaatst.
\def\removelastskip% a redefinition of plain
- {\ifvmode\ifdim\lastskip=\z@\else\vskip-\lastskip\fi\fi}
+ {\ifvmode\ifdim\lastskip=\zeropoint\else\vskip-\lastskip\fi\fi}
\def\dosomebreak#1%
- {\skip0=\lastskip
+ {\scratchskip\lastskip
\removelastskip
%\type{#1}%
#1\relax
- \ifdim\skip0=\!!zeropoint
- \else
- \vskip\skip0
+ \ifdim\scratchskip=\zeropoint \else
+ \vskip\scratchskip
\fi}
% beter, vooral in \vbox; nog in \pagina toepassen s!
@@ -1369,13 +1690,13 @@
\def\dosomebreak#1%
{\doifoutervmode
- {\skip0=\lastskip
+ {\scratchskip\lastskip
\removelastskip
%\leavevmode\type{#1}%
#1\relax
- \ifdim\skip0=\!!zeropoint % else interference with footnotes
+ \ifdim\scratchskip=\zeropoint % else interference with footnotes
\else
- \vskip\skip0
+ \vskip\scratchskip
\fi}}
% Idem:
@@ -1384,10 +1705,10 @@
%\def\noindentation% vervallen
% {\EveryPar
-% {\ifdim\parindent=\!!zeropoint
+% {\ifdim\parindent=\zeropoint
% \else
% \bgroup
-% \setbox0=\lastbox
+% \setbox\scratchbox\lastbox
% \egroup
% \fi
% \EveryPar{}}}
@@ -1397,11 +1718,8 @@
\let\checkindentation=\relax
\def\donoindentation%
- {\ifdim\parindent=\!!zeropoint
- \else
- \bgroup
- \setbox0=\lastbox
- \egroup
+ {\ifdim\parindent=\zeropoint \else
+ \bgroup \setbox\scratchbox\lastbox \egroup
\fi}
\def\noindentation% made global
@@ -1419,7 +1737,7 @@
\fi}
\def\indentation%
- {\ifvmode \ifdim\parindent=\!!zeropoint \else
+ {\ifvmode \ifdim\parindent=\zeropoint \else
% was : \hskip\parindent
% can be: \indent
% but we test:
@@ -1507,29 +1825,6 @@
%D anything, even a raw fontswitch. No a real improvement
%D (some 5 seconds on 260 seconds for the maps bibliography).
-\def\@@dodoconvertfont#1{\csname\@letter@ #1\endcsname}
-\def\@@donoconvertfont#1{\csname\@noletter@#1\endcsname}
-
-\unexpanded\def\dodoconvertfont#1%#2%
- {\doifdefinedelse{\@letter@#1}
- {\doifelsenothing{#1}
- {\let\next\gobbleoneargument}
- {\let\next\@@dodoconvertfont}}
- {\doifdefinedelse{#1}
- {\let\next\getvalue}
- {\let\next\firstofoneargument}}%
- \next{#1}}%{#2}}
-
-\let\doconvertfont=\dodoconvertfont
-
-\def\noconvertfont#1%#2%
- {\doifdefinedelse{\@noletter@#1}
- {\doifelsenothing{#1}
- {\let\next\gobbleoneargument}
- {\let\next\@@donoconvertfont}}
- {\let\next\firstofoneargument}%
- \next{#1}}%{#2}}
-
\beginTEX
\unexpanded\def\dostartattributes#1#2#3%
@@ -1573,6 +1868,69 @@
\unexpanded\def\doattributes#1#2#3#4%
{\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes}
+% An even faster \ETEX\ version:
+
+\beginETEX
+
+% \unexpanded\def\dostartattributes#1#2#3%
+% {\begingroup % geen \bgroup, anders in mathmode lege \hbox
+% \ifcsname#1#3\endcsname
+% \let\dostopattributes\@@dostopattributes
+% \startcolor[\csname#1#3\endcsname]%
+% \else
+% \let\dostopattributes\endgroup
+% \fi
+% \ifcsname#1#2\endcsname
+% \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
+% \fi}
+%
+% \unexpanded\def\@@dostopattributes%
+% {\stopcolor
+% \endgroup}
+
+\unexpanded\def\dostartattributes#1#2#3%
+ {\begingroup % geen \bgroup, anders in mathmode lege \hbox
+ \ifincolor
+ \ifcsname#1#3\endcsname
+ \let\dostopattributes\@@dostopattributes
+ \doglobalstartcolor[\csname#1#3\endcsname]%
+ \else
+ \let\dostopattributes\endgroup
+ \fi
+ \else
+ \let\dostopattributes\endgroup
+ \fi
+ \ifcsname#1#2\endcsname
+ \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
+ \fi}
+
+\unexpanded\def\@@dostopattributes%
+ {\doglobalstopcolor
+ \endgroup}
+
+%D Since this happens a lot, and sometimes large arguments
+%D are passed in \type {#4}, we just copy some code:
+
+\unexpanded\def\doattributes#1#2#3#4%
+ {\begingroup % geen \bgroup, anders in mathmode lege \hbox
+ \ifincolor
+ \ifcsname#1#3\endcsname
+ \let\dostopattributes\@@dostopattributes
+ \doglobalstartcolor[\csname#1#3\endcsname]%
+ \else
+ \let\dostopattributes\endgroup
+ \fi
+ \else
+ \let\dostopattributes\endgroup
+ \fi
+ \ifcsname#1#2\endcsname
+ \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
+ \fi
+ {#4}%
+ \dostopattributes}
+
+\endETEX
+
% Kan vaker worden toegepast en moet bovendien sneller!
\newskip\leftskipadaption
@@ -1655,14 +2013,37 @@
{\noexpand\realfolio}}}%
\writeparref}
-\def\setraggedparagraphmode#1#2%
- {\ifinner
+% \def\setraggedparagraphmode#1#2%
+% {\ifinner
+% \ifdubbelzijdig
+% \gettwopassdata{\s!paragraph}%
+% \iftwopassdatafound
+% \ifodd\twopassdata#1\else#2\fi
+% \else
+% \ifodd\realfolio#1\else#2\fi
+% \fi
+% \doparagraphreference
+% \else
+% #2\relax
+% \fi
+% \else
+% #2\relax
+% \fi}
+
+\def\setraggedparagraphmode#1#2% combineren met \ifrightpage
+ {\ifinpagebody
+ \ifdubbelzijdig
+ \ifodd\realpageno\relax#1\else#2\fi
+ \else
+ #2\relax
+ \fi
+ \else\ifinner
\ifdubbelzijdig
\gettwopassdata{\s!paragraph}%
\iftwopassdatafound
- \ifodd\twopassdata#1\else#2\fi
+ \ifodd\twopassdata\relax#1\else#2\fi
\else
- \ifodd\realfolio#1\else#2\fi
+ \ifodd\realpageno\relax#1\else#2\fi
\fi
\doparagraphreference
\else
@@ -1670,10 +2051,62 @@
\fi
\else
#2\relax
- \fi}
+ \fi\fi}
% \let\doifrightpageelse\setraggedparagraphmode
+% in both (otr) modules !
+
+% \def\doifrightpageelse#1#2%
+% {\ifdubbelzijdig
+% \gettwopassdata\s!paragraph
+% \iftwopassdatafound
+% \ifodd\twopassdata#1\else#2\fi
+% \else
+% \ifodd\realfolio#1\else#2\fi
+% \fi
+% \else
+% #1% was #2
+% \fi}
+%
+% better :
+
+\def\doifrightpageelse % watch out: other default ! ! !
+ {\ifinpagebody
+ \ifdubbelzijdig
+ \ifodd\twopassdata\relax
+ \twopassdatafoundtrue \else \twopassdatafoundfalse
+ \fi
+ \else
+ \twopassdatafoundtrue
+ \fi
+ \else
+ \ifdubbelzijdig
+ \gettwopassdata\s!paragraph
+ \iftwopassdatafound
+ \ifodd\twopassdata\relax
+ \twopassdatafoundtrue \else \twopassdatafoundfalse
+ \fi
+ \else
+ \ifodd\realpageno\relax
+ \twopassdatafoundtrue \else \twopassdatafoundfalse
+ \fi
+ \fi
+ \else
+ \twopassdatafoundtrue
+ \fi
+ \fi
+ \iftwopassdatafound
+ \@EA\firstoftwoarguments
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
+\def\signalrightpage
+ {\ifdubbelzijdig
+ \doparagraphreference
+ \fi}
+
% De onderstaande macro's zijn opgenomen in Plain TeX.
%
% \def\raggedright%
@@ -1703,6 +2136,10 @@
\newif\ifr@ggedbottom
\newif\ifb@selinebottom
+\def\normalbottom%
+ {% \topskip 10pt
+ \r@ggedbottomfalse}
+
\def\raggedbottom%
{\chardef\bottomraggedness=0
\n@rmalbottomfalse
@@ -1910,12 +2347,11 @@
%\def\regelmidden#1%
% {\noindent\centerline{{\strut#1}}}
-\def\doalignline#1#2%
- {\dowithnextbox
- {\noindent\hbox to \hsize
- {\strut#1\unhbox\nextbox#2}}
- \hbox}
-
+% \def\doalignline#1#2%
+% {\dowithnextbox
+% {\noindent\hbox to \hsize{\strut#1\unhbox\nextbox#2}}
+% \hbox}
+%
% also supporting \\
%
% \def\doalignline#1#2%
@@ -1927,10 +2363,9 @@
\def\doalignline#1#2%
{\bgroup
- \def\\{\egroup\par\doalignline#1#2\bgroup}%
+ \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}%
\dowithnextbox
- {\noindent\hbox to \hsize
- {\strut#1\unhbox\nextbox#2}\egroup}
+ {\noindent\hbox to \hsize{\strut#1\unhbox\nextbox#2}\egroup}
\hbox}
% directe commando's
@@ -1950,6 +2385,23 @@
\def\doregelplaats#1%
{\getvalue{regel#1}}
+%D Experimental:
+
+\def\doxalignline#1#2%
+ {\bgroup
+ \def\\{\egroup\par\doxalignline{#1}{#2}\bgroup}% inefficient
+ \dowithnextbox
+ {\noindent\hbox to \hsize
+ {\strut\signalrightpage
+ \doifrightpageelse{#1\unhbox\nextbox#2}{#2\unhbox\nextbox#1}}%
+ \egroup}
+ \hbox}
+
+\setvalue{regel\v!binnen}{\doxalignline\relax\hss}
+\setvalue{regel\v!buiten}{\doxalignline\hss\relax}
+
+%D ...
+
\def\dosteltolerantiein[#1]%
{\doifinsetelse{\v!vertikaal}{#1}%
{\ExpandFirstAfter\processallactionsinset
@@ -2038,6 +2490,36 @@
%D In \CONTEXT\ however we save some processing time by putting
%D an extra \type{\hbox} around the \type{\strutbox}.
+\def\definehspace
+ {\dodoubleargument\dodefinehspace}
+
+\def\dodefinehspace[#1][#2]%
+ {\setvalue{\??hs#1}{#2}}
+
+\unexpanded\def\hspace
+ {\dosingleempty\dohspace}
+
+\def\dohspace[#1]%
+ {\ifhmode
+ \removeunwantedspaces
+ \hskip
+ \iffirstargument
+ \executeifdefined{\??hs#1}{#1}%
+ \else
+ \getvalue{\??hs\s!default}%
+ \fi
+ \expandafter\ignorespaces
+ \fi}
+
+\def\emspaceamount{\fontdimen6\font}
+\def\spaceamount {\fontdimen2\font}
+
+\definehspace [\v!klein] [.25\emspaceamount]
+\definehspace [\v!middel] [.5\emspaceamount]
+\definehspace [\v!groot] [1\emspaceamount]
+\definehspace [\v!normaal] [1\spaceamount]
+\definehspace [\v!default] [\v!groot]
+
\stelwitruimtein
[\v!geen]
@@ -2068,7 +2550,8 @@
\c!boven=1.0,
\c!onder=0.4,
\c!afstand=1pt,
- \c!regel=2.8ex]
+ \c!regel=2.8ex,
+ \c!rek=0]
\stelsmallerin
[\c!links=1.5em,
diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex
index 190c04b69..a9153089a 100644
--- a/tex/context/base/core-syn.tex
+++ b/tex/context/base/core-syn.tex
@@ -15,6 +15,8 @@
\unprotect
+% \checkdefined kan hierheen
+
% Formaat tex-utility-input-file <jobname.tui>:
%
% synonym entry {tag} {pure} {text} {synonym}
@@ -98,7 +100,7 @@
%\def\getsynonymmeaning#1#2#3%
% {\doifdefinedelse{#2#3}
% {{\synonymmeaningtrue\getvalue{#2#3}}}
-% {{\showmessage{\m!systems}{18}{#1,#3}}}
+% {{\showmessage{\m!systems}{18}{#1,#3}}}}
\def\getsynonymmeaning#1#2#3%
{\bgroup
@@ -167,25 +169,7 @@
\fi}
\def\dodefinieersynoniemen[#1][#2][#3][#4]%
- {\stelsynoniemenin
- [#1]
- [\c!synoniemletter=,
- \c!tekstletter=,
- \c!status=\v!start,
- \c!criterium=,
- \c!plaats=\v!links,
- \c!breedte=5em,
- \c!afstand=0pt,
- \c!monster=,
- \c!hang=,
- \c!uitlijnen=,
- \c!voor=,
- \c!tussen=,
- \c!na=,
- \c!springvolgendein=\v!nee]%
- \presetheadtext
- [#2=\Word{#2}]%
- \setvalue{\e!stel#2\e!in}%
+ {\setvalue{\e!stel#2\e!in}%
{\dodoubleargument\getparameters[\??sm#1]}%
\iffourthargument
\unexpanded\def#4##1%
@@ -204,6 +188,25 @@
\setvalue{#1}%
{\dotripleempty\docomplexsynonym[][#1]}%
\fi
+ \dostelsynoniemenin
+ [#1]%
+ [\c!synoniemletter=,
+ \c!tekstletter=,
+ \c!status=\v!start,
+ \c!criterium=,
+ \c!plaats=\v!links,
+ \c!breedte=5em,
+ \c!afstand=0pt,
+ \c!monster=,
+ \c!hang=,
+ \c!uitlijnen=,
+ \c!voor=,
+ \c!tussen=,
+ \c!na=,
+ \c!springvolgendein=\v!nee,
+ \c!expansie=]%
+ \presetheadtext % changes the \if...argument
+ [#2=\Word{#2}]%
\setvalue{\s!set#1}%
{\dosetsynonym{#1}}%
\setvalue{\s!reset#1}%
@@ -336,7 +339,8 @@
\c!criterium=,
\c!letter=,
\c!voor=,
- \c!na=\endgraf]%
+ \c!na=\endgraf,
+ \c!expansie=]%
\presetheadtext[#2=\Word{#2}]%
\setvalue{\e!stel#2\e!in}[##1]% vervalt tzt, soort oo-mode
{\getparameters[\??so#1][##1]}%
diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex
index bcc3f6173..942f0c310 100644
--- a/tex/context/base/core-sys.tex
+++ b/tex/context/base/core-sys.tex
@@ -15,11 +15,25 @@
\unprotect
+\def\outputfilename{\@@svfile}
+\def\inputfilename {\@@svinputfile}
+
+\def\splitjobfilename
+ {\edef\ascii{\inputfilename}\convertcommand\ascii\to\ascii
+ %\beforesplitstring\ascii\at.\to\jobfilename
+ %\aftersplitstring \ascii\at.\to\jobfilesuffix
+ \splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix
+ \doifnothing\jobfilename {\let\jobfilename \jobname}%
+ \doifnothing\jobfilesuffix{\let\jobfilesuffix\c!tex}}
+
+\appendtoks \splitjobfilename \to \everyjob
+
\def\dosetupsystem[#1]%
{\getparameters[\??sv][#1]%
\setuprandomize[\@@svwillekeur]%
\beforesplitstring\@@svresolutie\at dpi\to\@@svresolutie
- \let\outputresolution=\@@svresolutie}
+ \let\outputresolution\@@svresolutie
+ \splitjobfilename}
\def\setupsystem%
{\dosingleargument\dosetupsystem}
@@ -39,9 +53,6 @@
\nextrandom
\egroup}}
-\def\outputfilename{\@@svfile}
-\def\inputfilename {\@@svinputfile}
-
\setupsystem
[\c!gebied=,
\c!resolutie=600dpi,
@@ -79,7 +90,7 @@
\definecomplexorsimple\start
\definecomplexorsimple\stop
-\def\dodefinieerstartstop[#1][#2]%
+\def\dododefinestartstop[#1][#2]%
{\getparameters
[\??be#1]
[\c!voor=,
@@ -87,8 +98,6 @@
\c!commandos=,
\c!letter=,
#2]%
-% \setvalue{\e!stel#1\e!in}[##1]%
-% {\dodoubleargument\getparameters[\??be##1]}%
\unexpanded\setvalue{#1}%
{\groupedcommand
{\getvalue{\??be#1\c!commandos}%
@@ -104,11 +113,19 @@
\egroup
\getvalue{\??be#1\c!na}}}
-\def\definieerstartstop%
- {\dodoubleargument\dodefinieerstartstop}
+\def\dodefinestartstop[#1][#2]%
+ {\def\docommando##1{\dododefinestartstop[##1][#2]}%
+ \processcommalist[#1]\docommando}
+
+\def\definestartstop
+ {\dodoubleargument\dodefinestartstop}
-\def\stelstartstopin[#1]%
- {\dodoubleargument\getparameters[\??be#1]}
+\def\dosetupstartstop[#1][#2]%
+ {\def\docommando##1{\getparameters[\??be##1][#2]}%
+ \processcommalist[#1]\docommando}
+
+\def\setupstartstop
+ {\dodoubleargument\dosetupstartstop}
% \docommando kan niet worden gebruikt omdat deze macro
% soms lokaal wordt gebruikt
@@ -161,25 +178,63 @@
\definecomplexorsimpleempty\definieer
-\unexpanded\def\naam#1%
+\unexpanded\def\naam#1% brrr
{\getvalue{#1}}
\def\gebruikcommandos#1%
{\bgroup
- \def\docommando##1%
- {\setbox0=\hbox{\getvalue{\string##1}##1}}%
+ \def\docommando##1{\setbox0=\hbox{\getvalue{\string##1}##1}}%
\processcommalist[#1]\docommando
\egroup}
-\def\convertexpanded#1#2#3% watch the double \v!ja expansion !
- {\ExpandFirstAfter\processaction
- [\getvalue{#1\c!expansie}]
- [ \v!ja=>{{\honorunexpanded\xdef\@@globalexpanded{#2}%
- \xdef\@@globalexpanded{\@@globalexpanded}}%
- \dodoglobal\convertcommand\@@globalexpanded\to#3},
- \v!commando=>{\dodoglobal\convertcommand #2\to#3},
- \s!default=>{\dodoglobal\convertargument#2\to#3},
- \s!unknown=>{\dodoglobal\convertargument#2\to#3}]}
+\newif\ifforcefileexpansion % handy for document level overload
+
+% \def\convertexpanded#1#2#3% watch the double \v!ja expansion !
+% {\ExpandFirstAfter\processaction
+% [\ifforcefileexpansion\v!ja\else\getvalue{#1\c!expansie}\fi]
+% [ \v!ja=>{{\honorunexpanded
+% \dontexpandencoding % new
+% \xdef\@@globalexpanded{#2}%
+% \xdef\@@globalexpanded{\@@globalexpanded}}%
+% \convertcommand\@@globalexpanded\to#3},
+% \v!commando=>{\convertcommand #2\to#3},
+% \s!default=>{\convertargument#2\to#3},
+% \s!unknown=>{\convertargument#2\to#3}]}
+
+%D The next implementation is about 4 times as fast on an
+%D string of average length. Since this feature is used in
+%D XML processing, it made sense to support this faster
+%D alternative.
+
+\def\installexpander#1{\setvalue{\s!do\c!expansie#1}}
+
+\long\def\convertexpanded#1#2#3% hm, first we need to make sure
+ {\csname % that we assign all exp a value
+ \s!do\c!expansie
+ \ifforcefileexpansion
+ \v!ja
+ \else\@EA\ifx\csname\s!do\c!expansie\csname#1\c!expansie\endcsname\endcsname\relax
+ \s!default
+ \else
+ \csname#1\c!expansie\endcsname
+ \fi\fi
+ \endcsname#2\to#3}
+
+\installexpander\v!ja {\convertmeaning }
+\installexpander\v!ja {\convertmeaning }
+\installexpander\v!commando{\convertcommand }
+\installexpander\s!default {\convertargument}
+\installexpander\empty {\convertargument}
+\installexpander\v!nee {\convertargument}
+
+\def\convertmeaning#1\to % watch the double expansion !
+ {\bgroup
+ \honorunexpanded
+ \dontexpandencoding % new
+ \xdef\@@globalexpanded{#1}%
+ \xdef\@@globalexpanded{\@@globalexpanded}%
+ \egroup
+ \convertcommand\@@globalexpanded\to}
% \setvalue{statevalue\v!stop }{0}
% \setvalue{statevalue\v!start }{1}
diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex
index ab17fbec0..383f9d8d5 100644
--- a/tex/context/base/core-tab.tex
+++ b/tex/context/base/core-tab.tex
@@ -96,7 +96,7 @@
%D options. After implementing this feature, I also added
%D warnings, error recovery and automatic spacing.
-\newif\iftracetables
+\newif\iftracetables
%D We show this feature in an eample that also shows some of
%D the basic table typesetting commands.
@@ -460,20 +460,6 @@
%D \ReadFormatKeys}
%D \stoptypen
-% \def\BeginTableParBox#1%
-% {\vtop\bgroup
-% \hsize=#1
-% \normalbaselines
-% \let~=\!ttTie
-% \let\-=\!ttDH
-% \the\EveryTableParBox
-% \begstrut} % added
-%
-% \def\EndTableParBox%
-% {\endstrut % added
-% \MakeStrut{0pt}{\StrutDepthFactor\StrutUnit}%
-% \egroup}
-
\newdimen\TABLEparheight
\def\BeginTableParBox#1%
@@ -485,17 +471,74 @@
\blanko[\v!blokkeer]% % added
\the\EveryTableParBox}
-\def\EndTableParBox%
- {\removelastskip % added
- %\MakeStrut{0pt}{\StrutDepthFactor\StrutUnit} % removed
- \par \ifnum\prevgraf>0 \strut \vskip-\lineheight \fi % added
- \egroup % finishes the \vtop begun by \BeginTableParbox
- \getboxheight\scratchdimen\of\box\scratchbox\relax % added
- \ifdim\scratchdimen>\TABLEparheight % added
- \global\TABLEparheight=\scratchdimen % added
- \fi % added
+% \def\EndTableParBox%
+% {\removelastskip % added
+% %\MakeStrut{0pt}{\StrutDepthFactor\StrutUnit} % removed
+% \par
+% \ifnum\prevgraf>0
+% \strut \geenwitruimte \vskip-\lineheight % added
+% \fi
+% \egroup % finishes the \vtop begun by \BeginTableParbox
+% \getboxheight\scratchdimen\of\box\scratchbox\relax % added
+% \ifdim\scratchdimen>\TABLEparheight % added
+% \global\TABLEparheight=\scratchdimen % added
+% \fi % added
+% \box\scratchbox}
+
+\def\EndTableParBox
+ {\removelastskip % itemize or so
+ \par
+ \ifnum\prevgraf>0 % we want at least
+ \strut \geenwitruimte \vskip-\lineheight % one line of text
+ \egroup
+ \ifdim\dp\scratchbox>\lineheight % see (*) for an
+ \getnoflines{\dp\scratchbox}% % example of where
+ \dp\scratchbox=\zeropoint % saving can go
+ \vtop to \noflines\lineheight{\box\scratchbox}% terrible wrong
+ \fi % esp between rows
+ \else % of paragraphs
+ \egroup
+ \fi
+ \getboxheight\scratchdimen\of\box\scratchbox\relax% compensate for
+ \ifdim\scratchdimen>\TABLEparheight % funny depth of
+ \global\TABLEparheight=\scratchdimen % multi-line box
+ \fi % i.e. vtop
\box\scratchbox}
+% (*) Try this one with \type {direction} and {girection};
+% the \PPCHTEX\ manual is a nice testcase.
+%
+% \startoverlay
+% {\starttable[ | l w(2cm) | w(8cm) | ]
+% \HL
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \MR
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \LR
+% \HL
+% \stoptable}
+% {\starttable[ | l w(2cm) | p(8cm) | ]
+% \HL
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \MR
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \LR
+% \HL
+% \stoptable}
+% \stopoverlay
+% \vskip2cm
+% \starttable[ | l w(2cm) | p(8cm) | ]
+% \HL
+% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR
+% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \LR
+% \HL
+% \stoptable
+% \vskip2cm
+% \starttable[ | l w(2cm) | p(8cm) | ]
+% \HL
+% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \FR
+% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \LR
+% \HL
+% \stoptable
+
%D To give an impression of what the (well documented) source
%D of \TABLE\ looks like, we first implement an alternative for
%D the numeric keys. The quantity keys (\type{q} and \type{Q})
@@ -987,7 +1030,7 @@
%D The third stage involves a lot of (re)sets, which we will
%D explain later.
-\let \everytable \EveryTable % convenient and more in tune
+\let \everytable \EveryTable % convenient and more in tune
\def\thirdstagestartTABLE#1%
{\global\setTABLEactiontrue
@@ -1011,6 +1054,7 @@
\defineTABLEshorthands
\defineTABLEbackgrounds
\defineTABLEendings
+ \forgetall % added
\doifsomething{#1}
{\def\TABLEformat{#1}%
\expandafter\getTABLEnofcolumns\expandafter{\TABLEformat}%
@@ -1238,7 +1282,8 @@
%D as efficient as possible.
\def\complexorsimpleTable#1#2%
- {\getvalue{\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1}#2}
+% {\getvalue{\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1}#2}
+ {\csname\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1\endcsname#2}
%D The next one is used in \type{\VL} cum suis and honours
%D the next grouping.
@@ -2030,7 +2075,7 @@
{\doanalyzeTABLEcr[#1,,]}
\def\doanalyzeTABLEcr[#1,#2,#3]%
- {\doifnumberelse{#1x} % Is the x still needed here?
+ {\doifnumberelse{#1x} % Is the x still needed here?
{\dodoanalyzeTABLEcr[#1,#2,#3]}
{\dodoanalyzeTABLEcr[1,#1,#2]}}
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index a2b458d94..2baf2bcda 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -13,8 +13,12 @@
\writestatus{loading}{Context Core Macros / Tabulation}
+% \processbetween gebruiken in head/tail macros
+
\unprotect
+% watch out, cells expand pretty late on a per row basis
+
% |p2|p3| 2:3
% spanning
@@ -116,9 +120,6 @@
% \NC 500 \NC \NC 20 \NC \NC 100 \NC \NR
% \stoptabulate
-
-
-
\newtoks \tabulatepreamble
\newtoks \tabulatebefore
\newtoks \tabulateafter
@@ -128,8 +129,9 @@
\newtoks \tabulatesettings
\newtoks \tabulatedummy
-\newcounter \nofautotabulate
-\newcounter \tabulatecolumns
+\newcount \nofautotabulate % \newcounter \nofautotabulate
+\newcount \tabulatecolumns % \newcounter \tabulatecolumns
+
\newcounter \tabulateminplines
\newcounter \tabulatemaxplines
@@ -213,11 +215,11 @@
% 1 = RC column raw RQ equal column raw
% 2 = HC column hook HQ equal column hook
\@EA\appendtoks \@EA&\@EA\hskip\pretabskip##&\to\!!toksa
- \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa
-\appendtoks \checktabulatehook\to\!!toksa
+ %\@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa
+ \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa
+ \appendtoks \checktabulatehook\to\!!toksa
\@EA\appendtoks \preamblebox\to\!!toksa
\appendtoks \bgroup\bbskip\bgroup#1\to\!!toksa
-% \appendtoks \checktabulatehook\to\!!toksa
\appendtoks\ifnum\tabulatetype=1 \else \to\!!toksa
\@EA\appendtoks \the\tabulatebmath\to\!!toksa
\@EA\appendtoks \the\tabulatefont\to\!!toksa
@@ -228,7 +230,8 @@
%
\appendtoks \tabulatehook##\to\!!toksa
%
- %\doifdefinedelse{\@@tabalign@@\tabulatecolumns}
+ %%\doifdefinedelse{\@@tabalign@@\tabulatecolumns}
+ %\doifdefinedelse{\@@tabalign@@\the\tabulatecolumns}
% {\appendtoks\handletabulatecharalign## \to\!!toksa}
% {\appendtoks\tabulatehook ##\to \!!toksa}%
% waarom kan ik hier geen \xx{##} geven, om een of
@@ -246,7 +249,7 @@
\def\pretabskip{.5\tabulateunit}%
\let\postabskip\pretabskip
\let\gettabulateexit\dogettabulateexit
- \tabulatewidth\!!zeropoint}
+ \tabulatewidth\zeropoint}
\def\dosettabulatepreamble%
{\ifx\next\relax
@@ -293,34 +296,36 @@
\def\gettabulatepreskip#1%
{\doifnumberelse{#1}
- {\scratchdimen=#1\tabulateunit\let\next\empty}
- {\scratchdimen=.5\tabulateunit\def\next{#1}}%
+ {\scratchdimen#1\tabulateunit\let\next\empty}
+ {\scratchdimen.5\tabulateunit\def\next{#1}}%
\edef\pretabskip{\the\scratchdimen}%
\@EA\settabulatepreamble\next}
\def\gettabulateposskip#1%
{\doifnumberelse{#1}
- {\scratchdimen=#1\tabulateunit\let\next\empty}
- {\scratchdimen=.5\tabulateunit\def\next{#1}}%
+ {\scratchdimen#1\tabulateunit\let\next\empty}
+ {\scratchdimen.5\tabulateunit\def\next{#1}}%
\edef\postabskip{\the\scratchdimen}%
\let\gettabulateexit\settabulatepreamble
\@EA\settabulatepreamble\next}
\def\gettabulatepreposskip#1%
{\doifnumberelse{#1}
- {\scratchdimen=#1\tabulateunit\let\next\empty}
- {\scratchdimen=.5\tabulateunit\def\next{#1}}%
+ {\scratchdimen#1\tabulateunit\let\next\empty}
+ {\scratchdimen.5\tabulateunit\def\next{#1}}%
\edef\pretabskip{\the\scratchdimen}%
\let\postabskip\pretabskip
\let\gettabulateexit\settabulatepreamble
\@EA\settabulatepreamble\next}
\def\gettabulatehook#1%
- {\setvalue{\@@tabhook@@\tabulatecolumns}{#1}%
+ %{\setvalue{\@@tabhook@@\tabulatecolumns}{#1}%
+ {\setvalue{\@@tabhook@@\the\tabulatecolumns}{#1}%
\settabulatepreamble}
\def\gettabulatealign#1%
- {\setvalue{\@@tabalign@@\tabulatecolumns}{#1}%
+ %{\setvalue{\@@tabalign@@\tabulatecolumns}{#1}%
+ {\setvalue{\@@tabalign@@\the\tabulatecolumns}{#1}%
\settabulatepreamble}
\def\gettabulatebefore#1%
@@ -335,32 +340,22 @@
{\tabulatefont{#1}%
\settabulatepreamble}
-\def\gettabulatewidth% why was this split = 0
- {\chardef\tabulatemodus=0
- \doifnextcharelse{(}
- {\chardef\tabulatedimen=0
- \dogettabulatewidth}
- {\chardef\tabulatedimen=0
- \settabulatepreamble}}
-
-%D So:
-
\def\gettabulatewidth%
- {\chardef\tabulatemodus=0
- \chardef\tabulatedimen=0
+ {\chardef\tabulatemodus0
+ \chardef\tabulatedimen0
\doifnextcharelse(\dogettabulatewidth\settabulatepreamble}
\def\gettabulateparagraph%
{\doifnextcharelse{(}
- {\chardef\tabulatemodus=1
- \chardef\tabulatedimen=1
+ {\chardef\tabulatemodus1
+ \chardef\tabulatedimen1
\dogettabulatewidth}
- {\chardef\tabulatemodus=2
- \chardef\tabulatedimen=0
+ {\chardef\tabulatemodus2
+ \chardef\tabulatedimen0
\settabulatepreamble}}
\def\dogettabulatewidth(#1)%
- {\tabulatewidth=#1\relax
+ {\tabulatewidth#1\relax
\ifnum\tabulatedimen=1
\global\advance\tabulatepwidth\tabulatewidth
\fi
@@ -376,16 +371,17 @@
\def\tabulatehss {\ifnum\tabulatetype=1 \else\hss \fi}
\def\nexttabulate#1|%
- {\chardef\tabulatealign=\@@tabulatealign
- \chardef\tabulatemodus=0
- \chardef\tabulatedimen=0
+ {\chardef\tabulatealign\@@tabulatealign
+ \chardef\tabulatemodus0
+ \chardef\tabulatedimen0
\tabulatebefore \emptytoks
\tabulateafter \emptytoks
\tabulatebmath \emptytoks
\tabulateemath \emptytoks
\tabulatefont \emptytoks
\tabulatesettings\emptytoks
- \doglobal\increment\tabulatecolumns
+ %\doglobal\increment\tabulatecolumns
+ \global\advance\tabulatecolumns\plusone
\settabulatepreamble#1\relax\relax % permits i without n
\ifcase\tabulatemodus\relax
\ifcase\tabulatealign\relax
@@ -400,7 +396,8 @@
\dodosettabulatepreamble{\bskip\tabulateraggedleft }\eskip \or
\dodosettabulatepreamble{\bskip\tabulateraggedcenter}\eskip \fi
\or % auto width
- \doglobal\increment\nofautotabulate\relax
+ %\doglobal\increment\nofautotabulate\relax
+ \global\advance\nofautotabulate\plusone\relax
\ifcase\tabulatealign\relax
\dodosettabulatepreamble \bskip \eskip \or
\dodosettabulatepreamble{\bskip\tabulateraggedright }\eskip \or
@@ -416,14 +413,16 @@
\def\splitofftabulatebox%
{\dontcomplain
- \@EA\global\@EA\setbox\@EA\tabulatebox\@EA
+% \global\@EA\setbox\@EA\tabulatebox\@EA
+% \vsplit\csname\@@tabbox@@\tabulatecolumn\endcsname to \lineheight
+ \global\setbox\tabulatebox
\vsplit\csname\@@tabbox@@\tabulatecolumn\endcsname to \lineheight
\setbox\tabulatebox=\vbox
{\unvbox\tabulatebox}%
\setbox\tabulatebox=\hbox to \wd\tabulatebox
{\hss\dotabulatehook{\box\tabulatebox}\hss}%
- \ht\tabulatebox=\ht\strutbox
- \dp\tabulatebox=\dp\strutbox
+ \ht\tabulatebox\ht\strutbox
+ \dp\tabulatebox\dp\strutbox
\box\tabulatebox}
\def\dotabulatehook%
@@ -436,12 +435,12 @@
{\xdef\tabulateminplines{1}%
\getnoflines\tabulatemaxpheight
\xdef\tabulatemaxplines{\the\noflines}%
- \global\tabulatemaxpheight=\!!zeropoint}
+ \global\tabulatemaxpheight\zeropoint}
\def\settabulatepheight%
- {\scratchdimen=\ht\csname\@@tabbox@@\tabulatecolumn\endcsname\relax
+ {\scratchdimen\ht\csname\@@tabbox@@\tabulatecolumn\endcsname\relax
\ifdim\scratchdimen>\tabulatemaxpheight
- \global\tabulatemaxpheight=\scratchdimen
+ \global\tabulatemaxpheight\scratchdimen
\fi}
\def\handletabulatepbreak%
@@ -503,12 +502,66 @@
\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]%
\setvalue{\e!start#1::#2}{\dofinalstarttabulate[#1][#2][#3]}%
\setvalue{\e!start#1}{\bgroup\dosubstarttabulate[#1]}%
+ \letvalue{\??tt#1\v!hoofd}\empty
+ \letvalue{\??tt#1\v!voet }\empty
\else\ifsecondargument
\definetabulate[#1][][#2]%
\else
\definetabulate[#1][][|l|p|]%
\fi\fi}
+\let\tabulateheadcontent\empty
+\let\tabulatetailcontent\empty
+
+% \def\checkfulltabulatecontent
+% {\doifdefinedelse{\??tt\currenttabulate\v!hoofd}
+% {\@EA\let\@EA\tabulateheadcontent\csname\??tt\currenttabulate\v!hoofd\endcsname}
+% {\let\tabulateheadcontent\empty}%
+% \doifdefinedelse{\??tt\currenttabulate\v!voet}
+% {\@EA\let\@EA\tabulatetailcontent\csname\??tt\currenttabulate\v!voet\endcsname}
+% {\let\tabulatetailcontent\empty}}
+
+\def\checkfulltabulatecontent
+ {\doifdefinedelse{\??tt\currenttabulate\v!hoofd}
+ {\@EA\let\@EA\tabulateheadcontent
+ \csname\??tt\currenttabulate\v!hoofd\endcsname}
+ {\let\tabulateheadcontent\empty}%
+ \doifdefinedelse{\??tt\currenttabulate\v!voet}
+ {\@EA\let\@EA\tabulatetailcontent
+ \csname\??tt\currenttabulate\v!voet\endcsname}
+ {\let\tabulatetailcontent\empty}}
+
+\newconditional\tabulatesomeamble
+
+% \def\fulltabulatecontent
+% {\tabulatecontent}
+
+\def\fulltabulatecontent
+ {\ifx\tabulateheadcontent\empty\else
+ \TABLEnoalign{\global\settrue\tabulatesomeamble}%
+ \tabulateheadcontent
+ \TABLEnoalign{\global\setfalse\tabulatesomeamble}%
+ \fi
+ \tabulatecontent
+ \ifx\tabulatetailcontent\empty\else
+ \TABLEnoalign{\global\settrue\tabulatesomeamble}%
+ \tabulatetailcontent
+ \fi}
+
+\setvalue{\e!start\e!tabulatehead}%
+ {\dosingleempty\dostartstarttabulatehead}
+
+\def\dostartstarttabulatehead[#1]%
+ {\processcontent{\e!stop\e!tabulatehead}\next
+ {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!hoofd}\next}}
+
+\setvalue{\e!start\e!tabulatetail}%
+ {\dosingleempty\dostartstarttabulatetail}
+
+\def\dostartstarttabulatetail[#1]%
+ {\processcontent{\e!stop\e!tabulatetail}\next
+ {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!voet}\next}}
+
\def\dosubstarttabulate%
{\dodoubleempty\dodosubstarttabulate}
@@ -587,10 +640,10 @@
{\getvalue{\??tt\currenttabulate EQ}\global\tabulateequalfalse}
\def\tabulatenormalcolumn#1%
- {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype=#1&}
+ {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&}
\def\tabulateequalcolumn#1%
- {&\tabulateEQ&\global\chardef\tabulatetype=#1&}
+ {&\tabulateEQ&\global\chardef\tabulatetype#1&}
\def\tabulateautocolumn%
{\tabulatenormalcolumn0\relax
@@ -601,8 +654,8 @@
\fi}
\def\setquicktabulate#1% see \startlegend \startgiven
- {\let#1=\tabulateautocolumn
- \let\\=\tabulateautocolumn}
+ {\let#1\tabulateautocolumn
+ \let\\\tabulateautocolumn}
%\def\tabulateruleseperator
% {\vskip\dp\strutbox}
@@ -610,7 +663,7 @@
\def\tabulateruleseperator%
{\bgroup
\def\factor{1}%
- \scratchskip=\dp\strutbox
+ \scratchskip\dp\strutbox
\ExpandFirstAfter\processallactionsinset
[\getvalue{\??tt\currenttabulate\c!afstand}]
[ \v!blanko=>\scratchskip=\bigskipamount,
@@ -618,10 +671,10 @@
\v!klein=>\def\factor{.25},
\v!middel=>\def\factor{.5},
\v!groot=>,
- \v!geen=>\scratchskip=\!!zeropoint\def\factor{0},
+ \v!geen=>\scratchskip=\zeropoint\def\factor{0},
\s!unknown=>\scratchskip=\commalistelement]%
\scratchdimen=\factor\scratchskip
- \vskip\scratchdimen\relax
+ \ifconditional\tabulatesomeamble\kern\else\vskip\fi\scratchdimen % new
\egroup}
\def\tabulaterule%
@@ -639,21 +692,25 @@
\def\processtabulate[|#1|]% in the process of optimizing
{\tabulateunit=\getvalue{\??tt\currenttabulate\c!eenheid}%
- \ExpandFirstAfter\processaction
+ \checkfulltabulatecontent
+ \ExpandFirstAfter\processaction % use \setalignmentswitch instead
[\getvalue{\??tt\currenttabulate\c!uitlijnen}]
- [ \v!rechts=>\def\@@tabulatealign{1},
+ [\v!normaal=>\def\@@tabulatealign{0}, % = default value
+ \v!rechts=>\def\@@tabulatealign{1},
\v!links=>\def\@@tabulatealign{2},
\v!midden=>\def\@@tabulatealign{3},
\s!default=>\def\@@tabulatealign{0},
\s!unknown=>\def\@@tabulatealign{0}]%
\let\pretabskip\!!zeropoint
\def\postabskip{.5\tabulateunit}%
- \doglobal\newcounter\tabulatecolumns
- \doglobal\newcounter\nofautotabulate
+ %\doglobal\newcounter\tabulatecolumns
+ %\doglobal\newcounter\nofautotabulate
+ \global\tabulatecolumns\zerocount
+ \global\nofautotabulate\zerocount
\doglobal\newcounter\noftabulatelines
\let\totalnoftabulatelines\noftabulatelines
\let\minusnoftabulatelines\noftabulatelines
- \global\tabulatepwidth=\!!zeropoint
+ \global\tabulatepwidth\zeropoint
\global\tabulateequalfalse
\resettabulatepheight
\def\NC{\tabulatenormalcolumn0}%
@@ -685,12 +742,12 @@
\let\LL\empty \let\LR\NR
\global\let\flushtabulated\empty
\let\savedbar=|\let|=\nexttabulate
- \tabskip\!!zeropoint
+ \tabskip\zeropoint
\!!toksa{&\hbox to \tabulateindent{}##\strut&##}%
- \tabulatewidth\!!zeropoint
+ \tabulatewidth\zeropoint
|#1X|\relax
- \tabulatewidth\!!zeropoint
- \dorecurse\tabulatecolumns
+ \tabulatewidth\zeropoint
+ \dorecurse\tabulatecolumns % can be made faster
{\doifundefinedelse{\@@tabbox@@\recurselevel}
{\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}%
{\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}%
@@ -720,13 +777,13 @@
{\footnotesenabledfalse
\let\tabulateindent\!!zeropoint
\trialtypesettingtrue % very important
- \@EA\halign\@EA{\the\!!toksa\cr\tabulatecontent\crcr}}%
+ \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}}%
\ifnum\nofautotabulate>0
\tabulatewidth\hsize
- \advance\tabulatewidth by -\wd0
- \advance\tabulatewidth by -\tabulatepwidth
+ \advance\tabulatewidth -\wd0
+ \advance\tabulatewidth -\tabulatepwidth
\ifnum\nofautotabulate>0
- \divide\tabulatewidth by \nofautotabulate\relax
+ \divide\tabulatewidth \nofautotabulate\relax
\fi
\fi
\ifsplittabulate
@@ -761,7 +818,7 @@
{\TABLEnoalign % noalign % no interference !
{\global\let\flushtabulatedindeed\empty
\handletabulatepbreak
- \dorecurse\noftabcolumns
+ \dorecurse\tabulatecolumns % was: \noftabcolumns
{\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else
\gdef\flushtabulatedindeed{\the\tabulatedummy}%
\fi}}%
@@ -805,7 +862,8 @@
{\tabulateruleseperator
\tabulaterule
\ifnum\noftabulatelines>1 \ifnum\noftabulatelines<\minusnoftabulatelines
- \vskip\topskip\allowbreak\vskip-\topskip\vskip-.4pt
+ \vskip\topskip\allowbreak\vskip-\topskip
+ \vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}%
\tabulaterule
\fi\fi
\tabulateruleseperator}}%
@@ -821,7 +879,7 @@
\vskip-\lineheight}%
\fi}}%
\chardef\tabulatepass=2
- \@EA\halign\@EA{\the\!!toksa\cr\tabulatecontent\crcr}%
+ \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}%
\prevdepth\dp\strutbox % nog eens beter, temporary hack
\egroup
\ifinsidefloat \else
@@ -853,6 +911,4 @@
\c!uitlijnen=\v!normaal,
\c!inspringen=\v!nee]
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex
index f5d5fc778..c9d2e3269 100644
--- a/tex/context/base/core-uti.tex
+++ b/tex/context/base/core-uti.tex
@@ -15,7 +15,8 @@
\unprotect
-% to do : lan ook safen
+% todo : safe lan etc too
+% todo : load all commands at once (tok)
% Utility-file
%
@@ -61,10 +62,10 @@
{\immediate\write\uti}
\def\writeutilitycommand#1%
- {\writeutility{c \string#1}}
+ {\write\uti{c \string#1}}
\def\immediatewriteutilitycommand#1%
- {\immediatewriteutility{c \string#1}}
+ {\immediate\write\uti{c \string#1}}
\def\openutilities%
{\immediate\openout\uti=\jobname.\f!inputextension
@@ -185,17 +186,17 @@
\long\def\doutilities#1#2#3#4#5% % introduceren in utility file
{\restorecatcodes
\resetutilities
- \def\docommando##1% % zo kunnen meerdere dingen
- {\getvalue{\s!set##1}}% % in een pass worden gedaan,
- \processcommacommand[#1]\docommando % zie bijvoorbeeld lijsten
+ \def\docommando##1% % more than one utility thing
+ {\csname\s!set##1\endcsname}% % can be handled in one pass,
+ \processcommacommand[#1]\docommando % for instance lists
\begingroup
\def\currentutilityfilename{#2}%
\footnotesenabledfalse
\doinpututilitiestrue
\global\utilitydonefalse
-\catcode`\\=\@@escape
-\catcode`\{=\@@begingroup
-\catcode`\}=\@@endgroup
+ \catcode`\\=\@@escape
+ \catcode`\{=\@@begingroup
+ \catcode`\}=\@@endgroup
\catcode`\%=\@@comment\relax
\pushendofline % geeft problemen zodra andere file wordt ingelezen
\ifunprotectutilities % nog nodig ?
@@ -207,14 +208,18 @@
\ifnum\catcode`\!=\@@active \else
\catcode`\!=\@@letter % permits multilingual constants
\fi
- #4\readjobfile{#2.\f!outputextension}{}{}#5%
+ #4%
+ \the\everybeforeutilityread
+ \readjobfile{#2.\f!outputextension}{}{}%
+ \the\everyafterutilityread
+ #5%
\relax
\ifunprotectutilities
\protect
\fi
\popendofline
\ifutilitydone\else
- \doifnot{#3}{}
+ \doifsomething{#3}
{\showmessage{\m!systems}{9}{{#3}}%
\ifvoorlopig
\blanko
@@ -269,24 +274,45 @@
\def\twopassentry#1%
{\executeifdefined{@@#1\s!pass}\gobbletwoarguments}
-\def\appendtwopasselement#1#2#3%
+%\def\appendtwopasselement#1#2#3%
+% {%\debuggerinfo{\m!systems}{twopass data #1 - #2 = #3}%
+% \@EA\ifx\csname#1:\s!list\endcsname\empty
+% \setxvalue{#1:\s!list}{#3}%
+% \else
+% \setxvalue{#1:\s!list}{\getvalue{#1:\s!list},#3}%
+% \fi}
+
+\def\appendtwopasselement#1#2#3% can sometimes become a large list
{%\debuggerinfo{\m!systems}{twopass data #1 - #2 = #3}%
- \@EA\ifx\csname#1:\s!list\endcsname\empty
- \setxvalue{#1:\s!list}{#3}%
- \else
- \setxvalue{#1:\s!list}{\getvalue{#1:\s!list},#3}%
- \fi}
+ \expandafter\xdef\csname#1:\s!list\endcsname
+ {\@EA\ifx\csname#1:\s!list\endcsname\empty \else
+ \csname#1:\s!list\endcsname,\fi#3}}
+
+%\def\dodefinetwopasslist#1%
+% {\doifundefined{#1:\s!list}
+% {%\debuggerinfo{\m!systems}{defining twopass class #1}%
+% \doglobal\addutilityreset{#1\s!pass}%
+% \setgvalue{\s!set#1\s!pass}%
+% {\global\letvalue{\s!set#1\s!pass}\gobbletwoarguments
+% \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}}%
+% \setgvalue{\s!reset#1\s!pass}%
+% {\global\letvalue{@@#1\s!pass}\gobbletwoarguments}%
+% \getvalue{\s!reset#1\s!pass}}}
\def\dodefinetwopasslist#1%
{\doifundefined{#1:\s!list}
{%\debuggerinfo{\m!systems}{defining twopass class #1}%
\doglobal\addutilityreset{#1\s!pass}%
- \setgvalue{\s!set#1\s!pass}%
- {\global\letvalue{\s!set#1\s!pass}\gobbletwoarguments
- \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}}%
- \setgvalue{\s!reset#1\s!pass}%
- {\global\letvalue{@@#1\s!pass}\gobbletwoarguments}%
- \getvalue{\s!reset#1\s!pass}}}
+ \setgvalue{\s!set #1\s!pass}{\dosettwopasslist {#1}}%
+ \setgvalue{\s!reset#1\s!pass}{\doresettwopasslist{#1}}%
+ \getvalue {\s!reset#1\s!pass}}}
+
+\def\dosettwopasslist#1%
+ {\global\letvalue{\s!set#1\s!pass}\gobbletwoarguments
+ \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}}
+
+\def\doresettwopasslist#1%
+ {\global\letvalue{@@#1\s!pass}\gobbletwoarguments}
\def\definetwopasslist#1%
{\expanded{\dodefinetwopasslist{#1}}%
@@ -323,26 +349,39 @@
\let\twopassdata=\empty
+%\def\dogettwopassdata[#1,#2]#3%
+% {\doifelse{#1}{0} % \ifcase truukje gaat fout
+% {\twopassdatafoundfalse
+% \let\twopassdata\empty}
+% {\twopassdatafoundtrue
+% \setxvalue{#3:\s!list}{#2}%
+% \edef\twopassdata{#1}}}
+
+\def\notwopassdata{0}
+
\def\dogettwopassdata[#1,#2]#3%
- {\doifelse{#1}{0} % \ifcase truukje gaat fout
- {\twopassdatafoundfalse
- \let\twopassdata\empty}
- {\twopassdatafoundtrue
- \setxvalue{#3:\s!list}{#2}%
- \edef\twopassdata{#1}}}
+ {\edef\twopassdata{#1}%
+ \ifx\twopassdata\notwopassdata
+ \twopassdatafoundfalse
+ \let\twopassdata\empty
+ \else
+ \twopassdatafoundtrue
+ \setxvalue{#3:\s!list}{#2}%
+ \fi}
\def\gettwopassdata#1%
{\loadtwopassdata
- \edef\!!stringa{\getvalue{#1:\s!list}}%
+ %\edef\!!stringa{\csname#1:\s!list\endcsname}%
%\debuggerinfo{\m!systems}{twopass get #1 - \!!stringa}%
- \expandafter\dogettwopassdata\expandafter[\!!stringa]{#1}}
+ %\expandafter\dogettwopassdata\expandafter[\!!stringa]{#1}}
+ \expanded{\dogettwopassdata[\csname#1:\s!list\endcsname]}{#1}}
-\def\findtwopassdata%
+\def\findtwopassdata#1#2%
{\loadtwopassdata
- \ExpandBothAfter\dofindtwopassdata}
+ \expanded{\dofindtwopassdata{#1}{#2}}}
\def\dofindtwopassdata#1#2%
- {\edef\!!stringa{,\getvalue{#1:\s!list}}%
+ {\edef\!!stringa{,\csname#1:\s!list\endcsname}%
%\debuggerinfo{\m!systems}{twopass find #2 - \!!stringa}%
\def\dodofindtwopassdata[##1,##2#2##3,##4]%
{\edef\twopassdata{##3}%
@@ -377,7 +416,7 @@
\def\getfromtwopassdata#1#2%
{\loadtwopassdata
- \getfromcommacommand[\getvalue{#1:\s!list}][#2]%
+ \getfromcommacommand[\csname#1:\s!list\endcsname][#2]%
\doifelsenothing{\commalistelement}
{\twopassdatafoundfalse
\let\twopassdata\empty}
diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex
index ab9c3d6b0..270c0c1d9 100644
--- a/tex/context/base/core-var.tex
+++ b/tex/context/base/core-var.tex
@@ -20,16 +20,23 @@
%D
%D A few every's.
-\newevery \everyshipout \relax
-\newevery \everybeforeshipout \relax
-\newevery \everyaftershipout \relax
-\newevery \everylastshipout \relax
-\newevery \everybye \relax
-\newevery \everygoodbye \relax
-\newevery \everystarttext \relax
-\newevery \everystoptext \relax
-\newevery \everypagebody \relax
-\newevery \everyforgetall \relax
+\newevery \everyshipout \relax
+\newevery \everybeforeshipout \relax
+\newevery \everyaftershipout \relax
+\newevery \everylastshipout \relax
+\newevery \everybye \relax
+\newevery \everygoodbye \relax
+\newevery \everystarttext \relax
+\newevery \everystoptext \relax
+\newevery \everyforgetall \relax
+
+\newevery \everybeforepagebody \relax
+\newevery \everyafterpagebody \relax
+
+\let \everypagebody \everybeforepagebody % backward compatible
+
+\newevery \everybeforeutilityread \relax
+\newevery \everyafterutilityread \relax
%D \macros
%D {ifproductionrun}
@@ -42,6 +49,21 @@
\appendtoks \productionruntrue \to \everydump
%D \macros
+%D {everyboxedcontent, ifboxedcontent,
+%D startboxedcontent, stopboxedcontent}
+%D
+%D This one is relatively new and will be used as a more
+%D robust test for inner situations.
+
+\newif \ifboxedcontent
+\newevery \everyboxedcontent \relax
+
+\appendtoks \boxedcontenttrue \to \everyboxedcontent
+
+\def\startboxedcontent{\bgroup\the\everyboxedcontent}
+\let\stopboxedcontent \egroup
+
+%D \macros
%D {fastmode}
%D
%D The command \type {\fastmode} disables some time consuming
@@ -77,6 +99,15 @@
\fi
-\protect
+%D We store some original meanings, maybe in \type
+%D {math-ini}.
+
+\let\normalin \in
+\let\normalover \over
+\let\normalabove \above
+\let\normalatop \atop
+\let\normaloverwithdelims \overwithdelims
+\let\normalabovewithdelims\abovewithdelims
+\let\normalatopwithdelims \atopwithdelims
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex
index 575e237cd..7833370b2 100644
--- a/tex/context/base/core-ver.tex
+++ b/tex/context/base/core-ver.tex
@@ -119,6 +119,8 @@
{\def\setupprettytype{\getvalue{setuppretty\prettyidentifier type}}}
{\let\setupprettytype=\relax}}
+\installprettytype [RAW] [RAW]
+
\installprettytype [TEX] [TEX]
\installprettytype [PERL] [PL]
@@ -220,6 +222,8 @@
%D \type{<<} and \type{>>} as delimiters. This alternative can
%D be used in situations where slanted typeseting is needed.
+% todo: we can use \letter... here:
+
\def\lesscharacter {<}
\def\morecharacter {>}
@@ -236,7 +240,6 @@
%\unexpanded\def\type%
% {\bgroup
-%% \verbatimcolor
% \catcode`\<=\@@other
% \catcode`\>=\@@other
% \futurelet\next\dotype}
@@ -246,6 +249,7 @@
\def\dotype#1%
{\bgroup
+ \strut % new, enables leading space in \type { abc } at par start
\edef\@@currenttype{#1}%
\catcode`\<=\@@other
\catcode`\>=\@@other
@@ -280,33 +284,70 @@
% \fi\fi
% \verbatimcolor
% \next}
+%
+% \def\dodotype%
+% {\ifx\next\bgroup
+% \initializetype
+% \verbatimcolor
+% \initializetypegrouping
+% \def\next%
+% {\afterassignment\protectfirsttype\let\next=}%
+% \else\if\next<%
+% \doifelsevalue{\??ty\@@currenttype\c!optie}{\v!geen}
+% {\initializetype
+% \verbatimcolor
+% \setupnotypegrouping
+% \def\next%
+% {\let\next=}}
+% {\def\next<##1%
+% {\initializetype
+% \verbatimcolor
+% \if##1<%
+% \else
+% \setupalternativetypegrouping
+% ##1%
+% \fi}}%
+% \else
+% \def\next##1%
+% {\initializetype
+% \verbatimcolor
+% \catcode`##1=\@@endgroup}%
+% \fi\fi
+% \next}
+
+\def\dodotypeA
+ {\initializetype
+ \initializetypegrouping
+ \verbatimcolor
+ \afterassignment\protectfirsttype\let\next=}
+
+\def\dodotypeB%
+ {\initializetype
+ \setupnotypegrouping
+ \verbatimcolor
+ \let\next=}
+
+\def\dodotypeC<#1%
+ {\initializetype
+ \verbatimcolor
+ \if#1<\else
+ \setupalternativetypegrouping#1%
+ \fi}
+
+\def\dodotypeD#1%
+ {\initializetype
+ \verbatimcolor
+ \catcode`#1=\@@endgroup}
\def\dodotype%
{\ifx\next\bgroup
- \initializetype
- \initializetypegrouping
- \def\next%
- {\afterassignment\protectfirsttype\let\next=}%
+ \@EA\dodotypeA
\else\if\next<%
\doifelsevalue{\??ty\@@currenttype\c!optie}{\v!geen}
- {\initializetype
- \setupnotypegrouping
- \def\next%
- {\let\next=}}
- {\def\next<##1%
- {\initializetype
- \if##1<%
- \else
- \setupalternativetypegrouping
- ##1%
- \fi}}%
+ {\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}%
\else
- \def\next##1%
- {\initializetype
- \catcode`##1=\@@endgroup}%
- \fi\fi
- \verbatimcolor
- \next}
+ \@EAEAEA\dodotypeD
+ \fi\fi}
\bgroup
\catcode`\[=\@@begingroup
@@ -553,7 +594,7 @@
%D support of \type{\tt} text will be implemented soon.
\def\obeyhyphens%
- {\def\obeyedspace{ }%
+ {\def\obeyedspace{\hskip\spaceskip}%
\edef\savedfont{\the\font}%
\ttsl\hyphenchar\font=45
\tttf\hyphenchar\font=45
@@ -561,7 +602,7 @@
\spaceskip.5em\!!plus.25em\!!minus.25em\relax}
\def\obeybreakpoints%
- {\def\obeyedspace{ }%
+ {\def\obeyedspace{\hskip\spaceskip}%
\spaceskip.5em
\veryraggedright}
@@ -688,7 +729,7 @@
\v!groot=>\scratchskip=\blankogrootmaat,
\v!halveregel=>\scratchskip=.5\baselineskip,
\v!regel=>\scratchskip=\baselineskip,
- \v!geen=>\scratchskip=\!!zeropoint,
+ \v!geen=>\scratchskip=\zeropoint,
\s!unknown=>\scratchskip=\commalistelement]%
\ifgridsnapping
\ifdim\scratchskip=.5\baselineskip\relax
@@ -832,6 +873,7 @@
\definetyping[\v!typen]
+\definetyping[RAW] [\c!optie=RAW]
\definetyping[MP] [\c!optie=MP]
\definetyping[PL] [\c!optie=PL]
\definetyping[PM] [\c!optie=PL]
diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex
index feb4a5afc..c23d1044c 100644
--- a/tex/context/base/core-vis.tex
+++ b/tex/context/base/core-vis.tex
@@ -325,7 +325,7 @@
\normalvfill}%
\normalhbox to \ruledwidth
{\scratchdimen=\cutmarklength
- \divide\scratchdimen by 2
+ \divide\scratchdimen 2
\llap{\copy\scratchbox\normalhskip\cutmarkoffset\scratchdimen}%
\normalhfill
\rlap{\normalhskip\cutmarkoffset\scratchdimen\copy\scratchbox}}}
@@ -416,10 +416,10 @@
\def\colorrangeA#1#2#3#4%
{\vbox
{\scratchdimen=-\colormarklength
- \multiply\scratchdimen by 4
- \advance\scratchdimen by \ruledheight
- \advance\scratchdimen by \ruleddepth
- \divide\scratchdimen by 21
+ \multiply\scratchdimen 4
+ \advance\scratchdimen \ruledheight
+ \advance\scratchdimen \ruleddepth
+ \divide\scratchdimen 21
\def\docommando##1%
{\vbox
{\hsize3em % \scratchdimen
@@ -433,7 +433,7 @@
\hrule
\!!width 3em
\!!height \scratchdimen
- \!!depth \!!zeropoint
+ \!!depth \zeropoint
\localstopcolor
\ifdim\scratchdimen>1ex
\vskip-\scratchdimen
@@ -446,12 +446,12 @@
\offinterlineskip
\processcommalist[1.00,0.95,0.75,0.50,0.25,0.05,0.00]\docommando}}
-\def\colorrangeB%
+\def\colorrangeB
{\hbox
{\scratchdimen=-\colormarklength
- \multiply\scratchdimen by 2
- \advance\scratchdimen by \ruledwidth
- \divide\scratchdimen by 11
+ \multiply\scratchdimen 2
+ \advance\scratchdimen \ruledwidth
+ \divide\scratchdimen 11
\def\docommando ##1 ##2 ##3##4##5##6%
{\definecolor
[\s!dummy]
@@ -463,7 +463,7 @@
\vrule
\!!width \scratchdimen
\!!height \colormarklength
- \!!depth \!!zeropoint
+ \!!depth \zeropoint
\localstopcolor
\ifdim\scratchdimen>2em
\hskip-\scratchdimen
@@ -485,7 +485,7 @@
\docommando B 1 \iftrue \iftrue \iffalse\iffalse
\docommando K 1 \iffalse\iffalse\iffalse\iftrue}}
-\def\colorrangeC%
+\def\colorrangeC
{\hbox
{\scratchdimen=-\colormarklength
\multiply\scratchdimen by 2
@@ -586,8 +586,8 @@
\else
- \let\supernormalmark \normalmark % mark is already superseded
- \let\supernormalmarks \normalmarks % mark is already superseded
+ \let\supernormalmark \normalmark % mark may already superseded
+ \let\supernormalmarks \normalmarks % mark may already superseded
\def\showwhatsits%
{\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }%
@@ -684,7 +684,49 @@
\fi}
\fi
-
-\protect
-\endinput
+%D The next macro can be used to keep track of classes of
+%D boxes (handy for development cq.\ tracing).
+
+\def\dodotagbox#1#2#3%
+ {\def\next##1##2##3##4%
+ {\vbox to \ht#2{##3\hbox to \wd#2{##1#3##2}##4}}%
+ \processaction
+ [#1]
+ [ l=>\next\relax\hfill\vfill\vfill,
+ r=>\next\hfill\relax\vfill\vfill,
+ t=>\next\hfill\hfill\relax\vfill,
+ b=>\next\hfill\hfill\vfill\relax,
+ lt=>\next\relax\hfill\relax\vfill,
+ lb=>\next\relax\hfill\vfill\relax,
+ rt=>\next\hfill\relax\relax\vfill,
+ rb=>\next\hfill\relax\vfill\relax,
+ tl=>\next\relax\hfill\relax\vfill,
+ bl=>\next\relax\hfill\vfill\relax,
+ tr=>\next\hfill\relax\relax\vfill,
+ br=>\next\hfill\relax\vfill\relax,
+ \s!default=>\next\hfill\hfill\vfill\vfill,
+ \s!unknown=>\next\hfill\hfill\vfill\vfill]}
+
+\def\dotagbox[#1]#2%
+ {\bgroup
+ \dowithnextbox
+ {\setbox\scratchbox\box\nextbox
+ \setbox\nextbox\ifhbox\nextbox\hbox\else\vbox\fi
+ \bgroup
+ \startoverlay
+ {\copy\scratchbox}
+ {\dodotagbox{#1}\scratchbox{\framed
+ [\c!achtergrond=\v!raster,\c!achtergrondraster=1]{#2}}}
+ \stopoverlay
+ \egroup
+ \wd\nextbox\the\wd\scratchbox
+ \ht\nextbox\the\ht\scratchbox
+ \dp\nextbox\the\dp\scratchbox
+ \box\nextbox
+ \egroup}}
+
+\def\tagbox
+ {\dosingleempty\dotagbox}
+
+\protect \endinput
diff --git a/tex/context/base/enco-ans.tex b/tex/context/base/enco-ans.tex
index e78b816b4..2e3b55cb5 100644
--- a/tex/context/base/enco-ans.tex
+++ b/tex/context/base/enco-ans.tex
@@ -49,9 +49,9 @@
% texnansx
-\definecasemap 26 26 29 \definecasemap 29 26 29
-\definecasemap 27 27 30 \definecasemap 30 27 30
-\definecasemap 28 28 31 \definecasemap 31 28 31
+%\definecasemap 26 26 29 \definecasemap 29 26 29
+%\definecasemap 27 27 30 \definecasemap 30 27 30
+%\definecasemap 28 28 31 \definecasemap 31 28 31
\stopmapping
@@ -62,7 +62,7 @@
\definecharacter textmacron 175
\definecharacter textcedilla 184
-\definecharacter dotlessi 105
+\definecharacter dotlessi 16 % 105
\definecharacter Lstroke 128
@@ -147,15 +147,15 @@
% texnansx
-\definecharacter aeligature 26
-\definecharacter oeligature 27
-\definecharacter ostroke 28
-
-\definecharacter AEligature 29
-\definecharacter OEligature 30
-\definecharacter Ostroke 31
-
-\definecharacter ssharp 25
+%\definecharacter aeligature 26
+%\definecharacter oeligature 27
+%\definecharacter ostroke 28
+%
+%\definecharacter AEligature 29
+%\definecharacter OEligature 30
+%\definecharacter Ostroke 31
+%
+%\definecharacter ssharp 25
\stopencoding
diff --git a/tex/context/base/enco-com.tex b/tex/context/base/enco-com.tex
index 06c15eb70..42d0d4774 100644
--- a/tex/context/base/enco-com.tex
+++ b/tex/context/base/enco-com.tex
@@ -14,7 +14,6 @@
%D Here we map some \quote {short} names onto the more
%D verbose glyph names.
-
\def\AA{\Aring}
\def\aa{\aring}
\def\AE{\AEligature}
diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex
index 6a0c0789a..cf132bd40 100644
--- a/tex/context/base/enco-def.tex
+++ b/tex/context/base/enco-def.tex
@@ -284,6 +284,18 @@
\stopencoding
+%D And:
+
+\startencoding[default]
+
+\definecharacter leftguillemot {\leftfakeguillemot }
+\definecharacter rightguillemot {\rightfakeguillemot}
+
+\definecharacter leftsubguillemot {\leftsubfakeguillemot }
+\definecharacter rightsubguillemot {\rightsubfakeguillemot}
+
+\stopencoding
+
%D We also use symbolic names for math accents.
\startencoding[default]
diff --git a/tex/context/base/enco-fde.tex b/tex/context/base/enco-fde.tex
index 6678a2125..6de30ac1b 100644
--- a/tex/context/base/enco-fde.tex
+++ b/tex/context/base/enco-fde.tex
@@ -17,6 +17,8 @@
\startlanguagespecifics[\s!de]
+ \appendtoks \makecharacteractive " \to \everynormalcatcodes
+
\installcompoundcharacter "a {\aumlaut\midworddiscretionary}
\installcompoundcharacter "e {\eumlaut\midworddiscretionary}
\installcompoundcharacter "i {\iumlaut\midworddiscretionary}
diff --git a/tex/context/base/enco-fpl.tex b/tex/context/base/enco-fpl.tex
index acf3caa50..0ae286873 100644
--- a/tex/context/base/enco-fpl.tex
+++ b/tex/context/base/enco-fpl.tex
@@ -17,6 +17,8 @@
\startlanguagespecifics[\s!pl]
+ \appendtoks \makecharacteractive / \to \everynormalcatcodes
+
\installcompoundcharacter /a {\k a}
\installcompoundcharacter /c {\'c}
\installcompoundcharacter /e {\k e}
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index 44029c7f0..8f5fe8ab4 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -162,7 +162,7 @@
{\localpushmacro\characterregime
\edef\characterregime{@#1@}%
\doifundefined{\@reg@\characterregime}
- {\expanded{\newtoks\csname\@reg@\characterregime\endcsname}}}
+ {\@EA\newtoks\csname\@reg@\characterregime\endcsname}}
\def\stopregime%
{\localpopmacro\characterregime}
@@ -201,12 +201,19 @@
%D This command is typically used in coding definitions,
%D like the \UNICODE\ one.
+%\def\dodefineactivedecimal#1#2% \unexpanded ? pdfdoc encoding
+% {\catcode#1=\active % maybe \protectregimetrue
+% \scratchcounter=\the\uccode`~
+% \uccode`~=#1\relax
+% \uppercase{\unexpanded\edef~{\noexpand#2{\number#1}}}%
+% \uccode`~=\scratchcounter}
+
\def\dodefineactivedecimal#1#2% \unexpanded ? pdfdoc encoding
- {\catcode#1=\active % maybe \protectregimetrue
- \scratchcounter=\the\uccode`~
- \uccode`~=#1\relax
+ {\catcode#1\active
+ \scratchcounter\uccode\activehackcode
+ \uccode\activehackcode#1\relax
\uppercase{\unexpanded\edef~{\noexpand#2{\number#1}}}%
- \uccode`~=\scratchcounter}
+ \uccode\activehackcode\scratchcounter}
\long\def\defineactivedecimal#1 #2 %
{\setregimetoks
@@ -340,8 +347,8 @@
\def\definecasemaps #1 to #2 lc #3 uc #4 % from to lc+ uc+
{\dostepwiserecurse{#1}{#2}{1}
- {\!!counta=\recurselevel\advance\!!counta by #3\relax
- \!!countb=\recurselevel\advance\!!countb by #4\relax
+ {\!!counta\recurselevel\advance\!!counta #3\relax
+ \!!countb\recurselevel\advance\!!countb #4\relax
\expanded{\definecasemap
\recurselevel\space\the\!!counta\space\the\!!countb\space}}%
\ignorespaces}
@@ -374,8 +381,8 @@
\def\setspacemap #1 #2 %
{\setregimecode{#1}\@@other
- \lccode #1=0
- \uccode #1=0
+ \lccode #1=\zerocount
+ \uccode #1=\zerocount
\sfcode #1=#2 }
\def\defineuppercasecom#1#2%
@@ -402,10 +409,22 @@
{\the\csname\@map@\charactermapping\endcsname}%
\edef\enabledmapping{\charactermapping}%
\enablelanguagespecifics[\currentlanguage]% new
-% \edef\enabledmapping{\charactermapping\currentlanguage}%
+ % \edef\enabledmapping{\charactermapping\currentlanguage}% can be comma list
\fi
\synchronizepatterns}
+% on behalf of font switching:
+
+\def\fastenablemapping#1%
+ {\edef\charactermapping{@#1@}%
+ \ifx\enabledmapping\charactermapping \else
+ \@EA\ifx\csname\@map@\charactermapping\endcsname\relax\else
+ \the\csname\@map@\charactermapping\endcsname
+ \fi
+ \let\enabledmapping\charactermapping
+ \enablelanguagespecifics[\currentlanguage]% to faster
+ \fi}
+
%D This macro wil be implemented in \type {lang-ini.tex}.
\ifx\enablelanguagespecifics\undefined
@@ -518,21 +537,23 @@
%D \type {\reduceto}||command for local switching to
%D simplified commands.
+% etex : \ifcsname
+
\def\donthandleaccent#1#2% \empty makes #2={} save % no \unexpanded
{\ifundefined{\characterencoding#1\string#2\empty}%
#2%
\else
- \getvalue{\characterencoding#1\string#2\empty}%
+ \csname\characterencoding#1\string#2\empty\endcsname
\fi}
\def\donthandlecommand#1% % no \unexpanded, otherwise pdfdoc will fail
{\ifundefined{\characterencoding#1}% as well as hyph patterns
#1%
\else
- \getvalue{\characterencoding#1}%
+ \csname\characterencoding#1\endcsname
\fi}
-\def\enablecoding%
+\def\enableencoding%
{\dodoubleempty\doenableencoding}
\def\doenableencoding[#1][#2]% main fallback
@@ -540,12 +561,24 @@
\edef\nocharacterencoding{@\ifsecondargument#2\else\s!default\fi @}%
\synchronizepatterns}
-\def\startcoding%
- {\dodoubleempty\dostartcoding}
+%\def\enablesimpleencoding#1% e.g. \enableencoding{raw}
+% {\edef\characterencoding{@#1@}% handy for XML key=val's
+% \edef\nocharacterencoding{@\s!default @}} % evt noppes
-\def\dostartcoding[#1][#2]% encoding regime
+% in font switch and xml simple k/v remapping
+
+\edef\xnocharacterencoding{@\s!default @}
+
+\def\fastenableencoding#1%
+ {\edef\characterencoding{@#1@}%
+ \let\nocharacterencoding\xnocharacterencoding}
+
+\def\startencoding%
+ {\dodoubleempty\dostartencoding}
+
+\def\dostartencoding[#1][#2]% encoding regime
{\doifelsenothing{#1}
- {\let\stopcoding\relax}
+ {\let\stopencoding\relax}
{%\protectfontcharacters % problematic in language loading
\showmessage{\m!encodings}{1}{#1}%
\pushmacro\dohandleaccent
@@ -560,14 +593,14 @@
{% message
\let\doautosetregime\gobbletwoarguments}
{\def\currentcharacterregime{@#2@}}%
- \enablecoding[#1]%
- \def\stopcoding%
+ \enableencoding[#1]%
+ \def\stopencoding%
{\popmacro\dosetautoregime
\popmacro\currentcharacterregime
\popmacro\definesortkey
\popmacro\dohandlecommand
\popmacro\dohandleaccent
- \enablecoding[\s!default]%
+ \enableencoding[\s!default]%
}}}% \unprotectfontcharacters}}} % ??
% probably obsolete
@@ -576,12 +609,12 @@
{\doifsomething{#1}
{\let\dohandleaccent\donthandleaccent
\let\dohandlecommand\donthandlecommand
- \enablecoding[#1]%
+ \enableencoding[#1]%
\enablelanguagespecifics[\currentlanguage]}}
-\def\startencoding {\startcoding}
-\def\stopencoding {\stopcoding}
-\def\enableencoding{\enablecoding}
+\let\startcoding \startencoding
+\def\stopcoding {\stopencoding }
+\let\enablecoding \enableencoding
%D The use of these macros are not limited to font
%D definition files, but may also be used when loading
@@ -908,7 +941,9 @@
%D
%D The \type{\next} construction permits handling of commands
%D that take arguments. This means that we can use this
-%D command to redefine accent handling commands too.
+%D command to redefine accent handling commands too
+%D (although today the next is not needed any longer in test
+%D macros).
\def\redefinecommand#1 %
{% no \unexpanded, else pdfdoc fails
@@ -1074,22 +1109,26 @@
%D \type{\lccode} and applying \type{\lowcase}. An example of
%D this can be found in \type{spec-mis}.
+\ifx\obeylccodes\undefined
+
\def\obeylccodes%
{\scratchcounter32
\loop
\ifnum\scratchcounter<127
\lccode\scratchcounter\scratchcounter
- \advance\scratchcounter 1
+ \advance\scratchcounter \plusone
\repeat
\ifeightbitcharacters
\scratchcounter128
\loop
\ifnum\scratchcounter<255
\lccode\scratchcounter`.
- \advance\scratchcounter 1
+ \advance\scratchcounter \plusone
\repeat
\fi}
+\fi
+
% %D \macros
% %D {cc,CC}
% %D
@@ -1280,11 +1319,11 @@
{\leavevmode
\vtop
{\forgetall
- \baselineskip\!!zeropoint
+ \baselineskip\zeropoint
\lineskip#1%
\everycr\emptytoks
- \tabskip\!!zeropoint
- \lineskiplimit\!!zeropoint
+ \tabskip\zeropoint
+ \lineskiplimit\zeropoint
\setbox0=\hbox{#4}%
\halign
{##\crcr#5\crcr
@@ -1361,6 +1400,17 @@
% \useencodingvector ec
% \stopregime
+% new, to be documented
+
+\def\dontexpandencoding%
+ {\let\dohandleaccent \donthandleaccent
+ \let\dohandlecommand \donthandlecommand
+ \let\dohandlecharacter\donthandlecharacter}
+
+\def\donthandleaccent #1{\expandafter\string\csname#1\endcsname\space}
+\def\donthandlecommand #1{\expandafter\string\csname#1\endcsname\space}
+\def\donthandlecharacter#1{\expandafter\string\csname#1\endcsname\space}
+
%D We preload several encodings:
\useencoding[def,acc,raw,com,cas,mis]
diff --git a/tex/context/base/enco-pfr.tex b/tex/context/base/enco-pfr.tex
index 16012a281..5b064805c 100644
--- a/tex/context/base/enco-pfr.tex
+++ b/tex/context/base/enco-pfr.tex
@@ -64,13 +64,13 @@
%D \stopopsomming
\def\pdffontresource%
- {\strippedcsname\pdffontresource\currentencoding}
+ {pdfr:\currentencoding}
\def\pdffontfileresource%
- {pdfr:\pdffontresource}
+ {pdff:\pdffontresource}
%D A resource is defined in a file prefixed by \type {pdfr-}.
-%D The following \PDF\ code is compsed by Ondrej Koala Vacha (i
+%D The following \PDF\ code is composed by Ondrej Koala Vacha (I
%D probably mispelled this name).
%D
%D \starttypen
@@ -151,30 +151,67 @@
\fi\fi
\fi}
-\def\doincludepdffontresource%
- {% does this font has an special encoding entry
- \doifdefined{\purefontname\font\s!encoding}
- {% does this encoding entry has a value
- \doifvaluesomething{\purefontname\font\s!encoding}
- {\bgroup
- % quick and dirty switch
- \edef\currentencoding{\getvalue{\purefontname\font\s!encoding}}% okay?
- % is there a pdf font encoding resource file defined
- \doifdefined{\pdffontfileresource}
- {% load the pdf font resource
- \doifvaluesomething{\pdffontfileresource}
- {% but load it only once
- \startreadingfile
- \readsysfile{pdfr-\getvalue{\pdffontfileresource}}{}{}% messages
- \stopreadingfile
- % but do that only once, so forget the flag, empty==loaded
- \global\letvalue{\pdffontfileresource}\empty}}%
- % is there a resource indeed, i.e. an object reference
- \doifdefined{\pdffontresource}
- {% if so, create a reference to the object
- \expanded{\pdffontattr\font % current font
- {/ToUnicode \getvalue{\pdffontresource}\space0 R}}}%
- \egroup}}}
+\beginETEX
+
+\def\doincludepdffontresource
+ {\ifcsname\s!ucmap\fontfile\endcsname\else
+ \dodoincludepdffontresource
+ \fi}
+
+\def\dodoincludepdffontresource%
+ {% does this font has an encoding specified
+ \ifx\currentencoding\empty \else \ifx\currentencoding\s!default \else
+ % is there a pdf font encoding resource file defined
+ \ifcsname\pdffontfileresource\endcsname
+ % load the pdf font resource
+ \edef\xpdffontfileresource{\csname\pdffontfileresource\endcsname}%
+ \ifx\xpdffontfileresource\empty \else
+ % but load it only once
+ \startreadingfile
+ \readsysfile{pdfr-\xpdffontfileresource}{}{}% messages
+ \stopreadingfile
+ % but do that only once, so forget the flag, empty==loaded
+ \global\@EA\let\csname\pdffontfileresource\endcsname\empty
+ \fi
+ \fi
+ % is there a resource indeed, i.e. an object reference
+ \ifcsname\pdffontresource\endcsname
+ % if so, create a reference to the object
+ \expanded{\pdffontattr\font % current font
+ {/ToUnicode \csname\pdffontresource\endcsname\space0 R}}%
+ \fi
+ \global\@EA\let\csname\s!ucmap\fontfile\endcsname\empty
+ \fi \fi}
+
+\endETEX
+
+\beginTEX
+
+\def\doincludepdffontresource
+ {\@EA\ifx\csname\s!ucmap\fontfile\endcsname\relax
+ \dodoincludepdffontresource
+ \fi}
+
+\def\dodoincludepdffontresource%
+ {\ifx\currentencoding\empty \else \ifx\currentencoding\s!default \else
+ \@EA\ifx\csname\pdffontfileresource\endcsname\relax\else
+ \edef\xpdffontfileresource{\csname\pdffontfileresource\endcsname}%
+ \ifx\xpdffontfileresource\empty \else
+ \startreadingfile
+ \readsysfile{pdfr-\xpdffontfileresource}{}{}%
+ \stopreadingfile
+ \global\@EA\let\csname\pdffontfileresource\endcsname\empty
+ \fi
+ \fi
+ \@EA\ifx\csname\pdffontresource\endcsname\relax\else
+ \expanded{\pdffontattr\font
+ {/ToUnicode \csname\pdffontresource\endcsname\space0 R}}%
+ \fi
+ \global\@EA\let\csname\s!ucmap\fontfile\endcsname\empty
+ \fi\fi}
+
+\endTEX
+
%D For the moment, we keep this definition here, if only
%D because \type {\usepdffontencoding} is not defined in the
diff --git a/tex/context/base/enco-tbo.tex b/tex/context/base/enco-tbo.tex
index ea32a53da..37df4d458 100644
--- a/tex/context/base/enco-tbo.tex
+++ b/tex/context/base/enco-tbo.tex
@@ -142,7 +142,10 @@
\definecharacter yacute 253
\definecharacter thorn 254
\definecharacter ydiaeresis 255
-
+
+\definecharacter leftguillemot 171
+\definecharacter rightguillemot 183
+
\stopencoding
\endinput
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index 3abd84a58..01d879eaa 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -27,24 +27,44 @@
\newcounter\pushedfont
-\def\savefont % do we also need to store the encoding ?
+\def\savefont
{\edef\savedfont{\the\font}%
- \pushmacro\savedfont}
+ \pushmacro\savedfont
+ \pushmacro\characterregime
+ \pushmacro\charactermapping
+ \pushmacro\characterencoding}
\def\restorefont%
- {\popmacro\savedfont
+ {\popmacro\characterencoding
+ \popmacro\charactermapping
+ \popmacro\characterregime
+ \popmacro\savedfont
\savedfont}
+
+\def\pushcurrentfont
+ {\edef\popcurrentfont
+ {\noexpand\def\noexpand\fontbody{\fontbody}%
+ \noexpand\def\noexpand\fontstyle{\fontstyle}%
+ \noexpand\dosetcurrentfontalternative{\fontalternative}%
+ \noexpand\dosetcurrentfontsize{\fontsize}%
+ \noexpand\synchronizefont}}
+
+% \definetypeface[one][rm][serif][computer-roman][default]
+% \definetypeface[two][rm][serif][computer-roman][default][rscale=.9]
+%
+% {\one \bf test \two test}
+% {\one \bf test \pushcurrentfont \two \popcurrentfont test}
% new
\def\dodefinedfont[#1]%
{\iffirstargument\definefont[\string\definedfont][#1]\fi
- \getvalue{\string\definedfont}}
+ \csname\string\definedfont\endcsname}
\def\definedfont%
{\dosingleempty\dodefinedfont}
-%%% message 14 added
+%%% message 14 added
\startmessages dutch library: fonts
title: korps
@@ -73,7 +93,7 @@
8: style -- defined
% 9: mapping -- is loaded
10: unknown font file --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: bodyfont -- is defined (can better be done global)
\stopmessages
\startmessages german library: fonts
@@ -88,7 +108,7 @@
8: Stil -- definiert
% 9: Map -- ist geladen
10: unbekanntes Font --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: Fliesstext -- wurde definiert (besser waere globale Definition)
\stopmessages
\startmessages czech library: fonts
@@ -103,7 +123,7 @@
8: styl -- definovan
% 9: mapovani -- je nacteno
10: neznamy font --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: bodyfont -- is defined (can better be done global)
\stopmessages
\startmessages italian library: fonts
@@ -118,7 +138,7 @@
8: stile -- definito
% 9: mappatura -- caricata
10: file di font sconosciuto --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: corpo del testo -- definito (sarebbe meglio globale)
\stopmessages
\startmessages norwegian library: fonts
@@ -133,7 +153,7 @@
8: stil -- definert
% 9: avbildning -- er lest inn
10: ukjent fontfil --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: bodyfont -- is defined (can better be done global)
\stopmessages
\startmessages romanian library: fonts
@@ -148,7 +168,7 @@
8: stilul -- definit
% 9: maparea -- este incarcat
10: fisier font necunoscut --
- 14: bodyfont -- is defined (can beter be done global)
+ 14: bodyfont -- is defined (can better be done global)
\stopmessages
%D This module is one of the oldest modules of \CONTEXT. The
@@ -468,12 +488,7 @@
\unexpanded\def\mf%
{\dodosetmathfont\fontalternative
- \getvalue{\fontalternative}}
-
-% \unexpanded\def\mf%
-% {\dodosetmathfont\fontalternative
-% \getvalue{\fontalternative}%
-% \fam\getvalue{\fontalternative\s!fam}}
+ \csname\fontalternative\endcsname}
%D The previous example was typeset saying:
%D
@@ -575,6 +590,11 @@
{\normalhbox\bgroup\mf
\dowithnextbox{\box\nextbox\egroup}\normalhbox}
+% to test:
+%
+% \def\normalmbox%
+% {\dowithnextboxcontent{\mf}{\box\nextbox}\normalhbox}
+
\def\mbox%
{\ifmmode\normalmbox\else\normalhbox\fi}
@@ -601,45 +621,49 @@
%D \TEX\ does. \PLAIN\ \TEX\ needs at least four families for
%D typesetting math. We use those but give them symbolic names.
-\chardef\mrfam=0 % 0 (Plain TeX) Math Roman
-\chardef\mifam=1 % 1 (Plain TeX) Math Italic
-\chardef\syfam=2 % 2 (Plain TeX) Math Symbol
-\chardef\exfam=3 % 3 (Plain TeX) Math Extra
+\chardef\mrfam = 0 % (Plain TeX) Math Roman
+\chardef\mifam = 1 % (Plain TeX) Math Italic
+\chardef\syfam = 2 % (Plain TeX) Math Symbol
+\chardef\exfam = 3 % (Plain TeX) Math Extra
%D \PLAIN\ \TEX\ also defines families for {\it italic}, {\sl
%D slanted} and {\bf bold} typefaces, so we don't have to
%D define them here.
-%D
-%D \starttypen
-%D \itfam % 4 (Plain TeX) Italic
-%D \slfam % 5 (Plain TeX) Slanted
-%D \bffam % 6 (Plain TeX) Boldface
-%D \stoptypen
-%D
+
+\ifx\itfam\undefined
+
+\chardef\itfam = 4 % (Plain TeX) Italic
+\chardef\slfam = 5 % (Plain TeX) Slanted
+\chardef\bffam = 6 % (Plain TeX) Boldface
+
+\fi
+
%D Family~7 in \PLAIN\ \TEX\ is not used in \CONTEXT, because
%D we do massive switches from roman to sans serif, teletype or
%D other faces.
-%D
-%D \starttypen
-%D \ttfam % 7 (Plain TeX) can be reused!
-%D \stoptypen
-%D
+
+\ifx\ttfam\undefined
+
+\chardef\ttfam = 7 % (Plain TeX) can be reused!
+
+\fi
+
%D We define ourselves some more families for {\bs bold
%D slanted}, {\bi bold italic} and {\sc Small Caps}, so
%D we can use them in math mode too. Instead of separate
%D families for {\ss sans serif} and \type{teletype} we use the
%D more general \type{\tffam}, which stands for typeface.
-\chardef\bsfam=8 % \newfam\bsfam % 8 (ConTeXt) BoldSlanted
-\chardef\bifam=9 % \newfam\bifam % 9 (ConTeXt) BoldItalic
-\chardef\scfam=10 % \newfam\scfam % A (ConTeXt) SmallCaps
-\chardef\tffam=11 % \newfam\tffam % B (ConTeXt) TypeFace
+\chardef\bsfam = 8 % (ConTeXt) BoldSlanted
+\chardef\bifam = 9 % (ConTeXt) BoldItalic
+\chardef\scfam = 10 % (ConTeXt) SmallCaps
+\chardef\tffam = 11 % (ConTeXt) TypeFace
%D Because Taco needs a few more math families, we reuse
%D family~7 for all those typefaces that have no related
%D family, and therefore are grouped into one.
-\chardef\nnfam=7 % \let\nnfam\ttfam % 7 (ReUsed) NoName
+\chardef\nnfam = 7 % (ReUsed) NoName
%D Normally \type{\mrfam} equals \type{\tffam}, but a more
%D distinctive alternatives are possible, for instance the
@@ -650,10 +674,10 @@
%D needed for the \AMS\ Symbol Fonts and Extended Lucida
%D Bright.
-\chardef\mafam=12 % \newfam\mafam % C (ConTeXt) Math A Fam (AmsTeX A)
-\chardef\mbfam=13 % \newfam\mbfam % D (ConTeXt) Math B Fam (AmsTeX B)
-\chardef\mcfam=14 % \newfam\mcfam % E (ConTeXt) Math C Fam (MathTime)
-\chardef\mdfam=15 % \newfam\mdfam % F (ConTeXt) Math D Fam (MathTime)
+\chardef\mafam = 12 % (ConTeXt) Math A Fam (AmsTeX A)
+\chardef\mbfam = 13 % (ConTeXt) Math B Fam (AmsTeX B)
+\chardef\mcfam = 14 % (ConTeXt) Math C Fam (MathTime)
+\chardef\mdfam = 15 % (ConTeXt) Math D Fam (MathTime)
%D Because there are 16~families and because \type{\ttfam}
%D is reused, at the moment we have no so many families
@@ -715,13 +739,13 @@
\newif\ifsynchronizemathfonts \synchronizemathfontstrue
\def\synchronizetext % stylish text in mmode
- {\ifsynchronizemathfonts\the\textstrategies\fam\mrfam\fi}
+ {\ifsynchronizemathfonts\the\textstrategies\fam\mrfam\fi}
\def\synchronizemath % math stuff in mmode
{\ifsynchronizemathfonts\the\mathstrategies\fam\mrfam\fi}
-
+
\def\synchronizesymb % stylish math stuff in mmode
- {\ifsynchronizemathfonts\the\symbstrategies\fam\mrfam\fi}
+ {\ifsynchronizemathfonts\the\symbstrategies\fam\mrfam\fi}
%D \macros
%D {textonly}
@@ -743,16 +767,16 @@
\def\dosettextfamily#1%
{\let\savedfontbody\fontbody
\let\fontfamily#1%
- \let\fontbody \scriptscriptface\dodosettextfamily\scriptscriptfont
- \let\fontbody \scriptface \dodosettextfamily \scriptfont
- \let\fontbody \textface \dodosettextfamily \textfont
+ \let\fontbody\scriptscriptface\dodosettextfamily\scriptscriptfont
+ \let\fontbody\scriptface \dodosettextfamily \scriptfont
+ \let\fontbody\textface \dodosettextfamily \textfont
\let\fontbody\savedfontbody}
% \def\s!nullfont{nullfont}
\beginTEX
-\def\dodosettextfamily#1%
+\def\dodosettextfamily#1%
{\@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax
\@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax
\@EA\ifx\csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname\relax
@@ -776,16 +800,38 @@
\beginETEX \ifcsname
-\def\dodosettextfamily#1%
- {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
- \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
- \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
- \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
- \ifcsname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
- \csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \else
- \ifcsname\fontclass\fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
- \csname\fontclass\fontbody\c!rm\fontfamily\endcsname \else
- \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+%\def\dodosettextfamily#1%
+% {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+% \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+% \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+% \ifcsname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \else
+% \ifcsname\fontclass\fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
+% \csname\fontclass\fontbody\c!rm\fontfamily\endcsname \else
+% \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
+% \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+% \csname \fontbody\c!mm\fontfamily\endcsname \else
+% \ifcsname \fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname \fontbody\c!rm\fontfamily\fontsize\endcsname \else
+% \ifcsname \fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
+% \csname \fontbody\c!rm\fontfamily\endcsname \else
+% \nullfont \autofontsizetrue
+% \fi\fi\fi\fi\fi\fi\fi\fi
+% #1\csname\fontfamily\s!fam\endcsname\font}
+%
+% slightly faster:
+
+\def\dodosettextfamily
+ {\ifx\fontclass\empty
+ \@EA\dodosettextfamilyA
+ \else
+ \@EA\dodosettextfamilyB
+ \fi}
+
+\def\dodosettextfamilyA#1%
+ {\ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
\csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
\ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
\csname \fontbody\c!mm\fontfamily\endcsname \else
@@ -794,7 +840,20 @@
\ifcsname \fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
\csname \fontbody\c!rm\fontfamily\endcsname \else
\nullfont \autofontsizetrue
- \fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi
+ #1\csname\fontfamily\s!fam\endcsname\font}
+
+\def\dodosettextfamilyB#1%
+ {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!rm\fontfamily\endcsname \else
+ \dodosettextfamilyA#1%
+ \fi\fi\fi\fi
#1\csname\fontfamily\s!fam\endcsname\font}
\endETEX
@@ -825,8 +884,8 @@
\beginTEX
-\def\dodosetmathfamily#1#2%
- {\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax
+\def\dodosetmathfamily#1#2%
+ {\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax
\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax
\@EA\ifx \csname\fontclass\fontbody\backfamily\fontsize\endcsname \relax
\@EA\ifx \csname\fontclass\fontbody\backfamily\endcsname \relax
@@ -849,16 +908,38 @@
\beginETEX \ifcsname
-\def\dodosetmathfamily#1#2%
- {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
- \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
- \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
- \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
- \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse
- \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else
- \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue
- \csname\fontclass\fontbody\backfamily\endcsname \else
- \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+%\def\dodosetmathfamily#1#2%
+% {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+% \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+% \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+% \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse
+% \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else
+% \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue
+% \csname\fontclass\fontbody\backfamily\endcsname \else
+% \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+% \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
+% \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+% \csname \fontbody\c!mm\fontfamily\endcsname \else
+% \ifcsname \fontbody\backfamily\fontsize\endcsname \autofontsizefalse
+% \csname \fontbody\backfamily\fontsize\endcsname \else
+% \ifcsname \fontbody\backfamily\endcsname \autofontsizetrue
+% \csname \fontbody\backfamily\endcsname \else
+% \nullfont \autofontsizetrue
+% \fi\fi\fi\fi\fi\fi\fi\fi
+% #1#2\font}
+%
+% sligthly faster:
+
+\def\dodosetmathfamily
+ {\ifx\fontclass\empty
+ \@EA\dodosetmathfamilyA
+ \else
+ \@EA\dodosetmathfamilyB
+ \fi}
+
+\def\dodosetmathfamilyA#1#2%
+ {\ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
\csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
\ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
\csname \fontbody\c!mm\fontfamily\endcsname \else
@@ -867,7 +948,20 @@
\ifcsname \fontbody\backfamily\endcsname \autofontsizetrue
\csname \fontbody\backfamily\endcsname \else
\nullfont \autofontsizetrue
- \fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi
+ #1#2\font}
+
+\def\dodosetmathfamilyB#1#2%
+ {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\backfamily\endcsname \else
+ \dodosetmathfamilyA#1#2%
+ \fi\fi\fi\fi
#1#2\font}
\endETEX
@@ -892,7 +986,7 @@
\beginTEX
-\def\dodosetsymbfamily#1#2%
+\def\dodosetsymbfamily#1#2%
{\@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname\relax
\@EA\ifx\csname\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname\relax
\else
@@ -1020,7 +1114,7 @@
\def\doresetrelativefontsize%
{\let\dorelativefontsize\norelativefontsize}
-\newdimen\scaledfont
+\newdimen\scaledfont
\def\@fs@{@fs@}
@@ -1031,30 +1125,28 @@
\def\doparsefontspec#1 #2%
{\def\somefontname{#1}%
- \ifx\somefontname\empty % space before fontname
+ \ifx\somefontname\empty % space before fontname
\@EA\doparsefontspec
+ \else\ifx#2\relax
+ \@EAEAEA\setnaturalfontspec
\else
- \ifx#2\relax
- \@EA\@EA\@EA\setnaturalfontspec
- \else
- \@EA\@EA\@EA\setforcedfontspec
- \fi
- \fi
+ \@EAEAEA\setforcedfontspec
+ \fi\fi
#2}
\def\setnaturalfontspec#1]%
{\@fs@scaled\!!thousand}
\def\setforcedfontspec#1 #2\relax]%
- {\getvalue{\@fs@#1}{#2}}
+ {\csname\@fs@#1\endcsname{#2}}
\def\@fs@scaled#1%
{\scaledfont#1pt%
\scaledfont\dorelativefontsize\scaledfont
\ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi
- \scratchcounter\scaledfont % \scaledfont is now pretty large
- \advance\scratchcounter \!!medcard
- \divide\scratchcounter \!!maxcard
+ \scratchcounter\scaledfont % \scaledfont is now pretty large
+ \advance\scratchcounter \medcard
+ \divide\scratchcounter \maxcard
\edef\somefontspec{ scaled \the\scratchcounter}}
\def\@fs@at#1%
@@ -1074,56 +1166,8 @@
\def\setsamofontspec#1%
{\checkfontscale#1\end\scaledfont
\scaledfont\dorelativefontsize\scaledfont
- \ifautofontsize
- \def\somefontspec{ at \currentfontbodyscale\scaledfont}%
- \else
- \def\somefontspec{ at \scaledfont}%
- \fi}
-
-% \def\getfontparameters%
-% {\expandafter\setfontparameter\fontdata,]=,}
-%
-% \def\getglobalfontparameters%
-% {\expandafter\setglobalfontparameter\fontdata,]=,}
-%
-% \def\setfontparameter#1=#2,%
-% {\if]#1\else
-% \expandafter\def\csname\fontfile#1\endcsname{#2}%
-% \expandafter\setfontparameter
-% \fi}
-%
-% \def\setglobalfontparameter#1=#2,%
-% {\if]#1\else
-% \expandafter\gdef\csname\fontfile#1\endcsname{#2}%
-% \expandafter\setglobalfontparameter
-% \fi}
-%
-% \def\donoparsefontspec#1%
-% {\edef\fontfile{\truefontname\somefontname}%
-% %\writestatus{specifying}{\somefontname/\fontfile/\somefontspec}%
-% \ifx\fontfile\s!unknown
-% %\writestatus{missing}{\somefontname}%
-% \let\fontfile\defaultfontfile
-% \else
-% \edef\fontdata{\truefontdata\fontfile}%
-% \ifx\fontdata\empty \else
-% %\writestatus{storing}{\fontfile\space(\fontdata)]}%
-% \ifx\fontclass\empty
-% \getfontparameters
-% \else
-% \getglobalfontparameters
-% \fi
-% \fi
-% \fi
-% \edef\lastfontname{\fontfile\somefontspec}% not really needed
-% %\writestatus{tfmloading}{[#1] [\lastfontname][\the\scaledfont]}%
-% \ifx\fontclass\empty\else\global\fi
-% \expandafter\font\csname#1\endcsname\lastfontname\relax
-% \the\everyfont % new
-% % the second \font definition prevents fuzzy font refs
-% % \expandafter\font\csname\dummyfontname\endcsname\lastfontname
-% % but somehow they changed tex so that it does not matter any more
-% \relax}
+ \edef\somefontspec
+ { at \ifautofontsize\currentfontbodyscale\fi\scaledfont}}
\def\getfontparameters%
{\expandafter\setfontparameter\@@fontdata,]=,}
@@ -1146,32 +1190,32 @@
\let\@@fontencoding\empty
\let\@@fontmapping \empty
\let\@@fonthandling\empty
-\let\@@skewchar \empty
-\let\@@hyphenchar \empty % todo, will go to encoding
+\let\@@skewchar \empty
+\let\@@hyphenchar \empty % todo, will go to encoding
-%D This brings down maps processing from 466 to 309 seconds
-%D ($-33$\%) and mfonts from 42 to 34 seconds ($-15$\%).
+%D This brings down maps processing from 466 to 309 seconds
+%D ($-33$\%) and mfonts from 42 to 34 seconds ($-15$\%).
\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
\def\donoparsefontspec#1%
{\edef\fontfile{\truefontname\somefontname}%
\ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi
- \edef\lastfontname{\fontfile\somefontspec}%
- \ifx\fontclass\empty\else\global\fi
+ \edef\lastfontname{\fontfile\somefontspec}%
+ \ifx\fontclass\empty\else\global\fi
\expandafter\font\csname#1\endcsname\lastfontname\relax
- \the\everyfont
+ %\the\everyfont
\relax}
%D An additional the second \type {\font} definition can
-%D prevent fuzzy font refs
-%D
-%D \starttypen
+%D prevent fuzzy font refs
+%D
+%D \starttypen
%D \expandafter\font\csname\dummyfontname\endcsname\lastfontname
-%D \stoptypen
-%D
+%D \stoptypen
+%D
%D but somehow they changed \TEX\ so that it does not matter
-%D any more.
+%D any more.
\def\defaultfontfile{cmtt10}
\edef\nullfontname {\fontname\nullfont}
@@ -1244,35 +1288,21 @@
%D data: \type {\truefontdata{\truefontname{Lucida-Bright}}}
%D \stopregels
-% \def\definefontsynonym%
-% {\dotripleempty\dodefinefontsynonym}
-%
-% \def\dodefinefontsynonym[#1][#2][#3]%
-% {\ifthirdargument
-% \setevalue{\??ff#1}{#2}%
-% \ifx\fontclass\empty\else\global\fi
-% \setevalue{\??ff\??ff#2}{#3}%
-% \else
-% \setevalue{\??ff\fontclass#1}{#2}%
-% \fi}
-
\def\definefontsynonym%
{\dotripleempty\dodefinefontsynonym}
\def\dodefinefontsynonym[#1][#2][#3]%
- {\ifthirdargument
- \setevalue{\??ff\fontclass#1}{#2}% here fontclass ?
+ {\@EA\edef\csname\??ff\fontclass#1\endcsname{#2}%
+ \ifthirdargument
\edef\@@fontdata{#3}%
\ifx\@@fontdata\empty \else
\edef\@@fontfile{#2}%
- \ifx\fontclass\empty
+ \ifx\fontclass\empty
\getfontparameters
\else
\getglobalfontparameters
\fi
\fi
- \else
- \setevalue{\??ff\fontclass#1}{#2}%
\fi}
\def\setupfontsynonym%
@@ -1280,9 +1310,9 @@
\def\dosetupfontsynonym[#1][#2]%
{\edef\@@fontdata{#2}%
- \ifx\@@fontdata\empty \else
+ \ifx\@@fontdata\empty \else
\edef\@@fontfile{#1}%
- \ifx\fontclass\empty
+ \ifx\fontclass\empty
\getfontparameters
\else
\getglobalfontparameters
@@ -1291,36 +1321,26 @@
\beginTEX
-%\def\truefontdata#1#2% font var
-% {\expandafter\ifx\csname\??ff#1#2\endcsname\relax
-% \expandafter\ifx\csname\??ff\fontclass#1\endcsname\relax
-% \expandafter\ifx\csname\??ff#1\endcsname\relax
-% \else
-% \expandafter\truefontdata\csname\??ff#1\endcsname#2%
-% \fi
-% \else
-% \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
-% \fi
-% \else
-% \csname\??ff#1#2\endcsname
-% \fi}
-
-\def\truefontdata#1#2% font var
- {\expandafter\ifx\csname\??ff#2\endcsname\relax
- \expandafter\ifx\csname\??ff#1#2\endcsname\relax
- \expandafter\ifx\csname\??ff\fontclass#1\endcsname\relax
- \expandafter\ifx\csname\??ff#1\endcsname\relax
+\def\truefontdata#1#2%
+ {\ifx\csname\??ff#1#2\endcsname\relax
+ \ifx\csname\??ff\fontclass#1\endcsname\relax
+ \ifx\csname\??ff#1\endcsname\relax
+ \ifx\csname\??ff#2\endcsname\relax
\else
- \expandafter\truefontdata\csname\??ff#1\endcsname#2%
+ % raw(key)
+ \csname\??ff#2\endcsname
\fi
\else
- \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
+ % exp(Regular) raw(key)
+ \expandafter\truefontdata\csname\??ff#1\endcsname#2%
\fi
\else
- \csname\??ff#1#2\endcsname
+ % exp(palatino Regular) raw(key)
+ \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
\fi
\else
- \csname\??ff#2\endcsname
+ % raw(Regular) raw(key)
+ \csname\??ff#1#2\endcsname\relax
\fi}
\def\truefontname#1%
@@ -1338,24 +1358,19 @@
\beginETEX \ifcsname
-%\def\truefontdata#1#2% font var
-% {\ifcsname\??ff#1#2\endcsname
-% \csname\??ff#1#2\endcsname
-% \else\ifcsname\??ff\fontclass#1\endcsname
-% \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
-% \else\ifcsname\??ff#1\endcsname
-% \expandafter\truefontdata\csname\??ff#1\endcsname#2%
-% \fi\fi\fi}
-
-\def\truefontdata#1#2% font var
- {\ifcsname\??ff#2\endcsname
- \csname\??ff#2\endcsname
- \else\ifcsname\??ff#1#2\endcsname
+\def\truefontdata#1#2%
+ {\ifcsname\??ff#1#2\endcsname
+ % raw(Regular) raw(key)
\csname\??ff#1#2\endcsname
\else\ifcsname\??ff\fontclass#1\endcsname
- \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
+ % exp(palatino Regular) raw(key)
+ \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2%
\else\ifcsname\??ff#1\endcsname
- \expandafter\truefontdata\csname\??ff#1\endcsname#2%
+ % exp(Regular) raw(key)
+ \expandafter\truefontdata\csname\??ff#1\endcsname#2%
+ \else\ifcsname\??ff#2\endcsname
+ % raw(key)
+ \csname\??ff#2\endcsname
\fi\fi\fi\fi}
\def\truefontname#1%
@@ -1439,9 +1454,10 @@
% \expanded{\getparameters[\@@currentfontfile][\fontdata]}}
\def\getfontfileparameters#1%
- {\edef\currentfontfileencoding{\truefontdata{#1}\s!encoding}%
- \edef\currentfontfilemapping {\truefontdata{#1}\s!mapping }%
- \edef\currentfontfilehandling{\truefontdata{#1}\s!handling}}
+ {\edef\@@truefontname{\truefontname{#1}}%
+ \edef\currentfontfileencoding{\truefontdata\@@truefontname\s!encoding}%
+ \edef\currentfontfilemapping {\truefontdata\@@truefontname\s!mapping }%
+ \edef\currentfontfilehandling{\truefontdata\@@truefontname\s!handling}}
%D \macros
%D {definefont}
@@ -1473,51 +1489,55 @@
\let\lastfontidentifier\empty
+\def\rawfontidentifier{**\lastfontidentifier\fontsize**}
+\def\newfontidentifier{*\fontclass\lastfontidentifier\fontsize*}
+
\def\dododefinefont#1#2%
- {\dosetrelativefontsize{#1}%
- \parsefontspec{#2}{**#1**}%
+ {\edef\lastfontidentifier{#1}%
+ \dosetrelativefontsize\lastfontidentifier
+ \parsefontspec{#2}\rawfontidentifier
\doresetrelativefontsize
- \csname**#1**\endcsname
- \autofontsizefalse
- \edef\lastfontidentifier{#1}%
+ \csname\rawfontidentifier\endcsname
+ \autofontsizefalse
\setfontcharacteristics
\the\everyfontswitch}
-\beginETEX \ifcsname
+\beginTEX
\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine
- {\ifcsname*\fontclass#1\fontsize*\endcsname\else
- \dosetrelativefontsize{\fontclass#1}% dangerous with fallback
- \parsefontspec{#2}{*\fontclass#1\fontsize*}%
+ {\edef\lastfontidentifier{#1}%
+ \@EA\ifx\csname\newfontidentifier\endcsname\relax
+ \dosetrelativefontsize{\fontclass\lastfontidentifier}% dangerous with fallback
+ \parsefontspec{#2}\newfontidentifier
\doresetrelativefontsize
\fi
- \csname*\fontclass#1\fontsize*\endcsname
- \autofontsizefalse
- \edef\lastfontidentifier{#1}%
+ \csname\newfontidentifier\endcsname
+ \autofontsizefalse
+ %\edef\lastfontidentifier{#1}%
\ifskipfontcharacteristics \else
\setfontcharacteristics
\the\everyfontswitch
\fi}
+\endTEX
-\endETEX
-
-\beginTEX
+\beginETEX \ifcsname
\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine
- {\@EA\ifx\csname*\fontclass#1\fontsize*\endcsname\relax
- \dosetrelativefontsize{\fontclass#1}% dangerous with fallback
- \parsefontspec{#2}{*\fontclass#1\fontsize*}%
+ {\edef\lastfontidentifier{#1}%
+ \ifcsname\newfontidentifier\endcsname\else
+ \dosetrelativefontsize{\fontclass\lastfontidentifier}% dangerous with fallback
+ \parsefontspec{#2}\newfontidentifier
\doresetrelativefontsize
\fi
- \csname*\fontclass#1\fontsize*\endcsname
- \autofontsizefalse
- \edef\lastfontidentifier{#1}%
+ \csname\newfontidentifier\endcsname
+ \autofontsizefalse
+ %\edef\lastfontidentifier{#1}%
\ifskipfontcharacteristics \else
\setfontcharacteristics
\the\everyfontswitch
\fi}
-\endTEX
+\endETEX
%D I considered checking for mistakenly use of \PLAIN's
%D \type{\magstep}'s but although it would take only a few
@@ -1589,7 +1609,7 @@
%D \type{12ptrmtf} as argument, we get \getfontname{12ptrmtf}.
\def\getfontname#1%
- {\getvalue{\??ft#1}}
+ {\csname\??ft#1\endcsname}
%D To be documented.
@@ -1623,7 +1643,7 @@
\beginTEX
-\def\currentfontscale%
+\def\currentfontscale
{\@EA\ifx\csname\??ft\s!default\xfontsize\endcsname\relax
\@EA\ifx\csname\??ft\s!default\s!text\endcsname\relax
1%
@@ -1634,7 +1654,7 @@
\csname\??ft\s!default\xfontsize\endcsname
\fi}
-\def\currentfontbodyscale%
+\def\currentfontbodyscale
{\@EA\ifx\csname\??ft\s!default\fontsize\endcsname\relax
\@EA\ifx\csname\??ft\s!default\s!text\endcsname\relax
1%
@@ -1649,26 +1669,40 @@
\beginETEX \ifcsname
-\def\currentfontscale%
- {\ifcsname\??ft\s!default\xfontsize\endcsname
- \csname\??ft\s!default\xfontsize\endcsname
- \else\ifcsname\??ft\s!default\s!text\endcsname
- \csname\??ft\s!default\s!text\endcsname
- \else
- 1%
- \fi\fi}
+% \def\currentfontscale%
+% {\ifcsname\??ft\s!default\xfontsize\endcsname
+% \csname\??ft\s!default\xfontsize\endcsname
+% \else\ifcsname\??ft\s!default\s!text\endcsname
+% \csname\??ft\s!default\s!text\endcsname
+% \else
+% 1%
+% \fi\fi}
+%
+% \def\currentfontbodyscale%
+% {\ifcsname\??ft\s!default\fontsize\endcsname
+% \csname\??ft\s!default\fontsize\endcsname
+% \else\ifcsname\??ft\s!default\s!text\endcsname
+% \csname\??ft\s!default\s!text\endcsname
+% \else
+% 1%
+% \fi\fi}
-\def\currentfontbodyscale%
- {\ifcsname\??ft\s!default\fontsize\endcsname
- \csname\??ft\s!default\fontsize\endcsname
- \else\ifcsname\??ft\s!default\s!text\endcsname
- \csname\??ft\s!default\s!text\endcsname
- \else
- 1%
- \fi\fi}
+\def\currentfontscale
+ {\csname\??ft\s!default
+ \ifcsname\??ft\s!default\xfontsize\endcsname \xfontsize \else
+ \ifcsname\??ft\s!default\s!text \endcsname \s!text \fi\fi
+ \endcsname}
+
+\def\currentfontbodyscale
+ {\csname\??ft\s!default
+ \ifcsname\??ft\s!default\fontsize\endcsname \fontsize \else
+ \ifcsname\??ft\s!default\s!text \endcsname \s!text \fi\fi
+ \endcsname}
\endETEX
+\setvalue{\??ft\s!default}{1}
+
%D Both alternatives use \type {\xfontsize}, a macro that
%D expands to the current size in terms of \type {a} \unknown
%D \type {d}, nothing, or \type {x} \unknown \type {xx}.
@@ -1745,20 +1779,20 @@
\def\@@beginfontdef%
{\ifcase\@@fontdefhack
- \let\k!savedtext =\k!text \let\k!text =\s!text
- \let\k!k!savedtext =\k!k!text \def\k!k!text {1}%
- \let\k!saveddefault =\k!default \let\k!default =\s!default
- \let\k!k!saveddefault=\k!k!default \def\k!k!default {1}%
+ \let\k!savedtext \k!text \let\k!text \s!text
+ \let\k!k!savedtext \k!k!text \def\k!k!text {1}%
+ \let\k!saveddefault \k!default \let\k!default \s!default
+ \let\k!k!saveddefault\k!k!default \def\k!k!default {1}%
\fi
- \advance\@@fontdefhack by 1 }
+ \advance\@@fontdefhack 1 }
\def\@@endfontdef%
- {\advance\@@fontdefhack by -1
+ {\advance\@@fontdefhack -1
\ifcase\@@fontdefhack
- \let\k!k!default=\k!k!saveddefault
- \let\k!default =\k!saveddefault
- \let\k!k!text =\k!k!savedtext
- \let\k!text =\k!savedtext
+ \let\k!k!default\k!k!saveddefault
+ \let\k!default \k!saveddefault
+ \let\k!k!text \k!k!savedtext
+ \let\k!text \k!savedtext
\fi}
\def\definebodyfontenvironment%
@@ -1779,10 +1813,10 @@
\def\dododefinebodyfontenvironment[#1][#2][#3]% size class settings
{\@@beginfontdef
- \doifundefined{\??ft#2#1\c!em} % \s!text goes wrong in testing because
+ \doifundefined{\??ft#2#1\c!em} % \s!text goes wrong in testing because
{\def\docommando##1% % the 12pt alternative will called when
- {\scratchdimen=#1\relax % typesetting the test (or so)
- \scratchdimen=\getvalue{\??ft\s!default##1}\scratchdimen
+ {\scratchdimen=#1\relax % typesetting the test (or so)
+ \scratchdimen=\csname\??ft\s!default##1\endcsname\scratchdimen
\normalizebodyfontsize\scratchdimen\to\tempbodyfontsize
\setevalue{\??ft#2#1##1}{\tempbodyfontsize}}%
\processcommalist
@@ -1794,34 +1828,34 @@
% \@@beginfontdef
\getparameters[\??ft#2#1][#3]%
\@@endfontdef
- % new code, see remark
- \ifloadingfonts \else % only runtime
- \doifundefined{\@size@#1} % only once
- {\letvalue{\@size@#1}\empty % prevent loop
- \defineunknownfont{#1}}% % safeguard
+ % new code, see remark
+ \ifloadingfonts \else % only runtime
+ \doifundefined{\@size@#1} % only once
+ {\letvalue{\@size@#1}\empty % prevent loop
+ \defineunknownfont{#1}}% % safeguard
\fi
- % so far
+ % so far
\setvalue{\@size@#1}{\docompletefontswitch[#1]}}
-%D {\bf Remark:} We need to cover the following cases,
+%D {\bf Remark:} We need to cover the following cases,
%D otherwise users can get confused:
-%D
+%D
%D \starttypen
%D \setupbodyfont[23pt]
-%D
+%D
%D \definebodyfontenvironment[23pt]
%D \setupbodyfont[23pt]
-%D
+%D
%D \definebodyfontenvironment[23pt]
%D \definebodyfont[23pt][rm,ss,tt][default]
%D \setupbodyfont[23pt]
-%D \stoptypen
+%D \stoptypen
-%D Beware: while some font defs can be global, the bodyfont
-%D environment checks local. This means that multiple local
-%D checks resulting in definitions are not that efficient.
+%D Beware: while some font defs can be global, the bodyfont
+%D environment checks local. This means that multiple local
+%D checks resulting in definitions are not that efficient.
%D So, apart from an occasional switch, one should define an
-%D environment at the outer level.
+%D environment at the outer level.
\def\checkbodyfontenvironment[#1]%
{\definebodyfontenvironment[\fontclass][#1][]}
@@ -1883,10 +1917,10 @@
%D
%D \showsetup{\y!definebodyfont}
%D
-%D This commands takes three arguments: a (series of) bodyfont
+%D This commands takes three arguments: a (series of) bodyfont
%D size(s), the style group to which the definitions belong,
-%D and an alternative, as specified by the \TEX\ (math) families,
-%D extended with~a, b~\unknown.
+%D and an alternative, as specified by the \TEX\ (math) families,
+%D extended with~a, b~\unknown.
%D
%D We show two examples, that show all the alternative
%D scaling options. The \type{\tfa} alternatives can be
@@ -1989,7 +2023,7 @@
\processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
{% [12pt] [style] [identifier]
\dodefinedefaultbodyfont[#1][#2][#3]}} % body style identifier
- {% [identifier] [style] [settings] % see ***
+ {% [identifier] [style] [settings] % see ***
\setvalue{\s!default#1#2}##1##2{\expanded{\xdodefinebodyfont[##1][##2][#3]}}}%
\else\ifsecondargument
\definebodyfont[#1][\c!rm][#2]%
@@ -2000,7 +2034,7 @@
{\definebodyfont[#1][\c!rm][]}% make sure some basics are set up.
\fi\fi}
-% nested
+% nested
%
% \def\xdodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
% {%\writestatus{[#1]}{[#2][#3]}%
@@ -2014,7 +2048,7 @@
% {% [identifier] [style] [settings]
% \setvalue{\s!default#1#2}##1##2{\expanded{\xdodefinebodyfont[##1][##2][#3]}}}}
%
-% faster
+% faster
\def\xdodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
{%\writestatus{[#1]}{[#2][#3]}%
@@ -2061,23 +2095,23 @@
\fi}
\def\checkbodyfont#1#2#3#4% body style alt size / gdef % #4 can be empty
- {\def\c!mm!{#2}%
- \ifx\c!mm!\c!mm % prevents \max and alike (re)defs
+ {\def\c!!mm{#2}%
+ \ifx\c!!mm\c!mm % prevents \max and alike (re)defs
\unexpanded\setgvalue {#2}{\setcurrentfontstyle {#2}}% \rm
\unexpanded\setgvalue {#3}{\setcurrentfontalternative {#3}}% \sl
- \else
+ \else
\unexpanded\setgvalue {#2#4}{\setcurrentfontstylesize {#2}{#4}}% \rma
\unexpanded\setgvalue {#3#4}{\setcurrentfontalternativesize {#3}{#4}}% \sla
\unexpanded\setgvalue {#2#3#4}{\setcurrentfontstylealternativesize{#2}{#3}{#4}}% \rmsla
\unexpanded\setgvalue {#2}{\setcurrentfontstyle {#2}}% \rm
\unexpanded\setgvalue {#3}{\setcurrentfontalternative {#3}}% \sl
- \unexpanded\setgvalue {#2\c!x}{\setcurrentfontxstylealternative {#3}}% \rmx
- \unexpanded\setgvalue{#2\c!xx}{\setcurrentfontxxstylealternative {#3}}% \rmxx
+ \unexpanded\setgvalue {#2\c!x}{\setcurrentfontxstylealternative {#2}}% \rmx
+ \unexpanded\setgvalue{#2\c!xx}{\setcurrentfontxxstylealternative {#2}}% \rmxx
\unexpanded\setgvalue {#3\c!x}{\setcurrentfontxalternative {#3}}% \slx
\unexpanded\setgvalue{#3\c!xx}{\setcurrentfontxxalternative {#3}}% \slxx
\unexpanded\setgvalue {#2#3}{\setcurrentfontstylealternative {#2}{#3}}% \rmsl
\fi}
-
+
\def\dodefinedefaultbodyfont[#1][#2][#3]% sizes styles identifier
{\def\dododefinedefaultbodyfont##1%
{\def\dodododefinedefaultbodyfont####1%
@@ -2097,21 +2131,20 @@
\newif\ifdefiningunknownfont
\def\defineunknownfont#1%
- {\let\c!savedtext=\c!text
- \let\c!text=\s!text
+ {\let\c!savedtext\c!text
+ \let\c!text\s!text
\donefalse
\def\docommando##1%
{\doifdefined{\??ft\s!default##1}
{\donetrue
\scratchdimen=#1\relax
- \scratchdimen=\getvalue{\??ft\s!default##1}\scratchdimen
- %\setevalue{\??ft#1##1}{\the\scratchdimen}}}%
+ \scratchdimen=\csname\??ft\s!default##1\endcsname\scratchdimen
\normalizebodyfontsize\scratchdimen\to\!!stringa
\letvalue{\??ft#1##1}\!!stringa}}%
\processcommalist
[\s!text,\s!script,\s!scriptscript,\c!x,\c!xx,\c!groot,\c!klein]
\docommando
- \let\c!text=\c!savedtext
+ \let\c!text\c!savedtext
\ifdone
\donefalse
\def\defineunknownbodyfont##1% see ***
@@ -2136,7 +2169,7 @@
\fi
\fi
\ifdone
- \showmessage{\m!fonts}{14}{#1}%
+ \showmessage{\m!fonts}{14}{#1}%
\fi
\fi}
@@ -2231,7 +2264,7 @@
%D often not the way users specify the bodyfont size. Therefore
%D we also store the normalized value.
-\chardef\fontdigits=1 %
+\chardef\fontdigits=1
\def\donormalizedbodyfontsize#1.#2#3#4\to#5%
{\edef#5%
@@ -2283,11 +2316,11 @@
\def\resetfontdefinitionfile[#1]%
{\letbeundefined{\c!file\f!fontprefix#1}}
-\newif\ifloadfontdefinitionfileonce
+\newif\ifloadfontfileonce
-\def\doreadfontdefinitionfile#1#2% #1 = set/switch state
+\def\doreadfontdefinitionfile#1#2% #1 = set/switch state
{\doifundefined{\c!file\f!fontprefix#2}%
- {\ifloadfontdefinitionfileonce
+ {\ifloadfontfileonce
\letvalue{\c!file\f!fontprefix#2}\empty
\fi
\startreadingfile
@@ -2299,7 +2332,7 @@
{\showmessage{\m!fonts}{3}{#2}}}%
\stopreadingfile}}
-%D When \type {\loadfontdefinitionfiletrue}, such files are
+%D When \type {\loadfontfileoncetrue}, such files are
%D only loaded once! This permits redundant loading, but at
%D the same time forced grouping when we want continuously mix
%D all kind of font, which of course is a kind of
@@ -2317,8 +2350,7 @@
{\getvalue{\@size@#1}%
\localbodyfontsize=#1\relax
\normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
-\checkbodyfontenvironment[\normalizedbodyfontsize]% added
- }% \the\everybodyfont}
+ \checkbodyfontenvironment[\normalizedbodyfontsize]}
{\showmessage{\m!fonts}{4}{#1}}}
\unprotected \def\doswitchstyle[#1]%
@@ -2392,7 +2424,7 @@
%D handle changes in size as well as returning to the global
%D bodyfont size.
-\def\dosetfont#1#2% #1 = set/switch state
+\def\dosetfont#1#2% #1 = set/switch state
{\doifelse{#2}{\v!globaal}
{\restoreglobalbodyfont}
{\processcommalist[#2]{\dodosetfont{#1}}% ##1 get also passed
@@ -2402,10 +2434,10 @@
\fi}%
\chardef\currentxfontsize=0\relax}
-\def\dodosetfont#1#2% #1 = set/switch state
+\def\dodosetfont#1#2% #1 = set/switch state
{\dododosetfont{#1}{#2}{\showmessage{\m!fonts}{4}{#2}}}
-\def\dododosetfont#1#2#3% #1 = set/switch state
+\def\dododosetfont#1#2#3% #1 = set/switch state
{\doifnumberelse{#2}
{\scratchdimen=#2\relax
\normalizebodyfontsize\scratchdimen\to\normalizedsetfont
@@ -2435,7 +2467,7 @@
%D are more probable to occur. By taking a value slightly
%D smaller than half a point, we can use the next method.
-\def\dosetsubstitutefont#1#2% #1 = set/switch state
+\def\dosetsubstitutefont#1#2% #1 = set/switch state
{\scratchdimen=#2\relax
\advance\scratchdimen by .499pt
\dimensiontocount\scratchdimen\scratchcounter
@@ -2474,41 +2506,41 @@
% 0=never 1=everymath 2=always
-\chardef\synchronizebigmathflag =1
+\chardef\synchronizebigmathflag =1
-\appendtoks
+\appendtoks
\ifcase\synchronizebigmathflag
- % never
- \or
+ % never
+ \or
\synchronizebigmath
- \or
- % always
+ \or
+ % always
\fi
\to \everymath
\def\nobigmath{\chardef\synchronizebigmathflag =0 }
\def\bigmath {\chardef\synchronizebigmathflag =2 \synchronizebigmath}
-\let\bigmathfontsize\empty
+\let\bigmathfontsize\empty
\def\synchronizebigmath%
- {\ifx\bigmathfontsize\fontsize
- % already in sync
+ {\ifx\bigmathfontsize\fontsize
+ % already in sync
\else
- \let\bigmathfontsize\fontsize
+ \let\bigmathfontsize\fontsize
\synchronizemath \synchronizetext
\fi}
\def\checkbigmathsynchronization
{\ifcase\synchronizebigmathflag
- % never
+ % never
\or
- \ifmmode \synchronizebigmath \fi
+ \ifmmode \synchronizebigmath \fi
\or
\synchronizebigmath
\fi}
-%D So far for synchronisation.
+%D So far for synchronisation.
\def\dosetcurrentfontsize#1%
{\edef\fontsize{#1}%
@@ -2516,7 +2548,7 @@
\def\dosetcurrentfontalternative#1%
{\edef\fontalternative{#1}%
- \ifmmode % maybe no test, or actually, an option
+ \ifmmode % maybe no test, or actually, an option
\fam\csname\fontalternative\s!fam\endcsname
\fi}
@@ -2536,7 +2568,7 @@
\def\setcurrentfontstyle#1%
{%\message{[3 #1]}%
\edef\fontstyle{#1}%
- \ifmmode\mr\fi % otherwise \rm not downward compatible
+ \ifmmode\mr\fi % otherwise \rm not downward compatible
\synchronizefont}
\def\setcurrentfontbodyalternative#1#2%
@@ -2584,87 +2616,75 @@
%D Some day we will.
\newtoks\fontstrategies
+\newif\iftryingfont
-\def\synchronizefont%
- {\let\fontstrategy\dofontstrategy
- \the\fontstrategies
- \ifskipfontcharacteristics
+\def\synchronizefont
+ {\tryingfonttrue
+ \ifx\fontclass\empty\else
+ \let\fontstrategy\dofontclassstrategy
+ \the\fontstrategies \relax % \relax still needed ?
+ \fi
+ \iftryingfont
+ \let\fontstrategy\dofontstrategy
+ \the\fontstrategies \relax % \relax still needed ?
+ \fi
+ \ifskipfontcharacteristics
\setfontcharacteristics
- \the\everyfontswitch
+ \the\everyfontswitch
\fi}
\beginTEX
-\def\dofontstrategy#1#2#3#4#5#6%
- {\expandafter\ifx\csname#2#3#4#5#6\endcsname\relax\else
- #1\csname#2#3#4#5#6\endcsname
- \let\fontstrategy\gobblesixarguments
+\def\dofontstrategy#1#2#3#4#5%
+ {\@EA\ifx\csname#2#3#4#5\endcsname\relax\else
+ #1\csname#2#3#4#5\endcsname \tryingfontfalse
+ \fi}
+
+\def\dofontclassstrategy#1#2#3#4#5%
+ {\@EA\ifx\csname\fontclass#2#3#4#5\endcsname\relax\else
+ #1\csname\fontclass#2#3#4#5\endcsname \tryingfontfalse
\fi}
\endTEX
\beginETEX \ifcsname
-\def\dofontstrategy#1#2#3#4#5#6%
- {\ifcsname#2#3#4#5#6\endcsname
- #1\csname#2#3#4#5#6\endcsname
- \let\fontstrategy\gobblesixarguments
+\def\dofontstrategy#1#2#3#4#5%
+ {\ifcsname#2#3#4#5\endcsname
+ #1\csname#2#3#4#5\endcsname \tryingfontfalse
\fi}
-\endETEX
-
-% font class
-
-\appendtoks \fontstrategy \autofontsizefalse % --- --- --- --- % pt tt bf a
- \fontclass \fontbody \fontstyle \fontalternative \fontsize
-\to \fontstrategies
-
-\appendtoks \fontstrategy \autofontsizetrue % --- --- --- def % pt tt bf
- \fontclass \fontbody \fontstyle \fontalternative \defaultfontsize
-\to \fontstrategies
-
-\appendtoks \fontstrategy \autofontsizetrue % --- --- def --- % pt tt tf a
- \fontclass \fontbody \fontstyle \defaultfontalternative \fontsize
-\to \fontstrategies
-
-\appendtoks \fontstrategy \autofontsizetrue % --- --- def def % pt tt tf
- \fontclass \fontbody \fontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
-
-\appendtoks \fontstrategy \autofontsizefalse % --- def def def % pt rm tf
- \fontclass \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
-
-\appendtoks \fontstrategy \autofontsizetrue % def def def def % rm tf
- \fontclass \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
-
-% no font class
+\def\dofontclassstrategy#1#2#3#4#5%
+ {\ifcsname\fontclass#2#3#4#5\endcsname
+ #1\csname\fontclass#2#3#4#5\endcsname \tryingfontfalse
+ \fi}
-\appendtoks \fontstrategy \autofontsizefalse % --- --- --- --- % pt tt bf a
- \empty \fontbody \fontstyle \fontalternative \fontsize
-\to \fontstrategies
+\endETEX
-\appendtoks \fontstrategy \autofontsizetrue % --- --- --- def % pt tt bf
- \empty \fontbody \fontstyle \fontalternative \defaultfontsize
-\to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizefalse % --- --- --- --- % pt tt bf a
+ \fontbody \fontstyle \fontalternative \fontsize
+\fi \to \fontstrategies
-\appendtoks \fontstrategy \autofontsizetrue % --- --- def --- % pt tt tf a
- \empty \fontbody \fontstyle \defaultfontalternative \fontsize
-\to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- --- def % pt tt bf
+ \fontbody \fontstyle \fontalternative \defaultfontsize
+\fi \to \fontstrategies
-\appendtoks \fontstrategy \autofontsizetrue % --- --- def def % pt tt tf
- \empty \fontbody \fontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- def --- % pt tt tf a
+ \fontbody \fontstyle \defaultfontalternative \fontsize
+\fi \to \fontstrategies
-\appendtoks \fontstrategy \autofontsizefalse % --- def def def % pt rm tf
- \empty \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizetrue % --- --- def def % pt tt tf
+ \fontbody \fontstyle \defaultfontalternative \defaultfontsize
+\fi \to \fontstrategies
-\appendtoks \fontstrategy \autofontsizetrue % def def def def % rm tf
- \empty \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
-\to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizefalse % --- def def def % pt rm tf
+ \fontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
+\fi \to \fontstrategies
+\appendtoks \iftryingfont \fontstrategy \autofontsizetrue % def def def def % rm tf
+ \defaultfontbody \defaultfontstyle \defaultfontalternative \defaultfontsize
+\fi \to \fontstrategies
+
%D Let's synchronize:
\newif\ifsynchronizefonts \synchronizefontstrue
@@ -2699,7 +2719,7 @@
\def\dosetcurrentfontxxxalternative#1#2#3#4%
{\chardef\currentxfontsize=#2
\ifmmode
- #4%
+ #4%
\else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname
\setcurrentfontbodyalternative{\bodyfontcsname\normalizedbodyfontsize#3\endcsname}{#1}%
\fi\fi}
@@ -2716,10 +2736,10 @@
\let\txx\empty}
% This alterative is not really needed, but for old time's sake
-% we keep it there. We can speed it up when needed.
+% we keep it there. We can speed it up when needed.
-\def\setcurrentfontxstylealternative #1{\getvalue{#1}\tfx}
-\def\setcurrentfontxxstylealternative#1{\getvalue{#1}\tfxx}
+\def\setcurrentfontxstylealternative #1{\csname#1\endcsname\tfx}
+\def\setcurrentfontxxstylealternative#1{\csname#1\endcsname\tfxx}
%D These macros also show us that when we call for \type{\tx},
%D this macro is redefined to be \type{\txx}. Therefore calls
@@ -2770,7 +2790,7 @@
% check kan hier
\def\docommando##1%
{\setvalue{\@shortstyle@##1}{#2}%
- \setvalue{\@style@##1}{\getvalue{#2}}}%
+ \setvalue{\@style@##1}{\csname#2\endcsname}}%
\processcommalist[#1]\docommando}
\def\definefontstyle%
@@ -2872,9 +2892,9 @@
\globalbodyfontsize=\localbodyfontsize
\normalizebodyfontsize\globalbodyfontsize\to\normalizedglobalbodyfontsize
\let\globalfontstyle=\fontstyle
-\ifloadingfonts\else
- \the\everybodyfont
- \fi }} % indeed needed in case \dosetfont is not executed
+ \ifloadingfonts\else
+ \the\everybodyfont % indeed needed in case \dosetfont is not executed
+ \fi}}
\unexpanded\def\switchtobodyfont[#1]%
{\doifsomething{#1}
@@ -2884,6 +2904,41 @@
{\dosetfont0{#1}}%
\the\everybodyfont}} % indeed needed in case nothing is executed
+%D The following alternative is meant for math||to||text
+%D switching and will be optimized.
+
+\beginTEX
+
+\def\fastswitchtobodyfont#1%
+ {\ifcsname\??ft\normalizedbodyfontsize#1\endcsname
+ \edef\futurebodyfontsize
+ {\csname\??ft\normalizedbodyfontsize#1\endcsname}%
+ \ifcsname\@size@\futurebodyfontsize\endcsname
+ \csname\@size@\futurebodyfontsize\endcsname
+ \localbodyfontsize\futurebodyfontsize\relax
+ \fi
+ \fi
+ \csname\@style@\fontstyle\endcsname
+ \the\everybodyfont}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\fastswitchtobodyfont#1%
+ {\ifcsname\??ft\normalizedbodyfontsize#1\endcsname
+ \edef\futurebodyfontsize
+ {\csname\??ft\normalizedbodyfontsize#1\endcsname}%
+ \ifcsname\@size@\futurebodyfontsize\endcsname
+ \csname\@size@\futurebodyfontsize\endcsname
+ \localbodyfontsize\futurebodyfontsize\relax
+ \fi
+ \fi
+ \csname\@style@\fontstyle\endcsname
+ \the\everybodyfont}
+
+\endETEX
+
%D Because the last macro can appear in arguments or be assigned
%D to parameters, we protect this one for unwanted expansion.
@@ -2892,9 +2947,9 @@
% \doifdefinedelse{#1\s!fam} % adapted
% {\edef\mffam{\getvalue{#1\s!fam}}}
% {\edef\mffam{\getvalue{\c!nn\s!fam}}}%
- \textfont \mrfam=\textfont \mffam
- \scriptfont \mrfam=\scriptfont \mffam
- \scriptscriptfont\mrfam=\scriptscriptfont\mffam}
+ \textfont \mrfam\textfont \mffam
+ \scriptfont \mrfam\scriptfont \mffam
+ \scriptscriptfont\mrfam\scriptscriptfont\mffam}
\def\domffam#1%
{\csname\ifundefined{#1\s!fam}\c!nn\else#1\fi\s!fam\endcsname}
@@ -2908,35 +2963,57 @@
%D The font specific features are bound to the filename.
\def\updatefontparameters%
- {\edef\@@fontencoding{\truefontdata\fontfile \s!encoding}%
- \edef\@@fontmapping {\truefontdata\fontfile \s!mapping }%
- \edef\@@fonthandling{\truefontdata\somefontname\s!handling}%
+ {\edef\@@fontencoding{\truefontdata\fontfile \s!encoding}%
+ \edef\@@fontmapping {\truefontdata\fontfile \s!mapping }%
+ \edef\@@fonthandling{\truefontdata\somefontname\s!handling}%
\edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}}
+% \def\setfontcharacteristics%
+% {\updatefontparameters
+% \enableencoding
+% [\ifx\@@fontencoding\empty
+% \s!default
+% \else
+% \@@fontencoding
+% \fi]%
+% \enablemapping
+% [\ifx\@@fontmapping\empty
+% \ifx\@@fontencoding\empty
+% \s!default
+% \else
+% \@@fontencoding
+% \fi
+% \else
+% \@@fontmapping
+% \fi]%
+% \enablehandling
+% [\ifx\@@fonthandling\empty
+% \s!default
+% \else
+% \@@fonthandling
+% \fi][\lastfontidentifier]}
+
\def\setfontcharacteristics%
{\updatefontparameters
- \enableencoding
- [\ifx\@@fontencoding\empty
- \s!default
- \else
- \@@fontencoding
- \fi]%
- \enablemapping
- [\ifx\@@fontmapping\empty
+ \fastenableencoding
+ {\ifx\@@fontencoding\empty
+ \s!default \else \@@fontencoding
+ \fi}%
+ \fastenablemapping
+ {\ifx\@@fontmapping\empty
\ifx\@@fontencoding\empty
- \s!default
- \else
- \@@fontencoding
+ \s!default \else \@@fontencoding
\fi
\else
\@@fontmapping
- \fi]%
- \enablehandling
- [\ifx\@@fonthandling\empty
- \s!default
- \else
- \@@fonthandling
- \fi][\lastfontidentifier]}
+ \fi}%
+ \fastenablehandling
+ {\ifx\@@fonthandling\empty
+ \s!default \else \@@fonthandling
+ \fi}%
+ {\lastfontidentifier}%
+ \the\everyfont
+ \synchronizepatterns}
%D The next auxilliary macro is an alternative to \type
%D {\fontname}.
@@ -2965,7 +3042,7 @@
\def\complexswitchstyleonly[#1]% todo : check
{\setcurrentfontstyle{\getvalue{\@shortstyle@#1}}%
- \the\everybodyfont} % needed ?
+ \the\everybodyfont} % needed ?
%D \macros
%D {os}
@@ -3060,14 +3137,36 @@
\let\mainfontclass\empty
-\def\restoreglobalbodyfont%
- {\let\fontsize=\empty
+\def\fullrestoreglobalbodyfont
+ {\let\fontsize\empty
\let\fontclass\globalfontclass
- \doswitchstyle[\globalfontstyle]%
\doswitchpoints[\normalizedglobalbodyfontsize]%
+ \doswitchstyle[\globalfontstyle]%
\redoconvertfont % just in case a pagebreak occurs
\tf \the\everybodyfont}
+\def\partialrestoreglobalbodyfont
+ {\let\fontsize\empty
+ \redoconvertfont
+ \tf}
+
+\def\restoreglobalbodyfont % ook style etc
+ {\ifx\fontclass\globalfontclass
+ \ifx\fontstyle\globalfontstyle
+ \ifx\normalizedbodyfontsize\normalizedglobalbodyfontsize
+ \partialrestoreglobalbodyfont
+ \else
+ \fullrestoreglobalbodyfont
+ \fi
+ \else
+ \fullrestoreglobalbodyfont
+ \fi
+ \else
+ \fullrestoreglobalbodyfont
+ \fi}
+
+% in case of troubles: \let\restorebodyfont\fullrestoreglobalbodyfont
+
%D This macro has to be called when entering the pagebody
%D handling routine as well as the footnote insert routine.
%D Users can access this feature |<|for instance when one wants
@@ -3190,31 +3289,50 @@
%D \type{\noconvertfont}. In nested calls, we can restore the
%D conversion by saying \type{\redoconvertfont}.
-\unexpanded\def\dodoconvertfont#1#2%
- {\doifdefinedelse{\@letter@#1}
- {\doifelsenothing{#1}
- {\let\next=\empty}
- {\def\next{\getvalue{\@letter@#1}}}}
- {\doifdefinedelse{#1}
- {\def\next{\getvalue{#1}}}
- {\def\next{#1}}}%
- \next{#2}}
+% \unexpanded\def\dodoconvertfont#1#2%
+% {\doifdefinedelse{\@letter@#1}
+% {\doifelsenothing{#1}
+% {\let\next\empty}
+% {\def\next{\getvalue{\@letter@#1}}}}
+% {\doifdefinedelse{#1}
+% {\def\next{\getvalue{#1}}}
+% {\def\next{#1}}}%
+% \next{#2}}
+%
+% \let\doconvertfont=\dodoconvertfont
+%
+% \def\noconvertfont#1#2%
+% {\doifdefinedelse{\@noletter@#1}
+% {\doifelsenothing{#1}
+% {\let\next\empty}
+% {\def\next{\getvalue{\@noletter@#1}}}}
+% {\def\next{#1}}%
+% \next{#2}}
+
+\def\@@dodoconvertfont#1{\csname\@letter@ #1\endcsname}
+\def\@@donoconvertfont#1{\csname\@noletter@#1\endcsname}
+
+\unexpanded\def\dodoconvertfont#1% #2% we need the protection
+ {\doifdefinedelse{\@letter@#1} % in testing
+ {\doifelsenothing{#1}\gobbleoneargument\@@dodoconvertfont}
+ {\doifdefinedelse{#1}\getvalue \firstofoneargument}%
+ {#1}} % {#2}}
\let\doconvertfont=\dodoconvertfont
-\def\noconvertfont#1#2%
+\def\noconvertfont#1% #2%
{\doifdefinedelse{\@noletter@#1}
- {\doifelsenothing{#1}
- {\let\next=\empty}
- {\def\next{\getvalue{\@noletter@#1}}}}
- {\def\next{#1}}%
- \next{#2}}
+ {\doifelsenothing{#1}\gobbleoneargument\@@donoconvertfont}
+ {\firstofoneargument}%
+ {#1}} % {#2}}
+
+%D Extras:
\unexpanded\def\dontconvertfont%
- {\let\doconvertfont=\noconvertfont}
+ {\let\doconvertfont\noconvertfont}
\unexpanded\def\redoconvertfont%
- {\let\doconvertfont=\dodoconvertfont}
+ {\let\doconvertfont\dodoconvertfont}
%D These commands are not grouped! Grouping is most probably
%D done by the calling macro's and would lead to unnecessary
@@ -3292,7 +3410,7 @@
\let\setemphasisboldface\relax
\unexpanded\def\bf%
{%\relax
- \let\bf\relax % new
+ \let\bf\relax % new
\ifx\fontalternative\c!it % \ifnum\fam=\itfam
\bi
\else\ifx\fontalternative\c!sl % \ifnum\fam=\slfam
@@ -3337,7 +3455,7 @@
\def\dododoemphasiscorrection%
{\scratchskip=\lastskip
- \ifdim\scratchskip=\!!zeropoint\relax
+ \ifdim\scratchskip=\zeropoint\relax
\/\relax
\else
\unskip\/\hskip\scratchskip
@@ -3483,13 +3601,13 @@
%D \starttypen
%D \getglyph{fontname}{character}
%D \stoptypen
-%D
+%D
%D This macro is used in for instance the symbol modules and
%D as one can see, it does obey the small and even smaller
%D sizes. The \type {\symbolicfont} macro can be used to
%D switch to a font named \type {fontname} (see \type
%D {cont-log} and \type {symb-eur} for examples of symbolic
-%D definitions.
+%D definitions.
\def\fontstringA%
{\ifx\fontstyle\c!rm \s!Serif \else
@@ -3528,7 +3646,7 @@
\endETEX
-\beginTEX \ifcsname
+\beginTEX
\def\glyphfontfile#1%
{#1%
@@ -3545,13 +3663,32 @@
\endTEX
-\def\symbolicfont#1% see cont-log.tex for example usage
- {\definedfont[\glyphfontfile{#1} sa *]}
+%D For an example of usage of the following command,
+%D see \type {cont-log.tex}.
+%D
+%D \starttypen
+%D \def\symbolicfont#1%
+%D {\definedfont[\glyphfontfile{#1} sa *]}
+%D \stoptypen
+%D
+%D Since we know what scaling it to be applied, we can
+%D implement a much faster alternative:
+
+\def\symbolicfont#1%
+ {\scaledfont\fontbody
+ \font\definedfont\truefontname{\glyphfontfile{#1}} at
+ \currentfontbodyscale\scaledfont
+ \definedfont}
+
+\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}}
-\def\getglyph#1#2%
- %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}}
- %{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}}
- {{\symbolicfont{#1}#2}}
+\def\getrawglyph#1#2% for simple symbols
+ {{\scaledfont\fontbody
+ \font\definedfont=#1 at \currentfontbodyscale\scaledfont
+ \definedfont#2}}
%D The last implementation of \type {\getglyph} permits
%D definitions like:
@@ -3654,34 +3791,28 @@
%D hexadecimal format. Next we set the height of the accented
%D character to the natural height of the character.
-\def\dodosmashaccent#1%
- {\bgroup
- \setbox0=\hbox{#1}%
- \setbox2=\hbox{\normalaccent\scratchcounter#1}%
- \ht2=\ht0\box2
- \egroup
- \nobreak}
-
-\def\dosmashaccent%
- {\afterassignment\dodosmashaccent\expandafter\scratchcounter}
-
-\def\smashaccent%
+\def\smashaccent#1%
{\dontleavehmode
- \let\accent=\dosmashaccent}
+ \bgroup
+ \setbox\scratchbox\hbox{#1}%
+ \ifdim\ht\scratchbox>\strutheight \ht\scratchbox\strutheight \fi
+ \ifdim\dp\scratchbox>\strutdepth \dp\scratchbox\strutdepth \fi
+ \box\scratchbox
+ \egroup}
%D For instance we can say:
%D
%D \starttypen
-%D \smashaccent\"Uberhaupt
+%D \smashaccent{\"Uberhaupt}
%D \stoptypen
%D
%D But normally one will use it as a prefix in definitions.
%D The difference is in the height:
%D
%D \leavevmode\ruledhbox
-%D {\ruledhbox{\smashaccent\"Uberhaupt}\quad
+%D {\ruledhbox{\smashaccent{\"U}berhaupt}\quad
%D oder\quad
-%D \ruledhbox{\"Uberhaupt}}
+%D \ruledhbox{\"Uberhaupt}
%D \macros
%D {moveaccent}
@@ -3689,34 +3820,25 @@
%D Exact positioning of accents can be realized by saying:
%D
%D \starttypen
-%D \moveaccent{-.1ex}\"uberhaupt
+%D \moveaccent{-.1ex}{\"u}berhaupt
%D \stoptypen
%D
%D Again, this one will mostly used as a prefix in definitions.
%D Here the difference is in the position:
%D
%D \leavevmode\ruledhbox
-%D {\ruledhbox{\moveaccent{-.1ex}\"Uberhaupt}\quad
+%D {\ruledhbox{\moveaccent{-.1ex}{\"}Uberhaupt}\quad
%D oder\quad
%D \ruledhbox{\"Uberhaupt}}
-\def\dodomoveaccent#1%
- {\bgroup
- \dimen0=\fontdimen5\font
- \dimen2=\dimen0
- \advance\dimen2 by -\accentdisplacement
- \fontdimen5\font=\dimen2
- \normalaccent\scratchcounter#1\relax
- \fontdimen5\font=\dimen0
- \egroup}
-
-\def\domoveaccent%
- {\afterassignment\dodomoveaccent\expandafter\scratchcounter}
-
-\def\moveaccent#1%
- {\dontleavehmode
- \def\accentdisplacement{#1}%
- \let\accent=\domoveaccent}
+\def\moveaccent#1#2%
+ {\smashaccent
+ {\dimen0=\fontdimen5\font
+ \dimen2=\dimen0
+ \advance\dimen2 -#1%
+ \fontdimen5\font\dimen2
+ #2\relax
+ \fontdimen5\font\dimen0}}
%D Personally I think that using \TEX\ is complicated by the
%D way fonts are handled. Apart from the many encodings, we
@@ -3744,12 +3866,12 @@
\c!b=1.440,
\c!c=1.728,
\c!d=2.074,
- *=\currentfontscale, % wildcard
+ *=\currentfontscale, % wildcard
\c!x=0.8,
\c!xx=0.6,
\c!groot=1.2,
\c!klein=0.8,
- \c!interlinie=,
+ \c!interlinie=,
\c!em=\v!schuin]
\definebodyfontenvironment
@@ -3932,7 +4054,7 @@
%D
%D New or old?
-% tzt proper \define...
+% tzt proper \define...
\def\tfmath{\tf\mf\synchronizesymb}
\def\bfmath{\bf\mf\synchronizesymb}
diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex
index 26f224d91..0ed13e09e 100644
--- a/tex/context/base/font-run.tex
+++ b/tex/context/base/font-run.tex
@@ -178,11 +178,11 @@
\stopoverlay
\nointerlineskip
\vskip2pt
- \edef\ascii
- {name:~{\black\fontname\font}\quad
- encoding:~{\black\currentencoding}\quad
- mapping:~{\black\currentmapping}\quad
- handling:~{\black\fonthandling}}%
+ \edef\ascii % \noexpand needed for non etex
+ {name:~{\noexpand\black\fontname\font}\quad
+ encoding:~{\noexpand\black\currentencoding}\quad
+ mapping:~{\noexpand\black\currentmapping}\quad
+ handling:~{\noexpand\black\fonthandling}}%
\tf\hbox to 40em
{\blue\hfill\tinyfont\setstrut\strut\ascii}
\egroup
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
index e41a2f209..74f3073b6 100644
--- a/tex/context/base/hand-ini.tex
+++ b/tex/context/base/hand-ini.tex
@@ -83,8 +83,8 @@
\else
- \def\enableprotruding {\pdfprotrudechars=2 }
- \def\disableprotruding{\pdfprotrudechars=0 }
+ \def\enableprotruding {\pdfprotrudechars2\relax}
+ \def\disableprotruding{\pdfprotrudechars0\relax}
\appendtoks \disableprotruding \to \everyforgetall % Here or not here?
@@ -202,28 +202,119 @@
\def\enablehandling%
{\dodoubleempty\doenablehandling}
+%\def\doenablehandling[#1][#2]% handling / symbolic fontname
+% {\doifdefinedelse{\@fha@\@fha@#1}%
+% {\setprotrudingfactor
+% {\getvalue{\@fha@\@fha@#1\c!links}}
+% {\getvalue{\@fha@\@fha@#1\c!rechts}}%
+% \edef\fonthandling{\getvalue{\@fha@\@fha@#1}}%
+% \checkfonthandling{#2}%
+% \@EA\rawprocesscommalist\@EA[\fonthandling]\dodoenablehandling
+% \registerfonthandling{#2}}
+% {\edef\fonthandling{#1}% new
+% \dodoenablehandling{#1}}}
+%
+%\def\dodoenablehandling#1% weg met die @EA
+% {\doifdefined{\@fha@#1}{\@EA\the\csname\@fha@#1\endcsname}}
+%
+%\def\checkfonthandling#1%
+% {\doifelsevalue{#1\s!handling\c!file}{\purefontname\font}
+% \skipprotrudingdeftrue\skipprotrudingdeffalse}
+%
+%\def\registerfonthandling#1%
+% {%\ifskipprotrudingdef\else\message{#1->#2->\purefontname\font}\wait\fi
+% \setxvalue{#1\s!handling\c!file}{\purefontname\font}}
+%
+%\def\registerfonthandling#1%
+% {%\ifskipprotrudingdef\else\message{#1->#2->\purefontname\font}\wait\fi
+% \setxvalue{#1\s!handling\c!file}{\purefontname\font}}
+
\def\doenablehandling[#1][#2]% handling / symbolic fontname
- {\doifdefinedelse{\@fha@\@fha@#1}%
- {\setprotrudingfactor
- {\getvalue{\@fha@\@fha@#1\c!links}}
- {\getvalue{\@fha@\@fha@#1\c!rechts}}%
- \edef\fonthandling{\getvalue{\@fha@\@fha@#1}}%
- \checkfonthandling{#2}%
- \@EA\rawprocesscommalist\@EA[\fonthandling]\dodoenablehandling
- \registerfonthandling{#2}}
- {\edef\fonthandling{#1}% new
- \dodoenablehandling{#1}}}
+ {\fastenablehandling{#1}{#2}} % for the moment the same as:
+
+% fast one for font switch:
+
+% \def\fastenablehandling#1#2%
+% {\@EA\ifx\csname\@fha@\@fha@#1\endcsname\relax
+% \edef\fonthandling{#1}% new
+% \dodoenablehandling{#1}%
+% \else
+% \setprotrudingfactor
+% {\csname\@fha@\@fha@#1\c!links\endcsname}
+% {\csname\@fha@\@fha@#1\c!rechts\endcsname}%
+% \edef\fonthandling{\csname\@fha@\@fha@#1\endcsname}%
+% \checkfonthandling{#2}%
+% \@EA\rawprocesscommalist\@EA[\fonthandling]\dodoenablehandling
+% \registerfonthandling{#2}%
+% \fi}
+%
+% \def\dodoenablehandling#1%
+% {\@EA\ifx\csname\@fha@#1\endcsname\relax\else
+% \the\csname\@fha@#1\endcsname
+% \fi}
+
+\beginTEX
+
+\def\fastenablehandling#1%
+ {\def\askedfonthandling{#1}%
+ \@EA\ifx\csname\@fha@\@fha@\askedfonthandling\endcsname\relax
+ \expandafter\nofastenablehandling
+ \else
+ \expandafter\dofastenablehandling
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\fastenablehandling#1% also gets #2 passed
+ {\def\askedfonthandling{#1}%
+ \ifcsname\@fha@\@fha@\askedfonthandling\endcsname
+ \expandafter\dofastenablehandling
+ \else
+ \expandafter\nofastenablehandling
+ \fi}
+
+\endETEX
+
+\def\dofastenablehandling#1%
+ {\setprotrudingfactor
+ {\csname\@fha@\@fha@\askedfonthandling\c!links \endcsname}
+ {\csname\@fha@\@fha@\askedfonthandling\c!rechts\endcsname}%
+ \edef\fonthandling{\csname\@fha@\@fha@\askedfonthandling\endcsname}%
+ \checkfonthandling{#1}%
+ \@EA\rawprocesscommalist\@EA[\fonthandling]\dodoenablehandling
+ \registerfonthandling{#1}}
+
+\def\nofastenablehandling#1%
+ {\let\fonthandling\askedfonthandling
+ \dodoenablehandling\fonthandling}
+
+\beginTEX
\def\dodoenablehandling#1%
- {\doifdefined{\@fha@#1}{\@EA\the\csname\@fha@#1\endcsname}}
+ {\@EA\ifx\csname\@fha@#1\endcsname\relax\else
+ \the\csname\@fha@#1\endcsname
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\dodoenablehandling#1%
+ {\ifcsname\@fha@#1\endcsname
+ \the\csname\@fha@#1\endcsname
+ \fi}
+
+\endETEX
-\def\checkfonthandling#1%
- {\doifelsevalue{#1\s!handling\c!file}{\purefontname\font}
+\def\checkfonthandling#1% we need a fast compare
+ {\doifelsevalue{#1\s!handling\c!file}{\purefontname\font}
\skipprotrudingdeftrue\skipprotrudingdeffalse}
\def\registerfonthandling#1%
{%\ifskipprotrudingdef\else\message{#1->#2->\purefontname\font}\wait\fi
- \setxvalue{#1\s!handling\c!file}{\purefontname\font}}
+ \@EA\xdef\csname#1\s!handling\c!file\endcsname{\purefontname\font}}
%D \macros
%D {usehandling}
diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex
index c5df7b08c..dab280e85 100644
--- a/tex/context/base/java-fld.tex
+++ b/tex/context/base/java-fld.tex
@@ -162,15 +162,15 @@ function Vide_Fields ( Name ) % show only one field
function Toggle_Hide ( Name )
{ var v = this.getField(Name) ;
- if (v) { v.hidden = !v.hidden } }
+ if (v) { v.hidden = !v.hidden ; this.dirty = false } }
function Field_On ( Name )
{ v = this.getField(Name) ;
- if (v) { v.value = "On" } }
+ if (v) { v.value = "On" ; this.dirty = false } }
function Field_Off ( Name )
{ var v = this.getField(Name) ;
- if (v) { v.value = "Off" } }
+ if (v) { v.value = "Off" ; this.dirty = false } }
function Toggle_Value ( Name )
{ var v = this.getField(Name) ;
@@ -178,7 +178,8 @@ function Toggle_Value ( Name )
{ if (v.value=="On")
{ v.value = "Off" }
else
- { v.value = "On" } } }
+ { v.value = "On" } }
+ this.dirty = false }
function Toggle_Read ( Name )
{ var v = this.getField(Name);
diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex
index ebe9698a6..d89b14a89 100644
--- a/tex/context/base/java-ini.tex
+++ b/tex/context/base/java-ini.tex
@@ -444,7 +444,7 @@
\ifoneJSpreamble
\gdef\allJSpreambles{collected}%
\fi
- \global\let\presetJSpreamble=\relax
+ \global\let\presetJSpreamble\relax
\egroup
\fi}
@@ -454,13 +454,13 @@
\bgroup
\presetJSpreamble
\expanded{\doflushJSpreamble{\allJSpreambles}}%
- \global\let\flushJSpreamble=\relax
- \global\let\allJSpreambles=\empty
+ \global\let\flushJSpreamble\relax
+ \global\let\allJSpreambles\empty
\egroup
\fi\fi
\fi\fi}
-\def\finalflushJSpreamble% kan direct in \everylastshipout, testen
+\def\finalflushJSpreamble
{\iflocation
\flushJSpreamble
\ifcase\currentJSpreamble\relax\else
@@ -623,7 +623,7 @@
%D Hooking this mechanism into the general \CONTEXT\ reference
%D mechanism does not take much effort:
-\definespecialtest{JS}
+\definespecialtest{JS}%
{\doifdefinedelse{\r!java\currentreferenceoperation}}
\definespeciallocation{JS}#1#2%
@@ -638,9 +638,7 @@
\data
{#2}%
\start
- \dostartgotoJS
- {\number\buttonwidth}{\number\buttonheight}
- {\JScode}%
+ \dostartgotoJS\buttonwidth\buttonheight\JScode
\stop
\dostopgotoJS
\dostopgoto
diff --git a/tex/context/base/lang-alt.tex b/tex/context/base/lang-alt.tex
index 815fa570c..f2192936e 100644
--- a/tex/context/base/lang-alt.tex
+++ b/tex/context/base/lang-alt.tex
@@ -44,16 +44,16 @@
\setupheadtext [\s!tr] [\v!inhoud=Fihrist]
\setupheadtext [\s!tr] [\v!tabellen=Tablolar]
-\setupheadtext [\s!tr] [\v!figuren=\c{S}ekiller]
+\setupheadtext [\s!tr] [\v!figuren=\Scedilla ekiller]
\setupheadtext [\s!tr] [\v!grafieken=Grafikler]
\setupheadtext [\s!tr] [\v!intermezzos=...]
-\setupheadtext [\s!tr] [\v!index=\.Index]
-\setupheadtext [\s!tr] [\v!afkortingen=K\i saltmalar]
+\setupheadtext [\s!tr] [\v!index=\Idotaccent ndex]
+\setupheadtext [\s!tr] [\v!afkortingen=K\dotlessi saltmalar]
\setupheadtext [\s!tr] [\v!logos=Logolar]
\setupheadtext [\s!tr] [\v!eenheden=Birimler]
\setuplabeltext [\s!tr] [\v!tabel=Tablo ]
-\setuplabeltext [\s!tr] [\v!figuur=\c{S}ekil ]
+\setuplabeltext [\s!tr] [\v!figuur=\Scedilla ekil ]
\setuplabeltext [\s!tr] [\v!intermezzo=... ]
\setuplabeltext [\s!tr] [\v!grafiek=Grafik ]
\setuplabeltext [\s!tr] [\v!hoofdstuk=] % [\v!hoofdstuk=Konu ]
@@ -63,27 +63,27 @@
\setuplabeltext [\s!tr] [\v!sub\v!sub\v!sub\v!paragraaf=]
\setuplabeltext [\s!tr] [\v!bijlage=] % [\v!bijlage=Ek ]
\setuplabeltext [\s!tr] [\v!deel=Cilt ]
-\setuplabeltext [\s!tr] [\v!regel=sat\i r ]
-\setuplabeltext [\s!tr] [\v!regels=sat\i rlar ]
+\setuplabeltext [\s!tr] [\v!regel=sat\dotlessi r ]
+\setuplabeltext [\s!tr] [\v!regels=sat\dotlessi rlar ]
\setuplabeltext [\s!tr] [\v!january=ocak]
-\setuplabeltext [\s!tr] [\v!february=\c{s}ubat]
+\setuplabeltext [\s!tr] [\v!february=\Scedilla ubat]
\setuplabeltext [\s!tr] [\v!march=mart]
\setuplabeltext [\s!tr] [\v!april=nisan]
-\setuplabeltext [\s!tr] [\v!may=may\i s]
+\setuplabeltext [\s!tr] [\v!may=may\dotlessi s]
\setuplabeltext [\s!tr] [\v!june=haziran]
\setuplabeltext [\s!tr] [\v!july=temmuz]
-\setuplabeltext [\s!tr] [\v!august=a\u{g}ustos]
-\setuplabeltext [\s!tr] [\v!september=eyl\"ul]
+\setuplabeltext [\s!tr] [\v!august=a\gbreve ustos]
+\setuplabeltext [\s!tr] [\v!september=eyl\udiaeresis l]
\setuplabeltext [\s!tr] [\v!october=ekim]
-\setuplabeltext [\s!tr] [\v!november=kas\i m]
-\setuplabeltext [\s!tr] [\v!december=aral\i k]
+\setuplabeltext [\s!tr] [\v!november=kas\dotlessi m]
+\setuplabeltext [\s!tr] [\v!december=aral\dotlessi k]
\setuplabeltext [\s!tr] [\v!sunday=pazar]
\setuplabeltext [\s!tr] [\v!monday=pazartesi]
-\setuplabeltext [\s!tr] [\v!tuesday=sal\i]
-\setuplabeltext [\s!tr] [\v!wednesday=\c{c}ar\c{s}amba]
-\setuplabeltext [\s!tr] [\v!thursday=per\c{s}embe]
+\setuplabeltext [\s!tr] [\v!tuesday=sal\dotlessi]
+\setuplabeltext [\s!tr] [\v!wednesday=\ccedilla ar\scedilla amba]
+\setuplabeltext [\s!tr] [\v!thursday=per\scedilla embe]
\setuplabeltext [\s!tr] [\v!friday=cuma]
\setuplabeltext [\s!tr] [\v!saturday=cumartesi]
diff --git a/tex/context/base/lang-ger.tex b/tex/context/base/lang-ger.tex
index 3b90f5cbe..d02ddc2f9 100644
--- a/tex/context/base/lang-ger.tex
+++ b/tex/context/base/lang-ger.tex
@@ -289,13 +289,12 @@
% \definesortkey {\o}{z} {c}{\o}
% \definesortkey {\O}{z} {c}{\O}
% \definesortkey {\aa}{z}{d}{\aa}
+% \definesortkey {\aring}{z}{d}{\aring}
% \definesortkey {\AA}{z}{d}{\AA}
+% \definesortkey {\Aring}{z}{d}{\Aring}
%
% \stoplanguagespecifics
%
-% Active characters - just for texnansi encoding now.
-% Will the other encodings be the same?
-%
% \startencoding[texnansi]
% \startlanguagespecifics[\s!no]%
% \defineactivecharacter æ {\ae{}}
@@ -311,7 +310,7 @@
\setupheadtext [\s!nl] [\v!inhoud=Inhoud]
\setupheadtext [\s!de] [\v!inhoud=Inhalt]
\setupheadtext [\s!da] [\v!inhoud=Indhold]
-\setupheadtext [\s!sv] [\v!inhoud=Inneh\aa l]
+\setupheadtext [\s!sv] [\v!inhoud=Inneh\aring l]
\setupheadtext [\s!af] [\v!inhoud=Inhoud]
\setupheadtext [\s!no] [\v!inhoud=Innhold]
@@ -357,9 +356,9 @@
\setupheadtext [\s!en] [\v!afkortingen=Abbreviations]
\setupheadtext [\s!nl] [\v!afkortingen=Afkortingen]
-\setupheadtext [\s!de] [\v!afkortingen=Abk\"urzungen]
+\setupheadtext [\s!de] [\v!afkortingen=Abk\uumlaut rzungen]
\setupheadtext [\s!da] [\v!afkortingen=Forkortelser]
-\setupheadtext [\s!sv] [\v!afkortingen=F\"orkortningen]
+\setupheadtext [\s!sv] [\v!afkortingen=F\oumlaut rkortningen]
\setupheadtext [\s!af] [\v!afkortingen=Afkortings]
\setupheadtext [\s!no] [\v!afkortingen=Forkortelser]
@@ -472,7 +471,7 @@
\setuplabeltext [\s!de] [\v!regel=Zeile ]
\setuplabeltext [\s!da] [\v!regel=linie ] % or linje
\setuplabeltext [\s!sv] [\v!regel=rad ]
-\setuplabeltext [\s!af] [\v!regel=re\"el ]
+\setuplabeltext [\s!af] [\v!regel=re\ediaeresis l ]
\setuplabeltext [\s!no] [\v!regel=linje ]
\setuplabeltext [\s!en] [\v!regels=lines ]
@@ -480,7 +479,7 @@
\setuplabeltext [\s!de] [\v!regels=Zeilen ]
\setuplabeltext [\s!da] [\v!regels=linier ] % or linjer
\setuplabeltext [\s!sv] [\v!regels=raden ]
-\setuplabeltext [\s!af] [\v!regels=re\"els ]
+\setuplabeltext [\s!af] [\v!regels=re\ediaeresis ls ]
\setuplabeltext [\s!no] [\v!regels=linjer ]
\setuplabeltext [\s!en] [\v!january=January]
@@ -511,7 +510,7 @@
\setuplabeltext [\s!de] [\v!january=Januar]
\setuplabeltext [\s!de] [\v!february=Februar]
-\setuplabeltext [\s!de] [\v!march=M\"arz]
+\setuplabeltext [\s!de] [\v!march=M\aumlaut rz]
\setuplabeltext [\s!de] [\v!april=April]
\setuplabeltext [\s!de] [\v!may=Mai]
\setuplabeltext [\s!de] [\v!june=Juni]
@@ -598,21 +597,21 @@
\setuplabeltext [\s!de] [\v!friday=Freitag]
\setuplabeltext [\s!de] [\v!saturday=Samstag]
-\setuplabeltext [\s!da] [\v!sunday=s\o ndag]
+\setuplabeltext [\s!da] [\v!sunday=s\ostroke ndag]
\setuplabeltext [\s!da] [\v!monday=mandag]
\setuplabeltext [\s!da] [\v!tuesday=tirsdag]
\setuplabeltext [\s!da] [\v!wednesday=onsdag]
\setuplabeltext [\s!da] [\v!thursday=torsdag]
\setuplabeltext [\s!da] [\v!friday=fredag]
-\setuplabeltext [\s!da] [\v!saturday=l\o rdag]
+\setuplabeltext [\s!da] [\v!saturday=l\ostroke rdag]
-\setuplabeltext [\s!sv] [\v!sunday=s\"ondag]
-\setuplabeltext [\s!sv] [\v!monday=m\aa ndag]
+\setuplabeltext [\s!sv] [\v!sunday=s\oumlaut ndag]
+\setuplabeltext [\s!sv] [\v!monday=m\aring ndag]
\setuplabeltext [\s!sv] [\v!tuesday=tisdag]
\setuplabeltext [\s!sv] [\v!wednesday=onsdag]
\setuplabeltext [\s!sv] [\v!thursday=torsdag]
\setuplabeltext [\s!sv] [\v!friday=fredag]
-\setuplabeltext [\s!sv] [\v!saturday=l\"ordag]
+\setuplabeltext [\s!sv] [\v!saturday=l\oumlaut rdag]
\setuplabeltext [\s!af] [\v!sunday=sondag]
\setuplabeltext [\s!af] [\v!monday=maandag]
@@ -622,13 +621,13 @@
\setuplabeltext [\s!af] [\v!friday=vrydag]
\setuplabeltext [\s!af] [\v!saturday=saterdag]
-\setuplabeltext [\s!no] [\v!sunday=s\o ndag]
+\setuplabeltext [\s!no] [\v!sunday=s\ostroke ndag]
\setuplabeltext [\s!no] [\v!monday=mandag]
\setuplabeltext [\s!no] [\v!tuesday=tirsdag]
\setuplabeltext [\s!no] [\v!wednesday=onsdag]
\setuplabeltext [\s!no] [\v!thursday=torsdag]
\setuplabeltext [\s!no] [\v!friday=fredag]
-\setuplabeltext [\s!no] [\v!saturday=l\o rdag]
+\setuplabeltext [\s!no] [\v!saturday=l\ostroke rdag]
%D Rather new ...
@@ -651,13 +650,13 @@
\setuplabeltext [\s!de] [\v!zie=siehe ]
\setuplabeltext [\s!da] [\v!pagina=Side ]
-\setuplabeltext [\s!da] [\v!oppagina=p\aa\ side ]
+\setuplabeltext [\s!da] [\v!oppagina=p\aring\ side ]
\setuplabeltext [\s!da] [\v!hierboven=se foroven]
\setuplabeltext [\s!da] [\v!hieronder=se forneden]
\setuplabeltext [\s!da] [\v!zie=se ]
\setuplabeltext [\s!no] [\v!pagina=Side ]
-\setuplabeltext [\s!no] [\v!oppagina=p\aa\ side ]
+\setuplabeltext [\s!no] [\v!oppagina=p\aring\ side ]
\setuplabeltext [\s!no] [\v!hierboven=se foroven]
\setuplabeltext [\s!no] [\v!hieronder=se forneden]
\setuplabeltext [\s!no] [\v!zie=se ]
diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex
index a94b41c5b..0aee0de61 100644
--- a/tex/context/base/lang-ini.tex
+++ b/tex/context/base/lang-ini.tex
@@ -8,8 +8,8 @@
%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 This module implements the (for the moment still simple)
%D multi||language support of \CONTEXT, which should not be
@@ -31,7 +31,7 @@
7: taal specifieke opties [--] introduceren een skip van --
8: taal specifieke opties [--] naadloos toegevoegd
9: taal -- is actief
- 10: patronen --geladen
+ 10: patronen --geladen
\stopmessages
\startmessages english library: linguals
@@ -59,10 +59,10 @@
7: Sprachenspezifische Option [--] fuegt eine Luecke von -- ein
8: Sprachenspezifische Option [--] nahtlos hinzugefuegt
9: Sprache -- ist aktiv
- 10: Trennmuster --geladen
+ 10: Trennmuster --geladen
\stopmessages
-% TOM: 9 and 10
+% TOM: 9 and 10
\startmessages czech library: linguals
title: jazyky
@@ -75,7 +75,7 @@
7: specificke volby jazyka [--] zavadeji -- (zavlecenou) mezeru
8: specificke volby jazyka [--] bez mezer pripojeny
9: language -- is active
- 10: vzory --nacteny
+ 10: vzory --nacteny
\stopmessages
\startmessages italian library: linguals
@@ -143,17 +143,19 @@
\newcounter\loadedlanguage
%D \macros
-%D {currentlanguage, setcurrentlanguage}
+%D {currentlanguage, setupcurrentlanguage}
%D
%D Instead of numbers,we are going to use symbolic names for
%D the languages. The current langage is saved in the macro
-%D \type {\currentlanguage}. The setup macro is mainly used
-%D for cosmetic purposes.
+%D \type {\currentlanguage}. The setup macro is mainly used
+%D for cosmetic purposes.
-\let\currentlanguage=\empty
+\let\currentlanguage \empty
+\let\currentmainlanguage\empty
-\def\setupcurrentlanguage[#1]%
- {\edef\currentlanguage{#1}}
+\def\setupcurrentlanguage[#1]{\def\currentlanguage{#1}}
+
+%D The internal macros will be defined later.
%D \macros
%D {installlanguage}
@@ -187,19 +189,19 @@
%D implementations support run time addition of patterns to a
%D preloaded format).
-\def\dodoinstalllanguage#1#2% #2 added
- {\doifundefined{#1}{\setvalue{#1}{\language[#2]}}%
+\def\dodoinstalllanguage#1#2% #2 added
+ {\doifundefined{#1}{\setvalue{#1}{\complexlanguage[#2]}}%
\expanded{\noexpand\uppercase{\noexpand\edef\noexpand\ascii{#1}}}%
- \doifundefined{\ascii}{\setvalue{\ascii}{\language[#2]}}}
+ \doifundefined{\ascii}{\setvalue{\ascii}{\complexlanguage[#2]}}}
%D \macros
%D {preloadlanguages}
%D
-%D We first try to load the files defined as file synonym
+%D We first try to load the files defined as file synonym
%D for \type {lang-*.pat} and \type {lang-*.hyp}. After that we
-%D fall back on those files. The macro \type {\preloadpatterns}
-%D reports which patterns are loaded and what hyphenmin
-%D values are set.
+%D fall back on those files. The macro \type {\preloadpatterns}
+%D reports which patterns are loaded and what hyphenmin
+%D values are set.
\let\preloadedpatterns\empty
@@ -208,12 +210,13 @@
-#1-%
\getvalue{\??la#1\s!righthyphenmin} }
-\def\preloadlanguages%
+\def\preloadlanguages%
{\doifsomething{\preloadedpatterns}
{\showmessage{\m!linguals}{10}{\preloadedpatterns}}}
\def\doinstalllanguage[#1][#2]%
- {\ConvertConstantAfter\doifinstringelse{=}{#2}
+ {%\ConvertConstantAfter\doifinstringelse{=}{#2}
+ \doifassignmentelse{#2}
{\doifdefinedelse{\??la#1\c!status}
{\getparameters[\??la#1][#2]}
{\setvalue{\l!prefix!#1}{#1}%
@@ -231,9 +234,9 @@
\c!rightquote=\upperrightsingleninequote,
\c!leftquotation=\upperleftdoublesixquote,
\c!rightquotation=\upperrightdoubleninequote,
- \c!leftspeech=\getvalue{\??la#1\c!leftquotation},
-\c!middlespeech=,
- \c!rightspeech=\getvalue{\??la#1\c!rightquotation},
+ \c!leftspeech=\getvalue{\??la#1\c!leftquotation},
+ \c!middlespeech=,
+ \c!rightspeech=\getvalue{\??la#1\c!rightquotation},
\c!datum={\v!jaar,\ ,\v!maand,\ ,\v!dag},
\c!status=\v!stop,
\c!default=,
@@ -256,9 +259,9 @@
\c!rightquote=\languagedefault{#1}\c!rightquote,
\c!leftquotation=\languagedefault{#1}\c!leftquotation,
\c!rightquotation=\languagedefault{#1}\c!rightquotation,
- \c!leftspeech=\languagedefault{#1}\c!leftspeech,
-\c!middlespeech=\languagedefault{#1}\c!middlespeech,
- \c!rightspeech=\languagedefault{#1}\c!rightspeech,
+ \c!leftspeech=\languagedefault{#1}\c!leftspeech,
+ \c!middlespeech=\languagedefault{#1}\c!middlespeech,
+ \c!rightspeech=\languagedefault{#1}\c!rightspeech,
\c!datum=\languagedefault{#1}\c!datum,
\s!mapping=\languagedefault{#1}\s!mapping,
\s!encoding=\languagedefault{#1}\s!encoding,
@@ -281,18 +284,18 @@
\showmessage{\m!linguals}{3}{\languagesuffix,#1,\loadedlanguage}%
\egroup}}
{\showmessage{\m!linguals}{5}{#1}}}
- {\setvalue{\l!prefix!#1}{#2}%
+ {\setvalue{\l!prefix!#1}{#2}%
\dodoinstalllanguage{#1}{#2}}}
-% ^^ \language[#1] gave unwanted side effect of loading language specifics
+% ^^ \language[#1] gave unwanted side effect of loading language specifics
\def\installlanguage%
{\dodoubleargument\doinstalllanguage}
-%D When the second argument is a language identifier, a
-%D synonym is created. This feature is present because we
-%D used dutch mnemonics in the dutch version, but nowadays
-%D conform a standard.
+%D When the second argument is a language identifier, a
+%D synonym is created. This feature is present because we
+%D used dutch mnemonics in the dutch version, but nowadays
+%D conform a standard.
\let \patternencoding \s!default
\let \patternmapping \s!default
@@ -316,10 +319,10 @@
\let\normalpatterns\patterns
\def\dodoloadpatterns#1#2#3#4%
- {\normallanguage=\loadedlanguage
-% \letvalue{\??la\??la#2}=\loadedlanguage
+ {\normallanguage\loadedlanguage
+% \letvalue{\??la\??la#2}\loadedlanguage
\bgroup
- \scratchtoks=\everyjob % we don't want additional junk put there
+ \scratchtoks\everyjob % we don't want additional junk put there
\let\showpatterns\relax
\startencoding[#3]%
\enablemapping[#4]%
@@ -350,10 +353,10 @@
\egroup
\increment\loadedlanguage}
-%D \macros
+%D \macros
%D {setuplanguage}
%D
-%D Quick and dirty, but useful:
+%D Quick and dirty, but useful:
%D
%D \showsetup{\y!setuplanguage}
@@ -361,8 +364,8 @@
{\dodoubleargument\dosetuplanguage}
\def\dosetuplanguage[#1][#2]%
- {\getparameters[\??la#1][#2]% % we need to make sure
- \doif{#1}{\currentlanguage}{\language[#1]}} % that settings apply
+ {\getparameters[\??la#1][#2]%
+ \doif{#1}{\currentlanguage}{\docomplexlanguage}}
%D The values \type {\c!leftsentence} and \type
%D {\c!rightsentence} can be (and are) used to implement
@@ -408,7 +411,7 @@
%D \stoptypen
%D
%D is a valid operation, where the relation between number
-%D and language depends on the order in installing languages.
+%D and language depends on the order in installing languages.
%D
%D \showsetup{\y!language}
%D \showsetup{\y!mainlanguage}
@@ -422,40 +425,61 @@
%D We take care of local as well as standardized language
%D switching (fr and fa, de and du, but nl and nl).
-% new, encoding specific patterns
+% new, encoding specific patterns
\ifx\synchronizepatterns\undefined \let\synchronizepatterns\relax \fi
-\def\dosetnormallanguage#1#2#3#4%
- {\doifdefinedelse{\??la\??la#2#3}
- {\doifelsevaluenothing{\??la\??la#2#3}
- {#4}
- {\donetrue
- \setxvalue{\??la#1\s!patterns}{#3}%
- \normallanguage=\getvalue{\??la\??la#2#3}\relax}} % \relax is needed for lookahead problems
- {#4}}
-
-\def\setnormallanguage#1#2%
- {\dosetnormallanguage{#1}{:\currentencoding:\currentmapping:}{#2}{%
- \dosetnormallanguage{#1}{:\currentencoding:\s!default :}{#2}{%
- \dosetnormallanguage{#1}{:\s!default :\currentmapping:}{#2}{%
- \dosetnormallanguage{#1}{:\s!default :\s!default :}{#2}{}}}}}
-
+%\def\dosetnormallanguage#1#2#3#4%
+% {\doifdefinedelse{\??la\??la#2#3}
+% {\doifelsevaluenothing{\??la\??la#2#3}
+% {#4}
+% {\donetrue
+% \setxvalue{\??la#1\s!patterns}{#3}%
+% \normallanguage=\getvalue{\??la\??la#2#3}\relax}} % \relax is needed for lookahead problems
+% {#4}}
%
-
+% because this macro is called often, we optimize 'm
+%
+% \def\dosetnormallanguage#1#2#3%
+% {\@EA\ifx\csname\??la\??la#2#3\endcsname\relax
+% \@EA\firstofoneargument
+% \else\@EA\ifx\csname\??la\??la#2#3\endcsname\empty
+% \@EAEAEA\firstofoneargument
+% \else
+% \donetrue
+% \global\expandafter\xdef\csname\??la#1\s!patterns\endcsname{#3}%
+% \normallanguage\csname\??la\??la#2#3\endcsname\relax % \relax is needed for lookahead problems
+% \@EAEAEA\gobbleoneargument
+% \fi\fi}
+%
+% \def\setnormallanguage#1#2%
+% {\dosetnormallanguage{#1}{:\currentencoding:\currentmapping:}{#2}{%
+% \dosetnormallanguage{#1}{:\currentencoding:\s!default :}{#2}{%
+% \dosetnormallanguage{#1}{:\s!default :\currentmapping:}{#2}{%
+% \dosetnormallanguage{#1}{:\s!default :\s!default :}{#2}{}}}}}
+%
% \def\docomplexlanguage[#1]%
% {\donefalse
-% \setnormallanguage{#1}{\getvalue{\??la#1\s!patterns}}%
+% % \def\synchronizepatterns{\setnormallanguage
+% % {#1}{\getvalue{\??la#1\s!patterns}}}%
+% % called often, so :
+% \def\synchronizepatterns{\setnormallanguage
+% {#1}{\csname\??la#1\s!patterns\endcsname}}%
+% \synchronizepatterns
% \ifdone\else
-% \setnormallanguage{#1}{#1}%
+% \def\synchronizepatterns{\setnormallanguage{#1}{#1}}%
+% \synchronizepatterns
% \ifdone\else
% \doifvaluesomething{\??la#1\c!default}
-% {\setnormallanguage{#1}{\getvalue{\??la\defaultlanguage{#1}\s!patterns}}%
+% {\def\synchronizepatterns{\setnormallanguage
+% {#1}{\getvalue{\??la\defaultlanguage{#1}\s!patterns}}}%
+% \synchronizepatterns
% \ifdone\else
% \setnormallanguage{#1}{\defaultlanguage{#1}}%
+% \synchronizepatterns
% \fi}%
% \fi
-% \fi
+% \fi
% \edef\currentlanguage{#1}%
% \enablelanguagespecifics[#1]%
% \enablemapping[\getvalue{\??la#1\s!mapping}]%
@@ -467,73 +491,177 @@
% \v!ruim=>\nonfrenchspacing,
% \s!unknown=>\frenchspacing]}
-\def\docomplexlanguage[#1]%
- {\donefalse
+\beginTEX
+
+\def\dosetnormallanguage#1#2%
+ {\@EA\ifx\csname\??la\??la#1#2\endcsname\relax
+ \@EA\firstofoneargument
+ \else\@EA\ifx\csname\??la\??la#1#2\endcsname\empty
+ \@EAEAEA\firstofoneargument
+ \else
+ \donetrue
+ \global\@EA\xdef\csname\??la\currentlanguage\s!patterns\endcsname{#2}%
+ \normallanguage\csname\??la\??la#1#2\endcsname\relax % \relax is needed for lookahead problems
+ \@EAEAEA\gobbleoneargument
+ \fi\fi}
+
+\endTEX
+
+\beginETEX
+
+\def\dosetnormallanguage#1#2%
+ {\ifcsname\??la\??la#1#2\endcsname
+ \edef\thenormallanguage{\csname\??la\??la#1#2\endcsname}%
+ \ifx\thenormallanguage\empty
+ \@EAEAEA\firstofoneargument
+ \else
+ \donetrue
+ \global\@EA\xdef\csname\??la\currentlanguage\s!patterns\endcsname{#2}%
+ \normallanguage\thenormallanguage\relax % \relax is needed for lookahead problems
+ \@EAEAEA\gobbleoneargument
+ \fi
+ \else
+ \@EA\firstofoneargument
+ \fi}
+
+\endETEX
+
+\def\setnormallanguage#1%
+ {\dosetnormallanguage{:\currentencoding:\currentmapping:}{#1}{%
+ \dosetnormallanguage{:\currentencoding:\s!default :}{#1}{%
+ \dosetnormallanguage{:\s!default :\currentmapping:}{#1}{%
+ \dosetnormallanguage{:\s!default :\s!default :}{#1}{}}}}}
+
+\def\docomplexlanguage% assumes that \currentlanguage is set
+ {\edef\currentdefaultlanguage{\defaultlanguage\currentlanguage}%
\def\synchronizepatterns{\setnormallanguage
- {#1}{\getvalue{\??la#1\s!patterns}}}%
+ {\csname\??la\currentlanguage\s!patterns\endcsname}}% called often
+ \donefalse
\synchronizepatterns
\ifdone\else
- \def\synchronizepatterns{\setnormallanguage{#1}{#1}}%
+ \def\synchronizepatterns{\setnormallanguage\currentlanguage}%
\synchronizepatterns
\ifdone\else
- \doifvaluesomething{\??la#1\c!default}
- {\def\synchronizepatterns{\setnormallanguage
- {#1}{\getvalue{\??la\defaultlanguage{#1}\s!patterns}}}%
- \synchronizepatterns
- \ifdone\else
- \setnormallanguage{#1}{\defaultlanguage{#1}}%
- \synchronizepatterns
- \fi}%
+ \ifx\currentdefaultlanguage\empty\else
+ \def\synchronizepatterns{\setnormallanguage
+ {\csname\??la\currentdefaultlanguage\s!patterns\endcsname}}%
+ \synchronizepatterns
+ \ifdone\else
+ \setnormallanguage\currentdefaultlanguage
+ \synchronizepatterns
+ \fi
+ \fi
\fi
- \fi
- \edef\currentlanguage{#1}%
- \enablelanguagespecifics[#1]%
- \enablemapping[\getvalue{\??la#1\s!mapping}]%
- \lefthyphenmin =0\getvalue{\??la#1\s!lefthyphenmin}\relax
- \righthyphenmin=0\getvalue{\??la#1\s!righthyphenmin}\relax
- \processaction
- [\getvalue{\??la#1\c!spatiering}]
- [\v!opelkaar=>\frenchspacing,
- \v!ruim=>\nonfrenchspacing,
- \s!unknown=>\frenchspacing]}
+ \fi
+ \enablelanguagespecifics[\currentlanguage]%
+% strange, what is this doing here, dangerous for {il2,ec}
+% \edef\languagemapping{\csname\??la\currentlanguage\s!mapping\endcsname}%
+% \ifx\languagemapping\empty\else
+% \fastenablemapping\languagemapping
+% \fi
+ \lefthyphenmin 0\csname\??la\currentlanguage\s!lefthyphenmin \endcsname
+ \righthyphenmin0\csname\??la\currentlanguage\s!righthyphenmin\endcsname\relax
+ % will be definable
+ \doifelsevalue{\??la\currentlanguage\c!spatiering}\v!ruim
+ \nonfrenchspacing\frenchspacing}
+
+\beginETEX
+
+\def\complexlanguage[#1]%
+ {\edef\askedlanguage{#1}%
+ \ifx\askedlanguage\empty \else
+ \ifcsname\l!prefix!\askedlanguage\endcsname
+ \edef\askedlanguage{\csname\l!prefix!\askedlanguage\endcsname}%
+ \ifx\currentlanguage\askedlanguage \else
+ \let\currentlanguage\askedlanguage
+ \docomplexlanguage
+ \fi
+ \else
+ \showmessage\m!linguals6{#1}%
+ \fi
+ \fi}
+
+\endETEX
+
+\beginTEX
\def\complexlanguage[#1]%
- {\doifdefinedelse{\l!prefix!#1}
- {\expanded{\docomplexlanguage[\getvalue{\l!prefix!#1}]}}
- {\showmessage{\m!linguals}{6}{#1}}}
+ {\edef\askedlanguage{#1}%
+ \ifx\askedlanguage\empty \else
+ \@EA\ifx\csname\l!prefix!\askedlanguage\endcsname\relax
+ \showmessage\m!linguals6{#1}%
+ \else
+ \edef\askedlanguage{\csname\l!prefix!\askedlanguage\endcsname}%
+ \ifx\currentlanguage\askedlanguage \else
+ \let\currentlanguage\askedlanguage
+ \docomplexlanguage
+ \fi
+ \fi
+ \fi}
-\def\simplelanguage%
- {\normallanguage}
+\endTEX
+
+\let\simplelanguage\normallanguage
\definecomplexorsimple\language
-\let\currentmainlanguage=\empty
+\beginETEX
+
+\def\mainlanguage[#1]%
+ {\edef\askedlanguage{#1}%
+ \ifx\askedlanguage\empty \else
+ \ifcsname\l!prefix!\askedlanguage\endcsname
+ \edef\askedlanguage{\csname\l!prefix!\askedlanguage\endcsname}%
+ \ifx\currentmainlanguage\askedlanguage \else
+ \let\currentmainlanguage\askedlanguage
+ \let\currentlanguage\askedlanguage
+ \docomplexlanguage
+ \fi
+ \fi
+ \fi}
+
+\endETEX
-%\def\mainlanguage[#1]%
-% {\edef\currentmainlanguage{#1}} % We expand indeed!
+\beginTEX
\def\mainlanguage[#1]%
- {\doifsomething{#1}
- {\doifdefined{\l!prefix!#1}
- {\@EA\let\@EA\currentmainlanguage\csname\l!prefix!#1\endcsname
- \language[#1]}}}
+ {\edef\askedlanguage{#1}%
+ \ifx\askedlanguage\empty \else
+ \@EA\ifx\csname\l!prefix!\askedlanguage\endcsname\relax\else
+ \edef\askedlanguage{\csname\l!prefix!\askedlanguage\endcsname}%
+ \ifx\currentmainlanguage\askedlanguage \else
+ \let\currentmainlanguage\askedlanguage
+ \let\currentlanguage\askedlanguage
+ \docomplexlanguage
+ \fi
+ \fi
+ \fi}
+
+\endTEX
%D \macros
%D {defaultlanguage,languagedefault}
%D
-%D The macro \type {\defaultlanguage{id}} expands into the
-%D default language, when defined, while \type
-%D {\languagedefault{id}\c!parameter} returns the default's
-%D parameter.
+%D The macro \type {\defaultlanguage{id}} expands into the
+%D default language, when defined, while \type
+%D {\languagedefault{id}\c!parameter} returns the default's
+%D parameter.
+
+%\def\defaultlanguage#1%
+% {\@EA\ifx\csname\??la#1\c!default\endcsname\empty
+% #1%
+% \else
+% \@EA\defaultlanguage\@EA{\csname\??la#1\c!default\endcsname}%
+% \fi}
\def\defaultlanguage#1%
{\@EA\ifx\csname\??la#1\c!default\endcsname\empty
#1%
\else
- \@EA\defaultlanguage\@EA{\csname\??la#1\c!default\endcsname}%
+ \@EA\defaultlanguage\csname\??la#1\c!default\endcsname
\fi}
-\def\languagedefault#1#2%
+\def\languagedefault#1#2%
{\csname\??la\defaultlanguage{#1}#2\endcsname}
%D \macros
@@ -563,7 +691,7 @@
%D precautions that will prevent spurious spaces to creep into
%D the list.
-\def\startlanguagespecifics% % we use double to
+\def\startlanguagespecifics% % we use double to
{\bgroup
\catcode`\^^I=\@@ignore
\catcode`\^^M=\@@ignore
@@ -573,7 +701,7 @@
%D The main macro looks quite complicated but actually does
%D nothing special. By embedding \type{\do} we can easily
%D append to the lists and also execute them at will. Just to
-%D be sure, we check on spurious spaces. The second dummy
+%D be sure, we check on spurious spaces. The second dummy
%D argument gobbles spaces.
\def\languageencoding%
@@ -601,12 +729,12 @@
% {\enablelanguagespecifics[##1]}}%
% \processcommalist[#1]\docommando}
-% This saves 3K in the fmt file.
+% This saves 3K in the fmt file.
\long\def\dostartlanguagespecifics[#1][#2]#3\stoplanguagespecifics%
{\egroup
\processcommalist[#1]{\dosetlanguagespecifics{#3}}}
-
+
\long\def\dosetlanguagespecifics#1#2%
{\doifdefinedelse{\??la\languageencoding#2\??la}
{\long\def\do##1##2##3%
@@ -628,16 +756,29 @@
%D define \type{\do} in such a way that \type{{ }} is removed
%D and the language key is gobbled.
+%\def\enablelanguagespecifics[#1]%
+% {\let\do\secondoftwoarguments
+% \doifvaluesomething{\??la#1\c!default}
+% {\getvalue{\??la\getvalue{\??la#1\c!default}\??la}%
+% \getvalue{\??la\languageencoding\??la}}%
+% \getvalue{\??la#1\??la}%
+% \getvalue{\??la\languageencoding#1\??la}}
+%
+% sped up since used often:
+
\def\enablelanguagespecifics[#1]%
- {\long\def\do##1##2{##2}%
- \doifvaluesomething{\??la#1\c!default}
- {\getvalue{\??la\getvalue{\??la#1\c!default}\??la}%
- \getvalue{\??la\languageencoding\getvalue{\??la#1\c!default}\??la}}%
- % or
- %\doifvaluesomething{\??la#1\c!default}
- % {\expanded{\enablelanguagespecifics[\getvalue{\??la#1\c!default}]}}%
- \getvalue{\??la#1\??la}%
- \getvalue{\??la\languageencoding#1\??la}}
+ {\let\do\secondoftwoarguments
+ \csname
+ \??la
+ \@EA\ifx\csname\??la#1\c!default\endcsname\relax
+ \languageencoding
+ \else
+ \csname\??la#1\c!default\endcsname
+ \fi
+ \??la
+ \endcsname
+ \csname\??la#1\??la\endcsname
+ \csname\??la\languageencoding#1\??la\endcsname} % dup ?
%D \macros
%D {leftguillemot,rightguillemot,leftsubguillemot,rightsubguillemot,
@@ -646,9 +787,9 @@
%D We assign logical names to all kind of quote and sentence
%D boundary characters.
%D
-%D When using Computer Modern Roman, the next definitions
-%D looks a bit better than the default ligatures.
-%D
+%D When using Computer Modern Roman, the next definitions
+%D looks a bit better than the default ligatures.
+%D
%D \starttypen
%D \def\lowerleftsingleninequote {,}
%D \def\lowerleftdoubleninequote {,\kern-.1em,}
@@ -656,7 +797,7 @@
%D \def\upperleftdoubleninequote {''\kern-.1em}
%D \def\upperleftsinglesixquote {`}
%D \def\upperleftdoublesixquote {`\kern-.1em`}
-%D
+%D
%D \def\lowerrightsingleninequote {,}
%D \def\lowerrightdoubleninequote {,\kern-.1em,}
%D \def\upperrightsingleninequote {'}
@@ -682,18 +823,18 @@
\def\upperrightsinglesixquote {`}
\def\upperrightdoublesixquote {``}
-%D Yes I know, they are ugly:
+%D Yes I know, they are ugly:
-\def\leftguillemot%
+\def\leftfakeguillemot
{\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle\ll$}}}
-\def\rightguillemot%
+\def\rightfakeguillemot
{\hbox{\raise.25ex\hbox{$\scriptscriptstyle\gg$}}}
-\def\leftsubguillemot%
+\def\leftsubfakeguillemot
{\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle<$}}}
-\def\rightsubguillemot%
+\def\rightsubfakeguillemot
{\hbox{\raise.25ex\hbox{$\scriptscriptstyle>$}}}
%D Just like with subsentence boundary symbols, quotes
@@ -711,8 +852,10 @@
%D \vskip.5em
%D \hrule
%D \vskip.5em
+%D \let\normalbar=|
%D \hbox to \hsize
-%D {\hfil\citaat{#3 #4}\hfil\citeer{#2}\hfil\strut|<||<|#3|>|#4|>|\hfil}
+%D {\hfil\citaat{#3 #4}\hfil\citeer{#2}\hfil
+%D \let|=\normalbar\strut|<||<|#3|>|#4|>|\hfil}
%D \vskip.5em
%D \hrule
%D \egroup
@@ -720,101 +863,108 @@
%D \blanko}
%D
%D \ShowLanguageValues [af] [afrikaans] afrikaanse ...
-%D \ShowLanguageValues [cz] [czech] tjechisch tex
-%D \ShowLanguageValues [cz] [slovak] slowaakse ...
+%D \ShowLanguageValues [cz] [czech] tjechisch tex
+%D \ShowLanguageValues [cz] [slovak] slowaakse ...
%D \ShowLanguageValues [da] [danish] deense ...
%D \ShowLanguageValues [de] [german] duitse degelijkheid
%D \ShowLanguageValues [en] [english] engelse humor
%D \ShowLanguageValues [fi] [finnish] finse ...
%D \ShowLanguageValues [fr] [french] franse slag
%D \ShowLanguageValues [it] [italian] italiaanse ...
-%D \ShowLanguageValues [la] [latin] latijnse missen
+%D \ShowLanguageValues [la] [latin] latijnse missen
%D \ShowLanguageValues [nl] [dutch] nederlandse zuinigheid
%D \ShowLanguageValues [no] [norwegian] noorse ...
%D \ShowLanguageValues [pl] [polish] poolse ...
%D \ShowLanguageValues [pt] [portuguese] portugese ...
-%D \ShowLanguageValues [sp] [spanish] spaans benauwd
+%D \ShowLanguageValues [es] [spanish] spaans benauwd
%D \ShowLanguageValues [sv] [swedish] zweedse ...
%D \ShowLanguageValues [tr] [turkish] turks fruit
-%D We support a lot of languages. These are specified and
-%D loaded in separate files, according to their roots. Here
-%D we only take care of (postponed) setting of the current
-%D language.
-%D
+%D We support a lot of languages. These are specified and
+%D loaded in separate files, according to their roots. Here
+%D we only take care of (postponed) setting of the current
+%D language.
+%D
%D \unprotect
%D \plaatstabel{The germanic languages (\type{lang-ger})}
%D \starttabel[||||]
-%D \HL
+%D \HL
%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
-%D \HL
-%D \NC \s!nl \NC dutch \NC germanic \NC\FR
-%D \NC \s!en \NC english \NC germanic \NC\MR
-%D \NC \s!de \NC german \NC germanic \NC\MR
-%D \NC \s!da \NC danish \NC germanic \NC\MR
-%D \NC \s!sv \NC swedish \NC germanic \NC\MR
-%D \NC \s!af \NC afrikaans \NC germanic \NC\MR
-%D \NC \s!no \NC norwegian \NC germanic \NC\LR
-%D \HL
+%D \HL
+%D \NC \s!nl \NC dutch \NC germanic \NC\FR
+%D \NC \s!en \NC english \NC germanic \NC\MR
+%D \NC \s!de \NC german \NC germanic \NC\MR
+%D \NC \s!da \NC danish \NC germanic \NC\MR
+%D \NC \s!sv \NC swedish \NC germanic \NC\MR
+%D \NC \s!af \NC afrikaans \NC germanic \NC\MR
+%D \NC \s!no \NC norwegian \NC germanic \NC\LR
+%D \HL
%D \stoptabel
%D \protect
-%D
+%D
%D \unprotect
%D \plaatstabel{The italic languages (\type{lang-ita})}
%D \starttabel[||||]
-%D \HL
+%D \HL
%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
-%D \HL
+%D \HL
%D \NC \s!fr \NC french \NC italic \NC\FR
-%D \NC \s!es \NC spanish \NC italic \NC\MR
-%D \NC \s!it \NC italian \NC italic \NC\MR
-%D \NC \s!la \NC latin \NC italic \NC\MR
-%D \NC \s!pt \NC portuguese \NC italic \NC\LR
-%D \HL
+%D \NC \s!es \NC spanish \NC italic \NC\MR
+%D \NC \s!it \NC italian \NC italic \NC\MR
+%D \NC \s!la \NC latin \NC italic \NC\MR
+%D \NC \s!pt \NC portuguese \NC italic \NC\LR
+%D \HL
%D \stoptabel
%D \protect
-%D
+%D
%D \unprotect
%D \plaatstabel{The slavic languages (\type{lang-sla})}
%D \starttabel[||||]
-%D \HL
+%D \HL
%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
-%D \HL
-%D \NC \s!pl \NC polish \NC slavic \NC\FR
-%D \NC \s!cz \NC czech \NC slavic \NC\MR
-%D \NC \s!sk \NC slavik \NC slavic \NC\LR
-%D \HL
+%D \HL
+%D \NC \s!pl \NC polish \NC slavic \NC\FR
+%D \NC \s!cz \NC czech \NC slavic \NC\MR
+%D \NC \s!sk \NC slavik \NC slavic \NC\LR
+%D \HL
%D \stoptabel
%D \protect
%D \unprotect
-%D
+%D
%D \plaatstabel{The altaic languages (\type{lang-alt})}
%D \starttabel[||||]
-%D \HL
+%D \HL
%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
-%D \HL
-%D \NC \s!tr \NC turkish \NC altaic \NC\SR
-%D \HL
+%D \HL
+%D \NC \s!tr \NC turkish \NC altaic \NC\SR
+%D \HL
%D \stoptabel
%D
%D \plaatstabel{The uralic languages (\type{lang-ura})}
%D \starttabel[||||]
-%D \HL
+%D \HL
%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
-%D \HL
-%D \NC \s!fi \NC finnish \NC uralic \NC\SR
-%D \HL
+%D \HL
+%D \NC \s!fi \NC finnish \NC uralic \NC\SR
+%D \HL
%D \stoptabel
%D \protect
+%D
+
+% \bgroup \normallanguage255 \patterns{} \egroup
+% \def\nopatterns{\normallanguage255 }
+
+\def\nopatterns{\normallanguage\minusone}
+
%D We default to the language belonging to the interface. This
%D is one of the few places outside the interface modules where
-%D \type{\startinterface} is used.
+%D \type{\startinterface} is used.
\let\normaldoublequote ="
\let\normalforwardslash=/
-%D We default to english:
+%D We default to english:
\setupcurrentlanguage[\s!en]
@@ -822,6 +972,4 @@
\appendtoks\showmessage{\m!linguals}{9}{\currentlanguage}\to\everyjob
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex
index e4bbd19ab..7d325e45a 100644
--- a/tex/context/base/lang-ita.tex
+++ b/tex/context/base/lang-ita.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Todo: replace \'.. by \namedglyph
+
\writestatus{loading}{Italic Languages}
%D The framework of this module is set up by Hans Hagen while
diff --git a/tex/context/base/lang-lab.tex b/tex/context/base/lang-lab.tex
index 00efe5a56..794cdf4c3 100644
--- a/tex/context/base/lang-lab.tex
+++ b/tex/context/base/lang-lab.tex
@@ -42,32 +42,29 @@
%D In a few paragraphs we'll show quite a lot of examples
%D of its use.
-\def\setupheadtext%
- {\dosetupsometextprefix\c!titel}
+\let\handletextprefix\relax
-\def\setuplabeltext%
- {\dosetupsometextprefix\c!label}
+\def\setupheadtext {\dosetupsometextprefix[\c!titel]}
+\def\setuplabeltext{\dosetupsometextprefix[\c!label]}
-\let\handletextprefix=\relax
+\def\dosetupsometextprefix
+ {\let\dodocommando\xdosetupsometextprefix
+ \dotripleempty\dodosetupsometextprefix}
-\def\dodosetupsometextprefix#1%
- {\def\dododosetupsometextprefix[##1][##2]%
- {\ifsecondargument
- \def\docommando####1{\dodocommando[#1##1][####1]}%
- \processcommalist[##2]\docommando
- \else
- \def\docommando####1{\dodocommando[#1\currentmainlanguage][####1]}%
- \processcommalist[##1]\docommando
- \fi}%
- \dodoubleempty\dododosetupsometextprefix}
+\def\dodosetupsometextprefix[#1][#2][#3]%
+ {\ifthirdargument
+ \def\docommando##1{\dodocommando[#1#2][##1]}%
+ \processcommalist[#3]\docommando
+ \else
+ \def\docommando##1{\dodocommando[#1\currentmainlanguage][##1]}%
+ \processcommalist[#2]\docommando
+ \fi}
\def\doassignsometextprefix[#1][#2,#3,#4]%
{\setvalue{#1}{\handletextprefix{#2}{#3}}}
-\def\dosetupsometextprefix#1%
- {\def\dodocommando[##1][##2=##3]%
- {\doassignsometextprefix[##1##2][##3,,]}%
- \dodosetupsometextprefix{#1}}
+\def\xdosetupsometextprefix[#1][#2=#3]%
+ {\doassignsometextprefix[#1#2][#3,,]}
%D By changing the meaning of \type {\handletextprefix} we
%D can filter the left and right labeltext as well as convert
@@ -96,8 +93,11 @@
%D
%D The latter one has an upcased alternative \type{\LABELTEXT}.
-\def\labellanguage{\currentmainlanguage}
-\def\headlanguage {\currentmainlanguage}
+% \def\labellanguage{\currentmainlanguage}
+% \def\headlanguage {\currentmainlanguage}
+
+\def\labellanguage{\defaultlanguage\currentmainlanguage}
+\def\headlanguage {\defaultlanguage\currentmainlanguage}
\def\headtext%
{\let\handletextprefix\firstoftwoarguments
@@ -128,24 +128,116 @@
\def\labeltexts#1#2{\leftlabeltext{#1}#2\rightlabeltext{#1}}
\def\LABELTEXTS#1#2{\LEFTLABELTEXT{#1}#2\RIGHTLABELTEXT{#1}}
-\def\dodogetupsometextprefix#1#2#3#4%
- {\doifdefinedelse{#2#1#3}
- {\getvalue{#2#1#3}}
- {\doifdefinedelse{#1#3}
- {\getvalue{#2#3}}
- {#4}}}
-
\newif\iflabeltextdone % needs to be reset elsewhere
\newif\iftracinglabels % shows missing labels
+% \def\dodogetupsometextprefix#1#2#3#4%
+% {\doifdefinedelse{#2#1#3}
+% {\getvalue{#2#1#3}}
+% {\doifdefinedelse{#2#3} % was bug: #1#3
+% {\getvalue{#2#3}}
+% {#4}}}
+%
+% \unexpanded\def\dogetupsometextprefix#1#2#3%
+% {\global\labeltextdonetrue
+% \dodogetupsometextprefix{#1}{#2}{#3}
+% {\dodogetupsometextprefix{\defaultlanguage{#1}}{#2}{#3}
+% {\dodogetupsometextprefix{\s!en}{#2}{#3}
+% {\dodogetupsometextprefix{\s!nl}{#2}{#3}
+% {\iftracinglabels{\tttf[#2:~#3/#1]~}\fi}}}}}
+
+\beginETEX
+
+% \def\dodogetupsometextprefix#1#2#3#4%
+% {\ifcsname#2#1#3\endcsname
+% \csname#2#1#3\endcsname
+% \else\ifcsname#2#3\endcsname
+% \csname#2#3\endcsname
+% \else
+% #4%
+% \fi\fi}
+%
+% this can be reduced to:
+%
+% \def\dodogetupsometextprefix#1#2#3%
+% {\ifcsname#2#1#3\endcsname
+% \csname#2#1#3\endcsname
+% \@EA\gobbleoneargument
+% \else\ifcsname#2#3\endcsname
+% \csname#2#3\endcsname
+% \@EAEAEA\gobbleoneargument
+% \else
+% \@EAEAEA\firstofoneargument
+% \fi\fi}
+%
+% \endETEX
+%
+% \beginTEX
+%
+% \def\dodogetupsometextprefix#1#2#3%
+% {\@EA\ifx\csname#2#1#3\endcsname\relax
+% \@EA\ifx\csname#2#3\endcsname\relax
+% \@EAEAEA\firstofoneargument
+% \else
+% \csname#2#3\endcsname
+% \@EAEAEA\gobbleoneargument
+% \fi
+% \else
+% \csname#2#1#3\endcsname
+% \@EA\gobbleoneargument
+% \fi}
+%
+% \endTEX
+%
+% \unexpanded\def\dogetupsometextprefix#1#2#3%
+% {\global\labeltextdonetrue
+% \dodogetupsometextprefix{#1}{#2}{#3}
+% {\dodogetupsometextprefix{\defaultlanguage{#1}}{#2}{#3}
+% {\dodogetupsometextprefix\s!en{#2}{#3}
+% {\dodogetupsometextprefix\s!nl{#2}{#3}
+% {\reporttextprefixerror{#1}{#2}{#3}}}}}}
+
+\def\reporttextprefixerror#1#2#3%
+ {\iftracinglabels{\tttf[#2:~#3/#1]~}\fi}
+
+\beginETEX \ifcsname
+
\unexpanded\def\dogetupsometextprefix#1#2#3%
- {\global\labeltextdonetrue
- \dodogetupsometextprefix{#1}{#2}{#3}
- {\dodogetupsometextprefix{\defaultlanguage{#1}}{#2}{#3}
- {\dodogetupsometextprefix{\s!en}{#2}{#3}
- {\dodogetupsometextprefix{\s!nl}{#2}{#3}
- {\iftracinglabels{\tttf[#2:~#3/#1]~}\fi}}}}}
+ {\global\labeltextdonetrue
+ \ifcsname#2#1#3\endcsname
+ \csname#2#1#3\endcsname \else
+ \ifcsname#2#3\endcsname
+ \csname#2#3\endcsname \else
+ \ifcsname#2\defaultlanguage{#1}#3\endcsname
+ \csname#2\defaultlanguage{#1}#3\endcsname \else
+ \ifcsname#2\s!en#3\endcsname
+ \csname#2\s!en#3\endcsname \else
+ \ifcsname#2\s!nl#3\endcsname
+ \csname#2\s!nl#3\endcsname \else
+ \reporttextprefixerror{#1}{#2}{#3}%
+ \fi\fi\fi\fi\fi}
+
+\endETEX
+
+\beginTEX
+\unexpanded\def\dogetupsometextprefix#1#2#3%
+ {\global\labeltextdonetrue
+ \@EA\ifx\csname#2#1#3\endcsname\relax
+ \@EA\ifx\csname#2#3\endcsname\relax
+ \@EA\ifx\csname#2\defaultlanguage{#1}#3\endcsname\relax
+ \@EA\ifx\csname#2\s!en#3\endcsname\relax
+ \@EA\ifx\csname#2\s!nl#3\endcsname\relax
+ \reporttextprefixerror{#1}{#2}{#3}%
+ \else\csname#2\s!nl#3\endcsname
+ \fi\else\csname#2\s!en#3\endcsname
+ \fi\else\csname#2\defaultlanguage{#1}#3\endcsname
+ \fi\else\csname#2#3\endcsname
+ \fi\else\csname#2#1#3\endcsname
+ \fi}
+
+\endTEX
+
\ifx\simplifiedcommands\undefined \newtoks\simplifiedcommands \fi
\appendtoks
@@ -166,17 +258,15 @@
%D head and label texts without replacing predefined ones.
%D These are internal macros.
-\def\dopresetsometextprefix#1%
- {\def\dodocommando[##1][##2=##3]%
- {\doifundefined{##1##2}
- {\doassignsometextprefix[##1##2][##3,,]}}%
- \dodosetupsometextprefix{#1}}
+\def\xdopresetsometextprefix[#1][#2=#3]%
+ {\ifundefined{#1#2}\doassignsometextprefix[#1#2][#3,,]\fi}
-\def\presetheadtext%
- {\dopresetsometextprefix\c!titel}
+\def\dopresetsometextprefix
+ {\let\dodocommando\xdopresetsometextprefix
+ \dotripleempty\dodosetupsometextprefix}
-\def\presetlabeltext%
- {\dopresetsometextprefix\c!label}
+\def\presetheadtext {\dopresetsometextprefix[\c!titel]}
+\def\presetlabeltext{\dopresetsometextprefix[\c!label]}
%D \macros
%D {translate}
@@ -196,7 +286,7 @@
%D which expands to {\em something} or {\em iets}, depending on
%D de current language.
-\def\dotranslate[#1]% don't group!
+\def\dotranslate[#1]% don't group! SLOW if really used: speed up
{\getparameters[\??lg][#1]%
\doifdefinedelse{\??lg\currentlanguage}%
{\getvalue{\??lg\currentlanguage}}
@@ -206,7 +296,7 @@
{\getvalue{\??lg\s!nl}}
{[translation #1]}}}}
-\unexpanded\def\translate%
+\unexpanded\def\translate
{\dosingleempty\dotranslate}
%D When used without argument, the last defined values are
@@ -228,8 +318,6 @@
\def\assigntranslation[#1]\to#2%
{\getparameters[\??lg][#1]%
- \edef#2{\getvalue{\??lg\currentlanguage}}}
-
-\protect
+ \edef#2{\csname\??lg\currentlanguage\endcsname}}
-\endinput
+\protect \endinput
diff --git a/tex/context/base/lang-sla.tex b/tex/context/base/lang-sla.tex
index 1b3dd3d3e..fa9eb9605 100644
--- a/tex/context/base/lang-sla.tex
+++ b/tex/context/base/lang-sla.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Todo: replace \'.. by \namedglyph
+
%D The framework of this module is set up by Hans Hagen while
%D many of the first translations were done by Tobias. Later
%D on, corrections were made by users. If you have suggestions,
diff --git a/tex/context/base/lang-ura.tex b/tex/context/base/lang-ura.tex
index 128fab6d5..22072dc0e 100644
--- a/tex/context/base/lang-ura.tex
+++ b/tex/context/base/lang-ura.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Todo: replace \'.. by \namedglyph
+
\writestatus{loading}{Uralic Languages}
%D The framework of this module is set up by Hans Hagen while
diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex
index 708aa791d..95d768cc3 100644
--- a/tex/context/base/m-chart.tex
+++ b/tex/context/base/m-chart.tex
@@ -77,6 +77,9 @@
\def\FLOWbufferprefix{flw-}
+\def\processFLOWbuffer#1{\haalbuffer[\FLOWbufferprefix#1]}
+\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]}
+
\def\setFLOWname#1#2% funny hack that makes sure that we get
{\bgroup % names that are acceptable for METAPOST
\lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e%
@@ -159,8 +162,8 @@
\def\doFLOWtext%
{\dosingleempty\dodoFLOWtext}
-\def\dodoFLOWtext[#1]#2%
- {\gdef\FLOWalign{#1}\gdef\FLOWtext{#2}}
+\def\dodoFLOWtext[#1]% % #2%
+ {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}}
\def\doFLOWcomment[#1]#2%
{\ignorespaces\dogobblesingleempty}
@@ -284,7 +287,7 @@
\gdef\dohandleflowchart[####1][####2]%
{\popmacro\dohandleflowchart
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix####1]}%
+ \processFLOWbuffer{####1}}%
\getvalue{\@FLOW@-##1}}}%
\processcommalist[#1]\dodoincludeFLOWchart
\popmacro\includeFLOWx
@@ -387,7 +390,7 @@
\let\FLOWheight\@@FLOWny
\let\startFLOWcell\startFLOWcellA
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
+ \processFLOWbuffer\currentFLOWnumber
\ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi
\ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi
\doifnothing{\@@FLOWmaxbreedte\@@FLOWmaxhoogte}{\FLOWscalingfalse}%
@@ -473,7 +476,7 @@
\resetMPdrawing
\doglobal\newcounter\FLOWcomment
\startMPdrawing
- input mp-char.mp ;
+ if unknown context_char : input mp-char.mp ; fi ;
grid_width := \FLOWgridwidth ;
grid_height := \FLOWgridheight ;
shape_width := \FLOWshapewidth ;
@@ -493,7 +496,7 @@
% \ignorespaces}%
% \let\startFLOWcell\startFLOWcellX
% \resetFLOWlocation
-% \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
+% \processFLOWbuffer\currentFLOWnumber
% \ifnum\@@FLOWnx\@@FLOWny=11 % listig
% \let\@@FLOWnx\FLOWwidth
% \let\@@FLOWny\FLOWheight
@@ -528,16 +531,19 @@
\stopMPdrawing]%
\let\startFLOWcell\startFLOWcellB
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
+ \processFLOWbuffer\currentFLOWnumber
\let\startFLOWcell\startFLOWcellC
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
+ \processFLOWbuffer\currentFLOWnumber
\startMPdrawing
clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ;
end_chart ;
\stopMPdrawing
\MPdrawingdonetrue
- \setbox0=\hbox{\MPshiftdrawingfalse\getMPdrawing}%
+ \setbox0=\hbox
+ {\MPstaticgraphictrue
+ \MPshiftdrawingfalse
+ \getMPdrawing}%
\def\MPmessage##1%
{\writestatus{MP charts}{##1}}%
\def\MPposition##1##2##3%
@@ -554,7 +560,7 @@
\setbox2=\vbox to \ht0
{\forgetall % \offinterlineskip
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]\vss}%
+ \processFLOWbuffer\currentFLOWnumber\vss}%
\setbox2=\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}%
\wd2=\wd0\ht2=\ht0\dp2=\dp0
@@ -562,7 +568,7 @@
\setbox4=\vbox to \ht0
{\forgetall % \offinterlineskip
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]\vss}%
+ \processFLOWbuffer\currentFLOWnumber\vss}%
\setbox4=\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}%
\wd4=\wd0\ht4=\ht0\dp4=\dp0
@@ -710,7 +716,7 @@
\doifelse{\@@FLOLpijl}{\v!ja}
{\startMPdrawing arrowtip := true ; \stopMPdrawing}
{\startMPdrawing arrowtip := false ; \stopMPdrawing}%
- \doifelse{\@@FLOLoffset}{none} % {\v!geen}
+ \doifelse{\@@FLOLoffset}{\v!geen}
{\startMPdrawing touchshape := true ; \stopMPdrawing}
{\startMPdrawing touchshape := false ; \stopMPdrawing}%
\startMPdrawing
@@ -940,7 +946,7 @@
\def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx
\let\startFLOWcell\startFLOWcellF
\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
+ \processFLOWbuffer\currentFLOWnumber
%\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}%
\ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi
\ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi
@@ -1051,7 +1057,7 @@
{{##1\expandafter\getFLOWlocation\FLOWlocation\end}}%
\def\dohandleflowchart[##1][##2]%
{\resetFLOWlocation
- \haalbuffer[\FLOWbufferprefix##1]}%
+ \processFLOWbuffer{##1}}%
\getvalue{\@FLOW@-#1}}}
\def\setupFLOWsplit%
@@ -1162,7 +1168,7 @@
\def\typeFLOWchart[#1]%
{\bgroup
- \def\dohandleflowchart[##1][##2]{\typebuffer[\FLOWbufferprefix##1]}%
+ \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}%
\convertargument\startFLOWchart[#1]\to\firstverbatimfileline
\convertargument \stopFLOWchart\to\lastverbatimfileline
\getvalue{\@FLOW@-#1}
@@ -1239,6 +1245,22 @@
\setupFLOWsets
[\c!commando=]
+%D This will be an option:
+
+% \def\startFLOWchart%
+% {\dodoubleempty\dostartFLOWchart}
+%
+% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart
+% {\preparenextFLOWchart{#1}{#2}%
+% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}}
+%
+% \long\def\dodefineFLOWchart[#1][#2]#3%
+% {\preparenextFLOWchart{#1}{#2}%
+% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}}
+%
+% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}}
+% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]}
+
%D The XML interface [will be mode protected or separate x-chart file]
\startXMLdefinitions flowchart
@@ -1269,9 +1291,6 @@
\defineXMLdirective [flowchart] [shapes] \setupFLOWshapes
\defineXMLdirective [flowchart] [lines] \setupFLOWlines
-
\stopXMLdefinitions
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/m-pstric.tex b/tex/context/base/m-pstric.tex
index c093cc7fa..39f45525a 100644
--- a/tex/context/base/m-pstric.tex
+++ b/tex/context/base/m-pstric.tex
@@ -26,18 +26,18 @@
{} %{\writestatus{pstricks}{overslaan definieer kleurgroep #2}}
\def\loadpstrickscolors#1%
- {\let\olddefinieerkleur=\definieerkleur
- \let\olddefinieerpalet=\definieerpalet
- \let\olddefinieerkleurgroep=\definieerkleurgroep
+ {\let\olddefinekleur =\definecolor
+ \let\olddefinepalet =\definepalet
+ \let\olddefinecolorgroup=\definecolorgroup
\writestatus{pstricks}{loading colors from #1}%
\input #1 \relax
- \let\definieerkleur=\olddefinieerkleur
- \let\definieerpalet=\olddefinieerpalet
- \let\definieerkleurgroep=\olddefinieerkleurgroep}
+ \let\definecolor =\olddefinecolor
+ \let\definepalet =\olddefinepalet
+ \let\definecolorgroup=\olddefinecolorgroup}
\input multido \relax
\input pstricks \relax
-\input pst_plot \relax
+\input pst-plot \relax
\loadpstrickscolors{colo-rgb} % nog koppelen \redef\
diff --git a/tex/context/base/m-quest.tex b/tex/context/base/m-quest.tex
index 23e9dc279..eb9787b81 100644
--- a/tex/context/base/m-quest.tex
+++ b/tex/context/base/m-quest.tex
@@ -206,10 +206,10 @@
\doifsomething{#1}
{\global\advance\invulget by 1
\doconvertfont
- {\@@ivletter}
- {\@@ivlinks
- \getvalue{\r!fillin\the\invulget}%
- \@@ivrechts}}
+ {\@@ivletter}
+ {\@@ivlinks
+ \getvalue{\r!fillin\the\invulget}%
+ \@@ivrechts}}
{\doconvertfont
{\@@ivletter}
{\@@ivlinks
diff --git a/tex/context/base/m-steps.tex b/tex/context/base/m-steps.tex
index 72a30b6eb..00a8c1ae3 100644
--- a/tex/context/base/m-steps.tex
+++ b/tex/context/base/m-steps.tex
@@ -457,8 +457,7 @@
anchor_box(\MPpos{\stepchartprefix origin}) ;
\stopMPdrawing
\MPdrawingdonetrue
- \setbox0=\vbox
- {\getMPdrawing}%
+ \setbox0=\vbox{\MPstaticgraphictrue\getMPdrawing}%
\resetMPdrawing
\setbox2=\vbox
{\offinterlineskip
@@ -792,7 +791,7 @@
anchor_box(\MPpos{\steptableprefix origin}) ;
\stopMPdrawing
\MPdrawingdonetrue
- \setbox0=\vbox{\getMPdrawing}
+ \setbox0=\vbox{\MPstaticgraphictrue\getMPdrawing}%
\resetMPdrawing
% typesetting pass
\dimen6=\@@STPTafstand \dimen6=2\dimen6
diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex
index b2c82373c..8cd1d4794 100644
--- a/tex/context/base/m-units.tex
+++ b/tex/context/base/m-units.tex
@@ -83,14 +83,14 @@
%D \stelsynoniemenin [unit] [textstyle=\dimension]
%D \stoptypen
%D
-%D We have to use the command \type {\unitedmeaning} instead
-%D of \type {\meaning}, simply because the latter is a \TEX\
-%D primitive we don't want to loose. We use the label text
-%D mechanism for translations.
-%D
%D This definition means that we can ask for the meaning of a
%D unit using \type {\unitmeaning} and get a list of used
%D units by saying \type {\placelistofunits}
+%D
+%D We have to use the command \type {\unitmeaning} instead
+%D of \type {\meaning}, simply because the latter is a \TEX\
+%D primitive we don't want to loose. We use the label text
+%D mechanism for translations.
%D \macros
%D {dimension}
@@ -277,15 +277,14 @@
\newif\ifSIunits \SIunitstrue
\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup}
-\def\doSI#1{\begingroup\SIunitstrue#1\endgroup}
+\def\doSI#1{\begingroup\SIunitstrue #1\endgroup}
%D \macros
%D {Degrees}
%D
%D We can fake the degrees symbol with:
-\def\Degrees%
- {\dimensionaddfix{^\circ}}
+\def\Degrees{\dimensionaddfix{^\circ}}
%D \macro
%D {Unit, NoUnit}
@@ -414,6 +413,21 @@
u:hour=Stunde,
u:min=Minuten]
+\setuplabeltext
+ [\s!it]
+ [u:sec=secondo,
+ u:fsec=femtosecondo,
+ u:psec=picosecondo,
+ u:nsec=nanosecondo,
+ u:usec=microsecondo,
+ u:msec=millisecondo,
+ u:year=anno,
+ u:month=mese,
+ u:week=settimana,
+ u:day=giorno,
+ u:hour=ora,
+ u:min=minuti]
+
%D Then we define some angles.
\getvalue{\v!eenheid} [Rad] {rad} {\labeltext{u:rad}}
@@ -434,6 +448,11 @@
[u:rad=Bogenma\SS,
u:deg=Gradma\SS]
+\setuplabeltext
+ [\s!it]
+ [u:rad=radianti,
+ u:deg=angoli sessagesimali]
+
%D Rotation and frequency related units are defined by:
\getvalue{\v!eenheid} [Hertz] {Hz} {Hertz}
@@ -461,6 +480,11 @@
[u:rps=Umdrehungen pro Sekunde,
u:rpm=Umdrehungen pro Minute]
+\setuplabeltext
+ [\s!it]
+ [u:rps=giri al secondo,
+ u:rpm=giri al minuto]
+
%D Mass and force:
\getvalue{\v!eenheid} [Gram] {g} {gram}
@@ -488,6 +512,10 @@
[\s!de]
[u:u=Atomare Masseneinheit]
+\setuplabeltext
+ [\s!it]
+ [u:u=unit\`a di massa atomica]
+
%D Energy units comes in two alternatives:
\getvalue{\v!eenheid} [Joule] {J} {Joule}
@@ -565,6 +593,11 @@
[u:vac=Wechselspannung,
u:vdc=Gleichspannung]
+\setuplabeltext
+ [\s!it]
+ [u:vac=corrente alternata,
+ u:vdc=corrente continua]
+
%D Computer memory is specified in Bytes:
\getvalue{\v!eenheid} [Baud] {Baud} {Baud (Bit/s)}
@@ -606,6 +639,14 @@
\getvalue{\v!eenheid} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}}
\getvalue{\v!eenheid} [Lux] {lux} {lux}
+
+\def\xPercent {\dimensionaddfix{\percent }}
+\def\xPromille{\dimensionaddfix{\promille}}
+
+\getvalue{\v!eenheid} [Percent] {\xPercent } {percent}
+\getvalue{\v!eenheid} [Permille] {\xPromille} {promille}
+\getvalue{\v!eenheid} [Promille] {\xPromille} {promille}
+
%D Some more, thanks to Tobias:
\getvalue{\v!eenheid} [Gray] {Gr} {Gray}
@@ -642,6 +683,15 @@
u:f=Force,
u:kcal=Kilokalorien]
+\setuplabeltext
+ [\s!it]
+ [u:at=pressione atmosferica tecnica,
+ u:atm=pressione atmosfera fisica,
+ u:ft=piede,
+ u:cal=caloria,
+ u:f=forza,
+ u:kcal=chilocaloria]
+
%D Here are some old ones, still there for compatibility
%D reasons. These will probably be obsolete in a few years.
diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex
index 3e02d7dbc..de2ea3ffa 100644
--- a/tex/context/base/math-ini.tex
+++ b/tex/context/base/math-ini.tex
@@ -315,12 +315,12 @@
{\popmacro\mathcollection}
\def\startrawmathcollection%
- {\pushmacro\iftracemathcollection
- \tracemathcollectionfalse
+ {%\pushmacro\iftracemathcollection % does not work in new push
+ %\tracemathcollectionfalse
\startmathcollection}
\def\stoprawmathcollection%
- {\popmacro\iftracemathcollection
+ {%\popmacro\iftracemathcollection
\stopmathcollection}
\newtoks\mathtoks
@@ -356,6 +356,43 @@
\fetchruntimecommand \showmathcharacters {\f!mathprefix\s!run}
+%D \macros
+%D {ifmathpunctuation, enablemathpunctuation,
+%D definemathpunctuation}
+%D
+%D \starttypen
+%D \definemathpunctuation . mathperiod textperiod
+%D \definemathpunctuation , mathcomma textcomma
+%D \stoptypen
+
+\newif\ifmathpunctuation
+
+\def\enablemathpunctuation{\mathpunctuationtrue}
+
+\def\definemathpunctuation #1 #2 #3 %
+ {\appendtoks
+ \initializemathpunctuation{#1}{#2}{#3}%
+ \to\everymath}
+
+\def\initializemathpunctuation#1#2#3% sloowww
+ {\ifmathpunctuation
+ \mathcode`#1="8000
+ \defineactivecharacter #1 {\dohandlemathpunctuation{#2}{#3}}%
+ \fi}
+
+\unexpanded\def\dohandlemathpunctuation#1#2% \if fails in mathml interval
+% {\def\next{\csname\if\space\nexttoken#2\else#1\fi\endcsname}%
+ {\def\next{\csname\ifx\space\nexttoken#2\else#1\fi\endcsname}%
+ \futurelet\nexttoken\next}
+
+%D \startbuffer
+%D \enablemathpunctuationtrue$(1,2) (1, 2) (1{,}2) \hbox{foo, not bar}$
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \blanko{\getbuffer}\blanko
+
\edef\hexmrfam {0} \edef\hexbsfam {8}
\edef\hexmifam {1} \edef\hexbifam {9}
\edef\hexsyfam {2} \edef\hexscfam {A}
@@ -382,6 +419,10 @@
\usemathcollection[default]
+%D Some goodies:
+
+\def\Angstrom{\nomathematics{\Aring}}
+
\protect \endinput
\tracemathcollectiontrue
@@ -390,7 +431,6 @@
\setupbodyfont[ams] \enablemathcollection[ams] \input math-ams \page
\setupbodyfont[lbr] \enablemathcollection[lbr] \input math-lbr \page
\setupbodyfont[eul] \enablemathcollection[eul] \input math-eul \stoptext
-
% to be checked
diff --git a/tex/context/base/math-pln.tex b/tex/context/base/math-pln.tex
new file mode 100644
index 000000000..5bc8c689b
--- /dev/null
+++ b/tex/context/base/math-pln.tex
@@ -0,0 +1,336 @@
+%D \module
+%D [ file=math-pln,
+%D version=2001.11.16,
+%D title=\CONTEXT\ System Macros,
+%D subtitle=Efficient \PLAIN\ \TEX\ 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.
+
+%D This is a temporary module, some of this code will move to
+%D the other math modules.
+
+\unprotect
+
+\def\m@th{\mathsurround\z@}
+
+\newbox\rootbox
+
+\def\root#1\of%
+ {\setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#1}$}%
+ \mathpalette\r@@t}
+
+\def\r@@t#1#2% will be overloaded
+ {\setbox\z@\hbox{$\m@th#1\sqrt{#2}$}\dimen@\ht\z@
+ \advance\dimen@-\dp\z@
+ \mkern5mu\raise.6\dimen@\copy\rootbox
+ \mkern-10mu\box\z@}
+
+\def\mathhexbox#1#2#3%
+ {\leavevmode
+ \hbox{$\m@th\mathchar"#1#2#3$}}
+
+\def\oalign#1%
+ {\leavevmode
+ \vtop
+ {\baselineskip\z@skip \lineskip.25ex%
+ \ialign{##\crcr#1\crcr}}}
+
+\def\o@lign
+ {\lineskiplimit\z@ \oalign}
+
+\def\ooalign % chars over each other
+ {\lineskiplimit-\maxdimen
+ \oalign}
+
+{\catcode`p=12 \catcode`t=12 \gdef\\#1pt{#1}} \let\getf@ctor=\\
+
+\def\sh@ft#1% kern by #1 times the current slant
+ {\dimen@#1%
+ \kern\expandafter\getf@ctor\the\fontdimen1\font
+ \dimen@}
+
+\def\copyright
+ {{\ooalign{\hfil\raise.07ex\hbox{c}\hfil\crcr\Orb}}}
+
+\def\dots
+ {\relax\ifmmode\ldots\else$\m@th\ldots\,$\fi}
+
+\def\hrulefill
+ {\leaders\hrule\hfill}
+
+\def\dotfill
+ {\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}
+
+\def\rightarrowfill
+ {$\m@th\smash-\mkern-7mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-7mu\mathord\rightarrow$}
+
+\def\leftarrowfill
+ {$\m@th\mathord\leftarrow\mkern-7mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-7mu\smash-$}
+
+% must go to math-tex
+
+\mathchardef\braceld="37A
+\mathchardef\bracerd="37B
+\mathchardef\bracelu="37C
+\mathchardef\braceru="37D
+
+\def\downbracefill
+ {$\m@th\setbox\z@\hbox{$\braceld$}%
+ \braceld\leaders\vrule\!!height\ht\z@\!!depth\z@\hfill\braceru
+ \bracelu\leaders\vrule\!!height\ht\z@\!!depth\z@\hfill\bracerd$}
+
+\def\upbracefill
+ {$\m@th\setbox\z@\hbox{$\braceld$}%
+ \bracelu\leaders\vrule\!!height\ht\z@\!!depth\z@\hfill\bracerd
+ \braceld\leaders\vrule\!!height\ht\z@\!!depth\z@\hfill\braceru$}
+
+\def\bye{\par\vfill\supereject\end}
+
+\let\sp=^
+\let\sb=_
+\def\,{\mskip\thinmuskip}
+\def\>{\mskip\medmuskip}
+\def\;{\mskip\thickmuskip}
+\def\!{\mskip-\thinmuskip}
+\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
+
+{\catcode`\'=\active \gdef'{^\bgroup\prim@s}}
+
+\def\prim@s
+ {\prime\futurelet\next\pr@m@s}
+
+\def\pr@m@s
+ {\ifx'\next
+ \let\nxt\pr@@@s
+ \else
+ \ifx^\next
+ \let\nxt\pr@@@t
+ \else
+ \let\nxt\egroup
+ \fi
+ \fi
+ \nxt}
+
+\def\pr@@@s#1%
+ {\prim@s}
+
+\def\pr@@@t#1#2%
+ {#2\egroup}
+
+{\catcode`\_=\active \global\let_=\_} % _ in math is either subscript or \_
+
+\def\relbar {\mathrel{\smash-}} % - has the same height as +
+\def\Relbar {\mathrel=}
+
+\def\Longrightarrow {\Relbar\joinrel\Rightarrow}
+\def\longrightarrow {\relbar\joinrel\rightarrow}
+\def\longleftarrow {\leftarrow\joinrel\relbar}
+\def\Longleftarrow {\Leftarrow\joinrel\Relbar}
+\def\longmapsto {\mapstochar\longrightarrow}
+\def\longleftrightarrow{\leftarrow\joinrel\rightarrow}
+\def\Longleftrightarrow{\Leftarrow\joinrel\Rightarrow}
+
+\def\overrightarrow#1%
+ {\vbox{\m@th\ialign{##\crcr
+ \rightarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+
+\def\overleftarrow#1%
+ {\vbox{\m@th\ialign{##\crcr
+ \leftarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+
+\def\overbrace#1%
+ {\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}
+ \downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
+
+\def\underbrace#1%
+ {\mathop{\vtop{\m@th\ialign{##\crcr
+ $\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern3\p@\nointerlineskip}
+ \upbracefill\crcr\noalign{\kern3\p@}}}}\limits}
+
+\def\skew#1#2#3%
+ {{\muskip\z@#1mu\divide\muskip\z@\tw@ \mkern\muskip\z@
+ #2{\mkern-\muskip\z@{#3}\mkern\muskip\z@}\mkern-\muskip\z@}{}}
+
+\def\n@space
+ {\nulldelimiterspace\z@ \m@th}
+
+\def\choose{\atopwithdelims()}
+\def\brack {\atopwithdelims[]}
+\def\brace {\atopwithdelims\{\}}
+
+\def\mathpalette#1#2%
+ {\mathchoice
+ {#1\displaystyle {#2}}%
+ {#1\textstyle {#2}}%
+ {#1\scriptstyle {#2}}%
+ {#1\scriptscriptstyle{#2}}}
+
+\def\cong%
+ {\mathrel{\mathpalette\@vereq\sim}} % congruence sign
+
+\def\@vereq#1#2%
+ {\lower.5\p@\vbox{\lineskiplimit\maxdimen\lineskip-.5\p@
+ \ialign{$\m@th#1\hfil##\hfil$\crcr#2\crcr=\crcr}}}
+
+\def\notin%
+ {\mathrel{\mathpalette\c@ncel\in}}
+
+\def\c@ncel#1#2%
+ {\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
+
+\def\rightleftharpoons%
+ {\mathrel{\mathpalette\rlh@{}}}
+
+\def\rlh@#1%
+ {\vcenter
+ {\m@th
+ \hbox
+ {\ooalign
+ {\raise2pt\hbox{$#1\rightharpoonup$}\crcr
+ $#1\leftharpoondown$}}}}
+
+\def\buildrel#1\over#2%
+ {\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
+
+\def\doteq%
+ {\buildrel\textstyle.\over=}
+
+\def\bmod%
+ {\nonscript
+ \mskip-\medmuskip
+ \mkern5mu
+ \mathbin{\rm mod}%
+ \penalty900
+ \mkern5mu
+ \nonscript
+ \mskip-\medmuskip}
+
+\def\pmod#1%
+ {\allowbreak
+ \mkern18mu
+ ({\rm mod}\,\,#1)}
+
+\def\cases#1%
+ {\left\{%
+ \,%
+ \vcenter
+ {\normalbaselines
+ \m@th
+ \ialign{$##\hfil$&\quad##\hfil\crcr#1\crcr}}%
+ \right.}
+
+\def\matrix#1%
+ {\null
+ \,%
+ \vcenter
+ {\normalbaselines\m@th
+ \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
+ \mathstrut\crcr\noalign{\kern-\baselineskip}
+ #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}%
+ \,}
+
+\def\pmatrix#1%
+ {\left(\matrix{#1}\right)}
+
+\newdimen\p@renwd
+
+% \setbox0=\hbox{\tenex B} \p@renwd=\wd0 % width of the big left (
+
+\def\bordermatrix#1%
+ {\begingroup
+ \m@th
+ \setbox\z@\vbox
+ {\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
+ \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
+ &&\quad\hfil$##$\hfil\crcr
+ \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
+ #1\crcr\omit\strut\cr}}%
+ \setbox\tw@\vbox
+ {\unvcopy\z@\global\setbox\@ne\lastbox}%
+ \setbox\tw@\hbox
+ {\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
+ \setbox\tw@\hbox
+ {$\kern\wd\@ne\kern-\p@renwd\left(\kern-\wd\@ne
+ \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
+ \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right)$}%
+ \null
+ \;%
+ \vbox{\kern\ht\@ne\box\tw@}%
+ \endgroup}
+
+\def\openup{\afterassignment\@penup\dimen@=}
+
+\def\@penup{\advance\lineskip\dimen@
+ \advance\baselineskip\dimen@
+ \advance\lineskiplimit\dimen@}
+
+\def\eqalign#1%
+ {\null
+ \,%
+ \vcenter
+ {\openup
+ \jot\m@th
+ \ialign
+ {\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil\crcr
+ #1\crcr}}%
+ \,}
+
+\newif\ifdt@p
+
+\def\displ@y%
+ {\global\dt@ptrue
+ \openup\jot\m@th
+ \everycr
+ {\noalign
+ {\ifdt@p
+ \global\dt@pfalse
+ \ifdim\prevdepth>-1000\p@
+ \vskip-\lineskiplimit
+ \vskip\normallineskiplimit
+ \fi
+ \else
+ \penalty\interdisplaylinepenalty
+ \fi}}}
+
+\def\@lign % restore inside \displ@y
+ {\tabskip\z@skip
+ \everycr{}}
+
+\def\displaylines#1%
+ {\displ@y
+ \tabskip\z@skip
+ \halign
+ {\hbox to \displaywidth{$\@lign\hfil\displaystyle##\hfil$}\crcr
+ #1\crcr}}
+
+\def\eqalignno#1%
+ {\displ@y
+ \tabskip\centering
+ \halign to \displaywidth
+ {\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
+ &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
+ &\llap{$\@lign##$}\tabskip\z@skip\crcr
+ #1\crcr}}
+
+\def\leqalignno#1%
+ {\displ@y
+ \tabskip\centering
+ \halign to \displaywidth
+ {\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
+ &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
+ &\kern-\displaywidth\rlap{$\@lign##$}\tabskip\displaywidth\crcr
+ #1\crcr}}
+
+\protect \endinput
diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex
index 2cc88200f..9ac574889 100644
--- a/tex/context/base/math-tex.tex
+++ b/tex/context/base/math-tex.tex
@@ -218,6 +218,12 @@
\startmathcollection[default]
+\definemathcommand [square] {\hbox{\hsmash{$\sqcup$}$\sqcap$}}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
\definemathsymbol [coprod] [op] [ex] ["60]
\definemathsymbol [bigvee] [op] [ex] ["57]
\definemathsymbol [bigwedge] [op] [ex] ["56]
@@ -495,4 +501,17 @@
\def\mit {\fam\purefamily{mitfamily}}
\def\cal {\fam\purefamily{calfamily}}
+\startmathcollection[default]
+
+ \definemathsymbol [mathperiod] [ord] [mi] ["3A]
+ \definemathsymbol [textperiod] [punct] [mi] ["3A]
+
+ \definemathsymbol [mathcomma] [ord] [mi] ["3B]
+ \definemathsymbol [textcomma] [punct] [mi] ["3B]
+
+\stopmathcollection
+
+\definemathpunctuation . mathperiod textperiod
+\definemathpunctuation , mathcomma textcomma
+
\protect \endinput
diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex
index e86d4f913..efbd48f0e 100644
--- a/tex/context/base/meta-fig.tex
+++ b/tex/context/base/meta-fig.tex
@@ -41,47 +41,6 @@
%D definitions with the text flow, since all settings are
%D kept local. The page is clipped to the image size.
-% \presetlocalframed[\??mp]
-%
-% \def\setupMPpage%
-% {\dodoubleargument\getparameters[\??mp]}
-%
-% \def\startMPpage%
-% {\dosingleempty\dostartMPpage}
-%
-% \long\def\dostartMPpage[#1]#2\stopMPpage
-% {\pagina
-% \bgroup
-% \setbox\scratchbox=\hbox
-% {\localframed[\??mp][#1]{\startMPcode#2\stopMPcode}}
-% \edef\MPwd{\the\wd\scratchbox}
-% \edef\MPht{\the\ht\scratchbox}
-% \definepapersize
-% [\s!dummy]
-% [\c!breedte=\MPwd,
-% \c!hoogte=\MPht]
-% \startlocal % keep settings as local as can be
-% \setuppapersize
-% [\s!dummy][\s!dummy]
-% \stellayoutin
-% [\c!breedte=\MPwd,\c!hoogte=\MPht,
-% \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint,
-% \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
-% \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
-% \stoplocal % which saves us the trouble of push/pop
-% \startmakeup[\v!standaard]%
-% \centerbox{\box\scratchbox}%
-% \stopmakeup
-% \egroup}
-%
-% \setupMPpage
-% [\c!strut=\v!nee,
-% \c!uitlijnen=,
-% \c!offset=\v!overlay,
-% \c!breedte=\v!passend,
-% \c!hoogte=\v!passend,
-% \c!kader=\v!uit]
-
% generalized, so this belongs in another module
\def\dostartfittingpage[#1][#2]%
@@ -94,22 +53,22 @@
\def\dostopfittingpage%
{\egroup\egroup\egroup
- \edef\fittingwd{\the\wd\scratchbox}
- \edef\fittinght{\the\ht\scratchbox}
+ \edef\fittingwd{\the\wd\scratchbox}%
+ \edef\fittinght{\the\ht\scratchbox}%
\definepapersize
[\s!dummy]
[\c!breedte=\fittingwd,
- \c!hoogte=\fittinght]
+ \c!hoogte=\fittinght]%
\startlocal % keep settings as local as can be
\setuppapersize
- [\s!dummy][\s!dummy]
+ [\s!dummy][\s!dummy]%
\stellayoutin
[\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden,
\c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint,
\c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
- \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
+ \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]%
\stoplocal % which saves us the trouble of push/pop
- \startmakeup[\v!standaard]%
+ \startmakeup[\v!standaard][\c!dubbelzijdig=\v!nee,\c!pagina=]%
\centerbox{\box\scratchbox}%
\stopmakeup
\egroup}
@@ -126,7 +85,7 @@
\long\def\dostartMPpage[#1]#2\stopMPpage
{\dostartfittingpage[\??mg][#1]%
- \startMPcode#2\stopMPcode%
+ \startMPcode#2\stopMPcode
\dostopfittingpage}
\setupMPpage
@@ -167,7 +126,7 @@
\def\MPfigure#1#2% test for dup figure
{\bgroup
- \getfiguredimensions[#1][\c!object=\v!nee]%
+ \getfiguredimensionsonly[#1]% [\c!object=\v!nee] already set
\freezedimenmacro\naturalfigurewidth
\freezedimenmacro\naturalfigureheight
\startMPcode
diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex
index 6a8d90399..f7c337645 100644
--- a/tex/context/base/meta-ini.tex
+++ b/tex/context/base/meta-ini.tex
@@ -11,6 +11,11 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% currently the running color influences the mp graphic in
+% pdftex, but this will change [i.e. become optional]; one
+% problem is that pdf has no grouping with regards to the
+% color
+
\writestatus{loading}{MetaPost Graphics / Initializations}
\unprotect
@@ -57,6 +62,8 @@
%D macros. so let's first preload a few auxiliary \METAPOST\
%D files.
+\maxnofMPgraphics = 8000 % metafun disables the 4K boundary
+
\appendtoks
if unknown context_tool : input mp-tool ; fi ;
if unknown context_spec : input mp-spec ; fi ;
@@ -83,13 +90,19 @@
\appendtoks \let\handlecompoundcharacter\string \to \everyMPgraphic
+%D Another one:
+
+\prependtoks \MPstaticgraphictrue \to \everyoverlay
+\prependtoks \MPstaticgraphictrue \to \everypagebody
+
%D We save the number of graphics for the sake of \TEXEXEC.
\newcounter\totalnumberofMPgraphics
-\def\thecurrentMPgraphic{\the\currentMPgraphic}
+
+\def\thenofMPgraphics{\the\nofMPgraphics} % from supp-mps
\appendtoks
- \savecurrentvalue\totalnumberofMPgraphics\thecurrentMPgraphic
+ \savecurrentvalue\totalnumberofMPgraphics\thenofMPgraphics
\to \everybye
%D \macros
@@ -120,8 +133,26 @@
\let\@@framed\s!unknown
+% \def\MPvariable#1%
+% {\getvalue{\ifundefined{\@@framed\@@meta#1}\else\@@framed\fi\@@meta#1}}
+
+\beginTEX
+
\def\MPvariable#1%
- {\getvalue{\ifundefined{\@@framed\@@meta#1}\else\@@framed\fi\@@meta#1}}
+ {\csname
+ \@EA\ifx\csname\@@framed\@@meta#1\endcsname\relax\else\@@framed\fi\@@meta#1%
+ \endcsname}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\MPvariable#1%
+ {\csname
+ \ifcsname\@@framed\@@meta#1\endcsname\@@framed\fi\@@meta#1%
+ \endcsname}
+
+\endETEX
\let\MPvar\MPvariable
@@ -146,18 +177,22 @@
%D
%D \starttypen
%D \long\def\startuniqueMPgraphic#1#2\stopuniqueMPgraphic%
-%D {\setvalue{MP:#1}%
+%D {\setvalue{\@@MPG#1}%
%D {\startreusableMPgraphic{\overlaystamp:#1}#2\stopreusableMPgraphic
%D \reuseMPgraphic{\overlaystamp:#1}}}
%D
%D \def\uniqueMPgraphic#1%
-%D {\getvalue{MP:#1}}
+%D {\getvalue{\@@MPG#1}}
%D \stoptypen
+%\def\overlaystamp% watch the \MPcolor, since colors can be redefined
+% {\overlaywidth:\overlayheight:\overlaydepth
+% :\MPcolor{\overlaycolor}:\MPcolor{\overlaylinecolor}}
+
\def\overlaystamp% watch the \MPcolor, since colors can be redefined
{\overlaywidth:\overlayheight:\overlaydepth
- :\MPcolor{\overlaycolor}:\MPcolor{\overlaylinecolor}}
-
+ :\MPcolor\overlaycolor:\MPcolor\overlaylinecolor}
+
%D A better approach is to let additional variables play a role
%D in determining the uniqueness. In the next macro, the
%D second, optional, argument is used to guarantee the
@@ -176,35 +211,33 @@
%D \uniqueMPgraphic{meta:hash}{gap=10pt,angle=30}
%D \stoptypen
-\def\handleuniqueMPgraphic#1#2#3%
+\long\def\handleuniqueMPgraphic#1#2#3%
{\def\@@meta{#1:}%
\extendMPoverlaystamp{#2}% incl prepare
- %\startreusableMPgraphic{\overlaystamp:#1}#3\stopreusableMPgraphic
- %\getvalue{MP:\overlaystamp:#1}} % no \reuseMPgraphic, else wrong \@@meta
- \ifundefined{MP:\overlaystamp:#1}%
+ \ifundefined{\@@MPG\overlaystamp:#1}%
\enableincludeMPgraphics
\startMPgraphic#3\stopMPgraphic
- \doifobjectssupportedelse{}{\useMPboxfalse}%
+ \doifobjectssupportedelse\donothing\useMPboxfalse
\ifuseMPbox
- \douseMPbox{MP:\overlaystamp:#1}%
+ \@EA\douseMPbox
\else
- \nouseMPbox{MP:\overlaystamp:#1}%
- \fi
+ \@EA\nouseMPbox
+ \fi {\@@MPG\overlaystamp:#1}%
\fi
- \getvalue{MP:\overlaystamp:#1}}
+ \getvalue{\@@MPG\overlaystamp:#1}}
\long\def\startuniqueMPgraphic%
{\dodoublegroupempty\dostartuniqueMPgraphic}
\long\def\dostartuniqueMPgraphic#1#2#3\stopuniqueMPgraphic%
- {\setvalue{MP:#1}{\handleuniqueMPgraphic{#1}{#2}{#3}}}
+ {\long\setvalue{\@@MPG#1}{\handleuniqueMPgraphic{#1}{#2}{#3}}}
\unexpanded\def\uniqueMPgraphic%
{\dodoublegroupempty\douniqueMPgraphic}
\def\douniqueMPgraphic#1#2%
-% {{\def\@@meta{#1:}\setupMPvariables[#2]\getvalue{MP:#1}{}}}
- {{\setupMPvariables[#1][#2]\getvalue{MP:#1}{}}}
+% {{\def\@@meta{#1:}\setupMPvariables[#2]\getvalue{\@@MPG#1}{}}}
+ {{\setupMPvariables[#1][#2]\getvalue{\@@MPG#1}{}}}
\long\def\handleuseMPgraphic#1#2#3%
{\bgroup
@@ -212,22 +245,24 @@
\prepareMPvariables{#2}%
\enableincludeMPgraphics
\startMPgraphic#3\stopMPgraphic
- \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+ \ifMPrun \else % see mfun-004 : processing buffer
+ \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+ \placeMPgraphic
+ \fi
\deallocateMPslot\currentMPgraphic
- \placeMPgraphic
\egroup}
\long\def\startuseMPgraphic%
{\dodoublegroupempty\dostartuseMPgraphic}
\long\def\dostartuseMPgraphic#1#2#3\stopuseMPgraphic%
- {\long\setgvalue{MP:#1}{\handleuseMPgraphic{#1}{#2}{#3}}}
+ {\long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}{#3}}}
\long\def\startusableMPgraphic% % redundant but handy
{\dodoublegroupempty\dostartusableMPgraphic}
\long\def\dostartusableMPgraphic#1#2#3\stopusableMPgraphic%
- {\long\setgvalue{MP:#1}{\handleuseMPgraphic{#1}{#2}{#3}}}
+ {\long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}{#3}}}
\long\def\handlereusableMPgraphic#1#2#3%
{\bgroup
@@ -235,28 +270,31 @@
\prepareMPvariables{#2}%
\enableincludeMPgraphics
\startMPgraphic#3\stopMPgraphic
- \doifobjectssupportedelse{}{\useMPboxfalse}%
+ \doifobjectssupportedelse\donothing\useMPboxfalse
\ifuseMPbox
- \douseMPbox{MP:#1}%
+ \@EA\douseMPbox
\else
- \nouseMPbox{MP:#1}%
- \fi
- \getvalue{MP:#1}%
+ \@EA\nouseMPbox
+ \fi {\@@MPG#1}%
+ \getvalue{\@@MPG#1}%
\egroup}
\long\def\startreusableMPgraphic%
{\dodoublegroupempty\dostartreusableMPgraphic}
-\long\def\dostartreusableMPgraphic#1#2#3\stopreusableMPgraphic%
- {\ifundefined{MP:#1}%
- \long\setgvalue{MP:#1}{\handlereusableMPgraphic{#1}{#2}{#3}}%
- \fi}
+% \long\def\dostartreusableMPgraphic#1#2#3\stopreusableMPgraphic%
+% {\ifundefined{\@@MPG#1}%
+% \long\setgvalue{\@@MPG#1}{\handlereusableMPgraphic{#1}{#2}{#3}}%
+% \fi}
+
+\long\def\dostartreusableMPgraphic#1#2#3\stopreusableMPgraphic
+ {\long\setgvalue{\@@MPG#1}{\handlereusableMPgraphic{#1}{#2}{#3}}}
\unexpanded\def\useMPgraphic%
{\dodoublegroupempty\douseMPgraphic}
\def\douseMPgraphic#1#2%
- {{\setupMPvariables[#1][#2]\getvalue{MP:#1}{}}}
+ {{\setupMPvariables[#1][#2]\getvalue{\@@MPG#1}{}}}
\let\reuseMPgraphic\useMPgraphic
@@ -302,11 +340,12 @@
%D We redefine \type {\extendMPoverlaystamp} to preprocess
%D variables using \type {\prepareMPvariable}.
+\def\doextendMPoverlaystamp#1%
+ {\prepareMPvariable{#1}%
+ \edef\overlaystamp{\overlaystamp:\MPvariable{#1}}}
+
\def\extendMPoverlaystamp#1%
- {\def\docommando##1%
- {\prepareMPvariable{##1}%
- \edef\overlaystamp{\overlaystamp:\MPvariable{##1}}}%
- \processcommalist[#1]\docommando}
+ {\processcommalist[#1]\doextendMPoverlaystamp}
\def\prepareMPvariables#1%
{\processcommalist[#1]\prepareMPvariable}
@@ -319,6 +358,15 @@
\def\MPdatafile%
{\bufferprefix mpd-\the\currentMPgraphic.mpd}
+%D \macros
+%D {MPrunfile}
+%D
+%D This one is more abstract and does not assume knowledge
+%D of buffer prefixes.
+
+\def\MPrunfile#1%
+ {\bufferprefix mprun.#1}
+
%D We also have to make sure that \METAPOST\ knows this:
\appendtoks
@@ -367,20 +415,22 @@
{\doifelsenothing{#1}
{\doprocessMPbuffer[\jobname]}
{\bgroup
- \let\par\empty
- \!!toksa=\emptytoks
+ \setnormalcatcodes
+ %\let\par\empty % oeps, this makes dvi mode graphics hang when not found
+ \!!toksa\emptytoks
\def\copyMPbufferline{\expandafter\appendtoks\fileline\to\!!toksa}%
\def\dodoprocessMPbuffer##1%
{\doprocessfile\scratchread{\TEXbufferfile{##1}}\copyMPbufferline}%
\processcommalist[#1]\dodoprocessMPbuffer
- \ifMPrun
- \@EA\startMPrun\the\!!toksa\stopMPrun
- \else
- \@EA\startuseMPgraphic\@EA{\@EA\s!dummy\@EA}\the\!!toksa\stopuseMPgraphic
- \useMPgraphic{\s!dummy}%
- \fi
+ \@EA\startMPcode\the\!!toksa\stopMPcode % more efficient
\egroup}}
+\def\runMPbuffer%
+ {\dosingleempty\dorunMPbuffer}
+
+\def\dorunMPbuffer[#1]% processing only
+ {{\MPruntrue\doprocessMPbuffer[#1]}}
+
%D \macros
%D {startMPenvironment, resetMPenvironment}
%D
@@ -391,6 +441,8 @@
\newtoks\everyMPTEXgraphic
\fi
+%D A more generar of passing environments is:
+
\def\startMPenvironment% % second arg gobbles spaces, so
{\dodoubleempty\dostartMPenvironment} % that reset gives \emptytoks
@@ -404,11 +456,11 @@
\def\resetMPenvironment%
{\everyMPTEXgraphic=\emptytoks % = is really needed !
\startMPenvironment
- \global\loadfontdefinitionfileoncetrue
+ \global\loadfontfileoncetrue
\stopMPenvironment}
\startMPenvironment
- \global\loadfontdefinitionfileoncetrue
+ \global\loadfontfileoncetrue
\stopMPenvironment
%D This command takes \type {[reset]} as optional
@@ -436,11 +488,17 @@
% \immediate\closeout\MPwrite
% }%\fi}
-
\def\initializeMPgraphicfile
- {\immediate\openout\MPwrite\MPgraphicfile.mp
- \immediate\write\MPwrite{end.}%
- \immediate\closeout\MPwrite}
+ {\bgroup
+ \doinitializeMPgraphicfile
+ \MPruntrue
+ \doinitializeMPgraphicfile
+ \egroup}
+
+\def\doinitializeMPgraphicfile
+ {\immediate\openout\scratchwrite\MPgraphicfile.mp
+ \immediate\write\scratchwrite{end.}%
+ \immediate\closeout\scratchwrite}
\def\initializeMPgraphics%
{\bgroup
@@ -538,6 +596,11 @@
\includeMPgraphic{init data}
\to \MPinitializations
+\appendtoks
+ \baselineskip1\baselineskip
+ \lineheight 1\lineheight
+\to \everyMPgraphic
+
% this will become (more efficient)
%
% \startuseMPgraphic{init data}
@@ -597,17 +660,83 @@
%D given of course that we use \PDFTEX. As a result we need to
%D fool around with the object trigger.
+\newtoks\everyinsertMPfile
+
+%D First we present the reasonable fast alternative that we
+%D happily used for some time.
+%D
+%D \starttypen
+%D \def\insertMPfile#1#2%
+%D {\ifx\undefined\externalfigure
+%D \message{[insert file #1 here]}%
+%D \else
+%D \bgroup
+%D \the\everyinsertMPfile
+%D \externalfigure
+%D [#1]
+%D [\c!type=\c!mps,\c!object=\v!nee,%
+%D \c!symbool=\v!ja,\c!reset=\v!ja,%
+%D \c!maxbreedte=,\c!maxhoogte=,%
+%D \c!kader=\v!uit,\c!achtergrond=,%
+%D #2]%
+%D \egroup
+%D \fi}
+%D \stoptypen
+%D
+%D However, on a 1 Gig Pentium, the next alternative saves
+%D us 20 seconds run time for the 300 page \METAFUN\ manual:
+
\def\insertMPfile#1#2%
- {\ifx\pdfoutput\undefined
- \doinsertMPfile{#1}%
- \else\ifcase\pdfoutput
- \doinsertMPfile{#1}%
- \else
- \doiffileelse{#1}
- {{\chardef\makeMPintoPDFobject=2 % in order to handle specials
- \convertMPtoPDF{#1}{1}{1}}}
- {\doinsertMPfile{#1}}%
- \fi\fi}
+ {\doiffileelse{./#1}
+ {\ifcase\pdfoutput
+ \@EA\includeMPasEPS\else\@EA\includeMPasPDF
+ \fi{./#1}}
+ {\message{[MP #1]}}}
+
+\def\includeMPasEPS#1%
+ {\bgroup
+ \message{[MP as EPS #1]}%
+ \the\everyinsertMPfile
+ \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb
+ \setbox\scratchbox\vbox to \!!heightb
+ {\vfill
+ \doinsertfile
+ {\c!mps,\c!mps}{#1,\empty}{100}{100}
+ \!!widtha\!!heighta\!!widthb\!!heightb{0}}%
+ \wd\scratchbox\!!widthb
+ \dp\scratchbox\zeropoint
+ \box\scratchbox
+ \egroup}
+
+\def\includeMPasPDF#1%
+ {\bgroup
+ \the\everyinsertMPfile
+ \ifinobject \else \chardef\makeMPintoPDFobject=2 \fi % when needed
+ \convertMPtoPDF{#1}{1}{1}%
+ \egroup}
+
+%D So, using a low level approach (thereby avoiding the slower
+%D figure analysis macros) pays off. This kind of
+%D optimizations are a bit tricky since we must make sure that
+%D special resources end up in the (PDF) files. Because the
+%D \METAPOST\ to \PDF\ can handle objects itself, it is not
+%D that complicated.
+
+%D We hook a couple of initializations into the graphic
+%D macros.
+
+\appendtoks
+ \let\figuretypes\c!mps
+ \runutilityfilefalse
+ \consultutilityfilefalse
+\to \everyinsertMPfile
+
+%D And some more. These are not really needed since we
+%D don't use the normal figure inclusion macros any longer.
+
+\appendtoks
+ \externalfigurepostprocessors\emptytoks % safeguard
+\to \everyinsertMPfile
%D We also take care of disabling fancy figure features, that
%D can terribly interfere when dealing with symbols,
@@ -616,13 +745,9 @@
%D can occur. One took me over a day to uncover when
%D processing the screen version of the \METAFUN\ manual.
-\def\doinsertMPfile#1%
- {\externalfigure
- [#1]
- [\c!type=\c!mps,\c!object=\v!nee,
- \c!reset=\v!ja,\c!symbool=\v!ja,
- \c!maxbreedte=,\c!maxhoogte=,
- \c!kader=\v!uit,\c!achtergrond=]}
+%D For my eyes only:
+
+\def\doifelseMPgraphic#1{\doifdefinedelse{\@@MPG#1}}
\protect \endinput
diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex
index e1deafb21..90c8cc25b 100644
--- a/tex/context/base/meta-pag.tex
+++ b/tex/context/base/meta-pag.tex
@@ -1,38 +1,39 @@
%D \module
%D [ file=meta-ini,
%D version=1999.07.10,
-%D title=\METAPOST\ Graphics,
-%D subtitle=Initialization,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Initialization,
%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.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
%D These definitions used to be part of the old \type
%D {core-mps} file, later changed into \type {meta-ini}, but
-%D keeping them separate is cleaner.
+%D keeping them separate is cleaner.
\writestatus{loading}{MetaPost Graphics / Page Data Management}
-\unprotect
+\unprotect
-\appendtoks
- if unknown context_page : input mp-page ; fi ;
-\to \MPinitializations
+\appendtoks
+ if unknown context_page : input mp-page ; fi ;
+\to \MPinitializations
-%D The next few macros tell \METAPOST\ how the \CONTEXT\
-%D pagebody looks.
+%D The next few macros tell \METAPOST\ how the \CONTEXT\
+%D pagebody looks.
\startuseMPgraphic{page data}
- boolean PageStateAvailable ; PageStateAvailable := true ;
- boolean OnRightPage ; OnRightPage := true ;
- def LoadPageState =
- OnRightPage := \MPonrightpage ;
- RealPageNumber := \the\realpageno ;
- PageNumber := \the\pageno ;
+ boolean PageStateAvailable, OnRightPage, InPageBody ;
+ PageStateAvailable := OnRightPage := true ;
+ InPageBody := \ifinpagebody true \else false \fi ;
+ def LoadPageState =
+ OnRightPage := \MPonrightpage ;
+ RealPageNumber := \the\realpageno ;
+ PageNumber := \the\pageno ;
NOfPages := \lastpage ;
PaperHeight := \the\papierhoogte ;
PaperWidth := \the\papierbreedte ;
@@ -60,67 +61,61 @@
RightMarginWidth := \the\rechtermargebreedte ;
RightEdgeDistance := \@the\rechterrandafstand ;
RightEdgeWidth := \the\rechterrandbreedte ;
- PageOffset := \MPpageoffset ;
- PageDepth := \MPpagedepth ;
- enddef ;
+ PageOffset := \the\pageoffset ;
+ PageDepth := \the\pagedepth ;
+ enddef ;
\stopuseMPgraphic
-
-\def\MPonrightpage{true}
-\let\MPpageoffset \!!zeropoint
-\let\MPpagedepth \!!zeropoint
+
+\def\MPonrightpage{true}
\def\freezeMPpagelayout%
- {\doifelsevalue{\??ma\v!pagina\c!offset}{\v!overlay}
- {\let\MPpageoffset\!!zeropoint}
- {\edef\MPpageoffset{\getvalue{\??ma\v!pagina\c!offset}}}%
- \edef\MPpagedepth{\getvalue{\??ma\v!pagina\c!diepte}}%
- \freezedimenmacro\MPpageoffset
- \freezedimenmacro\MPpagedepth
- \doifbothsides
- \def\MPonrightpage{true}%
+ {% the \edef\MPonrightpage{....} alternative is slower
+ \doifbothsides
+ \def\MPonrightpage{true}%
\orsideone
- \def\MPonrightpage{true}%
+ \def\MPonrightpage{true}%
\orsidetwo
- \def\MPonrightpage{false}%
+ \def\MPonrightpage{false}%
\od}
-
-\iffixedlayoutdimensions
+
+\iffixedlayoutdimensions
\let\freezeMPlayout\relax
\else
\def\freezeMPlayout% must be done more efficient
- {\freezedimenmacro\bovenafstand
- \freezedimenmacro\hoofdafstand
- \freezedimenmacro\voetafstand
- \freezedimenmacro\onderafstand
- \freezedimenmacro\linkerrandafstand
- \freezedimenmacro\linkermargeafstand
- \freezedimenmacro\rechtermargeafstand
- \freezedimenmacro\rechterrandafstand}
+ {\freezedimenmacro\bovenafstand
+ \freezedimenmacro\hoofdafstand
+ \freezedimenmacro\voetafstand
+ \freezedimenmacro\onderafstand
+ \freezedimenmacro\linkerrandafstand
+ \freezedimenmacro\linkermargeafstand
+ \freezedimenmacro\rechtermargeafstand
+ \freezedimenmacro\rechterrandafstand}
\fi
-%D We need to freeze the pagelayout before the backgrounds
-%D are build, because the overlay will temporarily become
+%D We need to freeze the pagelayout before the backgrounds
+%D are build, because the overlay will temporarily become
%D zero (overlay).
-\appendtoks
- \freezeMPpagelayout
-\to \everypagebody
+\appendtoks
+ \freezeMPpagelayout
+\to \everybeforepagebody
-%D By freezing these value every graphic, we can use layout
-%D variables that change halfways a page, whatever use that
-%D has.
+%D By freezing these value every graphic, we can use layout
+%D variables that change halfways a page, whatever use that
+%D has.
-\prependtoks
+\prependtoks
\calculatereducedvsizes % this is really needed
- \freezeMPlayout % to be used grouped
-\to \everyMPgraphic
+ \freezeMPpagelayout
+ \freezeMPlayout % to be used grouped
+\to \everyMPgraphic
-\appendtoks
- \includeMPgraphic{page data}
+\appendtoks
+ \includeMPgraphic{page data}
\to \MPinitializations
-\protect \endinput
+\protect \endinput
diff --git a/tex/context/base/meta-txt.tex b/tex/context/base/meta-txt.tex
index 87605556d..85d12d68e 100644
--- a/tex/context/base/meta-txt.tex
+++ b/tex/context/base/meta-txt.tex
@@ -25,7 +25,7 @@
\unprotect
\appendtoks
- input mp-text ;
+ if unknown context_text : input mp-text ; fi ;
\to \MPinitializations
%%%%%%%
@@ -48,7 +48,7 @@
\expanded{\switchtobodyfont[\@@shkorps]}%
\dontcomplain
\hsize\parwidth
- \setuptolerance[\v!zeersoepel,\v!rek]%
+ \steltolerantiein[\v!zeersoepel,\v!rek]%
\!!counta=0
\!!toksa=\emptytoks
\def\docommando##1%
@@ -83,12 +83,12 @@
\else
\advance\!!counta by -1
\fi}%
- \!!counta=\prevgraf
+ \!!counta\prevgraf
\doglobal\decrement(\totalparlines,\!!counta)%
\multiply\!!counta by 2
- \!!toksa=\emptytoks
+ \!!toksa\emptytoks
\expanded{\processseparatedlist[\the\partoks][\space]}\docommando
- \global\partoks=\!!toksa
+ \global\partoks\!!toksa
%\ifx\partoks\emptytoks\else % safeguard
\expanded{\parshape\totalparlines\the\partoks}%
}%\fi}
@@ -96,18 +96,18 @@
\def\getshapecharacteristics%
{\doglobal\increment\currentshapetext
\doifdefinedelse{parlines:\currentshapetext}
- {\global\parlines =\getvalue{parlines:\currentshapetext}%
- \global\chardef\parfirst =\getvalue{parfirst:\currentshapetext}%
- \global\parvoffset =\getvalue{parvoffset:\currentshapetext}%
- \global\parhoffset =\getvalue{parhoffset:\currentshapetext}%
- \global\parwidth =\getvalue{parwidth:\currentshapetext}%
- \global\parheight =\getvalue{parheight:\currentshapetext}}
- {\global\parlines =1
- \global\chardef\parfirst =0
- \global\parvoffset =\!!zeropoint
- \global\parhoffset =\!!zeropoint
- \global\parwidth =\hsize
- \global\parheight =\vsize}}
+ {\global\parlines \getvalue{parlines:\currentshapetext}%
+ \global\chardef\parfirst \getvalue{parfirst:\currentshapetext}%
+ \global\parvoffset \getvalue{parvoffset:\currentshapetext}%
+ \global\parhoffset \getvalue{parhoffset:\currentshapetext}%
+ \global\parwidth \getvalue{parwidth:\currentshapetext}%
+ \global\parheight \getvalue{parheight:\currentshapetext}}
+ {\global\parlines 1
+ \global\chardef\parfirst 0
+ \global\parvoffset \zeropoint
+ \global\parhoffset \zeropoint
+ \global\parwidth \hsize
+ \global\parheight \vsize}}
\def\setshapecharacteristics%
{\doglobal\increment\currentshapetext
@@ -123,14 +123,14 @@
\forgetall
\setbox\scratchbox\vbox to \parheight
{\expanded{\switchtobodyfont[\@@shkorps]}% evt strutheight en
- \splittopskip=\strutheight % lineheight opslaan
+ \splittopskip\strutheight % lineheight opslaan
\vskip\parvoffset % scheelt switch en
\ifcase\parfirst\or\vskip\lineheight\fi % is ook veiliger
\hskip\parhoffset
\hbox{\vsplit\shapetextbox to \parlines\lineheight}}%
- \wd\scratchbox=\parwidth
- \ht\scratchbox=\parheight
- \dp\scratchbox=\!!zeropoint
+ \wd\scratchbox\parwidth
+ \ht\scratchbox\parheight
+ \dp\scratchbox\zeropoint
\box\scratchbox
\getshapecharacteristics
\egroup}
@@ -175,6 +175,7 @@
\handletokens#1\with\processfollowingtoken
\startMPdrawing
if unknown RotPath : path RotPath ; RotPath := origin ; fi ;
+ if unknown RotColor : color RotColor ; RotColor := black ; fi ;
if unknown TraceRot : boolean TraceRot ; TraceRot := false ; fi ;
if unknown ExtraRot : numeric ExtraRot ; ExtraRot := 0 ; fi ;
numeric al, at, pl, wid, pos ; pair ap, ad ;
@@ -187,7 +188,7 @@
RotPath := RotPath scaled ((len[n]+ExtraRot)/al) ;
al := arclength RotPath ;
fi ;
- pl := (al-len[n])/(n-1) ;
+ pl := (al-len[n])/(if n>1 : (n-1) else : 1 fi) ;
if TraceRot :
draw RotPath withpen pencircle scaled 1pt withcolor blue ;
fi ;
@@ -197,7 +198,8 @@
at := arctime pos of RotPath ;
ap := point at of RotPath ;
ad := direction at of RotPath ;
- draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap ;
+ draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap
+ withcolor RotColor ;
if TraceRot :
draw boundingbox
pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap
@@ -274,4 +276,18 @@
\setlocalhsize \noindent \reuseMPgraphic{EnglishRule}
\stoplinecorrection}
+%D The following macro returns a tight bound character
+%D sequence.
+%D
+%D \startlinecorrection
+%D \TightText{\ss\bf 123}{0cm}{3cm}{red}
+%D \stoplinecorrection
+
+\def\TightText#1#2#3#4%
+ {\hbox % \ruledhbox
+ {\startMPcode
+ picture p ; p := image (graphictext "#1" withfillcolor red) ;
+ draw p xsized #2 ysized #3 withcolor \MPcolor{#4} ;
+ \stopMPcode}}
+
\protect \endinput
diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex
index d04ad2059..98a2e0441 100644
--- a/tex/context/base/mult-com.tex
+++ b/tex/context/base/mult-com.tex
@@ -22,7 +22,7 @@
%D
%D The German translations were provided by Tobias Burnus,
%D the Czech ones by Tom Hudec, and the Italian ones
-%D by Giuseppe Bilotta. Here we include their comments.
+%D by Giuseppe Bilotta. Here we include their comments.
%D Giuseppe Bilotta: \citaat {Having to choose between a
%D full|-|length name and a shortcut, I decided to resort to the
@@ -34,7 +34,7 @@
%D \tex{impostapdp}, and so for all composed words: \tex{footnote}
%D (nota a pi\`e di pagina) becomes \tex{notapdp};
%D \tex{footnotetext} (testo della nota a pi\`e di pagina) becomes
-%D \tex{testonotapdp}; and so on.}
+%D \tex{testonotapdp}; and so on.}
\writestatus{loading}{Context Multilingual Macros / Commands}
@@ -757,13 +757,13 @@
kolom: kolom column
spalte sloupec
colonna coloana
- kop: kop head
+ head: kop head
kopf nadpis
testa titlu % GB
but: but but
but spodek
fondo but
- som: som item
+ item: som item
pos polozka
elemento element
nop: nop nop
@@ -780,19 +780,26 @@
el el % abbr. of elemento (it) element (ro)
ran: ran ran
ran ran
- ran ran
- startopsomming: startopsomming startitemize
- startaufzaehlung startvycet
- iniziaelenco startenumerare
- stelopsommingenin: stelopsommingenin setupitemizations
+ ran ran
+% new
+ setupitemgroups: stelitemgroepenin setupitemgroups
+ setupitemgroups setupitemgroups
+ setupitemgroups setupitemgroups
+% downward compatible
+ setupitemgroups: stelopsommingenin setupitemizations
stelleaufzaehlungenein nastavvycty
impostaelencazioni setareitemization
- stelopsommingin: stelopsommingin setupitemize
+% will be replaced / generatated
+ startitemize: startopsomming startitemize
+ startaufzaehlung startvycet
+ iniziaelenco startenumerare
+ setupitemize: stelopsommingin setupitemize
stelleaufzaehlungein nastavvycet
impostaelenco setareenumerare
- stopopsomming: stopopsomming stopitemize
+ stopitemize: stopopsomming stopitemize
stopaufzaehlung stopvycet
terminaelenco stopenumerare
+%
definieerkop: definieerkop definehead
definiereueberschrift definujnadpis
definiscitesta definesteantet
@@ -1087,6 +1094,9 @@
stelplaatsblokkensplitsenin: stelplaatsblokkensplitsenin setupfloatsplitting
stelleplatziegeteiltegleitobjekt nastavdeleniplvoucichobjektu
impostaspezzamentooggettomobile seteazaimpartireafloat
+ placefloat: plaatsplaatsblok placefloat
+ placefloat placefloat
+ placefloat placefloat %%%
startcombinatie: startcombinatie startcombination
startkombination startspojeni
iniziacombinazione startcombinare
@@ -1468,9 +1478,12 @@
gebruikcommandos: gebruikcommandos usecommands
verwendebefehl uzijprikazy
usacomandi folosestecomenzi
- definieerstartstop: definieerstartstop definestartstop
+ definestartstop: definieerstartstop definestartstop
definierestartstop definujstartstop
definisciiniziatermina definestestartstop
+ setupstartstop: stelstartstopin setupstartstop
+ setupstartstop setupstartstop
+ impostainiziatermina setupstartstop
startlocal: startlokaal startlocal
startlokal startlokalni
inizialocale startlocal
@@ -1551,7 +1564,7 @@
impostaposizionamento setarepozitie
roteer: roteer rotate
drehen otocit
- rotazione roteste % GB
+ ruota roteste % GB
stelroterenin: stelroterenin setuprotate
stelledrehenein nastavotoceni
impostarotazione seteazarotare
@@ -1560,7 +1573,7 @@
riflessione reflexie
schaal: schaal scale
format meritko
- scale scala % GB
+ scala scala % GB
stelnummerenin: stelnummerenin setupnumbering
stellenummerierungein nastavcislovani
impostanumerazione seteazanumerotare
@@ -1713,7 +1726,7 @@
impostaposizionetesto seteazapozitietext
positiontext: positioneertekst positiontext
positiontext positiontext
- posizionetesto pozitietext % GB
+ posizionatesto pozitietext % GB
definerawfont: definerawfont definerawfont
definerawfont definerawfont
definiscifontgrezzo definestefontraw
@@ -1826,6 +1839,12 @@
printpapierhoogte: printpapierhoogte printpaperheight
printpapierhoehe vyskatiskpapiru
altezzacartastampa inaltimehartieimprimanta % GB
+ pageoffset: paginaoffset pageoffset
+ pageoffset pageoffset
+ pageoffset pageoffset
+ pagedepth: paginadiepte pagedepth
+ pagedepth pagedepth
+ pagedepth pagedepth
kopniveau: kopniveau headlevel
kopfniveau hlavniuroven
livellotesta niveltitlu % GB
diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex
index d7cc303ae..b7f1ee84a 100644
--- a/tex/context/base/mult-con.tex
+++ b/tex/context/base/mult-con.tex
@@ -873,6 +873,9 @@
paginaovergangen: paginaovergangen pageboundaries
seitenbegrenzung hranicestranky
limitipagina marginipagina
+ paginastatus: paginastatus pagestate
+ pagestate pagestate
+ statopagina pagestate % TODO
palet: palet palet
palette paleta
tavolozza paleta
@@ -969,6 +972,9 @@
regels: regels lines
zeilen radky
righe linii
+ rek: rek stretch
+ strecken natahnout
+ dilata dilatat % CHECK
resolutie: resolutie resolution
aufloesung rozliseni
risoluzione rezolutie
@@ -2262,6 +2268,9 @@
interactiemenu: interactiemenu interactionmenu
interaktionsmenue interaktivnimenu
menuinterattivo meniuinteractiune
+ itemize: opsomming itemize
+ aufzaehlung vycet
+ elenco enumerare
laad: laad load
laden nacist
carica incarca
@@ -2300,13 +2309,19 @@
termina stop
tabelkop: tabelkop tablehead
tabellenueberschrift zahlavitabulky
- testatabella antettabel % GB
+ testatabella antettabel
tabelstaart: tabelstaart tabletail
tabellenende konectabulky
- codatabella subsoltabel % GB
+ codatabella subsoltabel
tabulate: tabulatie tabulate
tabulator tabelator
- tabulate tabulate % GB
+ tabulato tabulate
+ tabulatehead: tabulatiekop tabulatehead
+ tabulatehead tabulatehead
+ testatabulato tabulatehead %
+ tabulatetail: tabulatiestaart tabulatetail
+ tabulatetail tabulatetail
+ codatabulato tabulatetail %
tekst: tekst text
text text
testo text
@@ -2436,13 +2451,13 @@
StartSound: StartGeluid StartSound
StartSound StartZvuk
IniziaSuono StartSunet % TB
- StopSound: StopFilm StopSound
+ StopSound: StopGeluid StopSound
StopSound StopZvuk
FermaSuono StopSunet % TB
- PauseSound: PauzeerFilm PauseSound
+ PauseSound: PauzeerGeluid PauseSound
PauseSound PozastavitZvuk
PausaSuono PauzaSunet % TB
- ResumeSound: HervatSound ResumeSound
+ ResumeSound: HervatGeluid ResumeSound
ResumeSound PokracovatZvuk
RiprendiSuono RepornesteSunet % TB
SaveForm: BewaarFormulier SaveForm
diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex
index f76e7943f..98af68127 100644
--- a/tex/context/base/mult-ini.tex
+++ b/tex/context/base/mult-ini.tex
@@ -347,8 +347,7 @@
\def\findinterfacemessage#1#2%
{\let#2\empty
- \def\dofindinterfacemessage##1 #1: ##2\relax##3\end%
- {\def#2{##2}}%
+ \def\dofindinterfacemessage##1 #1: ##2\relax##3\end{\def#2{##2}}%
\edef\!!stringa{\getvalue{\??ms\currentmessagelibrary} #1: \relax}%
\expandafter\dofindinterfacemessage\!!stringa\end}
@@ -404,11 +403,10 @@
\def\getinterfacemessage%
{\ifx\next\stopmessages
- \def\next##1{\egroup}%
+ \egroup\expandafter\gobbleoneargument
\else
- \let\next\addinterfacemessage
- \fi
- \next}
+ \expandafter\addinterfacemessage
+ \fi}
\def\startmessages #1 library: #2
{\definemessageconstant{#2}% handy for modules
@@ -572,12 +570,12 @@
\def\docopyvalue#1#2#3% c -> k
{\p!doifundefined{\k!prefix!#3}%
\let\donottest\doprocesstest
- \@EA\@EA\@EA\def\@EA
+ \@EAEAEA\def\@EA
\csname\@EA#1\@EA#3\@EA
\endcsname\@EA{\csname#2#3\endcsname}%
\else
\let\donottest\doprocesstest
- \@EA\@EA\@EA\def\@EA
+ \@EAEAEA\def\@EA
\csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA
\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
\fi}
@@ -622,30 +620,30 @@
{\let\c!internal!\c!internal!n
\@EA\ifx\csname\k!prefix!#2\endcsname\relax
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA\@EA\csname#1#2\endcsname
+ \@EAEAEA\def\@EA\@EA\csname#1#2\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EAEAEA\def\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
\fi}
\def\dosetevalue#1#2%
{\let\c!internal!\c!internal!n
\@EA\ifx\csname\k!prefix!#2\endcsname\relax
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\edef\@EA\@EA\csname#1#2\endcsname
+ \@EAEAEA\edef\@EA\@EA\csname#1#2\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\edef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EAEAEA\edef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
\fi}
\def\dosetgvalue#1#2%
{\let\c!internal!\c!internal!n
\@EA\ifx\csname\k!prefix!#2\endcsname\relax
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\gdef\@EA\@EA\csname#1#2\endcsname
+ \@EAEAEA\gdef\@EA\@EA\csname#1#2\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\gdef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EAEAEA\gdef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
\fi}
% so far
@@ -654,12 +652,12 @@
{\let\c!internal!\c!internal!n
\@EA\ifx\csname\k!prefix!#3\endcsname\relax
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA
+ \@EAEAEA\def\@EA
\csname\@EA#1\@EA#3\@EA
\endcsname\@EA{\csname#2#3\endcsname}%
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA
+ \@EAEAEA\def\@EA
\csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA
\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
\fi}
@@ -699,51 +697,93 @@
% \fi}
%
% cleaner (not that much faster) don't pass #3 yet:
+%
+% \def\dosetvalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\def\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\def\@EA\@EA\csname#1#2\endcsname
+% \fi}
+%
+% \def\dosetevalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\edef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\edef\@EA\@EA\csname#1#2\endcsname
+% \fi}
+%
+% \def\dosetgvalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\gdef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\gdef\@EA\@EA\csname#1#2\endcsname
+% \fi}
+%
+% \def\docopyvalue#1#2#3%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#3\endcsname
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\def\@EA
+% \csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA
+% \endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
+% \else
+% \let\c!internal!\c!internal!y
+% \@EAEAEA\def\@EA
+% \csname\@EA#1\@EA#3\@EA
+% \endcsname\@EA{\csname#2#3\endcsname}%
+% \fi}
+%
+% sligntly more efficient (but not faster in day to day runs)
\def\dosetvalue#1#2%
{\let\c!internal!\c!internal!n
\ifcsname\k!prefix!#2\endcsname
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EA\def\csname#1\csname\k!prefix!#2\endcsname%\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA\@EA\csname#1#2\endcsname
- \fi}
+ \@EA\def\csname#1#2%\endcsname
+ \fi\endcsname}
\def\dosetevalue#1#2%
{\let\c!internal!\c!internal!n
\ifcsname\k!prefix!#2\endcsname
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\edef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EA\edef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\edef\@EA\@EA\csname#1#2\endcsname
- \fi}
+ \@EA\edef\csname#1#2%\endcsname
+ \fi\endcsname}
\def\dosetgvalue#1#2%
{\let\c!internal!\c!internal!n
\ifcsname\k!prefix!#2\endcsname
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\gdef\@EA\@EA\csname#1\csname\k!prefix!#2\endcsname\endcsname
+ \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\gdef\@EA\@EA\csname#1#2\endcsname
- \fi}
-
-% so far
+ \@EA\gdef\csname#1#2%\endcsname
+ \fi\endcsname}
\def\docopyvalue#1#2#3%
{\let\c!internal!\c!internal!n
\ifcsname\k!prefix!#3\endcsname
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA
- \csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA
+ \@EAEAEA\def\@EA\@EA
+ \csname#1\csname\k!prefix!#3\endcsname
\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
\else
\let\c!internal!\c!internal!y
- \@EA\@EA\@EA\def\@EA
- \csname\@EA#1\@EA#3\@EA
- \endcsname\@EA{\csname#2#3\endcsname}%
+ \@EAEAEA\def\@EA\@EA\csname#1#3\endcsname\@EA{\csname#2#3\endcsname}%
\fi}
\endETEX
@@ -1296,7 +1336,7 @@
{\doifdefinedelse{#2}
{\debuggerinfo{command}{core command #2 redefined as #1}}%
{\debuggerinfo{command}{#2 defined as #1}}%
- \@EA\@EA\@EA\def\@EA\csname\@EA#2\@EA\endcsname
+ \@EAEAEA\def\@EA\csname\@EA#2\@EA\endcsname
\@EA{\csname#1\endcsname}}%
\setinterfacesetupvariable{#1}{#2}}}
diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex
index 2b0d9b7a2..fdd5e9155 100644
--- a/tex/context/base/mult-sys.tex
+++ b/tex/context/base/mult-sys.tex
@@ -49,11 +49,13 @@
\definesystemconstant {polish} \definesystemconstant {pl}
\definesystemconstant {portuguese} \definesystemconstant {pt}
\definesystemconstant {romanian} \definesystemconstant {ro}
+\definesystemconstant {russian} \definesystemconstant {ru}
\definesystemconstant {slovak} \definesystemconstant {sk}
\definesystemconstant {spanish} \definesystemconstant {es}
\definesystemconstant {swedish} \definesystemconstant {sv}
\definesystemconstant {turkish} \definesystemconstant {tr}
\definesystemconstant {ukenglish} \definesystemconstant {uk}
+\definesystemconstant {ukrainian} \definesystemconstant {ua}
\definesystemconstant {usenglish} \definesystemconstant {us}
%D For proper \UNICODE\ support we need a few font related
@@ -174,6 +176,7 @@
\definesystemconstant {mapping}
\definesystemconstant {patterns}
\definesystemconstant {handling}
+\definesystemconstant {ucmap}
%D Just to be complete we define the standard \TEX\ units.
@@ -320,6 +323,9 @@
\ifx\z@\undefined \newdimen\zeropoint \else \let\zeropoint\z@ \fi
+\newcount\medcard \medcard\!!medcard % used in font module
+\newcount\maxcard \maxcard\!!maxcard % used in font module
+
%D Variables are composed of a command specific tag and a user
%D supplied variable (system constant). The first tag \type{ag}
%D for instance is available as \type{\??ag} and expands to
@@ -330,6 +336,7 @@
\definesystemvariable {ag} % AchterGrond
\definesystemvariable {al} % ALinea's
\definesystemvariable {am} % interActieMenu
+\definesystemvariable {as} % AlignmentSwitch
\definesystemvariable {ba} % synchronisatieBAlk
\definesystemvariable {be} % startstop (BeginEnd)
\definesystemvariable {bj} % BlokJe
@@ -357,7 +364,8 @@
\definesystemvariable {do} % DefinieerOpmaak
\definesystemvariable {ds} % DoorSpringen
\definesystemvariable {ef} % ExternFiguur
-\definesystemvariable {ec} % Encoding
+\definesystemvariable {ec} % EnCoding
+\definesystemvariable {en} % ENvironments
\definesystemvariable {ep} % ExternfiguurPreset
\definesystemvariable {ex} % ExterneFiguren
\definesystemvariable {ht} % HiddenText
@@ -371,9 +379,11 @@
\definesystemvariable {fr} % ForM
\definesystemvariable {fs} % FileSynonym
\definesystemvariable {ft} % FonTs
+\definesystemvariable {hs} % HSpace
\definesystemvariable {ia} % Interactie
\definesystemvariable {ib} % InteractieBalk
\definesystemvariable {id} % Index
+\definesystemvariable {ig} % ItemGroup
\definesystemvariable {ih} % InHoudsopgave
\definesystemvariable {ii} % stelIndexIn
\definesystemvariable {il} % stelInvulRegelsin
@@ -444,6 +454,7 @@
\definesystemvariable {sc} % SCherm
\definesystemvariable {sd} % SounD
\definesystemvariable {se} % SEctie
+\definesystemvariable {sg} % SpacinG
\definesystemvariable {sh} % ShapeText
\definesystemvariable {si} % SplIt
\definesystemvariable {sk} % SectieKop
@@ -478,6 +489,8 @@
\definesystemvariable {vn} % VoetNoten
\definesystemvariable {vt} % VerTical
\definesystemvariable {wr} % WitRuimte
+\definesystemvariable {xf} % XML File
+\definesystemvariable {xp} % XML Processing
\definesystemvariable {xy} % schaal
\definesystemvariable {za} % ZetspiegelAanpassing
@@ -513,6 +526,9 @@
\defineinterfaceconstant {h} {h}
\defineinterfaceconstant {b} {b}
+\defineinterfaceconstant {t} {t} % transparency
+\defineinterfaceconstant {a} {a} % alternative
+
\defineinterfaceconstant {rgb} {rgb}
\defineinterfacevariable {rgb} {rgb}
diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex
index 0885dcf33..29ba0056e 100644
--- a/tex/context/base/page-bck.tex
+++ b/tex/context/base/page-bck.tex
@@ -60,9 +60,6 @@
\newif\ifnewbackground
\newif\ifsomebackground
-\def\recalculatebackgrounds%
- {\global\newbackgroundtrue}
-
%D For special purposes, users can question the \type
%D {*background} mode. This mode is only available when
%D typesetting the pagebody.
@@ -72,8 +69,8 @@
%D \stoptypen
\appendtoks
- \ifnewbackground\enablemode[\systemmodeprefix\v!achtergrond]\fi
-\to \everypagebody
+ \ifsomebackground \ifnewbackground \setsystemmode\v!achtergrond \fi \fi
+\to \everybeforepagebody
%D \macros
%D {addmainbackground, addtextbackground,
@@ -118,22 +115,27 @@
\def\ifsomebackgroundfound#1%
{\ifusage{\??ma#1}}
-\def\doifsomebackgroundelse#1#2#3%
- {\ifusage{\??ma#1}#2\else#3\fi}
+% \def\doifsomebackgroundelse#1#2#3%
+% {\ifusage{\??ma#1}#2\else#3\fi}
+
+\def\doifsomebackgroundelse#1%
+ {\ifusage{\??ma#1}%
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
%D The background mechanism falls back on the \type {\framed}
%D macro. This means that all normal frame and overlay
%D features can be used.
\def\addsomebackground#1#2#3#4% area box width height / zero test added
- {\ifdim#3>\zeropoint\ifdim#4>\zeropoint\ifsomebackgroundfound{#1}%
+ {\ifdim#3>\zeropoint\ifdim#4>\zeropoint\ifsomebackgroundfound#1%
\setbox#2=\vbox\localframed
[\??ma#1]
[\c!strut=\v!nee,\c!offset=\v!overlay,
\c!breedte=#3,\c!hoogte=#4]
{\dp#2=\zeropoint\box#2}%
-%{\offinterlineskip\smashbox#2\box#2\endgraf
-% \getvalue{\??ma#1\c!commando}}%
\fi\fi\fi}
%D There are quite some backgrounds. At the bottom layer,
@@ -142,7 +144,7 @@
\def\addprintbackground#1%
{\addsomebackground
- \v!papier{#1}\printpapierbreedte\printpapierhoogte}
+ \v!papier#1\printpapierbreedte\printpapierhoogte}
%D The page backgrounds can be put behind the {\em left
%D page}, the {\em right page} or {\em each page}. As with
@@ -150,13 +152,13 @@
\def\addpagebackground#1%
{\doifbothsidesoverruled
- \addsomebackground\v!rechterpagina{#1}\papierbreedte\papierhoogte
+ \addsomebackground\v!rechterpagina#1\papierbreedte\papierhoogte
\orsideone
- \addsomebackground\v!rechterpagina{#1}\papierbreedte\papierhoogte
+ \addsomebackground\v!rechterpagina#1\papierbreedte\papierhoogte
\orsidetwo
- \addsomebackground\v!linkerpagina {#1}\papierbreedte\papierhoogte
+ \addsomebackground\v!linkerpagina #1\papierbreedte\papierhoogte
\od
- \addsomebackground\v!pagina{#1}\papierbreedte\papierhoogte}
+ \addsomebackground\v!pagina #1\papierbreedte\papierhoogte}
%D Then there are the 25 areas that make up the layout: {\em
%D top, header, text, footer, bottom} times {\em left edge,
@@ -186,49 +188,104 @@
\def\addtextbackground#1%
{\ifconditional\hiddenbackgroundenabled
- \addsomebackground\v!verborgen{#1}\zetbreedte\teksthoogte% mine !
+ \addsomebackground\v!verborgen#1\zetbreedte\teksthoogte % mine !
\fi
- \addsomebackground\v!tekst{#1}\zetbreedte\teksthoogte}
+ \addsomebackground\v!tekst#1\zetbreedte\teksthoogte}
%D The next couple of macros implement the area backgrounds.
%D As said, these are cached in dedicated boxes. The offsets
%D and depth of the page are used for alignment purposes.
+\newdimen\pageoffset % bleed
+\newdimen\pagedepth
+
\let\pagebackgroundhoffset = \!!zeropoint
\let\pagebackgroundvoffset = \!!zeropoint
\let\pagebackgrounddepth = \!!zeropoint
-\def\setbackgroundboxes%
- {\showmessage{\m!layouts}{8}\empty
- \setbackgroundbox\leftbackground\relax
- \ifdubbelzijdig
- \setbackgroundbox\rightbackground\doswapmargins
- \fi
- \doifnot{\@@mastatus}{\v!herhaal}{\global\newbackgroundfalse}}
+% \def\setbackgroundboxes
+% {\showmessage{\m!layouts}{8}\empty
+% \setbackgroundbox\leftbackground\relax
+% \ifdubbelzijdig
+% \setbackgroundbox\rightbackground\doswapmargins
+% \fi
+% \doifnot{\@@mastatus}{\v!herhaal}{\global\newbackgroundfalse}}
+
+%D We need a bit more clever mechanism in order to handle
+%D layers well. This means that we cannot calculate both
+%D background at the same time since something may have
+%D changed halfway a page.
+
+\chardef\newrightbackground0
+\chardef\newleftbackground 0
+
+\def\recalculatebackgrounds
+ {\global\newbackgroundtrue}
+
+\def\setbackgroundboxes
+ {\ifnewbackground
+ \global\chardef\newrightbackground1
+ \global\chardef\newleftbackground1
+ \global\setbox\leftbackground\emptybox
+ \global\setbox\rightbackground\emptybox
+ \fi
+ \doifbothsides
+ \ifcase\newleftbackground \else
+ \showmessage\m!layouts8\empty
+ \setbackgroundbox\leftbackground\relax
+ \global\chardef\newleftbackground0
+ \global\chardef\newrightbackground0
+ \fi
+ \orsideone
+ \ifcase\newleftbackground \else
+ \showmessage\m!layouts8\empty
+ \setbackgroundbox\leftbackground\relax
+ \global\chardef\newleftbackground0
+ %\global\chardef\newrightbackground0
+ \fi
+ \orsidetwo
+ \ifcase\newrightbackground \else
+ \showmessage\m!layouts8\empty
+ \setbackgroundbox\rightbackground\doswapmargins
+ \global\chardef\newrightbackground0
+ \fi
+ \od
+ \ifx\@@mastatus\v!herhaal\else\global\newbackgroundfalse\fi}
+
+\def\addmainbackground#1% todo: dimension spec
+ {\ifsomebackground
+ \setbackgroundboxes
+ \setbox#1=\vbox
+ {\offinterlineskip
+ \doifmarginswapelse
+ {\copy\leftbackground}
+ {\copy\rightbackground}
+ \box#1}%
+ \fi}
\def\setbackgroundoffsets
{\ifsomebackground \ifnewbackground
- \global\let\pagebackgroundhoffset=\!!zeropoint
- \global\let\pagebackgroundvoffset=\!!zeropoint
- \global\let\pagebackgrounddepth =\!!zeropoint
+ \global\let\pagebackgroundhoffset\!!zeropoint
+ \global\let\pagebackgroundvoffset\!!zeropoint
+ \global\let\pagebackgrounddepth \!!zeropoint
\doifsomebackgroundelse{\v!tekst\v!tekst}\donetrue\donefalse
- \ifdone\else\doifsomebackgroundelse{\v!tekst}\donetrue\donothing\fi
+ \ifdone\else\doifsomebackgroundelse\v!tekst\donetrue\donothing\fi
\ifdone
\bgroup
- \scratchdimen=\getvalue{\??ma\v!pagina\c!offset}%
+ \scratchdimen\getvalue{\??ma\v!pagina\c!offset}%
\doifsomebackgroundelse{\v!boven\v!tekst}\donothing
{\doifsomebackgroundelse{\v!onder\v!tekst}\donothing
{\xdef\pagebackgroundhoffset{\the\scratchdimen}}}%
\doifsomebackgroundelse{\v!tekst\v!rechterrand}\donothing
{\doifsomebackgroundelse{\v!tekst\v!linkerrand}\donothing
{\xdef\pagebackgroundvoffset{\the\scratchdimen}%
- \scratchdimen=\getvalue{\??ma\v!pagina\c!diepte}%
+ \scratchdimen\getvalue{\??ma\v!pagina\c!diepte}%
\xdef\pagebackgrounddepth{\the\scratchdimen}}}%
\egroup
\fi
\fi \fi}
-\appendtoks \setbackgroundoffsets \to \everypagebody
+\appendtoks \setbackgroundoffsets \to \everybeforepagebody
\def\setbackgroundbox#1#2%
{\global\setbox#1=\vbox
@@ -330,9 +387,20 @@
\else\iffirstargument
\getparameters[\??ma][#1]%
\fi\fi\fi
- \doifelse{\@@mastatus}{\v!stop}
+ \doifelsevalue{\??ma\v!pagina\c!offset}\v!overlay
+ {\global\pageoffset\zeropoint}
+ {\global\pageoffset\getvalue{\??ma\v!pagina\c!offset}}%
+ \global\pagedepth\getvalue{\??ma\v!pagina\c!diepte}%
+ \xdef\pagebackgroundoffset{\the\pageoffset}%
+ \xdef\pagebackgrounddepth {\the\pagedepth }%
+ \doifelse\@@mastatus\v!stop
{\global\newbackgroundfalse}
- {\global\newbackgroundtrue}}
+ {\global\newbackgroundtrue }}
+
+\let\pagebackgroundoffset\!!zeropoint
+\let\pagebackgrounddepth \!!zeropoint
+
+\appendtoks\global\newbackgroundfalse\to\everyjob
%D Each areas (currently there are $1+3+25+1=30$ of them)
%D has its own low level framed object associated.
@@ -453,8 +521,8 @@
\def\enablehiddenbackground
{\global\settrue\hiddenbackgroundenabled
- \global\somebackgroundtrue % also make these
- \global\newbackgroundtrue} % two conditionals
+ \global\somebackgroundtrue
+ \recalculatebackgrounds}
\def\disablehiddenbackground
{\global\setfalse\hiddenbackgroundenabled}
diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex
index 3fd29d64d..2a43cc8a1 100644
--- a/tex/context/base/page-flt.tex
+++ b/tex/context/base/page-flt.tex
@@ -13,6 +13,9 @@
\writestatus{loading}{Context OTR Macros / Floating Bodies}
+%D This module is currently a mess, due to splitting float
+%D handlers over specific otr's. Consider it work in progress.
+
\unprotect
% naar supp-box.tex
@@ -109,7 +112,7 @@
\startmessages italian library: floatblocks
title: oggetti mobili
1: -- rinumerato / -- => --
- 2: -- salavto
+ 2: -- salvato
3: -- mosso
4: -- sistemato
5: ordine aggiustato
@@ -154,22 +157,24 @@
12: nedefinit
\stopmessages
-\def\stelplaatsblokkenin%
+\def\stelplaatsblokkenin
{\dodoubleargument\getparameters[\??bk]}
-\def\stelblokkopjesin%
+\def\stelblokkopjesin
{\dodoubleargument\getparameters[\??kj]}%
\def\dostelplaatsblokin[#1][#2]%
- {\getparameters[\??fl#1][#2]}
+ {\def\docommando##1{\getparameters[\??fl##1][#2]}%
+ \processcommalist[#1]\docommando}
-\def\stelplaatsblokin%
+\def\stelplaatsblokin
{\dodoubleargument\dostelplaatsblokin}
\def\dostelblokkopjein[#1][#2]%
- {\getparameters[\??kj#1][#2]}
+ {\def\docommando##1{\getparameters[\??kj##1][#2]}%
+ \processcommalist[#1]\docommando}
-\def\stelblokkopjein%
+\def\stelblokkopjein
{\dodoubleargument\dostelblokkopjein}
\def\doleegblok#1%
@@ -177,22 +182,97 @@
[\??fl#1][\c!kader=\v!aan]%
{\getmessage{\m!floatblocks}{12}}}
+% \def\docomplexplaatsblok[#1][#2][#3]#4%
+% {\flushfootnotes
+% \ifsomefloatwaiting
+% % this was \checkwaitingfloats spread all over
+% \doifinsetelse{\v!altijd}{#2}
+% {\showmessage{\m!floatblocks}{5}{}}
+% {\doifcommonelse{#2}{\v!tekst,\v!naast,% \v!pagina,
+% \v!links,\v!rechts,\v!inlinker,\v!inrechter,%
+% \v!inmarge}
+% {\doflushfloats}
+% {}}%
+% % but which should be done before using box \floatbox
+% \fi
+% \ifmargeblokken
+% \doifinset{\v!marge}{#2}
+% {\bgroup
+% \everypar{\egroup\the\everypar}%
+% \hsize=\@@mbbreedte}%
+% \fi
+% \global\insidefloattrue
+% \dowithnextboxcontent % better a \the\everyfloattoks
+% {\postponefootnotes} % new
+% {\setlocalfloatdimensions{#1}{#2}% new
+% \docompletefloat
+% {#1}{#3}{#1}{#2}{#1}{#4}
+% {\box\nextbox}}%
+% \vbox}
+
\def\docomplexplaatsblok[#1][#2][#3]#4%
{\flushfootnotes
+ \ifsomefloatwaiting
+ % this was \checkwaitingfloats spread all over
+ \doifinsetelse{\v!altijd}{#2}
+ {\showmessage{\m!floatblocks}{5}{}}
+ {\doifcommonelse
+ {#2}
+ {\v!tekst,\v!naast,% \v!pagina,
+ \v!links,\v!rechts,\v!inlinker,\v!inrechter,%
+ \v!inmarge}
+ {\doflushfloats}
+ {}}%
+ % but which should be done before using box \floatbox
+ \fi
\ifmargeblokken
\doifinset{\v!marge}{#2}
- {\bgroup
- \everypar{\egroup\the\everypar}%
- \hsize=\@@mbbreedte}%
+ {\bgroup\everypar{\egroup\the\everypar}%
+ \hsize\@@mbbreedte}%
\fi
\global\insidefloattrue
- \dowithnextboxcontent
- {\postponefootnotes} % new
- {\docompletefloat
- {#1}{#3}{#1}{#2}{#1}{#4}
- {\box\nextbox}}%
+ \let\@@extrafloat\empty
+ \dowithnextboxcontent % better a \the\everyfloattoks
+ {\postponefootnotes} % new
+ {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}}%
\vbox}
+\def\xxdocompletefloat#1#2%
+ {\setbox\nextbox\hbox{\signalrightpage\box\nextbox}%
+ \doifrightpageelse{\let\@@extrafloat#1}{\let\@@extrafloat#2}}
+
+\newif\ifextrafloatactions \extrafloatactionstrue
+
+\def\xdocompletefloat#1#2#3#4#5#6%
+ {\ifextrafloatactions
+ \let\@@extrafloat\empty
+ \processallactionsinset
+ [#4]
+ [\v!binnen=>\xxdocompletefloat\v!links \v!rechts,
+ \v!buiten=>\xxdocompletefloat\v!rechts \v!links,
+ ininner=>\xxdocompletefloat\v!inlinker \v!inrechter,
+ inouter=>\xxdocompletefloat\v!inrechter\v!inlinker]%
+ \ifx\@@extrafloat\empty
+ \setlocalfloatdimensions{#1}{#4}%
+ \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}{\box\nextbox}%
+ \else
+ \setlocalfloatdimensions{#1}{\@@extrafloat,#4}%
+ \docompletefloat{#1}{#2}{#3}{\@@extrafloat,#4}{#5}{#6}{\box\nextbox}%
+ \fi
+ \else % downward compatible
+ \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}{\box\nextbox}%
+ \fi}
+
+\def\setlocalfloatdimensions#1#2% experimental ! ! ! !
+ {\doifvaluesomething{\??fl#1\c!maxbreedte}
+ {\scratchdimen=\getvalue{\??fl#1\c!maxbreedte}\relax
+ \ifdim\wd\nextbox>\scratchdimen
+ \setbox\nextbox=\hbox to \scratchdimen
+ {\doifnotcommon{\v!rechts,\v!inrechter}{#2}{\hss}%
+ \box\nextbox
+ \doifnotcommon{\v!links ,\v!inlinker }{#2}{\hss}}%
+ \fi}}
+
\def\docomplexstarttekstblok[#1][#2][#3]%
{\flushfootnotes
\flushsidefloats % hoort eigenlijk niet hier
@@ -205,12 +285,29 @@
{\flushsidefloats % hoort eigenlijk niet hier
\docomplexreserveerblok[#1][#2][\v!tekst,#3,\v!links][#4]}
-\def\dodefinieerplaatsblok[#1][#2]% #1=naam #2=meervoud
+\def\definieerplaatsblok
+ {\dotripleempty\dodefinieerplaatsblok}
+
+\def\dodefinieerplaatsblok[#1][#2][#3]% #1=naam #2=meervoud #3=parent
+ {\ifthirdargument
+ \redodefinieerplaatsblok[#1][#2][#3]%
+ \else\ifsecondargument
+ \dododefinieerplaatsblok[#1][#2]%
+ \else
+ \dododefinieerplaatsblok[#1][#1]%
+ \fi\fi}
+
+\def\dododefinieerplaatsblok[#1][#2]%
{\presetlocalframed[\??fl#1]%
\stelplaatsblokin
[#1]
[\c!breedte=15\korpsgrootte,
\c!hoogte=10\korpsgrootte,
+\c!maxbreedte=,
+\c!maxhoogte=,
+\c!zijvoorwit=\@@bkzijvoorwit,
+\c!zijnawit=\@@bkzijnawit,
+\c!marge=\@@bkmarge,
\c!kader=\@@bkkader,
\c!straal=\@@bkstraal,
\c!hoek=\@@bkhoek,
@@ -228,11 +325,14 @@
\stelblokkopjein
[#1]
[\c!plaats=\@@kjplaats,
- %\c!voor=\@@kjvoor,
+ %\c!voor=\@@kjvoor,
\c!tussen=\@@kjtussen,
- %\c!na=\@@kjna,
+ %\c!na=\@@kjna,
\c!breedte=\@@kjbreedte,
\c!kopletter=\@@kjkopletter,
+ \c!kopkleur=\@@kjkopkleur,
+ \c!tekstletter=\@@kjtekstletter,
+ \c!tekstkleur=\@@kjtekstkleur,
\c!letter=\@@kjletter,
\c!kleur=\@@kjkleur,
\c!uitlijnen=\@@kjuitlijnen,
@@ -240,6 +340,7 @@
\c!wijze=\@@kjwijze,
\c!blokwijze=\@@kjblokwijze,
\c!sectienummer=\@@kjsectienummer,
+ \c!scheider=\@@kjscheider,
\c!conversie=\@@kjconversie]%
\doorlabelen
[#1]
@@ -250,8 +351,11 @@
\c!sectienummer=\getvalue{\??kj#1\c!sectienummer},
\c!conversie=\getvalue{\??kj#1\c!conversie}]%
\presetlabeltext[#1=\Word{#1}~]%
+ \dodefinefloatcommands[#1][#2]}
+
+\def\dodefinefloatcommands[#1][#2]%
+ {\definieerlijst[#1]%
\presetheadtext[#2=\Word{#2}]%
- \definieerlijst[#1]%
\setvalue{\e!plaats\e!lijstmet#2}%
{\dodoubleempty\doplaatslijst[#1]}%
\setvalue{\e!volledige\e!lijstmet#2}%
@@ -273,8 +377,28 @@
\setvalue{\e!leeg#1}%
{\doleegblok{#1}}}
-\def\definieerplaatsblok%
- {\dodoubleargument\dodefinieerplaatsblok}
+\def\redodefinieerplaatsblok[#1][#2][#3]% same label/number
+ {\presetlocalframed[\??fl#1]%
+ \copylocalframed[\??fl#1][\??fl#3]%
+ \copyparameters[\??fl#1][\??fl#3]
+ [\c!breedte,\c!hoogte,
+ \c!maxbreedte,\c!maxhoogte,\c!marge,\c!zijvoorwit,\c!zijnawit,
+ \c!kader,\c!straal,\c!hoek,\c!plaats,\c!achtergrond,
+ \c!achtergrondraster,\c!achtergrondkleur,\c!achtergrondoffset,
+ \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader,
+ \c!kaderoffset,\c!paginaovergangen]%
+ \copyparameters[\??kj#1][\??kj#3]
+ [\c!plaats,\c!voor,\c!tussen,\c!na,
+ \c!breedte,\c!kopletter,\c!kopkleur,\c!letter,\c!kleur,
+ \c!tekstletter,\c!tekstkleur,
+ \c!uitlijnen,\c!nummer,\c!wijze,\c!blokwijze,
+ \c!sectienummer,\c!scheider,\c!conversie]%
+ \definieernummer[#1][#3]%
+ \presetlabeltext[#1=\labeltext{#3}]%
+ \dodefinefloatcommands[#1][#2]}
+
+\def\placefloat % \plaatsplaatsblok
+ {\dotripleempty\docomplexplaatsblok}
% De onderstaande macro's zijn verantwoordelijk voor het plaatsen
% van floats. De macro's moeten nog worden aangepast en
@@ -296,13 +420,21 @@
\newbox\floatlist
\newbox\savedfloatlist
-%newinsert\topins
-\newinsert\botins
-\newinsert\lowins % below footnotes
+\ifx\topins\undefined \newinsert\topins \fi
+\ifx\botins\undefined \newinsert\botins \fi
+\ifx\lowins\undefined \newinsert\lowins \fi
+
+\skip\topins\zeropoint
+\skip\botins\zeropoint
+\skip\lowins\zeropoint
-\skip \botins=\zeropoint \skip \lowins=\zeropoint
-\count\botins=\!!thousand \count\lowins=\!!thousand
-\dimen\botins=\maxdimen \dimen\lowins=\maxdimen
+\count\topins\!!thousand
+\count\botins\!!thousand
+\count\lowins\!!thousand
+
+\dimen\topins\maxdimen
+\dimen\botins\maxdimen
+\dimen\lowins\maxdimen
\newdimen\topinserted \topinserted=\zeropoint
\newdimen\botinserted \botinserted=\zeropoint
@@ -482,7 +614,7 @@
{\nointerlineskip
\uncenteredfloatbox
\unvbox\floatlist}%
- \global\advance\savednoffloats by 1
+ \global\advance\savednoffloats 1
\global\somefloatwaitingtrue
\dosavefloatinfo
\nonoindentation}
@@ -492,7 +624,7 @@
{\nointerlineskip
\unvbox\floatlist
\uncenteredfloatbox}%
- \global\advance\savednoffloats by 1
+ \global\advance\savednoffloats 1
\global\somefloatwaitingtrue}
\def\doreversesavefloat%
@@ -500,26 +632,26 @@
{\nointerlineskip
\unvbox\floatlist
\uncenteredfloatbox}%
- \global\advance\savednoffloats by 1
+ \global\advance\savednoffloats 1
\global\somefloatwaitingtrue
\dosavefloatinfo}
\def\dosavefloatstatus%
- {\global\setbox\savedfloatlist=\copy\floatlist
- \global\setbox\savedfloatbox =\copy\floatbox
+ {\global\setbox\savedfloatlist\copy\floatlist
+ \global\setbox\savedfloatbox \copy\floatbox
\xdef\dorestorefloatstatus%
- {\global\setbox\floatlist=\box\savedfloatlist
- \global\setbox\floatbox =\box\savedfloatbox
- \savednoffloats=\the\savednoffloats}}
+ {\global\setbox\floatlist\box\savedfloatlist
+ \global\setbox\floatbox \box\savedfloatbox
+ \savednoffloats\the\savednoffloats}}
\let\dorestorefloatstatus\relax
-\def\checkwaitingfloats#1%
- {\ifsomefloatwaiting
- \doifinsetelse{\v!altijd}{#1}
- {\showmessage{\m!floatblocks}{5}{}}
- {\doflushfloats}%
- \fi}
+%\def\checkwaitingfloats#1%
+% {\ifsomefloatwaiting
+% \doifinsetelse{\v!altijd}{#1}
+% {\showmessage{\m!floatblocks}{5}{}}
+% {\doflushfloats}%
+% \fi}
\ifx\doflushfloats\undefined \let\doflushfloats\relax \fi
\ifx\flushfloatbox\undefined \let\flushfloatbox\relax \fi
@@ -534,7 +666,7 @@
\def\betweenfloatblanko% assumes that \@@bknawit is present
{\bgroup
\setbox0=\vbox{\strut\blanko[\@@bkvoorwit]\strut}%
- \setbox2=\vbox{\strut\blanko[\@@bknawit]\strut}%
+ \setbox2=\vbox{\strut\blanko[\@@bknawit ]\strut}%
\ifdim\ht0>\ht2
\blanko[-\@@bknawit,\@@bkvoorwit]
\fi
@@ -558,7 +690,7 @@
\ifx\sometextfloat\undefined \let\sometextfloat\doplacefloatbox \fi
\def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag
- {\checkwaitingfloats{#1}%
+ {%\checkwaitingfloats{#1}%
\global\setbox\collectedpagefloats=\vbox
{\unvbox\collectedpagefloats
\vbox to \teksthoogte
@@ -569,13 +701,13 @@
\doinsertfloatinfo}
\def\sometextfloat[#1]% lang, links, rechts, hoog, midden, laag, offset
- {\checkwaitingfloats{#1}%
+ {%\checkwaitingfloats{#1}%
\def\dostoptextfloat{\dodostoptextfloat[#1]}%
\global\floattextwidth=\hsize
\global\floatwidth=\wd\floatbox
\global\floatheight=\ht\floatbox % forget about the depth
- \global\advance\floattextwidth by -\floatwidth
- \global\advance\floattextwidth by -\@@bkmarge\relax % was \tfskipsize
+ \global\advance\floattextwidth -\floatwidth
+ \global\advance\floattextwidth -\@@bkmarge\relax % was \tfskipsize
\doifinsetelse{\v!lang}{#1}
{\floattextheight=\pagegoal
\advance\floattextheight by -\pagetotal
@@ -595,9 +727,9 @@
\hsize\floattextwidth
\ignorespaces}
-\def\dodostoptextfloat[#1]%
- {\egroup
- \doifnotinset{\v!lang}{#1}%
+\def\dodostoptextfloat[#1]% % de tekst kan beter in een soort
+ {\egroup % kadertekst zonder kader, is flexibeler
+ \doifnotinset{\v!lang}{#1}% en beter
{\ifdim\ht\floattext<\floatheight
\floattextheight=\floatheight
\else
@@ -644,7 +776,7 @@
\doinsertfloatinfo}
\def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag
- {\checkwaitingfloats{#1}%
+ {%\checkwaitingfloats{#1}%
\startnaast\box\floatbox\stopnaast
\doinsertfloatinfo}
@@ -723,41 +855,94 @@
\newcount\noftopfloats \noftopfloats=2
\newcount\nofbotfloats \nofbotfloats=0
-\def\calculatefloatskips%
- {{\def\calculatefloatskips##1##2%
- {\doifelsenothing{##2}
- {\global##1=\zeropoint}
- {\doifelse{##2}{\v!geen}
- {\global##1=\zeropoint}
- {\setbox0=\vbox{\witruimte\@EA\blanko\@EA[##2]}%
- \global##1=\ht0}}}%
- \calculatefloatskips\floattopskip\@@bkvoorwit
- \calculatefloatskips\floatbottomskip\@@bknawit
- \calculatefloatskips\sidefloattopskip\@@bkzijvoorwit
- \calculatefloatskips\sidefloatbottomskip\@@bkzijnawit
- \def\sidefloattopoffset{\openstrutdepth}% {\dp\strutbox}%
- \global\floatsideskip=\@@bkmarge\relax
- \global\noftopfloats=\@@bknboven\relax
- \global\nofbotfloats=\@@bknonder\relax}}
+\def\docalculatefloatskip#1#2%
+ {\doifelsenothing{#2}
+ {\global#1\zeropoint}
+ {\doifelse{#2}{\v!geen}
+ {\global#1\zeropoint}
+ {\setbox0\vbox{\witruimte\@EA\blanko\@EA[#2]}%
+ \global#1\ht0}}}
+
+\def\calculatefloatskips#1%
+ {{\docalculatefloatskip\floattopskip \@@bkvoorwit
+ \docalculatefloatskip\floatbottomskip \@@bknawit
+ \docalculatefloatskip\sidefloattopskip {\getvalue{\??fl#1\c!zijvoorwit}}% \@@bkzijvoorwit
+ \docalculatefloatskip\sidefloatbottomskip{\getvalue{\??fl#1\c!zijnawit}}% \@@bkzijnawit
+ \gdef\sidefloattopoffset{\openstrutdepth}% was \def
+ \global\floatsideskip\getvalue{\??fl#1\c!marge}% \@@bkmarge\relax
+ \global\noftopfloats \@@bknboven\relax
+ \global\nofbotfloats \@@bknonder\relax}}
\newif\ifinsidefloat
-\def\floatcaptionsuffix{} % an optional suffix
-\def\floatcaptionnumber{} % a logical counter
-
-\def\dosetfloatcaption#1#2#3% name will change
- {\def\dofloattekst%
- {{\doattributes{\??kj#1}\c!letter\c!kleur{#3}}}%
- \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
- {\def\dofloatnummer%
- {{\xdef\floatcaptionnumber{#1}%
- \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur
- {\strut#2\floatcaptionsuffix}}}%
- \ConvertToConstant\doifnot{#3}{}
- {\tfskip
- \emergencystretch=.5em}}}
- {\let\dofloatnummer=\empty}}
+\let\floatcaptionsuffix\empty % an optional suffix
+\let\floatcaptionnumber\empty % a logical counter
+
+% obsolete ?
+%
+% \def\dosetfloatcaption#1#2#3% name will change
+% {\def\dofloattekst%
+% {{\doattributes{\??kj#1}\c!letter\c!kleur{#3}}}%
+% \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
+% {\def\dofloatnummer%
+% {{\xdef\floatcaptionnumber{#1}%
+% \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur
+% {\strut#2\floatcaptionsuffix}}}%
+% \ConvertToConstant\doifnot{#3}{}
+% {\tfskip\emergencystretch=.5em}}}
+% {\let\dofloatnummer\empty}}
+
+% Quite experimental !
+% the split is needed when for instance the float goes into
+% a multi page field and the list of figs becomes larger than
+% one page: cycle between 'only flush when object ref ok'
+% and 'one/many page fig list'; see "uguide finometer"
+%
+% potential sync bug with sectionblocks, see uguide.tex
+
+\def\placefloatcaption
+ {\dodoubleempty\doplacefloatcaption}
+
+\def\doplacefloatcaption[#1][#2]#3%
+ {\setfloatcaption[#1][#2]{#3}%
+ \placefloatcaptiontext[#1]%
+ \placefloatcaptionreference[#1]}
+
+\def\setfloatcaption % \dosetfloatcaption already in use
+ {\dodoubleempty\dodosetfloatcaption} % beware, name clash
+
+\def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
+ {\doifelsevalue{\??kj#1\c!nummer}{\v!ja} % also handle trialtypesetting
+ {\verhoognummer[#1]%
+ \maakhetnummer[#1]%
+ \global\let\flhetnummer\hetnummer
+ \setgvalue{@fl@r@#1}%
+ {\dofloatreference
+ \redofloatorder{#1}%
+ \doschrijfnaarlijst{#1}{\flhetnummer}{#3}{#1}%
+ \doglobal\convertargument#3\to\flasciititle % \asciititle is global
+ \doifsomething{#2}{\rawreference{\s!flt}{#2}{{\flhetnummer}{\flasciititle}}}%
+ \global\letvalue{@fl@r@#1}\relax}% nills
+ \setgvalue{@fl@t@#1}%
+ {\preparethenumber{\??kj#1}\flhetnummer\preparednumber
+ \doattributes{\??kj#1}\c!letter\c!kleur
+ {\doattributes{\??kj#1}\c!kopletter\c!kopkleur
+ {\labeltexts{#1}{\preparednumber}}%
+ \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur
+ {\tfskip#3}}}}
+ {\global\letvalue{@fl@r@#1}\relax
+ \global\letvalue{@fl@t@#1}\relax}}
+
+\def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}}
+\def\placefloatcaptionreference[#1]{\getvalue{@fl@r@#1}}
+
+% still needed for uguide
+
+\let\placefloatlabel \placefloatcaption
+\let\placefloatlabeltext \placefloatcaptiontext
+\let\placefloatlabelreference \placefloatcaptionreference
+
\def\putborderedfloat#1\in#2\\%
{\setbox#2=\vbox
{\localframed
@@ -782,155 +967,8 @@
\else
\ifx\@@kjkjtussen\empty\else\unskip\@@kjkjtussen\fi
\fi}}%
- \begstrut#3\endstrut\endgraf}}
-
-% \def\dosetpagfloat#1#2#3#4% \copy wegwerken
-% {\bgroup
-% \forgetall
-% \postponefootnotes
-% \mindermeldingen
-% %\showcomposition
-% \putborderedfloat#4\in4\\%
-% \def\locatefloat%
-% {\doregelplaats\@@flflplaats}%
-% \ConvertToConstant\doifelse{#3}{\v!geen}
-% {\global\setbox\floatbox=\vbox % pas op als wd groter dan hsize
-% {\ifbinnenkolommen\ifdim\wd4>\hsize
-% \let\locatefloat\relax
-% \fi\fi
-% \locatefloat{\copy4}}} % we need \wd4 later
-% {\setbox2=\hbox
-% {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
-% \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
-% {\dimen0=\hsize
-% \advance\dimen0 by -\wd4\relax
-% \advance\dimen0 by -\@@bkmarge\relax % \was tfskipsize\relax
-% \ifdim\wd2>\dimen0\relax
-% \dimen2=1.3\dimen0\relax
-% \ifdim\wd2<\dimen2\relax
-% \dimen0=0.8\dimen0\relax
-% \fi
-% \fi
-% \setbox2=\vbox
-% {\forgetall
-% \hsize=\dimen0\relax
-% \raggedright
-% \putcompletecaption{#4}{#2}{#3}{1}}}
-% {\doifelse{\@@kjkjbreedte}{\v!max}
-% {\dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\wd4\relax
-% \putcompletecaption{#4}{#2}{#3}{0}}}
-% {\ifdim\wd2>\wd4\relax
-% \doifelse{\@@kjkjbreedte}{\v!passend}
-% {\ifdim\wd4<15\korpsgrootte\relax
-% \dimen0=15\korpsgrootte\relax
-% \else
-% \dimen0=\wd4\relax
-% \fi
-% \ifdim\wd4>\hsize
-% \setbox0=\vbox
-% {\forgetall
-% \hsize=1.0\wd4
-% \footnotesenabledfalse
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \ifdim\ht0>\lineheight\relax
-% \setbox2=\vbox
-% {\forgetall
-% \hsize=0.9\wd4
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \else
-% %\setbox2=\vbox % was 0, bug
-% % {\forgetall
-% % \hsize=1.0\wd4
-% % \putcompletecaption{#4}{#2}{#3}{0}}%
-% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi
-% \else
-% \setbox0=\vbox
-% {\forgetall
-% \dimen2=1.5\dimen0\relax
-% \ifdim\dimen2<\hsize
-% \hsize=\dimen2\relax
-% \fi
-% \footnotesenabledfalse
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \ifdim\ht0>\lineheight\relax
-% \setbox2=\vbox
-% {\forgetall
-% \dimen2=1.2\dimen0\relax
-% \ifdim\dimen2<\hsize
-% \hsize=\dimen2\relax
-% \fi
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \else
-% %\setbox2=\vbox % was 0, bug
-% % {\forgetall
-% % \dimen2=1.5\dimen0\relax
-% % \ifdim\dimen2<\hsize
-% % \hsize=\dimen2\relax
-% % \fi
-% % \putcompletecaption{#4}{#2}{#3}{0}}%
-% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi
-% \fi}
-% {\dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\@@kjkjbreedte
-% \putcompletecaption{#4}{#2}{#3}{0}}}%
-% \else
-% % \setbox2=\hbox % we want footnotes !
-% % {\putcompletecaption{#4}{#2}{#3}{0}}%
-% \dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\wd4
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi}}%
-% \global\setbox\floatbox=\vbox
-% {\forgetall
-% \processaction
-% [\@@kjkjplaats]
-% [ \v!boven=>\locatefloat{\copy2}%
-% \endgraf\@@kjkjtussen
-% \locatefloat{\copy4},
-% \v!onder=>\locatefloat{\copy4}%
-% \endgraf\@@kjkjtussen
-% \locatefloat{\copy2},
-% \v!hoog=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4{\@@kjkjtussen\copy2\vfill}}
-% {\vbox to\ht4{\@@kjkjtussen\copy2\vfill}%
-% \tfskip
-% \copy4}},
-% \v!laag=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4
-% {\vfill\copy2\@@kjkjtussen}}
-% {\vbox to\ht4
-% {\vfill\copy2\@@kjkjtussen}%
-% \tfskip
-% \copy4}},
-% \v!midden=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4{\vfill\copy2\vfill}}
-% {\vbox to\ht4{\vfill\copy2\vfill}%
-% \tfskip
-% \copy4}},
-% \v!geen=>\locatefloat{\copy4}]}}%
-% % extended:
-% \postcenterfloatbox{\wd4}%
-% %\ifdim\wd4>\hsize
-% % \global\setbox\floatbox=
-% % \hbox to \ifbinnenkolommen\wd4\else\hsize\fi
-% % {\hss\box\floatbox\hss}%
-% %\fi
-% \egroup}
+ \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur
+ {\begstrut#3\endstrut\endgraf}}}
% new
@@ -1033,10 +1071,16 @@
\putcompletecaption{#4}{#2}{#3}{0}}%
\else
% just over a line, don't use an overshoot
- \dosetraggedvbox\@@kjkjuitlijnen
- \setbox\tempcaptionbox=\raggedbox
- {\hsize\scratchdimen
- \putcompletecaption{#4}{#2}{#3}{0}}%
+ \doifinsetelse{\@@kjkjuitlijnen}{\v!links,\v!rechts}
+ {\dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\tempcaptionbox\raggedbox
+ {\hsize\scratchdimen
+ \raggedcenter
+ \putcompletecaption{#4}{#2}{#3}{0}}}
+ {% nicer
+ \setbox\tempcaptionbox\cbox
+ {\hsize\scratchdimen
+ \putcompletecaption{#4}{#2}{#3}{0}}}%
\fi
\fi}
@@ -1203,7 +1247,9 @@
{\ifvisible
\par
\doifcommonelse
- {#1}{\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge}
+ {#1}
+ {\v!links,\v!rechts,\v!inlinker,\v!inrechter,%
+ \v!inmarge}
{\global\parfloattrue}
{\global\parfloatfalse}%
\ifbinnenkolommen
@@ -1275,7 +1321,7 @@
\long\def\docompletefloat#1#2#3#4#5#6#7%
{\flushsidefloats
- \calculatefloatskips
+ \calculatefloatskips{#1}%
\bgroup
\global\setbox\floatbox=\vbox{#7}%
\dimen0=\ht\floatbox
@@ -1300,13 +1346,14 @@
\redofloatorder{#1}%
\rawreference{\s!flt}{#2}{{\hetnummer}{\asciititle}}%
\doschrijfnaarlijst{#3}{\hetnummer}{#6}{#3}}%
- \egroup\dofloat{#4}{\labeltexts{#5}{\hetnummer}}{#6}{#1}}
+ \egroup
+ \preparethenumber{\??kj#1}\hetnummer\preparednumber
+ \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}}
{\global\setbox\floatbox=\vbox
{\unvbox\floatbox % no \vss, keep the depth
\rawreference{\s!flt}{#2}{{}{\asciititle}}}%
\egroup\dofloat{#4}{}{#6}{#1}}}%
\global\insidefloatfalse}
-
\newif\ifmargeblokken
@@ -1460,6 +1507,26 @@
% \global\inuitstellenfalse % Anyhow, 'uitstellen'
% \fi\fi} % is still suboptimal.
+% \def\douitstellen%
+% {\the\everytopofpage
+% \ifvoid\collectedpagefloats\else
+% % message
+% \unvbox\collectedpagefloats
+% \fi
+% \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
+% \bgroup
+% \restoreglobalbodyfont % else problems inside split verbatim
+% % message
+% \global\pagetotal\zeropoint % recently added
+% \global\inuitstellentrue % definitely needed
+% \dorecurse{\nofpostponedblocks} % else we can loose
+% {\haalbuffer[buf-\recurselevel]} % or disorder floats
+% \doflushfloats % new but potential dangerous % and that is something
+% \doglobal\newcounter\nofpostponedblocks % we don't want, do we?
+% \global\inuitstellenfalse % Anyhow, 'uitstellen'
+% \egroup
+% \fi\fi} % is still suboptimal.
+
\def\douitstellen%
{\the\everytopofpage
\ifvoid\collectedpagefloats\else
@@ -1467,19 +1534,21 @@
\unvbox\collectedpagefloats
\fi
\ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
-\bgroup
-\black % else problems inside split verbatim
-\restoreglobalbodyfont % else problems inside split verbatim
- % message
- \global\pagetotal\zeropoint % recently added
- \global\inuitstellentrue % definitely needed
- \dorecurse{\nofpostponedblocks} % else we can loose
- {\haalbuffer[buf-\recurselevel]} % or disorder floats
- \doflushfloats % new but potential dangerous % and that is something
- \doglobal\newcounter\nofpostponedblocks % we don't want, do we?
- \global\inuitstellenfalse % Anyhow, 'uitstellen'
-\egroup
- \fi\fi} % is still suboptimal.
+ \bgroup % we need the color/font switch, else problems inside split verbatim
+ \setnormalcatcodes % uitstellen in verbatim
+ \edef\savedtopofpagecolor{\topofpagecolor}%
+ \doifsomething\savedtopofpagecolor\stopcolormode
+ \restoreglobalbodyfont
+ \global\pagetotal\zeropoint % recently added and
+ \global\inuitstellentrue % definitely needed else
+ \dorecurse{\nofpostponedblocks} % we can loose or disorder
+ {\haalbuffer[buf-\recurselevel]} % floats; anyhow, this
+ \doflushfloats % new but potential dangerous % mechanism is still
+ \doglobal\newcounter\nofpostponedblocks % suboptimal and needs a
+ \global\inuitstellenfalse % proper analysis
+ \doifsomething\savedtopofpagecolor\startcolormode\savedtopofpagecolor
+ \egroup
+ \fi\fi}
\setvalue{\e!start\e!uitstellen}%
{\doglobal\increment\nofpostponedblocks
@@ -1506,7 +1575,7 @@
\getparameters[\??si][#1]%
\resetnummer[\??si]%
\def\floatcaptionsuffix{\nummer[\??si]}%
- \TABLEcaptionheight=\@@siregels\lineheight
+ \TABLEcaptionheight=\@@siregels\lineheight % brrr
\def\docomplexpagina[##1]{\goodbreak}%
\dowithnextbox
{\forgetall
@@ -1581,13 +1650,17 @@
\c!na=\blanko,
\c!breedte=\v!passend,
\c!kopletter=\v!vet,
+ \c!kopkleur=,
\c!letter=\v!normaal,
\c!kleur=,
+ \c!tekstletter=,
+ \c!tekstkleur=,
\c!uitlijnen=,
\c!nummer=\v!ja,
\c!wijze=\@@nrwijze,
\c!blokwijze=\@@nrblokwijze,
\c!sectienummer=\@@nrsectienummer,
+ \c!scheider=\@@koscheider,
\c!conversie=\v!cijfers]
\stelplaatsblokkenin
@@ -1623,18 +1696,22 @@
[\c!conversie=\v!letter, % \v!romeins
\c!regels=3]
-% float strategy
+% float strategy, replaces some of the above macros
\let\floatmethod\empty
+\let\floatcolumn\empty
+\let\floatrow \empty
\def\dogetfloatbox#1%
{\ifvisible
\getfromcommalist[#1][1]%
\@EA\beforesplitstring\commalistelement\at:\to\floatmethod
\@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
+ \@EA\aftersplitstring \floatcolumn\at*\to\floatrow
+ \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn
% nog algemeen otr
\ifx\OTRSETsetpreferedcolumnslot\undefined\else
- \OTRSETsetpreferedcolumnslot\floatcolumn
+ \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
\fi
% commando van maken
\doifundefined{\string\floatmethod\floatmethod}
diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex
index b013bb917..fb4684f4c 100644
--- a/tex/context/base/page-imp.tex
+++ b/tex/context/base/page-imp.tex
@@ -8,24 +8,24 @@
%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.
+
+% much of this can more to run time loading !
\writestatus{loading}{Context Core Macros / Pagebody Building}
\unprotect
-% moved code:
+% moved code:
\def\myshipout#1%
- {\voorpagina % voor de pagebody dus !
+ {\voorpagina % voor de pagebody dus !
\dontshowcomposition
\ifarrangingpages
- \actualarrange
- {\thisisrealpage{\realfolio}#1}%
+ \actualarrange{\thisisrealpage{\realfolio}#1}%
\else
- \actualshipout
- {\thisisrealpage{\realfolio}#1}%
+ \actualshipout{\thisisrealpage{\realfolio}#1}%
\fi
\gotonextrealpage
\napagina}
@@ -34,24 +34,24 @@
\def\flushatshipout%
{\dowithnextbox
- {\global\setbox\postponedcontent=\hbox to \!!zeropoint
+ {\global\setbox\postponedcontent=\hbox to \zeropoint
{%\hskip-\maxdimen % niet hier, gaat mis in acrobat (clipt)
\box\postponedcontent\box\nextbox}%
- \global\ht\postponedcontent=\!!zeropoint
- \global\dp\postponedcontent=\!!zeropoint
- \global\wd\postponedcontent=\!!zeropoint}%
+ \global\ht\postponedcontent\zeropoint
+ \global\dp\postponedcontent\zeropoint
+ \global\wd\postponedcontent\zeropoint}%
\hbox}
-
% \starttypen
% \def\pagestoshipout{1,3,5}
% \stoptypen
-\newcounter\shippedoutpages
+\newcount\shippedoutpages
+
\let\pagestoshipout\empty % {1,3,6}
\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even
\def\actualshipout#1%
- {\doglobal\increment\shippedoutpages
+ {\global\advance\shippedoutpages\plusone
\ifx\pagestoshipout\empty
\ifcase\whichpagetoshipout\relax
\donetrue
@@ -62,8 +62,8 @@
\else
\donetrue
\fi
- \else
- \ExpandBothAfter\doifinsetelse{\shippedoutpages}{\pagestoshipout}
+ \else % testen, aangepast
+ \expandbothargsafter\doifinsetelse{\the\shippedoutpages}{\pagestoshipout}
\donetrue\donefalse
\fi
\ifdone
@@ -73,7 +73,7 @@
\mindermeldingen
\vskip-1in
\hskip-1in
- \hbox
+ \hbox % \setbox0=\box.. is nicer
{\setbox0=\hbox{#1}% just in case there are objects there
\setbox\scratchbox=\hbox
{\the\everyshipout
@@ -99,10 +99,15 @@
\pusharrangedpage0
\deadcycles=0 }
-% so far for the moved code
+%D We need a couple of boxes for duplex printing \unknown
+
+\newbox\arrangedpageA \newbox\arrangedpageB
+
+%D \unknown\ and some for simulating big sheets.
-\newbox\arrangedpageA
-\newbox\arrangedpageB
+\newbox\arrangedpageC \newbox\arrangedpageD
+\newbox\arrangedpageE \newbox\arrangedpageF
+\newbox\arrangedpageG \newbox\arrangedpageH
\newif\ifswaparranged
\newif\ifnegatearranged
@@ -121,12 +126,12 @@
\chardef\arrangedpageY=1
\def\calculatepaperoffsets#1%
- {\scratchdimen=\getvalue{\??pp#1\c!offset}%
- \divide\scratchdimen by \arrangedpageX
- \global\advance\papierbreedte by -2\scratchdimen
- \scratchdimen=\getvalue{\??pp#1\c!offset}%
- \divide\scratchdimen by \arrangedpageY
- \global\advance\papierhoogte by -2\scratchdimen}
+ {\scratchdimen\getvalue{\??pp#1\c!offset}%
+ \divide\scratchdimen \arrangedpageX
+ \global\advance\papierbreedte -2\scratchdimen
+ \scratchdimen\getvalue{\??pp#1\c!offset}%
+ \divide\scratchdimen \arrangedpageY
+ \global\advance\papierhoogte -2\scratchdimen}
\def\setuparranging[#1]%
{\ifarrangingdisabled \else
@@ -148,67 +153,9 @@
90=>\gdef\arrangedrotationO {90}\gdef\arrangedrotationE{270},
180=>\gdef\arrangedrotationO{180}\gdef\arrangedrotationE{0},
270=>\gdef\arrangedrotationO{270}\gdef\arrangedrotationE{90},
- 2*16=>\global\chardef\arrangedpageX=8
- \global\chardef\arrangedpageY=4
- \global\chardef\arrangedpageT=16
- \global\chardef\horizontalcutmarks=5
- \global\chardef\verticalcutmarks=5
- \global\let\pusharrangedpage=\pusharrangedpageTHIRTYTWO
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2*8=>\global\chardef\arrangedpageX=4
- \global\chardef\arrangedpageY=2
- \global\chardef\arrangedpageT=8
- \global\chardef\horizontalcutmarks=5
- \global\chardef\verticalcutmarks=3
- \global\let\pusharrangedpage=\pusharrangedpageSIXTEEN
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2*4=>\global\chardef\arrangedpageX=2
- \global\chardef\arrangedpageY=2
- \global\chardef\arrangedpageT=4
- \global\chardef\horizontalcutmarks=3
- \global\chardef\verticalcutmarks=3
- \global\let\pusharrangedpage=\pusharrangedpageEIGHT
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2*2=>\global\chardef\arrangedpageX=2
- \global\chardef\arrangedpageY=1
- \global\chardef\arrangedpageT=2
- \global\chardef\horizontalcutmarks=3
- \global\chardef\verticalcutmarks=2
- \global\let\pusharrangedpage=\pusharrangedpageFOURA
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2**2=>\global\chardef\arrangedpageX=2
- \global\chardef\arrangedpageY=1
- \global\chardef\arrangedpageT=2
- \global\chardef\horizontalcutmarks=3
- \global\chardef\verticalcutmarks=2
- \global\let\pusharrangedpage=\pusharrangedpageFOURB
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2SIDE=>\global\chardef\arrangedpageX=2
- \global\chardef\arrangedpageY=1
- \global\chardef\arrangedpageT=2
- \global\chardef\horizontalcutmarks=3
- \global\chardef\verticalcutmarks=2
- \global\let\pusharrangedpage=\pusharrangedpageSIDE
- \global\let\poparrangedpages=\poparrangedpagesAB,
- 2UP=>\global\chardef\arrangedpageX=2
- \global\chardef\arrangedpageY=1
- \global\chardef\arrangedpageT=4
- \global\chardef\horizontalcutmarks=3
- \global\chardef\verticalcutmarks=2
- \global\let\handlearrangedpage=\handlearrangedpageTWOUP
- \global\let\pusharrangedpage=\pusharrangedpageTWO
- \global\let\poparrangedpages=\poparrangedpagesTWO,
- 2DOWN=>\global\chardef\arrangedpageX=1
- \global\chardef\arrangedpageY=2
- \global\chardef\arrangedpageT=4
- \global\chardef\horizontalcutmarks=2
- \global\chardef\verticalcutmarks=3
- \global\let\handlearrangedpage=\handlearrangedpageTWODOWN
- \global\let\pusharrangedpage=\pusharrangedpageTWO
- \global\let\poparrangedpages=\poparrangedpagesTWO,
\s!reset=>\global\arrangingpagesfalse,
- \s!unknown=>\global\arrangingpagesfalse,
- \s!default=>\global\arrangingpagesfalse]%
+ \s!unknown=>\checkinstalledpagearrangement\commalistelement,
+ \s!default=>\checkinstalledpagearrangement\commalistelement]%
\doifcommonelse{#1}{90,270,\v!geroteerd}
{\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution
\setuppapersize
@@ -216,96 +163,75 @@
\abortutilitygeneration
\fi
\fi}
-
-% cleaner, but unchecked, and incomplete
-%
-% \def\dosetuparrangingXY#1#2#3#4#5#6#7#8%
-% {\global\chardef\arrangedpageX =#1%
-% \global\chardef\arrangedpageY =#2%
-% \global\chardef\arrangedpageT =#3%
-% \global\chardef\horizontalcutmarks=#4%
-% \global\chardef\verticalcutmarks =#5%
-% \global\let \pusharrangedpage =#6%
-% \global\let \poparrangedpages =#7%
-% \global\let \handlearrangedpage=#8}
-%
-% \def\dosetuparrangingOE#1#2%
-% {\gdef\arrangedrotationO{#1}%
-% \gdef\arrangedrotationE{#2}}
-%
-% \def\setuparranging[#1]%
-% {\ifarrangingdisabled \else
-% \doifelse{#1}{\v!blokkeer}
-% {\global\arrangingdisabledtrue}
-% {\global\arrangingdisabledfalse}%
-% \global\arrangingpagestrue
-% \global\negatearrangedfalse
-% \global\mirrorarrangedfalse
-% \global\doublearrangedfalse
-% \gdef\arrangedrotationO{0}%
-% \gdef\arrangedrotationE{180}%
-% \processallactionsinset
-% [#1]
-% [ \v!gespiegeld=>\global\mirrorarrangedtrue,
-% \v!dubbelzijdig=>\global\doublearrangedtrue,
-% \v!negatief=>\global\negatearrangedtrue,
-% \v!geroteerd=>\dosetuparrangingOE{90}{270},
-% 90=>\dosetuparrangingOE{90}{270},
-% 180=>\dosetuparrangingOE{180}{0},
-% 270=>\dosetuparrangingOE{270}{90},
-% 2*16=>\dosetuparrangingXY{8}{4}{16}{5}{5}
-% \pusharrangedpageTHIRTYTWO
-% \poparrangedpagesAB
-% \relax,
-% 2*8=>\dosetuparrangingXY{4}{2}{8}{5}{3}
-% \pusharrangedpageSIXTEEN
-% \poparrangedpagesAB
-% \relax,
-% 2*4=>\dosetuparrangingXY{2}{2}{4}{3}{3}
-% \pusharrangedpageEIGHT
-% \poparrangedpagesAB
-% \relax,
-% 2*2=>\dosetuparrangingXY{2}{1}{2}{3}{2}
-% \pusharrangedpageFOUR
-% \poparrangedpagesAB
-% \relax,
-% 2**2=>\dosetuparrangingXY{2}{1}{2}{3}{2}
-% \pusharrangedpageFOURPLUS
-% \poparrangedpagesAB
-% \relax,
-% 2SIDE=>\dosetuparrangingXY{2}{1}{2}{3}{2}
-% \pusharrangedpageSIDE
-% \poparrangedpagesAB
-% \relax,
-% 2UP=>\dosetuparrangingXY{2}{1}{4}{3}{2}
-% \pusharrangedpageTWO
-% \poparrangedpagesTWO,
-% \handlearrangedpageTWOUP,
-% 2DOWN=>\dosetuparrangingXY{1}{2}{4}{2}{3}
-% \pusharrangedpageTWO
-% \poparrangedpagesTWO
-% \handlearrangedpageTWODOWN,
-% \s!reset=>\global\arrangingpagesfalse,
-% \s!unknown=>\global\arrangingpagesfalse,
-% \s!default=>\global\arrangingpagesfalse]%
-% \doifcommonelse{#1}{90,270,\v!geroteerd}
-% {\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution
-% \setuppapersize
-% \ifarrangingpages
-% \abortutilitygeneration
-% \fi
-% \fi}
+
+\def\installpagearrangement #1 %
+ {\setgvalue{\??pp\??pp#1}}
+
+\def\checkinstalledpagearrangement#1%
+ {\executeifdefined{\??pp\??pp#1}{\global\arrangingpagesfalse}}
+
+\def\dosetuparrangement#1#2#3#4#5#6#7#8%
+ {\global\chardef\arrangedpageX #1%
+ \global\chardef\arrangedpageY #2%
+ \global\chardef\arrangedpageT #3%
+ \global\chardef\horizontalcutmarks#4%
+ \global\chardef\verticalcutmarks #5%
+ \global\let \pusharrangedpage #6%
+ \global\let \poparrangedpages #7%
+ \global\let \handlearrangedpage#8}
+
+\installpagearrangement 2*16
+ {\dosetuparrangement{4}{4}{16}{5}{5}
+ \pusharrangedpageTHIRTYTWO\poparrangedpagesAB\relax}
+
+\installpagearrangement 2*8
+ {\dosetuparrangement{4}{2}{8}{5}{3}
+ \pusharrangedpageSIXTEEN\poparrangedpagesAB\relax}
+
+\installpagearrangement 2*4
+ {\dosetuparrangement{2}{2}{4}{3}{3}
+ \pusharrangedpageEIGHT\poparrangedpagesAB\relax}
+
+\installpagearrangement 2*2
+ {\dosetuparrangement{2}{1}{2}{3}{2}
+ \pusharrangedpageFOURA\poparrangedpagesAB\relax}
+
+\installpagearrangement 2**2
+ {\dosetuparrangement{2}{1}{2}{3}{2}
+ \pusharrangedpageFOURB\poparrangedpagesAB\relax}
+
+\installpagearrangement 2SIDE
+ {\dosetuparrangement{2}{1}{2}{3}{2}
+ \pusharrangedpageSIDETOP\poparrangedpagesTWO\handlearrangedpageSIDE}
+
+\installpagearrangement 2TOP
+ {\dosetuparrangement{1}{2}{2}{2}{3}
+ \pusharrangedpageSIDETOP\poparrangedpagesTWO\handlearrangedpageTOP}
+
+\installpagearrangement 2UP
+ {\dosetuparrangement{2}{1}{4}{3}{2}
+ \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWOUP}
+
+\installpagearrangement 2DOWN
+ {\dosetuparrangement{1}{2}{4}{2}{3}
+ \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWODOWN}
+
+\installpagearrangement 2*4*2 % one defined by Willy Egger:
+ {\dosetuparrangement{2}{2}{4}{3}{2}
+ \pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax}
+
+\installpagearrangement 2*2*4 % onother one of Willy Egger
+ {\dosetuparrangement{2}{1}{8}{3}{2}
+ \pusharrangedpageSIXTEENFOUR\poparrangedpagesAtoH\relax}
\def\filluparrangedpages% beware: \realpageno is 1 ahead
{\ifarrangingpages
- \scratchcounter=-\realpageno
- \divide\scratchcounter by \arrangedpageT
- \multiply\scratchcounter by \arrangedpageT
- \advance\scratchcounter by \realpageno
- \advance\scratchcounter by -1
- \dorecurse{\scratchcounter}
- {\noheaderandfooterlines
- \ejectdummypage}
+ \scratchcounter-\realpageno
+ \divide\scratchcounter \arrangedpageT
+ \multiply\scratchcounter \arrangedpageT
+ \advance\scratchcounter \realpageno
+ \advance\scratchcounter -1
+ \dorecurse\scratchcounter{\noheaderandfooterlines\ejectdummypage}
\fi}
\def\handlearrangedpageXY#1#2#3#4#5%
@@ -316,47 +242,51 @@
\mindermeldingen
\vskip#4\papierhoogte
\hskip#3\papierbreedte
- \dorotatebox{#2}\hbox{\box#1}%
+ \dorotatebox{\ifcase#2 0\else180\fi}\hbox{\box#1}%
\vfill}%
- \wd\scratchbox=\!!zeropoint
+ \wd\scratchbox\zeropoint
\box\scratchbox\box#5\hss}}
-\def\gotonextarrangepage%
- {\global\advance\arrangeno by 1
- \def\pagecutmarksymbol%
- {\the\arrangeno}}
+\def\gotonextarrangepage
+ {\global\advance\arrangeno 1
+ \def\pagecutmarksymbol{\the\arrangeno}}
\def\outputarrangedbox#1%
{\bgroup
\gotonextarrangepage
\ifnum\arrangedrotationO\arrangedrotationE>0
\ifdoublearranged
- \ifodd\arrangeno
+ \ifodd\arrangeno % if into 2d arg
\setbox#1=\vbox{\dorotatebox\arrangedrotationO\hbox{\box#1}}%
\else
\setbox#1=\vbox{\dorotatebox\arrangedrotationE\hbox{\box#1}}%
\fi
\else
\setbox#1=\vbox{\dorotatebox\arrangedrotationO\hbox{\box#1}}%
- \fi
+ \fi
\fi
\ifmirrorarranged
\setbox#1=\vbox{\domirrorbox\vbox{\box#1}}%
\fi
\ifnegatearranged
\negatecolorbox{#1}%
- \fi
+ \fi
\finishpagebox#1
\actualshipout{\box#1}%
\egroup}
+%D The format file can be 16K smaller when we postpone the
+%D real arrangments. Some day ...
+
+% TOP
+
% 32/16/8/4/SIDE
\def\poparrangedpagesAB%
{\ifnum\arrangedpageN>0
\mindermeldingen
- \papierbreedte=\arrangedpageX\papierbreedte
- \papierhoogte=\arrangedpageY\papierhoogte
+ \papierbreedte\arrangedpageX\papierbreedte
+ \papierhoogte\arrangedpageY\papierhoogte
\outputarrangedbox\arrangedpageA
\outputarrangedbox\arrangedpageB
\doglobal\newcounter\arrangedpageN
@@ -366,38 +296,38 @@
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
- \or \handlearrangedpageXY{#1} {0}{3}{3}\arrangedpageA % 1
- \or \handlearrangedpageXY{#1} {0}{0}{3}\arrangedpageB % 2
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageB % 3
- \or \handlearrangedpageXY{#1}{180}{3}{0}\arrangedpageA % 4
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageA % 5
- \or \handlearrangedpageXY{#1}{180}{3}{0}\arrangedpageB % 6
- \or \handlearrangedpageXY{#1} {0}{3}{3}\arrangedpageB % 7
- \or \handlearrangedpageXY{#1} {0}{0}{3}\arrangedpageA % 8
- \or \handlearrangedpageXY{#1}{180}{0}{2}\arrangedpageA % 9
- \or \handlearrangedpageXY{#1}{180}{3}{2}\arrangedpageB % 10
- \or \handlearrangedpageXY{#1} {0}{3}{1}\arrangedpageB % 11
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageA % 12
- \or \handlearrangedpageXY{#1} {0}{3}{1}\arrangedpageA % 13
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageB % 14
- \or \handlearrangedpageXY{#1}{180}{0}{2}\arrangedpageB % 15
- \or \handlearrangedpageXY{#1}{180}{3}{2}\arrangedpageA % 16
- \or \handlearrangedpageXY{#1}{180}{2}{2}\arrangedpageA % 17
- \or \handlearrangedpageXY{#1}{180}{1}{2}\arrangedpageB % 18
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageB % 19
- \or \handlearrangedpageXY{#1} {0}{2}{1}\arrangedpageA % 20
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageA % 21
- \or \handlearrangedpageXY{#1} {0}{2}{1}\arrangedpageB % 22
- \or \handlearrangedpageXY{#1}{180}{2}{2}\arrangedpageB % 23
- \or \handlearrangedpageXY{#1}{180}{1}{2}\arrangedpageA % 24
- \or \handlearrangedpageXY{#1} {0}{1}{3}\arrangedpageA % 25
- \or \handlearrangedpageXY{#1} {0}{2}{3}\arrangedpageB % 26
- \or \handlearrangedpageXY{#1}{180}{2}{0}\arrangedpageB % 27
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageA % 28
- \or \handlearrangedpageXY{#1}{180}{2}{0}\arrangedpageA % 29
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageB % 30
- \or \handlearrangedpageXY{#1} {0}{1}{3}\arrangedpageB % 31
- \or \handlearrangedpageXY{#1} {0}{2}{3}\arrangedpageA % 32
+ \or \handlearrangedpageXY{#1}033\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1}003\arrangedpageB % 2
+ \or \handlearrangedpageXY{#1}100\arrangedpageB % 3
+ \or \handlearrangedpageXY{#1}130\arrangedpageA % 4
+ \or \handlearrangedpageXY{#1}100\arrangedpageA % 5
+ \or \handlearrangedpageXY{#1}130\arrangedpageB % 6
+ \or \handlearrangedpageXY{#1}033\arrangedpageB % 7
+ \or \handlearrangedpageXY{#1}003\arrangedpageA % 8
+ \or \handlearrangedpageXY{#1}102\arrangedpageA % 9
+ \or \handlearrangedpageXY{#1}132\arrangedpageB % 10
+ \or \handlearrangedpageXY{#1}031\arrangedpageB % 11
+ \or \handlearrangedpageXY{#1}001\arrangedpageA % 12
+ \or \handlearrangedpageXY{#1}031\arrangedpageA % 13
+ \or \handlearrangedpageXY{#1}001\arrangedpageB % 14
+ \or \handlearrangedpageXY{#1}102\arrangedpageB % 15
+ \or \handlearrangedpageXY{#1}132\arrangedpageA % 16
+ \or \handlearrangedpageXY{#1}122\arrangedpageA % 17
+ \or \handlearrangedpageXY{#1}112\arrangedpageB % 18
+ \or \handlearrangedpageXY{#1}011\arrangedpageB % 19
+ \or \handlearrangedpageXY{#1}021\arrangedpageA % 20
+ \or \handlearrangedpageXY{#1}011\arrangedpageA % 21
+ \or \handlearrangedpageXY{#1}021\arrangedpageB % 22
+ \or \handlearrangedpageXY{#1}122\arrangedpageB % 23
+ \or \handlearrangedpageXY{#1}112\arrangedpageA % 24
+ \or \handlearrangedpageXY{#1}013\arrangedpageA % 25
+ \or \handlearrangedpageXY{#1}023\arrangedpageB % 26
+ \or \handlearrangedpageXY{#1}120\arrangedpageB % 27
+ \or \handlearrangedpageXY{#1}110\arrangedpageA % 28
+ \or \handlearrangedpageXY{#1}120\arrangedpageA % 29
+ \or \handlearrangedpageXY{#1}110\arrangedpageB % 30
+ \or \handlearrangedpageXY{#1}013\arrangedpageB % 31
+ \or \handlearrangedpageXY{#1}023\arrangedpageA % 32
\poparrangedpages
\fi}
@@ -405,22 +335,22 @@
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
- \or \handlearrangedpageXY{#1} {0}{3}{1}\arrangedpageA % 1
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageB % 2
- \or \handlearrangedpageXY{#1} {0}{3}{1}\arrangedpageB % 3
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageA % 4
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageA % 5
- \or \handlearrangedpageXY{#1}{180}{3}{0}\arrangedpageB % 6
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageB % 7
- \or \handlearrangedpageXY{#1}{180}{3}{0}\arrangedpageA % 8
- \or \handlearrangedpageXY{#1}{180}{2}{0}\arrangedpageA % 9
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageB % 10
- \or \handlearrangedpageXY{#1}{180}{2}{0}\arrangedpageB % 11
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageA % 12
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageA % 13
- \or \handlearrangedpageXY{#1} {0}{2}{1}\arrangedpageB % 14
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageB % 15
- \or \handlearrangedpageXY{#1} {0}{2}{1}\arrangedpageA % 16
+ \or \handlearrangedpageXY{#1}031\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1}001\arrangedpageB % 2
+ \or \handlearrangedpageXY{#1}031\arrangedpageB % 3
+ \or \handlearrangedpageXY{#1}001\arrangedpageA % 4
+ \or \handlearrangedpageXY{#1}100\arrangedpageA % 5
+ \or \handlearrangedpageXY{#1}130\arrangedpageB % 6
+ \or \handlearrangedpageXY{#1}100\arrangedpageB % 7
+ \or \handlearrangedpageXY{#1}130\arrangedpageA % 8
+ \or \handlearrangedpageXY{#1}120\arrangedpageA % 9
+ \or \handlearrangedpageXY{#1}110\arrangedpageB % 10
+ \or \handlearrangedpageXY{#1}120\arrangedpageB % 11
+ \or \handlearrangedpageXY{#1}110\arrangedpageA % 12
+ \or \handlearrangedpageXY{#1}011\arrangedpageA % 13
+ \or \handlearrangedpageXY{#1}021\arrangedpageB % 14
+ \or \handlearrangedpageXY{#1}011\arrangedpageB % 15
+ \or \handlearrangedpageXY{#1}021\arrangedpageA % 16
\poparrangedpages
\fi}
@@ -428,14 +358,14 @@
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageA % 1
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageB % 2
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageB % 3
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageA % 4
- \or \handlearrangedpageXY{#1}{180}{0}{0}\arrangedpageA % 5
- \or \handlearrangedpageXY{#1}{180}{1}{0}\arrangedpageB % 6
- \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageB % 7
- \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageA % 8
+ \or \handlearrangedpageXY{#1}011\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1}001\arrangedpageB % 2
+ \or \handlearrangedpageXY{#1}100\arrangedpageB % 3
+ \or \handlearrangedpageXY{#1}110\arrangedpageA % 4
+ \or \handlearrangedpageXY{#1}100\arrangedpageA % 5
+ \or \handlearrangedpageXY{#1}110\arrangedpageB % 6
+ \or \handlearrangedpageXY{#1}011\arrangedpageB % 7
+ \or \handlearrangedpageXY{#1}001\arrangedpageA % 8
\poparrangedpages
\fi}
@@ -446,65 +376,79 @@
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
- \or \handlearrangedpageXY{#3} {0} {1}{0}\arrangedpageA % 1
- \or \handlearrangedpageXY{#3}{180}{#1}{0}\arrangedpageB % 2/3
- \or \handlearrangedpageXY{#3}{180}{#2}{0}\arrangedpageB % 3/2
- \or \handlearrangedpageXY{#3} {0} {0}{0}\arrangedpageA % 4
+ \or \handlearrangedpageXY{#3}010\arrangedpageA % 1
+ \or \handlearrangedpageXY{#3}0{#1}0\arrangedpageB % 2/3 not {1}
+ \or \handlearrangedpageXY{#3}0{#2}0\arrangedpageB % 3/2 not {1}
+ \or \handlearrangedpageXY{#3}000\arrangedpageA % 4
\poparrangedpages
\fi}
-\def\pusharrangedpageSIDE#1% not ok yet
+\def\pusharrangedpageSIDETOP#1%
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
- \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageA % 1
- \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageA % 2
- \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageB % 3
- \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageB % 4
+ \or \handlearrangedpageXY{#1}000\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1}000\arrangedpageB % 2
\poparrangedpages
\fi}
+\def\handlearrangedpageSIDE
+ {\global\wd\arrangedpageA\papierbreedte
+ \global\wd\arrangedpageB\papierbreedte
+ \global\setbox\arrangedpageA\hbox
+ {\box\arrangedpageA\box\arrangedpageB}%
+ \global\ht\arrangedpageA\papierhoogte
+ \global\setbox\arrangedpageB\box\scratchbox} % ?
+
+\def\handlearrangedpageTOP
+ {\global\ht\arrangedpageA\papierhoogte
+ \global\ht\arrangedpageB\papierhoogte
+ \global\setbox\arrangedpageA\vbox
+ {\forgetall\offinterlineskip\vskip\papierhoogte
+ \box\arrangedpageA\box\arrangedpageB}%
+ \global\setbox\arrangedpageB\box\scratchbox} % ?
+
% 2UP/2DOWN / 1pt prevents overflow
\def\splitoffarrangedpagesTWO%
- {\splittopskip\!!zeropoint
- \global\setbox\arrangedpageA=\vsplit\arrangedpageB to \!!onepoint
- \scratchdimen=\ht\arrangedpageB
- \advance\scratchdimen by -\!!onepoint
+ {\splittopskip\zeropoint
+ \global\setbox\arrangedpageA\vsplit\arrangedpageB to \!!onepoint
+ \scratchdimen\ht\arrangedpageB
+ \advance\scratchdimen -\!!onepoint
\ifdim\scratchdimen>\!!onepoint
- \setbox\scratchbox=\vsplit\arrangedpageB to \scratchdimen
+ \setbox\scratchbox\vsplit\arrangedpageB to \scratchdimen
\fi}
\def\handlearrangedpageTWOUP%
{\splitoffarrangedpagesTWO
\ifswaparranged
- \global\setbox\arrangedpageA=\hbox
+ \global\setbox\arrangedpageA\hbox
{\box\arrangedpageA\box\arrangedpageB}%
\swaparrangedfalse
\else
- \global\setbox\arrangedpageA=\hbox
+ \global\setbox\arrangedpageA\hbox
{\box\arrangedpageB\box\arrangedpageA}%
\swaparrangedtrue
\fi
- \global\ht\arrangedpageA=\papierhoogte
- \global\setbox\arrangedpageB=\box\scratchbox}
+ \global\ht\arrangedpageA\papierhoogte
+ \global\setbox\arrangedpageB\box\scratchbox}
\def\handlearrangedpageTWODOWN%
{\splitoffarrangedpagesTWO
- \global\ht\arrangedpageA=\papierhoogte
- \global\ht\arrangedpageB=\papierhoogte
+ \global\ht\arrangedpageA\papierhoogte
+ \global\ht\arrangedpageB\papierhoogte
\ifswaparranged
- \global\setbox\arrangedpageA=\vbox
+ \global\setbox\arrangedpageA\vbox
{\forgetall\offinterlineskip\vskip\papierhoogte
\box\arrangedpageA\box\arrangedpageB}%
\swaparrangedfalse
\else
- \global\setbox\arrangedpageA=\vbox
+ \global\setbox\arrangedpageA\vbox
{\forgetall\offinterlineskip\vskip\papierhoogte
\box\arrangedpageB\box\arrangedpageA}%
\swaparrangedtrue
\fi
- \global\setbox\arrangedpageB=\box\scratchbox}
+ \global\setbox\arrangedpageB\box\scratchbox}
\def\poparrangedpagesTWO%
{\ifnum\arrangedpageN>0
@@ -513,13 +457,13 @@
\doloop
{\handlearrangedpage
\bgroup
- \papierbreedte=\arrangedpageX\papierbreedte
- \papierhoogte=\arrangedpageY\papierhoogte
- \ht\arrangedpageA=\papierhoogte
- \wd\arrangedpageA=\papierbreedte
+ \papierbreedte\arrangedpageX\papierbreedte
+ \papierhoogte\arrangedpageY\papierhoogte
+ \ht\arrangedpageA\papierhoogte
+ \wd\arrangedpageA\papierbreedte
\outputarrangedbox\arrangedpageA
\egroup
- \ifdim\ht\arrangedpageB=\!!zeropoint
+ \ifdim\ht\arrangedpageB=\zeropoint
\exitloop
\fi}%
\doglobal\newcounter\arrangedpageN
@@ -528,41 +472,123 @@
\def\pusharrangedpageTWO#1%
{\doglobal\increment\arrangedpageN
\reportarrangedpage\arrangedpageN
- \global\setbox\arrangedpageB=\vbox
+ \global\setbox\arrangedpageB\vbox
{\forgetall
\offinterlineskip
\unvbox\arrangedpageB
\allowbreak
\ht#1=\!!onepoint
- \dp#1=\!!zeropoint
+ \dp#1=\zeropoint
\vbox{\box#1}}}
-%D One can (mis)use this mechanism, in close cooperation
-%D with \PDFTEX\ to arrange pages of already produced files.
+%D Willy Egger's sheet simulations:
+
+\def\poparrangedpagesAtoH%
+ {\ifnum\arrangedpageN>0
+ \mindermeldingen
+ \papierbreedte\arrangedpageX\papierbreedte
+ \papierhoogte\arrangedpageY\papierhoogte
+ \outputarrangedbox\arrangedpageA
+ \outputarrangedbox\arrangedpageB
+ \outputarrangedbox\arrangedpageC
+ \outputarrangedbox\arrangedpageD
+ \outputarrangedbox\arrangedpageE
+ \outputarrangedbox\arrangedpageF
+ \outputarrangedbox\arrangedpageG
+ \outputarrangedbox\arrangedpageH
+ \doglobal\newcounter\arrangedpageN
+ \fi}
+
+% to arrange 16 pages on 2 sheets to form one booklet
+
+\def\poparrangedpagesAtoD%
+ {\ifnum\arrangedpageN>0
+ \mindermeldingen
+ \papierbreedte\arrangedpageX\papierbreedte
+ \papierhoogte\arrangedpageY\papierhoogte
+ \outputarrangedbox\arrangedpageA
+ \outputarrangedbox\arrangedpageB
+ \outputarrangedbox\arrangedpageC
+ \outputarrangedbox\arrangedpageD
+ \doglobal\newcounter\arrangedpageN
+ \fi}
+
+% to arrange 16 pages on 4 sheets to form one booklet
+
+\def\pusharrangedpageSIXTEENFOUR#1%
+ {\doglobal\increment\arrangedpageN
+ \reportarrangedpage\arrangedpageN
+ \ifcase\arrangedpageN
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageB % 2
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageC % 3
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageD % 4
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageE % 5
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageF % 6
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageG % 7
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageH % 8
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageH % 9
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageG % 10
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageF % 11
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageE % 12
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageD % 13
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageC % 14
+ \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageB % 15
+ \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageA % 16
+ \poparrangedpages
+ \fi}
+
+% to arrange 16 pages on 2 sheets to form one booklet
+
+\def\pusharrangedpageSIXTEENTWO#1%
+ {\doglobal\increment\arrangedpageN
+ \reportarrangedpage\arrangedpageN
+ \ifcase\arrangedpageN
+ \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageA % 1
+ \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageB % 2
+ \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageC % 3
+ \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageD % 4
+ \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageD % 5
+ \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageC % 6
+ \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageB % 7
+ \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageA % 8
+ \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageA % 9
+ \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageB % 10
+ \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageC % 11
+ \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageD % 12
+ \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageD % 13
+ \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageC % 14
+ \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageB % 15
+ \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageA % 16
+ \poparrangedpages
+ \fi}
+
+%D One can (mis)use this mechanism, in close cooperation
+%D with \PDFTEX\ to arrange pages of already produced files.
%D
%D \starttypen
%D \insertpages[file.pdf][1,3][n=30,width=18cm]
%D \stoptypen
%D
%D The pages are inserted in the text area, and even pages
-%D are repositioned according to the width. In this example
-%D empty pages are added after page 1 and 3.
+%D are repositioned according to the width. In this example
+%D empty pages are added after page 1 and 3.
%D
-%D Selecting pages can be accomplished by:
+%D Selecting pages can be accomplished by:
%D
-%D \starttypen
+%D \starttypen
%D \filterpages[file.pdf][1,3,5][n=30,width=18cm]
%D \stoptypen
%D
-%D One may pass \type {odd} or \type {even} instead of a
-%D comma separated list. A third alternative is:
+%D One may pass \type {odd} or \type {even} instead of a
+%D comma separated list. A third alternative is:
%D
-%D \starttypen
+%D \starttypen
%D \copypages[file.pdf][n=30,scale=950]
%D \stoptypen
-%D
-%D This macros inserts the page, according to the settings
-%D provided.
+%D
+%D This macros inserts the page, according to the settings
+%D provided.
\def\insertpages%
{\dotripleempty\doinsertpages}
@@ -570,13 +596,14 @@
\def\doinsertpages[#1][#2][#3]%
{\doifassignmentelse{#2}
{\dodoinsertpages[#1][][#2]}
- {\dodoinsertpages[#1][#2][#3]}}
+ {\dodoinsertpages[#1][#2][#3]}}
-\def\dodoinsertpages[#1][#2][#3]%
+\def\dodoinsertpages[#1][#2][#3]%
{\bgroup
\mindermeldingen
- \getfiguredimensions[#1]%
+ \getfiguredimensions[#1]%
\getparameters[\??ip][\c!n=\noffigurepages,\c!breedte=\!!zeropoint,#3]%
+ \doifinsetelse{0}{#2}{\null\pagina}{}%
\dorecurse{\@@ipn}
{\dofilterpage{#1}{\recurselevel}%
\doifinsetelse{\recurselevel}{#2}{\null\pagina}{}}%
@@ -585,10 +612,10 @@
\def\filterpages%
{\dotripleempty\dofilterpages}
-\def\dofilterpages[#1][#2][#3]% % \noffigurepages not yet supported
+\def\dofilterpages[#1][#2][#3]% % \noffigurepages not yet supported
{\bgroup
\mindermeldingen
- \getfiguredimensions[#1]%
+ \getfiguredimensions[#1]%
\getparameters[\??ip][\c!n=\noffigurepages,\c!breedte=\!!zeropoint,#3]%
\doifelse{#2}{\v!even}
{\dorecurse{\@@ipn}
@@ -612,13 +639,13 @@
\def\dofilterpage#1#2%
{\hbox to \tekstbreedte
- {\ifdubbelzijdig\ifdim\@@ipbreedte>\!!zeropoint\relax\ifodd\realpageno\else
+ {\ifdubbelzijdig\ifdim\@@ipbreedte>\zeropoint\relax\ifodd\realpageno\else
\hfill
\def\dowithfigure{\hskip-\@@ipbreedte}%
\fi\fi\fi
- \setbox0=\hbox
+ \setbox0=\hbox
{\externalfigure[#1][\c!pagina=#2,\c!hoogte=\teksthoogte]}%
- \wd0=\!!zeropoint
+ \wd0\zeropoint
\box0}
\pagina}
@@ -642,8 +669,8 @@
{\doifelse{\@@ipmarkering}{\v!aan}
{\let\next\cuthbox}{\let\next\hbox}%
\next
- {\ifdim\scratchdimen>\!!zeropoint\relax
- \advance\vsize by -2\scratchdimen
+ {\ifdim\scratchdimen>\zeropoint\relax
+ \advance\vsize by -2\scratchdimen
\advance\hsize by -2\scratchdimen
\externalfigure[#1][\c!pagina=\recurselevel,#2,\c!schaal=,\c!factor=\v!max,\c!offset=\v!overlay]%
\else
@@ -654,12 +681,12 @@
%D \macros
%D {combinepages}
-%D
-%D Yet another way of postprocessing is handles by \type
-%D {\combinepages}. This macro builds a matrix of pages from a
-%D file, for example:
%D
-%D \starttypen
+%D Yet another way of postprocessing is handles by \type
+%D {\combinepages}. This macro builds a matrix of pages from a
+%D file, for example:
+%D
+%D \starttypen
%D \setuppapersize
%D [A4][A4] % or [A4,landscape][A4,landscape]
%D
@@ -667,86 +694,114 @@
%D [header=0pt,footer=1cm,
%D backspace=1cm,topspace=1cm,
%D width=middle,height=middle]
-%D
+%D
%D \setupfootertexts
%D [presentation---\currentdate\space---\space\pagenumber]
-%D
+%D
%D \starttext
-%D \combinepages[slides][nx=2,ny=3,frame=on]
+%D \combinepages[slides][nx=2,ny=3,frame=on]
%D \stoptext
-%D \starttypen
+%D \starttypen
%D
-%D One can influence the way the pages are combined. (This
+%D One can influence the way the pages are combined. (This
%D will be explained some time.)
\def\combinepages%
{\dodoubleempty\docombinepages}
-\def\docombinepages[#1][#2]%
+\def\docombinepages[#1][#2]% a=perpag b=free
{\bgroup
- \getfiguredimensions[#1]%
+ \mindermeldingen
+ \getfiguredimensions[#1]%
\getparameters
[\??ip]
- [\c!n=\noffigurepages,\c!nx=2,\c!ny=2,
+ [\c!variant=\v!a,
+ \c!n=\noffigurepages,\c!nx=2,\c!ny=2,
\c!afstand=\bodyfontsize,
\c!onder=\vfill,\c!boven=\vss,
\c!links=\hss,\c!rechts=\hss,
- \c!voor=\pagina,\c!na=\pagina,\c!kader=,
+ \c!voor=\pagina,\c!na=\pagina,\c!tussen=\blanko,
+ \c!kader=,
#2]%
\@@ipvoor
\doglobal\newcounter\combinedpagescounter
- \doloop
- {\vbox to \teksthoogte
- {\mindermeldingen
- \hsize=\tekstbreedte
- \scratchdimen=\@@ipafstand
- \!!widtha=\hsize
- \advance\!!widtha by -\@@ipnx\scratchdimen
- \advance\!!widtha by \scratchdimen
- \divide \!!widtha by \@@ipnx
- \!!heighta=\vsize
- \advance\!!heighta by -\@@ipny\scratchdimen
- \advance\!!heighta by \scratchdimen
- \divide \!!heighta by \@@ipny
- \dorecurse{\@@ipny}
- {\hbox to \hsize
- {\dorecurse{\@@ipnx}
- {\doglobal\increment\combinedpagescounter
- \vbox to \!!heighta
- {\hsize=\!!widtha
- \vsize=\!!heighta
- \@@ipboven
- \hbox to \hsize
- {\@@iplinks
- \ifnum\combinedpagescounter>\@@ipn \else
- \externalfigure[#1]
- [\c!pagina=\combinedpagescounter,
- \c!factor=\v!max,
- \c!kader=\@@ipkader]%
- \fi
- \@@iprechts}
- \@@iponder}%
- \hfil}%
- \hfilneg}
- \vfil}
- \vfilneg}
- \pagina
- \ifnum\combinedpagescounter<\@@ipn \else\exitloop\fi}
+ \doifelse{\@@ipvariant}{\v!b}{\!!doneafalse}{\!!doneatrue}%
+ \if!!donea
+ \doloop
+ {\vbox to \teksthoogte
+ {\hsize=\tekstbreedte % ? ?
+ \scratchdimen=\@@ipafstand
+ \!!widtha=\hsize
+ \advance\!!widtha by -\@@ipnx\scratchdimen
+ \advance\!!widtha by \scratchdimen
+ \divide \!!widtha by \@@ipnx
+ \!!heighta=\vsize
+ \advance\!!heighta by -\@@ipny\scratchdimen
+ \advance\!!heighta by \scratchdimen
+ \divide \!!heighta by \@@ipny
+ \dorecurse{\@@ipny}
+ {\hbox to \hsize
+ {\dorecurse{\@@ipnx}
+ {\doglobal\increment\combinedpagescounter
+ \vbox to \!!heighta
+ {\hsize=\!!widtha
+ \vsize=\!!heighta
+ \@@ipboven
+ \hbox to \hsize
+ {\@@iplinks
+ \ifnum\combinedpagescounter>\@@ipn \else
+ \externalfigure[#1]
+ [\c!object=\v!nee,
+ \c!pagina=\combinedpagescounter,
+ \c!factor=\v!max,
+ \c!kader=\@@ipkader]%
+ \fi
+ \@@iprechts}
+ \@@iponder}%
+ \hfil}%
+ \hfilneg}
+ \vfil}%
+ \vfilneg}%
+ \ifnum\combinedpagescounter<\@@ipn \else\exitloop\fi}
+ \else
+ \doloop
+ {\startbaselinecorrection
+ \scratchdimen=\@@ipafstand
+ \!!widtha=\hsize
+ \advance\!!widtha by -\@@ipnx\scratchdimen
+ \advance\!!widtha by \scratchdimen
+ \divide \!!widtha by \@@ipnx
+ \hbox to \hsize
+ {\dorecurse{\@@ipnx}
+ {\doglobal\increment\combinedpagescounter
+ \ifnum\combinedpagescounter>\@@ipn \else
+ \externalfigure[#1]
+ [\c!pagina=\combinedpagescounter,
+ \c!breedte=\!!widtha,
+ \c!kader=\@@ipkader]%
+ \fi}}%
+ \stopbaselinecorrection
+ \ifnum\combinedpagescounter<\@@ipn
+ \@@iptussen
+ \else
+ \exitloop
+ \fi}
+ \fi
\@@ipna
\egroup}
-%D \macros
+%D \macros
%D {setuppagecomment,startpagecomment}
%D
-%D This command is not yet documented. Usage:
+%D This command is not yet documented. Usage:
+%D
+%D \starttypen
+%D \setuppagecomment[state=start,location=right]
%D
-%D \starttypen
-%D \setuppagecomment[state=start,location=right]
-%D
%D \startpagecomment
-%D \input knuth
+%D \input knuth
%D \stoppagecomment
-%D \stoptypen
+%D \stoptypen
\def\setuppagecomment%
{\dosingleempty\dosetuppagecomment}
@@ -776,8 +831,8 @@
\let\@@pcprintpapersize\printpapersize
\setuppapersize[\papersize][commentedpage]%
\setupbackgrounds[\v!papier][\c!achtergrond=pagecomment]}
- {\doif{\@@pcstatus}{\v!stop} % else initialization invokes backgrounds
- {% this should be tested first
+ {\doif{\@@pcstatus}{\v!stop} % else initialization invokes backgrounds
+ {% this should be tested first
% \expanded{\setuppapersize[\papersize][\@@pcprintpapersize]}%
\setupbackgrounds[\v!papier][\c!achtergrond=]}}}
@@ -830,43 +885,75 @@
\c!afstand=.5cm,
\c!hoogte=5cm,
\c!breedte=10cm]
-
-\protect \endinput
-% This macro cuts a page into n parts that can be pasted
+% This macro cuts a page into n parts that can be pasted
% together.
+
+\def\slicepages%
+ {\dotripleempty\doslicepages}
+
+\def\doslicepages[#1][#2][#3]%
+ {\ifthirdargument
+ \dodoslicepages[#1][#2][#3]%
+ \else
+ \dodoslicepages[#1][#2][#2]%
+ \fi}
+
+\newcounter\slicedpagenumber
+
+\def\dodoslicepages[#1][#2][#3]%
+ {\bgroup
+ \dontcomplain
+ \gdef\slicedpagenumber{0}%
+ \getfiguredimensions[#1]
+ \getparameters
+ [\??ip]
+ [\c!n=1,
+ \c!offset=\!!zeropoint,
+ \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint,
+ \c!breedte=\figurewidth,\c!hoogte=\figureheight,#2]
+\ifnum\@@ipn>0
+ \definepapersize
+ [\s!dummy][\c!hoogte=\@@iphoogte,\c!breedte=\@@ipbreedte]
+ \setuppapersize
+ [\s!dummy][\s!dummy]
+ \stellayoutin % \setuplayout
+ [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
+ \c!hoogte=\v!midden,\c!breedte=\v!midden,
+ \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
+\fi
+ \dorecurse\noffigurepages
+ {\global\let\slicedpagenumber\recurselevel
+ \ifnum\@@ipn>1
+ \dorecurse\@@ipn
+ {\let\xslice\recurselevel
+ \dorecurse\@@ipn
+ {\let\yslice\recurselevel
+ \clip
+ [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
+ {\schaal
+ [\c!schaal=\@@ipn000]
+ {\externalfigure[#1][\c!pagina=\slicedpagenumber]}}
+ \pagina}}
+ \else
+ \ifodd\slicedpagenumber\relax
+ \getparameters[\??ip][#2]
+ \else
+ \getparameters[\??ip][#3]
+ \fi
+ \hskip\@@ipoffset
+ \clip
+ [\c!hoffset=\@@iphoffset,\c!voffset=\@@ipvoffset,
+ \c!hoogte=\@@iphoogte,\c!breedte=\@@ipbreedte]
+ {\externalfigure[#1][\c!pagina=\slicedpagenumber]}
+ \pagina
+ \fi}
+ \egroup}
+
+% \starttext
+%
+% \slicepages[slice1.pdf][n=3]
%
-% \def\slicepages%
-% {\dodoubleempty\doslicepages}
-%
-% \def\doslicepages[#1][#2]%
-% {\bgroup
-% \getfiguredimensions[#1]
-% \getparameters[\??ip][\c!n=1,#2]
-% \definepapersize
-% [\s!dummy][\c!hoogte=\figureheight,\c!breedte=\figurewidth]
-% \setuppapersize
-% [\s!dummy][\s!dummy]
-% \setuplayout
-% [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
-% \c!hoogte=\v!midden,\c!breedte=\v!midden,
-% \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
-% \dorecurse{\noffigurepages}
-% {\let\pslice=\recurselevel
-% \dorecurse{\@@ipn}
-% {\let\xslice\recurselevel
-% \dorecurse{\@@ipn}
-% {\let\yslice\recurselevel
-% \clip
-% [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
-% {\schaal
-% [\c!schaal=\@@ipn000]
-% {\externalfigure[#1][\c!pagina=\pslice]}}
-% \pagina}}}
-% \egroup}
-%
-% \starttext
-%
-% \slicepages[slice1.pdf][n=3]
-%
-% \stoptext
+% \stoptext
+
+\protect \endinput
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index f6f59dd92..528102b18 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -24,8 +24,6 @@
\unprotect
-\def\m!otr{otr}
-
% message will be distributed
\startmessages dutch library: systems
@@ -343,6 +341,12 @@
11: spatierea -- nu este permisa in gridmode
\stopmessages
+\def\m!otr{otr}
+
+\chardef\normalpagebox=255
+
+\newbox\pagebox
+
\ifx\recalculatelayout\undefined
\let \recalculatelayout \relax
@@ -557,24 +561,6 @@
\def\@@OTR{OTR}
-% \beginETEX \ifcsname
-%
-% \let\ifcs \ifcsname
-% \let\endcs\endcsname
-%
-% \endETEX
-%
-% \beginTEX \ifcsname
-%
-% \def\ifcs#1\endcs{\@EA\ifx\csname#1\endcsname\relax\else}
-%
-% \endTEX
-%
-% \def\OTRcommand#1%
-% {\csname\@@OTR
-% \ifcs\@@OTR\OTRidentifier\strippedcsname#1\endcs\OTRidentifier\fi
-% \strippedcsname#1\endcsname}
-
\let\OTRdefault\empty
\beginETEX \ifcsname
@@ -584,7 +570,7 @@
\ifcsname\@@OTR\OTRidentifier\strippedcsname#1\endcsname
\OTRidentifier
\else\ifcsname\@@OTR\OTRdefault\strippedcsname#1\endcsname % fallback
- \OTRidentifier
+ \OTRdefault
\fi\fi
\strippedcsname#1\endcsname}
@@ -686,21 +672,16 @@
\unvbox\normalpagebox}
\newtoks\mainoutput
+\newif\ifinotr
-\mainoutput
- {\doifdefinedelse{\@@OTR\the\outputpenalty}
- {\getvalue{\@@OTR\the\outputpenalty}}
- {\the\OTRcommand\output}}
-
-%\mainoutput
-% {\advance\otrlevel 1
-% \ifnum\otrlevel>1 \writestatus{otr}{nested main output}\fi
-% \doifdefinedelse{\@@OTR\the\outputpenalty}
-% {\getvalue{\@@OTR\the\outputpenalty}}
-% {\the\OTRcommand\output}%
-% \advance\otrlevel -1 }
+\def\invokeoutputroutine
+ {\ifcsname\@@OTR\the\outputpenalty\endcsname
+ \csname\@@OTR\the\outputpenalty\endcsname
+ \else
+ \the\OTRcommand\output
+ \fi}
-\output{\the\mainoutput}
+\mainoutput{\invokeoutputroutine} \output{\inotrtrue\the\mainoutput}
%D In order to force consistent use of variables, we
%D predefine a lot of them here.
@@ -877,7 +858,7 @@
\def\afterfinaloutput%
{\forgetall
- \vskip\!!zeropoint\relax
+ \vskip\zeropoint\relax
\ifvoid\normalpagebox
\else
\unvbox\normalpagebox
@@ -896,7 +877,7 @@
{\beforefinaloutput
\the\everybeforeshipout
\ifspecialbasedsettings
- \myshipout{\hbox{\hbox to \!!zeropoint{\the\pageboundsettings}\hbox{\dopagebody#1#2\setpagecounters}}}%
+ \myshipout{\hbox{\hbox to \zeropoint{\the\pageboundsettings}\hbox{\dopagebody#1#2\setpagecounters}}}%
\else
\the\pageboundsettings
\myshipout{\hbox{\dopagebody#1#2\setpagecounters}}%
@@ -984,7 +965,7 @@
\def\doversie[#1]%
{\voorlopigfalse
\conceptfalse
- \overfullrule=\!!zeropoint
+ \overfullrule=\zeropoint
\processaction
[#1]
[\v!voorlopig=>\voorlopigtrue\overfullrule=5pt,
@@ -993,21 +974,42 @@
\def\versie%
{\dosingleargument\doversie}
-\def\addstatusinfo#1%
- {\ifvoorlopig \donetrue \fi
- \ifconcept \donetrue \fi
- \ifdone
- \setbox#1=\vbox to \papierhoogte
- {\vsmashbox#1\box#1
- \offinterlineskip
- \vskip\topspace
- \hsize\papierbreedte
- \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss
- \settexthoffset\hskip\texthoffset
- \tlap{\plaatsversieaanduiding}
- \vskip.5cm}%
- \fi}
-
+%\def\addstatusinfo#1%
+% {\ifvoorlopig \donetrue \else
+% \ifconcept \donetrue \else
+% \donefalse \fi \fi
+% \ifdone
+% \setbox#1=\vbox to \papierhoogte
+% {\vsmashbox#1\box#1
+% \offinterlineskip
+% \vskip\kopwit
+% \hsize\papierbreedte
+% \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss
+% \settexthoffset\hskip\texthoffset
+% \tlap{\plaatsversieaanduiding}
+% \vskip.5cm}%
+% \fi}
+
+\def\addstatusinfo
+ {\ifvoorlopig
+ \@EA\doaddstatusinfo
+ \else\ifconcept
+ \@EAEAEA\doaddstatusinfo
+ \else
+ \@EAEAEA\gobbleoneargument
+ \fi\fi}
+
+\def\doaddstatusinfo#1%
+ {\setbox#1=\vbox to \papierhoogte
+ {\vsmashbox#1\box#1
+ \offinterlineskip
+ \vskip\kopwit
+ \hsize\papierbreedte
+ \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss
+ \settexthoffset\hskip\texthoffset
+ \tlap{\plaatsversieaanduiding}
+ \vskip.5cm}}
+
% this will be inserts some day
%\newinsert\referentieinfobox
@@ -1021,7 +1023,7 @@
\def\dotestinfo#1#2#3%
{\ifvoorlopig\ifinpagebody\else
\begingroup
- \convertargument#3\to\ascii
+ \@EA\convertargument#3\to\ascii
\xdef\extratestinfo%
{#2 \ascii}%
\gdef\totaltestinfo%
@@ -1043,14 +1045,9 @@
\fi
\fi\fi}
-\def\referentieinfo%
- {\dotestinfo\referentieinfobox}
-
-\def\registerinfo%
- {\dotestinfo\registerinfobox}
-
-\def\floatinfo%
- {\dotestinfo\floatinfobox}
+\def\referentieinfo{\dotestinfo\referentieinfobox}
+\def\registerinfo {\dotestinfo\registerinfobox}
+\def\floatinfo {\dotestinfo\floatinfobox}
\def\plaatstestinfo%
{\ifvoorlopig
@@ -1080,14 +1077,6 @@
\versie[\v!definitief]
-% Output routines
-%
-% \dopagecontents#1#2 : tekst, floats en footnotes
-% \dopagebody#1#2 : hoofd, \pagecontents, voet
-% \dooutput : outputroutine
-%
-% \ifinpagebody
-
% De volgende macro's worden gedefinieerd in de module
% colo-ini. Om resetten bij twee maal laden te voorkomen
% checken we wel even. Anders krijgen we een mark-build-up.
@@ -1155,7 +1144,7 @@
\hskip-\zetbreedte
\od
\box#1}%
- \dp#1=\!!zeropoint}
+ \dp#1=\zeropoint}
\newif\ifpagebodyornaments \pagebodyornamentstrue
\newif\ifarrangingpages \arrangingpagesfalse
@@ -1177,7 +1166,7 @@
\forgetall % igv problemen, check: \boxmaxdepth\maxdimen
\boxmaxdepth\maxdimen % new
\mindermeldingen
- \setbox0=\vbox
+ \setbox\pagebox=\vbox
{\offinterlineskip
\ifpagebodyornaments
% \getbackgroundbox
@@ -1190,35 +1179,35 @@
\fi
\getmainbox#1#2}% including footnotes
\ifpagebodyornaments
- \addmainbackground0%
- \addlogobackground0%
+ \addmainbackground\pagebox
+ \addlogobackground\pagebox
\fi
- \buildpagebox0%
- \addstatusinfo0% new
+ \buildpagebox\pagebox
+ \addstatusinfo\pagebox
\ifpagebodyornaments
- \addpagebackground0%
+ \addpagebackground\pagebox
\fi
\ifarrangingpages \else
- \addpagecutmarks0%
- \replicatepagebox0%
- \scalepagebox0%
- \mirrorpaperbox0%
- \rotatepaperbox0%
- \addpagecolormarks0%
- \centerpagebox0%
-\addprintbackground0%
- \mirrorprintbox0%
- \rotateprintbox0%
- \offsetprintbox0%
- \negateprintbox0%
+ \addpagecutmarks\pagebox
+ \replicatepagebox\pagebox
+ \scalepagebox\pagebox
+ \mirrorpaperbox\pagebox
+ \rotatepaperbox\pagebox
+ \addpagecolormarks\pagebox
+ \centerpagebox\pagebox
+ \addprintbackground\pagebox
+ \mirrorprintbox\pagebox
+ \rotateprintbox\pagebox
+ \offsetprintbox\pagebox
+ \negateprintbox\pagebox
\fi
- \box0%
+ \box\pagebox
\endrestorecatcodes}%
\ifsavepagebody\copy\savedpagebody\fi}
\def\finishpagebox#1%
{\ifarrangingpages
- \addpagecutmarks#1%
+ \addpagecutmarks#1%
\addpagecolormarks#1%
\centerpagebox#1%
\mirrorprintbox#1%
@@ -1227,14 +1216,12 @@
\negateprintbox#1%
\fi}
-\chardef\normalpagebox=255
-
-\appendtoks \restoreglobalbodyfont \to \everypagebody
-\appendtoks \restorecolumnsettings \to \everypagebody
+\appendtoks \restoreglobalbodyfont \to \everybeforepagebody
+\appendtoks \restorecolumnsettings \to \everybeforepagebody
\def\dopagebody#1#2%
- {\getallmarks
- \the\everypagebody
+ {%\getallmarks % now in following token register
+ \the\everybeforepagebody
\startcolorpage
\gotonextsubpage % nog eens: als in pagina (tbv standaard opmaak)
\dontshowboxes % dan hier blokkeren en verderop resetten
@@ -1249,7 +1236,8 @@
\resetpagina
\updatelistreferences
\resetlayoutlines % will go to \aftereverypage
- \stopcolorpage}
+ \stopcolorpage
+ \the\everyafterpagebody}
\newtoks\pageboundsettings
@@ -1282,9 +1270,17 @@
\let\resetcurrentsectionmarks=\relax
-% was: \resetsectionmarks[\firstsection], zie \handelpaginaaf
+% was: \resetsectionmarks\firstsection, zie \handelpaginaaf
-\def\docomplexpagina[#1]%
+\def\complexpagina[#1]%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ % do nothing and avoid processing, see head's
+ \else
+ \@EA\docomplexpagina\@EA[\!!stringa]
+ \fi}
+
+\def\docomplexpagina[#1]% % will be installable
{\flushfootnotes
\bgroup
\processallactionsinset
@@ -1372,13 +1368,15 @@
%\fi
\od
\filluparrangedpages},
- \s!unknown=>\doifinstringelse{+}{#1}
+% \s!default=>,% do nothing if empty
+ \s!unknown=>\let\@@pagespecification\commalistelement
+ \doifinstringelse{+}\@@pagespecification
{\ejectinsert\ejectpage
- \dorecurse{#1}{\ejectdummypage}}
- {\doifnumberelse{#1}
+ \dorecurse\@@pagespecification\ejectdummypage}
+ {\doifnumberelse\@@pagespecification
{\ejectinsert\ejectpage
\doloop
- {\ifnum\userpageno<#1\relax
+ {\ifnum\userpageno<\@@pagespecification\relax
\ejectdummypage
\else
\exitloop
@@ -1386,11 +1384,7 @@
{}}]%
\egroup}
-\def\complexpagina[#1]%
- {\expanded{\docomplexpagina[#1]}}
-
-\def\simplepagina%
-% {\docomplexpagina[\v!ja]}
+\def\simplepagina
{\flushfootnotes
\ifpaginageblokkeerd\else
\ejectinsert
@@ -1415,55 +1409,57 @@
% \setuphead[chapter][before={\pagetype[chapter]}]
% \chapter{First} \page test \chapter{second} \page test
-\newif\ifgeselecteerd
-\geselecteerdtrue
-
-\newif\ifselecteren
-\selecterenfalse
-
-\newif\ifverwerken
-\verwerkentrue
+\newif\ifgeselecteerd \geselecteerdtrue
+\newif\ifselecteren \selecterenfalse
+\newif\ifverwerken \verwerkentrue
-\def\selectie{}
-\def\paginasoort{}
+\let\selectie \empty
+\let\paginasoort\empty
+\let\naastpagina\relax
+\let\napagina \relax
+\let\voorpagina \relax
-\let\naastpagina=\relax
-\let\napagina=\relax
-\let\voorpagina=\relax
+\def\dodovoorpagina#1%
+ {\global\let\voorpagina\relax
+ \getvalue{\??pg#1\c!voor}}
\def\dovoorpagina%
{\doifsomething{\paginasoort}
- {\def\dododopagina##1%
- {\global\let\voorpagina=\relax
- \getvalue{\??pg##1\c!voor}}%
- \processcommacommand[\paginasoort]\dododopagina}}
+ {\processcommacommand[\paginasoort]\dodovoorpagina}}
\def\dododonapagina#1%
- {\global\let\napagina=\relax
- \gdef\paginasoort{}%
+ {\global\let\napagina\relax
+ \global\let\paginasoort\empty
\getvalue{\??pg#1\c!na}}
+\def\dodonapagina#1%
+ {\doifelsevalue{\??pg#1\c!optie}{\v!dubbelzijdig}
+ {\doifbothsidesoverruled
+ \dododonapagina{#1}%
+ \orsideone
+ \dododonapagina{#1}%
+ \orsidetwo
+ \od}
+ {\dododonapagina{#1}}}
+
\def\donapagina%
{\doifsomething{\paginasoort}
- {\def\dodopagina##1%
- {\doifelsevalue{\??pg##1\c!optie}{\v!dubbelzijdig}
- {\doifbothsidesoverruled
- \dododonapagina{##1}%
- \orsideone
- \dododonapagina{##1}%
- \orsidetwo
- \od}%
- {\dododonapagina{##1}}}%
- \processcommacommand[\paginasoort]\dodopagina}}
+ {\processcommacommand[\paginasoort]\dodonapagina}}
+
+% Dit wordt eigenlijk nooit en moet worden vervangen door
+% het meer algemene mechanisme.
\def\dosoortpagina[#1]%
- {\doglobal\addtocommalist{#1}\paginasoort
- \ifselecteren
- \ExpandBothAfter\doifcommon{#1}{\selectie}
- {\global\geselecteerdtrue}%
- \fi
- \gdef\voorpagina{\dovoorpagina}%
- \gdef\napagina{\donapagina}}
+ {\edef\desoortpagina{#1}%
+ \ifx\desoortpagina\empty \else
+ \@EA\doglobal\@EA\addtocommalist\@EA{\desoortpagina}\paginasoort
+ \ifselecteren
+ \fullexpandtwoargsafter\doifcommon{\desoortpagina}{\selectie}
+ {\global\geselecteerdtrue}%
+ \fi
+ \gdef\voorpagina{\dovoorpagina}%
+ \gdef\napagina {\donapagina }%
+ \fi}
\def\soortpagina%
{\dosingleargument\dosoortpagina}
diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex
index 25360af97..dd8b46690 100644
--- a/tex/context/base/page-lay.tex
+++ b/tex/context/base/page-lay.tex
@@ -15,6 +15,9 @@
% to be translated into english
+% hoofdhoogte wordt bij status=hoog niet aangepast op outer
+% level, wel binnen bepaalde berekeningen
+
%D Before you start wondering why some of the page related
%D modules skip upward or left in order to place elements, you
%D must realize that the reference point is the top left
@@ -211,12 +214,17 @@
\global\rechtermargeafstand\layoutdistance\rechtermargebreedte\c!rechtermargeafstand
\global\bovenafstand\layoutdistance\bovenhoogte\c!bovenafstand
\global\hoofdafstand\layoutdistance\hoofdhoogte\c!hoofdafstand
- \global\global\voetafstand \layoutdistance\voethoogte \c!voetafstand
+ \global\voetafstand \layoutdistance\voethoogte \c!voetafstand
\global\onderafstand\layoutdistance\onderhoogte\c!onderafstand}
+ \def\setlayoutdistances% local in \setreducedvsize
+ {\hoofdafstand\layoutdistance\hoofdhoogte\c!hoofdafstand
+ \voetafstand \layoutdistance\voethoogte \c!voetafstand}
+
\else
\let\setlayoutdimensions\relax
+ \let\setlayoutdistance \relax
\fi
@@ -282,9 +290,11 @@
{\dodoubleempty\dosetuppapersize}
\def\dosetuppapersize[#1][#2]%
- {\doifinstringelse{=}{#1}
+% {\doifinstringelse{=}{#1}
+ {\doifassignmentelse{#1}
{\getparameters[\??pp][#1]}
- {\doifinstringelse{=}{#2}
+% {\doifinstringelse{=}{#2}
+ {\doifassignmentelse{#2}
{\getparameters[\??pp#1][#2]}
{\dodosetuppapersize[#1][#2]}}}
@@ -374,83 +384,89 @@
\processcommalist[#1]\docommando}
\def\recalculatelayout%
- {\global\linkermargebreedte =\layoutparameter\c!linkermarge
- \global\rechtermargebreedte=\layoutparameter\c!rechtermarge
- \global\linkerrandbreedte =\layoutparameter\c!linkerrand
- \global\rechterrandbreedte =\layoutparameter\c!rechterrand
- \global\hoofdhoogte =\layoutparameter\c!hoofd
- \global\voethoogte =\layoutparameter\c!voet
- \global\onderhoogte =\layoutparameter\c!onder
- \global\bovenhoogte =\layoutparameter\c!boven
- \global\rugwit =\layoutparameter\c!rugwit
- \global\kopwit =\layoutparameter\c!kopwit
+ {\global\linkermargebreedte \layoutparameter\c!linkermarge
+ \global\rechtermargebreedte\layoutparameter\c!rechtermarge
+ \global\linkerrandbreedte \layoutparameter\c!linkerrand
+ \global\rechterrandbreedte \layoutparameter\c!rechterrand
+ \global\hoofdhoogte \layoutparameter\c!hoofd
+ \global\voethoogte \layoutparameter\c!voet
+ \global\onderhoogte \layoutparameter\c!onder
+ \global\bovenhoogte \layoutparameter\c!boven
+ \global\rugwit \layoutparameter\c!rugwit
+ \global\kopwit \layoutparameter\c!kopwit
\setlayoutdimensions % the rest of the `dimensions'
- \doifelse{\@@lygrid}{\v!ja}
- {\gridsnappingtrue}
- {\gridsnappingfalse}%
+ \doifelse\@@lygrid\v!ja\gridsnappingtrue\gridsnappingfalse
\ifgridsnapping
- \widowpenalty=0 % is gewoon beter
- \clubpenalty =0 % zeker bij grids
+ \widowpenalty\zerocount % is gewoon beter
+ \clubpenalty \zerocount % zeker bij grids
\else
- \widowpenalty=\defaultwidowpenalty
- \clubpenalty =\defaultclubpenalty
+ \widowpenalty\defaultwidowpenalty
+ \clubpenalty \defaultclubpenalty
\fi
- \stelwitruimtein
- \stelblankoin
- \doifelse{\layoutparameter\c!breedte}{\v!midden}
- {\global\zetbreedte=\papierbreedte
- \global\advance\zetbreedte by -\rugwit
- \scratchdimen=\layoutparameter\c!snijwit\relax
- \ifdim\scratchdimen=\zeropoint
- \scratchdimen=\rugwit
- \fi
- \global\advance\zetbreedte by -\scratchdimen}
- {\doifelse{\layoutparameter\c!breedte}{\v!passend}
- {\global\zetbreedte=\papierbreedte
- \global\advance\zetbreedte by -\rugwit
- \scratchdimen=\rugwit
- \advance\scratchdimen by -\linkerrandbreedte
- \advance\scratchdimen by -\linkerrandafstand
- \advance\scratchdimen by -\linkermargebreedte
- \advance\scratchdimen by -\linkermargeafstand
+ \simplestelwitruimtein
+ \simplestelblankoin
+ \scratchdimen\layoutparameter\c!snijwit\relax
+ \ifdim\scratchdimen=\zeropoint
+ \scratchdimen\rugwit
+ \fi
+ \doifelse{\layoutparameter\c!breedte}\v!midden
+ {\global\zetbreedte\papierbreedte
+ \global\advance\zetbreedte -\rugwit
+ %\scratchdimen\layoutparameter\c!snijwit\relax
+ %\ifdim\scratchdimen=\zeropoint
+ % \scratchdimen\rugwit
+ %\fi
+ \global\advance\zetbreedte -\scratchdimen}
+ {\doifelse{\layoutparameter\c!breedte}\v!passend
+ {\global\zetbreedte\papierbreedte
+ %\global\advance\zetbreedte -\rugwit
+ \global\advance\zetbreedte -\scratchdimen
+ %
+ \scratchdimen\rugwit
+ \advance\scratchdimen -\linkerrandbreedte
+ \advance\scratchdimen -\linkerrandafstand
+ \advance\scratchdimen -\linkermargebreedte
+ \advance\scratchdimen -\linkermargeafstand
\ifdim\scratchdimen<\zeropoint
- \scratchdimen=\zeropoint
- \fi
- \global\advance\zetbreedte by -\rechtermargeafstand
- \global\advance\zetbreedte by -\rechtermargebreedte
- \global\advance\zetbreedte by -\rechterrandafstand
- \global\advance\zetbreedte by -\rechterrandbreedte
- \global\advance\zetbreedte by -\scratchdimen}
- {\global\zetbreedte=\layoutparameter\c!breedte}}%
- \doifelse{\layoutparameter\c!regels}{}
- {\doifelse{\layoutparameter\c!hoogte}{\v!midden}
- {\global\zethoogte=\papierhoogte
- \global\advance\zethoogte by -\kopwit
- \scratchdimen=\layoutparameter\c!bodemwit\relax
- \ifdim\scratchdimen=\zeropoint
- \scratchdimen=\kopwit
+ \scratchdimen\zeropoint
\fi
- \global\advance\zethoogte by -\scratchdimen}
- {\doifelse{\layoutparameter\c!hoogte}{\v!passend}
- {\global\zethoogte=\papierhoogte
- \global\advance\zethoogte by -\kopwit
- \scratchdimen=\kopwit
- \advance\scratchdimen by -\bovenhoogte
- \advance\scratchdimen by -\bovenafstand
+ \global\advance\zetbreedte -\rechtermargeafstand
+ \global\advance\zetbreedte -\rechtermargebreedte
+ \global\advance\zetbreedte -\rechterrandafstand
+ \global\advance\zetbreedte -\rechterrandbreedte
+ \global\advance\zetbreedte -\scratchdimen}
+ {\global\zetbreedte\layoutparameter\c!breedte}}%
+ \scratchdimen\layoutparameter\c!bodemwit\relax
+ \ifdim\scratchdimen=\zeropoint
+ \scratchdimen\kopwit
+ \fi
+ \doifelse{\layoutparameter\c!regels}\empty
+ {\doifelse{\layoutparameter\c!hoogte}\v!midden
+ {\global\zethoogte\papierhoogte
+ \global\advance\zethoogte -\kopwit
+ \global\advance\zethoogte -\scratchdimen}
+ {\doifelse{\layoutparameter\c!hoogte}\v!passend
+ {\global\zethoogte\papierhoogte
+ %\global\advance\zethoogte -\kopwit
+ \global\advance\zethoogte -\scratchdimen
+ %
+ \scratchdimen\kopwit
+ \advance\scratchdimen -\bovenhoogte
+ \advance\scratchdimen -\bovenafstand
\ifdim\scratchdimen<\zeropoint
- \scratchdimen=\zeropoint
+ \scratchdimen\zeropoint
\fi
- \global\advance\zethoogte by -\onderafstand
- \global\advance\zethoogte by -\onderhoogte
- \global\advance\zethoogte by -\scratchdimen}
- {\global\zethoogte=\layoutparameter\c!hoogte}}}
- {\global\zethoogte=\layoutparameter\c!regels\lineheight
- \global\advance\zethoogte by \hoofdhoogte
- \global\advance\zethoogte by \voethoogte}%
- \rugoffset=\layoutparameter\c!rugoffset
- \kopoffset=\layoutparameter\c!kopoffset
-\global\setdimentoatleast\zetbreedte\!!onepoint
-\global\setdimentoatleast\zethoogte\!!onepoint
+ \global\advance\zethoogte -\onderafstand
+ \global\advance\zethoogte -\onderhoogte
+ \global\advance\zethoogte -\scratchdimen}
+ {\global\zethoogte\layoutparameter\c!hoogte}}}
+ {\global\zethoogte\layoutparameter\c!regels\lineheight
+ \global\advance\zethoogte \hoofdhoogte
+ \global\advance\zethoogte \voethoogte}%
+ \rugoffset\layoutparameter\c!rugoffset
+ \kopoffset\layoutparameter\c!kopoffset
+ \global\setdimentoatleast\zetbreedte\!!onepoint
+ \global\setdimentoatleast\zethoogte\!!onepoint
\calculatehsizes
\calculatevsizes
\recalculatelogos
@@ -463,11 +479,30 @@
\appendtoks \checklayout \to \everystarttext
\def\checkcurrentlayout%
- {\doifundefinedelse{\??ly\number\realfolio\c!status}
- {\doifonevenpaginaelse
- {\doifdefined{\??ly\v!oneven\c!status}{\stellayoutin[\v!oneven]}}
- {\doifdefined{\??ly\v!even \c!status}{\stellayoutin[\v!even ]}}}
- {\stellayoutin[\number\realfolio]}}
+ {\ifundefined{\??ly\number\realfolio\c!status}%
+ \doifonevenpaginaelse\checkcurrentoddlayout\checkcurrentevenlayout
+ \else
+ \stellayoutin[\number\realfolio]%
+ \fi}
+
+\def\checkcurrentoddlayout
+ {\ifundefined{\??ly\v!oneven\c!status}\else\stellayoutin[\v!oneven]\fi}
+
+\def\checkcurrentevenlayout
+ {\ifundefined{\??ly\v!even \c!status}\else\stellayoutin[\v!even ]\fi}
+% not much faster at all
+%
+% \beginETEX
+%
+% \def\checkcurrentlayout%
+% {\ifcsname\??ly\number\realfolio\c!status\endcsname
+% \stellayoutin[\number\realfolio]%
+% \else\doifonevenpaginaelse
+% {\ifcsname\??ly\v!oneven\c!status\endcsname\stellayoutin[\v!oneven]\fi}
+% {\ifcsname\??ly\v!even \c!status\endcsname\stellayoutin[\v!even ]\fi}%
+% \fi}
+%
+% \endETEX
\appendtoks \checkcurrentlayout \to \everyaftershipout
@@ -508,7 +543,7 @@
\recalculatelayout
\presetcenterpagebox}
-\def\stellayoutin%
+\def\stellayoutin
{\dodoubleempty\dostellayoutin}
\let\@@zahoogte=\!!zeropoint
@@ -516,14 +551,14 @@
\def\dopushpagedimensions%
{\xdef\oldteksthoogte{\the\teksthoogte}%
\xdef\oldvoethoogte{\the\voethoogte}%
- \global\let\@@zahoogte=\@@zahoogte}
+ \global\let\@@zahoogte\@@zahoogte}
\def\dopoppagedimensions%
- {\global\teksthoogte=\oldteksthoogte
- \global\voethoogte=\oldvoethoogte
+ {\global\teksthoogte\oldteksthoogte
+ \global\voethoogte\oldvoethoogte
\recalculatelayout
- \global\let\pushpagedimensions=\dopushpagedimensions
- \global\let\poppagedimensions=\relax}
+ \global\let\pushpagedimensions\dopushpagedimensions
+ \global\let\poppagedimensions\relax}
\let\poppagedimensions = \relax
\let\pushpagedimensions = \dopushpagedimensions
@@ -535,20 +570,21 @@
\let\adaptedpages\empty
-\def\adaptpagedimensions%
- {\rawdoifinsetelse{\realfolio}{\adaptedpages}
- {\getvalue{\??za\realfolio}%
- \letbeundefined{\??za\realfolio}}
- {}}
+\def\adaptpagedimensions
+ {\ifx\adaptedpages\empty\else
+ \rawdoifinsetelse\realfolio\adaptedpages
+ {\getvalue{\??za\realfolio}%
+ \letbeundefined{\??za\realfolio}}
+ \donothing
+ \fi}
\def\checkpagedimensions%
{\poppagedimensions
\adaptpagedimensions}
\def\reportpagedimensions%
- {\ifx\poppagedimensions\relax
- \else
- \spatie\@@zahoogte\spatie-
+ {\ifx\poppagedimensions\relax \else
+ \spatie\@@zahoogte\space-\space
\fi
\realfolio}
@@ -563,16 +599,16 @@
{\balancedimensions{\teksthoogte}{\voethoogte}{\voethoogte}}
{\balancedimensions{\teksthoogte}{\voethoogte}{\@@zahoogte}}%
\ifdim\voethoogte<\zeropoint
- \global\advance\teksthoogte by \voethoogte
- \global\voethoogte=\zeropoint
+ \global\advance\teksthoogte \voethoogte
+ \global\voethoogte\zeropoint
\global\xdef\@@zahoogte{\layoutparameter\c!voet\spatie(\v!max)}%
\fi
\setvsize
- \global\pagegoal=\vsize % nog corrigeren voor insertions ?
+ \global\pagegoal\vsize % nog corrigeren voor insertions ?
\recalculatelogos
\recalculatebackgrounds
- \global\let\pushpagedimensions=\relax
- \global\let\poppagedimensions=\dopoppagedimensions}
+ \global\let\pushpagedimensions\relax
+ \global\let\poppagedimensions\dopoppagedimensions}
\def\dopaslayoutaan[#1][#2]%
{\doifelsenothing{#2}
@@ -660,8 +696,8 @@
\setbox#1=\vbox
{%\forgetall
\offinterlineskip
- \dorecurse{\@@lyny}
- {\hbox{\dorecurse{\@@lynx}{\copy#1\hskip\@@lydx}\unskip}%
+ \dorecurse\@@lyny
+ {\hbox{\dorecurse\@@lynx{\copy#1\hskip\@@lydx}\unskip}%
\vskip\@@lydy}
\unskip}%
\fi}
@@ -709,13 +745,13 @@
{\the\realpageno}%
\def\addpagecutmarks#1%
- {\doif{\@@lymarkering}{\v!aan}
- {\let\cutmarksymbol=\pagecutmarksymbol
+ {\doif\@@lymarkering\v!aan
+ {\let\cutmarksymbol\pagecutmarksymbol
\makecutbox{#1}}}
\def\addpagecolormarks#1%
- {\doif{\@@lymarkering}{\v!kleur}
- {\let\cutmarksymbol=\pagecutmarksymbol
+ {\doif\@@lymarkering\v!kleur
+ {\let\cutmarksymbol\pagecutmarksymbol
\makecutbox{#1}%
\ifnum\horizontalcutmarks>1 \chardef\colormarkoffset=4 \fi
\ifnum\verticalcutmarks >1 \chardef\colormarkoffset=4 \fi
@@ -724,40 +760,52 @@
\newif\ifdubbelzijdig \dubbelzijdigfalse
\newif\ifenkelzijdig \enkelzijdigtrue
-\def\doifsometextlineelse#1#2#3% ! omgekeerd !
- {\doifinsetelse{\getvalue{\??tk#1\v!tekst\c!status}}{\v!geen,\v!hoog}
- {#3}{#2}}
+%\def\doifsometextlineelse#1#2#3% ! omgekeerd !
+% {\doifinsetelse{\getvalue{\??tk#1\v!tekst\c!status}}{\v!geen,\v!hoog}
+% {#3}{#2}}
+
+\def\doifsometextlineelse#1%
+ {\edef\!!stringa{\csname\??tk#1\v!tekst\c!status\endcsname}%
+ \ifx\!!stringa\v!geen
+ \@EA\secondoftwoarguments
+ \else\ifx\!!stringa\v!hoog
+ \@EAEAEA\secondoftwoarguments
+ \else
+ \@EAEAEA\firstoftwoarguments
+ \fi\fi}
% NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET
\def\calculatevsizes% global needed in \recalculatelayoutregel
- {\redoglobal\teksthoogte=\zethoogte
+ {\redoglobal\teksthoogte\zethoogte
\doifsometextlineelse \v!hoofd
- {\redoglobal\advance\teksthoogte by -\hoofdhoogte
- \redoglobal\advance\teksthoogte by -\hoofdafstand}
+ {\redoglobal\advance\teksthoogte -\hoofdhoogte
+ \redoglobal\advance\teksthoogte -\hoofdafstand}
\donothing
\doifsometextlineelse \v!voet
- {\redoglobal\advance\teksthoogte by -\voethoogte
- \redoglobal\advance\teksthoogte by -\voetafstand}
+ {\redoglobal\advance\teksthoogte -\voethoogte
+ \redoglobal\advance\teksthoogte -\voetafstand}
\donothing
\resetglobal
\setvsize}
\def\calculatereducedvsizes%
- {\teksthoogte=\zethoogte
+ {\teksthoogte\zethoogte
\doifsometextlineelse \v!hoofd
- {\advance\teksthoogte by -\hoofdhoogte
- \advance\teksthoogte by -\hoofdafstand}
- {\hoofdhoogte=\zeropoint}%
+ {\advance\teksthoogte -\hoofdhoogte
+ \advance\teksthoogte -\hoofdafstand}
+ {\hoofdhoogte\zeropoint
+ \setlayoutdistances}%
\doifsometextlineelse \v!voet
- {\advance\teksthoogte by -\voethoogte
- \advance\teksthoogte by -\voetafstand}
- {\voethoogte=\zeropoint}}
+ {\advance\teksthoogte -\voethoogte
+ \advance\teksthoogte -\voetafstand}
+ {\voethoogte\zeropoint
+ \setlayoutdistances}}
\def\freezetextwidth% % \zetbreedte may be set to \tekstbreedte
- {\tekstbreedte=\zetbreedte % which is a tricky but valid value
+ {\tekstbreedte\zetbreedte % which is a tricky but valid value
\doifsomething{\layoutparameter\c!tekstbreedte}
- {\tekstbreedte=\layoutparaneter\c!tekstbreedte}}
+ {\tekstbreedte\layoutparaneter\c!tekstbreedte}}
\def\calculatehsizes%
{\freezetextwidth
@@ -775,11 +823,26 @@
\newif\ifshiftedrealpageno
-\def\doifonevenpaginaelse#1#2%
+% \def\doifonevenpaginaelse#1#2%
+% {\ifshiftedrealpageno
+% \ifodd\realpageno#2\else#1\fi
+% \else
+% \ifodd\realpageno#1\else#2\fi
+% \fi}
+
+\def\doifonevenpaginaelse
{\ifshiftedrealpageno
- \ifodd\realpageno#2\else#1\fi
+ \ifodd\realpageno
+ \@EAEAEA\secondoftwoarguments
+ \else
+ \@EAEAEA\firstoftwoarguments
+ \fi
\else
- \ifodd\realpageno#1\else#2\fi
+ \ifodd\realpageno
+ \@EAEAEA\firstoftwoarguments
+ \else
+ \@EAEAEA\secondoftwoarguments
+ \fi
\fi}
\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od%
@@ -813,19 +876,6 @@
\advance\texthoffset-\zetbreedte
\od}
-\def\initializepaper%
- {\iflocation
- \dosetuppaper
- {\papersize}
- {\the\papierbreedte}
- {\the\papierhoogte}%
- \else
- \dosetuppaper
- {\printpapersize}
- {\the\printpapierbreedte}
- {\the\printpapierhoogte}%
- \fi}
-
\def\goleftonpage%
{\hskip-\linkermargeafstand
\hskip-\linkermargebreedte
@@ -835,7 +885,7 @@
\iffixedlayoutdimensions
\def\doswapmargins%
- {\let\doswapmargins=\relax % to prevent local swapping
+ {\let\doswapmargins\relax % to prevent local swapping
\swapdimens\linkermargeafstand\rechtermargeafstand
\swapdimens\linkerrandafstand \rechterrandafstand
\swapdimens\linkermargebreedte\rechtermargebreedte
@@ -850,7 +900,7 @@
\letvalue{\??ly\currentlayout#2}\!!stringa}
\def\doswapmargins%
- {\let\doswapmargins=\relax % to prevent local swapping
+ {\let\doswapmargins\relax % to prevent local swapping
\dodoswapmargins\c!linkermargeafstand\c!rechtermargeafstand
\dodoswapmargins\c!linkerrandafstand \c!rechterrandafstand
\swapdimens\linkermargebreedte\rechtermargebreedte
@@ -862,7 +912,7 @@
{\doifbothsides#1\orsideone#1\orsidetwo#2\od}
\def\swapmargins%
- {\doifmarginswapelse{}{\doswapmargins}}
+ {\doifmarginswapelse\relax\doswapmargins}
%D \macros
%D {showprint, showframe, showlayout, showsetups}
@@ -990,27 +1040,34 @@
%D \CDROM\ covers, but it does not hurt to have the paper size
%D ready.
-\definepapersize [CD] [\c!breedte=120mm, \c!hoogte=120mm]
+\definepapersize [CD] [\c!breedte=120mm,\c!hoogte=120mm]
%D The next series is for our English speaking friends who
-%D decided to stick to non metric values.
+%D decided to stick to non metric values. Thanks to Nelson
+%D Beebe for completing the inch based list.
+
+\definepapersize [letter] [\c!breedte=8.5in,\c!hoogte=11in]
+\definepapersize [ledger] [\c!breedte=11in,\c!hoogte=17in]
+\definepapersize [tabloid] [\c!breedte=17in,\c!hoogte=11in]
+
+\definepapersize [legal] [\c!breedte=8.5in,\c!hoogte=14in]
+\definepapersize [folio] [\c!breedte=8.5in,\c!hoogte=13in]
+\definepapersize [executive] [\c!breedte=7.25in,\c!hoogte=10.5in]
-\definepapersize [letter] [\c!breedte=8.5in, \c!hoogte=11in]
-\definepapersize [2*letter] [\c!breedte=11in, \c!hoogte=17in]
-\definepapersize [legal] [\c!breedte=8.5in, \c!hoogte=14in]
-\definepapersize [folio] [\c!breedte=8.5in, \c!hoogte=13in]
-\definepapersize [executive] [\c!breedte=7.25in, \c!hoogte=10.5in]
+\definepapersize [A] [\c!breedte=8.5in,\c!hoogte=11in] % 1 sheet
+\definepapersize [B] [\c!breedte=11in,\c!hoogte=17in] % 2 sheets
+\definepapersize [C] [\c!breedte=17in,\c!hoogte=22in] % 4 sheets
-%D This set is for Tobias Burnus, who gave me the sizes.
+%D The next set is for Tobias Burnus, who gave me the sizes.
-\definepapersize [envelope 9] [\c!breedte=8.88in, \c!hoogte=3.88in]
-\definepapersize [envelope 10] [\c!breedte=9.5in, \c!hoogte=4.13in]
+\definepapersize [envelope 9] [\c!breedte=8.88in,\c!hoogte=3.88in]
+\definepapersize [envelope 10] [\c!breedte=9.5in,\c!hoogte=4.13in]
\definepapersize [envelope 11] [\c!breedte=10.38in,\c!hoogte=4.5in]
-\definepapersize [envelope 12] [\c!breedte=11.0in, \c!hoogte=4.75in]
-\definepapersize [envelope 14] [\c!breedte=11.5in, \c!hoogte=5.0in]
-\definepapersize [monarch] [\c!breedte=7.5in, \c!hoogte=3.88in]
-\definepapersize [check] [\c!breedte=8.58in, \c!hoogte=3.88in]
-\definepapersize [DL] [\c!breedte=220mm, \c!hoogte=110mm]
+\definepapersize [envelope 12] [\c!breedte=11.0in,\c!hoogte=4.75in]
+\definepapersize [envelope 14] [\c!breedte=11.5in,\c!hoogte=5.0in]
+\definepapersize [monarch] [\c!breedte=7.5in,\c!hoogte=3.88in]
+\definepapersize [check] [\c!breedte=8.58in,\c!hoogte=3.88in]
+\definepapersize [DL] [\c!breedte=220mm,\c!hoogte=110mm]
%D We can now default to a reasonable size. We match the print
%D paper size with the typeset paper size. This setting should
diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex
index d9c624815..91b2d0863 100644
--- a/tex/context/base/page-lin.tex
+++ b/tex/context/base/page-lin.tex
@@ -50,6 +50,7 @@
\global\let\afterfirstobeyedline\relax}}%
\def\obeyedline%
{\par
+\let\checkindentation=\relax % else problems with odd/even
\afterfirstobeyedline
\ifdim\lastskip>\zeropoint
\gdef\@@rglinesteptoggle{0}%
@@ -164,7 +165,7 @@
{\regelreferentie1[#1]\ignorespaces}
\def\stopregel[#1]%
- {\unskip\regelreferentie2[#1]}
+ {\removelastspace\regelreferentie2[#1]}
% \def\inregellabel#1%
% {\doifinstringelse{--}{#1}
@@ -313,7 +314,7 @@
{\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break}
\def\opeenregel%
- {\def\crlf{\ifhmode\unskip\fi\space}\let\\\crlf}
+ {\def\crlf{\removelastspace\space}\let\\\crlf}
\newcount\internalparagraphnumber
diff --git a/tex/context/base/page-log.tex b/tex/context/base/page-log.tex
index 15e7f3125..66feb39f5 100644
--- a/tex/context/base/page-log.tex
+++ b/tex/context/base/page-log.tex
@@ -94,17 +94,17 @@
% no logos to take care of
\or % 1
\ifnewlogos
- \chardef\logostatus=2
+ \chardef\logostatus2
\setlogoboxes
- \chardef\logostatus=1
+ \chardef\logostatus1
\global\newlogosfalse
\fi
\or % 2
\setlogoboxes
- \chardef\logostatus=1
+ \chardef\logostatus1
\or % 3
\setlogoboxes
- \global\chardef\logostatus=2
+ \global\chardef\logostatus2
\fi
\setbox#1=\vbox
{\offinterlineskip
diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex
index 7bc27b31f..a9bc11ac7 100644
--- a/tex/context/base/page-lyr.tex
+++ b/tex/context/base/page-lyr.tex
@@ -15,12 +15,16 @@
\unprotect
+% When being backgrounds layers get the background offset
+% displacement. Should be an option, on by default
+% (compatibility).
+
%D The layering mechanism implemented here is independent of
%D the output routine, but future extensions may depend on a
%D more close cooperation.
%D First we overload a macro from \type {core-rul}. From now on
-%D we accept a third (optional) argument: the specific layer it
+%D we accept a (optional) argument: the specific layer it
%D will go in. This means that we can move an overlay from one
%D background to the other using the dimensions of the parent.
@@ -29,12 +33,13 @@
\def\defineoverlay%
{\dotripleempty\dodefineoverlay}
-\def\dodefineoverlay[#1][#2][#3]%
+\def\dodefineoverlay[#1][#2][#3]% overlay [layer] content
{\ifthirdargument
+ \writestatus{BEWARE}{This (overlay definition) has changed!}% temp
\def\docommando##1%
{\setvalue{\??ov##1}####1####2####3####4####5####6####7%
- {\setlayer[#3]{\executedefinedoverlay
- ##1\\#2\\{####1}{####2}{####3}{####4}{####5}{####6}{####7}}}}%
+ {\setlayer[#2]{\executedefinedoverlay
+ ##1\\#3\\{####1}{####2}{####3}{####4}{####5}{####6}{####7}}}}%
\else
\def\docommando##1%
{\setvalue{\??ov##1}{\executedefinedoverlay
@@ -75,8 +80,10 @@
[\c!status=\v!start,\c!richting=\v!normaal,\c!optie=,
\c!x=\!!zeropoint,\c!y=\!!zeropoint,\c!positie=\v!nee,
\c!breedte=\wd\nextbox,\c!hoogte=\ht\nextbox,
+ \c!offset=\!!zeropoint,
\c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint,
- \c!plaats=rb,\c!positie=\v!nee,\c!pagina=,#2]}
+ \c!plaats=rb,\c!positie=\v!nee,\c!pagina=,
+ \c!sx=1,\c!sy=1,\c!hoek=,#2]}
%D \macros
%D {setuplayer}
@@ -116,7 +123,8 @@
\doglobal\increment\currentlayerdata
\forgetall
\dontcomplain
- \doifvalue{\??ll#1\c!optie}{\v!test}{\tracelayerstrue}%
+ \doifvalue{\??ll#1\c!optie}{\v!test}
+ {\traceboxplacementtrue\tracelayerstrue}%
\dowithnextbox % sneller als aparte macro
{\ifundefined{\@@layerbox#1}%
\writestatus{layer}{unknown layer #1}%
@@ -128,28 +136,102 @@
\newbox\layerbox
-\def\dododosetlayer[#1][#2]%
+% \def\dododosetlayer[#1][#2]%
+% {\getparameters[\??ll#1][#2]%
+% \doifvalue{\??ll#1\c!positie}{\v!overlay}
+% {\getparameters[\??ll#1]
+% [\c!positie=\v!ja,
+% \c!breedte=\!!zeropoint,
+% \c!hoogte=\!!zeropoint]}%
+% \doifelsevalue{\??ll#1\c!positie}{\v!ja}
+% {\edef\layerpage{\MPp{lyr:\currentlayerdata}}%
+% \scratchdimen\MPx{lyr:#1:\layerpage}\scratchdimen-\scratchdimen
+% \advance\scratchdimen\MPx{lyr:\currentlayerdata}%
+% \setevalue{\??ll#1\c!x}{\the\scratchdimen}%
+% \scratchdimen\MPy{lyr:#1:\layerpage}%
+% \advance\scratchdimen-\MPy{lyr:\currentlayerdata}%
+% \setevalue{\??ll#1\c!y}{\the\scratchdimen}%
+% \setxvalue{\??ll#1\layerpage\c!positie}{\v!ja}%
+% \setxvalue{\??ll#1\c!status}{\v!start}% needed ?
+% \setbox\layerbox\vbox to \getvalue{\??ll#1\c!hoogte} % \ht\nextbox
+% {\hbox to \getvalue{\??ll#1\c!breedte} % \wd\nextbox
+% {\xypos{lyr:\currentlayerdata}\hss}%
+% \vss}}
+% {\setbox\layerbox=\emptybox
+% \edef\layerpage{\getvalue{\??ll#1\c!pagina}}}%
+% \doifsomething{\layerpage}
+% {\edef\layerpage{:\layerpage}%
+% \doifundefined{\@@layerbox#1\layerpage}
+% {\global\expandafter\newbox\csname\@@layerbox#1\layerpage\endcsname}}%
+% \global\setbox\csname\@@layerbox#1\layerpage\endcsname=\vbox
+% {\offinterlineskip
+% \ifvoid\csname\@@layerbox#1\layerpage\endcsname\else
+% \ht\csname\@@layerbox#1\layerpage\endcsname\zeropoint
+% \dp\csname\@@layerbox#1\layerpage\endcsname\zeropoint
+% \wd\csname\@@layerbox#1\layerpage\endcsname\zeropoint
+% \doifnotvalue{\??ll#1\c!richting}{\v!omgekeerd}
+% {\box\csname\@@layerbox#1\layerpage\endcsname}%
+% \fi
+% \setbox\nextbox=\hbox
+% {\alignedbox[\getvalue{\??ll#1\c!plaats}]\vbox{\box\nextbox}}%
+% \smashbox\nextbox
+% \scratchdimen=\getvalue{\??ll#1\c!y}%
+% \advance\scratchdimen\getvalue{\??ll#1\c!voffset}%
+% \vskip\scratchdimen
+% \hskip\getvalue{\??ll#1\c!x}%
+% \hskip\getvalue{\??ll#1\c!hoffset}%
+% \box\nextbox % \hfill
+% \ifvoid\csname\@@layerbox#1\layerpage\endcsname
+% % already flushed
+% \else
+% % the reverse case
+% \vskip-\scratchdimen
+% \box\csname\@@layerbox#1\layerpage\endcsname
+% \fi}%
+% \ifvoid\layerbox\else\box\layerbox\fi}
+
+\newdimen\@@layerxsiz \newdimen\@@layerxoff \newdimen\@@layerxpos
+\newdimen\@@layerysiz \newdimen\@@layeryoff \newdimen\@@layerypos
+
+\def\dododosetlayer[#1][#2]% will be sped up
{\getparameters[\??ll#1][#2]%
- \doifvalue{\??ll#1\c!positie}{\v!overlay}
+ \doifvalue{\??ll#1\c!positie}\v!overlay % slow
{\getparameters[\??ll#1]
- [\c!positie=\v!ja,
- \c!breedte=\!!zeropoint,
- \c!hoogte=\!!zeropoint]}%
- \doifelsevalue{\??ll#1\c!positie}{\v!ja}
+ [\c!breedte=\!!zeropoint,
+ \c!hoogte=\!!zeropoint,
+ \c!positie=\v!ja]}%
+ \@@layerxsiz\getvalue{\??ll#1\c!breedte}%
+ \@@layerysiz\getvalue{\??ll#1\c!hoogte }%
+ \@@layerxpos\getvalue{\??ll#1\c!x}%
+ \@@layerypos\getvalue{\??ll#1\c!y}%
+ \@@layerxoff\getvalue{\??ll#1\c!hoffset}%
+ \@@layeryoff\getvalue{\??ll#1\c!voffset}%
+ \advance\@@layerxoff \getvalue{\??ll#1\c!offset}%
+ \advance\@@layeryoff \getvalue{\??ll#1\c!offset}%
+ \@@layerxpos\getvalue{\??ll#1\c!sx}\@@layerxpos
+ \@@layerypos\getvalue{\??ll#1\c!sy}\@@layerypos
+ \@@layerxoff\getvalue{\??ll#1\c!sx}\@@layerxoff
+ \@@layeryoff\getvalue{\??ll#1\c!sy}\@@layeryoff
+ \doifelsevalue{\??ll#1\c!positie}{\v!ja} % combine ^
{\edef\layerpage{\MPp{lyr:\currentlayerdata}}%
- \scratchdimen\MPx{lyr:#1:\layerpage}\scratchdimen-\scratchdimen
+ \scratchdimen\MPx{lyr:#1:\layerpage}%
+ \scratchdimen-\scratchdimen
\advance\scratchdimen\MPx{lyr:\currentlayerdata}%
- \setevalue{\??ll#1\c!x}{\the\scratchdimen}%
+ \@@layerxpos\scratchdimen
\scratchdimen\MPy{lyr:#1:\layerpage}%
\advance\scratchdimen-\MPy{lyr:\currentlayerdata}%
- \setevalue{\??ll#1\c!y}{\the\scratchdimen}%
+ \@@layerypos\scratchdimen
\setxvalue{\??ll#1\layerpage\c!positie}{\v!ja}%
\setxvalue{\??ll#1\c!status}{\v!start}% needed ?
- \setbox\layerbox\vbox to \getvalue{\??ll#1\c!hoogte} % \ht\nextbox
- {\hbox to \getvalue{\??ll#1\c!breedte} % \wd\nextbox
- {\xypos{lyr:\currentlayerdata}\hss}%
- \vss}}
+ \setbox\layerbox\vbox to \@@layerysiz
+ {\hbox to \@@layerxsiz{\xypos{lyr:\currentlayerdata}\hss}\vss}}
{\setbox\layerbox=\emptybox
+ \doifvalue{\??ll#1\c!hoek}{\v!onder}
+ {\ifdim\@@layerysiz>\zeropoint
+ \advance\@@layerypos-\@@layerysiz
+ \@@layerypos-\@@layerypos
+ \@@layeryoff-\@@layeryoff
+ \fi}%
\edef\layerpage{\getvalue{\??ll#1\c!pagina}}}%
\doifsomething{\layerpage}
{\edef\layerpage{:\layerpage}%
@@ -167,17 +249,17 @@
\setbox\nextbox=\hbox
{\alignedbox[\getvalue{\??ll#1\c!plaats}]\vbox{\box\nextbox}}%
\smashbox\nextbox
- \scratchdimen=\getvalue{\??ll#1\c!y}%
- \advance\scratchdimen\getvalue{\??ll#1\c!voffset}%
- \vskip\scratchdimen
- \hskip\getvalue{\??ll#1\c!x}%
- \hskip\getvalue{\??ll#1\c!hoffset}%
- \box\nextbox % \hfill
+ \vskip\@@layerypos
+ \vskip\@@layeryoff
+ \hskip\@@layerxpos
+ \hskip\@@layerxoff
+ \box\nextbox
\ifvoid\csname\@@layerbox#1\layerpage\endcsname
- % already flushed
- \else
- % the reverse case
- \vskip-\scratchdimen
+ % already flushed
+ \else
+ % the reverse case % check !
+ \vskip-\@@layerypos
+ \vskip-\@@layeryoff
\box\csname\@@layerbox#1\layerpage\endcsname
\fi}%
\ifvoid\layerbox\else\box\layerbox\fi}
@@ -207,7 +289,8 @@
{\ifundefined{\@@layerbox#3}%
\ifcase#1\else\writestatus{layer}{unknown layer #3}\fi
\else
- \doifvalue{\??ll#2\c!optie}{\v!test}\tracelayerstrue
+ \doifvalue{\??ll#2\c!optie}{\v!test}
+ {\traceboxplacementtrue\tracelayerstrue}%
\iftracelayers \ruledvbox \else \vbox \fi to \overlayheight
{\forgetall
\hbox to \overlaywidth
@@ -241,7 +324,7 @@
\def\doresetlayer#1%
{\ifundefined{\@@layerbox#1}\else
- \global\@EA\setbox\csname\@@layerbox#1\endcsname\emptybox
+ \global\setbox\csname\@@layerbox#1\endcsname\emptybox
\fi}
\def\resetlayer[#1]%
@@ -309,18 +392,18 @@
\def\startpositioning%
{\bgroup
- \xposition \!!zeropoint \yposition\!!zeropoint
- \xdimension\!!zeropoint \ydimension\!!zeropoint
- \xoffset \!!zeropoint \yoffset \!!zeropoint
+ \xposition \zeropoint \yposition \zeropoint
+ \xdimension\zeropoint \ydimension\zeropoint
+ \xoffset \zeropoint \yoffset \zeropoint
\hfuzz \papierbreedte \vfuzz \papierhoogte
\setbox\positionbox\hbox\bgroup}
\def\stoppositioning%
- {\doifnot{\@@psoffset}{\v!ja}
- {\global\xoffset=\!!zeropoint
- \global\yoffset=\!!zeropoint}%
- \global\advance\xdimension by \xoffset
- \global\advance\ydimension by \yoffset
+ {\doifnot\@@psoffset\v!ja
+ {\global\xoffset\zeropoint
+ \global\yoffset\zeropoint}%
+ \global\advance\xdimension \xoffset
+ \global\advance\ydimension \yoffset
\egroup
\vbox to \ydimension
{\vskip\yoffset
diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex
index 239707ecb..7578020ef 100644
--- a/tex/context/base/page-mak.tex
+++ b/tex/context/base/page-mak.tex
@@ -56,6 +56,7 @@
\c!tekststatus=\v!normaal,
\c!hoofdstatus=\v!stop,
\c!voetstatus=\v!stop,
+ \c!paginastatus=\v!stop,
\c!kleur=,
#2]%
\setvalue{\e!start#1\e!opmaak}{\startmakeup[#1]}%
@@ -75,6 +76,10 @@
%D the direct and indirect way. The parameterless call will
%D build a simple box.
+\newtoks\everymakeup
+
+\appendtoks \postponemarks \to \everymakeup
+
\let\currentmakeup\empty
\def\startmakeup%
@@ -82,6 +87,7 @@
\def\dostartmakeup[#1][#2]%
{\bgroup
+ \the\everymakeup
\edef\currentmakeup{#1}%
\iffirstargument
\setupmakeup[\currentmakeup][#2]%
@@ -102,6 +108,7 @@
\def\donostopmakeup%
{\egroup
+ \flushmarks % new, here, else empty pages
\pagina
\egroup}
@@ -126,7 +133,8 @@
{\endgraf
\makeupparameter\c!onder
\egroup
-\stopregistercolor
+ \flushmarks % new, here, else empty pages
+ \stopregistercolor
\doflushmakeup
\egroup
\calculatehsizes
@@ -149,20 +157,26 @@
\fi}
\def\doshipoutmakeup%
- {\makeupparameter\c!voor
+ {\pushmacro\@@pnstatus % new
+ \makeupparameter\c!voor
\vbox{\hbox{\color[\makeupparameter\c!kleur]{\box\makeupbox}}}%
+ \stelpaginanummerin[\c!status=\makeupparameter\c!paginastatus]%
\setupmakeuplayout
\pagina
\makeupparameter\c!na
\ifdubbelzijdig \ifodd\realpageno\else
\processaction
[\makeupparameter\c!dubbelzijdig]
- [ \v!ja=>\null\pagina\verlaagpaginanummer,
+ [ \v!ja=>\null
+ \pagina,
+ % \verlaagpaginanummer, % new
\v!leeg=>\setupmakeuplayout
- \pagebodyornamentsfalse % hm, an old forgotten option
- \null\pagina\verlaagpaginanummer]%
+ \pagebodyornamentsfalse
+ \null\pagina]%
+ % \verlaagpaginanummer]% % new
\fi \fi
- \verlaagpaginanummer}
+ % \verlaagpaginanummer % new
+ \popmacro\@@pnstatus} % new
%D The text surrounding the main body text can be influenced
%D by setting their associated status variables. The
@@ -174,7 +188,7 @@
\setuptext [\c!status=\makeupparameter\c!tekststatus]%
\setupbottom[\c!status=\makeupparameter\c!onderstatus]%
\setuptop [\c!status=\makeupparameter\c!bovenstatus]}
-
+
%D The standard page template is defined as follows:
\definemakeup
diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex
index 4a163ed23..6dbd27198 100644
--- a/tex/context/base/page-mar.tex
+++ b/tex/context/base/page-mar.tex
@@ -254,7 +254,7 @@
\def\flushmargincontents%
{\restoreinterlinepenalty % here?
- \ifnum\margincontent>0 % called quite often, so we
+ \ifcase\margincontent\else % called quite often, so we
\expandafter\doflushmargincontents % speed up the \fi scan by
\fi} % using a \do..
@@ -296,13 +296,13 @@
\def\doflushmargincontents% % links + rechts
{\bgroup
\forgetall
- \global\marginheight\!!zeropoint
+ \global\marginheight\zeropoint
\dorecurse{\margincontent}
{\bgroup
\edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}%
\edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}%
\edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}%
- \let\margetekstnummer=\recurselevel
+ \let\margetekstnummer\recurselevel
\getvalue{\??im\recurselevel}%
\global\setvalue{\??im\recurselevel}{}%
\egroup}%
@@ -314,12 +314,12 @@
\donefalse % how needed
\fi\fi
\ifdone
- \advance\marginheight by \pagetotal
- \advance\marginheight by \lineheight % a sort of bonus
+ \advance\marginheight \pagetotal
+ \advance\marginheight \lineheight % a sort of bonus
\ifdim\marginheight>\pagegoal
\xdef\restoreinterlinepenalty%
{\global\let\restoreinterlinepenalty\relax
- \global\interlinepenalty=\the\interlinepenalty}%
+ \global\interlinepenalty=\the\interlinepenalty}% keep = here
\global\interlinepenalty=10000
\fi
\else % We need the above because interlinepenalties overrule vadjusted \nobreaks.
@@ -381,6 +381,12 @@
\getboxheight\dimen0\of\box0
\vskip-\dimen0\
\box0}}
+
+\def\resetmargincontent % quick hack
+ {\doglobal\newcounter\margincontent}
+
+\def\resetmargetitels
+ {\resetmargincontent}
%D \macros
%D {inleftside,inleftmargin,inrightmargin,inrightside}
@@ -474,12 +480,12 @@
\ifnum\realpageno>1
\bgroup
\pagebodyornamentsfalse
- \setbox\facingpage=\vbox to \zethoogte
+ \setbox\facingpage\vbox to \zethoogte
{\unvbox\facingpage\vfil}%
\myshipout{\buildpagebody\box\facingpage}%
\egroup
\else
- \global\setbox\facingpage=\box\voidb@x
+ \global\setbox\facingpage\emptybox
\fi
\fi}
@@ -491,17 +497,16 @@
\def\startnaast% beter: \dowithnextbox
{\iffacingpages
- \global\setbox\facingbox=\vbox
+ \global\setbox\facingbox\vbox
\bgroup
- \hsize=\zetbreedte
+ \hsize\zetbreedte
\else
- \def\next{\gobbleuntil\stopnaast}%
- \expandafter\next
+ \@EA\gobbleuntil\@EA\stopnaast
\fi}
\def\stopnaast%
{\egroup
- \global\setbox\facingpage=\vbox
+ \global\setbox\facingpage\vbox
{\ifvoid\facingpage
\vskip\openstrutdepth % \dp\strutbox
\else
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index ca8d8aea7..eb01d4e67 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -299,16 +299,16 @@
\global\vsize=-\columntextoffset
\global\multiply\vsize by 2
\global\advance\vsize by \columntextheight
- \ifdim\precolumnboxheight>\!!zeropoint
+ \ifdim\precolumnboxheight>\zeropoint
\global\advance\vsize by -\precolumnboxheight
\fi
\getinsertionheights\to\dimen0\\%
\global\advance\vsize by -\dimen0
- \ifgridsnapping % evt altijd, nog testen
+%%%\ifgridsnapping % evt altijd, nog testen, testing now, see columned tocs
\getnoflines\vsize
\vsize=\noflines\openlineheight
\advance\vsize by .5\openlineheight % collect enough data
- \fi
+%%%\fi
\global\vsize=\nofcolumns\vsize
\global\pagegoal=\vsize} % let's do it only here
@@ -365,7 +365,7 @@
\hangafter=0
\hangindent=\!!zeropoint
\everypar{}%
- \ifdim\pagetotal=\!!zeropoint \else
+ \ifdim\pagetotal=\zeropoint \else
\vbox{\forgetall\strut}%
\vskip-\openlineheight
\fi
@@ -439,7 +439,7 @@
\def\checkbegincolumnfootnotes%
{\ifcleverfootnotes
\doflushfootnotes
- \ifdim\ht\footins>\!!zeropoint % hm, actually unknown
+ \ifdim\ht\footins>\zeropoint % hm, actually unknown
\global\setbox\savedfootins=\box\footins
\else
\global\setbox\savedfootins=\box\voidb@x
@@ -572,12 +572,13 @@
\global\precolumnboxheight=\!!zeropoint
\setvsize
\dosomebreak\nobreak
- \ifgridsnapping \else
- \scratchdimen=\topskip
- \advance\scratchdimen by -\openstrutheight
- \nointerlineskip
- \vskip-\scratchdimen
- \fi
+% wrong ! ! ! ! !
+% \ifgridsnapping \else
+% \scratchdimen=\topskip
+% \advance\scratchdimen by -\openstrutheight
+% \nointerlineskip
+% \vskip-\scratchdimen
+% \fi
\prevdepth\openstrutdepth
\nointerlineskip
\dp\columnpagebox=\!!zeropoint
@@ -732,7 +733,7 @@
\def\splitcolumn#1from \box#2to \dimen#3 top \box#4%
{\bgroup
- \ifdim\ht#4>\!!zeropoint
+ \ifdim\ht#4>\zeropoint
\dimen0=\dimen#3\relax
\dimen2=\dimen0
\advance\dimen0 by -\ht#4%
@@ -780,7 +781,7 @@
{\relax
\ifcleverfootnotes
\ifnum#1=\lastcolumnbox
- \ifdim\ht\footins>\!!zeropoint
+ \ifdim\ht\footins>\zeropoint
\vskip1\skip\footins % remove stretch and shrink
\kern\ht\footins % a \vskip would be is discarded!
\fi
@@ -791,7 +792,7 @@
{\relax
\ifcleverfootnotes
\ifnum#1=\lastcolumnbox\relax
- \ifdim\ht\footins>\!!zeropoint
+ \ifdim\ht\footins>\zeropoint
\advance#2 by -\ht\footins
\advance#2 by -\skip\footins
\fi
@@ -800,7 +801,7 @@
\def\overlaycolumnfootnotes% VERVANGEN !!!
{\relax
- \ifcleverfootnotes\ifdim\ht\footins>\!!zeropoint
+ \ifcleverfootnotes\ifdim\ht\footins>\zeropoint
\bgroup
\scratchdimen=\ht\firstcolumnbox
\advance\scratchdimen by -\openstrutdepth % \dp\strutbox
@@ -1387,7 +1388,7 @@
\else
% \showmessage{\m!columns}{13}{}%
\fi
- \ifdim\ht\floatbox>\!!zeropoint\relax
+ \ifdim\ht\floatbox>\zeropoint\relax
\global\setbox\currenttopcolumnbox=\vbox
{\snaptogrid\vbox
{\copy\currenttopcolumnbox
@@ -1455,7 +1456,7 @@
\def\linebetweencolumns%
{\bgroup
\startcolorpage
- \ifdim\@@klafstand>\!!zeropoint
+ \ifdim\@@klafstand>\zeropoint
\dimen0=\@@klafstand
\else
\dimen0=\linewidth
@@ -1489,6 +1490,8 @@
\let\restorecolumnsettings\relax
+\definecomplexorsimpleempty\startkolommen
+
\def\complexstartkolommen[#1]% %% \startkolommen
{\bgroup
\let\stopkolommen=\egroup
@@ -1536,7 +1539,7 @@
\edef\minbalancetoplines{\@@klnboven}%
\steltolerantiein[\@@kltolerantie]% %% \startkolommen
\stelblankoin[\@@klblanko]%
- \ifdim\tussenwit>\!!zeropoint
+ \ifdim\tussenwit>\zeropoint\relax
\stelwitruimtein[\@@klblanko]%
\fi
\def\stopkolommen%
@@ -1549,8 +1552,6 @@
\fi
\fi}
-\definecomplexorsimpleempty\startkolommen
-
%\def\kolom%
% {\ifbinnenkolommen
% \ejectcolumn
diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex
index e7f0a2109..b2eab250c 100644
--- a/tex/context/base/page-num.tex
+++ b/tex/context/base/page-num.tex
@@ -58,7 +58,7 @@
\processaction
[\@@snstatus]
[ \v!stop=>\ifsubpaging
-\resetsubpaginanummer % new, see sync
+ \resetsubpaginanummer % new, see sync
\else
\subpagingfalse
\fi
@@ -77,21 +77,21 @@
\def\stelsubpaginanummerin%
{\dosingleargument\dostelsubpaginanummerin}
-\def\newnofsubpages {0}
-\def\nofsubpages {0}
-\def\firstsubpage {1}
-\def\prevsubpage {1}
-\def\nextsubpage {1}
-\def\lastsubpage {1}
+\def\newnofsubpages{0}
+\def\nofsubpages {0}
+\def\firstsubpage {1}
+\def\prevsubpage {1}
+\def\nextsubpage {1}
+\def\lastsubpage {1}
-\def\nextpage {1}
-\def\prevpage {1}
+\def\nextpage {1}
+\def\prevpage {1}
-\definetwopasslist{\s!subpage}
+\definetwopasslist\s!subpage
\def\savenofsubpages%
{\ifsubpaging
- \showmessage{\m!layouts}{6}{\newnofsubpages,\the\subpageno}%
+ \showmessage\m!layouts6{\newnofsubpages,\the\subpageno}%
\immediatewriteutilitycommand%
{\twopassentry%
{\s!subpage}%
@@ -104,8 +104,8 @@
\bgroup
\xdef\nofsubpages{\twopassdata}%
\xdef\firstsubpage{\realfolio}%
- \advance\realpageno by \nofsubpages
- \advance\realpageno by -1
+ \advance\realpageno \nofsubpages
+ \advance\realpageno -1
\xdef\lastsubpage{\realfolio}%
\egroup
\else
@@ -113,7 +113,7 @@
\fi}
\def\gotonextsubpage% overlapt behoorlijk met realpage macro
- {\global\let\checksubpages=\relax
+ {\global\let\checksubpages\relax
\ifresettingsubpagenumber
\resetnummer[\s!subpage]%
\global\resettingsubpagenumberfalse
@@ -121,12 +121,12 @@
\ifsubpaging
\edef\oldsubpage{\the\subpageno}%
\verhoognummer[\s!subpage]%
- \global\subpageno=\ruwenummer[\s!subpage]\relax
+ \global\subpageno\ruwenummer[\s!subpage]\relax
\ifnum\subpageno=1
- \gettwopassdata{\s!subpage}%
+ \gettwopassdata\s!subpage
\setsubpagenumbers
\ifnum\oldsubpage>0
- \showmessage{\m!layouts}{6}{\newnofsubpages,\oldsubpage}%
+ \showmessage\m!layouts6{\newnofsubpages,\oldsubpage}%
\edef\next%
{\writeutilitycommand%
{\twopassentry%
@@ -137,34 +137,34 @@
\fi
\doglobal\increment\newnofsubpages\relax
\fi
- \setglobalsystemreference\rt!page{\v!eerstesubpagina}\firstsubpage
- \setglobalsystemreference\rt!page{\v!laatstesubpagina}\lastsubpage
+ \setglobalsystemreference\rt!page\v!eerstesubpagina\firstsubpage
+ \setglobalsystemreference\rt!page\v!laatstesubpagina\lastsubpage
\bgroup
\ifnum\realpageno=\firstsubpage\relax
- \global\let\prevsubpage=\firstsubpage
-\setglobalsystemreference\rt!page{\v!sub\v!achteruit}\lastsubpage
+ \global\let\prevsubpage\firstsubpage
+ \setglobalsystemreference\rt!page{\v!sub\v!achteruit}\lastsubpage
\else
\xdef\prevsubpage{\realfolio}%
\doglobal\decrement\prevsubpage
-\setglobalsystemreference\rt!page{\v!sub\v!achteruit}\prevsubpage
+ \setglobalsystemreference\rt!page{\v!sub\v!achteruit}\prevsubpage
\fi
- \setglobalsystemreference\rt!page{\v!vorigesubpagina}\prevsubpage
+ \setglobalsystemreference\rt!page\v!vorigesubpagina\prevsubpage
\ifnum\realpageno=\lastsubpage\relax
- \global\let\nextsubpage=\lastsubpage
-\setglobalsystemreference\rt!page{\v!sub\v!vooruit}\firstsubpage
+ \global\let\nextsubpage\lastsubpage
+ \setglobalsystemreference\rt!page{\v!sub\v!vooruit}\firstsubpage
\else
\xdef\nextsubpage{\realfolio}%
\doglobal\increment\nextsubpage
-\setglobalsystemreference\rt!page{\v!sub\v!vooruit}\nextsubpage
+ \setglobalsystemreference\rt!page{\v!sub\v!vooruit}\nextsubpage
\fi
- \setglobalsystemreference\rt!page{\v!volgendesubpagina}\nextsubpage
+ \setglobalsystemreference\rt!page\v!volgendesubpagina\nextsubpage
\egroup
\fi}
\def\checksubpages%
- {\getfromtwopassdata{\s!subpage}{1}%
+ {\getfromtwopassdata\s!subpage1%
\setsubpagenumbers
- \global\let\checksubpages=\relax}
+ \global\let\checksubpages\relax}
% Omdat \gotonextrealpage gebruik maakt van de hulpfile,
% moet het initialiseren van \realpageno plaatsvinden in
@@ -195,79 +195,79 @@
\def\currentpage {\the\realpageno}
\def\gotonextrealpage%
- {\global\advance\realpageno by 1
+ {\global\advance\realpageno 1
\ifnum\realpageno>\lastpage
\xdef\lastpage{\realfolio}%
\fi
- \setglobalsystemreference\rt!page{\v!eerstepagina}\firstpage
- \setglobalsystemreference\rt!page{\v!laatstepagina}\lastpage
+ \setglobalsystemreference\rt!page\v!eerstepagina\firstpage
+ \setglobalsystemreference\rt!page\v!laatstepagina\lastpage
\bgroup
\ifnum\realpageno>1
- \advance\realpageno by -1
+ \advance\realpageno -1
\xdef\prevpage{\realfolio}%
- \setglobalsystemreference\rt!page{\v!achteruit}\prevpage
+ \setglobalsystemreference\rt!page\v!achteruit\prevpage
\else
- \global\let\prevpage=\firstpage
- \setglobalsystemreference\rt!page{\v!achteruit}\lastpage
+ \global\let\prevpage\firstpage
+ \setglobalsystemreference\rt!page\v!achteruit\lastpage
\fi
- \setglobalsystemreference\rt!page{\v!vorigepagina}\prevpage
+ \setglobalsystemreference\rt!page\v!vorigepagina\prevpage
\egroup
\bgroup
\ifnum\realpageno<\lastpage\relax
- \advance\realpageno by 1
+ \advance\realpageno 1
\xdef\nextpage{\realfolio}%
- \setglobalsystemreference\rt!page{\v!pagina}\nextpage
- \setglobalsystemreference\rt!page{\v!vooruit}\nextpage
+ \setglobalsystemreference\rt!page\v!pagina\nextpage
+ \setglobalsystemreference\rt!page\v!vooruit\nextpage
\bgroup
\xdef\nextnextpage{\realfolio}%
\ifodd\realpageno
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
+ \setglobalsystemreference\rt!page\v!volgendeonevenpagina\nextnextpage
\else
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
+ \setglobalsystemreference\rt!page\v!volgendeevenpagina\nextnextpage
\fi
- \advance\realpageno by 1
+ \advance\realpageno 1
\xdef\nextnextpage{\realfolio}%
\ifnum\realpageno>\lastpage\relax
%\ifodd\realpageno
- % \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
+ % \setglobalsystemreference\rt!page\v!volgendeonevenpagina\lastpage
%\else
- % \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
+ % \setglobalsystemreference\rt!page\v!volgendeevenpagina\lastpage
%\fi
\else
\ifodd\realpageno
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
+ \setglobalsystemreference\rt!page\v!volgendeonevenpagina\nextnextpage
\else
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
+ \setglobalsystemreference\rt!page\v!volgendeevenpagina\nextnextpage
\fi
\fi
\egroup
\else
- \global\let\nextpage=\lastpage
- \setglobalsystemreference\rt!page{\v!pagina}\firstpage
- \setglobalsystemreference\rt!page{\v!vooruit}\firstpage
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
+ \global\let\nextpage\lastpage
+ \setglobalsystemreference\rt!page\v!pagina\firstpage
+ \setglobalsystemreference\rt!page\v!vooruit\firstpage
+ \setglobalsystemreference\rt!page\v!volgendeonevenpagina\lastpage
+ \setglobalsystemreference\rt!page\v!volgendeevenpagina\lastpage
\fi
- \setglobalsystemreference\rt!page{\v!volgendepagina}\realfolio
+ \setglobalsystemreference\rt!page\v!volgendepagina\realfolio
\egroup}
-\def\checkrealpage%
- {\global\realpageno=0
+\def\checkrealpage
+ {\global\realpageno0
\gotonextrealpage
- \global\let\checkrealpage=\relax}
+ \global\let\checkrealpage\relax}
-\def\savenofpages%
- {\advance\realpageno by -1
+\def\savenofpages
+ {\advance\realpageno -1
\savecurrentvalue\lastpage{\realfolio}}%
-\def\totaalaantalpaginas%
+\def\totaalaantalpaginas
{\lastpage}
-\def\setpagecounters%
+\def\setpagecounters
{\setuserpageno{\ruwenummer[\s!page]}%
- \doifelse{\@@snstatus}{\v!stop}
- {\global\subpageno=0}
- {\global\subpageno=\ruwenummer[\s!subpage]}}
+ \doifelse\@@snstatus\v!stop
+ {\global\subpageno\zerocount}
+ {\global\subpageno\ruwenummer[\s!subpage]}}
% Standaard is \count0 in Plain TeX de paginateller. Omwille
% van de afhandeling van lokaal nummeren, definieren we
@@ -389,7 +389,7 @@
\def\dostelnummeringin[#1]%
{\getparameters[\??nm][#1]%
- \preparepaginaprefix{\??nm}%
+ \preparepaginaprefix\??nm
\enkelzijdigfalse
\dubbelzijdigfalse
\ExpandFirstAfter\processallactionsinset
@@ -429,42 +429,82 @@
%
% best, beware, chapter (yes) can be followed by title (no)
+%\def\preparepaginaprefix#1%
+% {\def\dopreparepaginaprefix##1%
+% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}% %v
+% \processcommacommand[\@@kolijst]\dopreparepaginaprefix
+% \def\dopreparepaginaprefix##1%
+% {\doifvalue{#1##1\v!nummer}{\v!ja} %v
+% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}}}%
+% \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
+
\def\preparepaginaprefix#1%
{\def\dopreparepaginaprefix##1%
- {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}% %v
- \processcommacommand[\@@kolijst]\dopreparepaginaprefix
+ {\letvalue{#1\getvalue{\??by##1}\v!nummer}\v!nee}% %v
+ \rawprocesscommalist[\@@kolijst]\dopreparepaginaprefix
\def\dopreparepaginaprefix##1%
- {\doifvalue{#1##1\v!nummer}{\v!ja} %v
- {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}}}%
- \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
-
-\def\dopaginaprefix#1#2%
+ {\doifvalue{#1##1\v!nummer}\v!ja %v
+ {\letvalue{#1\getvalue{\??by##1}\v!nummer}\v!ja}}%
+ \rawprocesscommalist[\@@kolijst]\dopreparepaginaprefix}
+
+% \def\dopaginaprefix#1#2%
+% {\let\normaluchar\uchar\let\uchar\relax % ugly but needed
+% \doifelsevalue{#1#2\v!nummer}{\v!ja} % \v! and no \c!
+% {\@EA\beforesplitstring\@EA{\postprefix}\at:\to\preprefix
+% \@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+% \let\uchar\normaluchar % ugly but needed
+% \doifsomething{\preprefix}
+% {\doifnot{\preprefix}{0}{\preprefix\@@nmnummerscheider}}}%
+% {\@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+% \let\uchar\normaluchar}} % ugly but needed
+%
+% \def\paginaprefix#1[#2::#3::#4]% kan wat sneller ####1:0:
+% {\bgroup
+% \edef\postprefix{#3}%
+% \def\donexttrackcommando##1%
+% {\dopaginaprefix{#1}{##1}%
+% \donexttracklevel{##1}}%
+% \donexttrackcommando\firstsection
+% \egroup}
+
+\def\dodopaginaprefix#1%
{\let\normaluchar\uchar\let\uchar\relax % ugly but needed
- \doifelsevalue{#1#2\v!nummer}{\v!ja} % \v! and no \c!
- {\@EA\beforesplitstring\@EA{\postprefix}\at:\to\preprefix
- \@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+ \doifelsevalue{\paginatype#1\v!nummer}\v!ja % \v! and no \c!
+ {\@EA\beforesplitstring\postprefix\at:\to\preprefix
+ \@EA\aftersplitstring\postprefix\at:\to\postprefix
\let\uchar\normaluchar % ugly but needed
- \doifsomething{\preprefix}
- {\doifnot{\preprefix}{0}{\preprefix\@@nmnummerscheider}}}%
- {\@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+ \ifx\preprefix\empty \else
+ \ifx\preprefix\zerocountervalue\else
+ \preprefix\@@nmnummerscheider
+ \fi
+ \fi}
+ {\@EA\aftersplitstring\postprefix\at:\to\postprefix
\let\uchar\normaluchar}} % ugly but needed
+\def\dopaginaprefix#1%
+ {\dodopaginaprefix{#1}%
+ \donexttracklevel{#1}}
+
\def\paginaprefix#1[#2::#3::#4]% kan wat sneller ####1:0:
{\bgroup
+ \edef\paginatype{#1}%
\edef\postprefix{#3}%
- \def\donexttrackcommando##1%
- {\dopaginaprefix{#1}{##1}%
- \donexttracklevel{##1}}%
+ \let\donexttrackcommando\dopaginaprefix
\donexttrackcommando\firstsection
\egroup}
+%D It was Marco Kuhlmann who uncovered the missing strut. This
+%D was a pretty old bug kind of covered up by the fact that non
+%D oldstyle numbers are about as high as strutheight. Rather
+%D interesting that it went unnoticed for so long.
+
\unexpanded\def\@@plaatspaginanummer% called in empty tests
- %{\doif{\@@pnstatus}{\v!start}
{\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
- {{\@@nmcommando{\doattributes\??nm\c!letter\c!kleur{\volledigepaginanummer}}}}}
+ {{\doif{\@@nmstrut}{\v!ja}{\strut}%
+ \@@nmcommando{\doattributes\??nm\c!letter\c!kleur
+ {\volledigepaginanummer}}}}}
\def\@@plaatspaginascheider% still used ?
- %{\doif{\@@pnstatus}{\v!start}%
{\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
{\@@nmtekstscheider}}
diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex
index e2fd95d14..9bf96232b 100644
--- a/tex/context/base/page-one.tex
+++ b/tex/context/base/page-one.tex
@@ -25,17 +25,17 @@
\newtoks\OTRONEoutput
\def\OTRONEsethsize%
- {\global\hsize=\tekstbreedte}
+ {\global\hsize\tekstbreedte}
\def\OTRONEsetvsize%
{\ifdim\vsize=\teksthoogte \else
\bgroup
- \scratchdimen=-\vsize
- \advance\scratchdimen by \teksthoogte
- \global\advance\vsize by \scratchdimen
+ \scratchdimen-\vsize
+ \advance\scratchdimen \teksthoogte
+ \global\advance\vsize \scratchdimen
\ifdim\pagegoal<\maxdimen
- \advance\scratchdimen by \pagegoal
- \global\pagegoal=\scratchdimen
+ \advance\scratchdimen \pagegoal
+ \global\pagegoal\scratchdimen
\fi
\egroup
\fi}
@@ -64,30 +64,30 @@
\kern\maxdepth
\dobotinsertions
\fi\fi\fi
- \ifdim\ht\footins>\!!zeropoint % beter dan \ifvoid\footins\else
+ \ifdim\ht\footins>\zeropoint % beter dan \ifvoid\footins\else
\kern\skip\footins
\kern\ht\footins
\fi}%
\ifbottomnotes
\ifgridsnapping
\getnoflines\teksthoogte
- \advance\noflines by -1
- \scratchdimen=\noflines\lineheight
- \advance\scratchdimen by \topskip
+ \advance\noflines -1
+ \scratchdimen\noflines\lineheight
+ \advance\scratchdimen \topskip
\else
- \scratchdimen=\ht0
+ \scratchdimen\ht0
\fi
\else
- \scratchdimen=\!!zeropoint
+ \scratchdimen\zeropoint
\fi
\setbox2=\hbox
{\ifvoid\savedfootins \else
- \setbox\footins=\box\savedfootins
+ \setbox\footins\box\savedfootins
\fi
\lower\scratchdimen\vbox{\placefootnotes}}%
\smashbox2% % needed here
\ifbottomnotes
- \ht0=\!!zeropoint
+ \ht0\zeropoint
\fi
\vbox to \teksthoogte
{\box0\box2\ifbottomnotes\else\vfill\fi}%
@@ -109,15 +109,15 @@
\def\OTRONEdosettopinserts%
{\bgroup
\ifsomefloatwaiting
- \noffloatinserts=0
- \let\totaltopinserted=\!!zeropoint
+ \noffloatinserts0
+ \let\totaltopinserted\!!zeropoint
\OTRONEdodosettopinserts
\ifnum\@@bknonder=0
\ifnum\@@bknregels>0
- \ifdim\totaltopinserted>\!!zeropoint\relax
+ \ifdim\totaltopinserted>\zeropoint\relax
\dimen0=\lineheight
\dimen0=\@@bknregels\dimen0
- \advance\dimen0 by \totaltopinserted\relax
+ \advance\dimen0 \totaltopinserted\relax
\ifdim\dimen0>\teksthoogte
\showmessage{\m!floatblocks}{8}{\@@bknregels}%
\vfilll\eject
@@ -136,15 +136,16 @@
\else
\topofinsertfalse
\fi
- \global\advance\topinserted by \ht\floatbox
- \global\advance\topinserted by \dp\floatbox
- \global\advance\topinserted by \floatbottomskip\relax
+ \global\advance\topinserted \ht\floatbox
+ \global\advance\topinserted \dp\floatbox
+ \global\advance\topinserted \floatbottomskip\relax
\ifdim\topinserted<\teksthoogte\relax
\xdef\totaltopinserted{\the\topinserted}%
\insert\topins
{\forgetall
\iftopofinsert
- \kern-\lineskip\par\prevdepth=\maxdimen
+ \kern-\lineskip\par
+ \prevdepth\maxdimen
\else
%\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back
\betweenfloatblanko
@@ -152,27 +153,27 @@
\flushfloatbox
\blanko[\@@bknawit]}%
\ifsomefloatwaiting
- \advance\noffloatinserts by 1
+ \advance\noffloatinserts 1
\else
- \noffloatinserts=\noftopfloats\relax
+ \noffloatinserts\noftopfloats\relax
\fi
\dofloatflushedinfo
\else
\doresavefloat
- \noffloatinserts=\noftopfloats\relax
+ \noffloatinserts\noftopfloats\relax
\fi
\else
\ifsomefloatwaiting
- \showmessage{\m!floatblocks}{6}{\the\noftopfloats}%
+ \showmessage\m!floatblocks6{\the\noftopfloats}%
\fi
- \let\OTRONEdodosettopinserts=\relax
+ \let\OTRONEdodosettopinserts\relax
\fi
\OTRONEdodosettopinserts}
\def\OTRONEdosetbotinserts%
{\bgroup
\ifsomefloatwaiting
- \noffloatinserts=0
+ \noffloatinserts0
\OTRONEdodosetbotinserts
\fi
\egroup}
@@ -180,40 +181,40 @@
\def\OTRONEdodosetbotinserts%
{\ifnum\noffloatinserts<\nofbotfloats\relax
\dogetfloat
- \global\advance\botinserted by \ht\floatbox\relax
- \global\advance\botinserted by \dp\floatbox\relax
- \global\advance\botinserted by \floattopskip\relax
+ \global\advance\botinserted \ht\floatbox\relax
+ \global\advance\botinserted \dp\floatbox\relax
+ \global\advance\botinserted \floattopskip\relax
\ifdim\botinserted<\pagegoal\relax
\insert\botins
{\forgetall
\blanko[\@@bkvoorwit]%
\flushfloatbox}%
\ifsomefloatwaiting
- \advance\noffloatinserts by 1
+ \advance\noffloatinserts 1
\else
- \noffloatinserts=\nofbotfloats
+ \noffloatinserts\nofbotfloats
\fi
\dofloatflushedinfo
\else
\doresavefloat
- \noffloatinserts=\nofbotfloats\relax
+ \noffloatinserts\nofbotfloats\relax
\fi
\global\nofloatpermittedtrue % vgl topfloats s!
\else
\ifsomefloatwaiting
- \showmessage{\m!floatblocks}{7}{\the\nofbotfloats}%
+ \showmessage\m!floatblocks7{\the\nofbotfloats}%
\fi
- \let\OTRONEdodosetbotinserts=\relax
+ \let\OTRONEdodosetbotinserts\relax
\fi
\OTRONEdodosetbotinserts}
\def\OTRONEdosetbothinserts%
{\ifflushingfloats
- \global\topinserted=\zeropoint
- \global\botinserted=\zeropoint
+ \global\topinserted\zeropoint
+ \global\botinserted\zeropoint
\else
- \global\topinserted=\zeropoint \OTRONEdosettopinserts
- \global\botinserted=\zeropoint \OTRONEdosetbotinserts
+ \global\topinserted\zeropoint \OTRONEdosettopinserts
+ \global\botinserted\zeropoint \OTRONEdosetbotinserts
\fi}
\def\OTRONEdotopinsertions%
@@ -225,7 +226,7 @@
\unvbox\topins
\fi
\fi
- \global\topinserted=\!!zeropoint\relax}
+ \global\topinserted\zeropoint}
\def\OTRONEdobotinsertions%
{\ifvoid\botins\else
@@ -235,7 +236,7 @@
\unvbox\botins
\fi
\fi
- \global\botinserted=\!!zeropoint\relax
+ \global\botinserted\zeropoint
\global\nofloatpermittedfalse}
\def\OTRONEdoflushfloats%
@@ -245,13 +246,13 @@
\ifvmode\prevdepth=\maxdimen\fi % prevents whitespace
\OTRONEdodoflushfloats
\fi
- \global\savednoffloats=0
+ \global\savednoffloats0
\global\somefloatwaitingfalse
\global\flushingfloatsfalse}
\def\OTRONEflushfloatbox% nog verder doorvoeren en meer info in marge
{\ifcenterfloatbox \ifdim\wd\floatbox<\hsize
- \setbox\floatbox=\hbox to \hsize{\hss\box\floatbox\hss}%
+ \setbox\floatbox\hbox to \hsize{\hss\box\floatbox\hss}%
\fi \fi
\snaptogrid\hbox{\iftestfloatbox\ruledhbox\fi{\copy\floatbox}}}
@@ -271,23 +272,23 @@
\centerfloatboxfalse
\dogetfloat
\ifdim\wd\floatbox>\zetbreedte
- \global\setbox\floatbox=\hbox to \zetbreedte{\hss\box\floatbox\hss}%
+ \global\setbox\floatbox\hbox to \zetbreedte{\hss\box\floatbox\hss}%
\fi
\OTRONEsetvsize
- \!!widtha=\wd\floatbox
+ \!!widtha\wd\floatbox
\dofloatflushedinfo
\doloop
{\ifsomefloatwaiting
\dosavefloatstatus
\dogetfloat
- \advance\!!widtha by 1em % variable
- \advance\!!widtha by \wd\floatbox\relax
+ \advance\!!widtha 1em % variable
+ \advance\!!widtha \wd\floatbox\relax
\ifdim\!!widtha>\hsize
\dorestorefloatstatus
\global\somefloatwaitingtrue
\exitloop
\else
- \global\setbox\floatbox=\hbox
+ \global\setbox\floatbox\hbox
{\ifcase\columndirection % nog document wide
\ifvoid\savedfloatbox\else
\ifhbox\savedfloatbox\unhbox\else\box\fi\savedfloatbox\hfil
@@ -322,10 +323,10 @@
\global\roomforfloatfalse
\else
\dimen0=\pagetotal
- \advance\dimen0 by \ht\floatbox
- \advance\dimen0 by \dp\floatbox
- \advance\dimen0 by \floattopskip
- \advance\dimen0 by -\pageshrink % toegevoegd
+ \advance\dimen0 \ht\floatbox
+ \advance\dimen0 \dp\floatbox
+ \advance\dimen0 \floattopskip
+ \advance\dimen0 -\pageshrink % toegevoegd
%\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait
\ifdim\dimen0>\pagegoal
\global\roomforfloatfalse
@@ -338,21 +339,21 @@
{\baselinecorrection
\doplacefloatbox
\doinsertfloatinfo
- \doif{\@@bkspringvolgendein}{\v!nee}{\noindentation}} % new
+ \doif\@@bkspringvolgendein\v!nee\noindentation} % new
-\def\OTRONEsomefixdfloat[#1]%
+\def\OTRONEsomefixdfloat% [#1]%
{\docheckiffloatfits
\ifroomforfloat\else
\goodbreak
\fi
- \showmessage{\m!floatblocks}{9}{}%
- \someherefloat}
+ \showmessage\m!floatblocks9\empty
+ \someherefloat} % [#1]}%
\def\OTRONEsomesidefloat[#1]% links, rechts NOG TESTEN EN AANPASSEN
{\ifbinnenkolommen
\someelsefloat[\v!hier]%
\else
- \checkwaitingfloats{#1}%
+ %\checkwaitingfloats{#1}%
\def\logsidefloat%
{\doinsertfloatinfo}%
\setbox\floatbox=\vbox{\box\floatbox}%
@@ -369,14 +370,16 @@
{\flushsidefloatsafterpar}%
\fi}
-\def\OTRONEsomepagefloat[#1]% links, rechts, midden, hoog, midden, laag
- {\checkwaitingfloats{#1}%
- \vbox to \teksthoogte
- {\doifnotinset{\v!hoog}{#1}{\vfill}%
- \box\floatbox
- \doifnotinset{\v!laag}{#1}{\vfill}}%
- \doinsertfloatinfo
- \pagina} % toegevoegd
+\def\OTRONEsomepagefloat[#1]%
+ {%\checkwaitingfloats{#1}%
+ \global\setbox\collectedpagefloats=\vbox
+ {\unvbox\collectedpagefloats
+ \vbox to \teksthoogte
+ {\doifnotinset{\v!hoog}{#1}{\vfill}
+ \box\floatbox
+ \doifnotinset{\v!laag}{#1}{\vfill}}
+ \goodbreak}%
+ \doinsertfloatinfo}
\def\OTRONEsometopsfloat[#1]%
{\ifdim\topinserted=\!!zeropoint\relax
diff --git a/tex/context/base/page-run.tex b/tex/context/base/page-run.tex
index 4301f460c..469900b9f 100644
--- a/tex/context/base/page-run.tex
+++ b/tex/context/base/page-run.tex
@@ -133,6 +133,52 @@
\fi
+% \startinterface english % english is fallback
+
+\gdef\showsetups%
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{paperheight} \paperheight
+ \showsetupA{paperwidth} \paperwidth
+ \showsetupA{printpaperheight} \printpaperheight
+ \showsetupA{printpaperwidth} \printpaperwidth
+ \showsetupA{topspace} \topspace
+ \showsetupA{backspace} \backspace
+ \showsetupA{height} \makeupheight
+ \showsetupA{width} \makeupwidth
+ \showsetupA{top} \topheight
+ \showsetupC{topdistance} \topdistance
+ \showsetupA{header} \headerheight
+ \showsetupC{headerdistance} \headerdistance
+ \showsetupA{textheight} \textheight
+ \showsetupC{footerdistance} \footerdistance
+ \showsetupA{footer} \footerheight
+ \showsetupC{bottomdistance} \bottomdistance
+ \showsetupA{bottom} \bottomheight
+ \showsetupA{leftedge} \leftedgewidth
+ \showsetupC{leftedgedistance} \leftedgedistance
+ \showsetupA{leftmargin} \leftmarginwidth
+ \showsetupC{leftmargindistance} \leftmargindistance
+ \showsetupA{textwidth} \textwidth
+ \showsetupC{rightmargindistance}\rightmargindistance
+ \showsetupA{rightmargin} \rightmarginwidth
+ \showsetupC{rightedgedistance} \rightedgedistance
+ \showsetupA{rightedge} \rightedgewidth
+ \showsetupB{bodyfontsize} \the \globalbodyfontsize
+ \showsetupB{line} \relax \normallineheight
+ \showsetupB{height} \relax \strutheightfactor
+ \showsetupB{depth} \relax \strutdepthfactor
+ \showsetupB{topskip} \relax \topskipfactor
+ \showsetupB{maxdepth} \relax \maxdepthfactor}}}
+
+% \stopinterface
+
\startinterface dutch
\gdef\showsetups%
@@ -317,52 +363,6 @@
\stopinterface
-\ifx\showsetups\undefined
-
- \gdef\showsetups% english is fallback
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \showsetupA{paperheight} \paperheight
- \showsetupA{paperwidth} \paperwidth
- \showsetupA{printpaperheight} \printpaperheight
- \showsetupA{printpaperwidth} \printpaperwidth
- \showsetupA{topspace} \topspace
- \showsetupA{backspace} \backspace
- \showsetupA{height} \makeupheight
- \showsetupA{width} \makeupwidth
- \showsetupA{top} \topheight
- \showsetupC{topdistance} \topdistance
- \showsetupA{header} \headerheight
- \showsetupC{headerdistance} \headerdistance
- \showsetupA{textheight} \textheight
- \showsetupC{footerdistance} \footerdistance
- \showsetupA{footer} \footerheight
- \showsetupC{bottomdistance} \bottomdistance
- \showsetupA{bottom} \bottomheight
- \showsetupA{leftedge} \leftedgewidth
- \showsetupC{leftedgedistance} \leftedgedistance
- \showsetupA{leftmargin} \leftmarginwidth
- \showsetupC{leftmargindistance} \leftmargindistance
- \showsetupA{textwidth} \textwidth
- \showsetupC{rightmargindistance}\rightmargindistance
- \showsetupA{rightmargin} \rightmarginwidth
- \showsetupC{rightedgedistance} \rightedgedistance
- \showsetupA{rightedge} \rightedgewidth
- \showsetupB{bodyfontsize} \the \globalbodyfontsize
- \showsetupB{line} \relax \normallineheight
- \showsetupB{height} \relax \strutheightfactor
- \showsetupB{depth} \relax \strutdepthfactor
- \showsetupB{topskip} \relax \topskipfactor
- \showsetupB{maxdepth} \relax \maxdepthfactor}}}
-
-\fi
-
\gdef\showlayout% interfereert lelijk met een \typefile er na
{\bgroup
\pagina
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index a0509bba0..1b7bee5f8 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -192,7 +192,7 @@
\else
\OTRSETdoifcellelse{#1}\columnfirstcell
{\global\advance\columnfirstcell 1 }
- {\exitloop}
+ {\exitloop}%
\fi}%
\global\columnlastcell=\columnfirstcell
\doloop
@@ -201,7 +201,7 @@
\else
\OTRSETdoifcellelse{#1}\columnlastcell
{\global\advance\columnlastcell -1 \exitloop}
- {\global\advance\columnlastcell 1 }
+ {\global\advance\columnlastcell 1 }%
\fi}%
\ifnum\columnfirstcell>\columnmaxcells
\global\columnfreecells=0
@@ -245,8 +245,64 @@
\OTRSETdomakegridbox{\nofcolumns}{1}{-1}%
\fi}
+%\def\OTRSETdomakegridbox#1#2#3%
+% {\hbox\bgroup
+% % test first !
+% \hbox to \zetbreedte
+% {\dostepwiserecurse{#1}{#2}{#3}
+% {\mofcolumns=\recurselevel
+% \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+% \setbox\scratchbox=\hbox\localframed
+% [\??mc\OTRSETidentifier\number\mofcolumns]%
+% [\c!breedte=\localcolumnwidth,\c!hoogte=\teksthoogte]%
+% {}%
+% \ifcase\columndirection
+% \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
+% \else
+% \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
+% \fi}}%
+% \hskip-\zetbreedte
+% % main text
+% \hbox to \zetbreedte
+% {\dostepwiserecurse{#1}{#2}{#3}
+% {\mofcolumns=\recurselevel
+% \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+% \offinterlineskip
+% \setbox\scratchbox=\vbox to \teksthoogte
+% {\topskipcorrection
+% \dorecurse{\columnmaxcells}
+% {\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
+% \ht\scratchbox=\ht\strutbox
+% \dp\scratchbox=\dp\strutbox
+% \ifcase\columndirection
+% \box\scratchbox
+% \else
+% \hbox to \localcolumnwidth
+% {\hskip\localcolumnwidth\llap{\box\scratchbox}}
+% \fi
+% \par}}%
+% \wd\scratchbox=\localcolumnwidth % \tekstbreedte
+% \ifcase\columndirection
+% \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
+% \else
+% \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
+% \fi}}%
+% \egroup}
+
\def\OTRSETdomakegridbox#1#2#3%
{\hbox\bgroup
+%
+\ifbalancecolumns
+ \ifnum\realpageno=\balancingpageno\relax
+ \!!heighta \localcolumnmaxcells\lineheight
+\xdef\localcolumnmaxcells{0}%
+ \else
+ \!!heighta \teksthoogte
+ \fi
+\else
+ \!!heighta \teksthoogte
+\fi
+%
% test first !
\hbox to \zetbreedte
{\dostepwiserecurse{#1}{#2}{#3}
@@ -254,7 +310,7 @@
\localcolumnwidth=\OTRSETlocalwidth\mofcolumns
\setbox\scratchbox=\hbox\localframed
[\??mc\OTRSETidentifier\number\mofcolumns]%
- [\c!breedte=\localcolumnwidth,\c!hoogte=\teksthoogte]%
+ [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta]% \teksthoogte]%
{}%
\ifcase\columndirection
\hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
@@ -268,7 +324,7 @@
{\mofcolumns=\recurselevel
\localcolumnwidth=\OTRSETlocalwidth\mofcolumns
\offinterlineskip
- \setbox\scratchbox=\vbox to \teksthoogte
+ \setbox\scratchbox=\vbox to \!!heighta % \teksthoogte
{\topskipcorrection
\dorecurse{\columnmaxcells}
{\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
@@ -278,7 +334,7 @@
\box\scratchbox
\else
\hbox to \localcolumnwidth
- {\hskip\localcolumnwidth\llap{\box\scratchbox}}
+ {\hskip\localcolumnwidth\llap{\box\scratchbox}}%
\fi
\par}}%
\wd\scratchbox=\localcolumnwidth % \tekstbreedte
@@ -289,6 +345,11 @@
\fi}}%
\egroup}
+\def\OTRSETreducegridbox%
+ {\ifnum\localcolumnmaxcells>0
+ \let\columnmaxcells\localcolumnmaxcells
+ \fi}
+
\def\OTRSETflushfinalfootnotes
{\ifcase\lastcolumnlastcell \else
\setbox\scratchbox=\hbox
@@ -304,24 +365,52 @@
\global\lastcolumnlastcell=0
\fi}
+%\def\OTRSETdoflush
+% {\ifcollectingcontent
+% \global\mofcolumns=1
+% \else
+% \OTRSETdofinalflush
+% \OTRSETinitializecolumns
+% \OTRSETmanualbalance % or after \gotonextpage
+% %\OTRSETdoflushfloats
+% \OTRSETgotonextpage
+% \fi}
+
\def\OTRSETdoflush
{\ifcollectingcontent
\global\mofcolumns=1
\else
- \OTRSETdofinalflush
+ \OTRSETdofinalflush
+ \OTRSETdofinaloutput
\OTRSETinitializecolumns
\OTRSETmanualbalance % or after \gotonextpage
%\OTRSETdoflushfloats
\OTRSETgotonextpage
+\initializecolumntextareas
\fi}
+%\def\OTRSETdofinalflush % see \OTRSETdoflush
+% {\OTRSETflushfinalfootnotes
+% \placecolumntextareas
+% \OTRSETcentergridcells
+% \setbox\scratchbox=\OTRSETmakegridbox
+% \global\mofcolumns=\nofcolumns % otherwise problems in finaloutput
+% \finaloutput\box\scratchbox}
+
+\newbox\OTRfinalpagebox
+
\def\OTRSETdofinalflush % see \OTRSETdoflush
{\OTRSETflushfinalfootnotes
\placecolumntextareas
\OTRSETcentergridcells
- \setbox\scratchbox=\OTRSETmakegridbox
- \global\mofcolumns=\nofcolumns % otherwise problems in finaloutput
- \finaloutput\box\scratchbox}
+ \OTRSETreducegridbox
+ \global\setbox\OTRfinalpagebox=\OTRSETmakegridbox
+ \global\mofcolumns=\nofcolumns} % otherwise problems in finaloutput
+
+\def\OTRSETdofinaloutput
+ {\ifdim\ht\OTRfinalpagebox=\teksthoogte
+ \finaloutput\box\OTRfinalpagebox
+ \fi}
\let\OTRSETbalancinglist\empty
@@ -361,7 +450,7 @@
\allowbreak % hm
\fi
\ifdim\ht\footins>\zeropoint % updates vsize
- \insert\footins{\unvbox\footins}
+ \insert\footins{\unvbox\footins}%
\fi
\fi}
@@ -385,8 +474,8 @@
\def\OTRSETnextcolumn%
{\ifhmode
\bgroup
- \unskip\unskip\unskip
- \parfillskip\!!zeropoint
+ \removeunwantedspaces
+ \parfillskip\zeropoint
\OTRSETcolumnseparator
\par
\egroup
@@ -444,11 +533,11 @@
\vskip\lineheight
\prevdepth\dp\strutbox
\unvbox\normalpagebox
- \vfill}
+ \vfill}%
\setbox2=\hbox
- {\OTRSETplacefootnotes}
+ {\OTRSETplacefootnotes}%
\setbox\scratchbox=\hbox
- {\wd0=\!!zeropoint\box0\box2}
+ {\wd0=\zeropoint\box0\box2}%
\dp\scratchbox=\dp\strutbox
\OTRSEThandleflushedtext1}
@@ -579,9 +668,6 @@
\OTRSETsavebox{#1}%
\fi}
-\def\OTRSETstoreincolumnslotHERE%
- {\OTRSETflushtextsofar\OTRSETstoreincolumnslotTOPS}
-
\def\OTRSETstoreincolumnslotTOPS#1%
{\OTRSETcheckcolumnslot{#1}%
\ifenoughcolumncells
@@ -589,7 +675,7 @@
\fi
\ifenoughcolumncells
\OTRSETsetgridcells\mofcolumns\columnfirstcell\columnhcells\columnvcells
- {\hbox{\copy#1}}
+ {\hbox{\copy#1}}%
\OTRSETsetvsize
\else
\OTRSETsavebox{#1}%
@@ -620,7 +706,7 @@
\def\OTRSETcheckcolumnspace#1#2#3% col row box
{\columnhcells=1
- \totalcolumnspace=\!!zeropoint
+ \totalcolumnspace=\zeropoint
\scratchcounter=#1%
\enoughcolumncellstrue
\doloop
@@ -655,9 +741,9 @@
%\scratchcounter=#2\advance\scratchcounter-1\relax
%\ifnum\scratchcounter>0
% \dostepwiserecurse{#1}{\!!countd}{1}
-% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
% \def\columnspacetopoffset{1}%
-% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
% \def\columnspacetopoffset{1}%
% \fi\fi}%
% \advance\!!counte \columnspacetopoffset \relax
@@ -668,9 +754,9 @@
%\advance\scratchcounter \columnvcells \relax
%\ifnum\scratchcounter>\columnmaxcells\else
% \dostepwiserecurse{#1}{\!!countd}{1}
-% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
% \def\columnspacebotoffset{1}%
-% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
% \def\columnspacebotoffset{1}%
% \fi\fi}%
% \advance\!!counte \columnspacebotoffset \relax
@@ -687,24 +773,17 @@
\fi}%
\fi}
-\def\OTRSETsetpreferedcolumnslot#1%
- {\doifsomething{#1}{\edef\preferedcolumn{#1}}}
+\def\OTRSETsetpreferedcolumnslot#1#2%
+ {\doifsomething{#1}{\edef\preferedcolumn{#1}}%
+ \doifsomething{#2}{\edef\preferedrow {#2}}}
-\OTRSETsetpreferedcolumnslot{\nofcolumns} % default ?
+\OTRSETsetpreferedcolumnslot{\nofcolumns}{1} % default ?
\let\pofcolumns\mofcolumns
\let\qofcolumns\mofcolumns
\newif\ifquitincurrentcolumn
-\def\OTRSETstoreincolumnslotFXTB% fixed column
- {\OTRSETstoreincolumnslotindeed
- \pofcolumns\pofcolumns+\currenthcell1\columnmaxcells+\currentvcell}
-
-\def\OTRSETstoreincolumnslotFXBT% fixed column
- {\OTRSETstoreincolumnslotindeed
- \pofcolumns\pofcolumns+\currenthcell\columnmaxcells1-\currentvcell}
-
\def\OTRSETstoreincolumnslotLRTB%
{\OTRSETstoreincolumnslotindeed
\mofcolumns\nofcolumns+\currenthcell1\columnmaxcells+\currentvcell}
@@ -737,6 +816,42 @@
{\OTRSETstoreincolumnslotindeed
\columnmaxcells1-\currentvcell\nofcolumns\qofcolumns-\currenthcell}
+\def\OTRSETstoreincolumnslotFXTB% fixed column
+ {\OTRSETstoreincolumnslotindeed
+ \pofcolumns\pofcolumns
+ +\currenthcell\preferedrow
+ \columnmaxcells+\currentvcell}
+
+\def\OTRSETstoreincolumnslotFXBT% fixed column
+ {\OTRSETstoreincolumnslotindeed
+ \pofcolumns\pofcolumns
+ +\currenthcell\columnmaxcells
+ \preferedrow-\currentvcell}
+
+%\def\OTRSETstoreincolumnslotHERE% fixed column
+% {\OTRSETflushtextsofar
+% \ifdim\pagetotal>\zeropoint
+% \@EA\OTRSETstoreincolumnslotEREH
+% \else
+% \@EA\OTRSETstoreincolumnslotTOPS
+% \fi}
+%
+%\def\OTRSETstoreincolumnslotEREH% fixed column
+% {\getnoflines\pagetotal
+% \OTRSETstoreincolumnslotindeed
+% \mofcolumns\mofcolumns
+% +\currenthcell\noflines
+% \columnmaxcells+\currentvcell}
+
+\def\OTRSETstoreincolumnslotHERE#1% fixed column
+ {\OTRSETflushtextsofar
+ \getnoflines\pagetotal \advance\noflines\columnfirstcell
+ \OTRSETstoreincolumnslotindeed
+ \mofcolumns\mofcolumns
+ +\currenthcell\noflines
+ \columnmaxcells+\currentvcell{#1}%
+ \OTRSETsetvsize}
+
\def\OTRSETstoreincolumnslotindeed#1#2#3#4#5#6#7#8#9%
{\OTRSETflushtextsofar
\ifnum\preferedcolumn<\mofcolumns
@@ -820,12 +935,12 @@
\def\columnslotspacing{2}
\def\OTRSETstoreincolumnslot#1#2% {method} {box} % alleen last
- {\dp#2=\!!zeropoint
+ {\dp#2=\zeropoint
\ifcase\columnslotspacing\else
\setbox#2=\vbox spread \columnslotspacing\lineheight
- {\vss\box#2\vss}
+ {\vss\box#2\vss}%
\fi
-%\dp#2=\!!zeropoint
+%\dp#2=\zeropoint
\doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1}
{\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}}
{\copy#2}}
@@ -834,10 +949,14 @@
% {\setbox\floatbox=\box#1\dosavefloat}
\def\OTRSETsavebox#1% clean up the skips
- {\setbox\scratchbox=\vbox
- {\unvbox#1\unskip\unskip\unskip
- \global\setbox\floatbox\lastbox
- }%\unskip\unskip\unskip\box\floatbox}%
+ {\ifhbox#1% spans and so
+ \global\setbox\floatbox=\vbox{\box#1}%
+ \else
+ \setbox\scratchbox=\vbox
+ {\unvbox#1\unskip\unskip\unskip
+ \global\setbox\floatbox\lastbox
+ }%\unskip\unskip\unskip\box\floatbox}%
+ \fi
\dosavefloat}
\def\OTRSETflushfloatbox% nog verder doorvoeren en meer info in marge
@@ -851,7 +970,7 @@
\dogetfloat
\ifdim\wd\floatbox>\zeropoint
\!!doneatrue
- \dp\floatbox=\!!zeropoint
+ \dp\floatbox=\zeropoint
\OTRSETstoreincolumnslot{TBLR}\floatbox
\if!!donea
%\message{[flu]}%
@@ -919,8 +1038,8 @@
\def\OTRSETinitializecolumns% once per page
{\columnspreadtrue % todo
\ifcolumnspread
- \global\rofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nrechts}
- \global\lofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nlinks}
+ \global\rofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nrechts}%
+ \global\lofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nlinks}%
\global\tofcolumns=\rofcolumns \relax
\ifodd\realpageno\relax
\global\nofcolumns=\rofcolumns
@@ -929,7 +1048,7 @@
\global\nofcolumns=\lofcolumns
\fi
\else
- \global\nofcolumns=\getvalue{\??mc\OTRSETidentifier\c!n}
+ \global\nofcolumns=\getvalue{\??mc\OTRSETidentifier\c!n}%
\global\rofcolumns=\nofcolumns
\global\lofcolumns=\nofcolumns
\global\tofcolumns=\nofcolumns
@@ -1024,22 +1143,45 @@
\binnenkolommentrue % will be different flag
%\let\redofloatorder\gobbleoneargument % will also be a flag
\let\kolom\OTRSETgotocolumn%
- \activateotr{SET}{ONE} % andere naam, activate or so
- \xdef\OTRSETlist{#1}
+ \activateotr{SET}{ONE}% andere naam, activate or so
+ \xdef\OTRSETlist{#1}%
\OTRSETgotonextpage
\OTRSETassignwidths
\else
\bgroup
\fi}
+%\def\stopcolumnset%
+% {\ifnum\columnsetlevel=1
+% \par
+% \OTRSETsetmanualbalance
+% \dostopcolumnset
+% \egroup
+% \global\footnotelimittrue
+% \dimen\footins\savedfootnotedimen % ugly
+% \ifsomefloatwaiting \setvsize \pagina \setvsize \fi
+% \else
+% \egroup
+% \fi
+% \decrement\columnsetlevel\relax}
+
\def\stopcolumnset%
- {\ifnum\columnsetlevel=1
+ {\relax
+ \ifnum\columnsetlevel=1
\par
\OTRSETsetmanualbalance
\dostopcolumnset
\egroup
\global\footnotelimittrue
\dimen\footins\savedfootnotedimen % ugly
+\setvsize
+\sethsize
+\ifvoid\OTRfinalpagebox\else
+ \dp\OTRfinalpagebox\zeropoint
+ \box\OTRfinalpagebox
+ \nobreak\vbox{\strut}\vskip-\lineheight
+\prevdepth\dp\strutbox
+\fi
\ifsomefloatwaiting \setvsize \pagina \setvsize \fi
\else
\egroup
@@ -1057,13 +1199,33 @@
\def\OTRSETdobalance
{\OTRSETnobalance}
+%\def\OTRSETmanualbalance
+% {\ifbalancecolumns
+% \ifnum\realpageno=\balancingpageno\relax
+% \ifnum\mofcolumns=1
+% \dorecurse\nofcolumns
+% {\!!counta=\recurselevel
+% \!!countb=\balancingcolumnmaxcells\!!counta
+% \advance\!!countb 1
+% \dostepwiserecurse\!!countb\columnmaxcells1
+% {\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}%
+% \fi
+% \fi
+% \fi}
+
+\def\localcolumnmaxcells{0}
+
\def\OTRSETmanualbalance
{\ifbalancecolumns
+ \let\savedcolumnmaxcells\columnmaxcells
\ifnum\realpageno=\balancingpageno\relax
\ifnum\mofcolumns=1
\dorecurse\nofcolumns
{\!!counta=\recurselevel
- \!!countb=\balancingcolumnmaxcells\!!counta
+ \!!countb=\balancingcolumnmaxcells\!!counta\relax
+ \ifnum\!!countb>\localcolumnmaxcells
+ \xdef\localcolumnmaxcells{\the\!!countb}%
+ \fi
\advance\!!countb 1
\dostepwiserecurse\!!countb\columnmaxcells1
{\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}%
@@ -1092,6 +1254,16 @@
\fi
\global\balancingcolumnsfalse}
+%\def\OTRSETnobalance
+% {\iflastcolumnfootnotes % testen ! optie
+% % inhibit flush of floats !
+% \dostepwiserecurse{\mofcolumns}{\nofcolumns}{1}
+% {\vskip-\lineheight\vbox{\strut}\vfill\eject}%
+% \else
+% \ifdim\pagetotal>\zeropoint
+% \vfill \eject \OTRSETdofinalflush
+% \fi
+% \fi}
\def\OTRSETnobalance
{\iflastcolumnfootnotes % testen ! optie
@@ -1100,7 +1272,14 @@
{\vskip-\lineheight\vbox{\strut}\vfill\eject}%
\else
\ifdim\pagetotal>\zeropoint
- \vfill \eject \OTRSETdofinalflush
+\ifnum\mofcolumns=\nofcolumns
+ \OTRSETflushfinalfootnotes
+ \vfill \eject
+\else
+ \vfill \eject
+ \OTRSETdofinalflush
+ \OTRSETdofinaloutput
+\fi
\fi
\fi}
@@ -1125,7 +1304,6 @@
\initializecolumntextareas % name !
\OTRSETsetvsize}
-
\OTRSEToutput
{\OTRSETnaturalflush
% \OTRSETgotonextpage
@@ -1134,11 +1312,11 @@
\def\OTRSETinitializefeatures%
{% number of lines
- \getnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}
+ \getnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}%
% direction
\doifelsevalue{\??mc\OTRSETidentifier\c!richting}{\v!rechts}
{\chardef\columndirection=0}
- {\chardef\columndirection=1}
+ {\chardef\columndirection=1}%
% balancing
\doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}{\v!ja}
{\balancecolumnstrue}
@@ -1151,12 +1329,12 @@
\fi}
\def\OTRSEThandlepreposttext%
- {\getnoflines{\ht\precolumnbox}
+ {\getnoflines{\ht\precolumnbox}%
\doOTRSETsetgridcells
{\copy\placeholderboxe}
11\nofcolumns\noflines
- {\box\precolumnbox}
- \getnoflines{\ht\postcolumnbox}
+ {\box\precolumnbox}%
+ \getnoflines{\ht\postcolumnbox}%
\advance\columnfreecells -\noflines
\advance\columnfreecells 1
\doOTRSETsetgridcells
@@ -1195,7 +1373,7 @@
\def\OTRSETinhibitinserts%
{\global\count\footins=0
- \global\skip\footins=\!!zeropoint}
+ \global\skip\footins=\zeropoint}
% interface to footnotes
@@ -1269,9 +1447,9 @@
\fi
\hss}%
\ifcase#1\relax
- \ht\scratchbox\!!zeropoint
- \dp\scratchbox\!!zeropoint
- \wd\scratchbox\!!zeropoint
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
+ \wd\scratchbox\zeropoint
\else
\wd\scratchbox\hsize
\ht\scratchbox\ht\strutbox
@@ -1287,10 +1465,11 @@
\global\setbox\placeholderboxe\columnplaceholder0\magenta
\global\setbox\placeholderboxf\columnplaceholder1\darkgray}
+\def\doOTRSETshowstatus
+ {\llap{\tt\tfxx\blue(\number\columnfirstcell\#\number\columnfreecells)}}
+
\def\OTRSETshowstatus
- {\iftracecolumnset
- \llap{\tt\tfxx\blue(\number\columnfirstcell\#\number\columnfreecells)}%
- \fi}
+ {\iftracecolumnset \doOTRSETshowstatus \fi}
\appendtoks \OTRSETshowstatus \to \everypar
@@ -1325,7 +1504,7 @@
% {\ifsecondargument
% \doifundefinedelse{#4box}
% {\@EA\newbox\csname#4box\endcsname}
-% {\@EA\setbox\csname#4box\endcsname=\box\voidb@x}%
+% {\setbox\csname#4box\endcsname=\box\voidb@x}%
% \setvalue{\??mc#1#2\v!tekst#3}{\OTRSETflusharea{#1}{#2}{#3}}%
% \setxvalue{#1#2#3source}{#4}%
% \setgvalue{#4setup}%
@@ -1376,109 +1555,114 @@
\doifelse{#2}{\v!beide}
{\definecolumntextarea[#1][\v!links ][#3]%
\definecolumntextarea[#1][\v!rechts][#3]}
- {\presetlocalframed
- [\??mt#1#2]%
- \processaction[#2]
- [ \v!links=>\addtocommalist{#1}\columnleftareas,
- \v!rechts=>\addtocommalist{#1}\columnrightareas]%
- \getparameters[\??mt#1#2]
- [\c!x=1,\c!y=1,\c!nx=1,\c!ny=1,
- \c!offset=\v!overlay,\c!strut=\v!nee,\c!kader=\v!uit,
- \c!status=\v!stop,#3]}%
+ {\doifelse{#2}{\v!volgende}
+ {\doifonevenpaginaelse
+ {\definecolumntextarea[#1][\v!rechts][#3]}
+ {\definecolumntextarea[#1][\v!links][#3]}}
+ {\presetlocalframed
+ [\??mt#1#2]%
+ \processaction[#2] % \doglobal voorkomt stack build up
+ [ \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!offset=\v!overlay,\c!strut=\v!nee,\c!kader=\v!uit,
+ \c!status=\v!stop,#3]}}%
\else
- \definecolumntextarea[#1][\v!beide][#2]%
+ \definecolumntextarea[#1][\v!volgende][#2]%
\fi}
\def\setupcolumntextarea%
{\dotripleempty\dosetupcolumntextarea}
-\def\dosetupcolumntextarea[#1][#2]%
- {\getparameters[\??mt#1#2]}
+\def\dosetupcolumntextarea[#1][#2][#3]%
+ {\ifthirdargument
+ \doifelse{#2}{\v!beide}
+ {\setupcolumntextarea[#1][\v!links ][#3]%
+ \setupcolumntextarea[#1][\v!rechts][#3]}
+ {\doifelse{#2}{\v!volgende}
+ {\doifonevenpaginaelse
+ {\setupcolumntextarea[#1][\v!rechts][#3]}
+ {\setupcolumntextarea[#1][\v!links][#3]}}
+ {\getparameters[\??mt#1#2][#3]}}%
+ \else
+ \setupcolumntextarea[#1][\v!volgende][#2]%
+ \fi}
+
+\def\initializecolumntextareas%
+ {\ifodd\realpageno
+ \doinitializecolumntextareas\columnrightareas\v!rechts
+ \else
+ \doinitializecolumntextareas\columnleftareas\v!links
+ \fi}
\def\doinitializecolumntextareas#1#2%
{\def\docommando##1%
- {\doifvalue{\??mt##1#2\c!status}{\v!start}
- {\doOTRSETsetgridcells
- {\copy\placeholderboxd}
- {\getvalue{\??mt##1#2\c!x }}{\getvalue{\??mt##1#2\c!y }}
- {\getvalue{\??mt##1#2\c!nx}}{\getvalue{\??mt##1#2\c!ny}}
- {\copy\placeholderboxd}}}%
+ {\doifelsevalue{\??mt##1#2\c!status}{\v!start}
+ {\dodoinitializecolumntextareas{##1}{#2}}
+ {\doifvalue{\??mt##1#2\c!status}{\v!herhaal}
+ {\dodoinitializecolumntextareas{##1}{#2}}}}%
\processcommacommand[#1]\docommando}
-\def\initializecolumntextareas%
+\def\dodoinitializecolumntextareas#1#2%
+ {\doOTRSETsetgridcells
+ {\copy\placeholderboxd}
+ {\getvalue{\??mt#1#2\c!x }}{\getvalue{\??mt#1#2\c!y }}
+ {\getvalue{\??mt#1#2\c!nx}}{\getvalue{\??mt#1#2\c!ny}}
+ {\copy\placeholderboxd}}
+
+\def\placecolumntextareas%
{\ifodd\realpageno
- \doinitializecolumntextareas\columnrightareas\v!rechts
+ \doplacecolumntextareas\columnrightareas\v!rechts
\else
- \doinitializecolumntextareas\columnleftareas\v!links
+ \doplacecolumntextareas\columnleftareas\v!links
\fi}
-\def\doplacecolumntextareas#1#2%
+\def\doplacecolumntextareas#1#2% global ?
{\bgroup
\forgetall
\def\docommando##1%
- {\doifvalue{\??mt##1#2\c!status}{\v!start}
- {\!!counta=\getvalue{\??mt##1#2\c!x}%
- \!!countb=\getvalue{\??mt##1#2\c!nx}%
- \!!widtha=\!!countb\hsize
- \!!heighta=\getvalue{\??mt##1#2\c!ny}\lineheight
- \advance\!!countb \!!counta \advance\!!countb -1 \relax
- \ifnum\!!countb>\nofcolumns
- \!!countc=\!!countb
- \advance\!!countc -\nofcolumns
- \!!countb=\nofcolumns
- \else
- \!!countc=0
- \fi
- \advance\!!counta 1
- \dostepwiserecurse{\!!counta}{\!!countb}{1}
- {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
- \!!widthc=\!!widtha
- \advance\!!widthc -\!!countc\hsize
-\!!widthb=\!!widthc
- \ifodd\realpageno \else
- \ifcase\!!countc\else
- \advance\!!widtha 2\rugwit
- \advance\!!widthc \rugwit
- \dorecurse{\!!countc}
- {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
- \fi
- \fi
-% option
-\advance\!!heighta -\lineheight
- \setbox\scratchbox=\vbox
- {\localframed
- [\??mt##1#2]
- [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]
- {\getvalue{\??mt##1#2}}}%
- \!!counta=\getvalue{\??mt##1#2\c!x}%
- \!!countb=\getvalue{\??mt##1#2\c!y}%
- \advance\!!countb \getvalue{\??mt##1#2\c!ny}%
- \advance\!!countb -1
- \OTRSETsetgridcell
- {\!!counta}{\!!countb}
- \hbox{\clip
- [\c!breedte=\!!widthc,\c!hoogte=\!!heighta]
- {\copy\scratchbox}}%
- \ifcase\!!countc\else
- \advance\!!counta \getvalue{\??mt##1#2\c!nx}%
- \advance\!!counta -\!!countc
- \advance\!!widtha -\!!widthc
- \OTRSETsetgridcell
- {\!!counta}{\!!countb}
- \hbox{\hskip-\rugwit
- \clip
- [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,
- \c!hoffset=\!!widthc]
- {\copy\scratchbox}}%
- \fi}}%
+ {\doifelsevalue{\??mt##1#2\c!status}{\v!start}
+ {\doglobal\removefromcommalist{##1}#1%
+ \dodoplacecolumntextareas{##1}{#2}}
+ {\doifvalue{\??mt##1#2\c!status}{\v!herhaal}
+ {\dodoplacecolumntextareas{##1}{#2}}}}%
\processcommacommand[#1]\docommando
\egroup}
-\def\placecolumntextareas%
- {\ifodd\realpageno
- \doplacecolumntextareas\columnrightareas\v!rechts
- \else
- \doplacecolumntextareas\columnleftareas\v!links
+\def\dodoplacecolumntextareas#1#2%
+ {\!!counta\getvalue{\??mt#1#2\c!x}%
+ \!!countb\getvalue{\??mt#1#2\c!nx}%
+ \docalculatecolumnsetspan
+ \!!heighta=\getvalue{\??mt#1#2\c!ny}\lineheight
+ % option
+ \advance\!!heighta -\lineheight
+ \setbox\scratchbox=\vbox
+ {\localframed
+ [\??mt#1#2]
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]
+ {\getvalue{\??mt#1#2}}}%
+ \!!counta=\getvalue{\??mt#1#2\c!x}%
+ \!!countb=\getvalue{\??mt#1#2\c!y}%
+ \advance\!!countb \getvalue{\??mt#1#2\c!ny}%
+ \advance\!!countb -1
+ \OTRSETsetgridcell
+ {\!!counta}{\!!countb}
+ \hbox{\clip
+ [\c!breedte=\!!widthb,\c!hoogte=\!!heighta]
+ {\copy\scratchbox}}%
+ \ifcase\!!countc\else
+ \advance\!!counta \getvalue{\??mt#1#2\c!nx}%
+ \advance\!!counta -\!!countc
+ \advance\!!widtha -\!!widthb
+ \OTRSETsetgridcell
+ {\!!counta}{\!!countb}
+ \hbox
+ {\hskip-\rugwit
+ \clip
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,
+ \c!hoffset=\!!widthb]
+ {\copy\scratchbox}}%
\fi}
\def\setupcolumntextareatext%
@@ -1487,4 +1671,89 @@
\def\dosetupcolumntextareatext[#1][#2][#3]%
{\setvalue{\??mt#1#2}{#3}}
+\def\docalculatecolumnsetspan
+ {% \!!counta <= x
+ % \!!countb <= nx
+ % \!!widtha => total width
+ % \!!widthb => left width
+ % \!!countc => left cols
+ \!!widtha=\!!countb\hsize
+ \advance\!!countb \!!counta \advance\!!countb -1 \relax
+ \ifnum\!!countb>\nofcolumns
+ \!!countc=\!!countb
+ \advance\!!countc -\nofcolumns
+ \!!countb=\nofcolumns
+ \else
+ \!!countc=0
+ \fi
+ \advance\!!counta 1
+ \dostepwiserecurse{\!!counta}{\!!countb}{1}
+ {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
+ \!!widthb=\!!widtha
+ \advance\!!widthb -\!!countc\hsize
+ \ifodd\realpageno \else
+ \ifcase\!!countc\else
+ \advance\!!widtha 2\rugwit
+ \advance\!!widthb \rugwit
+ \dorecurse{\!!countc}
+ {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
+ \fi
+ \fi}
+
+\def\columnsetspanhsize{\hsize}
+
+\def\setcolumnsetspanhsize#1#2% x nx / uses counta/b
+ {\!!counta=#1\!!countb=#2\docalculatecolumnsetspan
+ \edef\columnsetspanhsize{\the\!!widtha}}
+
+\def\definecolumnsetspan%
+ {\dodoubleempty\dodefinecolumnsetspan}
+
+\def\dodefinecolumnsetspan[#1][#2]%
+ {\ifsecondargument
+ \defineframedtext
+ [cs:#1]
+ [\c!kader=\v!uit,
+ \c!voor=,
+ \c!na=,
+ \c!offset=\v!overlay,
+ \c!plaats=,
+ \c!dieptecorrectie=\v!uit,
+ \c!n=2,
+ #2]%
+ \else
+ \definecolumnspan[][#1]%
+ \fi}
+
+\def\setupcolumnsetspan%
+ {\dodoubleempty\dosetupcolumnsetspan}
+
+\def\dosetupcolumnsetspan[#1][#2]%
+ {\ifsecondargument
+ \setupframedtext[cs:#1][#2]%
+ \else
+ \setupcolumnsetspan[][#1]%
+ \fi}
+
+\def\startcolumnsetspan%
+ {\dotripleempty\dostartcolumnsetspan}
+
+\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space
+ {\bgroup
+ \!!countc\getvalue{\??kd cs:#1\c!n} % \framedtextparameter{cs:\c!n}%
+ \!!countd\nofcolumns \advance\!!countd -\mofcolumns \advance\!!countd 1
+ \ifnum\!!countc>\!!countd \!!countc\!!countd \fi
+ \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used
+ \hsize\columnsetspanhsize
+ \setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize,#2]
+ \setbox\scratchbox\ruledhbox \bgroup
+ \dostartframedtext[cs:#1][\v!geen]
+ \vskip-\lineheight\par\strut\par}
+
+\def\stopcolumnsetspan%
+ {\par\kern-\lineheight\prevdepth\dp\strutbox\strut
+ \dostopframedtext \egroup
+ \OTRSETstoreincolumnslotHERE\scratchbox
+ \egroup}
+
\protect \endinput
diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex
index 894a91ac8..b2fe14f78 100644
--- a/tex/context/base/page-sid.tex
+++ b/tex/context/base/page-sid.tex
@@ -21,6 +21,9 @@
% Figures at Either Margin. De macro's zijn slechts op enkele
% punten door mij aangepast.
+% This module badly needs an update because it's now a
+% mixture of old and new macros.
+
% afhankelijke variabelen
%
% \overgap vervangen door \floatsidetopskip
@@ -46,6 +49,7 @@
\newdimen\sidefloatwidth
\newdimen\sidefloathsize
\newdimen\sidefloatvsize \def\nofloatvsize{-1pt }
+\newdimen\sidefloatprogress
\newbox\floatbottom
@@ -57,22 +61,57 @@
\newif\iffloatrighteqo
\newif\iffloatlefteqo
-\let\floatrighteqo=\eqno
-\let\floatleftleqo=\leqno
+% eq is still crap
+
+\ifx\normalleqno\undefined
+
+ \let\floatrighteqo=\eqno
+ \let\floatleftleqo=\leqno
+
+\else
+
+ \let\floatrighteqo=\normaleqno
+ \let\floatleftleqo=\normalleqno
+
+\fi
% Watch it even more! In inner, gaat't mis omdat daar
% pagetotal enz niet zijn aangepast. Inner kan overigens niet
% betrouwbaar worden getest!
+% \def\flushsidefloats%
+% {\par
+% \sidefloatprogress=\sidefloatvsize
+% \advance\sidefloatprogress by -\pagetotal
+% \ifdim\sidefloatprogress>\zeropoint
+% \witruimte % nog checken op interferentie
+% \kern\sidefloatprogress
+% \fi
+% \global\sidefloatvsize=\nofloatvsize
+% \global\floatflagfalse}
+%
+% no, too buggy, leads to top of page crap
+%
+%\def\flushsidefloats%
+% {\par
+% \dochecksidefloat
+% \scratchcounter=-\hangafter
+% \dorecurse{\scratchcounter}{\strut\hfill\strut\par}}
+
\def\flushsidefloats%
{\par
- \!!heighta=\sidefloatvsize
- \advance\!!heighta by -\pagetotal
+ \!!heighta\sidefloatvsize
+ \advance\!!heighta -\pagetotal
\ifdim\!!heighta>\zeropoint
- \witruimte % nog checken op interferentie
+ % to be checked for interference
+ \witruimte
+ % will be option
+ \getnoflines\!!heighta
+ \!!heighta\noflines\lineheight
+ % so far for option
\kern\!!heighta
\fi
- \global\sidefloatvsize=\nofloatvsize
+ \global\sidefloatvsize\nofloatvsize
\global\floatflagfalse}
\def\flushsidefloatsafterpar%
@@ -80,7 +119,7 @@
\gdef\checksidefloat%
{\dochecksidefloat
\ifdim\oldpagetotal=\pagetotal \else
- \xdef\checksidefloat{\dochecksidefloat}%
+ \global\let\checksidefloat\dochecksidefloat
\flushsidefloats
\fi}}
@@ -103,8 +142,7 @@
\let\poppenalties=\relax
\def\restorepenalties%
- {\ifnum\outputpenalty=\!!tenthousand\relax
- \else
+ {\ifnum\outputpenalty=\!!tenthousand\else
\penalty\outputpenalty
\fi}
@@ -120,7 +158,7 @@
\else
\restoreleftindent
\ifdim\wd\floatbottom<\sidefloathsize
- \parskip=\!!zeropoint
+ \parskip=\zeropoint
%\noindent
\vadjust{\penalty-1}%
\iffloatlefteqo
@@ -152,17 +190,29 @@
\def\restoreleftindent%
{\ifrightfloat \else
- \parskip=\!!zeropoint
+ \parskip=\zeropoint
\noindent
\vadjust{\penalty-1}%
\hskip\sidefloatwidth
\fi}
-\def\eqno%
- {\iffloatshort
- \global\floatrighteqotrue
- \fi
- \floatrighteqo}
+\ifx\normaleqno\undefined
+
+ \def\normaleqno%
+ {\iffloatshort
+ \global\floatrighteqotrue
+ \fi
+ \floatrighteqo}
+
+\else
+
+ \def\eqno%
+ {\iffloatshort
+ \global\floatrighteqotrue
+ \fi
+ \floatrighteqo}
+
+\fi
\def\leftmarginfloat#1%
{\global\rightfloatfalse\marginfloattrue\putsidefloat{#1}}
@@ -176,49 +226,56 @@
\def\rightfloat#1%
{\global\rightfloattrue\marginfloatfalse\putsidefloat{#1}}
-\def\putsidefloat#1%
+\def\putsidefloat#1% crap macro
{\par
\witruimte
+ % moved here dec 2001
+ {\everypar\emptytoks\forgetall\vbox{\strut}\vskip-\lineheight}% moved
+ %
\previoussidefloat
\stallsidefloat
\setbox\floatbox=\hbox{\vbox % pretty ugly, will be rewritten
{\vskip\ifmarginfloat-\sidefloattopskip\else\sidefloattopoffset\fi#1}}
\measuresidefloat
- \ifroomforfloat \else
+ \ifroomforfloat
+ \else
\tosssidefloat
\measuresidefloat
\stallsidefloat
\fi
\setsidefloat}
+
\def\progresssidefloat%
- {\!!heighta=\sidefloatvsize
+ {\sidefloatprogress=\sidefloatvsize
\iffloatflag
- \advance\!!heighta by -\dimen3
+ \advance\sidefloatprogress -\sidefloatpagetotal
\global\floatflagfalse
\else
- \advance\!!heighta by -\pagetotal
+ \advance\sidefloatprogress -\pagetotal
\fi}
\def\tosssidefloat%
{\vfill\eject}
+\newdimen\sidefloatpagetotal
+
\def\measuresidefloat%
{\global\floatflagtrue
- \dimen3=\pagetotal % global
+ \global\sidefloatpagetotal \pagetotal % global
\ifmarginfloat
- \global\sidefloatwidth=\!!zeropoint
+ \global \sidefloatwidth \zeropoint
\else
- \global\sidefloatwidth=\wd\floatbox
- \global\advance\sidefloatwidth by \floatsideskip
+ \global \sidefloatwidth \wd\floatbox
+ \global\advance\sidefloatwidth \floatsideskip
\fi
- \global\sidefloathsize=\hsize
- \global\advance\sidefloathsize by -\sidefloatwidth
- \global\sidefloatheight=\ht\floatbox
- \global\advance\sidefloatheight by \dp\floatbox
- \global\advance\sidefloatheight by \sidefloattopskip
- \global\sidefloatvsize=\sidefloatheight
- \global\advance\sidefloatvsize by \dimen3
+ \global \sidefloathsize \hsize
+ \global\advance\sidefloathsize -\sidefloatwidth
+ \global \sidefloatheight \ht\floatbox
+ \global\advance\sidefloatheight \dp\floatbox
+ \global\advance\sidefloatheight \sidefloattopskip
+ \global \sidefloatvsize \sidefloatheight
+ \global\advance\sidefloatvsize \sidefloatpagetotal
\dimen0=\sidefloatvsize
\ifdim\dimen0>.99\pagegoal \relax
\roomforfloatfalse
@@ -238,13 +295,15 @@
\fi}
\def\setsidefloat% nilling everypar saves time and redudant pos's
- {{\everypar\emptytoks\vbox{\strut}}\vskip-\lineheight
+ {% removed here dec 2001
+ %{\everypar\emptytoks\forgetall\vbox{\strut}\vskip-\lineheight}%
+ %
\kern\sidefloattopskip
\edef\presidefloatdepth{\the\prevdepth}%
\nointerlineskip
\bgroup
- \everypar=\emptytoks
- \parskip=\zeropoint
+ \everypar\emptytoks
+ \parskip\zeropoint
\logsidefloat
\ifrightfloat
\hfill
@@ -265,7 +324,7 @@
\egroup
\par
\kern-\sidefloatheight
- \penalty10001
+ \penalty10001 % oeps, this will change
\normalbaselines
\prevdepth=\presidefloatdepth
%\noindent
@@ -278,33 +337,33 @@
{\ifnum\sidefloatparagraph=1 }
\def\setsidefloatparagraph%
- {\global\advance\sidefloatparagraph by 1 }
+ {%\advance\sidefloatprogress by \sidefloatbottomskip
+ %\!!counta=\sidefloatprogress
+\scratchdimen=\sidefloatprogress
+\advance\scratchdimen \ht\strutbox
+\!!counta=\scratchdimen
+ \divide\!!counta by \baselineskip
+ \ifnum\!!counta>0
+ \ifrightfloat
+ \hangindent=-\sidefloatwidth
+ \else
+ \hangindent=\sidefloatwidth
+ \fi
+ \hangafter=-\!!counta
+ \fi
+ \global\advance\sidefloatparagraph 1 }
\def\resetsidefloatparagraph%
{\global\sidefloatparagraph=0 }
\def\dochecksidefloat%
{\progresssidefloat
- \ifdim\!!heighta>\zeropoint
-% \advance\!!heighta by \sidefloatbottomskip
-% \!!counta=\!!heighta
-\scratchdimen=\!!heighta
-\advance\scratchdimen \ht\strutbox
-\!!counta=\scratchdimen
- \divide\!!counta by \baselineskip
- \ifnum\!!counta>0
- \ifrightfloat
- \hangindent=-\sidefloatwidth
- \else
- \hangindent=\sidefloatwidth
- \fi
- \hangafter=-\!!counta
- \fi
+ \ifdim\sidefloatprogress>\zeropoint
\setsidefloatparagraph
\else
\resetsidefloatparagraph
\fi
- \parskip=\tussenwit}
+ \parskip\tussenwit}
\def\checksidefloat%
{\dochecksidefloat}
@@ -320,20 +379,20 @@
\def\previoussidefloat%
{\progresssidefloat
- \ifdim\!!heighta>\!!zeropoint \relax
+ \ifdim\sidefloatprogress>\zeropoint \relax
\iffloatshort
\global\floatshortfalse
\tosssidefloat
\else
- \kern\!!heighta
+ \kern\sidefloatprogress
\fi
\fi}
\def\stallsidefloat%
{\!!counta=\pageshrink
- \divide\!!counta by \baselineskip
- \advance\!!counta by 1
- \parskip=\!!zeropoint
+ \divide\!!counta \baselineskip
+ \advance\!!counta 1
+ \parskip=\zeropoint
\dorecurse{\!!counta}{\line{}}
\kern-\!!counta\baselineskip
\penalty0 }
diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex
index 89abd3f15..cafc15ed4 100644
--- a/tex/context/base/page-txt.tex
+++ b/tex/context/base/page-txt.tex
@@ -19,7 +19,7 @@
\let\dodummypageskip\gobbleoneargument % obsolete
-%D Interfainge between this and other modules is handled by
+%D Interfacing between this and other modules is handled by
%D the following macros. The current state of a text line
%D (header, footer, etc.) is checked by:
%D
@@ -188,7 +188,8 @@
\doifsomething{\ascii}
{\doattributes{#1#2}#3#4%
{\doifvalue{#1\v!tekst\c!strut}{\v!ja}{\setstrut\strut}% here!
- \doifdefinedelse{\??mk\ascii\c!koppeling} % brrr
+ %\doifdefinedelse{\??mk\ascii\c!koppeling} % brrr
+ \doifelsemarking\ascii
{\dolimitatetexts{#1#2#5}{\haalmarkering[\ascii][\v!eerste]}}
{\ConvertConstantAfter\doifelse{\v!paginanummer}{#6}
{\@@plaatspaginanummer}
@@ -201,7 +202,7 @@
%D length.
\def\dolimitatetexts#1#2%
- {\doifelsevaluenothing{#1}{#2}{\limitatetext{#2}{\getvalue{#1}}{...}}}
+ {\doifelsevaluenothing{#1}{#2}{\limitatetext{#2}{\getvalue{#1}}{\unknown}}}
%D The placement of text is hooked into the token lists
%D associated to the area at hand.
@@ -230,11 +231,24 @@
%D Instead we will map the values of status onto macro
%D expansions.
-\def\placelayouttextline#1#2% % handelt o.b.v. tekst
- {\edef\textlinestatus{\getvalue{\??tk#1\v!tekst\c!status}}%
- \doifdefinedelse{\string\placelayouttextline\textlinestatus}
- {\getvalue{\string\placelayouttextline\textlinestatus}{#1}{#2}}
- {\getvalue{\string\placelayouttextline\s!unknown}{#1}{#2}}}
+%\def\placelayouttextline#1#2% % handelt o.b.v. tekst
+% {\edef\textlinestatus{\getvalue{\??tk#1\v!tekst\c!status}}%
+% \doifdefinedelse{\string\placelayouttextline\textlinestatus}
+% {\getvalue{\string\placelayouttextline\textlinestatus}{#1}{#2}}
+% {\getvalue{\string\placelayouttextline\s!unknown}{#1}{#2}}}
+%
+%\def\placelayouttextline#1% #2
+% {\edef\textlinestatus{\getvalue{\??tk#1\v!tekst\c!status}}%
+% \doifundefined{\string\placelayouttextline\textlinestatus}
+% {\let\textlinestatus\s!unknown}%
+% \getvalue{\string\placelayouttextline\textlinestatus}{#1}} % {#2}
+
+\def\placelayouttextline#1% #2
+ {\edef\textlinestatus{\csname\??tk#1\v!tekst\c!status\endcsname}%
+ \ifundefined{\string\placelayouttextline\textlinestatus}%
+ \let\textlinestatus\s!unknown
+ \fi
+ \csname\string\placelayouttextline\textlinestatus\endcsname{#1}} % {#2}
\letvalue{\string\placelayouttextline\v!normaal}\doplacelayouttextline
\letvalue{\string\placelayouttextline }\doplacelayouttextline
@@ -243,14 +257,14 @@
\setvalue{\string\placelayouttextline\v!leeg}#1#2%
{\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \vskip#2\relax}
+ }% oeps, bug: \vskip#2\relax}
\setvalue{\string\placelayouttextline\v!start}#1#2%
{\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
\doplacelayouttextline{#1}{#2}}
\setvalue{\string\placelayouttextline\v!stop}#1#2%
- {\vskip#2\relax}
+ {}% oeps, bug:\vskip#2\relax}
\setvalue{\string\placelayouttextline\v!geenmarkering}#1#2%
{\bgroup
@@ -262,22 +276,27 @@
\setvalue{\string\placelayouttextline\s!unknown}#1#2%
{\bgroup % new
\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \setlocallayoutline{#1\textlinestatus}%
- \setlocallayoutline{#1\v!tekst\textlinestatus}%
- \setlocallayoutline{#1\v!marge\textlinestatus}%
- \setlocallayoutline{#1\v!rand\textlinestatus}%
+ %\setlocallayoutline{#1\textlinestatus}%
+ %\setlocallayoutline{#1\v!tekst\textlinestatus}%
+ %\setlocallayoutline{#1\v!marge\textlinestatus}%
+ %\setlocallayoutline{#1\v!rand\textlinestatus}%
+ \getvalue{\??tk#1\textlinestatus}%
+ \getvalue{\??tk#1\v!tekst\textlinestatus}%
+ \getvalue{\??tk#1\v!marge\textlinestatus}%
+ \getvalue{\??tk#1\v!rand\textlinestatus}%
\doplacelayouttextline{#1}{#2}%
\egroup}
-\def\setlocallayoutline#1%
- {\ifundefined{\??tk#1}\else\getvalue{\??tk#1}\fi}
+% \def\setlocallayoutline#1%
+% {\ifundefined{\??tk#1}\else\getvalue{\??tk#1}\fi}
%D The following macro has to be called after a page
%D is flushed.
\def\resetlayoutline#1% beware: global assignment
- {\doifvalue{\??tk#1\v!tekst\c!status}{\v!hoog}
- {\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}\donetrue}}
+ {\doifvalue{\??tk#1\v!tekst\c!status}\v!hoog
+ {\global\letvalue{\??tk#1\v!tekst\c!status}\v!normaal
+ \donetrue}}
\def\resetlayoutlines%
{\donefalse
@@ -335,6 +354,8 @@
\smashbox\scratchpagebox
\box\scratchpagebox}
+\let\maintextcolor\empty
+
\def\getmainbox#1#2%
{\setbox\scratchpagebox=\vbox
{\offinterlineskip % na \paginaletter !
@@ -361,7 +382,11 @@
\settextpagecontent\scratchpagebox{#1}{#2}%
\addtextbackground\scratchpagebox
\addtextgridlayer\scratchpagebox
- \box\scratchpagebox
+ \ifx\maintextcolor\empty
+ \box\scratchpagebox
+ \else
+ \color[\maintextcolor]{\box\scratchpagebox}%
+ \fi
\bgroup
\hskip\rechtermargeafstand
\ifdim\rechtermargebreedte>\zeropoint
@@ -394,7 +419,7 @@
\hss}%
\dp#1=\zeropoint}
-\def\addtextgridlayer#1%
+\def\addtextgridlayer#1%
{\ifshowgrid
\setgridbox\scratchbox\zetbreedte\teksthoogte
\setbox#1=\hbox
diff --git a/tex/context/base/ppchtex.tex b/tex/context/base/ppchtex.tex
index d3da5174e..2b8729597 100644
--- a/tex/context/base/ppchtex.tex
+++ b/tex/context/base/ppchtex.tex
@@ -3,6 +3,9 @@
% final => file / local run
%
% constante van phantom in definitie ONE: \setchemicaltextwidth 300
+%
+% it would be interesting to rewrite this module with todays
+% experiences and new context functionality, mybe ...
%D \module
%D [ file=ppchtex (m-chemie),
@@ -291,14 +294,14 @@
\newif\ifloweredsubscripts
% Due to some upward incompatibality of LaTeX to LaTeX2.09
-% and/or LaTeX2e we had to force \@@chemicalletter. Otherwise
+% and/or LaTeX2e we had to force \@@dochemicalstyle. Otherwise
% some weird \nullfont error comes up.
\def\beginlatexmathmodehack%
{\ifmmode
\let\endlatexmathmodehack=\relax
\else
- \def\endlatexmathmodehack{$}$\@@chemicalletter
+ \def\endlatexmathmodehack{$}$\@@dochemicalstyle\empty
\fi}
\def\setsubscripts%
@@ -308,10 +311,10 @@
\setxvalue{@@\string##1\string##2}{\the##1##2\relax}%
##1##2=\dimen0\relax}%
\def\dodosetsubscript##1##2%
- {\dosetsubscript{##1}{\textfont2}{##2}%
- \dosetsubscript{##1}{\scriptfont2}{##2}%
+ {\dosetsubscript{##1}{\textfont 2}{##2}%
+ \dosetsubscript{##1}{\scriptfont 2}{##2}%
\dosetsubscript{##1}{\scriptscriptfont2}{##2}}%
- %\dodosetsubscript{\fontdimen14}{?}%
+ %\dodosetsubscript{\fontdimen14}{?}%
\dodosetsubscript{\fontdimen16}{.7}%
\dodosetsubscript{\fontdimen17}{.7}%
\global\loweredsubscriptstrue
@@ -410,6 +413,8 @@
\newif\ifsmallchemicaltext
+\let\@@localchemicalstyle\empty
+
\def\setupchemicalformat[#1]%
{\processaction
[\getvalue{#1\c!formaat}]
@@ -450,13 +455,20 @@
\doifelse{\@@chemicalchemicaloffset}{LOW}
{\setlowsubscripts}
{\sethighsubscripts}%
- \setupchemicalformat[\??chemical\s!chemical]}
+ \setupchemicalformat[\??chemical\s!chemical]%
+ \ignorespaces}
\def\setupchemical%
{\dosingleargument\dosetupchemical}
-\def\@@chemicalletter% % $inner-style$
- {\@@chemicalchemicalletter} % $$outer-style$$
+\def\@@dochemicalstyle% % default mapping
+ {\@@chemicalletter}
+
+\def\@@dochemicalcolor% % no mapping yet
+ {}
+
+\def\@@chemicalletter % $inner-style$ % (overloaded)
+ {\@@chemicalchemicalletter} % $$outer-style$$
\def\@@writechemicalstatus#1#2%
{}
@@ -470,7 +482,7 @@
\pushMPdrawing
\startMPdrawing
%prologues := 1 ;
- input mp-tool ;
+ %input mp-tool ;
u := 10*\@@chemicalunit;
bboxmargin := 0pt ;
pickup pencircle scaled 2u ; % ???
@@ -485,7 +497,8 @@
\endpspicture
\or
\resetchemicalcoordinates
- \setbox2=\hbox{\MPshiftdrawingtrue\getMPdrawing}%
+ \setbox2=\hbox
+ {\MPshiftdrawingtrue\MPstaticgraphictrue\getMPdrawing}%
\wd2=\!!zeropoint\ht2=\!!zeropoint\dp2=\!!zeropoint
\put {\box2} at 0 0
\endpicture
@@ -524,7 +537,8 @@
\put {\box\chemicalsymbols} at 0 0 % elders
\ifMPdrawingdone
\resetchemicalcoordinates
- \setbox2=\hbox{\MPshiftdrawingtrue\getMPdrawing}%
+ \setbox2=\hbox
+ {\MPshiftdrawingtrue\MPstaticgraphictrue\getMPdrawing}%
\wd2=\!!zeropoint\ht2=\!!zeropoint\dp2=\!!zeropoint
\put {\box2} at 0 0 %
\fi
@@ -540,7 +554,7 @@
\or
\setcoordinatesystem units <\@@chemicalunit,\@@chemicalunit> %
\startMPdrawing
- input mp-tool ;
+ %input mp-tool ;
%prologues := 1 ;
u := 10*#1;
bboxmargin := 0pt ;
@@ -587,7 +601,7 @@
\newcount \currentchemical
%\newif \ifskipchemical
-%
+
\def\setchemicaldimensions#1#2#3%
{\bgroup
\global\advance\currentchemical by 1
@@ -597,7 +611,7 @@
\setxvalue{chemical::\the\currentchemical}%
{\noexpand\docommando{\the\dimen0}{\the\dimen2}{\the\dimen4}}%
\egroup}
-%
+
%\def\getchemicaldimensions#1#2#3%
% {\global\advance\currentchemical by 1
% \def\docommando##1##2##3%
@@ -643,7 +657,7 @@
% \fi
% \egroup
% \global\let\loadchemicaldimensions=\relax}
-
+
\ifx\normalchemicalframe\undefined
\let\normalchemicalframe\hbox % hook for educational purposes
\fi
@@ -653,7 +667,8 @@
[\??chemical][\??chemical\s!chemical]
[\c!breedte,\c!hoogte,\c!links,\c!rechts,\c!boven,\c!onder,
\c!korps,\c!formaat,\c!schaal,\c!status,\c!kader,\c!assenstelsel,
- \c!plaats,\c!optie,\c!variant,\c!resolutie,\c!offset,\c!letter]%
+ \c!plaats,\c!optie,\c!variant,\c!resolutie,\c!offset,\c!letter,
+ \c!kleur,\c!lijnkleur,\c!lijndikte]%
\getparameters
[\??chemical]
[#1]%
@@ -667,6 +682,9 @@
\doif{\@@chemicalvariant}{2}
{\@@setsecondchemicalplotsymbol}%
%
+ \doif{\@@chemicalassenstelsel}{\v!aan}
+ {\let\chemicalframe\hbox}%
+ %
\!!counta=250000
\divide\!!counta by \@@localchemicalscale
\!!widtha=\@@chemicalkorps
@@ -830,14 +848,10 @@
\def\checkchemicaldirection#1#2%
{\ifchemicaldirection
- % \ifnum#1>0 \advance\horchemical by +\chemicaldirection \fi
- % \ifnum#1<0 \advance\horchemical by -\chemicaldirection \fi
- % \ifnum#2>0 \advance\verchemical by +\chemicaldirection \fi
- % \ifnum#2<0 \advance\verchemical by -\chemicaldirection \fi
- \ifnum#1>0 \advance\horchemical by -\chemicaldirection \fi
- \ifnum#1<0 \advance\horchemical by +\chemicaldirection \fi
- \ifnum#2>0 \advance\verchemical by -\chemicaldirection \fi
- \ifnum#2<0 \advance\verchemical by +\chemicaldirection \fi
+ \ifnum#1>0 \advance\horchemical -\chemicaldirection \fi
+ \ifnum#1<0 \advance\horchemical +\chemicaldirection \fi
+ \ifnum#2>0 \advance\verchemical -\chemicaldirection \fi
+ \ifnum#2<0 \advance\verchemical +\chemicaldirection \fi
\chemicaldirectionfalse
\fi}
@@ -845,8 +859,8 @@
{\chemicaldirectiontrue\processchemicaltranslate}
\def\setchemicalcoordinates#1#2%
- {\advance\horchemical by #1\relax
- \advance\verchemical by #2\relax
+ {\advance\horchemical #1\relax
+ \advance\verchemical #2\relax
\checkchemicaldirection{#1}{#2}%
\!!counta=-\horchemical\edef\chemicalxoffset{\the\!!counta}%
\!!countb=-\verchemical\edef\chemicalyoffset{\the\!!countb}%
@@ -955,7 +969,7 @@
\def\chemicaloffset{0}
\def\processchemicaloffset#1%
- {\dimen0=62500 sp % real calc on cardinals
+ {\dimen0=62500 sp % real calc on cardinals, funny number
\dimen0=\chemicalrepeat\dimen0
\divide\dimen0 by \@@localchemicalscale
\!!counta=\dimen0
@@ -982,7 +996,7 @@
\def\processchemicalphantom#1#2%
{\setbox0=\hbox
{\def\splitoff##1????{##1}%
- $\@@chemicalletter{\@@localchemicalformat\splitoff#2}$}%
+ $\@@dochemicalstyle{\@@localchemicalformat\splitoff#2}$}%
\dimen0=.25\wd0
\divide\dimen0 by \@@localchemicalscale
\!!counta=\dimen0
@@ -1127,8 +1141,8 @@
\def\doputchemicaltext#1 [#2] at #3 #4 %
{\ifnum\chemicaldrawingmode=1
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
- {\expanded{\rput[#2]{-\chemicalangle}(#3,#4){#1}}}%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {\expanded{\rput[#2]{\chemicalangle}(#3,#4){#1}}}%
\else
\put {#1} [#2] at {#3} {#4} %
\fi}
@@ -1148,14 +1162,14 @@
{\def\@@chemicalframe{\chemicalframe}}
{\def\@@chemicalframe{}}%
\dosetsubscripts
- \setbox2=\hbox{$\@@chemicalletter{\@@localchemicalformat \chemicaltext}$}%
- \setbox4=\hbox{$\@@chemicalletter{\@@localchemicalformat C_2^2}$}%
- \setbox6=\hbox{$\@@chemicalletter{\@@localchemicalformat O}$}% or C
+ \setbox2=\hbox{$\@@dochemicalstyle{\@@localchemicalformat \chemicaltext}$}%
+ \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C_2^2}$}%
+ \setbox6=\hbox{$\@@dochemicalstyle{\@@localchemicalformat O}$}% or C
\doresetsubscripts
\doifnot{\@@chemicalplaats}{\v!intekst}
{\ht2=\ht4
\dp2=\dp4}%
- \setbox2=\hbox{\@@chemicalframe{\box2}}%
+ \setbox2=\hbox{\@@chemicalframe{\@@dochemicalcolor\box2}}%
\ifdim\wd2>\wd6
\doifelse{#1}{0}
{\doifnot{#2}{0}{\wd2=\wd6}}
@@ -1229,8 +1243,8 @@
\def\doputchemicaltext##1 [##2] at ##3 ##4 %
{\ifnum\chemicaldrawingmode=1
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
- {\rput{-\chemicalangle}(\@@xxx,\@@yyy){\expanded{\rput[##2](##3,##4){##1}}}}%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {\rput{\chemicalangle}(\@@xxx,\@@yyy){\expanded{\rput[##2](##3,##4){##1}}}}%
\else
\put
{\stoprotation \setcoordinatesystem point at 0 0
@@ -1287,29 +1301,30 @@
\or
\ifcase\chemicallinetype
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psline(\!!counta,\!!countb)(\!!countc,\!!countd)}%
\or
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psline{->}(\!!counta,\!!countb)(\!!countc,\!!countd)}%
\or
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psline{<-}(\!!counta,\!!countb)(\!!countc,\!!countd)}%
\or
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\expanded{\rput[\chemicallineposition]{-\chemicalangle}%
(\!!counta,\!!countb){\psline(0,0)(\!!counte,\!!countf)}}}%
\else
\psset{linestyle=dashed}%
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psline(\!!counta,\!!countb)(\!!countc,\!!countd)}%
\fi
\or
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
x0 := \MPdivten[\chemicalxoffset]u ;
y0 := \MPdivten[\chemicalyoffset]u ;
@@ -1339,7 +1354,8 @@
\else
% 4 : dashed line
draw ((z1--z2) rotatedaround(origin,-\chemicalangle))
- shifted z0 dashed evenly ;
+% shifted z0 dashed evenly ;
+ shifted z0 dashed dashpattern(on 5.5u off 6u) ;
\fi
\stopMPdrawing
\fi
@@ -1355,6 +1371,7 @@
{\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax
\ifnum\chemicaldrawingmode=2
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
x0 := \MPdivten[\chemicalxoffset]u ;
y0 := \MPdivten[\chemicalyoffset]u ;
@@ -1399,6 +1416,7 @@
{\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax
\ifnum\chemicaldrawingmode=2
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
x0 := \MPdivten[\chemicalxoffset]u ;
y0 := \MPdivten[\chemicalyoffset]u ;
@@ -1515,12 +1533,13 @@
1050 0 /
\endpicture
\or
- \rput{\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ \rput{-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psline(300,0)(500,0)%
\rput(500,0){\psplot[yunit=75,plotstyle=curve]{0}{720}{x sin}}%
\psline(950,0)(1050,0)}%
\or
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
x0 := \MPdivten[\chemicalxoffset]u ;
y0 := \MPdivten[\chemicalyoffset]u ;
@@ -1559,10 +1578,11 @@
\psset{linestyle=dashed}%
\fi
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
{\psarc(0,0){#3}{#1}{#2}}%
\or
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
r := \MPdivten[#3]*2u;
x0 := \MPdivten[\chemicalxoffset]u ;
@@ -1624,8 +1644,8 @@
\egroup
\ifnum\chemicaldrawingmode=1
\rput
- {\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
- {\expanded{\rput[\chemicalloca]{-\chemicalangle}(#1,#2){\box\nextbox}}}%
+ {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)%
+ {\expanded{\rput[\chemicalloca]{\chemicalangle}(#1,#2){\box\nextbox}}}%
\else
\expanded{\put{\box\nextbox}[\chemicalloca] at {#1} {#2} }
\fi
@@ -1754,9 +1774,9 @@
{#1[#2][#3]}% % experiment
\def\complexdododochemical[##1]% % experiment
{\def\dowithchemical% % experiment
- {\localthisischemical{#2}}% % experiment
+ {\localthisischemical{#2}}% % experiment
#1[#3][##1]}% % experiment
- \complexorsimple\dododochemical} % experiment
+ \complexorsimple\dododochemical} % experiment
\def\dodochemical[#1][#2]%
{\ignorespaces
@@ -1860,46 +1880,52 @@
\def\dochemicaltop#1#2#3#4%
{\vbox
- {\baselineskip=\chemicaltfraction\baselineskip \lineskip0pt
+ {\@@dochemicalcolor
+ \baselineskip=\chemicaltfraction\baselineskip \lineskip0pt
\halign
{#1###2\cr
- $\@@chemicalletter{\scriptscriptstyle#3}$\cr
- $\@@chemicalletter{\@@currentchemicalformat#4}$\cr}}}
+ $\@@dochemicalstyle{\scriptscriptstyle#3}$\cr
+ $\@@dochemicalstyle{\@@currentchemicalformat#4}$\cr}}}
\def\dochemicalbottom#1#2#3#4%
{\vtop
- {\baselineskip=\chemicalbfraction\baselineskip \lineskip0pt
+ {\@@dochemicalcolor
+ \baselineskip=\chemicalbfraction\baselineskip \lineskip0pt
\halign
{#1###2\cr
- $\@@chemicalletter{\@@currentchemicalformat#4}$\cr
- $\@@chemicalletter{\scriptscriptstyle#3}$\cr}}}
+ $\@@dochemicalstyle{\@@currentchemicalformat#4}$\cr
+ $\@@dochemicalstyle{\scriptscriptstyle#3}$\cr}}}
\def\chemicalleft#1#2%
{\hbox
- {$\@@chemicalletter{\scriptscriptstyle#1}$%
- $\@@chemicalletter{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}}
+ {\@@dochemicalcolor
+ $\@@dochemicalstyle{\scriptscriptstyle#1}$%
+ $\@@dochemicalstyle{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}}
\def\chemicalright#1#2%
{\hbox
- {$\@@chemicalletter{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$%
- $\@@chemicalletter{\scriptscriptstyle#1}$}}
+ {\@@dochemicalcolor
+ $\@@dochemicalstyle{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$%
+ $\@@dochemicalstyle{\scriptscriptstyle#1}$}}
\def\chemicalcentered#1%
- {\setbox0=\hbox{$\@@chemicalletter{\scriptscriptstyle#1}$}%
- \setbox2=\hbox{$\@@chemicalletter{\@@currentchemicalformat C}$}%
+ {\setbox0=\hbox{$\@@dochemicalstyle{\scriptscriptstyle#1}$}%
+ \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}%
\dimen0=.5\ht2
\advance\dimen0 by -.5\ht0
\advance\dimen0 by \dp0
- \raise\dimen0\box0}
+ \hbox{\@@dochemicalcolor\raise\dimen0\box0}}
\def\chemicalleftcentered#1#2%
{\hbox
- {\chemicalcentered{#1}%
- $\@@chemicalletter{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}}
+ {\@@dochemicalcolor
+ \chemicalcentered{#1}%
+ $\@@dochemicalstyle{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}}
\def\chemicalrightcentered#1#2%
{\hbox
- {$\@@chemicalletter{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$%
+ {\@@dochemicalcolor
+ $\@@dochemicalstyle{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$%
\chemicalcentered{#1}}}
\def\chemicaltop {\dochemicaltop \hss \hss }
@@ -1915,24 +1941,27 @@
\def\chemicalbottomright#1{\chemicalright{\chemicalleftbottom{#1}{}}}
\def\chemicalsmashedleft#1%
- {\bgroup
- \setbox0=\hbox{$\@@chemicalletter{\@@currentchemicalformat C}$}%
- \setbox2=\hbox{$\@@chemicalletter{\@@currentchemicalformat#1}$}%
+ {\hbox\bgroup
+ \@@dochemicalcolor
+ \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}%
+ \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}%
\wd2=\wd0
\box2
\egroup}
\def\chemicalsmashedmiddle#1%
- {\bgroup
- \setbox0=\hbox{$\@@chemicalletter{\@@currentchemicalformat C}$}%
- \setbox2=\hbox{$\@@chemicalletter{\@@currentchemicalformat#1}$}%
+ {\hbox\bgroup
+ \@@dochemicalcolor
+ \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}%
+ \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}%
\hbox{\hskip-.5\wd2\hskip.5\wd0\box2}
\egroup}
\def\chemicalsmashedright#1%
- {\bgroup
- \setbox0=\hbox{$\@@chemicalletter{\@@currentchemicalformat C}$}%
- \setbox2=\hbox{$\@@chemicalletter{\@@currentchemicalformat#1}$}%
+ {\hbox\bgroup
+ \@@dochemicalcolor
+ \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}%
+ \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}%
\hbox to \wd0{\hskip-\wd2\hskip\wd0\box2}%
\egroup}
@@ -1940,7 +1969,9 @@
\def\chemicalforever#1#2%
{\bgroup
- \setbox0=\hbox{$\@@chemicalletter{\scriptscriptstyle\hskip-.15em#2}$}%
+ \setbox0=\hbox
+ {\@@dochemicalcolor
+ $\@@dochemicalstyle{\scriptscriptstyle\hskip-.15em#2}$}%
\wd0=0pt
\big#1_{\hskip.1em\box0}%
\egroup}
@@ -2064,22 +2095,22 @@
{{\setbox0=\hbox{$#1+$}%
\raise\dp0\hbox{$#1#2$}}}
-\def\chemicalinnersign#1%
+\def\chemicalinnersign#1% todo: \@@chemicaltextcolor
{\chemicalraise{\@@localchemicalstyle}{#1}}
\def\chemicaloutersign#1%
- {\chemicalraise{}{#1}}
+ {\chemicalraise{}{\@@dochemicalcolor#1}}
\def\chemicalsingleinnerarrow#1#2%
{\chemicalraise{\@@localchemicalstyle}{\longrightarrow}}
-\def\chemicaldoubleinnerarrow#1#2%
+\def\chemicaldoubleinnerarrow#1#2% todo: \@@chemicaltextcolor
{\lower.2ex\hbox
{\setbox0=\hbox{$\@@localchemicalstyle\longrightarrow$}%
\setbox2=\hbox{$\@@localchemicalstyle\longleftarrow$}%
\wd0=0pt\raise\ht0\box0\box2}}
-\def\chemicaltwintipinnerarrow#1#2%
+\def\chemicaltwintipinnerarrow#1#2% todo: \@@chemicaltextcolor
{\hbox
{\setbox0=\hbox{\chemicalraise{\@@localchemicalstyle}{\longrightarrow}}%
\setbox2=\hbox{\chemicalraise{\@@localchemicalstyle}{\longleftarrow}}%
@@ -2088,8 +2119,8 @@
\def\dochemicalouterarrow#1#2#3%
{\bgroup
\setbox0=\hbox{$\longrightarrow$}%
- \setbox2=\hbox{$\@@chemicalletter{\scriptstyle\quad#2\quad}$}%
- \setbox4=\hbox{$\@@chemicalletter{\scriptstyle\quad#3\quad}$}%
+ \setbox2=\hbox{$\@@dochemicalstyle{\scriptstyle\quad#2\quad}$}%
+ \setbox4=\hbox{$\@@dochemicalstyle{\scriptstyle\quad#3\quad}$}%
\dimen2=\wd0 % \dimen0 is used elsewhere
\ifdim\wd2>\dimen2 \dimen0=\wd2 \fi
\ifdim\wd4>\dimen2 \dimen0=\wd4 \fi
@@ -2117,61 +2148,54 @@
\hskip-\dimen2
\hbox to \dimen2{\leftarrowfill}}}}
-\def\chemicalinnermolecule#1#2#3% #3 vergeten
- {\chemicalspace
- %\mathop % onnodig en genereert spatie aan het begin van een regel
- {\dosetsubscripts
- \hbox{$\@@chemicalletter{\@@localchemicalstyle\strut#1}$}%
- \doresetsubscripts}%
+\def\chemicalinnermolecule#1#2#3% no mathop here, can generate space
+ {\chemicalspace % todo: \@@chemicaltextcolor
+ \bgroup
+ \dosetsubscripts
+ \hbox{$\@@dochemicalstyle{\@@localchemicalstyle\strut#1}$}%
+ \doresetsubscripts
+ \egroup
\chemicalspace}
-%\def\chemicaloutermolecule#1#2#3%
-% {\chemicalspace
-% \setbox0=\hbox % else the font is reset
-% {\dosetsubscripts
-% \hbox{$\@@chemicalletter{\strut#1}$}%
-% \doresetsubscripts}%
-% \mathop{\box0}%
-% \doifnot{#2}{}
-% {_{\@@chemicalletter{\strut\ifthirdargument#3\else#2\fi}}}%
-% \doifnot{#3}{}
-% {^{\@@chemicalletter{\strut\ifthirdargument#2\else#3\fi}}}%
-% \chemicalspace}
-
\def\chemicaloutermolecule#1#2#3%
{\chemicalspace
+ \bgroup
+ \@@dochemicalcolor
\setbox0=\hbox % else the font is reset
{\dosetsubscripts
- \hbox{$\@@chemicalletter{\strut#1}$}%
+ \hbox{$\@@dochemicalstyle{\strut#1}$}%
\doresetsubscripts}%
\mathop{\box0}%
\ifthirdargument
\doifnot{#2}{}
- {^{\@@chemicalletter{\strut#2}}}%
+ {^{\@@dochemicalstyle{\strut#2}}}%
\doifnot{#3}{}
- {_{\@@chemicalletter{\strut#3}}}%
+ {_{\@@dochemicalstyle{\strut#3}}}%
\else
\doifnot{#2}{}
- {_{\@@chemicalletter{\strut#2}}}%
+ {_{\@@dochemicalstyle{\strut#2}}}%
\fi
+ \egroup
\chemicalspace}
\def\chemicalsinglepicturearrow#1%
{\lower.5ex\hbox
- {$\chemicalspace
+ {\@@dochemicalstyle
+ $\chemicalspace
\buildrel
- \@@chemicalletter{\scriptstyle\quad#1\quad}%
+ \@@dochemicalstyle{\scriptstyle\quad#1\quad}%
\over{\overrightarrow
{\hphantom{\@chemicalletter{\scriptstyle\quad#1\quad}}}}%
\chemicalspace$}}
\def\chemicaldoublepicturearrow#1%
{\lower.5ex\hbox
- {$\chemicalspace
+ {\@@dochemicalstyle
+ $\chemicalspace
\buildrel
- \@@chemicalletter{\scriptstyle\quad#1\quad}%
+ \@@dochemicalstyle{\scriptstyle\quad#1\quad}%
\over{\overrightarrow{\overleftarrow
- {\hphantom{\@@chemicalletter{\scriptstyle\quad#1\quad}}}}}%
+ {\hphantom{\@@dochemicalstyle{\scriptstyle\quad#1\quad}}}}}%
\chemicalspace$}}
% Bij de in-line bindingen wordt gebruik gemaakt van
@@ -2181,11 +2205,12 @@
\def\somechemicalbond%
{\hrule width \wd0 height .4pt}
-\def\dochemicalbonds#1#2#3%
+\def\dochemicalbonds#1#2#3% todo: \@@chemicaltextletter
{{\setbox0=\hbox
- {$\@@chemicalletter{\@@localchemicalstyle M}$}%
+ {${\@@localchemicalstyle M}$}%
\vbox to \ht0
- {\hsize\wd0
+ {\@@dochemicalcolor
+ \hsize\wd0
\vskip.1\wd0#1\vfill#2\vfill#3\vskip.1\wd0}}}
\def\singlechemicalbond%
@@ -3135,7 +3160,7 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
\dogetcommalistelement2\from#3\to\bottext
\def\dochemicaltext##1%
{\dosetsubscripts%
- $\@@chemicalletter{\@@localchemicalformat\strut##1}$%
+ $\@@dochemicalstyle{\@@localchemicalformat\strut##1}$%
\doresetsubscripts}%
\doifelse{\@@chemicalplaats}{\v!intekst}%
{#1{\dochemicaltext\toptext}}%
@@ -3164,12 +3189,12 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
\def\executechemicalsign#1[#2]%
{\doifelse{\@@chemicalplaats}{\v!intekst}
{\dosetsubscripts
- $\@@chemicalletter{\@@localchemicalformat#1}$%
+ $\@@dochemicalstyle{\@@localchemicalformat#1}$%
\doresetsubscripts}
{\setbox\chemicalsymbols=\hbox
{\box\chemicalsymbols
\dosetsubscripts
- $\@@chemicalletter{\@@localchemicalformat#1}$%
+ $\@@dochemicalstyle{\@@localchemicalformat#1}$%
\doresetsubscripts}}}
\def\executechemicalPLUS%
@@ -3191,7 +3216,7 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
{\doifnot{\@@chemicalplaats}{\v!intekst}%
{\setbox\chemicalsymbols=\hbox
{\box\chemicalsymbols
- $\@@chemicalletter{\@@localchemicalformat#1}$}}}
+ $\@@dochemicalstyle{\@@localchemicalformat#1}$}}}
\def\executechemicalTEXT[#1]%
{\doifnot{\@@chemicalplaats}{\v!intekst}%
@@ -3213,6 +3238,7 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
\bgroup
\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax
\global\MPdrawingdonetrue
+ \setchemicalattributes
\startMPdrawing
x1 := \MPdivten[\the\!!counta]u ;
y1 := \MPdivten[\the\!!countb]u ;
@@ -3262,6 +3288,8 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
\def\executechemicalUPDOWNARROW[#1]%
{\executechemicalverticalsymbol\updownarrow{#1}}
+\let\setchemicalattributes\relax
+
\setupchemical
[\c!breedte=0,
\c!hoogte=0,
@@ -3281,7 +3309,10 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
\c!plaats=,
\c!optie=,
\c!offset=LOW,
- \c!variant=1]
+ \c!variant=1,
+ \c!kleur=,
+ \c!lijndikte=,
+ \c!lijnkleur=]
% Tijdelijk plaatsen we deze extra macro's hier.
%
@@ -3312,10 +3343,55 @@ RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{},
{\offinterlineskip
\halign
{\hss##\hss\cr
- $\@@chemicalletter{\@@localchemicalformat\scriptscriptstyle#1}$\cr
+ $\@@dochemicalstyle{\@@localchemicalformat\scriptscriptstyle#1}$\cr
\noalign{\vskip.5ex}%
- $\@@chemicalletter{\@@localchemicalformat#2}$\cr}}}
+ $\@@dochemicalstyle{\@@localchemicalformat#2}$\cr}}}
+
+%D Here are a couple of \CONTEXT\ goodies:
+%D
+%D \startopsomming
+%D \som styles hooked into \CONTEXT\ style mechanism
+%D \som support for color and rulethickness (mp mode only)
+%D \som position tracking
+%D \stopopsoming
+
+\ifCONTEXT
+
+\def\setchemicalattributes
+ {\scratchdimen=\@@chemicalchemicallijndikte
+ \def\chemicalattributes
+ {withpen pencircle scaled \the\scratchdimen\space
+ withcolor }%
+ \doifelsenothing{\@@chemicalchemicallijnkleur}
+ {\edef\chemicalattributes{\chemicalattributes black}}
+ {\edef\chemicalattributes
+ {\chemicalattributes \MPcolor{\@@chemicalchemicallijnkleur}}}%
+ \startMPdrawing
+ drawoptions (\chemicalattributes) ;
+ \stopMPdrawing}
+
+\let\@@chemicalkleur\empty
+
+\def\@@dochemicalcolor
+ {\doifsomething{\@@chemicalkleur}{\color[\@@chemicalkleur]}}
+
+\def\@@dochemicalstyle
+ {\doconvertfont{\@@chemicalletter}}
+
+\setupchemical
+ [\c!lijndikte=\linewidth,
+ \c!lijnkleur=,
+ \c!kleur=]
+\def\cpos#1#2%
+ {\bgroup
+ \pushmacro\dowithchemical
+ \gdef\dowithchemical##1{\hpos{#1}{##1}\popmacro\dowithchemical}%
+ #2%
+ \egroup}
+
+\fi
+
\protect
\endinput
diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex
index 7d8e12ad5..a1347030a 100644
--- a/tex/context/base/s-abr-01.tex
+++ b/tex/context/base/s-abr-01.tex
@@ -89,6 +89,7 @@
\logo [MODULA] {Modula}
\logo [MOV] {mov}
\logo [MPS] {mps}
+\logo [MPTOPDF] {mptopdf}
\logo [MSDOS] {msdos}
\logo [MSWINDOWS] {MS~Windows}
\logo [NETPBM] {NetPBM}
@@ -114,6 +115,7 @@
\logo [PSCHECK] {pscheck}
\logo [PSTOPAGE] {pstopage}
\logo [PSTRICKS] {pstricks}
+\logo [PSTOEDIT] {pstoedit}
\logo [PS] {Post\-Script}
\logo [RGB] {rgb}
\logo [SGML] {sgml}
diff --git a/tex/context/base/s-faq-01.tex b/tex/context/base/s-faq-01.tex
index 6e73d70d4..8c116e0f7 100644
--- a/tex/context/base/s-faq-01.tex
+++ b/tex/context/base/s-faq-01.tex
@@ -129,7 +129,7 @@
[bottom 1]
[state=start]
-\def\EndAnswer%
+\def\EndAnswer
{\vfill
\bgroup
\tfx\setstrut
@@ -141,7 +141,7 @@
{\AuthorOfFAQ}
\egroup}
-\def\TitlePage%
+\def\TitlePage
{\startstandardmakeup
\blank[3*big]
\midaligned{\bfd \labeltext{FAQ}}
@@ -156,16 +156,22 @@
\blank[3*big]
\stopstandardmakeup}
-\def\FileWithFAQs%
+\def\StartReadingFAQ
{\setupinteractionmenu[bottom 1][state=stop]
\setupinteractionmenu[bottom 2][state=start]
- \page
- \input \FileNameOfFAQ \relax
- \page
+ \page}
+
+\def\StopReadingFAQ
+ {\page
\setupinteractionmenu[bottom 2][state=stop]
\setupinteractionmenu[bottom 1][state=start]}
-\def\IndexPage%
+\def\FileWithFAQs
+ {\StartReadingFAQ
+ \input \FileNameOfFAQ \relax
+ \StopReadingFAQ}
+
+\def\IndexPage
{\page
\def\CurrentIndexOfFAQ{}
\def\NameOfFAQ{}
@@ -173,19 +179,22 @@
\placeregister[index]
\page}
-\def\BeginFAQ%
+\def\BeginFAQ
{\doglobal\increment\CurrentNOfFAQ
\setbox0=\vbox\bgroup
\setupframedtexts[before=,after=,linecorrection=off]
\startframedtext}
-\def\EndFAQ%
+\def\EndFAQ
{\stopframedtext
\egroup
- \button[color=,contrastcolor=,frame=overlay,offset=overlay]{\copy0}[faq:\CurrentNOfFAQ]
+ \button
+ [color=,contrastcolor=,frame=overlay,offset=overlay]
+ {\copy0}
+ [faq:\CurrentNOfFAQ]
\vskip6pt}
-\def\AllFAQs%
+\def\AllFAQs
{\page
\def\CurrentIndexOfFAQ{}
\def\NameOfFAQ{}
diff --git a/tex/context/base/s-faq-02.tex b/tex/context/base/s-faq-02.tex
index 7247ee6a1..02287bde4 100644
--- a/tex/context/base/s-faq-02.tex
+++ b/tex/context/base/s-faq-02.tex
@@ -41,14 +41,23 @@
\blank[3*big]
\stopstandardmakeup}
-\def\FileWithFAQs%
- {\page
+\def\StartReadingFAQ
+ {\page}
+
+\def\StopReadingFAQ
+ {\page}
+
+\def\FileWithFAQs
+ {\StartReadingFAQ
\input \FileNameOfFAQ \relax
- \page}
+ \StopReadingFAQ}
-\def\IndexPage%
+\def\IndexPage
{\page
\setupfootertexts[\labeltext{index}][]
\placeregister[index]}
+\def\AllFAQs
+ {}
+
\endinput
diff --git a/tex/context/base/s-faq-03.tex b/tex/context/base/s-faq-03.tex
index 7d4b5edc4..4f556f713 100644
--- a/tex/context/base/s-faq-03.tex
+++ b/tex/context/base/s-faq-03.tex
@@ -11,6 +11,33 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\def\StartFAQ[#1]%
+ {\getrawparameters[FAQ][name=,label=,language=,hyphenation=,url=,#1]
+ \let\NameOfFAQ \FAQname
+ \let\TagOfFAQ \FAQlabel
+ \let\LanguageOfFAQ \FAQlanguage
+ \let\HyphenationOfFAQ \FAQhyphenation
+ \let\ListOfFAQ \FAQurl
+ \doifmodeelse{screen}
+ {\usemodule[faq-01]}
+ {\usemodule[faq-02]}
+ \starttext
+ \TitlePage
+ \StartReadingFAQ}
+
+\def\StopFAQ
+ {\StopReadingFAQ
+ \IndexPage
+ \AllFAQs
+ \stoptext}
+
+\def\ProcessFAQ[#1]%
+ {\StartFAQ[#1]
+ \input \FileNameOfFAQ \relax
+ \StopFAQ}
+
+% for old times sake:
+
\def\PDFscreenFAQ \name #1 \tag #2 \language #3 \hyphenation #4 \list #5
{\def\NameOfFAQ {#1}
\def\TagOfFAQ {#2}
@@ -38,17 +65,6 @@
\IndexPage
\stoptext}
-\def\DVIpaperFAQ \name #1 \tag #2 \language #3 \hyphenation #4 \list #5
- {\def\NameOfFAQ {#1}
- \def\TagOfFAQ {#2}
- \def\LanguageOfFAQ {#3}
- \def\HyphenationOfFAQ {#4}
- \def\ListOfFAQ {#5}
- \usemodule[faq-02]
- \starttext
- \TitlePage
- \FileWithFAQs
- \IndexPage
- \stoptext}
+\let\DVIpaperFAQ\PDFscreenFAQ
\endinput
diff --git a/tex/context/base/s-mod-00.tex b/tex/context/base/s-mod-00.tex
index b3f11e1a9..26720368c 100644
--- a/tex/context/base/s-mod-00.tex
+++ b/tex/context/base/s-mod-00.tex
@@ -22,7 +22,7 @@
\newprettytrue
-\gebruikmodule[eenheid]
+\usemodule[eenheid]
\mainlanguage[en]
@@ -39,10 +39,10 @@
% nog eens \interface \\ \\ verder doorvoeren
\def\resetmodule%
- {\getparameters
+ {\getrawparameters
[Module]
[ file=\jobname,
- version={\currentdate[jaar,{.},maand,{.},dag]},
+ version={\currentdate[\v!jaar,{.},\v!maand,{.},\v!dag]},
title=,
subtitle=,
author=Hans Hagen,
@@ -55,20 +55,20 @@
\def\dostartmodule[#1]%
{\newcounter\ParagraphNumber
\resetmodule
- \getparameters[Module][type=tex,#1]}
+ \getrawparameters[Module][type=tex,#1]}
\def\startmodule%
{\dosingleempty\dostartmodule}
\def\complexmodule[#1]%
- {\startglobaal % i.v.m. \bgroup in \startdocumentation
- \getparameters[Module][#1]
- \stopglobaal % i.v.m. \bgroup in \startdocumentation
+ {\startglobal % i.v.m. \bgroup in \startdocumentation
+ \getrawparameters[Module][#1]
+ \stopglobal % i.v.m. \bgroup in \startdocumentation
\moduletitel}
\def\stopmodule%
{\pagina
- \plaatsindex
+ \plaatsregister[\v!index]
[\c!balanceren=\v!ja,
\c!aanduiding=\v!nee,
\c!criterium=\v!tekst]}
@@ -78,55 +78,139 @@
\definecomplexorsimple\module
-\startmode[atpragma]
-
- \def\TitelPagina#1% can be done more efficient
- {\startMPrun
- mpgraph := #1 ;
- input mp-cont ;
- \stopMPrun
- \externalfigure
- [\bufferprefix mprun.#1]
- [\c!hoogte=\vsize,
- \c!breedte=\hsize]}
-
- \definieeroverlay[titelpagina][\TitelPagina{512}]
-
-\stopmode
+% \startmode[atpragma]
+%
+% \def\TitelPagina#1% can be done more efficient
+% {\startMPrun
+% mpgraph := #1 ;
+% input mp-cont ;
+% \stopMPrun
+% \externalfigure
+% [\bufferprefix mprun.#1]
+% [\c!hoogte=\vsize,
+% \c!breedte=\hsize]}
+%
+% \defineoverlay[titelpagina][\TitelPagina{512}]
+%
+% \stopmode
+
+\startuseMPgraphic{titlepage}
+
+ width := PaperWidth ;
+ height := PaperHeight ;
+
+ color local_red, local_white, local_blue ;
+
+ local_white := white ;
+
+ local_blue := local_white randomized (.6,.8) ;
+ local_red := local_white randomized (.3,.4) ;
+
+ u := width/400 ;
+
+ def a_module (expr dx, dy) =
+ picture p ; p := image
+ ( ddy := 0 ; sx := 60u ;
+ for i=1 upto (4 randomized 2) :
+ sy := 7u randomized 3u ;
+ fill unitsquare xyscaled(sx,sy) shifted (0,ddy)
+ withcolor local_red ;
+ ddy := ddy + sy + 4u ;
+ endfor ) ;
+ p := p shifted (dx,dy) shifted - center p ;
+ fill boundingbox p enlarged 8u withcolor local_white ;
+ fill boundingbox p enlarged 4u withcolor local_blue ;
+ draw p ;
+ enddef ;
+
+ set_grid(width, height, width/15, height/15) ;
+ forever:
+ if new_on_grid(uniformdeviate width,uniformdeviate height):
+ a_module(dx,dy) ;
+ fi ;
+ exitif grid_full ;
+ endfor ;
+
+ clip currentpicture to unitsquare xyscaled(width,height) ;
+\stopuseMPgraphic
+
+\defineoverlay
+ [titelpagina]
+ [\useMPgraphic{titlepage}]
+
+% When run at \PRAGMA, we use a slightly difgferent graphic,
+% so that we can recognize an original. Users are not
+% supposed to mimick this feature.
+
+\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}}
+
+\defineframed
+ [TitleFrame]
+ [\c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=wit,
+ \c!uitlijnen=\v!rechts,
+ \c!offset=12pt,
+ \c!strut=\v!nee,
+ \c!kader=\v!uit,
+ \c!onder=]
+
+\definelayout
+ [titlepage]
+ [\c!rugwit=0pt,
+ \c!kopwit=0pt,
+ \c!hoofd=0pt,
+ \c!voet=0pt,
+ \c!hoogte=\v!midden,
+ \c!breedte=\v!midden]
\def\moduletitel%
- {\ifx\ModuleNumber\undefined \else
+ {\stellayoutin[titlepage]
+ \ifx\ModuleNumber\undefined \else
\ifnum\ModuleNumber<10
- \edef\ModuleNumber{00\ModuleNumber}%
+ \edef\ModuleNumber{00\ModuleNumber}
\else\ifnum\ModuleNumber<100
- \edef\ModuleNumber{0\ModuleNumber}%
+ \edef\ModuleNumber{0\ModuleNumber}
\fi\fi
- \stelachtergrondenin
+ \setupbackgrounds
[\v!pagina]
[\c!achtergrond=titelpagina]
\fi
- \startstandaardopmaak[\c!hoofdstatus=\v!geen,\c!voetstatus=\v!geen]
- \switchnaarkorps[14.4pt,ss]
- \definefont[temp][SansBold at 72pt] % \font\temp=cmssbx10 at 72pt
+ \startmakeup[\v!standaard][\c!hoofdstatus=\v!geen,\c!voetstatus=\v!geen]
+ \switchtobodyfont[14.4pt,ss]
\bgroup
\def\CONTEXT {Con\kern-.15em\TeX t}
\def\TEXUTIL {\TeX Util}
\def\PPCHTEX {PPCH\TeX}
- \regellinks{\temp \CONTEXT} \vskip24pt
- \doifelse{\Modulesubtitle}{}
- {\regellinks{\bfd \Moduletitle} \vfill}
- {\regellinks{\bfd \Modulesubtitle} \vfill
- \doifnot{\Moduletitle}{}
- {\regellinks{\bf category: \Moduletitle} \vskip6pt}}
- \regellinks{\bf author: \Moduleauthor} \vskip6pt
- \regellinks{\bf date: \currentdate} \vskip6pt
- \doifnot{\Modulesuggestions}{}
- {\regellinks{\bs suggestions: \Modulesuggestions} \vskip6pt}
+ \def\METAPOST{MetaPost}
+ \hfill
+ {\definedfont[SansBold at 96pt]\setstrut
+ \TitleFrame{\CONTEXT}}
+ \vfill
+ \definetabulate[temp][|l|l|]%
+ \switchtobodyfont[17.3pt,ss]
+ \hfill
+ {\bf\setstrut
+ \TitleFrame
+ {\insidefloattrue\steltabulatiein[\c!voor=,\c!na=]%
+ \starttemp
+ \doifsomething{\Moduletitle}
+ {\NC title \EQ \Moduletitle \NC\NR}%
+ \doifsomething{\Modulesubtitle}
+ {\NC subtitle \EQ \Modulesubtitle \NC\NR}%
+ \doifsomething{\Moduleauthor}
+ {\NC author \EQ \Moduleauthor \NC\NR}%
+ \NC date \EQ \currentdate \NC\NR
+ %\doifsomething{\Modulesuggestions} % todo: generates space
+ % {\NC suggestions \NC \Modulesuggestions \NC\NR}%
+ \stoptemp}}
\egroup
- \stopstandaardopmaak
+ \stopmakeup
\ifx\ModuleNumber\undefined \else
- \stelachtergrondenin[\v!pagina][\c!achtergrond=]
- \fi}
+ \setupbackgrounds
+ [\v!pagina]
+ [\c!achtergrond=]
+ \fi
+ \stellayoutin}
\let\stopdocumentation=\relax
@@ -142,41 +226,38 @@
\gdef\CompressDefinitions%
{\ifcompressdefinitions
- \switchnaarkorps[klein]%
+ \switchtobodyfont[\v!klein]%
\fi}
-\definieertypen
- [definition]
+\startnotmode[nocode]
+
+ \definetyping
+ [definition]
+
+ \setuptyping
+ [definition]
+ [\c!voor={\pagina[\v!voorkeur]}\blanko\PresetParagraphNumber\CompressDefinitions,
+ \c!na=\ResetParagraphNumber\blanko,
+ \c!optie=\Moduletype]
-\steltypenin
- [definition]
- [\c!voor={\pagina[\v!voorkeur]}\blanko\PresetParagraphNumber\CompressDefinitions,
- \c!na=\ResetParagraphNumber\blanko,
- \c!optie=\Moduletype]
+\stopnotmode
-\definieertypen
- [PL]
- [\c!optie=PL,
- \c!marge=\v!standaard]
+\startmode[nocode]
-\definieertypen
- [JV]
- [\c!optie=JV,
- \c!marge=\v!standaard]
+% \definieerbuffer[definition] % ignore
-\definieertypen
- [MP]
- [\c!optie=MP,
- \c!marge=\v!standaard]
+ \long\def\startdefinition#1\stopdefinition{}
+
+\stopmode
-\definieertypen
- [TEX]
- [\c!optie=TEX,
- \c!marge=\v!standaard]
+\definetyping [PL] [\c!optie=PL, \c!marge=\v!standaard]
+\definetyping [JV] [\c!optie=JV, \c!marge=\v!standaard]
+\definetyping [MP] [\c!optie=MP, \c!marge=\v!standaard]
+\definetyping [TEX] [\c!optie=TEX,\c!marge=\v!standaard]
-\steltypenin [\v!typen] [\c!marge=\v!standaard]
-\steltypenin [\v!file] [\c!marge=\v!standaard]
-\steltypenin [definition] [\c!marge=0pt]
+\setuptyping [\v!typen] [\c!marge=\v!standaard]
+\setuptyping [\v!file] [\c!marge=\v!standaard]
+\setuptyping [definition] [\c!marge=0pt]
\newcounter\NOfMarginLines
\newcounter\ParagraphNumber
@@ -230,7 +311,7 @@
\def\margeaanduidingen#1[#2]%
{\def\domargeaanduidingen##1##2%
{\margetitel[#2]%
- {\switchnaarkorps[klein]%
+ {\switchtobodyfont[\v!klein]%
\doglobal\newcounter\NOfMarginLines
\dodomargeaanduidingen[##1]#1%
\scratchcounter=\NOfMarginLines
@@ -241,14 +322,27 @@
\processcommalist[##2]\index}}%
\dodoublegroupempty\domargeaanduidingen}
-\def\complexmacros%
- {\margeaanduidingen\tex}
+\def\complexmacros{\margeaanduidingen\tex }
+\def\complexextras{\margeaanduidingen\relax}
-\def\complexextras%
- {\margeaanduidingen\relax}
+\def\complexelements%
+ {\margeaanduidingen\someelement}
+
+\def\someelement#1{\type{<#1>}}
\definecomplexorsimpleempty\macros
\definecomplexorsimpleempty\extras
+\definecomplexorsimpleempty\elements
+
+\def\showelements{\dodoubleempty\doshowelements}
+
+\def\doshowelements[#1][#2]
+ {\bgroup
+ \processXMLbuffer
+ \typebuffer
+ \setupcolors[\c!status=\v!stop]
+ \showXSDcomponent[#1][#2]
+ \egroup}
% \macros{a,b}
% \macros{a,b}{b}
@@ -373,6 +467,7 @@
\VL \THREE{\bf subsentence symbol and quotes} \VL\SR
\HL
\VL \citaat{#3 #4} \VL \citeer{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\SR
+ \VL \citaat{#3 #4} \VL \citeer{#2} \VL |<||<|#3|>|#4|>| \VL\SR
\HL
\stoptabel
\egroup
@@ -404,7 +499,7 @@
{\doglobal\newcounter\CurrentArgument
\setup}
-\stelkadertekstenin
+\setupframedtexts
[setuptext]
[\c!achtergrond=\v!raster,
\c!kader=\v!uit]
diff --git a/tex/context/base/s-mod-01.tex b/tex/context/base/s-mod-01.tex
index f6426f976..bac50cc8e 100644
--- a/tex/context/base/s-mod-01.tex
+++ b/tex/context/base/s-mod-01.tex
@@ -18,10 +18,10 @@
\unprotect
-\stelkorpsin
+\setupbodyfont
[10pt,ams]
-\taal
+\mainlanguage
[en]
\stelwitruimtein
@@ -60,13 +60,13 @@
\stelnummeringin
[\c!plaats=]
-\stelvoettekstenin
+\setupfootertexts
[\v!rand]
[][\v!paginanummer]
\startmode[single]
- \stelvoettekstenin
+ \setupfootertexts
[\v!marge]
[\tt\Modulefile][]
@@ -74,19 +74,19 @@
\startnotmode[single]
- \stelvoettekstenin
+ \setupfootertexts
[\v!marge]
[\tt\Modulefile][]
[\tt\Modulefile][]
\stopnotmode
-\stelvoettekstenin
+\setupfootertexts
[\v!tekst]
[\CONTEXT]
[\Moduletitle]
-\stelhoofdtekstenin
+\setupheadertexts
[\v!tekst]
[]
[\Modulesubtitle]
@@ -104,7 +104,7 @@
\c!hoofd=\v!leeg]
\stelkopin
- [paragraaf]
+ [\v!paragraaf]
[\c!letter=\ssb,
\c!pagina=\v!rechts]
@@ -113,32 +113,34 @@
[\c!letter=\v!vet,
\c!na=\blanko]
-\stelinhoudin
+\stelsamengesteldelijstin
+ [\v!inhoud]
[\c!breedte=3em,
\c!titeluitlijnen=\v!ja]
-\stelindexin
+\stelregisterin
+ [\v!index]
[\c!balanceren=\v!ja,
\c!aanduiding=\v!nee]
\startnotmode[nocolor]
-\stelkleurenin
+\setupcolors
[\c!status=\v!start]
\stopnotmode
\startnotmode[color]
- \stelkleurenin
+ \setupcolors
[\c!conversie=\v!altijd]
- \steltypenin
+ \setuptyping
[\c!palet=graypretty]
\stopnotmode
-\stelinteractiein
+\setupinteraction
[\c!status=\v!start,
\c!kleur=,
\c!letter=]
diff --git a/tex/context/base/s-pre-19.tex b/tex/context/base/s-pre-19.tex
index e5477e1e6..d924d97bc 100644
--- a/tex/context/base/s-pre-19.tex
+++ b/tex/context/base/s-pre-19.tex
@@ -330,9 +330,6 @@ enddef ;
\starttext
-% \useenvironment[pre-organic]
-% \setupoutput[pdftex]
-
\setupMPvariables[page][alternative=3]
\TitlePage
diff --git a/tex/context/base/setupa.tex b/tex/context/base/setupa.tex
index cf4188b0d..220e3ba38 100644
--- a/tex/context/base/setupa.tex
+++ b/tex/context/base/setupa.tex
@@ -8,15 +8,15 @@
%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.
-\startmessages dutch library: setup
+\startmessages dutch library: setup
title: setup
formula: formule
number: getal
list: lijst
- dimension: maat
+ dimension: maat
mark: markering
reference: verwijzing
command: commando
@@ -24,6 +24,7 @@
name: naam
text: tekst
section: sectie
+sectionnumber: sectienummer
singular: naam enkelvoud
plural: naam meervoud
matrix: n*m
@@ -34,12 +35,12 @@
4: -- wordt nogmaals verwerkt
\stopmessages
-\startmessages english library: setup
+\startmessages english library: setup
title: setup
formula: formula
number: number
list: list
- dimension: dimension
+ dimension: dimension
mark: mark
reference: reference
command: command
@@ -47,10 +48,11 @@
name: name
text: text
section: section
- singular: singular name
- plural: plural name
+sectionnumber: sectionnumber
+ singular: singular name
+ plural: plural name
matrix: n*m
- see: see
+ see: see
1: the characters < and > are globally active!
2: -- is processed
3: -- is undefined
@@ -70,6 +72,7 @@
name: Name
text: Text
section: Abschnitt
+sectionnumber: Abschnittnummer
singular: singular
plural: plural
matrix: n*m
@@ -93,6 +96,7 @@
name: jmeno
text: text
section: sekce
+sectionnumber: sekcecislo % ?
singular: jmeno v singularu
plural: jmeno v pluralu
matrix: n*m
@@ -103,12 +107,12 @@
4: -- je zpracovano znovu
\stopmessages
-\startmessages italian library: setup
+\startmessages italian library: setup
title: setup
formula: formula
number: number
list: list
- dimension: dimension
+ dimension: dimension
mark: mark
reference: reference
command: command
@@ -116,16 +120,17 @@
name: name
text: text
section: section
- singular: singular name
- plural: plural name
+sectionnumber: sectionnumber
+ singular: singular name
+ plural: plural name
matrix: n*m
- see: see
+ see: see
1: the characters < and > are globally active!
2: -- is processed
3: -- is undefined
4: -- is processed again
\stopmessages
-
+
\startmessages romanian library: setup
title: setari
formula: formula
@@ -139,6 +144,7 @@
name: nume
text: text
section: sectiune
+ sectionnumber: sectiunenumar % ?
singular: nume singular
plural: nume pluram
matrix: n*m
@@ -149,9 +155,9 @@
4: -- este procesat din nou
\stopmessages
-% we need some more constants
+% we need some more constants
-\interfacetranslationtrue
+\interfacetranslationtrue
\input mult-sys
\input mult-con
@@ -179,15 +185,18 @@
% zitten, moeten we deze karakters bij verwijzingen
% converteren naar wat onschuldiger varianten.
-\catcode`\<=\active
-\catcode`\>=\active
+\def\stpt#1{{\tttf#1}}
+\def\stpr#1{#1*}
+\def\stpv#1{{\setupvarfont#1}}
-\def<{\lesscharacter}
-\def>{\morecharacter}
+\bgroup \catcode`\<=\active \catcode`\>=\other
-\def\protectmoreless{\def<{@}\def>{@}}
+\gdef \verbatimsetupvariablepart{\def<<##1>>{\stpr{##1}}}
+\gdef \protectsetupvariablepart{\def<<##1>>{\string\stpv{##1}}}
+\gdef\visualizesetupvariablepart{\def<<##1>>{\stpv{##1}}}
+\gdef \naturalsetupvariablepart{\def<<##1>>{\string<\string<##1\string>\string>}}
-\showmessage{setup}{1}{}
+\egroup
% \stelsetupin
% [verwijzing=<0,1,2,3>]
@@ -263,102 +272,40 @@
\def\c!setupref {stp}
\def\??stp {@@stp}
-\def\c!command!%
- {{\setupvarfont\getmessage{setup}{command}}}
-
-\def\c!dimension!%
- {{\setupvarfont\getmessage{setup}{dimension}}}
-
-\def\c!filename!%
- {{\setupvarfont\getmessage{setup}{file}}}
-
-\def\c!identifier!%
- {{\setupvarfont\getmessage{setup}{name}}}
-
-\def\c!character!%
- {{\setupvarfont\getmessage{setup}{character}}}
-
-\def\c!marker!%
- {{\setupvarfont\getmessage{setup}{mark}}}
-
-\def\c!number!%
- {{\setupvarfont\getmessage{setup}{number}}}
-
-\def\c!reference!%
- {{\setupvarfont\getmessage{setup}{reference}}}
-
-\def\c!plural!%
- {{\setupvarfont\getmessage{setup}{plural}}}
-
-\def\c!singular!%
- {{\setupvarfont\getmessage{setup}{singular}}}
-
-\def\c!text!%
- {{\setupvarfont\getmessage{setup}{text}}}
-
-\def\c!formula!%
- {{\setupvarfont\getmessage{setup}{formula}}}
-
-\def\c!font!%
- {{\setupvarfont\getmessage{setup}{file}}}
-
-\def\c!matrix!%
- {{\setupvarfont\getmessage{setup}{matrix}}}
-
-\def\c!list!%
- {{\setupvarfont\getmessage{setup}{list}}}
-
-\def\c!section!%
- {{\setupvarfont\getmessage{setup}{section}}}
-
-\def\c!noargument!%
- {{\setupvarfont\texescape\getmessage{setup}{command}}}
-
-\def\c!oneargument!%
- {{\setupvarfont\texescape\getmessage{setup}{command}\#1}}
-
-\def\c!twoarguments!%
- {{\setupvarfont\texescape\getmessage{setup}{command}\#1\#2}}
-
-\def\c!threearguments!%
- {{\setupvarfont\texescape\getmessage{setup}{command}\#1\#2\#3}}
-
-\def\c!repeat! {\c!opt!{{\setupvarfont n}*}}
-\def\c!arg! {\leftargument\c!dots!\rightargument}
-\def\c!args! {\leftargument..,\c!dots!,..\rightargument}
-\def\c!dis! {\$\$\c!dots!\$\$}
-\def\c!idx! {\leftargument\c!dots!\rightargument}
-\def\c!idxs! {\leftargument..+\c!dots!+..\rightargument}
-\def\c!mat! {\$\c!dots!\$}
-\def\c!nop! {\c!dots!}
-\def\c!fil! {~\c!dots!~}
-\def\c!pos! {(\c!dots!)}
-\def\c!poss! {(\c!dots!,\c!dots!)}
-\def\c!sep! {\texescape\texescape}
-\def\c!ref! {[{\setupvarfont ref}]}
-\def\c!refs! {[{\setupvarfont ref},..]}
-\def\c!val! {[\c!dots!]}
-\def\c!vals! {[..,\c!dots!,..]}
-\def\c!var! {[..=..]}
-\def\c!vars! {[..,..=..,..]}
-\def\c!cmd! {\c!noargument!}
-\def\c!dest! {[\leftargument..\c!ref!\rightargument]}
-\def\c!dests! {[..,\leftargument..\c!refs!\rightargument,..]}
-\def\c!trip! {[x:y:z=]}
-\def\c!trips! {[x:y:z=,..]}
-\def\c!wrd! {\leftargument\c!dots!\rightargument}
-\def\c!wrds! {\leftargument.. \c!dots!\ ..\rightargument}
-\def\c!par! {\texescape par}
-\def\c!opt! #1{{\setupoptfont{#1}}}
+\def\c!setup!variable!#1{{\setupvarfont\getmessage{setup}{#1}}}
+\def\c!setup!command! #1{{\setupvarfont\texescape\getmessage{setup}{command}#1}}
+
+\def\c!command! {\c!setup!variable!{command}}
+\def\c!dimension! {\c!setup!variable!{dimension}}
+\def\c!filename! {\c!setup!variable!{file}}
+\def\c!identifier! {\c!setup!variable!{name}}
+\def\c!character! {\c!setup!variable!{character}}
+\def\c!marker! {\c!setup!variable!{mark}}
+\def\c!number! {\c!setup!variable!{number}}
+\def\c!reference! {\c!setup!variable!{reference}}
+\def\c!plural! {\c!setup!variable!{plural}}
+\def\c!singular! {\c!setup!variable!{singula}}
+\def\c!text! {\c!setup!variable!{text}}
+\def\c!formula! {\c!setup!variable!{formula}}
+\def\c!font! {\c!setup!variable!{file}}
+\def\c!matrix! {\c!setup!variable!{matrix}}
+\def\c!list! {\c!setup!variable!{list}}
+\def\c!section! {\c!setup!variable!{section}}
+\def\c!sectionnumber!{\c!setup!variable!{sectionnumber}}
+
+\def\c!noargument! {\c!setup!command!{}}
+\def\c!oneargument! {\c!setup!command!{\#1}}
+\def\c!twoarguments! {\c!setup!command!{\#1\#2}}
+\def\c!threearguments!{\c!setup!command!{\#1\#2\#3}}
+
\def\c!tex! #1{\texescape#1}
\def\c!or! {\hbox spread .25em{\vl}}
\let\redefinesetupconstants=\relax
-% Test:
+% Test:
-\newif\ifbreaksetup
-\def\breaksetup{\ifbreaksetup\allowbreak\fi}
+\newif\ifbreaksetup \def\breaksetup{\ifbreaksetup\allowbreak\fi}
\def\c!repeat! {\breaksetup\c!opt!{{\setupvarfont n}*}\breaksetup}
\def\c!arg! {\breaksetup\leftargument\c!dots!\rightargument\breaksetup}
@@ -376,7 +323,7 @@
\def\c!refs! {\breaksetup[{\setupvarfont ref},\breaksetup..]\breaksetup}
\def\c!val! {\breaksetup[\c!dots!]\breaksetup}
\def\c!vals! {\breaksetup[..,\breaksetup\c!dots!,\breaksetup..]\breaksetup}
-\def\c!var! {\breaksetup[..=..]\breaksetup}
+\def\c!var! {\breaksetup[..=..]\breaksetup}
\def\c!vars! {\breaksetup[..,\breaksetup..=..,\breaksetup..]\breaksetup}
\def\c!cmd! {\breaksetup\c!noargument!\breaksetup}
\def\c!dest! {\breaksetup[\leftargument..\breaksetup\c!ref!\rightargument]\breaksetup}
@@ -410,10 +357,10 @@
[\c!commando=\@@stpcommando,
\c!criterium=\v!alles]
-% verwijzing: 0 geen verwijzingen plaatsen / wel genereren
-% 1 alleen bij zie plaatsen / wel genereren
-% 2 alle verwijzingen plaatsen / niet genereren
-% 3 bij zie commando klikken / wel genereren
+% verwijzing: 0 geen verwijzingen plaatsen / wel genereren
+% 1 alleen bij zie plaatsen / wel genereren
+% 2 alle verwijzingen plaatsen / niet genereren
+% 3 bij zie commando klikken / wel genereren
\newif\ifv!numberingdots!
\newif\ifv!alwaysinteractive!
@@ -482,10 +429,10 @@
{\writesetupparametervalues{#1}{#3}{}}}
{\writesetupparametervalues{#1}{#3}{#5}}}
-\unexpanded\def\inheritsetup#1%
+\unexpanded\def\inheritsetup#1%
{\setsetupreference#1\to\currentsetupinheritance
\ifcase\@@stpverwijzing
- \texescape#1% % njet
+ \texescape#1% % njet
\or
{\op{p}[\currentsetupinheritance]: \texescape#1}% zonder { } probleem
\or
@@ -499,8 +446,7 @@
\def\inheritsetupvalues[#1]#2[#3]%
{\bgroup
\ConvertToConstant\doifelse{#3}{}{\def\next{}}{\def\next{: }}%
- \def<<{\setupvarfont}\def>>{}%
- \protectmoreless
+ \verbatimsetupvariablepart
\value[\getmessage{setup}{see} \inheritsetup{#1}\next#3][]%
\egroup}
@@ -509,23 +455,28 @@
\def\inheritsetupvariables[#1]#2[#3]%
{\bgroup
\ConvertToConstant\doifelse{#3}{}{\def\next{}}{\def\next{: }}%
- \def<<{\setupvarfont}\def>>{}%
- \protectmoreless
+ \verbatimsetupvariablepart
\variable[..=..][\getmessage{setup}{see} \inheritsetup{#1}\next#3][]%
\egroup}
\def\stelsetupin%
{\dodoubleargument\getparameters[\??stp]}
-\def\dowritetexcommand#1<<#2>>#3\\%
+\bgroup \catcode`<=\active
+
+\gdef\dowritetexcommand#1<<#2>>#3\\%
{\texescape#1{\setupvarfont#2}#3}
-\def\writetexcommand#1%
+\gdef\writetexcommand#1%
{\setuptxtfont
- \doifinstringelse{<<}{#1}
+ \convertargument<<\to\asciia
+ \convertargument#1\to\asciib
+ \doifinstringelse{\asciia}{\asciib}
{\dowritetexcommand#1\\}
{\texescape#1}}
+\egroup
+
\xdef\currentsetupreference {}
\xdef\currentsetupinheritance {}
@@ -535,7 +486,7 @@
\def\setsetupreference#1\to#2%
{\bgroup
- \protectmoreless
+ \verbatimsetupvariablepart
\let\subsetup=\subsetupreference
\xdef#2{\c!setupref:#1}%
\egroup}
@@ -570,9 +521,16 @@
\dointeractivesetupsymbol\setupoptcolor
\fi}
-\@EA\def\@EA\c!dostp!\e!start#1<<#2>>#3\\%
+\bgroup \catcode`<=\active
+
+\@EA\gdef\@EA\c!dostp!\e!start#1<<#2>>#3\\%
{\breaksetup~...~\breaksetup\texescape\e!stop#1{\setupvarfont#2}}%
+\gdef\stripsetupstoppart#1%
+ {\@EA\def\@EA\c!stp!\@EA{\@EA\c!dostp!#1<<>>\\}}
+
+\egroup
+
\pushmacro\setuptext
\defineframedtext
@@ -583,15 +541,17 @@
\popmacro\setuptext
-\newif\ifshortsetup
+\newif\ifshortsetup
+
+\newcounter\currentsetupnumber
-\def\dosetupreference%
+\def\dosetupreference%
{\doifundefinedelse{done::\currentsetupreference}
{\pagereference[\currentsetupnumber]%
\pagereference[\currentsetupreference]%
\setgvalue{done::\currentsetupreference}{}}
{\showmessage{setup}{4}{\currentsetupreference}}}
-
+
\def\doprocesssetup\number[#1]\command[#2]\type[#3]#4%
{\bgroup
\showmessage{setup}{2}{#2}%
@@ -600,19 +560,15 @@
\let\variable=\setupvariable
\let\inheritvalues=\inheritsetupvalues
\let\inheritvariables=\inheritsetupvariables
- \@EA\def\@EA\c!stp!\@EA{\@EA\c!dostp!#2<<>>\\}%
+ \stripsetupstoppart{#2}%
\advance\hsize by -\leftskip
\advance\hsize by -\rightskip
\getvalue{\e!start setuptext}
\stelwitruimtein[\v!geen]%
\bgroup
- \def<{}%
- \def>{}%
- \edef\firstcommand{#2*}%
- \let<=\lesscharacter
- \let>=\morecharacter
- \edef\secondcommand{#2}%
- \expanded{\texmacro[\firstcommand]{\noexpand\tex{\secondcommand}}}%
+ \verbatimsetupvariablepart \edef\first {#2*}%
+ \protectsetupvariablepart \edef\second{#2}%
+ \expanded{\texmacro[\first]{\noexpand\stpt{\second}}}%
\egroup
\global\v!dotnumber!=0
\global\v!numberingdots!true
@@ -626,8 +582,8 @@
\fi
\global\v!dotnumber!=0
\ifbreaksetup
- \hangafter1
- \hangindent1em
+ \hangafter1
+ \hangindent1em
\veryraggedright
\else
\hbox to \hsize
@@ -635,6 +591,7 @@
{\let\subsetup=\gobbleoneargument
\redefinesetupconstants
\setuptxtfont\setstrut\strut
+ \visualizesetupvariablepart
\writetexcommand{#2}#3%
\ifbreaksetup\hfill\else\hss\fi
\ifnum\@@stpverwijzing>0
@@ -684,65 +641,66 @@
\fi
\getvalue{\e!stop setuptext}
\egroup}
-
-\newcounter\currentsetupnumber
-
-\def\startsetup#1\command[#2]#3\type[#4]#5\stopsetup%
- {\bgroup
- \def<{}%
- \def>{}%
- \doglobal\increment\currentsetupnumber\relax
- \def\!!stringa{\@@setup#2}%
- \expandafter\setgvalue\expandafter\!!stringa\expandafter
- {\expandafter\doprocesssetup
- \expandafter\number\expandafter[\currentsetupnumber]%
- \command[#2]%
- \type[#4]%
- {#5}}%
- \edef\firstcommand{#2*}%
- \let<=\lesscharacter
- \let>=\morecharacter
- \edef\secondcommand{#2}%
- % 'elk' comes first, else no 'gebruikt' entries are written
- \expanded{\elktexcommando[\firstcommand]{\secondcommand}}%
- % this uggly hack prevents messages
- \let\showmessage=\gobblethreearguments
- % here 'elk' is overruled
- \expanded{\texcommando[\firstcommand]{\secondcommand}}%
- \egroup}
-
+
\def\dosetup#1%
{\protect
- \@@stpvoor
- \bgroup
- \def<{}%
- \def>{}%
+ \verbatimsetupvariablepart
\xdef\globalsetupname{#1}%
- \gebruikcommandos{#1*}%
- \egroup
+ \expanded{\gebruikcommandos{#1*}}%
\doifdefinedelse{\@@setup\globalsetupname}
{\getvalue{\@@setup\globalsetupname}}
{\bgroup
\showmessage{setup}{3}{#1}%
\setuptxtfont [setup \makemessage{setup}{3}{#1}]\endgraf
\egroup}%
+ \egroup
\@@stpna}
\def\setup%
- {\shortsetupfalse
- \unprotect\dosetup}
+ {\@@stpvoor
+ \bgroup
+ \catcode`\<=\@@active
+ \catcode`\>=\@@other
+ \unprotect
+ \shortsetupfalse
+ \dosetup}
\def\shortsetup%
- {\shortsetuptrue
- \unprotect\dosetup}
-
+ {\@@stpvoor
+ \bgroup
+ \catcode`\<=\@@active
+ \catcode`\>=\@@other
+ \unprotect
+ \shortsetuptrue
+ \dosetup}
+
\def\startsetupfile%
- {\unprotect}
+ {\bgroup
+ \catcode`\<=\active
+ \unprotect}
\def\stopsetupfile%
{\protect
+ \egroup
\endinput}
+\def\startsetup#1\command[#2]#3\type[#4]#5\stopsetup%
+ {\bgroup
+ \verbatimsetupvariablepart
+ \doglobal\increment\currentsetupnumber\relax
+ \edef\!!stringa{\@@setup#2}%
+ \expandafter\setgvalue\expandafter\!!stringa\expandafter
+ {\expandafter\doprocesssetup\expandafter
+ \number\expandafter[\currentsetupnumber]%
+ \command[#2]\type[#4]{#5}}%
+ % 'elk' comes first, else no 'gebruikt' entries are written
+ \expanded{\elktexcommando[#2*]{#2}}%
+ % this uggly hack prevents messages
+ \let\showmessage\gobblethreearguments
+ % here 'elk' is overruled
+ \expanded{\texcommando[#2*]{#2}}%
+ \egroup}
+
\let\documenteduntilhere=\relax
\definieerblok [dutch, english, german, czech, italian]
@@ -756,7 +714,9 @@
\c!criterium=\v!gebruikt]
\def\plaatssetup%
- {\getvalue{\e!plaats\e!lijstmet texcommandos}}
+ {\bgroup
+ \getvalue{\e!plaats\e!lijstmet texcommandos}
+ \egroup}
\def\plaatselkesetup% for fun purposes only
{\bgroup
@@ -765,9 +725,14 @@
\getvalue{\e!plaats\e!lijstmet alletexcommandos}%
\egroup}
-\let\setupsetup = \stelsetupin
-\let\placesetup = \plaatssetup
-\let\placeeverysetup= \plaatselkesetup
+\let\setupsetup \stelsetupin
+\let\placesetup \plaatssetup
+\let\placeeverysetup\plaatselkesetup
+
+
+\bgroup \catcode`\<=\active \def<{\lesscharacter} \egroup
+
+% \showmessage{setup}{1}{} \catcode`\<=\active
\protect
diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex
index 6cc744185..7cf6de973 100644
--- a/tex/context/base/setupb.tex
+++ b/tex/context/base/setupb.tex
@@ -13,7 +13,7 @@
% nieuw: oncomment plaatssamengesteldelijst
-% nog 'reductie=ja/nee' in \setupcolors
+% nog 'reductie=ja/nee' in \setupcolors
\startsetupfile
@@ -86,6 +86,9 @@
[\y!setuplanguage]
\type
[\c!val!\c!vars!]
+ \value
+ [\s!nl,\s!fr,\s!en,\s!uk,\s!de,\s!es,\s!cz,..]
+ [\s!nl]
\inheritvariables
[\y!installlanguage]
[]
@@ -484,16 +487,13 @@
\command
[\y!definecolorgroup]
\type
- [\c!val!\c!opt!\c!val!\c!vals!]
+ [\c!val!\c!opt!\c!val!\c!trips!]
\value
[\c!identifier!]
[]
\value
[\v!rgb,\v!cmyk,\v!grijs,\v!s]
[\v!rgb]
- \value
- [\c!trips!]
- []
\stopsetup
\startsetup
@@ -568,7 +568,7 @@
\command
[\y!setuptype]
\type
- [\c!var!]
+ [\c!vars!]
\variable
[\c!spatie]
[\v!aan,\v!uit]
@@ -886,6 +886,10 @@
[\c!bovenoffset]
[\c!dimension!]
[2.5pt]
+ \variable
+ [\c!lijnkleur]
+ [\c!identifier!]
+ []
\stopsetup
\startsetup
@@ -1988,7 +1992,8 @@
\startsetup
\command[\y!lohi]
- \type[\c!arg!\c!arg!]
+ \type[\c!opt!\c!val!\c!arg!\c!arg!]
+ \value[\v!laag][]
\value[\c!text!][]
\value[\c!text!][]
\stopsetup
@@ -3412,7 +3417,7 @@
[\c!text!]
[]
\variable
- [\c!section!\c!number!]
+ [\c!sectionnumber!]
[\v!ja,\v!nee]
[]
\variable
@@ -3420,6 +3425,10 @@
[\c!text!]
[--]
\variable
+ [\c!strut]
+ [\v!ja,\v!nee]
+ [\v!ja]
+ \variable
[\c!status]
[\v!start,\v!stop]
[\v!start]
@@ -3467,9 +3476,12 @@
\startsetup
\command
- [\y!definieerstartstop]
+ [\y!definestartstop]
\type
[\c!val!\c!vars!]
+ \value
+ [\c!identifier!]
+ []
\variable
[\c!voor]
[\c!command!]
@@ -3560,6 +3572,10 @@
[\c!wijze]
[\v!per\v!tekst,\v!per\c!section!]
[\v!per\v!tekst]
+ \variable
+ [\c!scheider]
+ [\c!text!]
+ [.]
\stopsetup
\startsetup
@@ -3809,13 +3825,13 @@
\command
[\y!setupreferencing]
\type
- [\c!var!]
+ [\c!vars!]
\variable
[\c!status]
[\v!start,\v!stop]
[\v!start]
\variable
- [\c!section!\c!number!]
+ [\c!sectionnumber!]
[\v!ja,\v!nee]
[]
\variable
@@ -4047,7 +4063,7 @@
[\v!uit]
\variable
[\c!criterium]
- [\c!section!,\v!lokaal,\v!vorige,\v!alles]
+ [\c!section!,\v!lokaal,\v!vorige,\v!huidige,\v!alles]
[\v!lokaal]
\variable
[\c!paginaovergangen]
@@ -4119,14 +4135,14 @@
[\v!nee]
\variable
[\c!prefix]
- [\v!ja,\v!nee]
+ [\v!ja,\v!nee,\v!geen]
[\v!ja]
\variable
[\c!paginanummer]
[\v!ja,\v!nee]
[\v!ja]
\variable
- [\c!section!\c!number!]
+ [\c!sectionnumber!]
[\v!ja,\v!nee]
[]
\variable
@@ -4160,6 +4176,10 @@
\variable
[\c!scheider]
[\c!text!]
+ [.]
+ \variable
+ [\c!afsluiter]
+ [\c!text!]
[]
\variable
[\c!symbool]
@@ -4311,6 +4331,10 @@
[\c!na]
[\c!dimension!]
[0pt]
+ \variable
+ [\c!scheider]
+ [\c!text!]
+ [.]
\stopsetup
\startsetup
@@ -4832,6 +4856,10 @@
[\c!oneargument!]
[]
\variable
+ [\c!scheider]
+ [\c!text!]
+ [.]
+ \variable
[\c!prefix]
[+,-,\c!text!]
[]
@@ -4927,7 +4955,7 @@
\startsetup
\command
- [\y!stelopsommingin]
+ [\y!setupitemize]
\type
[\c!opt!\c!val!\c!opt!\c!vals!\c!opt!\c!vars!]
\value
@@ -5036,7 +5064,7 @@
\startsetup
\command
- [\y!startopsomming]
+ [\y!startitemize]
\type
[\c!opt!\c!vals!\c!opt!\c!vars!\c!stp!]
\value
@@ -5046,15 +5074,15 @@
\v!kolommen]
[\v!standaard]
\inheritvariables
- [\y!stelopsommingin]
+ [\y!setupitemize]
[]
\stopsetup
-\startsetup \command[\y!som] \type[\c!opt!\c!refs!] \stopsetup
+\startsetup \command[\y!item]\type[\c!opt!\c!refs!] \stopsetup
\startsetup \command[\y!but] \type[\c!alwint!\c!ref!] \stopsetup
\startsetup \command[\y!its] \type[\c!opt!\c!refs!] \stopsetup
\startsetup \command[\y!ran] \type[\c!arg!] \stopsetup
-\startsetup \command[\y!kop] \type[\c!opt!\c!refs!] \stopsetup
+\startsetup \command[\y!head]\type[\c!opt!\c!refs!] \stopsetup
\startsetup \command[\y!mar] \type[\c!opt!\c!refs!\c!arg!] \stopsetup
\startsetup \command[\v!sub] \type[\c!opt!\c!refs!] \stopsetup % no \y!sub
\startsetup \command[\y!sym] \type[\c!arg!] \stopsetup
@@ -5117,7 +5145,7 @@
[\v!ja,\v!nee]
[\v!nee]
\variable
- [\c!section!\c!number!]
+ [\c!sectionnumber!]
[\v!ja,\v!nee]
[]
\variable
@@ -5533,6 +5561,10 @@
[\v!stop,\v!start]
[\v!stop]
\variable
+ [\c!paginastatus]
+ [\v!stop,\v!start]
+ [\v!stop]
+ \variable
[\c!kleur]
[\c!identifier!]
[]
@@ -5560,10 +5592,9 @@
[\y!currentdate]
\type
[\c!vals!]
- \value
- [\v!dag,\v!maand,\v!weekdag,\v!jaar, % \v!WEEKDAG,\v!MAAND,
- dd,mm,jj,yy,d,m,j,y,\v!kenmerk]
- [\v!dag,\v!maand,\v!jaar]
+ \inheritvalues
+ [\y!date]
+ []
\stopsetup
\startsetup
@@ -5583,9 +5614,10 @@
[y]
[\c!number!]
[]
- \inheritvalues
- [\y!currentdate]
- []
+ \value
+ [\v!dag,\v!maand,\v!weekdag,\v!jaar, % \v!WEEKDAG,\v!MAAND,
+ dd,mm,jj,yy,d,m,j,y,\v!kenmerk]
+ [\v!dag,\v!maand,\v!jaar]
\stopsetup
\startsetup
@@ -6397,6 +6429,14 @@
[\c!letter]
[\v!normaal,\v!vet,\v!schuin,\v!vet\v!schuin,\v!type,\v!kap,\v!klein...,\c!command!]
[\v!normaal]
+ \variable
+ [\c!kleur]
+ [\c!identifier!]
+ []
+ \variable
+ [\c!plaats]
+ [\v!tekst,\v!marge]
+ [\v!marge]
\stopsetup
\startsetup
@@ -7985,13 +8025,7 @@
\command
[\y!remark]
\type
- [\c!poss!\c!poss!\c!vars!\c!arg!]
- \value
- [\c!number!]
- []
- \value
- [\c!number!]
- []
+ [\c!pos!\c!pos!\c!vars!\c!arg!]
\value
[\c!number!]
[]
@@ -8272,9 +8306,6 @@
[\v!label,\v!horizontaal,\v!vertikaal,\v!kader]
[]
\inheritvariables
- [\y!framed]
- []
- \inheritvariables
[\y!setupfields]
[]
\stopsetup
@@ -8290,9 +8321,6 @@
\value
[\v!reset,\v!label,\v!horizontaal,\v!vertikaal,\v!kader]
[]
- \inheritvariables
- [\y!framed]
- []
\variable
[\c!n]
[\c!number!]
@@ -8374,6 +8402,9 @@
[\c!veldachtergrondkleur]
[\c!identifier!]
[]
+ \inheritvariables
+ [\y!framed]
+ []
\stopsetup
\startsetup
diff --git a/tex/context/base/setupd.tex b/tex/context/base/setupd.tex
index 0cd91b802..861efe0c4 100644
--- a/tex/context/base/setupd.tex
+++ b/tex/context/base/setupd.tex
@@ -1,7 +1,7 @@
%D \module
-%D [ file=setupa,
+%D [ file=setupd,
%D version=1998.07.20,
-%D title=\CONTEXT\ Setup Definitions,
+%D title=\CONTEXT\ Setup to TWS,
%D subtitle=Help Generation,
%D author=Hans Hagen,
%D date=\currentdate,
@@ -38,6 +38,7 @@
\copymessage \c!matrix! * {matrix}
\copymessage \c!list! * {list}
\copymessage \c!section! * {section}
+\copymessage \c!sectionnumber! * {sectionnumber}
\copymessage \c!noargument! \empty {command}
\copymessage \c!oneargument! \empty {command}
\copymessage \c!twoarguments! \empty {command}
@@ -149,6 +150,7 @@
\long\def\startsetup#1\stopsetup % the :'s serve as breakpoints
{\bgroup
+ \naturalsetupvariablepart
\long\def\command [##1]%
{\immediate\write\scratchwrite{com:##1:}}%
\long\def\type [##1]%
diff --git a/tex/context/base/setupe.tex b/tex/context/base/setupe.tex
new file mode 100644
index 000000000..2d3e4b60e
--- /dev/null
+++ b/tex/context/base/setupe.tex
@@ -0,0 +1,310 @@
+%D \module
+%D [ file=setupe,
+%D version=2001.10.24,
+%D title=\CONTEXT\ Setup to XML
+%D subtitle=Help 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.
+
+\let\wait\relax
+
+\input setupa
+
+\unprotect
+
+\def\SETUPnamespace{xmlns:cd="http://www.pragma-ade.com/commands"}
+
+\def\c!command! {cd:command}
+\def\c!dimension! {cd:dimension}
+\def\c!filename! {cd:file}
+\def\c!identifier! {cd:name}
+\def\c!character! {cd:character}
+\def\c!marker! {cd:mark}
+\def\c!number! {cd:number}
+\def\c!reference! {cd:reference}
+\def\c!plural! {cd:plural}
+\def\c!singular! {cd:singular}
+\def\c!text! {cd:text}
+\def\c!formula! {cd:formula}
+\def\c!font! {cd:file}
+\def\c!matrix! {cd:matrix}
+\def\c!list! {cd:list}
+\def\c!section! {cd:section}
+\def\c!sectionnumber! {cd:sectionnumber}
+\def\c!noargument! {cd:noargument}
+\def\c!oneargument! {cd:oneargument}
+\def\c!twoarguments! {cd:twoarguments}
+\def\c!threearguments! {cd:threearguments}
+
+\def\subsetup#1{*#1} % ?
+
+\beginTEX
+
+\def\getinterfaceconstant#1%
+ {\ifinterfacetranslation
+ \ifx\csname\x!prefix!#1\endcsname\relax
+ #1\else\csname\x!prefix!#1\endcsname
+ \fi
+ \else
+ #1%
+ \fi}
+
+\def\getinterfacevariable#1%
+ {\ifinterfacetranslation
+ \ifx\csname\y!prefix!#1\endcsname\relax
+ #1\else\csname\y!prefix!#1\endcsname
+ \fi
+ \else
+ #1%
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\getinterfaceconstant#1%
+ {\ifinterfacetranslation
+ \ifcsname\x!prefix!#1\endcsname
+ \csname\x!prefix!#1\endcsname\else#1%
+ \fi
+ \else
+ #1%
+ \fi}
+
+\def\getinterfacevariable#1%
+ {\ifinterfacetranslation
+ \ifcsname\y!prefix!#1\endcsname
+ \csname\y!prefix!#1\endcsname\else#1%
+ \fi
+ \else
+ #1%
+ \fi}
+
+\endETEX
+
+\let\typespec\empty
+
+\long\def\dovalvar#1%
+ {\increment\currentwhatever
+ \scratchcounter=0
+ \dostring{\space\space\space\space}{}{#1\typespec}
+ \let\typespec\empty
+ \currentsetup
+ \let\typespec\empty
+ \dostring{\space\space\space\space}{/}{#1}}
+
+\long\def\doanother#1%
+ {\dostring{\space\space\space\space}{}{#1\typespec/}
+ \let\typespec\empty}
+
+\long\def\addtypespec#1#2%
+ {\edef\typespec{\typespec\space#1="#2"}}
+
+\def\c!opt! {\addtypespec{optional}{yes}}
+\def\c!optint! {\addtypespec{interactive}{yes}}
+\def\c!alwint! {\addtypespec{interactive}{exclusive}}
+
+\def\c!val! {\dovalvar{keywords}}
+\def\c!var! {\dovalvar{assignments}}
+
+\def\c!vals! {\addtypespec{list}{yes}\dovalvar{keywords}}
+\def\c!vars! {\addtypespec{list}{yes}\dovalvar{assignments}}
+
+\def\c!arg! {\doanother{content}}
+\def\c!cmd! {\doanother{command}}
+\def\c!dest! {\doanother{reference}}
+\def\c!dis! {\doanother{displaymath}}
+\def\c!fil! {\doanother{file}}
+\def\c!idx! {\doanother{index}}
+\def\c!mat! {\doanother{math}}
+\def\c!nop! {\doanother{nothing}}
+\def\c!pos! {\doanother{position}}
+\def\c!ref! {\doanother{reference}}
+\def\c!trip! {\doanother{triplet}}
+\def\c!wrd! {\doanother{word}}
+
+\def\c!args! {\addtypespec{list}{yes}\c!arg!}
+\def\c!dests! {\addtypespec{list}{yes}\c!dest!}
+\def\c!idxs! {\addtypespec{list}{yes}\c!idx!}
+\def\c!poss! {\addtypespec{list}{yes}\c!pos!}
+\def\c!refs! {\addtypespec{list}{yes}\c!ref!}
+\def\c!wrds! {\addtypespec{list}{yes}\c!wrd!}
+\def\c!trips! {\addtypespec{list}{yes}\c!trip!}
+
+\def\c!par! {\addtypespec{delimiter}{par}} % \par
+\def\c!sep! {\addtypespec{separator}{backslash}} % \\
+\def\c!stp! {}
+
+\def\c!repeat! {}
+\def\c!tex! #1{\addtypespec{command}{#1}\doanother{tex}}
+\def\c!or! {}
+
+% wrapper
+
+\def\startsetupfile
+ {\immediate\openout\scratchwrite=cont-\currentlanguage.xml
+ \doline{\string<?xml version="1.0"?>}
+ \doline{}
+ \dostring{}{}{interface \SETUPnamespace\space name="context"}}
+
+\def\stopsetupfile
+ {\doline{}
+ \dostring{}{/}{interface}
+ \immediate\closeout\scratchwrite}
+
+\let\documenteduntilhere\relax
+
+\bgroup \catcode`\<=\@@other
+
+\unexpanded\gdef\dostring#1#2#3{\immediate\write\scratchwrite{#1<#2cd:#3>}}
+ \gdef\doline #1{\immediate\write\scratchwrite{#1}}
+
+\egroup
+
+\def\doval#1#2#3%
+ {\doifelse{#1}{#3}
+ {\def\valattr{ default="yes"}}
+ {\let\valattr\empty}%
+ \doifdefinedelse{c!#3!}
+ {\dostring{#2}{}{variable type="cd:#3"\valattr/}}
+ {\dostring{#2}{}{constant type="#3"\valattr/}}}
+
+\long\def\docommand[#1]%
+ {\def\currentname{#1}}
+
+\long\def\dotype[#1]%
+ {\def\currenttype{#1}}
+
+\long\def\dovalue[#1]#2[#3]%
+ {\advance\scratchcounter 1
+ \ifnum\scratchcounter=\currentwhatever\relax
+ \processcommalist[#1]{\doval{#3}{\space\space\space\space\space\space}}
+ \fi}
+
+\newif\ifinvariables
+
+\long\def\dovariable[#1]#2[#3]#4[#5]% comes as sequence
+ {\ifinvariables\else\advance\scratchcounter 1 \fi
+ \ifnum\scratchcounter=\currentwhatever\relax
+ \invariablestrue
+ \dostring{\space\space\space\space\space\space}{}%
+ {parameter name="\getinterfaceconstant{#1}"}
+ \processcommalist[#3]
+ {\doval{}{\space\space\space\space\space\space\space\space}}
+ \dostring{\space\space\space\space\space\space}{/}{parameter}
+ \fi}
+
+\long\def\doinheritvalues[#1]#2[#3]%
+ {\advance\scratchcounter 1
+ \ifnum\scratchcounter=\currentwhatever\relax
+ \dostring{\space\space\space\space\space\space}{}{inherit name="#1"/}
+ \fi}
+
+\long\def\doinheritvariables[#1]#2[#3]%
+ {\ifinvariables\else \advance\scratchcounter 1 \fi
+ \ifnum\scratchcounter=\currentwhatever\relax
+ \dostring{\space\space\space\space\space\space}{}{inherit name="#1"/}
+ \fi}
+
+\long\def\nocommand [#1]{}
+\long\def\notype [#1]{}
+\long\def\novalue [#1]#2[#3]{}
+\long\def\novariable [#1]#2[#3]#4[#5]{}
+\long\def\noinheritvalues [#1]#2[#3]{}
+\long\def\noinheritvariables[#1]#2[#3]{}
+
+\bgroup \catcode`\<=\active
+
+\gdef\cleanupcurrentname{\def<<##1>>{##1}}
+
+\gdef\findvariablename#1%
+ {\bgroup
+ \def<<##1>>{\gdef\varname{##1}}%
+ \global\let\varname\empty
+ \setbox\scratchbox=\hbox{#1}%
+ \egroup}
+
+\gdef\splitcurrentname{\@EA\dosplitcurrentname\currentname<<>><<>>\end}
+
+\gdef\dosplitcurrentname#1<<#2>>#3<<>>#4\end
+ {\def\prename{#1}\def\midname{#2}\def\posname{#3}}
+
+\egroup
+
+\newif\ifsetupisenvironment
+
+\long\def\startsetup#1\stopsetup
+ {\bgroup
+ \doline{}
+ % zero pass
+ \long\def\currentsetup{#1}
+ % first pass
+ \let\command \docommand
+ \let\type \dotype
+ \let\value \novalue
+ \let\variable \novariable
+ \let\inheritvalues \noinheritvalues
+ \let\inheritvariables\noinheritvariables
+ \currentsetup
+ % second pass
+ \convertargument\c!stp!\to\asciia
+ \convertcommand\currenttype\to\asciib
+ \let\envattr\empty
+ \let\prename\empty
+ \let\midname\empty
+ \let\posname\empty
+ \ExpandBothAfter\doifinstringelse{\asciia}{\asciib}
+ {\expandafter\aftersplitstring\currentname\at start\to\currentname
+ \def\envattr{ type="environment"}}
+ {} % \def\envattr{ type="standalone"}}
+ \convertargument<<\to\asciic
+ \convertcommand\currentname\to\asciid
+ \findvariablename\currentname
+ \ExpandBothAfter\doifinstringelse{\asciic}{\asciid}
+ {\edef\envattr{\envattr\space generated="yes"}}
+ {} % \edef\envattr{\envattr\space generated="no"}}
+ \splitcurrentname
+ \cleanupcurrentname
+ \dostring{}{}{command name="\currentname"\envattr}
+ \def\next##1%
+ {\ifx##1\empty
+ % skip
+ \else\ifx##1\varname
+ \dostring{\space\space\space\space}{}{variable value="##1"/}
+ \else
+ \dostring{\space\space\space\space}{}{string value="##1"/}
+ \fi\fi}
+ \dostring{\space\space}{}{sequence}
+ \next\prename
+ \next\midname
+ \next\posname
+ \dostring{\space\space}{/}{sequence}
+ \ifx\currenttype\empty \else
+ \dostring{\space\space}{}{arguments}
+ \let\command \nocommand
+ \let\type \notype
+ \let\value \dovalue
+ \let\variable \dovariable
+ \let\inheritvalues \doinheritvalues
+ \let\inheritvariables\doinheritvariables
+ \newcounter\currentwhatever \currenttype
+ \dostring{\space\space}{/}{arguments}
+ \fi
+ \dostring{}{/}{command}
+ \egroup}
+
+\let\stopsetup\relax
+
+\def\convertsetupdata#1#2% only accept #1=\v!whatever
+ {\doifsystemconstantelse{#1}{\edef#2{#1}}{\let#2\empty}}
+
+\input setupb
+
+\protect
+
+\end
diff --git a/tex/context/base/spec-def.tex b/tex/context/base/spec-def.tex
new file mode 100644
index 000000000..ea1fdd192
--- /dev/null
+++ b/tex/context/base/spec-def.tex
@@ -0,0 +1,893 @@
+%D \module
+%D [ file=spec-def,
+%D version=1996.01.25,
+%D title=\CONTEXT\ Special Macros,
+%D subtitle=Definitions,
+%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 used to be integrated in \type {spec-ini},
+%D but testing optimization is more convenient this way.
+
+\writestatus{loading}{Context Special Macros / Definitions}
+
+%D The following libraries are defined. Two postscript
+%D drivers are supported, as well as two mechanisms for
+%D interactive texts.
+%D
+%D \startregelcorrectie
+%D \starttabel[|l|l|l|l|l|]
+%D \HL
+%D \NC \bf file \NC
+%D \bf name \NC
+%D \bf calls \NC
+%D \bf support \NC
+%D \bf program / driver \NC\SR
+%D \HL
+%D \NC \tttf spec-tex \NC
+%D \tttf tex \NC
+%D \NC
+%D Generic \TEX\ (\DVI) \NC
+%D (default) \NC\FR
+%D \NC \tttf spec-tpd \NC
+%D \tttf \PDF \NC
+%D \NC
+%D Han The Thanh \NC
+%D (pdftex) \NC\MR
+%D \NC \tttf spec-ps \NC
+%D \tttf postscript \NC
+%D \NC
+%D Adobe PostScript \NC
+%D (default) \NC\MR
+%D \NC \tttf spec-tr \NC
+%D \tttf rokicki \NC
+%D \tttf postscript \NC
+%D Thomas Rokicki \NC
+%D (dvips) \NC\MR
+%D \NC \tttf spec-yy \NC
+%D \tttf yandy \NC
+%D \tttf postscript \NC
+%D YandY \NC
+%D (dvipsone, dviwindo) \NC\MR
+%D \NC \tttf spec-pdf \NC
+%D \tttf pdf \NC
+%D \NC
+%D Adobe PDF \NC
+%D (Acrobat) \NC\MR
+%D \NC \tttf spec-win \NC
+%D \tttf dviwindo \NC
+%D YandY \NC
+%D (dviwindo) \NC\MR
+%D \NC \tttf spec-htm \NC
+%D \tttf html \NC
+%D \NC
+%D HTML V 2.0 \NC
+%D (dvips) \NC\LR
+%D \HL
+%D \stoptabel
+%D \stopregelcorrectie
+
+%D \macros
+%D {dostartgraymode,dostopgraymode,
+%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,dostopcolormode}
+%D
+%D Switching to and from color can be done in two ways:
+%D
+%D \startopsomming[opelkaar,n]
+%D \som insert driver specific commands
+%D \som pass instructions to the output device
+%D \stopopsomming
+%D
+%D The first approach is more general and lays the
+%D responsibility at the driver side. Probably due to the fact
+%D that \TEX\ does not directly support color, we have been
+%D confronted for the last few years with changing special
+%D definitions. The need for support depends on how a macro
+%D package handles colored text that crosses the page boundary.
+%D Again, there are two approaches.
+%D
+%D \startopsomming[opelkaar,n]
+%D \som let \TEX\ do the job
+%D \som let the driver handle things
+%D \stopopsomming
+%D
+%D The first approach is as driver independant as possible and
+%D can easily be accomplished by using \TEX's mark mechanism.
+%D In \CONTEXT\ we follow this approach. More and more, drivers
+%D are starting to support color, including stacking them.
+%D
+%D Colors as well as grayscales can be represented in scales
+%D from~0 to~1. When drivers use values in the range 0..255,
+%D this value has to be adapted in the translation process.
+%D Technically it's possible to get a grayscale from combining
+%D colors. In the \kap{RGB} color system, a color with Red,
+%D Green and Blue components of 0.80 show the same gray as a
+%D Gray Scale specified 0.80. The \kap{CMYK} color system
+%D supports a Black component apart from Cyan, Magenta and
+%D Yellow.
+%D
+%D Depending on the target format, color support differs from
+%D gray support. PostScript for example offers different
+%D operators for setting gray and color. This is because
+%D printing something using three colors is someting else than
+%D printing with just black.
+%D
+%D In \CONTEXT\ we have implemented a color subsystem that
+%D supports the use of well defined colors that, when printed
+%D in black and white, still can be distinguished. This
+%D approach enables us to serve both printed and electronic
+%D versions, using colored text and illustrations. More on the
+%D fundamentals of this topic can be found in the \kap{MAPS} of
+%D the Dutch User Group, 14 (95.1).
+%D
+%D To satisfy all those needs, we define four specials which
+%D supply enough information for drivers to act upon. We
+%D could have used more general commands with the keywords
+%D 'rgb' and 'gray', but because these specials are used often,
+%D we prefer the more direct and shorter alternative.
+%D
+%D We start with the installation of color and grayscale
+%D specials. The values are in the range 0..1 (e.g. 0.25).
+%D
+%D \starttypen
+%D \dostartgraymode {gray} ... \dostopgraymode
+%D \dostartrgbcolormode {red} {green} {blue} ... \dostopcolormode
+%D \dostartcmykcolormode {cyan} {magenta} {yellow} {black} ... \dostopcolormode
+%D \dostartgraycolormode {gray} ... \dostopcolormode
+%D \stoptypen
+%D
+%D Because we can expect conflicts between drivers, we
+%D implement them as category \type{or}. In previous versions
+%D of \DVIPSONE\ the use of their color||specials did not
+%D interfere with the PostScript ones, but recent versions do.
+
+\installspecial [\dostartgraymode] [or] [1]
+\installspecial [\dostopgraymode] [or] [0]
+
+\installspecial [\dostartrgbcolormode] [or] [3]
+\installspecial [\dostartcmykcolormode] [or] [4]
+\installspecial [\dostartgraycolormode] [or] [1]
+\installspecial [\dostopcolormode] [or] [0]
+
+%D For some drivers, the stop special is of no use and can
+%D simply call the start one with zero arguments.
+
+%D \macros
+%D {doinsertfile}
+%D
+%D Probably the most problematic special is the following
+%D one. Because we want to be able to support different
+%D schemes, we pass a lot of data to it.
+%D
+%D The support of inserting files (like illustrations) comes in
+%D many flavors. Some drivers use scales, some take dimensions.
+%D Some need offsets and others act on stored characteristics.
+%D They need one thing in common: a filename. Although separate
+%D specials for different formats sometimes are more clear, we
+%D decided to combine them all in one:
+%D
+%D \starttypen
+%D \doinsertfile {type,method} {file,label}
+%D {xscale} {yscale} {x} {y} {w} {h}
+%D {options}
+%D \stoptypen
+%D
+%D The scale is given percents, the other values are base
+%D points.
+%D
+%D The special is implemented as \type{or}. Because \DVIPSONE\
+%D understands them all, a chain of alternatives would generate
+%D multiple occurrences of the same illustration.
+%D
+%D When option 1 is passed, the viewers is asked to present a
+%D preview, like the first frame of a movie.
+
+\installspecial [\doinsertfile] [or] [9]
+
+%D No start||stop construction is needed here, because there in
+%D no further interference of \TEX. All dimensions are output
+%D in points and scales as a number, where 100 equal 100\%. (We
+%D used to pass scaled points).
+
+%D \macros
+%D {doinsertsoundtrack}
+%D
+%D Sounds are (for the moment) just files with
+%D associated options.
+%D
+%D \starttypen
+%D \doinsertsoundtrack {file} {label} {options}
+%D \stoptypen
+
+\installspecial [\doinsertsoundtrack] [or] [3]
+
+%D \macros
+%D {dogetnofinsertpages}
+%D
+%D Some file formats support more than one page, like \PDF,
+%D and for special applications, one may want to have access
+%D to the total number of pages.
+%D
+%D \starttypen
+%D \dogetnofinsertpages{filename}
+%D \stoptypen
+%D
+%D The number is also available after the insert is placed,
+%D since inclusion may take place immediate when an insert is
+%D called upon.
+
+\def\nofinsertpages{1} % one of the few 'talk backs'
+
+\installspecial [\dogetnofinsertpages] [or] [1]
+
+%D \macros
+%D {dostartrotation,
+%D dostoprotation}
+%D
+%D We support rotation with the special:
+%D
+%D \starttypen
+%D \dostartrotation {angle} ... \dostoprotation
+%D \stoptypen
+%D
+%D For the moment these specials are installed as
+%D category \type{or}.
+
+\installspecial [\dostartrotation] [or] [1]
+\installspecial [\dostoprotation] [or] [0]
+
+%D \macros
+%D {dostartscaling,
+%D dostopscaling}
+%D
+%D Scaling is also supported:
+%D
+%D \starttypen
+%D \dostartscaling {x} {y} ... \dostopscaling
+%D \stoptypen
+%D
+%D Like the previous one, these specials are of category
+%D \type{or}.
+
+\installspecial [\dostartscaling] [or] [2]
+\installspecial [\dostopscaling] [or] [0]
+
+%D \macros
+%D {dostartmirroring,
+%D dostopmirroring}
+%D
+%D And indeed, mirroring is there too:
+%D
+%D \starttypen
+%D \dostartmirroring {x} {y} ... \dostopmirroring
+%D \stoptypen
+%D
+%D Again these specials are installed as category \type{or}.
+
+\installspecial [\dostartmirroring] [or] [0]
+\installspecial [\dostopmirroring] [or] [0]
+
+%D \macros
+%D {dostartnegative,
+%D dostopnegative}
+%D
+%D When producing output for an image setter, negating the
+%D page comes into view. Here are the tools:
+
+\installspecial [\dostartnegative] [or] [0]
+\installspecial [\dostopnegative] [or] [0]
+
+%D \macros
+%D {doselectfirstpaperbin,
+%D doselectsecondpaperbin}
+%D
+%D Here are some very printer||specific ones. No further
+%D comment.
+
+\installspecial [\doselectfirstpaperbin] [or] [0]
+\installspecial [\doselectsecondpaperbin] [or] [0]
+
+%D \macros
+%D {doovalbox}
+%D
+%D When we look at the implementation, this is a complicated
+%D one. There are seven arguments.
+%D
+%D \starttypen
+%D \doovalbox {w} {h} {d} {linewidth} {radius} {stroke} {fill}
+%D \stoptypen
+%D
+%D This command has to return a \type{\vbox} which can be used
+%D to lay over another one (with text). The radius is in
+%D degrees, the stroke and fill are~\type{1} (true) of~\type{0}
+%D (false).
+
+\installspecial [\doovalbox] [or] [7]
+
+%D \macros
+%D {dostartclipping,dostopclipping}
+%D
+%D Clipping is implemented in such a way that an arbitrary
+%D can be fed.
+%D
+%D \starttypen
+%D \dostartclipping {pathname}{width} {height}
+%D \dostopclipping
+%D \stoptyping
+%D
+%D
+
+\installspecial [\dostartclipping] [or] [3]
+\installspecial [\dostopclipping] [or] [0]
+
+%D \macros
+%D {dosetupidentity}
+%D
+%D We can declare some characteristics of the document with
+%D
+%D \starttypen
+%D \dosetupidentity {title} {subject} {author} {creator} {date}
+%D \stoptypen
+%D
+%D All data is in string format.
+
+\installspecial [\dosetupidentity] [and] [5]
+
+%D \macros
+%D {dosetuppaper}
+%D
+%D This special can be used to tell the driver what page size
+%D to use. The special takes three arguments.
+%D
+%D \starttypen
+%D \dosetuppaper {type} {width} {height}
+%D \stoptypen
+%D
+%D The type is one of the common identifiers, like A4, A5 or
+%D B2.
+
+\installspecial [\dosetuppaper] [and] [3]
+
+%D \macros
+%D {dosetupprinter}
+%D
+%D Some drivers enable the user to specify the paper type
+%D used and/or page dimensions to be taken into account.
+%D
+%D \starttypen
+%D \dosetupprinter {type} {hoffset} {voffset} {width} {height}
+%D \stoptypen
+%D
+%D The first argument is one of \type{letter}, \type{legal},
+%D \type{A4}, \type{A5} etc. The dimensions are in
+%D basepoints.
+
+\installspecial [\dosetupprinter] [and] [5]
+
+%D \macros
+%D {% dosetuppage,
+%D dosetupopenaction, dosetupclosaction,
+%D dosetupopenpageaction, dosetupclospageaction,
+%D dosetupinteraction,
+%D dosetupscreen,
+%D dosetupviewmode}
+%D
+%D Here come some obscure interactive commands. Probably the
+%D specs will change with the development of the macros that
+%D use them.
+%D
+%D The first ones can be used to set up the interaction.
+%D
+%D \starttypen
+%D \dosetupinteraction
+%D \stoptypen
+%D
+%D Normally this command does nothing but giving a message
+%D that some scheme is supported.
+%D
+%D \starttypen
+%D \dosetupstartaction
+%D \dosetupstopaction
+%D \stoptypen
+%D
+%D These two setup the actions to be executed when the document
+%D is opened and closed.
+%D
+%D The next command sets up the screen. It takes five
+%D arguments:
+%D
+%D \starttypen
+%D \dosetupscreen {hoffset} {voffset} {width} {height} {options}
+%D \stoptypen
+%D
+%D The first four arguments are in points. Option~1 results in a
+%D full screen launch.
+%D
+%D \starttypen
+%D \dosetuppageview {keyword}
+%D \stoptypen
+%D
+%D For the moment we only support \type{fit}.
+
+\installspecial [\dosetupinteraction] [and] [0]
+\installspecial [\dosetupopenaction] [and] [0]
+\installspecial [\dosetupcloseaction] [and] [0]
+\installspecial [\dosetupopenpageaction] [and] [0]
+\installspecial [\dosetupclosepageaction] [and] [0]
+\installspecial [\dosetupscreen] [and] [5]
+\installspecial [\dosetuppageview] [and] [1]
+
+%D \macros
+%D {dostarthide,
+%D dostophide}
+%D
+%D Not every part of the screen is suitable for paper. Menus
+%D for instance have no meaning on an non||interactive medium.
+%D These elements are hidden by means of:
+%D
+%D \starttypen
+%D \dostarthide
+%D \dostophide
+%D \stoptypen
+
+\installspecial [\dostarthide] [or] [0]
+\installspecial [\dostophide] [or] [0]
+
+%D \macros
+%D {dostartgotolocation, dostopgotolocation,
+%D dostartgotorealpage, dostopgotorealpage}
+%D
+%D When we want to support hypertext buttons, again we have
+%D to deal with two concepts.
+%D
+%D \startopsomming[opelkaar,n]
+%D \som let \TEX\ highlight the text
+%D \som let the driver show us where to click
+%D \stopopsomming
+%D
+%D The first approach is the most secure one. It gives us
+%D complete control over the visual appearance of hyper
+%D buttons. The second alternative lets the driver guess what
+%D part of the text needs highlighting. As long as we deal with
+%D not too complicated textual buttons, this is no problem.
+%D It's even a bit more efficient when we take long mid
+%D paragraph active regions into account. When we let \TEX\
+%D handle active sentences {\em for instance marked like this
+%D one}, we have to take care of line- and pagebreaks ourselve.
+%D However, it's no trivial matter to let a driver find out
+%D where things begin and end. Because most hyperlinks can be
+%D found in tables of contents and registers, the saving in
+%D terms of bytes can be neglected and the first approach is a
+%D clear winner.
+%D
+%D The most convenient way of cross||referencing is using named
+%D destinations. A more simple scheme is using page numbers as
+%D destinations. Because the latter alternative can often be
+%D implemented more efficient, and because we cannot be sure
+%D what scheme a driver supports, we always have to supply a
+%D pagenumber, even when we use named destinations.
+%D
+%D To enable a driver to find out what to make active, we have
+%D to provide begin and endpoints, so like with color, we use
+%D pairs of specials. The first scheme can be satisfied with
+%D proper dimensions of the areas to be made active.
+%D
+%D The interactive real work is done by the following four
+%D specials. The reason for providing the first one with both
+%D a label and a number, is a result of the quite poor
+%D implementation of \type{pdfmarks} in version 1.0 of
+%D Acrobat. Because only pagenumbers were supported as
+%D destination, we had to provide both labels (\DVIWINDO) and
+%D pagenumbers (\PDF). Some drivers use start stop pairs.
+%D
+%D \starttypen
+%D \dostartgotolocation {w} {h} {url} {file} {label} {page}
+%D \dostartgotorealpage {w} {h} {url} {file} {page}
+%D \stoptypen
+%D
+%D Their counterparts are:
+%D
+%D \starttypen
+%D \dostopgotolocation
+%D \dostopgotorealpage
+%D \stoptypen
+%D
+%D The internal alternative is used for system||generated
+%D links, the external one for user||generated links. The
+%D Uniform Resource Locator can be used to let the reader
+%D surf the net.
+
+\installspecial [\dostartgotolocation] [and] [6]
+\installspecial [\dostopgotolocation] [and] [0]
+\installspecial [\dostartgotorealpage] [and] [5]
+\installspecial [\dostopgotorealpage] [and] [0]
+
+%D One may wonder why jumps to page and location are not
+%D combined. By splitting them, we enable macro||packages to
+%D force the prefered alternative, while on the other hand
+%D drivers can pick up the alternative desired most.
+
+%D \macros
+%D {dostartgotoJS, doflushJSpreamble}
+%D
+%D Rather special is the option to include and execute
+%D JavaScript code. This is a typical \PDF\ option.
+%D
+%D \starttypen
+%D \dostartgotoJS {w} {h} {script}
+%D \stoptypen
+%D
+%D This not so standard \TEX\ feature should be used with
+%D care. Preamble scripts are flushed by
+%D
+%D \doflushJSpreamble {script}
+
+\installspecial [\dostartgotoJS] [and] [3]
+\installspecial [\dostopgotoJS] [and] [0]
+\installspecial [\doflushJSpreamble][and] [1]
+
+%D \macros
+%D {dostartthisislocation, dostopthisislocation,
+%D dostartthisisrealpage, dostopthisisrealpage}
+%D
+%D Before we can goto some location or page, we have to tell
+%D the system where it can be found. Because some drivers
+%D follow the \SGML\ approach of begin||end tags, we have to
+%D support pairs. A possible extension to this scheme is
+%D supplying coordinates for viewing the text.
+%D
+%D The opposite commands of \type{\dogotosomething} have only
+%D one argument:
+%D
+%D \starttypen
+%D \dostartthisislocation {label}
+%D \dostartthisisrealpage {page}
+%D \stoptypen
+%D
+%D These commands are accompanied by:
+%D
+%D \starttypen
+%D \dostopthisislocation
+%D \dostopthisisrealpage
+%D \stoptypen
+%D
+%D As with all interactive commands's they are installed as
+%D \type{and} category specials.
+
+\installspecial [\dostartthisislocation] [and] [1]
+\installspecial [\dostopthisislocation] [and] [0]
+\installspecial [\dostartthisisrealpage] [and] [1]
+\installspecial [\dostopthisisrealpage] [and] [0]
+
+%D In \CONTEXT\ we don't use the \type{\stopsomething}
+%D macros because we let \TEX\ take care of typographic
+%D issues.
+
+%D \macros
+%D {doresetgotowhereever}
+%D
+%D These and others need:
+
+\installspecial [\doresetgotowhereever] [and] [0]
+
+%D \macros
+%D {dostartexecutecommand, dostopexecutecommand}
+%D
+%D The actual behavior of the next pair of commands depends
+%D much on the viewing engine. Therefore one cannot depend
+%D too much on their support.
+%D
+%D \starttypen
+%D \dostartexecutecommand {w} {h} {command} {options}
+%D \stoptypen
+%D
+%D At least the next commands are supported (more examples
+%D can be found in \type {spec-fdf.tex}:
+%D
+%D \startregelcorrectie\steluitlijnenin[midden]\leavevmode
+%D \starttabel[|l|l|]
+%D \HL
+%D \NC \bf command \NC \bf action \NC\SR
+%D \HL
+%D \NC first \NC go to the first page \NC\FR
+%D \NC previous \NC go to the previous page \NC\MR
+%D \NC next \NC go to the next page \NC\MR
+%D \NC last \NC go to the last page \NC\MR
+%D \NC backward \NC go back to the link list \NC\MR
+%D \NC forward \NC go forward in the link list \NC\MR
+%D \NC print \NC enter print mode \NC\MR
+%D \NC exit \NC exit viewer \NC\MR
+%D \NC close \NC close document \NC\MR
+%D \NC enter \NC enter viewer \NC\MR
+%D \NC help \NC show help on the viewer \NC\LR
+%D \HL
+%D \stoptabel
+%D \stopregelcorrectie
+%D
+%D Options are to be passed as a comma separated list of
+%D assignments.
+
+\installspecial [\dostartexecutecommand] [and] [4]
+\installspecial [\dostopexecutecommand] [and] [0]
+
+%D \macros
+%D {dostartobject,
+%D dostopobject,
+%D doresetobjects,
+%D doinsertobject}
+%D
+%D Reuse of object can reduce the output filesize
+%D considerably. Reusable objects are implemented with:
+%D
+%D \starttypen
+%D \dostartobject{class}{name}{width}{height}{depth}
+%D some typeset material
+%D \dostopobject
+%D \stoptypen
+%D
+%D \starttypen
+%D \doinsertobject{class}{name}
+%D \stoptypen
+%D
+%D The savings can be huge in interactive texts.
+%D
+%D \starttypen
+%D \doresetobjects
+%D \stoptypen
+
+\installspecial [\dostartobject] [or] [5]
+\installspecial [\dostopobject] [or] [0]
+\installspecial [\doinsertobject] [or] [2]
+\installspecial [\doresetobjects] [or] [0]
+
+%D \macros
+%D {doregisterfigure}
+%D
+%D Images can be objects as well and it's up to the driver to
+%D handle this. Alternative images are also up to the driver,
+%D and the next macro tells the driver that the previous image
+%D is somehow followed by another and that both have to be
+%D handled together. This is a rather fuzzy model, but for the
+%D moment it suits its purpose: low res screen versions combined
+%D with high res printable ones.
+
+\installspecial [\doregisterfigure][or] [2]
+
+% %D \macros
+% %D {dogetobjectreference}
+% %D
+% %D For very special purposes, one can ask for the internal
+% %D reference to the object. Beware!
+%
+% \installspecial [\dogetobjectreference] [or] [3]
+%
+% %D The first argument is the name, the second a macro that
+% %D gets the assiciated value.
+
+%D \macros
+%D {dostartrunprogram, dostoprunprogram,
+%D dostartgotoprofile, dostopgotoprofile,
+%D dobeginofprofile,
+%D doendofprofile}
+%D
+%D These specials are still experimental. They are not yet
+%D supported by the programs the way they should be.
+%D
+%D {\em --- still undocumented ---}
+
+\installspecial [\dostartrunprogram] [and] [4]
+\installspecial [\dostoprunprogram] [and] [0]
+\installspecial [\dostartgotoprofile] [and] [3]
+\installspecial [\dostopgotoprofile] [and] [0]
+\installspecial [\dobeginofprofile] [and] [4]
+\installspecial [\doendofprofile] [and] [0]
+
+%D \macros
+%D {doinsertbookmark}
+%D
+%D Bookmarks, that is viewer generated tables of contents, are
+%D a strange phenomena, mainly because \TEX\ can provide
+%D whatever kind of table in much better quality.
+
+\installspecial [\doinsertbookmark] [and] [5]
+
+%D This special is called as:
+%D
+%D \starttypen
+%D \doinstallbookmark {level} {nofsubentries} {text} {page} {open}
+%D \stoptypen
+%D
+%D This definition is very \PDF\ oriented, so for more
+%D information we kindly refer to the \PDF\ manuals.
+
+%D \macros
+%D {dosetpagetransition}
+%D
+%D In presentations, fancy page transitions can, at least for a
+%D short moment, let the audience focus at the screen. Like the
+%D previous one, this special is very \PDF.
+%D
+%D \starttypen
+%D \dosetpagetransition{dissolve}{0}
+%D \stoptypen
+%D
+%D Transitions have symbolic names, like dissolve, box, split,
+%D blinds, wipe and glitter. The second argument determines
+%D the wait time (unless zero).
+
+\installspecial [\dosetpagetransition] [or] [2]
+
+%D \macros
+%D {dopresettextfield,dopresetlinefield,
+%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield,
+%D dopresetbuttonfield,dopresetcheckfield,
+%D dopresetradiofield,dopresetradiorecord}
+%D
+%D The special drivers are programmed independant from their
+%D calling macros are thereby use the standard \TEX\ way of
+%D passing parameters. Unfortunately fields often have more
+%D than nine characteristics, so we pack some arguments in one.
+%D
+%D \starttypen
+%D \dopresettextfield / \dopresetlinefield
+%D {name} {width} {height} {default} {length}
+%D {style,color} {options} {alignment} {actions}
+%D
+%D \dopresetchoicefield / \dopresetpopupfield / \dopresetcombofield
+%D {name} {width} {height} {default}
+%D {style,color} {options} {values} {actions}
+%D
+%D \dopresetpushfield
+%D {name} {width} {height} {default}
+%D {options} {values} {actions}
+%D
+%D \dopresetcheckfield
+%D {name} {width} {height} {default}
+%D {options} {values} {actions}
+%D
+%D \dopresetradiofield
+%D {name} {width} {height} {default}
+%D {options} {parent} {values} {actions}
+%D
+%D \dopresetradiorecord
+%D {name} {top} {options} {kids} {actions}
+%D \stoptypen
+
+\installspecial [\dopresetlinefield] [or] [9]
+\installspecial [\dopresettextfield] [or] [9]
+\installspecial [\dopresetchoicefield] [or] [8]
+\installspecial [\dopresetpopupfield] [or] [8]
+\installspecial [\dopresetcombofield] [or] [8]
+\installspecial [\dopresetpushfield] [or] [7]
+\installspecial [\dopresetcheckfield] [or] [7]
+\installspecial [\dopresetradiofield] [or] [8]
+\installspecial [\dopresetradiorecord] [or] [5]
+
+%D \macros
+%D {dodefinefieldset,dogetfieldset,doiffieldset}
+%D
+%D Field sets, used in resetting and submitting, are handled
+%D by:
+
+\installspecial [\dodefinefieldset] [or] [2]
+\installspecial [\dogetfieldset] [or] [1]
+\installspecial [\doiffieldset] [or] [2]
+
+%D \macros
+%D {dosetfieldstatus}
+%D
+%D For practical reasons we set some field characteristics
+%D using:
+%D
+%D \starttypen
+%D \dosetfieldstatus {mode} {parent} {kids} {root}
+%D \stoptypen
+
+\installspecial [\dosetfieldstatus] [or] [4]
+
+%D with:
+
+\def\fieldlonermode {0} % no \chardef here
+\def\fieldparentmode{1} % no \chardef here
+\def\fieldchildmode {2} % no \chardef here
+\def\fieldcopymode {3} % no \chardef here
+
+%D \macros
+%D {doregistercalculationset}
+%D
+%D We can define a calculation order list with:
+%D
+%D \starttypen
+%D \doregistercalculationset {set identifier}
+%D \stoptypen
+
+\installspecial [\doregistercalculationset] [or] [1]
+
+%D \macros
+%D {doinsertcomment}
+%D
+%D Not so much out of need, but to be complete, we also
+%D implement text annotations, so called comment:
+%D
+%D \starttypen
+%D \doinsertcomment
+%D {title} {width} {height} {color} {open} {symbol} {data}
+%D \stoptypen
+
+\installspecial[\doinsertcomment] [and] [7]
+
+%D \macros
+%D {dosetposition, dosetpositionwhd, dosetpositionplus,
+%D dosetpositionpapersize}
+%D
+%D Not natural to \TEX, but available in \PDFTEX, and by
+%D means of postprocessed \DVI, we can save and call upon
+%D positions.
+%D
+%D \starttypen
+%D \dosetposition {identifier}
+%D \dosetpositionwhd {identifier} {width} {height} {depth}
+%D \dosetpositionplus {identifier} {width} {height} {depth} {list}
+%D \dosetpositionpapersize {width} {height}
+%D \stoptypen
+%D
+%D This is one of the few specials where when using \PDFTEX\
+%D the driver directly deals with the utility file.
+
+\installspecial [\dosetposition] [or] [1]
+\installspecial [\dosetpositionwhd] [or] [4]
+\installspecial [\dosetpositionplus] [or] [5]
+\installspecial [\dosetpositionpapersize] [or] [2]
+
+%D \macros
+%D {dostarttransparency,dostoptransparency}
+%D
+%D \starttypen
+%D \dostarttransparency{fraction}{type}
+%D \dostoptransparency
+%D \stoptypen
+%D
+%D Although in \CONTEXT\ transparency is closely integrated
+%D in the color drivers, in the end it is an independent
+%D feature.
+
+\installspecial [\dostarttransparency] [or] [2]
+\installspecial [\dostoptransparency] [or] [0]
+
+%D Some suitable special collections are defined below.
+
+\defineoutput [dvipsone] [dvi,ps,yy]
+\defineoutput [dviwindo] [dvi,ps,yy,win]
+\defineoutput [dvips] [dvi,ps,tr]
+\defineoutput [dviview] [dvi,ps,tr,dv]
+\defineoutput [dvipdfm] [dpm]
+\defineoutput [pdftex] [tpd]
+\defineoutput [pdf] [tpd]
+\defineoutput [acrobat] [pdf,ps,tr]
+
+%D Please let me know if we need more. From now on we default
+%D to:
+
+\setupoutput [dvips]
+
+%D We don't enable \ACROBAT, because pure \POSTSCRIPT\ is not
+%D that strong on objects and \PDFTEX\ does a better job.
+%D Some reasonable alternatives are:
+%D
+%D \starttypen
+%D \setupoutput [dvipsone,acrobat]
+%D \setupoutput [dviwindo,acrobat]
+%D \stoptypen
+%D
+%D Although, better is:
+%D
+%D \starttypen
+%D \setupoutput [pdftex]
+%D \stoptypen
+
+\protect \endinput
diff --git a/tex/context/base/spec-dpm.tex b/tex/context/base/spec-dpm.tex
index de5b90329..e5d06f3b7 100644
--- a/tex/context/base/spec-dpm.tex
+++ b/tex/context/base/spec-dpm.tex
@@ -11,8 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% untested - sp as unit not supported
-
\unprotect
%D This driver is build on top of the general \PDF\ macros,
@@ -39,8 +37,8 @@
\def\doDPMsetuppaper#1#2#3%
{\bgroup
- \scratchdimen=#2\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#3\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#2\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#3\edef\height{\the\scratchdimen\space}%
\special{pdf: pagesize width \width height \height}%
\global\let\doDPMsetuppaper\gobblethreearguments
\egroup}
@@ -56,16 +54,10 @@
\definespecial\doinsertfile#1#2#3#4#5#6#7#8#9%
{\dodoinsertfile{dpm}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}
-%\definefileinsertion{dpm}{mps}#1#2#3#4#5#6#7#8#9%
-% {\hbox
-% {\convertMPcolors{#1}%
-% \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\xscale
-% \scratchdimen=#4pt \PointsToReal{.01\scratchdimen}\yscale
-% \convertMPtoPDF{#1}\xscale\yscale}}
-
\definefileinsertion{dpm}{mps}#1#2#3#4#5#6#7#8#9%
- {\ScaledPointsToWholeBigPoints{#7}\width
- \ScaledPointsToWholeBigPoints{#8}\height
+ {\PointsToWholeBigPoints{#7}\width
+ \PointsToWholeBigPoints{#8}\height
+ % brrr, should use #1->#9
\special
{PSfile="#1"\space
llx=\EPSllx\space lly=\EPSlly\space
@@ -74,15 +66,15 @@
\definefileinsertion{dpm}{pdf}#1#2#3#4#5#6#7#8#9%
{\bgroup
- \scratchdimen=#7sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#8sp\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#7\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#8\edef\height{\the\scratchdimen\space}%
\special{pdf: epdf width \width height \height (#1)}%
\egroup}
\definefileinsertion{dpm}{jpg}#1#2#3#4#5#6#7#8#9%
{\bgroup
- \scratchdimen=#7pt\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#8pt\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#7\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#8\edef\height{\the\scratchdimen\space}%
\special{pdf: image width \width height \height (#1)}%
\egroup}
@@ -130,8 +122,11 @@
%D Negation is not (yet) supported:
-\definespecial\dostartnegative {}
-\definespecial\dostopnegative {}
+% \definespecial\dostartnegative {}
+% \definespecial\dostopnegative {}
+% \definespecial\dostarttransparency {}
+% \definespecial\dostoptransparency {}
+
%D \macros
%D {dosetupinteraction,
@@ -213,8 +208,8 @@
\definespecial\dobeginofprofile#1#2#3#4%
{\bgroup
\setPDFdestination{#1}%
- \scratchdimen=#2sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#3sp\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#2\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#3\edef\height{\the\scratchdimen\space}%
\doifsomething{\PDFdestination}
{\special
{pdf: thread @ART::\PDFdestination\space
@@ -237,8 +232,8 @@
{\bgroup
\setbox\nextbox=\hbox\bgroup
\dosetobjectreference{#1}{#2}{#1::#2}%
- \scratchdimen=#3sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#4sp\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#3\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#4\edef\height{\the\scratchdimen\space}%
\special{pdf: bxobj @#1::#2 width \width height \height}}
\definespecial\dostopobject%
@@ -311,15 +306,22 @@
\xdef\lastPDFaction{#3}%
\else
\bgroup
- \xdef\lastPDFaction{<<#3>>}%
- % this is yet untested
- % \ifcase\similarreference\relax\or\ifsharePDFactions
- % \global\advance\nofPDFsimilar by 1
- % \special{pdf: object @PDF::sim:\the\nofPDFsimilar\space\lastPDFaction}%
- % \xdef\lastPDFaction{@PDF::sim:\the\nofPDFsimilar}%
- % \fi\fi
- \scratchdimen=#1sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#2sp\edef\height{\the\scratchdimen\space}%
+ % this is yet untested
+ %\ifsharePDFactions
+ % \ifcase\similarreference\relax
+ % \xdef\lastPDFaction{<<#3>>}%
+ % \or
+ % \global\advance\nofPDFsimilar by 1
+ % \special{pdf: object @PDF::sim:\the\nofPDFsimilar\space<<#3>>}%
+ % \xdef\lastPDFaction{@PDF::sim:\the\nofPDFsimilar}%
+ % \else
+ % % leave \lastPDFaction untouched
+ % \fi
+ %\else
+ \xdef\lastPDFaction{<<#3>>}%
+ %\fi
+ \scratchdimen#1\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#2\edef\height{\the\scratchdimen\space}%
\special{pdf: ann width \width height \height
<</Subtype /Link /Border [0 0 0]
\ifhighlighthyperlinks \else /H /N \fi
@@ -329,8 +331,8 @@
\def\doPDFannotation width #1 height #2 data #3%
{\bgroup
- \scratchdimen=#1sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#2sp\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#1\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#2\edef\height{\the\scratchdimen\space}%
\special{pdf: ann width \width height \height
<</Subtype /Link /Border [0 0 0] /A <<#3>>}%
\egroup}
@@ -340,8 +342,8 @@
\def\doPDFannotationobject class #1 name #2 width #3 height #4 data #5%
{\bgroup
- \scratchdimen=#3sp\edef\width {\the\scratchdimen\space}%
- \scratchdimen=#4sp\edef\height{\the\scratchdimen\space}%
+ \scratchdimen#3\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#4\edef\height{\the\scratchdimen\space}%
\special{pdf: ann @#1::#2 width \width height \height <<#5>>}%
\dosetobjectreference{#1}{#2}{@#1::#2}%
\egroup}
@@ -358,6 +360,10 @@
\def\doPDFpagesattribute#1%
{\special{pdf: put @pages <<#1>>}}
+\def\doPDFpageresource#1%
+ {\message{[skipping PDF resource]}}
+
+\let\doPDFresetpageresources =\relax
\let\doPDFresetpageattributes=\relax
%D \macros
@@ -392,6 +398,4 @@
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-dvi.tex b/tex/context/base/spec-dvi.tex
index 97428cbb3..be8fdd73c 100644
--- a/tex/context/base/spec-dvi.tex
+++ b/tex/context/base/spec-dvi.tex
@@ -34,9 +34,9 @@
{\offinterlineskip
\forgetall
\unvbox\DVIobjects
- \setbox\nextbox=\hbox{\box\nextbox}
- \wd\nextbox=\!!zeropoint
- \dp\nextbox=\!!zeropoint
+ \setbox\nextbox\hbox{\box\nextbox}
+ \wd\nextbox\zeropoint
+ \dp\nextbox\zeropoint
\ht\nextbox=\!!onepoint
\allowbreak
\box\nextbox}%
@@ -48,13 +48,13 @@
\definespecial\doinsertobject#1#2%
{\bgroup
\dogetobjectreference{#1}{#2}\DVIobjectreference
- \splittopskip\!!zeropoint
+ \splittopskip\zeropoint
\setbox0=\copy\DVIobjects
\dimen0=\DVIobjectreference pt
- \advance\dimen0 by -\!!onepoint
+ \advance\dimen0 -\!!onepoint
\setbox2=\vsplit0 to \dimen0
\ifdim\ht0>\!!onepoint
- \setbox0=\vsplit0 to \!!onepoint
+ \setbox0=\vsplit0 \!!onepoint
\fi
\unvbox0\setbox0=\lastbox\unhbox0
\egroup}
@@ -106,6 +106,4 @@
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index ee5e75c86..1c8913957 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -31,25 +31,76 @@
%D characters from the destination name.
%D
%D The \ACROBAT\ programs are not bug free. By setting the next
-%D switch, we will at least try to prevent problems.
+%D switches, we will at least try to prevent problems.
-\newif\ifovercomePDFbugs \overcomePDFbugsfalse % true
-\newif\ifovercomePDFspace \overcomePDFspacetrue
+\newif\ifovercomePDFbugs \overcomePDFbugsfalse % dest sort problem / 3-
+\newif\ifovercomePDFspace \overcomePDFspacetrue % dest sort problem / 3-
+\newif\ifovercomePDFpage \overcomePDFpagetrue % pdf spec change / 5+
+
+\chardef\safePDFcode=`-
\def\setPDFdestination#1%
{\bgroup
\obeylccodes
- \lccode`\/=`-\lccode`\#=`-\lccode`\<=`-\lccode`\>=`-%
- \lccode`\[=`-\lccode`\]=`-\lccode`\(=`-\lccode`\)=`-%
- \ifovercomePDFspace
- \stripcharacter{ }\from#1\to\PDFdestination
+ \lccode`\/\safePDFcode \lccode`\#\safePDFcode
+ \lccode`\<\safePDFcode \lccode`\>\safePDFcode
+ \lccode`\[\safePDFcode \lccode`\]\safePDFcode
+ \lccode`\(\safePDFcode \lccode`\)\safePDFcode
+ \ifovercomePDFspace
+ \lccode`\ \safePDFcode
+ \fi
+ \ifovercomePDFbugs
+ \xdef\PDFdestination{'#1'}%
\else
\xdef\PDFdestination{#1}%
\fi
- \@EA\lowercase\@EA{\@EA\xdef\@EA\PDFdestination\@EA
- {\ifovercomePDFbugs'\fi\PDFdestination\ifovercomePDFbugs'\fi}}%
+ \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.
+
+% \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
+%
+% \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}
+%
+% \egroup
+%
+% \def\setPDFdestination#1% expansion is needed, otherwise embedded
+% {\bgroup % macros will not expand under the new
+% \setPDFdcharacters % catcode regime
+% \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
+%
+% \endETEX
+
%D \macros
%D {sanitizePDFstring}
%D
@@ -62,6 +113,8 @@
%D special characters, limit their number and finaly convert
%D some of the characters to save ones.
+%\beginTEX
+
\chardef\maxPDFstringsize=60
\def\sanitizePDFstring#1\to#2%
@@ -89,10 +142,49 @@
\fi}%
%\global\let#2=\empty
% or to permit #2 to be \ascii too:
- \@EA\global\@EA\let\@EA#2\@EA\empty
+ \global\@EA\let\@EA#2\@EA\empty
\@EA\handletokens\ascii\with\docommando
\egroup}
+%\endTEX
+%
+% \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
+%
+% .gdef.setPDFscharacters%
+% {.catcode`.\=.@@other
+% .catcode`./=.@@active .def/{.noexpand./}%
+% .catcode`.<=.@@active .def<{.noexpand.<}%
+% .catcode`.>=.@@active .def>{.noexpand.>}%
+% .catcode`.[=.@@active .def[{.noexpand.[}%
+% .catcode`.]=.@@active .def]{.noexpand.]}%
+% .catcode`.(=.@@active .def({.noexpand.(}%
+% .catcode`.)=.@@active .def){.noexpand.)}}
+%
+% .gdef.sanitizePDFstring#1.to#2%
+% {.bgroup
+% .setPDFscharacters
+% .catcode`=.@@escape
+% .edef.next{.strippedcsname#2}%
+% .scantokens{setxvalue{next}{#1}}%
+% .egroup}
+%
+% .egroup
+%
+% \doifnotmode{atpragma}{\let\sanitizePDFstring\next} % experimental
+%
+% \endETEX
+
%D \macros
%D {doPDFdestination,
%D doPDFaction,
@@ -102,6 +194,7 @@
%D doPDFarrayobject,
%D doPDFaddtocatalog,
%D doPDFpageattribute,
+%D doPDFpageresource,
%D doPDFpagesattribute,
%D doPDFbookmark,
%D defaultobjectreference,
@@ -122,6 +215,7 @@
%D \doPDFarrayobject class #1 name #2 data #3
%D \doPDFaddtocatalog #1
%D \doPDFpageattribute #1
+%D \doPDFpageresource #1
%D \doPDFpagesattribute #1
%D \doPDFbookmark level #1 n #2 text #3 page #4 open #5
%D
@@ -138,20 +232,43 @@
%D Due to the fact that \PDFTEX\ has a different concept of
%D page attributes, we need:
-\let\doPDFresetpageattributes=\relax
+\let\doPDFresetpageattributes\relax
+\let\doPDFresetpageresources \relax
\appendtoksonce
\doPDFresetpageattributes
+ \doPDFresetpageresources
\to \everyshipout
\ifx\PDFcode\undefined
\ifx\pdfliteral\undefined
\def\PDFcode#1{\message{[ignored pdfliteral: #1]}}
\else
- \let\PDFcode=\pdfliteral
+ \let\PDFcode\pdfliteral
\fi
\fi
+%D For special (\METAPOST) effects, we need to build
+%D resource dictionaries. Here is the framework.
+
+\let\docuPDFextgstates\empty
+%let\pagePDFextgstates\empty
+
+\def\checkPDFextgstates
+ {\ifx\docuPDFextgstates\empty \else
+ \ifnum\realpageno=\lastpage\relax
+ \doPDFdictionaryobject class FDF name docuextgstates data
+ {\docuPDFextgstates}%
+ \fi
+ \doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
+ \doPDFpageresource{/ExtGState \PDFobjectreference}%
+ \fi}
+
+\appendtoks \checkPDFextgstates \to \everyshipout
+
+\def\appendtoPDFdocumentextgstates#1%
+ {\xdef\docuPDFextgstates{\docuPDFextgstates\space#1}}
+
%D \macros
%D {doPDFsetupscreen}
%D
@@ -161,20 +278,20 @@
\def\doPDFsetupscreen#1#2#3#4#5#6% watch the extra argument
{\bgroup
- \!!widtha=#4sp
- \advance\!!widtha by #2sp
- \!!heighta=-#5sp
- \!!heightb=#1% extra argument
- \advance\!!heightb by -#3sp
- \advance\!!heighta by \!!heightb
- \ScaledPointsToWholeBigPoints{#2}\left
- \ScaledPointsToWholeBigPoints{\number\!!heighta}\bottom
- \ScaledPointsToWholeBigPoints{\number\!!widtha }\width
- \ScaledPointsToWholeBigPoints{\number\!!heightb}\height
-% \ScaledPointsToBigPoints{#2}\left
-% \ScaledPointsToBigPoints{\number\!!heighta}\bottom
-% \ScaledPointsToBigPoints{\number\!!widtha }\width
-% \ScaledPointsToBigPoints{\number\!!heightb}\height
+ \!!widtha#4%
+ \advance\!!widtha #2%
+ \!!heighta-#5%
+ \!!heightb#1% extra argument
+ \advance\!!heightb -#3%
+ \advance\!!heighta \!!heightb
+ \PointsToWholeBigPoints{#2}\left
+ \PointsToWholeBigPoints\!!heighta\bottom
+ \PointsToWholeBigPoints\!!widtha \width
+ \PointsToWholeBigPoints\!!heightb\height
+% \PointsToBigPoints{#2}\left
+% \PointsToBigPoints\!!heighta\bottom
+% \PointsToBigPoints\!!widtha \width
+% \PointsToBigPoints\!!heightb\height
\xdef\currentPDFcropbox% \doPDFpagesattribute
{/CropBox [\left\space\bottom\space\width\space\height]}%
\xdef\currentPDFpagemode% \doPDFaddtocatalog
@@ -238,17 +355,19 @@
\def\doPDFsetupclosepageaction%
{\global\let\PDFclosepageaction\lastPDFaction}
-\def\checkPDFpageactions%
- {\donefalse
- \ifx\PDFopenpageaction \empty\!!doneafalse\else\donetrue\!!doneatrue\fi
- \ifx\PDFclosepageaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
- \ifdone
- \doPDFpageattribute
- {/AA <<\if!!donea/O <<\PDFopenpageaction >> \fi
- \if!!doneb/C <<\PDFclosepageaction>> \fi>>}%
- \fi
- \global\let\PDFopenpageaction \empty
- \global\let\PDFclosepageaction\empty}
+\def\checkPDFpageactions
+ {\iflocation % important since direct -)
+ \donefalse
+ \ifx\PDFopenpageaction \empty\!!doneafalse\else\donetrue\!!doneatrue\fi
+ \ifx\PDFclosepageaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
+ \ifdone
+ \doPDFpageattribute
+ {/AA <<\if!!donea/O <<\PDFopenpageaction >> \fi
+ \if!!doneb/C <<\PDFclosepageaction>> \fi>>}%
+ \fi
+ \global\let\PDFopenpageaction \empty
+ \global\let\PDFclosepageaction\empty
+ \fi}
\appendtoksonce
\checkPDFpageactions
@@ -266,8 +385,11 @@
\def\doPDFstartthisislocation#1%
{\bgroup
\setPDFdestination{#1}%
- \doifsomething{\PDFdestination}
- {\doPDFdestination name {\PDFdestination}}%
+ %\doifsomething{\PDFdestination}
+ % {\doPDFdestination name {\PDFdestination}}%
+ \ifx\PDFdestination\empty \else
+ \doPDFdestination name {\PDFdestination}%
+ \fi
\egroup}
%D \macros
@@ -316,31 +438,37 @@
\fi
\egroup}
-\def\doPDFstartgotorealpage#1#2#3#4#5%
+\def\PDFgotonewwindow{\ifgotonewwindow\space/NewWindow true \fi}
+
+\def\doPDFstartgotorealpage#1#2#3#4#5% watch the R append trick
{\bgroup
\doifelsenothing{#3}
{\scratchcounter=0#5\relax
\ifnum\scratchcounter>0
- \advance\scratchcounter by -1
- \edef\PDFdestination{\the\scratchcounter}%
+ \advance\scratchcounter -1 % pdf starts numbering at zero
\doifelsenothing{#4}
{\let\PDFfile\empty}
{\doifparentfileelse{#4}
{\let\PDFfile\empty}
{\setreferencefilename#4.\locationfilesuffix\to\PDFfile
- \edef\PDFfile%
- {R /F (\PDFfile)\ifgotonewwindow\space/NewWindow true \fi}}}%
- \edef\action%
- {/S /GoTo\PDFfile\space
- /D [\PDFdestination\PDFpageviewwrd]}%
+ \edef\PDFfile{R /F (\PDFfile)\PDFgotonewwindow}}}%
+ \ifx\PDFfile\empty
+ \ifovercomePDFpage % a named page ref
+ \edef\PDFdestination{(page:\the\scratchcounter)}%
+ \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}%
\else
\let\action\empty
\fi}
{\doifelsenothing{#4}
{\let\PDFfile\empty}
{\setreferencefilename/#4\to\PDFfile}%
- \edef\action%
- {/S /URI /URI (#3\PDFfile)}}%
+ \edef\action{/S /URI /URI (#3\PDFfile)}}%
\ifx\action\empty\else
\ifsecondaryreference
\savesecondaryPDFreference\action
@@ -353,6 +481,18 @@
\fi
\egroup}
+\def\fakePDFpagedestination % as in pdf, we start numbering at zero
+ {\iflocation \ifovercomePDFpage \ifarrangingpages \else
+ \bgroup
+ \advance\realpageno -1 % is \expanded needed ?
+ \expanded{\doPDFdestination name {page:\realfolio}}%
+ \egroup
+ \fi \fi \fi}
+
+\appendtoksonce
+ \fakePDFpagedestination
+\to \everyshipout
+
\def\doPDFstartgotoJS#1#2#3%
{\bgroup
\doPSsanitizeJScode#3\to\sanitizedJScode
@@ -387,7 +527,7 @@
\def\PDFexecutestartsound {\PDFmoviecode1\currentsound0}
\def\PDFexecutestopsound {\PDFmoviecode1\currentsound1}
-\def\PDFexecutespausesound {\PDFmoviecode1\currentsound2}
+\def\PDFexecutepausesound {\PDFmoviecode1\currentsound2}
\def\PDFexecuteresumesound {\PDFmoviecode1\currentsound3}
\def\PDFformcode#1%
@@ -397,7 +537,13 @@
\def\PDFexecuteexportform {/Named /N /AcroForm:ExportFDF}
\def\PDFexecuteresetform {/ResetForm \PDFformcode\argumentA}
\def\PDFexecutesubmitform {/SubmitForm \PDFformcode\argumentB
- /Flags \ifnum\submitoutputformat=2 12\else4\fi
+ /Flags \ifcase\submitoutputformat\space
+ 4 % 0=unknown
+ \or 4 % 1=HTML
+ \or 0 % 2=FDF % was 12 ? ? ?
+ \or 32 % 3=XML
+ \else 4 % ?=unknown
+ \fi
/F (\argumentA)}
\def\PDFexecutehide {/Hide /T (\argumentA) /H true}
@@ -444,10 +590,10 @@
%D \macros
%D {doPDFstartrunprogram}
%D
-%D Running programs is possible, but rather non portable, and
-%D therefore ill advized.
+%D Running programs is possible, but is non that portable, and
+%D therefore dangerous.
-\def\doPDFstartrunprogram#1#2#3#4% new: #3 => #3#4
+\def\doPDFstartrunprogram#1#2#3#4% new: #3 => #3#4
{\bgroup
%\edef\string{#3}%
%\@EA\beforesplitstring\string\at{ }\to\program
@@ -551,8 +697,8 @@
\def\doPDFinsertmov#1#2#3#4#5#6#7#8#9%
{\bgroup
\xdef\currentmovie{#2}% label
- \ScaledPointsToBigPoints{#7}\width
- \ScaledPointsToBigPoints{#8}\height
+ \PointsToBigPoints{#7}\width
+ \PointsToBigPoints{#8}\height
\let\pdf@@options\empty
\let\pdf@@actions\empty
\donefalse
@@ -580,7 +726,7 @@
{\bgroup
\xdef\currentsound{#2}%
\flushatshipout % since it can be buried in a chained box
- {\doPDFannotation width 0 height 0 data
+ {\doPDFannotation width 0pt height 0pt data
{/Subtype /Movie
/T (sound \currentsound)
/Movie <</F (#1)>>}}%
@@ -597,7 +743,7 @@
{\bgroup
\sanitizePDFdocencoding#3\to\bookmarktext % uses scratchcounter
\scratchcounter=#4%
- \advance\scratchcounter by -1
+ \advance\scratchcounter -1
%\sanitizePDFstring#3\to\bookmarktext
\doPDFbookmark level #1 n #2 text {\bookmarktext}
page {\the\scratchcounter} open #5
@@ -665,13 +811,13 @@
\def\setFDFswitches[#1]%
{\bgroup
- \!!counta=0
- \!!countb=0
+ \!!counta\zerocount
+ \!!countb\zerocount
\def\docommando##1%
{\doifsomething{##1}
- {\advance\!!counta by 0\getvalue{\@@FDFflag##1}%
+ {\advance\!!counta 0\getvalue{\@@FDFflag##1}%
\setvalue{\@@FDFflag##1}{0}%
- \advance\!!countb by 0\getvalue{\@@FDFplus##1}%
+ \advance\!!countb 0\getvalue{\@@FDFplus##1}%
\setvalue{\@@FDFplus##1}{0}}}%
\processcommacommand[#1]\docommando
\xdef\FDFflag{\the\!!counta}%
@@ -745,7 +891,7 @@
\setbox\scratchbox=\hbox
\bgroup
\doconvertfont{#1}{}%
- \ScaledPointsToBigPoints{\number\bodyfontsize}\size % x/xx, so better the actual size
+ \PointsToBigPoints\bodyfontsize\size % x/xx, so better the actual size
\doifdefinedelse{FDF\fontstyle\fontalternative}
{\xdef\FDFattributes{\getvalue{FDF\fontstyle\fontalternative}}}
{\doifdefinedelse{FDF\fontstyle}
@@ -894,8 +1040,11 @@
\defineFDFfonts
\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
\doPDFdictionaryobject class FDF name local:acroform data
{/Fields \PDFobjectreference\space
+ /NeedAppearances true
\doFDFiffieldset\PDFcalculationset{/CO [\doFDFgetfieldset\PDFcalculationset]}
/DR << /Font << \FDFfonts >> >>
/DA (/Helv 10 Tf 0 g)}%
@@ -966,7 +1115,7 @@
%D And a big one:
-\def\FDFencodingvector
+\def\FDFencodingvector
{/Type /Encoding
/Differences
[ 24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek
@@ -1194,9 +1343,11 @@
\ifcase#8\relax\FDFvaluesfalse\else\FDFvaluestrue\fi
\setFDFswitches[#5]%
\setFDFactions[#7]%
+ \doifelse{#4}{1}
+ {\def\FDFdefault{On}}
+ {\def\FDFdefault{Off}}%
\ifcase\currentFDFmode
\doFDFappearance{On}{#6}{#8}%
- \doFDFdefault{#6}{#4}%
\doPDFannotationobject class FDF name #1 width #2 height #3 data
{/Subtype /Widget /T (#1) /FT /Btn
\ifFDFvalues
@@ -1210,7 +1361,6 @@
\FDFactions}%
\registerFDFobject{#1}%
\or
- \doFDFdefault{#6}{#4}%
\setFDFkids[kids:][\currentFDFkids]%
\doPDFdictionaryobject class FDF name #1 data
{/T (#1) /FT /Btn
@@ -1226,25 +1376,33 @@
\registerFDFobject{#1}%
\or
\doFDFappearance{On}{#6}{#8}%
- \doFDFdefault{#6}{#4}%
\doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference
\global\objectreferencingtrue
\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
/Ff \FDFflag\space
/F \FDFplus\space
\FDFappearance\space
\FDFactions}%
\or
\doFDFappearance{On}{#6}{#8}%
- \doFDFdefault{#6}{#4}%
\doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference
\global\objectreferencingtrue
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
/F \FDFplus\space
+ \ifFDFvalues
+ /DV /\FDFdefault\space
+ /V /\FDFdefault\space
+ /AS /\FDFdefault\space
+ \fi
\FDFappearance}%
\fi
\egroup}
@@ -1255,24 +1413,28 @@
\def\doFDFpresetcheckfield#1#2#3#4#5#6#7%
{\doFDFpresetpushcheckfield{#1}{#2}{#3}{#4}{#5}{#6}{#7}{1}}
-\def\doFDFpresetradiofield#1#2#3#4#5#6#7%
+\def\doFDFpresetradiofield#1#2#3#4#5#6#7#8%
{\bgroup
\FDFvaluestrue
- \setFDFswitches[#4]%
- \setFDFactions[#7]%
+ \setFDFswitches[#5]%
+ \setFDFactions[#8]%
+ \doifelsenothing{#4}
+ {\def\FDFdefault{Off}}
+ {\def\FDFdefault{#4}}%
\ifcase\currentFDFmode
- \doFDFappearance{#1}{#6}{1}%
- \doPDFgetobjectreference{FDF}{#5}\PDFobjectreference
+ \doFDFappearance{#1}{#7}{1}%
+ \doPDFgetobjectreference{FDF}{#6}\PDFobjectreference
\doPDFannotationobject class FDF name #1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
/F \FDFplus\space
+ /AS /\FDFdefault\space
\FDFappearance\space
\FDFactions}%
\registerFDFobject{#1}%
\or
\setFDFkids[kids:][\currentFDFkids]%
- \doPDFgetobjectreference{FDF}{#5}\PDFobjectreference
+ \doPDFgetobjectreference{FDF}{#6}\PDFobjectreference
\doPDFdictionaryobject class FDF name #1 data
{/Parent \PDFobjectreference\space
/Kids [\FDFkids]
@@ -1280,22 +1442,26 @@
\FDFactions}%
\registerFDFobject{#1}%
\or
- \doFDFappearance{#1}{#6}{1}%
+ %\doFDFappearance{#1}{#7}{1}%
+ \doFDFappearance{\currentFDFparent}{#7}{1}%
\doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference
- \global\objectreferencingtrue
+ \global\objectreferencingtrue % nb
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
+ /AS /\FDFdefault\space
/F \FDFplus\space
\FDFappearance\space
\FDFactions}%
\or
- \doFDFappearance{#1}{#6}{1}%
+ %\doFDFappearance{#1}{#7}{1}%
+ \doFDFappearance{\currentFDFparent}{#7}{1}%
\doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference
\global\objectreferencingtrue
\doPDFannotationobject class FDF name kids:#1 width #2 height #3 data
{/Subtype /Widget
/Parent \PDFobjectreference\space
+ /AS /\FDFdefault\space
/F \FDFplus\space
\FDFappearance\space}
\fi
@@ -1308,7 +1474,7 @@
\setFDFactions[#5]%
\doPDFdictionaryobject class FDF name #1 data
{/Subtype /Widget /FT /Btn /T (#1) /Rect [0 0 0 0]
- /DV /#2 /V /#2
+ /DV (#2) % /V (#2)
/H /N
/Ff \FDFflag\space /F \FDFplus\space /Kids [\FDFkids]
\FDFactions}%
@@ -1369,11 +1535,14 @@
\doPDFgetobjectreference{FDF}{ap:#1:\yes:\no}\PDFobjectreference
\edef\FDFappearance{\FDFappearance /AP \PDFobjectreference}}
+%\def\doFDFdefault#1#2%
+% {\dogetcommacommandelement1\from#1,\to\commalistelement
+% \dogetcommacommandelement1\from\commalistelement\to\commalistelement
+% \doifelse{\commalistelement}{#2} % kan ook met \ifx
+% {\def\FDFdefault{On}}{\def\FDFdefault{Off}}}
+
\def\doFDFdefault#1#2%
- {\dogetcommacommandelement1\from#1,\to\commalistelement
- \dogetcommacommandelement1\from\commalistelement\to\commalistelement
- \doifelse{\commalistelement}{#2} % kan ook met \ifx
- {\def\FDFdefault{On}}{\def\FDFdefault{Off}}}
+ {\doifelse{#2}{1}{\def\FDFdefault{On}}{\def\FDFdefault{Off}}}
%D The three appearances {\em normal}, \type{roll over} and
%D \type{push down} are passed as comma separated triplets,
@@ -1417,16 +1586,22 @@
\doPDFresetgotowhereever % just to be sure
+% we can (in etex) share more by testing on this
+
\def\savesecondaryPDFreference#1%
- {\setxvalue{PDF-SR:\the\nofsecondaryreferences}{#1}}
+ %{\setxvalue{PDF-SR:\the\nofsecondaryreferences}{#1}}
+ {\@EA\xdef\csname PDF-SR:\the\nofsecondaryreferences\endcsname{#1}}
+
+\def\savesecondaryPDFreference % #1 == \action
+ {\global\@EA\let\csname PDF-SR:\the\nofsecondaryreferences\endcsname}
\def\getsecondaryPDFreferences%
- {\ifnum\nofsecondaryreferences>0
+ {\ifcase\nofsecondaryreferences\else
%\doifdefined{PDF-SR:\the\nofsecondaryreferences}
\xdef\secondaryPDFreferences%
- {/Next << \getvalue{PDF-SR:\the\nofsecondaryreferences}\space
+ {/Next << \csname PDF-SR:\the\nofsecondaryreferences\endcsname\space
\secondaryPDFreferences >>}%
- \global\advance\nofsecondaryreferences by -1
+ \global\advance\nofsecondaryreferences \minusone
\expandafter\getsecondaryPDFreferences
\fi}
@@ -1512,7 +1687,7 @@
\global\let\normalslash=/
\catcode`\/=\@@escape
-\gdef\TEXloadFDFfields#1%
+\gdef\TEXloadFDFfields#1% will become obsolete due to XFDF
{\bgroup
\setbox0=\hbox
{\global\let\allFDFfields\empty
@@ -1639,9 +1814,9 @@
\PDFcomment
\PDFidentifier
\PDFattributes}}%
- \wd\scratchbox=\!!zeropoint
- \ht\scratchbox=\!!zeropoint
- \dp\scratchbox=\!!zeropoint
+ \wd\scratchbox\zeropoint
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
\box\scratchbox
\egroup}
@@ -1675,24 +1850,24 @@
%D implemented in the \POSTSCRIPT\ driver.
\def\doPDFovalcalc#1#2#3%
- {\dimen2=#1sp
- \advance\dimen2 by #2\relax
- \ScaledPointsToBigPoints{\number\dimen2}#3}
+ {\dimen2=#1%
+ \advance\dimen2 #2\relax
+ \PointsToBigPoints{\dimen2}#3}
-\def\doPDFovalbox#1#2#3#4#5#6#7%
+\def\doPDFovalbox#1#2#3#4#5#6#7% todo: \scratchdimen/\scatchbox
{\bgroup
- \dimen0=#4sp\divide\dimen0 by 2
+ \dimen0=#4\divide\dimen0 by 2
\doPDFovalcalc{0}{+\dimen0}\xmin
\doPDFovalcalc{#1}{-\dimen0}\xmax
\doPDFovalcalc{#2}{-\dimen0}\ymax
\doPDFovalcalc{-#3}{+\dimen0}\ymin
- \advance\dimen0 by #5sp
+ \advance\dimen0 by #5%
\doPDFovalcalc{0}{+\dimen0}\xxmin
\doPDFovalcalc{#1}{-\dimen0}\xxmax
\doPDFovalcalc{#2}{-\dimen0}\yymax
\doPDFovalcalc{-#3}{+\dimen0}\yymin
- \doPDFovalcalc{#4}{0pt}\stroke
- \doPDFovalcalc{#5}{0pt}\radius
+ \doPDFovalcalc{#4}{\zeropoint}\stroke
+ \doPDFovalcalc{#5}{\zeropoint}\radius
\edef\dostroke{#6}%
\edef\dofill{#7}%
\setbox0=\hbox
@@ -1716,7 +1891,7 @@
\ifnum\dofill=1 f \fi
Q}%
\fi}%
- \wd0=#1sp\ht0=#2sp\dp0=#3sp\box0
+ \wd0=#1\ht0=#2\dp0=#3\box0
\egroup}
%D \macros
@@ -1809,10 +1984,51 @@
\PDFcode{/GSpositive gs}%
\fi}
+%D Transparency support (experimental):
+
+\def\PDFtransparancydictionary#1#2#3% type fraction extras
+ {<</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
+ Exclusion\else Compatible\fi
+ #3>>}
+
+\newif\ifPDFtransparencysupported
+
+\def\dodoPDFstarttransparency#1#2%
+ {\presetPDFtransparency{#1}{#2}%
+ \PDFcode{\PDFtransparencyidentifier\space gs}}
+
+\def\dodoPDFstoptransparency
+ {\PDFcode{/Tr0 gs}}
+
+\def\doPDFstarttransparency
+ {\ifPDFtransparencysupported
+ \global\let\doPDFstarttransparency\dodoPDFstarttransparency
+ \global\let\doPDFstoptransparency \dodoPDFstoptransparency
+ \initializetransparency
+ \expandafter\doPDFstarttransparency
+ \else
+ \expandafter\gobbletwoarguments
+ \fi}
+
+\let\doPDFstoptransparency\relax
+
+%D These use:
+
+\let\PDFtransparencyresetreference \empty
+\let\PDFtransparencyresetidentifier\empty
+
+\let\PDFtransparencyreference \empty
+\let\PDFtransparencyidentifier\empty
+
+\let\presetPDFtransparency \gobbletwoarguments
+\let\initializetransparency\relax
+
%D And that was all.
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-ini.tex b/tex/context/base/spec-ini.tex
index 8d6dbc70d..db56152e6 100644
--- a/tex/context/base/spec-ini.tex
+++ b/tex/context/base/spec-ini.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\newif\ifsimplifyspecials \simplifyspecialstrue % see later
+
%D Specials are \TEX's channel to the outside world. They make
%D \TEX\ even more platform independant and permit easy
%D adaption to new developments. One major drawback of specials
@@ -252,11 +254,11 @@
%D We define some local constants and variables. They look a
%D bit horrible but we don't want conflicts.
-\def\@@specfil@@{@@specfil@@}
-\def\@@speclst@@{@@speclst@@}
-\def\@@speccat@@{@@speccat@@}
-\def\@@specarg@@{@@specarg@@}
-\def\@@specexc@@{@@specexc@@}
+\def\@@specfil@@{@@spcfil@@}
+\def\@@speclst@@{@@spclst@@}
+\def\@@speccat@@{@@spccat@@}
+\def\@@specarg@@{@@spcarg@@}
+\def\@@specexc@@{@@spcexc@@}
% not faster
%
@@ -266,9 +268,9 @@
% \def\@@specarg@@{@sp@a@}
% \def\@@specexc@@{@sp@e@}
-\let\currentspecial =\empty
-\let\currentspecialfile=\empty
-\let\preloadedspecials =\empty
+\let\currentspecial \empty
+\let\currentspecialfile\empty
+\let\preloadedspecials \empty
%D \macros
%D {preloadspecials}
@@ -291,34 +293,6 @@
%D The optional second argument can consist of a list of
%D libraries that are to be loaded first.
-% to fuzzy and error prone
-%
-% \def\dostartspecials[#1][#2]%
-% {\let\mainspecialfile=\currentspecialfile
-% \doifelsenothing{#2}
-% {\inheritspecialsfalse}
-% {\ifinheritspecials
-% \showmessage{\m!specials}{2}{(#2)}%
-% \else
-% \inheritspecialstrue
-% \processcommalist[#2]\dousespecials
-% \inheritspecialsfalse
-% \fi}%
-% \doifelsenothing{#1}
-% {\let\currentspecial\s!unknown}
-% {\def\currentspecial{#1}}%
-% \let\currentspecialfile=\mainspecialfile
-% \setevalue{\@@specfil@@\currentspecial}{\currentspecialfile}%
-% \unprotect
-% \addtocommalist{\currentspecial}\preloadedspecials}
-%
-% \def\startspecials%
-% {\dodoubleempty\dostartspecials}
-%
-% \def\stopspecials%
-% {\def\currentspecial{}%
-% \protect}
-
\def\dostartspecials[#1][#2]%
{\doifsomething{#2}
{\processcommalist[#2]\dousespecials}%
@@ -410,25 +384,25 @@
%D {usespecials}
%D
%D We use \type{\usespecials} to load a specific library.
-%D This command is only permitted outside de definition part.
+%D This command is only permitted outside the definition part.
-\def\dousespecials#1%
+\def\dousespecials#1%
{\doifelse{#1}{\v!reset}
{\resetspecials}
{\doifdefinedelse{\@@specfil@@#1}
{\edef\currentspecialfile{\getvalue{\@@specfil@@#1}}}
{\edef\currentspecialfile{#1}}%
\makeshortfilename[\f!specialprefix\currentspecialfile]%
- \showmessage{\m!specials}{5}{\currentspecialfile}%
+ \showmessage\m!specials5\currentspecialfile
\startreadingfile
- \readsysfile{\shortfilename}{}{}%
+ \readsysfile\shortfilename\donothing\donothing
\stopreadingfile
- \showmessage{\m!specials}{1}{\preloadedspecials}}}
+ \showmessage\m!specials1\preloadedspecials}}
\def\usespecials[#1]%
{\doifelsenothing{\currentspecial}
{\processcommalist[#1]\dousespecials}
- {\showmessage{\m!specials}{6}{}}}
+ {\showmessage\m!specials6\empty}}
%D \macros
%D {executespecials}
@@ -555,8 +529,8 @@
%D because we pass all those arguments to the specials support
%D macro.
-\let\openspecialfile = \relax
-\let\closespecialfile = \relax
+\let\openspecialfile \relax
+\let\closespecialfile \relax
%D \macros
%D {doifspecialavailableelse}
@@ -577,832 +551,56 @@
\def\doifspecialavailableelse#1#2#3%
{\doifelsevaluenothing{\@@speclst@@\string#1}{#3}{#2}}
-%D The following libraries are defined. Two postscript
-%D drivers are supported, as well as two mechanisms for
-%D interactive texts.
-%D
-%D \startregelcorrectie
-%D \starttabel[|l|l|l|l|l|]
-%D \HL
-%D \NC \bf file \NC
-%D \bf name \NC
-%D \bf calls \NC
-%D \bf support \NC
-%D \bf program / driver \NC\SR
-%D \HL
-%D \NC \tttf spec-tex \NC
-%D \tttf tex \NC
-%D \NC
-%D Generic \TEX\ (\DVI) \NC
-%D (default) \NC\FR
-%D \NC \tttf spec-tpd \NC
-%D \tttf \PDF \NC
-%D \NC
-%D Han The Thanh \NC
-%D (pdftex) \NC\MR
-%D \NC \tttf spec-ps \NC
-%D \tttf postscript \NC
-%D \NC
-%D Adobe PostScript \NC
-%D (default) \NC\MR
-%D \NC \tttf spec-tr \NC
-%D \tttf rokicki \NC
-%D \tttf postscript \NC
-%D Thomas Rokicki \NC
-%D (dvips) \NC\MR
-%D \NC \tttf spec-yy \NC
-%D \tttf yandy \NC
-%D \tttf postscript \NC
-%D YandY \NC
-%D (dvipsone, dviwindo) \NC\MR
-%D \NC \tttf spec-pdf \NC
-%D \tttf pdf \NC
-%D \NC
-%D Adobe PDF \NC
-%D (Acrobat) \NC\MR
-%D \NC \tttf spec-win \NC
-%D \tttf dviwindo \NC
-%D YandY \NC
-%D (dviwindo) \NC\MR
-%D \NC \tttf spec-htm \NC
-%D \tttf html \NC
-%D \NC
-%D HTML V 2.0 \NC
-%D (dvips) \NC\LR
-%D \HL
-%D \stoptabel
-%D \stopregelcorrectie
-
-%D \macros
-%D {dostartgraymode,dostopgraymode,
-%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,dostopcolormode}
-%D
-%D Switching to and from color can be done in two ways:
-%D
-%D \startopsomming[opelkaar,n]
-%D \som insert driver specific commands
-%D \som pass instructions to the output device
-%D \stopopsomming
-%D
-%D The first approach is more general and lays the
-%D responsibility at the driver side. Probably due to the fact
-%D that \TEX\ does not directly support color, we have been
-%D confronted for the last few years with changing special
-%D definitions. The need for support depends on how a macro
-%D package handles colored text that crosses the page boundary.
-%D Again, there are two approaches.
-%D
-%D \startopsomming[opelkaar,n]
-%D \som let \TEX\ do the job
-%D \som let the driver handle things
-%D \stopopsomming
-%D
-%D The first approach is as driver independant as possible and
-%D can easily be accomplished by using \TEX's mark mechanism.
-%D In \CONTEXT\ we follow this approach. More and more, drivers
-%D are starting to support color, including stacking them.
-%D
-%D Colors as well as grayscales can be represented in scales
-%D from~0 to~1. When drivers use values in the range 0..255,
-%D this value has to be adapted in the translation process.
-%D Technically it's possible to get a grayscale from combining
-%D colors. In the \kap{RGB} color system, a color with Red,
-%D Green and Blue components of 0.80 show the same gray as a
-%D Gray Scale specified 0.80. The \kap{CMYK} color system
-%D supports a Black component apart from Cyan, Magenta and
-%D Yellow.
-%D
-%D Depending on the target format, color support differs from
-%D gray support. PostScript for example offers different
-%D operators for setting gray and color. This is because
-%D printing something using three colors is someting else than
-%D printing with just black.
-%D
-%D In \CONTEXT\ we have implemented a color subsystem that
-%D supports the use of well defined colors that, when printed
-%D in black and white, still can be distinguished. This
-%D approach enables us to serve both printed and electronic
-%D versions, using colored text and illustrations. More on the
-%D fundamentals of this topic can be found in the \kap{MAPS} of
-%D the Dutch User Group, 14 (95.1).
-%D
-%D To satisfy all those needs, we define four specials which
-%D supply enough information for drivers to act upon. We
-%D could have used more general commands with the keywords
-%D 'rgb' and 'gray', but because these specials are used often,
-%D we prefer the more direct and shorter alternative.
-%D
-%D We start with the installation of color and grayscale
-%D specials. The values are in the range 0..1 (e.g. 0.25).
-%D
-%D \starttypen
-%D \dostartgraymode {gray} ... \dostopgraymode
-%D \dostartrgbcolormode {red} {green} {blue} ... \dostopcolormode
-%D \dostartcmykcolormode {cyan} {magenta} {yellow} {black} ... \dostopcolormode
-%D \dostartgraycolormode {gray} ... \dostopcolormode
-%D \stoptypen
-%D
-%D Because we can expect conflicts between drivers, we
-%D implement them as category \type{or}. In previous versions
-%D of \DVIPSONE\ the use of their color||specials did not
-%D interfere with the PostScript ones, but recent versions do.
-
-\installspecial [\dostartgraymode] [or] [1]
-\installspecial [\dostopgraymode] [or] [0]
-
-\installspecial [\dostartrgbcolormode] [or] [3]
-\installspecial [\dostartcmykcolormode] [or] [4]
-\installspecial [\dostartgraycolormode] [or] [1]
-\installspecial [\dostopcolormode] [or] [0]
-
-%D For some drivers, the stop special is of no use and can
-%D simply call the start one with zero arguments.
-
-%D \macros
-%D {doinsertfile}
-%D
-%D Probably the most problematic special is the following
-%D one. Because we want to be able to support different
-%D schemes, we pass a lot of data to it.
-%D
-%D The support of inserting files (like illustrations) comes in
-%D many flavors. Some drivers use scales, some take dimensions.
-%D Some need offsets and others act on stored characteristics.
-%D They need one thing in common: a filename. Although separate
-%D specials for different formats sometimes are more clear, we
-%D decided to combine them all in one:
-%D
-%D \starttypen
-%D \doinsertfile {type,method} {file,label}
-%D {xscale} {yscale} {x} {y} {w} {h}
-%D {options}
-%D \stoptypen
-%D
-%D The scale is given percents, the other values are base
-%D points.
-%D
-%D The special is implemented as \type{or}. Because \DVIPSONE\
-%D understands them all, a chain of alternatives would generate
-%D multiple occurrences of the same illustration.
-%D
-%D When option 1 is passed, the viewers is asked to present a
-%D preview, like the first frame of a movie.
-
-\installspecial [\doinsertfile] [or] [9]
-
-%D No start||stop construction is needed here, because there in
-%D no further interference of \TEX. All dimensions are output
-%D as scaled points and scales as a number, where 100 equal
-%D 100\%.
-
-%D \macros
-%D {doinsertsoundtrack}
-%D
-%D Sounds are (for the moment) just files with
-%D associated options.
-%D
-%D \starttypen
-%D \doinsertsoundtrack {file} {label} {options}
-%D \stoptypen
-
-\installspecial [\doinsertsoundtrack] [or] [3]
-
-%D \macros
-%D {dogetnofinsertpages}
-%D
-%D Some file formats support more than one page, like \PDF,
-%D and for special applications, one may want to have access
-%D to the total number of pages.
-%D
-%D \starttypen
-%D \dogetnofinsertpages{filename}
-%D \stoptypen
-%D
-%D The number is also available after the insert is placed,
-%D since inclusion may take place immediate when an insert is
-%D called upon.
-
-\def\nofinsertpages{1} % one of the few 'talk backs'
-
-\installspecial [\dogetnofinsertpages] [or] [1]
-
-%D \macros
-%D {dostartrotation,
-%D dostoprotation}
-%D
-%D We support rotation with the special:
-%D
-%D \starttypen
-%D \dostartrotation {angle} ... \dostoprotation
-%D \stoptypen
-%D
-%D For the moment these specials are installed as
-%D category \type{or}.
-
-\installspecial [\dostartrotation] [or] [1]
-\installspecial [\dostoprotation] [or] [0]
-
-%D \macros
-%D {dostartscaling,
-%D dostopscaling}
-%D
-%D Scaling is also supported:
-%D
-%D \starttypen
-%D \dostartscaling {x} {y} ... \dostopscaling
-%D \stoptypen
-%D
-%D Like the previous one, these specials are of category
-%D \type{or}.
-
-\installspecial [\dostartscaling] [or] [2]
-\installspecial [\dostopscaling] [or] [0]
-
-%D \macros
-%D {dostartmirroring,
-%D dostopmirroring}
-%D
-%D And indeed, mirroring is there too:
-%D
-%D \starttypen
-%D \dostartmirroring {x} {y} ... \dostopmirroring
-%D \stoptypen
-%D
-%D Again these specials are installed as category \type{or}.
-
-\installspecial [\dostartmirroring] [or] [0]
-\installspecial [\dostopmirroring] [or] [0]
-
-%D \macros
-%D {dostartnegative,
-%D dostopnegative}
-%D
-%D When producing output for an image setter, negating the
-%D page comes into view. Here are the tools:
-
-\installspecial [\dostartnegative] [or] [0]
-\installspecial [\dostopnegative] [or] [0]
-
-%D \macros
-%D {doselectfirstpaperbin,
-%D doselectsecondpaperbin}
-%D
-%D Here are some very printer||specific ones. No further
-%D comment.
-
-\installspecial [\doselectfirstpaperbin] [or] [0]
-\installspecial [\doselectsecondpaperbin] [or] [0]
-
-%D \macros
-%D {doovalbox}
-%D
-%D When we look at the implementation, this is a complicated
-%D one. There are seven arguments.
-%D
-%D \starttypen
-%D \doovalbox {w} {h} {d} {linewidth} {radius} {stroke} {fill}
-%D \stoptypen
-%D
-%D This command has to return a \type{\vbox} which can be used
-%D to lay over another one (with text). The radius is in
-%D degrees, the stroke and fill are~\type{1} (true) of~\type{0}
-%D (false).
-
-\installspecial [\doovalbox] [or] [7]
-
-%D \macros
-%D {dostartclipping,dostopclipping}
-%D
-%D Clipping is implemented in such a way that an arbitrary
-%D can be fed.
-%D
-%D \starttypen
-%D \dostartclipping {pathname}{width} {height}
-%D \dostopclipping
-%D \stoptyping
-%D
-%D
-
-\installspecial [\dostartclipping] [or] [3]
-\installspecial [\dostopclipping] [or] [0]
-
-%D \macros
-%D {dosetupidentity}
-%D
-%D We can declare some characteristics of the document with
-%D
-%D \starttypen
-%D \dosetupidentity {title} {subject} {author} {creator} {date}
-%D \stoptypen
-%D
-%D All data is in string format.
-
-\installspecial [\dosetupidentity] [and] [5]
-
-%D \macros
-%D {dosetuppaper}
-%D
-%D This special can be used to tell the driver what page size
-%D to use. The special takes three arguments.
-%D
-%D \starttypen
-%D \dosetuppaper {type} {width} {height}
-%D \stoptypen
-%D
-%D The type is one of the common identifiers, like A4, A5 or
-%D B2.
-
-\installspecial [\dosetuppaper] [and] [3]
-
-%D \macros
-%D {dosetupprinter}
-%D
-%D Some drivers enable the user to specify the paper type
-%D used and/or page dimensions to be taken into account.
-%D
-%D \starttypen
-%D \dosetupprinter {type} {hoffset} {voffset} {width} {height}
-%D \stoptypen
-%D
-%D The first argument is one of \type{letter}, \type{legal},
-%D \type{A4}, \type{A5} etc. The dimensions are in
-%D basepoints.
-
-\installspecial [\dosetupprinter] [and] [5]
-
-%D \macros
-%D {% dosetuppage,
-%D dosetupopenaction, dosetupclosaction,
-%D dosetupopenpageaction, dosetupclospageaction,
-%D dosetupinteraction,
-%D dosetupscreen,
-%D dosetupviewmode}
-%D
-%D Here come some obscure interactive commands. Probably the
-%D specs will change with the development of the macros that
-%D use them.
-%D
-%D The first ones can be used to set up the interaction.
-%D
-%D \starttypen
-%D \dosetupinteraction
-%D \stoptypen
-%D
-%D Normally this command does nothing but giving a message
-%D that some scheme is supported.
-%D
-%D \starttypen
-%D \dosetupstartaction
-%D \dosetupstopaction
-%D \stoptypen
-%D
-%D These two setup the actions to be executed when the document
-%D is opened and closed.
-%D
-%D The next command sets up the screen. It takes five
-%D arguments:
-%D
-%D \starttypen
-%D \dosetupscreen {hoffset} {voffset} {width} {height} {options}
-%D \stoptypen
-%D
-%D The first four arguments are in scaled points. Option~1
-%D results in a full screen launch.
-%D
-%D \starttypen
-%D \dosetuppageview {keyword}
-%D \stoptypen
-%D
-%D For the moment we only support \type{fit}.
-
-\installspecial [\dosetupinteraction] [and] [0]
-\installspecial [\dosetupopenaction] [and] [0]
-\installspecial [\dosetupcloseaction] [and] [0]
-\installspecial [\dosetupopenpageaction] [and] [0]
-\installspecial [\dosetupclosepageaction] [and] [0]
-\installspecial [\dosetupscreen] [and] [5]
-\installspecial [\dosetuppageview] [and] [1]
-
-%D \macros
-%D {dostarthide,
-%D dostophide}
-%D
-%D Not every part of the screen is suitable for paper. Menus
-%D for instance have no meaning on an non||interactive medium.
-%D These elements are hidden by means of:
-%D
-%D \starttypen
-%D \dostarthide
-%D \dostophide
-%D \stoptypen
-
-\installspecial [\dostarthide] [or] [0]
-\installspecial [\dostophide] [or] [0]
-
-%D \macros
-%D {dostartgotolocation, dostopgotolocation,
-%D dostartgotorealpage, dostopgotorealpage}
-%D
-%D When we want to support hypertext buttons, again we have
-%D to deal with two concepts.
-%D
-%D \startopsomming[opelkaar,n]
-%D \som let \TEX\ highlight the text
-%D \som let the driver show us where to click
-%D \stopopsomming
-%D
-%D The first approach is the most secure one. It gives us
-%D complete control over the visual appearance of hyper
-%D buttons. The second alternative lets the driver guess what
-%D part of the text needs highlighting. As long as we deal with
-%D not too complicated textual buttons, this is no problem.
-%D It's even a bit more efficient when we take long mid
-%D paragraph active regions into account. When we let \TEX\
-%D handle active sentences {\em for instance marked like this
-%D one}, we have to take care of line- and pagebreaks ourselve.
-%D However, it's no trivial matter to let a driver find out
-%D where things begin and end. Because most hyperlinks can be
-%D found in tables of contents and registers, the saving in
-%D terms of bytes can be neglected and the first approach is a
-%D clear winner.
-%D
-%D The most convenient way of cross||referencing is using named
-%D destinations. A more simple scheme is using page numbers as
-%D destinations. Because the latter alternative can often be
-%D implemented more efficient, and because we cannot be sure
-%D what scheme a driver supports, we always have to supply a
-%D pagenumber, even when we use named destinations.
-%D
-%D To enable a driver to find out what to make active, we have
-%D to provide begin and endpoints, so like with color, we use
-%D pairs of specials. The first scheme can be satisfied with
-%D proper dimensions of the areas to be made active.
-%D
-%D The interactive real work is done by the following four
-%D specials. The reason for providing the first one with both
-%D a label and a number, is a result of the quite poor
-%D implementation of \type{pdfmarks} in version 1.0 of
-%D Acrobat. Because only pagenumbers were supported as
-%D destination, we had to provide both labels (\DVIWINDO) and
-%D pagenumbers (\PDF). Some drivers use start stop pairs.
-%D
-%D \starttypen
-%D \dostartgotolocation {w} {h} {url} {file} {label} {page}
-%D \dostartgotorealpage {w} {h} {url} {file} {page}
-%D \stoptypen
-%D
-%D Their counterparts are:
-%D
-%D \starttypen
-%D \dostopgotolocation
-%D \dostopgotorealpage
-%D \stoptypen
-%D
-%D The internal alternative is used for system||generated
-%D links, the external one for user||generated links. The
-%D Uniform Resource Locator can be used to let the reader
-%D surf the net.
-
-\installspecial [\dostartgotolocation] [and] [6]
-\installspecial [\dostopgotolocation] [and] [0]
-\installspecial [\dostartgotorealpage] [and] [5]
-\installspecial [\dostopgotorealpage] [and] [0]
-
-%D One may wonder why jumps to page and location are not
-%D combined. By splitting them, we enable macro||packages to
-%D force the prefered alternative, while on the other hand
-%D drivers can pick up the alternative desired most.
-
-%D \macros
-%D {dostartgotoJS, doflushJSpreamble}
-%D
-%D Rather special is the option to include and execute
-%D JavaScript code. This is a typical \PDF\ option.
-%D
-%D \starttypen
-%D \dostartgotoJS {w} {h} {script}
-%D \stoptypen
-%D
-%D This not so standard \TEX\ feature should be used with
-%D care. Preamble scripts are flushed by
-%D
-%D \doflushJSpreamble {script}
-
-\installspecial [\dostartgotoJS] [and] [3]
-\installspecial [\dostopgotoJS] [and] [0]
-\installspecial [\doflushJSpreamble][and] [1]
-
-%D \macros
-%D {dostartthisislocation, dostopthisislocation,
-%D dostartthisisrealpage, dostopthisisrealpage}
-%D
-%D Before we can goto some location or page, we have to tell
-%D the system where it can be found. Because some drivers
-%D follow the \SGML\ approach of begin||end tags, we have to
-%D support pairs. A possible extension to this scheme is
-%D supplying coordinates for viewing the text.
-%D
-%D The opposite commands of \type{\dogotosomething} have only
-%D one argument:
-%D
-%D \starttypen
-%D \dostartthisislocation {label}
-%D \dostartthisisrealpage {page}
-%D \stoptypen
-%D
-%D These commands are accompanied by:
-%D
-%D \starttypen
-%D \dostopthisislocation
-%D \dostopthisisrealpage
-%D \stoptypen
-%D
-%D As with all interactive commands's they are installed as
-%D \type{and} category specials.
-
-\installspecial [\dostartthisislocation] [and] [1]
-\installspecial [\dostopthisislocation] [and] [0]
-\installspecial [\dostartthisisrealpage] [and] [1]
-\installspecial [\dostopthisisrealpage] [and] [0]
+%D So far for the macros that deal with installing specials.
+%D In the file \type {spec-def} you will find the predefined
+%D specials.
-%D In \CONTEXT\ we don't use the \type{\stopsomething}
-%D macros because we let \TEX\ take care of typographic
-%D issues.
+%D Now that we have seen the flexible way (permitting
+%D special chains) we will implement a faster and flat
+%D alternative. But only if flag si set.
-%D \macros
-%D {doresetgotowhereever}
-%D
-%D These and others need:
+\ifsimplifyspecials
-\installspecial [\doresetgotowhereever] [and] [0]
+ \def\doinstallspecial[#1][#2][#3]%
+ {\appendtoks\forgetspecial#1{#3}\to\everyresetspecials
+ \@EA\chardef\csname\@@speclst@@\string#1\endcsname0
+ \forgetspecial#1{#3}}
-%D \macros
-%D {dostartexecutecommand, dostopexecutecommand}
-%D
-%D The actual behavior of the next pair of commands depends
-%D much on the viewing engine. Therefore one cannot depend
-%D too much on their support.
-%D
-%D \starttypen
-%D \dostartexecutecommand {w} {h} {command} {options}
-%D \stoptypen
-%D
-%D At least the next commands are supported (more examples
-%D can be found in \type {spec-fdf.tex}:
-%D
-%D \startregelcorrectie\steluitlijnenin[midden]\leavevmode
-%D \starttabel[|l|l|]
-%D \HL
-%D \NC \bf command \NC \bf action \NC\SR
-%D \HL
-%D \NC first \NC go to the first page \NC\FR
-%D \NC previous \NC go to the previous page \NC\MR
-%D \NC next \NC go to the next page \NC\MR
-%D \NC last \NC go to the last page \NC\MR
-%D \NC backward \NC go back to the link list \NC\MR
-%D \NC forward \NC go forward in the link list \NC\MR
-%D \NC print \NC enter print mode \NC\MR
-%D \NC exit \NC exit viewer \NC\MR
-%D \NC close \NC close document \NC\MR
-%D \NC enter \NC enter viewer \NC\MR
-%D \NC help \NC show help on the viewer \NC\LR
-%D \HL
-%D \stoptabel
-%D \stopregelcorrectie
-%D
-%D Options are to be passed as a comma separated list of
-%D assignments.
+ \def\forgetspecial#1#2%
+ {\ifcase#2\relax
+ \let#1\relax \or
+ \let#1\gobbleoneargument \or
+ \let#1\gobbletwoarguments \or
+ \let#1\gobblethreearguments \or
+ \let#1\gobblefourarguments \or
+ \let#1\gobblefivearguments \or
+ \let#1\gobblesixarguments \or
+ \let#1\gobblesevenarguments \or
+ \let#1\gobbleeightarguments \or
+ \let#1\gobbleninearguments \or
+ \let#1\gobbletenarguments \fi}
-\installspecial [\dostartexecutecommand] [and] [4]
-\installspecial [\dostopexecutecommand] [and] [0]
+ \def\resetspecials%
+ {\the\everyresetspecials
+ \let\preloadedspecials\empty}
-%D \macros
-%D {dostartobject,
-%D dostopobject,
-%D doinsertobject}
-%D
-%D Reuse of object can reduce the output filesize
-%D considerably. Reusable objects are implemented with:
-%D
-%D \starttypen
-%D \dostartobject{class}{name}{width}{height}{depth}
-%D some typeset material
-%D \dostopobject
-%D \stoptypen
-%D
-%D \starttypen
-%D \doinsertobject{class}{name}
-%D \stoptypen
-%D
-%D The savings can be huge in interactive texts.
-
-\installspecial [\dostartobject] [or] [5]
-\installspecial [\dostopobject] [or] [0]
-\installspecial [\doinsertobject] [or] [2]
-
-%D \macros
-%D {doregisterfigure}
-%D
-%D Images can be objects as well and it's up to the driver to
-%D handle this. Alternative images are also up to the driver,
-%D and the next macro tells the driver that the previous image
-%D is somehow followed by another and that both have to be
-%D handled together. This is a rather fuzzy model, but for the
-%D moment it suits its purpose: low res screen versions combined
-%D with high res printable ones.
-
-\installspecial [\doregisterfigure][or] [2]
-
-% %D \macros
-% %D {dogetobjectreference}
-% %D
-% %D For very special purposes, one can ask for the internal
-% %D reference to the object. Beware!
-%
-% \installspecial [\dogetobjectreference] [or] [3]
-%
-% %D The first argument is the name, the second a macro that
-% %D gets the assiciated value.
+ \def\definespecial#1%
+ {\@EA\chardef\csname\@@speclst@@\string#1\endcsname=1
+ \def#1}
-%D \macros
-%D {dostartrunprogram, dostoprunprogram,
-%D dostartgotoprofile, dostopgotoprofile,
-%D dobeginofprofile,
-%D doendofprofile}
-%D
-%D These specials are still experimental. They are not yet
-%D supported by the programs the way they should be.
-%D
-%D {\em --- still undocumented ---}
-
-\installspecial [\dostartrunprogram] [and] [4]
-\installspecial [\dostoprunprogram] [and] [0]
-\installspecial [\dostartgotoprofile] [and] [3]
-\installspecial [\dostopgotoprofile] [and] [0]
-\installspecial [\dobeginofprofile] [and] [4]
-\installspecial [\doendofprofile] [and] [0]
-
-%D \macros
-%D {doinsertbookmark}
-%D
-%D Bookmarks, that is viewer generated tables of contents, are
-%D a strange phenomena, mainly because \TEX\ can provide
-%D whatever kind of table in much better quality.
+ \def\doifspecialavailableelse#1%
+ {\ifcase\csname\@@speclst@@\string#1\endcsname
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
-\installspecial [\doinsertbookmark] [and] [5]
+\fi
-%D This special is called as:
+%D For quite some time the \CONTEXT\ way of specifying the
+%D output format has been:
%D
%D \starttypen
-%D \doinstallbookmark {level} {nofsubentries} {text} {page} {open}
-%D \stoptypen
-%D
-%D This definition is very \PDF\ oriented, so for more
-%D information we kindly refer to the \PDF\ manuals.
-
-%D \macros
-%D {dosetpagetransition}
-%D
-%D In presentations, fancy page transitions can, at least for a
-%D short moment, let the audience focus at the screen. Like the
-%D previous one, this special is very \PDF.
-%D
-%D \starttypen
-%D \dosetpagetransition{dissolve}{0}
-%D \stoptypen
-%D
-%D Transitions have symbolic names, like dissolve, box, split,
-%D blinds, wipe and glitter. The second argument determines
-%D the wait time (unless zero).
-
-\installspecial [\dosetpagetransition] [or] [2]
-
-%D \macros
-%D {dopresettextfield,dopresetlinefield,
-%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield,
-%D dopresetbuttonfield,dopresetcheckfield,
-%D dopresetradiofield,dopresetradiorecord}
-%D
-%D The special drivers are programmed independant from their
-%D calling macros are thereby use the standard \TEX\ way of
-%D passing parameters. Unfortunately fields often have more
-%D than nine characteristics, so we pack some arguments in one.
-%D
-%D \starttypen
-%D \dopresettextfield / \dopresetlinefield
-%D {name} {width} {height} {default} {length}
-%D {style,color} {options} {alignment} {actions}
-%D
-%D \dopresetchoicefield / \dopresetpopupfield / \dopresetcombofield
-%D {name} {width} {height} {default}
-%D {style,color} {options} {values} {actions}
-%D
-%D \dopresetpushfield
-%D {name} {width} {height} {default}
-%D {options} {values} {actions}
-%D
-%D \dopresetcheckfield
-%D {name} {width} {height} {default}
-%D {options} {values} {actions}
-%D
-%D \dopresetradiofield
-%D {name} {width} {height}
-%D {options} {parent} {values} {actions}
-%D
-%D \dopresetradiorecord
-%D {name} {top} {options} {kids} {actions}
-%D \stoptypen
-
-\installspecial [\dopresetlinefield] [or] [9]
-\installspecial [\dopresettextfield] [or] [9]
-\installspecial [\dopresetchoicefield] [or] [8]
-\installspecial [\dopresetpopupfield] [or] [8]
-\installspecial [\dopresetcombofield] [or] [8]
-\installspecial [\dopresetpushfield] [or] [7]
-\installspecial [\dopresetcheckfield] [or] [7]
-\installspecial [\dopresetradiofield] [or] [7]
-\installspecial [\dopresetradiorecord] [or] [5]
-
-%D \macros
-%D {dodefinefieldset,dogetfieldset,doiffieldset}
-%D
-%D Field sets, used in resetting and submitting, are handled
-%D by:
-
-\installspecial [\dodefinefieldset] [or] [2]
-\installspecial [\dogetfieldset] [or] [1]
-\installspecial [\doiffieldset] [or] [2]
-
-%D \macros
-%D {dosetfieldstatus}
-%D
-%D For practical reasons we set some field characteristics
-%D using:
-%D
-%D \starttypen
-%D \dosetfieldstatus {mode} {parent} {kids} {root}
-%D \stoptypen
-
-\installspecial [\dosetfieldstatus] [or] [4]
-
-%D with:
-
-\def\fieldlonermode {0} % no \chardef here
-\def\fieldparentmode{1} % no \chardef here
-\def\fieldchildmode {2} % no \chardef here
-\def\fieldcopymode {3} % no \chardef here
-
-%D \macros
-%D {doregistercalculationset}
-%D
-%D We can define a calculation order list with:
-%D
-%D \starttypen
-%D \doregistercalculationset {set identifier}
-%D \stoptypen
-
-\installspecial [\doregistercalculationset] [or] [1]
-
-%D \macros
-%D {doinsertcomment}
-%D
-%D Not so much out of need, but to be complete, we also
-%D implement text annotations, so called comment:
-%D
-%D \starttypen
-%D \doinsertcomment
-%D {title} {width} {height} {color} {open} {symbol} {data}
-%D \stoptypen
-
-\installspecial[\doinsertcomment] [and] [7]
-
-%D \macros
-%D {dosetposition, dosetpositionwhd, dosetpositionplus,
-%D dosetpositionpapersize}
-%D
-%D Not natural to \TEX, but available in \PDFTEX, and by
-%D means of postprocessed \DVI, we can save and call upon
-%D positions.
-%D
-%D \starttypen
-%D \dosetposition {identifier}
-%D \dosetpositionwhd {identifier} {width} {height} {depth}
-%D \dosetpositionplus {identifier} {width} {height} {depth} {list}
-%D \dosetpositionpapersize {width} {height}
-%D \stoptypen
-%D
-%D This is one of the few specials where when using \PDFTEX\
-%D the driver directly deals with the utility file.
-
-\installspecial [\dosetposition] [or] [1]
-\installspecial [\dosetpositionwhd] [or] [4]
-\installspecial [\dosetpositionplus] [or] [5]
-\installspecial [\dosetpositionpapersize] [or] [2]
-
-%D So far for the installation. For quite some time the
-%D \CONTEXT\ way of specifying the output format has been:
-%D
-%D \starttypen
%D \usespecials[ps,yy,win,pdf]
%D \stoptypen
%D
@@ -1428,7 +626,7 @@
%D \setupoutput[name,...]
%D \stoptypen
%D
-%D In a few lines, we will see some examples.
+%D In a \type {spec-def} you can find some examples.
\def\defineoutput%
{\dodoubleargument\dodefineoutput}
@@ -1446,37 +644,4 @@
\def\setupoutput[#1]%
{\resetspecials\processcommacommand[#1]\dosetupoutput}
-%D Some suitable definitions are:
-
-\defineoutput [dvipsone] [dvi,ps,yy]
-\defineoutput [dviwindo] [dvi,ps,yy,win]
-\defineoutput [dvips] [dvi,ps,tr]
-\defineoutput [dviview] [dvi,ps,tr,dv]
-\defineoutput [dvipdfm] [dpm]
-\defineoutput [pdftex] [tpd]
-\defineoutput [pdf] [tpd]
-\defineoutput [acrobat] [pdf,ps,tr] % use: [acrobat,dvipsone]
-
-%D Please let me know if we need more. From now on we default
-%D to:
-
-\setupoutput [dvips]
-
-%D We don't enable \ACROBAT, because pure \POSTSCRIPT\ is not
-%D that strong on objects and \PDFTEX\ does a better job.
-%D Some reasonable alternatives are:
-%D
-%D \starttypen
-%D \setupoutput [dvipsone,acrobat]
-%D \setupoutput [dviwindo,acrobat]
-%D \stoptypen
-%D
-%D Although, better is:
-%D
-%D \starttypen
-%D \setupoutput [pdftex]
-%D \stoptypen
-
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-mis.tex b/tex/context/base/spec-mis.tex
index ae7c61e44..b05832085 100644
--- a/tex/context/base/spec-mis.tex
+++ b/tex/context/base/spec-mis.tex
@@ -79,7 +79,7 @@
%D All driver modules use the same scheme for file insertion,
%D and therefore have the next macro in common:
-\def\dododoinsertfile[#1][#2,#3][#4,#5]%
+\def\dododoinsertfile[#1][#2,#3][#4,#5]% \next kan weg
{\def\fileinsertionclass{do#1insert}%
\doifdefinedelse{\fileinsertionclass#3}
{\def\next{\getvalue{\fileinsertionclass#3}}}
@@ -123,13 +123,13 @@
%D When submitting forms, we need to communicate the format.
-\chardef\submitoutputformat=0 % 0=unknown 1=HTML 2=FDF
+\chardef\submitoutputformat=0 % 0=unknown 1=HTML 2=FDF 3=XML
\def\setsubmitoutputformat#1%
{\doifinsetelse{#1}{FDF,fdf}
{\chardef\submitoutputformat=2}
- {\chardef\submitoutputformat=1}}
+ {\doifinsetelse{#1}{XML,xml}
+ {\chardef\submitoutputformat=3}
+ {\chardef\submitoutputformat=1}}}
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-pdf.tex b/tex/context/base/spec-pdf.tex
index 576d99925..6c8215c1f 100644
--- a/tex/context/base/spec-pdf.tex
+++ b/tex/context/base/spec-pdf.tex
@@ -167,8 +167,8 @@
{\bgroup
\setPDFdestination{#1}%
\doifsomething{\PDFdestination}
- {\ScaledPointsToBigPoints{#2}\width
- \ScaledPointsToBigPoints{#3}\height
+ {\PointsToBigPoints{#2}\width
+ \PointsToBigPoints{#3}\height
\special
{\@@insertpostscriptretain
[ /Title (\PDFdestination)
@@ -208,9 +208,9 @@
{\bgroup
\setbox\nextbox=\hbox\bgroup
\bgroup
- \ScaledPointsToBigPoints{#3}\width
- \ScaledPointsToBigPoints{#4}\height
- \ScaledPointsToBigPoints{#5}\depth
+ \PointsToBigPoints{#3}\width
+ \PointsToBigPoints{#4}\height
+ \PointsToBigPoints{#5}\depth
\dosetobjectreference{#1}{#2}{#1::#2}%
\special
{\@@insertpostscriptretain
@@ -331,18 +331,25 @@
\xdef\lastPDFaction{#3}%
\else
\bgroup
- \xdef\lastPDFaction{<<#3>>}%
- % does not work well with distiller 4
- % \ifcase\similarreference\relax\or\ifsharePDFactions
- % \global\advance\nofPDFsimilar by 1
- % \special
- % {\@@insertpostscriptretain
- % [ /_objdef {PDF::sim:\the\nofPDFsimilar} /type /dict /OBJ pdfmark
- % [ {PDF::sim:\the\nofPDFsimilar} \lastPDFaction\space /PUT pdfmark}%
- % \xdef\lastPDFaction{{PDF::sim:\the\nofPDFsimilar}}%
- % \fi\fi
- \ScaledPointsToBigPoints{#1}\width
- \ScaledPointsToBigPoints{#2}\height
+ % does not work well with distiller 4
+ %\ifsharePDFactions
+ % \ifcase\similarreference\relax
+ % \xdef\lastPDFaction{<<#3>>}%
+ % \or
+ % \global\advance\nofPDFsimilar by 1
+ % \special
+ % {\@@insertpostscriptretain
+ % [ /_objdef {PDF::sim:\the\nofPDFsimilar} /type /dict /OBJ pdfmark
+ % [ {PDF::sim:\the\nofPDFsimilar} <<#3>>\space /PUT pdfmark}%
+ % \xdef\lastPDFaction{{PDF::sim:\the\nofPDFsimilar}}%
+ % \else
+ % % leave \lastPDFaction untouched
+ % \fi
+ %\else
+ \xdef\lastPDFaction{<<#3>>}%
+ %\fi
+ \PointsToBigPoints{#1}\width
+ \PointsToBigPoints{#2}\height
\special
{\@@insertpostscriptretain
[ /Action \lastPDFaction\space
@@ -357,8 +364,8 @@
\def\doPDFannotation width #1 height #2 data #3%
{\bgroup
- \ScaledPointsToBigPoints{#1}\width
- \ScaledPointsToBigPoints{#2}\height
+ \PointsToBigPoints{#1}\width
+ \PointsToBigPoints{#2}\height
\special
{\@@insertpostscriptretain
[ /Rect [0 0 \width\space \height] #3
@@ -368,8 +375,8 @@
\def\doPDFannotationobject class #1 name #2 width #3 height #4 data #5%
{\bgroup
- \ScaledPointsToBigPoints{#3}\width
- \ScaledPointsToBigPoints{#4}\height
+ \PointsToBigPoints{#3}\width
+ \PointsToBigPoints{#4}\height
\special
{\@@insertpostscriptretain
[ /_objdef {#1::#2}
@@ -415,12 +422,16 @@
{\@@insertpostscriptretain
[ {ThisPage} << #1 >> /PUT pdfmark}}}
+\def\doPDFpageresource#1%
+ {\message{[skipping PDF resource]}}
+
\def\doPDFpagesattribute#1%
{\doifsomething{#1}
{\special
{\@@insertpostscriptretain
[ #1 /PAGES pdfmark}}}
+\let\doPDFresetpageresources =\relax
\let\doPDFresetpageattributes=\relax
%D \macros
@@ -455,6 +466,4 @@
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-ps.tex b/tex/context/base/spec-ps.tex
index 9a5a81490..b31a4e4c0 100644
--- a/tex/context/base/spec-ps.tex
+++ b/tex/context/base/spec-ps.tex
@@ -20,7 +20,6 @@
%D dostartnegative,dostopnegative,
%D doselectfirstpaperbin,
%D doselectsecondpaperbin}
-%D {}
%D
%D This implementation is straightforward and can be used as
%D a default with postscript||drivers. We use \type{ps:} as
@@ -116,7 +115,6 @@
%D \macros
%D {doovalbox}
-%D {}
%D
%D This implementation is a mixture of several possible
%D implementations. We use some constants that may not be
@@ -144,14 +142,14 @@
\def\@@insertpostscriptretain {postscript } % unknown
\def\dosomeovalcalc#1#2#3%
- {\dimen2=#1sp%
- \advance\dimen2 by #2%
- \ScaledPointsToBigPoints{\number\dimen2}#3}
+ {\dimen2=#1%
+ \advance\dimen2 #2%
+ \PointsToBigPoints{\dimen2}#3}
\def\dosomeovalbox#1#2#3#4#5#6#7%
{\bgroup
- \dimen0=#4sp\divide\dimen0 by 2
- \dosomeovalcalc {0}{+\dimen0}\xmin
+ \dimen0=#4\divide\dimen0 2
+ \dosomeovalcalc{0pt}{+\dimen0}\xmin
\dosomeovalcalc{#1}{-\dimen0}\xmax
\dosomeovalcalc{#2}{-\dimen0}\ymax
\dosomeovalcalc{-#3}{+\dimen0}\ymin
@@ -183,7 +181,7 @@
{fill} if
grestore}%
\fi}%
- \wd0=#1sp\ht0=#2sp\dp0=#3sp\box0
+ \wd0=#1\ht0=#2\dp0=#3\box0
\egroup}
%D The indirect call permits a (rather) dirty hack, needed
@@ -198,8 +196,8 @@
%D These two specials are not yet working as expected.
\definespecial\dostartclipping#1#2#3%
- {\ScaledPointsToBigPoints{#2}\width
- \ScaledPointsToBigPoints{#3}\height
+ {\PointsToBigPoints{#2}\width
+ \PointsToBigPoints{#3}\height
\grabMPclippath{#1}{0}{\width}{\height}
{0 0 moveto \width 0 lineto \width \height lineto 0 \height\space lineto}%
\special
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 7dba68e6f..5b9d66613 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -138,8 +138,8 @@
%D it in a way we don't want, therefore we need:
\definespecial\dosetuppaper#1#2#3%
- {\global\pdfpagewidth =#2\relax
- \global\pdfpageheight=#3\relax}
+ {\global\pdfpagewidth #2\relax
+ \global\pdfpageheight#3\relax}
%D \macros
%D {doinsertfile,dogetnofinsertpages}
@@ -195,7 +195,7 @@
%D {\beforesplitstring#1\at.\to\filename
%D \scratchdimen=#3pt \PointsToReal{.01\scratchdimen}\xscale
%D \scratchdimen=#4pt \PointsToReal{.01\scratchdimen}\yscale
-%D \convertPDFtoPDF{\filename.pdf}\xscale\yscale{#5sp}{#6sp}{#7sp}{#8sp}}
+%D \convertPDFtoPDF{\filename.pdf}\xscale\yscale{#5}{#6}{#7}{#8}}
%D \stoptypen
%D
%D superseded by the next macros.
@@ -246,14 +246,14 @@
\doifvalidpdfimagefileelse{#1}
{\checkpdfimagepagenumber{#9}%
\immediate\pdfximage
- \ifcase#7 \else \!!width #7sp\fi
- \ifcase#8 \else \!!height #8sp\fi
+ \ifdim#7>\zeropoint \!!width #7\fi
+ \ifdim#8>\zeropoint \!!height #8\fi
\pdfimagepagenumber
{#1}%
\xdef\PDFimagereference{\the\pdflastximage}%
\xdef\nofinsertpages{\the\pdflastximagepages}%
\pdfrefximage\pdflastximage}
- {\framed[\c!breedte=#7sp,\c!hoogte=#8sp]{#1}}%
+ {\framed[\c!breedte=#7,\c!hoogte=#8]{#1}}%
\egroup}
\else
@@ -262,10 +262,10 @@
{\bgroup
\doifvalidpdfimagefileelse{#1}
{\pdfimage
- \ifcase#7 \else \!!width #7sp\fi
- \ifcase#8 \else \!!height #8sp\fi
+ \ifdim#7>\zeropoint \!!width #7\fi
+ \ifdim#8>\zeropoint \!!height #8\fi
{#1}}%
- {\framed[\c!breedte=#7sp,\c!hoogte=#8sp]{#1}}%
+ {\framed[\c!breedte=#7,\c!hoogte=#8]{#1}}%
\egroup}
\fi
@@ -314,8 +314,8 @@
\def\dogetTPDfiguresize#1#2#3#4#5#6#7%
{\ifmeasureTPDfiguresize
- #4=\!!zeropoint
- #5=\!!zeropoint
+ #4=\zeropoint
+ #5=\zeropoint
\doifvalidpdfimagefileelse{#2}
{\ifvoid\foundexternalfigure
\donetrue
@@ -338,8 +338,8 @@
\global\let\PDFfigurereference\empty
\global\let\PDFimageattributes\empty
\else
- #6=\!!zeropoint
- #7=\!!zeropoint
+ #6=\zeropoint
+ #7=\zeropoint
\fi
\else
#1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
@@ -349,14 +349,14 @@
\def\dogetTPDfiguresize#1#2#3#4#5#6#7%
{\ifmeasureTPDfiguresize
- #4=\!!zeropoint
- #5=\!!zeropoint
+ #4=\zeropoint
+ #5=\zeropoint
\doifvalidpdfimagefileelse{#2}
{\global\setbox\foundexternalfigure=\vbox{\pdfimage{#2}}%
#6=\wd\foundexternalfigure
#7=\ht\foundexternalfigure}
- {#6=\!!zeropoint
- #7=\!!zeropoint}%
+ {#6=\zeropoint
+ #7=\zeropoint}%
\else
#1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
\fi}
@@ -432,21 +432,66 @@
\definespecial\dostopnegative {\doPDFstopnegative}
%D \macros
+%D {dostarttransparency,dostoptransparency}
+%D
+%D For transparency, we need to implement a couple of
+%D auxiliary macros. If needed, we will generalize tham later.
+
+\definespecial\dostarttransparency {\doPDFstarttransparency}
+\definespecial\dostoptransparency {\doPDFstoptransparency}
+
+\PDFtransparencysupportedtrue
+
+\def\@@PDT{@PDT@}
+
+\newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+
+\def\assignPDFtransparency#1#2%
+ {\def\PDFtransparencyidentifier{/Tr#1}%
+ \def\PDFtransparencyreference{#2 0 R}}
+
+\def\presetPDFtransparency#1#2%
+ {\initializePDFtransparency
+ \executeifdefined{\@@PDT#1:#2}{\dopresetPDFtransparency{#1}{#2}}}
+
+\def\dopresetPDFtransparency#1#2%
+ {\global\advance\PDFcurrenttransparency 1
+ \immediate\pdfobj{\PDFtransparancydictionary{#1}{#2}{}}%
+ \edef\PDFtransparencyidentifier{/Tr\the\PDFcurrenttransparency}%
+ \edef\PDFtransparencyreference {\the\pdflastobj\space 0 R}%
+ \setxvalue{\@@PDT#1:#2}%
+ {\noexpand\assignPDFtransparency{\the\PDFcurrenttransparency}{\the\pdflastobj}}%
+ \appendtoPDFdocumentextgstates
+ {\PDFtransparencyidentifier\space
+ \PDFtransparencyreference\space}}
+
+\def\initializePDFtransparency
+ {\immediate\pdfobj{\PDFtransparancydictionary{1}{1}{/AIS false}}%
+ \xdef\PDFtransparencyresetidentifier{/Tr0}%
+ \xdef\PDFtransparencyresetreference{\the\pdflastobj\space 0 R}%
+ \setxvalue{\@@PDT0:0}%
+ {\noexpand\assignPDFtransparency{0}{\the\pdflastobj}}%
+ \appendtoPDFdocumentextgstates
+ {\PDFtransparencyresetidentifier\space
+ \PDFtransparencyresetreference\space}%
+ \global\let\initializePDFtransparency\relax}
+
+%D \macros
%D {dostartclipping,dostopclipping}
%D
%D Clipping in \PDFTEX\ is rather trivial. We can even hook
%D in \METAPOST\ without problems.
\definespecial\dostartclipping#1#2#3%
- {\ScaledPointsToBigPoints{#2}\width
- \ScaledPointsToBigPoints{#3}\height
+ {\PointsToBigPoints{#2}\width
+ \PointsToBigPoints{#3}\height
\grabMPclippath{#1}{1}{\width}{\height}
{0 0 m \width\space 0 l \width \height l 0 \height l}%
\pdfliteral
{q 0 w \MPclippath\space W n}}
\definespecial\dostopclipping%
- {\pdfliteral{Q}}
+ {\pdfliteral{Q n}}
%D \macros
%D {dosetupinteraction,
@@ -584,7 +629,7 @@
{\setPDFdestination{#1}%
\doifsomething{\PDFdestination}
{\pdfthread
- width #2sp height #3sp
+ width #2 height #3
attr {/Title (\PDFdestination)} % can be omitted
name {\PDFdestination}}}
@@ -650,12 +695,15 @@
\else
\dosetobjectreference{#1}{#2}{-\PDFimagereference}%
\global\let\PDFimagereference\empty
- \fi}}
+ \fi}}
\definespecial\dostopobject%
{\dodostopobject
\egroup}
+ \definespecial\doresetobjects
+ {\global\let\PDFimagereference\empty}
+
\definespecial\doinsertobject#1#2%
{\bgroup
\doifobjectreferencefoundelse{#1}{#2}
@@ -822,24 +870,62 @@
\newif\ifsharePDFactions \sharePDFactionstrue
+% hm, due to some stupid optimization this feature has been
+% disabled for some time, watch out \lastPDFaction is to be
+% persistent
+
\ifnum\pdftexversion>13
\def\doPDFaction width #1 height #2 action #3%
{\ifcollectreferenceactions
\xdef\lastPDFaction{#3}%
\else
- \xdef\lastPDFaction{<<#3>>}%
- \ifcase\similarreference\relax\or\ifsharePDFactions
- \immediate\pdfobj{\lastPDFaction}%
- \xdef\lastPDFaction{\the\pdflastobj\space0 R}%
- \fi\fi
+ \ifsharePDFactions
+ \ifcase\similarreference\relax
+ \xdef\lastPDFaction{<<#3>>}%
+ \or
+ \immediate\pdfobj{<<#3>>}%
+ \xdef\lastPDFaction{\the\pdflastobj\space0 R}%
+ \else
+ % leave \lastPDFaction untouched
+ \fi
+ \else
+ \xdef\lastPDFaction{<<#3>>}%
+ \fi
\pdfannot
- width #1sp height #2sp depth 0sp
+ width #1 height #2 depth \zeropoint
{/Subtype /Link
/Border [0 0 0]
\ifhighlighthyperlinks \else /H /N \fi
/A \lastPDFaction}%
- \fi}
+ \fi}
+
+ % less #2 passing
+
+ \def\doPDFaction width #1 height #2 action #3%
+ {\xdef\lastPDFcontent{#3}%
+ \ifcollectreferenceactions
+ \global\let\lastPDFaction\lastPDFcontent
+ \else
+ \ifsharePDFactions
+ \ifcase\similarreference\relax
+ \xdef\lastPDFaction{<<\lastPDFcontent>>}%
+ \or
+ \immediate\pdfobj{<<\lastPDFcontent>>}%
+ \xdef\lastPDFaction{\the\pdflastobj\space0 R}%
+ \else
+ % leave \lastPDFaction untouched
+ \fi
+ \else
+ \xdef\lastPDFaction{<<\lastPDFcontent>>}%
+ \fi
+ \pdfannot
+ width #1 height #2 depth \zeropoint
+ {/Subtype /Link
+ /Border [0 0 0]
+ \ifhighlighthyperlinks \else /H /N \fi
+ /A \lastPDFaction}%
+ \fi}
\else
@@ -847,13 +933,20 @@
{\ifcollectreferenceactions
\xdef\lastPDFaction{#3}%
\else
- \xdef\lastPDFaction{<<#3>>}%
- \ifcase\similarreference\relax\or\ifsharePDFactions
- \immediate\pdfobj{\lastPDFaction}%
- \xdef\lastPDFaction{\the\pdflastobj\space0 R}%
- \fi\fi
+ \ifsharePDFactions
+ \ifcase\similarreference\relax
+ \xdef\lastPDFaction{<<#3>>}%
+ \or
+ \immediate\pdfobj{<<#3>>}%
+ \xdef\lastPDFaction{\the\pdflastobj\space0 R}%
+ \else
+ % leave \lastPDFaction untouched
+ \fi
+ \else
+ \xdef\lastPDFaction{<<#3>>}%
+ \fi
\pdfannotlink % could be \pdfannot if not the - problem was there
- width #1sp height #2sp depth 0sp
+ width #1 height #2 depth \zeropoint
user {/Subtype /Link
/Border [0 0 0]
\ifhighlighthyperlinks \else /H /N \fi
@@ -866,7 +959,7 @@
% pdftex and viewers give problems with this one (printing forms)
%
%\def\doPDFannotation width #1 height #2 data #3%
-% {\pdfannot width #1sp height -#2sp depth 0sp {#3}}
+% {\pdfannot width #1sp height -#2sp depth \zeropoint{#3}}
%
% This is corrected in version 14. When this version is wide
% spread, this will be cleaned up.
@@ -874,12 +967,12 @@
\ifnum\pdftexversion>13
\def\doPDFannotation width #1 height #2 data #3%
- {\pdfannot width #1sp height #2sp depth 0sp {#3}}
+ {\pdfannot width #1 height #2 depth \zeropoint{#3}}
\else
\def\doPDFannotation width #1 height #2 data #3%
- {\hbox{\raise#2sp\hbox{\pdfannot width #1sp height #2sp depth 0sp {#3}}}}
+ {\hbox{\raise#2\hbox{\pdfannot width #1 height #2 depth \zeropoint{#3}}}}
\fi
@@ -891,10 +984,6 @@
%D the last annotation object number directly), we take the
%D save route.
-%\def\doPDFannotationobject class #1 name #2 width #3 height #4 data #5%
-% {\pdfannot width #3sp height -#4sp depth 0sp {#5}%
-% \dosetobjectreference{#1}{#2}{\the\pdflastannot}}
-
\def\doPDFannotationobject class #1 name #2 width #3 height #4 data #5%
{\doPDFannotation width #3 height #4 data {#5}%
\dosetobjectreference{#1}{#2}{\the\pdflastannot}}
@@ -911,15 +1000,17 @@
\def\doPDFpageattribute#1%
{\expanded{\global\pdfpageattr{#1\the\pdfpageattr}}}
+\def\doPDFpageresource#1%
+ {\expanded{\global\pdfpageresources{#1\the\pdfpageresources}}}
+
\def\doPDFpagesattribute#1%
{\expanded{\global\pdfpagesattr{#1\the\pdfpagesattr}}}
-\def\doPDFresetattributes%
- {\global\pdfpageattr{}}
+\def\doPDFresetpageattributes%
+ {\global\pdfpageattr\emptytoks}
-\appendtoksonce
- \doPDFresetattributes
-\to \everyaftershipout
+\def\doPDFresetpageresources%
+ {\global\pdfpageresources\emptytoks}
%D \macros
%D {doPDFbookmark}
@@ -975,19 +1066,13 @@
%D Here follow some rather obscure macros. They will only
%D come into action when one wants negated output.
-\let\PDFextgstates\empty
-
-\def\initializePDFnegative%
- {%\bgroup
- %\pdfcompresslevel=0
- \immediate\pdfobj stream attr {/FunctionType 4 /Range [0 1] /Domain [0 1]} {{1 exch sub}}%
+\def\initializePDFnegative
+ {\immediate\pdfobj stream attr {/FunctionType 4 /Range [0 1] /Domain [0 1]} {{1 exch sub}}%
\immediate\pdfobj{<</Type /ExtGState /TR \the\pdflastobj\space0 R>>}%
- \xdef\PDFextgstates{\PDFextgstates/GSnegative \the\pdflastobj\space0 R}%
+ \appendtoPDFdocumentextgstates{/GSnegative \the\pdflastobj\space0 R}%
\immediate\pdfobj{<</Type /ExtGState /TR /Identity>>}%
- \xdef\PDFextgstates{\PDFextgstates/GSpositive \the\pdflastobj\space0 R}%
- \global\let\initializePDFnegative\relax
- %\egroup
- \expanded{\global\pdfpageresources{/ExtGState <<\PDFextgstates>>}}}
+ \appendtoPDFdocumentextgstates{/GSpositive \the\pdflastobj\space0 R}%
+ \global\let\initializePDFnegative\relax}
% %D We can set \METAPOST\ prologues to~2:
@@ -997,6 +1082,4 @@
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-tr.tex b/tex/context/base/spec-tr.tex
index 1d12a80b5..5d52e0abd 100644
--- a/tex/context/base/spec-tr.tex
+++ b/tex/context/base/spec-tr.tex
@@ -28,8 +28,8 @@
\def\@@insertpostscriptretain {" }
%\definefileinsertion{tr}{eps}#1#2#3#4#5#6#7#8#9%
-% {\ScaledPointsToBigPoints{#5}\width
-% \ScaledPointsToBigPoints{#6}\height
+% {\PointsToBigPoints{#5}\width
+% \PointsToBigPoints{#6}\height
% \special
% {psfile=#1
% hscale=#3\space
@@ -40,8 +40,8 @@
%D Ugly but useful:
\definefileinsertion{tr}{eps}#1#2#3#4#5#6#7#8#9%
- {\ScaledPointsToWholeBigPoints{#7}\width
- \ScaledPointsToWholeBigPoints{#8}\height
+ {\PointsToWholeBigPoints{#7}\width
+ \PointsToWholeBigPoints{#8}\height
\special
{PSfile="#1"\space
llx=\EPSllx\space
@@ -53,7 +53,7 @@
\definefileinsertion{tr}{mps}#1#2#3#4#5#6#7#8#9%
{\hbox
- {\includeMPfonts{#1}%
+ {%\includeMPfonts{#1}% dvips know mp
\convertMPcolors{#1}%
\dofileinsertion{tr}{eps}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}}
diff --git a/tex/context/base/spec-win.tex b/tex/context/base/spec-win.tex
index 1633fcc65..77b88d005 100644
--- a/tex/context/base/spec-win.tex
+++ b/tex/context/base/spec-win.tex
@@ -42,11 +42,12 @@
{\doifparentfileelse{#4}
{\!!doneafalse}
{\!!doneatrue}}%
- %\hsmash{[l:#5]}%
\setreferencefilename#4\to\DVIfile
+ \scratchdimen#1\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#2\edef\height{\the\scratchdimen\space}%
\special
{button:
- #1 #2
+ \width \height
\if!!donea
file: \DVIfile,
\fi
@@ -62,11 +63,12 @@
{\doifparentfileelse{#4}
{\!!doneafalse}
{\!!doneatrue}}%
- %\hsmash{[p:#5]}%
\setreferencefilename#4\to\DVIfile
+ \scratchdimen#1\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#2\edef\height{\the\scratchdimen\space}%
\special
{button:
- #1 #2
+ \width \height
\if!!donea
file: \DVIfile,
\fi
@@ -77,20 +79,21 @@
\egroup}
\definespecial\dostartthisislocation#1%
- {%\hsmash{[m:#1]}%
- \special{mark: "#1"}}
+ {\special{mark: "#1"}}
\definespecial\dostartthisisrealpage#1%
{}
\definespecial\dostartrunprogram#1#2#3#4%
- {\special{button: #1 #2 launch: #3 #4}}
+ {\bgroup
+ \scratchdimen#1\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#2\edef\height{\the\scratchdimen\space}%
+ \special{button: \width \height launch: #3 #4}%
+ \egroup}
\let\doyandyinsertmov = \docommoninsertmov
\let\dotrinsertmov = \docommoninsertmov
\stopspecials
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/spec-yy.tex b/tex/context/base/spec-yy.tex
index e96ff4005..9d09b6e35 100644
--- a/tex/context/base/spec-yy.tex
+++ b/tex/context/base/spec-yy.tex
@@ -44,8 +44,8 @@
{\special{color gray 0}}
\definefileinsertion{yy}{eps}#1#2#3#4#5#6#7#8#9%
- {\ScaledPointsToBigPoints{#5}\width
- \ScaledPointsToBigPoints{#6}\height
+ {\PointsToBigPoints{#5}\width
+ \PointsToBigPoints{#6}\height
\special
{psfile=#1
hscale=#3\space
diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex
index 9ee5cfa91..0b6320502 100644
--- a/tex/context/base/supp-box.tex
+++ b/tex/context/base/supp-box.tex
@@ -19,7 +19,8 @@
\unprotect
-%D First a hack to make this module loadable in plain \TEX.
+%D First a couple of hacks to make this module loadable
+%D in plain \TEX.
\ifx\myalloc@\undefined % seems like we're not in context
\def\newbox{\alloc@4\box\chardef\insc@unt}
@@ -27,6 +28,11 @@
\ifx \scratchbox\undefined \newbox \scratchbox \fi
\ifx\globalscratchbox\undefined \newbox\globalscratchbox \fi
+
+\ifx\normalhbox \undefined \let\normalhbox \hbox \fi
+\ifx\normalvbox \undefined \let\normalvbox \vbox \fi
+\ifx\normalvtop \undefined \let\normalvtop \vtop \fi
+\ifx\normalvcenter\undefined \let\normalvcenter\vcenter \fi
%D \macros
%D {resetbox, emptybox}
@@ -55,9 +61,9 @@
%D one is presented first.
\def\smashbox#1%
- {\wd#1=\zeropoint
- \ht#1=\zeropoint
- \dp#1=\zeropoint}
+ {\wd#1\zeropoint
+ \ht#1\zeropoint
+ \dp#1\zeropoint}
%D \macros
%D {hsmashbox,vsmashbox}
@@ -66,35 +72,56 @@
%D the mode, horizontal or vertical, one can use:
\def\hsmashbox#1%
- {\wd#1=\zeropoint}
+ {\wd#1\zeropoint}
\def\vsmashbox#1%
- {\ht#1=\zeropoint
- \dp#1=\zeropoint}
+ {\ht#1\zeropoint
+ \dp#1\zeropoint}
%D The next implementation is less sensitive for spurious
%D spaces.
\newcount\registercount
-\def\dowithregister#1%
- {\def\dodowithregister{#1}%
- \afterassignment\dodowithregister\registercount}
+% \def\dowithregister#1%
+% {\def\dodowithregister{#1}%
+% \afterassignment\dodowithregister\registercount}
+%
+% \def\smashbox%
+% {\dowithregister
+% {\wd\registercount\zeropoint
+% \ht\registercount\zeropoint
+% \dp\registercount\zeropoint}}
+%
+% \def\hsmashbox%
+% {\dowithregister
+% {\wd\registercount\zeropoint}}
+%
+% \def\vsmashbox%
+% {\dowithregister
+% {\ht\registercount\zeropoint
+% \dp\registercount\zeropoint}}
\def\smashbox%
- {\dowithregister
- {\wd\registercount\zeropoint
- \ht\registercount\zeropoint
- \dp\registercount\zeropoint}}
+ {\afterassignment\dosmashbox\registercount}
+
+\def\dosmashbox
+ {\wd\registercount\zeropoint
+ \ht\registercount\zeropoint
+ \dp\registercount\zeropoint}
\def\hsmashbox%
- {\dowithregister
- {\wd\registercount\zeropoint}}
+ {\afterassignment\dohsmashbox\registercount}
+
+\def\dohsmashbox
+ {\wd\registercount\zeropoint}
\def\vsmashbox%
- {\dowithregister
- {\ht\registercount\zeropoint
- \dp\registercount\zeropoint}}
+ {\afterassignment\dovsmashbox\registercount}
+
+\def\dovsmashbox
+ {\ht\registercount\zeropoint
+ \dp\registercount\zeropoint}
%D \macros
%D {hsmash,vsmash,
@@ -137,18 +164,14 @@
%D math module (although the \type {\leavevmode} is not added
%D here).
-\def\smash%
+\def\smash
{\futurelet\nexttoken\dosmash}
-\def\dosmash%
- {\ifx\nexttoken[%
- \@EA\dodosmash
- \else
- \@EA\dodosmash\@EA[\@EA h\@EA d\@EA]%
- \fi}
+\def\dosmash
+ {\ifx\nexttoken[\@EA\dodosmash\else\@EA\donosmash\fi}
-% \def\smash% test
-% {\doifnextcharelse{[}{\dodosmash}{\dodosmash[hd]}}
+\def\donosmash
+ {\dodosmash[hd]}
\def\dodosmash[#1]%
{\edef\@@smash{#1}\futurelet\nexttoken\dododosmash}
@@ -175,7 +198,7 @@
\def\finsm@sh% redefined plain macro
{\dowithnextbox
- {\@EA\handletokens\@@smash\with\makesm@sh\box\nextbox}\hbox}
+ {\@EA\handletokens\@@smash\with\makesm@sh\box\nextbox}\normalhbox}
%D \starttabulatie[|l|l|]
%D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR
@@ -219,7 +242,7 @@
\ht\scratchbox\ht#1\dp\scratchbox\dp#2\wd\scratchbox\wd#3%
\box\scratchbox
\endgroup}
- \hbox}
+ \normalhbox}
% used in table
%
@@ -228,12 +251,9 @@
\let\finph@nt\undefined
-% %D We have to redefine plain's \type {\mathstrut}. Well,
-% %D this is not longer needed.
-% %D
-% %D \starttypen
-% %D \def\mathstrut{\vphantom{(}}
-% %D \stoptypen
+%D We also define plain's \type {\mathstrut}.
+
+\def\mathstrut{\vphantom{(}}
%D \macros
%D {getboxheight}
@@ -259,7 +279,7 @@
%D \stoptypen
\def\getboxheight#1\of#2\box#3%
- {#1=\ht#3\advance#1\dp#3\relax}
+ {#1\ht#3\advance#1\dp#3\relax}
%D \macros
%D {doiftextelse, doiftext}
@@ -273,17 +293,26 @@
%D \doiftext {data} {then branch}
%D \stoptypen
-\def\doiftextelse#1#2#3%
+%\def\doiftextelse#1#2#3%
+% {\bgroup
+% \setbox0=\normalhbox{#1}%
+% \ifdim\wd0>\zeropoint
+% \egroup#2%
+% \else
+% \egroup#3%
+% \fi}
+
+\def\doiftextelse#1%
{\bgroup
- \setbox0=\hbox{#1}%
+ \setbox0\normalhbox{#1}%
\ifdim\wd0>\zeropoint
- \egroup#2%
+ \egroup\@EA\firstoftwoarguments
\else
- \egroup#3%
+ \egroup\@EA\secondoftwoarguments
\fi}
\def\doiftext#1#2%
- {\doiftextelse{#1}{#2}{}}
+ {\doiftextelse{#1}{#2}\donothing}
%D \macros
%D {dowithnextbox,nextbox}
@@ -309,7 +338,7 @@
%D \starttypen
%D \def\getfloat%
%D {\def\handlefloat{...\box\nextbox...}
-%D \dowithnextbox\handlefloat\vbox}
+%D \dowithnextbox\handlefloat\normalvbox}
%D \stoptypen
%D
%D instead of:
@@ -333,13 +362,6 @@
\def\dododowithnextbox%
{\aftergroup\dodowithnextbox}
-% Better but first to be checked:
-%
-%\long\def\dowithnextbox#1%
-% {\bgroup\long\def\dodowithnextbox{#1\egroup}%
-% \afterassignment\dododowithnextbox
-% \setbox\nextbox}
-
%D So in fact we get:
%D
%D \starttypen
@@ -357,13 +379,13 @@
%D \starttypen
%D \long\def\dowithnextbox#1#2%
%D {\long\def\dodowithnextbox{#1}%
-%D \ifx#2\hbox
+%D \ifx#2\normalhbox
%D \afterassignment\dododowithnextbox
-%D \else\ifx#2\vbox
+%D \else\ifx#2\normalvbox
%D \afterassignment\dododowithnextbox
-%D \else\ifx#2\vtop
+%D \else\ifx#2\normalvtop
%D \afterassignment\dododowithnextbox
-%D \else\ifx#2\vcenter
+%D \else\ifx#2\normalvcenter
%D \afterassignment\dododowithnextbox
%D \else
%D \afterassignment\dodowithnextbox
@@ -384,6 +406,8 @@
%D \starttypen
%D \dowithnextboxcontent{inside}{after}{box content}
%D \stoptypen
+%D
+%D {\em todo: Search source for potential usage!}
\long\def\dowithnextboxcontent#1#2% inside, after
{\long\def\dodowithnextbox{#2}%
@@ -399,7 +423,8 @@
%D \macros
%D {llap, rlap, tlap, blap}
%D
-%D Some well known friends.
+%D Some well known friends, but we implement them our own
+%D way.
\def\rlap{\begingroup\dowithnextbox{\normalhbox to \zeropoint
{\box\nextbox\normalhss}\endgroup}\normalhbox}
@@ -458,7 +483,7 @@
%D
%D \reshapebox
%D {\doglobal\increment\LineNumber
-%D \hbox{\llap{\LineNumber\hskip2em}\box\shapebox}}
+%D \normalhbox{\llap{\LineNumber\hskip2em}\box\shapebox}}
%D
%D \flushshapebox
%D \stopbuffer
@@ -480,7 +505,7 @@
%D
%D \reshapebox
%D {\doglobal\increment\LineNumber
-%D \hbox
+%D \normalhbox
%D {\llap{\LineNumber\ (\NumberOfLines)\hskip2em}%
%D \box\shapebox}%
%D \doglobal\decrement\NumberOfLines}
@@ -503,7 +528,7 @@
%D
%D \reshapebox
%D {\doglobal\increment\LineNumber
-%D \hbox{\llap{$\star$\hskip1em}\box\shapebox}%
+%D \normalhbox{\llap{$\star$\hskip1em}\box\shapebox}%
%D \doglobal\decrement\NumberOfLines}
%D
%D \flushshapebox
@@ -556,67 +581,16 @@
{\kern \shapekern }
{\vskip \shapeskip }}
-%\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
-% {\setbox\newshapebox=\normalvbox
-% \bgroup
-% \unvcopy\oldshapebox
-% \resetbox\newshapebox
-% \shapecounter=0
-% \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}%
-% \unvbox\newshapebox
-% \egroup}
-%
-%\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
-% {\ifdim\lastskip=\zeropoint\relax
-% \ifdim\lastkern=\zeropoint\relax
-% \ifnum\lastpenalty=0
-% \setbox\shapebox=\lastbox
-% \ifvoid\shapebox
-% \unskip\unpenalty\unkern
-% \else
-% \ifdim\wd\shapebox=\shapesignal\relax
-% \exitloop
-% \else
-% \shapecounter=0
-% \setbox\newshapebox=
-% \normalvbox{#1\unvbox\newshapebox}
-% \fi
-% \fi
-% \else
-% \shapepenalty=\lastpenalty
-% \setbox\newshapebox=
-% \normalvbox{#2\unvbox\newshapebox}
-% \unpenalty
-% \fi
-% \else
-% \shapekern=\lastkern
-% \setbox\newshapebox=
-% \normalvbox{#3\unvbox\newshapebox}
-% \unkern
-% \fi
-% \else
-% \shapeskip=\lastskip
-% \setbox\newshapebox=
-% \normalvbox{#4\unvbox\newshapebox}
-% \unskip
-% \fi
-% \ifnum\shapecounter>100 % can be less
-% \message{<<forced exit from shapebox>>}%
-% \exitloop
-% \else
-% \advance\shapecounter by 1
-% \fi}
-
\newbox\tmpshapebox
\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
{\ifdim\ht\oldshapebox=\zeropoint
- \setbox\newshapebox=\normalvbox{}%
+ \setbox\newshapebox\normalvbox{}%
\else
- \setbox\newshapebox=\normalvbox
+ \setbox\newshapebox\normalvbox
{\unvcopy\oldshapebox
\resetbox\newshapebox
- \shapecounter=0
+ \shapecounter\zerocount
\doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}%
\setbox\newshapebox\box\tmpshapebox
\fi}
@@ -624,56 +598,52 @@
\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
{\ifdim\lastskip=\zeropoint\relax
\ifdim\lastkern=\zeropoint\relax
- \ifnum\lastpenalty=0
- \setbox\shapebox=\lastbox
+ \ifcase\lastpenalty % =\zerocount
+ \setbox\shapebox\lastbox
\ifvoid\shapebox
\unskip\unpenalty\unkern
\else
\ifdim\wd\shapebox=\shapesignal\relax
\exitloop
\else
- \shapecounter=0
- \global\setbox\tmpshapebox=
- \normalvbox{#1\unvbox\tmpshapebox}
+ \shapecounter\zerocount
+ \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}
\fi
\fi
\else
- \shapepenalty=\lastpenalty
- \global\setbox\tmpshapebox=
- \normalvbox{#2\unvbox\tmpshapebox}
+ \shapepenalty\lastpenalty
+ \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}
\unpenalty
\fi
\else
- \shapekern=\lastkern
- \global\setbox\tmpshapebox=
- \normalvbox{#3\unvbox\tmpshapebox}
+ \shapekern\lastkern
+ \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}
\unkern
\fi
\else
- \shapeskip=\lastskip
- \global\setbox\tmpshapebox=
- \normalvbox{#4\unvbox\tmpshapebox}
+ \shapeskip\lastskip
+ \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}
\unskip
\fi
\ifnum\shapecounter>100 % can be less
\message{<<forced exit from shapebox>>}%
- \global\setbox\tmpshapebox=\copy\oldshapebox
+ \global\setbox\tmpshapebox\copy\oldshapebox
\exitloop
\else
- \advance\shapecounter by 1
+ \advance\shapecounter \plusone
\fi}
%\def\beginofshapebox%
% {\setbox\oldshapebox=\normalvbox
% \bgroup
% \reshapingboxtrue
-% \hbox to \shapesignal{\hss}}
+% \normalhbox to \shapesignal{\hss}}
\def\beginofshapebox%
- {\setbox\oldshapebox=\normalvbox
+ {\setbox\oldshapebox\normalvbox
\bgroup
\reshapingboxtrue
- \hbox to \shapesignal{\strut\hss} % plus \strut
+ \normalhbox to \shapesignal{\strut\hss}% plus \strut
\prevdepth\dp\strutbox % hm
}%\nointerlineskip} % suppress parskip
@@ -684,40 +654,6 @@
\let\beginshapebox=\beginofshapebox
\let\endshapebox =\endofshapebox
-%\def\flushshapebox%
-% {\ifdim\ht\newshapebox=\zeropoint\relax
-% \else
-% % make \prevdepth legal
-% % \par before the next \vskip gives far worse results
-% \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi
-% % and take a look
-% \ifdim\prevdepth=-1000pt
-% \prevdepth=\zeropoint
-% \fi
-% \ifdim\prevdepth<\zeropoint\relax
-% % something like a line or a signal or ...
-% \donetrue
-% \else\ifinner
-% % not watertight and not ok
-% \donefalse
-% \else\ifdim\pagegoal=\maxdimen
-% \donetrue
-% \else
-% % give the previous line a normal depth
-% \donetrue
-% \vbox{\forgetall\strut}\nobreak\kern-\lineheight % geen \vskip
-% \vskip-\dp\strutbox
-% \fi\fi\fi
-% \unvcopy\newshapebox\relax
-% % \prevdepth=0pt and \dp\newshapebox depend on last line
-% \kern-\dp\newshapebox\relax
-% % now \prevdepth=0pt
-% \ifdone
-% \kern\dp\strutbox
-% \prevdepth\dp\strutbox
-% \fi
-% \fi}
-
\def\flushshapebox%
{\bgroup
\ifdim\ht\newshapebox=\zeropoint\relax
@@ -727,7 +663,7 @@
\ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi
% and take a look
\ifdim\prevdepth=-1000pt
- \prevdepth=\zeropoint
+ \prevdepth\zeropoint
\fi
\ifdim\prevdepth<\zeropoint\relax
% something like a line or a signal or ...
@@ -740,7 +676,7 @@
\else
% give the previous line a normal depth
\donetrue
- {\everypar\emptytoks\vbox{\strut}}\nobreak
+ {\everypar\emptytoks\normalvbox{\strut}}\nobreak
\kern-\lineheight % geen \vskip
\kern-\parskip
% \vskip-\dp\strutbox
@@ -770,8 +706,7 @@
% \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test}
\def\innerflushshapebox%
- {\ifdim\ht\newshapebox=\zeropoint\relax
- \else
+ {\ifdim\ht\newshapebox=\zeropoint\relax \else
\unvcopy\newshapebox\relax
% \kern-\dp\newshapebox\relax
\fi}
@@ -792,15 +727,15 @@
%D
%D When constructing a new box, using the content of \type
%D {\shapebox}, one can best use \type {\shapedhbox} instead
-%D of \type {\hbox}, since it manages the height and depth of
+%D of \type {\normalhbox}, since it manages the height and depth of
%D the line.
\def\shapedhbox%
{\dowithnextbox
- {\ht\nextbox=\zeropoint
- \dp\nextbox=\zeropoint
+ {\ht\nextbox\zeropoint
+ \dp\nextbox\zeropoint
\box\nextbox}
- \hbox}
+ \normalhbox}
%D \macros
%D {hyphenatedword,
@@ -842,30 +777,30 @@
\def\dohyphenateword#1#2#3%
{\bgroup
- \setbox0=\hbox
+ \setbox0=\normalhbox
{\mindermeldingen
\widowpenalty=0
\clubpenalty=0
- \setbox0=\vbox
+ \setbox0=\normalvbox
{\hsize\zeropoint \ #3}%
\ifnum#1>0
\dorecurse{#1}
- {\setbox2=\hbox
+ {\setbox2=\normalhbox
{\splittopskip=\openstrutheight
\vsplit0 to \baselineskip}}%
#2%
\fi
\loop
- \setbox2=\hbox
+ \setbox2=\normalhbox
{\splittopskip=\openstrutheight
\vsplit0 to \baselineskip}%
- \hbox
+ \normalhbox
{\unhbox2
\setbox2=\lastbox
- \vbox
+ \normalvbox
{\unvbox2
\setbox2=\lastbox
- \hbox{\unhbox2}}}%
+ \normalhbox{\unhbox2}}}%
\ifdim\ht0>\zeropoint
\repeat}%
\ht0=\ht\strutbox
@@ -895,7 +830,7 @@
%D complex macro than needed at first sight.
% \def\dodoboundtext#1%
-% {\setbox0=\hbox{\unhcopy0 #1}%
+% {\setbox0=\normalhbox{\unhcopy0 #1}%
% \ifdim\wd0>\dimen0
% \let\dodoboundtext=\gobbleoneargument
% \else
@@ -903,13 +838,13 @@
% \fi}
%
% \def\doboundtext#1#2#3%
-% {\hbox
-% {\setbox0=\hbox{#1}%
+% {\normalhbox
+% {\setbox0=\normalhbox{#1}%
% \dimen0=#2\relax
% \ifdim\wd0>\dimen0
-% \setbox2=\hbox{#3}%
+% \setbox2=\normalhbox{#3}%
% \advance\dimen0 by -\wd2
-% \setbox0=\hbox{}%
+% \setbox0=\normalhbox{}%
% \processtokens
% {\dodoboundtext}
% {\dodoboundtext}
@@ -922,17 +857,17 @@
% \fi}}
\def\dodoboundtext#1%
- {\setbox2=\hbox{#1}%
- \advance\dimen0 by -\wd2
+ {\setbox2=\normalhbox{#1}%
+ \advance\dimen0 -\wd2
\ifdim\dimen0>\zeropoint\relax#1\fi}%
\def\doboundtext#1#2#3%
- {\hbox
- {\setbox0=\hbox{#1}%
+ {\normalhbox
+ {\setbox0=\normalhbox{#1}%
\dimen0=#2\relax
\ifdim\wd0>\dimen0
- \setbox0=\hbox{#3}%
- \advance\dimen0 by -\wd0
+ \setbox0=\normalhbox{#3}%
+ \advance\dimen0 -\wd0
\handletokens#1\with\dodoboundtext
\fi
\box0}}
@@ -946,7 +881,8 @@
%D on text that cannot be hyphenated.
%D
%D \starttypen
-%D \limitatetext {text} {width} {sentinel}
+%D \limitatetext {text} {width} {sentinel}
+%D \limitatetext {text} {-width} {prelude}
%D \stoptypen
%D
%D When no width is given, the whole text comes available. The
@@ -959,8 +895,9 @@
%D \starttypen
%D \unexpanded\def\limitatetext%
%D {\bgroup % evt \setstrut
+%D \forgetall
%D \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! !
-%D \dowithnextbox\dolimitatetext\hbox}
+%D \dowithnextbox\dolimitatetext\normalhbox}
%D
%D \def\dolimitatetext#1#2%
%D {\doifelsenothing{#1}
@@ -969,9 +906,9 @@
%D \clubpenalty=0
%D \scratchdimen=#1\relax
%D \ifdim\wd\nextbox>\scratchdimen
-%D \setbox\scratchbox=\hbox{ #2}%
+%D \setbox\scratchbox=\normalhbox{ #2}%
%D \advance\scratchdimen by -\wd\scratchbox
-%D \setbox\nextbox=\vbox
+%D \setbox\nextbox=\normalvbox
%D {\hsize=\scratchdimen
%D \hfuzz\maxdimen
%D \veryraggedright
@@ -979,12 +916,12 @@
%D \ifdim\ht\nextbox>\ht\strutbox \else
%D \setbox\scratchbox\null % overfull and not split
%D \fi
-%D \setbox\nextbox=\vbox % if omitted: missing brace reported
+%D \setbox\nextbox=\normalvbox % if omitted: missing brace reported
%D {\splittopskip=\openstrutheight
%D \setbox\nextbox=\vsplit\nextbox to \ht\strutbox
%D \unvbox\nextbox
%D \setbox\nextbox=\lastbox
-%D \global\setbox1=\hbox
+%D \global\setbox1=\normalhbox
%D {\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox\unskip}}%
%D \unhbox1
%D \else
@@ -999,49 +936,52 @@
\unexpanded\def\limitatetext%
{\bgroup % evt \setstrut
+ \forgetall % otherwise indentation and so
+ %\def\limitatetext##1##2##3{##1}% \def !
+ \let\limitatetext\firstofthreearguments
\fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! !
- \dowithnextbox\dolimitatetext\hbox}
+ \dowithnextbox\dolimitatetext\normalhbox}
\def\dolimitatetext#1#2%
{\doifelsenothing{#1}
{\unhbox\nextbox}
- {\widowpenalty=0
- \clubpenalty=0
- \scratchdimen=#1\relax
+ {\widowpenalty\zerocount
+ \clubpenalty\zerocount
+ \scratchdimen#1\relax
\ifdim\scratchdimen<\zeropoint\relax % we'll take the last line
\donefalse
- \scratchdimen=-\scratchdimen
+ \scratchdimen-\scratchdimen
\else
\donetrue
\fi
\ifdim\wd\nextbox>\scratchdimen
- \setbox\scratchbox=\hbox{\ifdone\space#2\else#2\space\fi}%
- \advance\scratchdimen by -\wd\scratchbox
- \setbox0=\box\nextbox
- \setbox\nextbox=\vbox
- {\hsize=\scratchdimen
+ \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}%
+ \advance\scratchdimen -\wd\scratchbox
+ \setbox0\box\nextbox
+ \setbox\nextbox\normalvbox
+ {\hsize\scratchdimen
\hfuzz\maxdimen
\veryraggedright
\strut
\ifdone \else
- \parfillskip=\zeropoint
- \rightskip=\zeropoint
+ \parfillskip\zeropoint
+ \rightskip\zeropoint
\hskip\zeropoint \!!plus 1\!!fill % \hsize
\fi
\unhcopy0}%
\ifdim\ht\nextbox>\ht\strutbox
- \setbox\nextbox=\vbox % if omitted: missing brace reported
- {\splittopskip=\openstrutheight
+ \setbox\nextbox\normalvbox % if omitted: missing brace reported
+ {\splittopskip\openstrutheight
\ifdone
- \setbox\nextbox=\vsplit\nextbox to \ht\strutbox
+ \setbox\nextbox\vsplit\nextbox to \ht\strutbox
\else
\doloop
- {\setbox0=\vsplit\nextbox to \ht\strutbox
+ {\setbox0\vsplit\nextbox to \ht\strutbox
\ifdim\ht\nextbox>\ht\strutbox \else \exitloop \fi}%
\fi
\unvbox\nextbox
- \setbox\nextbox=\lastbox
- \global\setbox1=\hbox
+ \setbox\nextbox\lastbox
+ \global\setbox1\normalhbox
{\ifdone
\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox
\else
@@ -1056,6 +996,44 @@
\unhbox\nextbox
\fi}%
\egroup}
+
+%D We can also limit a text with more control:
+%D
+%D \startbuffer
+%D \limitatetext {\input tufte } {2cm,5mm} {\unknown}
+%D \limitatetext {ton en hans} {2cm,5mm} {\unknown}
+%D \limitatetext {ton en hans zijn eikels} {2cm,5mm} {\unknown}
+%D \limitatetext {ton} {2cm,5mm} {\unknown}
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+%D
+%D We build this feature on top of the previous macro.
+
+\let\normallimitatetext\limitatetext
+
+\def\speciallimitatetext#1#2#3#4% text left right placeholder
+ {%\dontleavehmode
+ \bgroup
+ %\def\speciallimitatetext##1##2##3##4{##1}% \def !
+ \let\speciallimitatetext\firstoffourarguments
+ \setbox0\normalhbox
+ {\nohyphens
+ \normallimitatetext{#1}{+#2}{}#4%
+ \normallimitatetext{#1}{-#3}{}}%
+ \setbox2\normalhbox
+ {#1}%
+ \ifdim\wd2<\wd0 #1\else\unhbox0\fi
+ \egroup}
+
+\def\limitatetext#1#2#3%
+ {\beforesplitstring#2\at,\to\leftlimit
+ \aftersplitstring #2\at,\to\rightlimit
+ \ifx\rightlimit\empty
+ \normallimitatetext{#1}{\leftlimit}{#3}%
+ \else
+ \speciallimitatetext{#1}{\leftlimit}{\rightlimit}{#3}%
+ \fi}
%D \macros
%D {processisolatedwords,
@@ -1094,7 +1072,7 @@
%D \startbuffer
%D \processisolatedwords{some more words} \ruledhbox \par
%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par
-%D \processisolatedwords{and a \hbox{$x + y = z$}} \ruledhbox \par
+%D \processisolatedwords{and a \normalhbox{$x + y = z$}} \ruledhbox \par
%D \stopbuffer
%D
%D \typebuffer
@@ -1131,8 +1109,8 @@
%D strange and|/|or complicated arguments or simply boxes
%D whose dimensions are to be left intact.
%D
-%D First we build a \type{\hbox}. This enables us to save the
-%D last skip. Next we fill a \type{\vbox} without hyphenating
+%D First we build a \type{\normalhbox}. This enables us to save the
+%D last skip. Next we fill a \type{\normalvbox} without hyphenating
%D words. After we've tested if there is more than one word, we
%D start processing the individual lines (words). We need some
%D splitting, packing and unpacking to get the spacing and
@@ -1159,40 +1137,40 @@
\fakecompoundhyphen
\mindermeldingen
\forgetall
- \widowpenalty=0
- \clubpenalty=0
+ \widowpenalty\zerocount
+ \clubpenalty\zerocount
\def\processisolatedwords##1##2{##2{##1}}% we split only once
\global\let\localbetweenisolatedwords\betweenisolatedwords
- \setbox0=\hbox % we default to spaces, but from inside out
+ \setbox0\normalhbox % we default to spaces, but from inside out
{\ignorespaces#1% \localbetweenisolatedwords can be overruled
\global\isolatedlastskip\lastskip}%
- \setbox2=\vbox
- {%\hyphenpenalty10000 % this one fails in \url breaking,
- \lefthyphenmin=\!!maxcard % but this trick works ok, due to them
- \righthyphenmin=\!!maxcard % total>63, when no hyphenation is done
+ \setbox2\normalvbox
+ {%\hyphenpenalty10000 % this one fails in \url breaking,
+ \lefthyphenmin\maxcard % but this trick works ok, due to them
+ \righthyphenmin\maxcard % total>63, when no hyphenation is done
\hsize\zeropoint
\unhcopy0}% == #1
\ifdim\ht0=\ht2
\isolatedwordsfalse
- #2{\unhcopy0}% == #2{#1}
+ #2{\unhbox0}% == #2{#1} % was \unhcopy0
\else
\isolatedwordstrue
- \setbox0=\hbox
+ \setbox0=\normalhbox
{\ignorespaces
\loop
- \setbox4=\hbox
- {\splittopskip=\openstrutheight
+ \setbox4\normalhbox
+ {\splittopskip\openstrutheight
\vsplit2 to \baselineskip}%
- \hbox
+ \normalhbox
{\unhbox4\unskip % recently added
- \setbox4=\lastbox
- \vbox % outer \hbox needed
+ \setbox4\lastbox
+ \normalvbox % outer \normalhbox needed
{\unvbox4 % for nested use
- \setbox4=\lastbox
- \hbox{#2{\hbox
+ \setbox4\lastbox
+ \normalhbox{#2{\normalhbox
{\unhbox4
\unskip\unpenalty % remove end of line stuff
- \global\dimen1=\lastkern}}}}}%
+ \global\dimen1\lastkern}}}}}%
\ifdim\ht2>\zeropoint\relax
\ifdim\dimen1=\compoundbreakpoint
\allowbreak
@@ -1202,7 +1180,7 @@
\repeat
\unskip}%
\unhbox0\unskip
- \ifdim\isolatedlastskip=\zeropoint\relax\else % added
+ \ifdim\isolatedlastskip=\zeropoint\else % added
\hskip\isolatedlastskip
\fi
\fi
@@ -1247,14 +1225,21 @@
\def\sbox% in handleiding, voorbeeld \inlinker{xx} \extern..
{\dowithnextbox
- {\setbox0=\hbox
+ {\setbox\scratchbox\normalhbox
{\strut
- \dp\nextbox=0pt
+ \dp\nextbox\zeropoint
\lower\strutdepth\box\nextbox}%
- \dp0=\strutdepth
- \ht0=\strutheight
- \box0}%
- \vbox}
+ \dp\scratchbox\strutdepth
+ \ht\scratchbox\strutheight
+ \box\scratchbox}%
+ \normalvbox}
+
+\def\struttedbox
+ {\dowithnextbox
+ {\dp\nextbox\strutdepth
+ \ht\nextbox\strutheight
+ \box\nextbox}%
+ \normalhbox}
%D \macros
%D {centeredbox, centerednextbox}
@@ -1304,19 +1289,19 @@
\def\centeredbox#1#% height +/-dimen width +/-dimen
{\bgroup
- \setbox0=\vbox to \vsize
+ \setbox0\normalvbox to \vsize
\bgroup
\mindermeldingen
\forgetall
- \setbox0=\hbox{\vrule\!!width \zeropoint#1}%
- \setbox2=\vbox{\hrule\!!height\zeropoint#1}%
- \advance\vsize by \ht2
- \advance\hsize by \wd0
- \vbox to \vsize
+ \setbox0\normalhbox{\vrule\!!width \zeropoint#1}%
+ \setbox2\normalvbox{\hrule\!!height\zeropoint#1}%
+ \advance\vsize \ht2
+ \advance\hsize \wd0
+ \normalvbox to \vsize
\bgroup
\vskip-\ht2
\vss
- \hbox to \hsize
+ \normalhbox to \hsize
\bgroup
\dowithnextbox
{\hskip-\wd0
@@ -1327,11 +1312,11 @@
\vss
\egroup
\egroup
- \wd0=\hsize
- \ht0=\vsize
+ \wd0\hsize
+ \ht0\vsize
\box0
\egroup}
- \hbox}
+ \normalhbox}
%D For those who don't want to deal with \type {\hsize}
%D and \type {\vsize}, we have:
@@ -1350,7 +1335,7 @@
\vsize\ht\nextbox
\centeredbox#1{\box\nextbox}%
\egroup}
- \hbox}
+ \normalhbox}
%D \macros
%D {centerbox}
@@ -1368,13 +1353,13 @@
{\bgroup
\dowithnextbox
{\setlocalhsize
- \setbox0=\hbox{\vrule\!!width\zeropoint#1}%
- \setbox2=\vbox{\hrule\!!height\zeropoint#1}%
+ \setbox0\normalhbox{\vrule\!!width \zeropoint#1}%
+ \setbox2\normalvbox{\hrule\!!height\zeropoint#1}%
\hsize\ifdim\wd0=\zeropoint\hsize\else\wd0\fi
\vsize\ifdim\ht2=\zeropoint\vsize\else\ht2\fi
- \vbox to \vsize{\vss\hbox to \hsize{\hss\box\nextbox\hss}\vss}%
+ \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\box\nextbox\hss}\vss}%
\egroup}%
- \hbox}
+ \normalhbox}
%D \macros
%D {setrigidcolumnhsize,rigidcolumnbalance}
@@ -1401,13 +1386,13 @@
\def\setrigidcolumnhsize#1#2#3%
{\xdef\savedrigidhsize{\the\hsize}%
- \hsize=#1\relax
+ \hsize#1\relax
\global\chardef\rigidcolumns=#3\relax
- \scratchdimen=-#2\relax
- \multiply\scratchdimen by #3\relax
- \advance\scratchdimen by #2\relax
- \advance\hsize by \scratchdimen
- \divide\hsize by #3\relax}
+ \scratchdimen -#2\relax
+ \multiply\scratchdimen #3\relax
+ \advance\scratchdimen #2\relax
+ \advance\hsize \scratchdimen
+ \divide\hsize #3\relax}
\newbox\rigidcolumnbox
@@ -1415,34 +1400,34 @@
{\ifnum\rigidcolumns=1 % tzt ook h/d correctie
\ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax
\else
- \vbox
+ \normalvbox
{\forgetall
\dontcomplain
- \setbox\rigidcolumnbox=\vbox
+ \setbox\rigidcolumnbox\normalvbox
{\line{}\goodbreak\unvbox#1\removebottomthings}%
- \splittopskip=\openstrutheight
- \setbox\scratchbox=\vsplit\rigidcolumnbox to \zeropoint
- \scratchdimen=\ht\rigidcolumnbox
- \divide\scratchdimen by \rigidcolumns
+ \splittopskip\openstrutheight
+ \setbox\scratchbox\vsplit\rigidcolumnbox to \zeropoint
+ \scratchdimen\ht\rigidcolumnbox
+ \divide\scratchdimen \rigidcolumns
\getnoflines\scratchdimen
- \scratchdimen=\noflines\lineheight
- \setbox\scratchbox=\hbox to \savedrigidhsize
- {\dorecurse{\rigidcolumns}
+ \scratchdimen\noflines\lineheight
+ \setbox\scratchbox\normalhbox to \savedrigidhsize
+ {\dorecurse\rigidcolumns
{\setbox\scratchbox=\vsplit\rigidcolumnbox to \scratchdimen
\dp\scratchbox=\openstrutdepth
- \setbox\scratchbox=\vtop
+ \setbox\scratchbox=\normalvtop
\ifalignrigidcolumns to
\ifstretchrigidcolumns\vsize\else\scratchdimen\fi
\fi
- {\unvbox\scratchbox}%
+ {\unvbox\scratchbox}%
\wd\scratchbox=\hsize
\box\scratchbox
\hfill}%
\hfillneg}%
- \advance\scratchdimen by -\openstrutdepth
- \setbox\scratchbox\hbox{\raise\scratchdimen\box\scratchbox}
- \dp\scratchbox=\openstrutdepth
- \ht\scratchbox=\scratchdimen
+ \advance\scratchdimen -\openstrutdepth
+ \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}
+ \dp\scratchbox\openstrutdepth
+ \ht\scratchbox\scratchdimen
\box\scratchbox}
\fi}
@@ -1454,14 +1439,14 @@
%D like:
%D
%D \starttypen
-%D \vbox
+%D \normalvbox
%D \bgroup
%D \startvboxtohbox ... \stopvboxtohbox
%D \startvboxtohbox ... \stopvboxtohbox
%D \startvboxtohbox ... \stopvboxtohbox
%D \egroup
%D
-%D \vbox
+%D \normalvbox
%D \bgroup
%D \converthboxtovbox
%D \egroup
@@ -1481,18 +1466,18 @@
\fi
\divide\dimen0 by \hsize
\multiply\dimen0 by 64
- \xdef\vboxtohboxfactor{\expandafter\withoutpt\the\dimen0}%
+ \xdef\normalvboxtohboxfactor{\expandafter\withoutpt\the\dimen0}%
\egroup}
\def\startvboxtohbox%
{\bgroup
\setvboxtohbox
- \setbox0=\hbox\bgroup}
+ \setbox0=\normalhbox\bgroup}
\def\stopvboxtohbox%
{\egroup
\dp0=\zeropoint
- \ht0=\vboxtohboxfactor\wd0
+ \ht0=\normalvboxtohboxfactor\wd0
\box0
\egroup}
@@ -1501,16 +1486,16 @@
%
% \def\stopvboxtohbox%
% {\egroup
-% \setbox2=\vbox
+% \setbox2=\normalvbox
% {\forgetall\unhcopy0\par\xdef\globalvhlines{\the\prevgraf}}%
-% \setbox2=\vbox
+% \setbox2=\normalvbox
% {\unvbox2
% \setbox2=\lastbox
-% \setbox2=\hbox{\unhbox2}%
+% \setbox2=\normalhbox{\unhbox2}%
% \xdef\globalvhwidth{\the\wd2}}%
% \decrement\globalvhlines
% \dimen0=\globalvhwidth
-% \dimen0=\vboxtohboxfactor\dimen0
+% \dimen0=\normalvboxtohboxfactor\dimen0
% \advance\dimen0 by \globalvhlines\lineheight
% \dp0=\zeropoint
% \ht0=\dimen0
@@ -1526,15 +1511,15 @@
\def\convertvboxtohbox%
{\setvboxtohbox
\makehboxofhboxes
- \setbox0=\hbox{\unhbox0 \removehboxes}%
+ \setbox0=\normalhbox{\unhbox0 \removehboxes}%
\noindent\unhbox0\par}
\def\makehboxofhboxes%
- {\setbox0=\hbox{}%
+ {\setbox0=\normalhbox{}%
\loop % \doloop { .. \exitloop .. }
\setbox2=\lastbox
\ifhbox2
- \setbox0=\hbox{\box2\unhbox0}%
+ \setbox0=\normalhbox{\box2\unhbox0}%
\repeat}
\def\removehboxes%
@@ -1561,16 +1546,16 @@
\clubpenalty=0
\mindermeldingen
\forgetall
- \setbox\unhhedbox=\vbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize
+ \setbox\unhhedbox=\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize
\doloop
{\setbox\hhbox=\vsplit\unhhedbox to \lineheight
\ifvoid\unhhedbox
- \setbox\hhbox=\hbox{\strut\hboxofvbox\hhbox}%
+ \setbox\hhbox=\normalhbox{\strut\normalhboxofvbox\hhbox}%
\fi
\ht\hhbox=\ht\strutbox
\dp\hhbox=\dp\strutbox
\ifdim\hhboxindent=\zeropoint\else
- \setbox\hhbox=\hbox{\hskip-\hhboxindent\box\hhbox}%
+ \setbox\hhbox=\normalhbox{\hskip-\hhboxindent\box\hhbox}%
\hhboxindent=\zeropoint
\fi
\global\lasthhboxwidth=\wd\hhbox
@@ -1583,11 +1568,11 @@
\egroup}
\def\dohboxofvbox%
- {\setbox0=\vbox{\unvbox\scratchcounter\global\setbox1=\lastbox}%
+ {\setbox0=\normalvbox{\unvbox\scratchcounter\global\setbox1=\lastbox}%
\unhbox1
\egroup}
-\def\hboxofvbox%
+\def\normalhboxofvbox%
{\bgroup
\afterassignment\dohboxofvbox
\scratchcounter=}
@@ -1599,8 +1584,8 @@
%D headers.
%D
%D \startbuffer
-%D \setbox0=\hbox{\input tufte \relax}
-%D \setbox2=\hbox{\input knuth \relax}
+%D \setbox0=\normalhbox{\input tufte \relax}
+%D \setbox2=\normalhbox{\input knuth \relax}
%D \unhhbox0\with{\ruledhbox{\box\hhbox}}
%D \hskip1em plus 1em minus 1em
%D \hhboxindent=\lasthhboxwidth
@@ -1627,12 +1612,12 @@
%D \doifcontent{pre content}{post content}{no content}\somebox
%D \stoptypen
%D
-%D Where \type{\somebox} is either a \type{\hbox} or
-%D \type{\vbox}. If the dimension of this box suggest some
+%D Where \type{\somebox} is either a \type{\normalhbox} or
+%D \type{\normalvbox}. If the dimension of this box suggest some
%D content, the resulting box is unboxed and surrounded by the
%D first two arguments, else the third arguments is executed.
-\def\doifcontent#1#2#3%
+\unexpanded\def\doifcontent#1#2#3%
{\dowithnextbox
{\ifhbox\nextbox
\ifdim\wd\nextbox>\zeropoint
@@ -1651,11 +1636,11 @@
%D So when we say:
%D
%D \startbuffer
-%D \doifcontent{[}{]}{}\hbox{content sensitive typesetting}
+%D \doifcontent{[}{]}{}\normalhbox{content sensitive typesetting}
%D
-%D \doifcontent{}{\pagina}{}\vbox{content sensitive typesetting}
+%D \doifcontent{}{\pagina}{}\normalvbox{content sensitive typesetting}
%D
-%D \doifcontent{}{}{\message{Didn't you forget something?}}\hbox{}
+%D \doifcontent{}{}{\message{Didn't you forget something?}}\normalhbox{}
%D \stopbuffer
%D
%D \typebuffer
@@ -1698,7 +1683,7 @@
{\dowithnextbox
{\ifhmode\unskip\fi\doprocessbox % takes \nextbox makes \processbox
\afterassignment\dogetprocessbox\let\next=}
- \hbox\bgroup}
+ \normalhbox\bgroup}
%D \macros
%D {startoverlay}
@@ -1722,10 +1707,10 @@
% \def\dooverlaybox%
% {\ifhmode\unskip\fi
% \ifdim\ht\nextbox>\ht\processbox
-% \setbox\processbox=\vbox to \ht\nextbox
+% \setbox\processbox=\normalvbox to \ht\nextbox
% {\vss\box\processbox\vss}%
% \else
-% \setbox\nextbox=\vbox to \ht\processbox
+% \setbox\nextbox=\normalvbox to \ht\processbox
% {\vss\box\nextbox\vss}%
% \fi
% \scratchdimen=\wd
@@ -1734,10 +1719,10 @@
% \else
% \processbox
% \fi
-% \setbox\processbox=\hbox to \scratchdimen
-% {\hbox to \scratchdimen{\hss\box\processbox\hss}%
+% \setbox\processbox=\normalhbox to \scratchdimen
+% {\normalhbox to \scratchdimen{\hss\box\processbox\hss}%
% \hskip-\scratchdimen
-% \hbox to \scratchdimen{\hss\box\nextbox\hss}}}
+% \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}}
%
% \def\startoverlay%
% {\bgroup
@@ -1753,10 +1738,10 @@
\processbox
\fi
\ifdim\ht\nextbox>\ht\processbox
- \setbox\processbox=\vbox to \ht\nextbox
+ \setbox\processbox=\normalvbox to \ht\nextbox
{\dp\processbox=\zeropoint\vss\box\processbox\vss}%
\else
- \setbox\nextbox=\vbox to \ht\processbox
+ \setbox\nextbox=\normalvbox to \ht\processbox
{\dp\nextbox=\zeropoint\vss\box\nextbox\vss}%
\fi
\dp\nextbox=\scratchdimen
@@ -1767,10 +1752,10 @@
\else
\processbox
\fi
- \setbox\processbox=\hbox to \scratchdimen
- {\hbox to \scratchdimen{\hss\box\processbox\hss}%
+ \setbox\processbox=\normalhbox to \scratchdimen
+ {\normalhbox to \scratchdimen{\hss\box\processbox\hss}%
\hskip-\scratchdimen
- \hbox to \scratchdimen{\hss\box\nextbox\hss}}}
+ \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}}
\def\startoverlay%
{\bgroup
@@ -1803,7 +1788,7 @@
% \def\dohspread{\hfil\box\nextbox}}
%
% \def\starthspread%
-% {\hbox to \hsize \bgroup
+% {\normalhbox to \hsize \bgroup
% \let\stophspread\egroup
% \processboxes\dohspread}
@@ -1813,7 +1798,7 @@
%D The next macro is a rather silly one, but saves space.
%D
%D \starttypen
-%D \hbox{\fakebox0}
+%D \normalhbox{\fakebox0}
%D \stoptypen
%D
%D returns an empty box with the dimensions of the box
@@ -1824,7 +1809,7 @@
\wd\scratchbox=\wd\scratchcounter
\ht\scratchbox=\ht\scratchcounter
\dp\scratchbox=\dp\scratchcounter
- \ifhbox\scratchcounter\hbox\else\vbox\fi{\box\scratchbox}%
+ \ifhbox\scratchcounter\normalhbox\else\normalvbox\fi{\box\scratchbox}%
\egroup}
\def\fakebox%
@@ -1842,7 +1827,7 @@
%D \rbox{text ...}
%D \stoptypen
%D
-%D Are similar to \type {\vbox}, which means that they also
+%D Are similar to \type {\normalvbox}, which means that they also
%D accept something like \type{to 3cm}, but align to the left,
%D middle and right. These box types can be used to typeset
%D paragraphs.
@@ -1852,7 +1837,7 @@
\def\rbox{\lrcbox\raggedright}
\def\lrcbox#1#2#%
- {\vbox#2\bgroup
+ {\normalvbox#2\bgroup
\let\\=\endgraf
\forgetall#1\let\next=}
@@ -1879,29 +1864,29 @@
\def\bbox{\tbbox\dp\ht}
\def\tbbox#1#2%
- {\hbox\bgroup
+ {\normalhbox\bgroup
\dowithnextbox
{\scratchdimen=\ht\nextbox
\advance\scratchdimen\dp\nextbox
\advance\scratchdimen-#1\strutbox
#1\nextbox=#1\strutbox
#2\nextbox=\scratchdimen
- \setbox\nextbox=\hbox
+ \setbox\nextbox=\normalhbox
{\lower\dp\nextbox\box\nextbox}%
#1\nextbox=#1\strutbox
#2\nextbox=\scratchdimen
\box\nextbox
\egroup}
- \hbox}
+ \normalhbox}
%D \macros
%D {lhbox,mhbox,rhbox}
%D
%D A few more boxes.
-\def\lhbox{\dowithnextbox{\hbox to \hsize{\box\nextbox\hss }}\hbox}
-\def\mhbox{\dowithnextbox{\hbox to \hsize{\hss\box\nextbox\hss}}\hbox}
-\def\rhbox{\dowithnextbox{\hbox to \hsize{\hss\box\nextbox }}\hbox}
+\def\lhbox{\dowithnextbox{\normalhbox to \hsize{\box\nextbox\hss }}\normalhbox}
+\def\mhbox{\dowithnextbox{\normalhbox to \hsize{\hss\box\nextbox\hss}}\normalhbox}
+\def\rhbox{\dowithnextbox{\normalhbox to \hsize{\hss\box\nextbox }}\normalhbox}
\let\lefthbox =\lhbox
\let\midhbox =\mhbox
@@ -1915,7 +1900,7 @@
%D additions, we can use:
%D
%D \starttypen
-%D \boxofsize \vbox 10cm 3cm -5cm {the text to be typeset}
+%D \boxofsize \normalvbox 10cm 3cm -5cm {the text to be typeset}
%D \stoptypen
%D
%D This example demonstrates that one can use positive and
@@ -1949,12 +1934,12 @@
{\dowithnextbox
{\dimen0=#1\hsize
\ifdim\wd\nextbox>\dimen0
- \setbox\nextbox=\hbox
+ \setbox\nextbox=\normalhbox
{\advance\dimen0 by -.1\hsize
\limitatetext{\unhbox\nextbox}{\dimen0}{\nobreak#2}}%
\fi
\unhbox\nextbox}
- \hbox}
+ \normalhbox}
\def\fittoptobaselinegrid% weg hier
{\dowithnextbox
@@ -1963,7 +1948,7 @@
\dimen0=\ht\nextbox
\ht\nextbox=\ht\strutbox
\dp\nextbox=\dp\strutbox
- \hbox{\box\nextbox}
+ \normalhbox{\box\nextbox}
\prevdepth\dp\strutbox
\doloop
{\advance\dimen0 by -\lineheight
@@ -1971,80 +1956,91 @@
\exitloop
\else
\nobreak
- \hbox{\strut}
+ \normalhbox{\strut}
\fi}
\egroup}
- \vbox}
+ \normalvbox}
%D Some more undocumented macros (used in m-chart).
\newif\iftraceboxplacement % \traceboxplacementtrue
-\def\boxcursor%
+\newbox\fakedboxcursor
+
+\setbox\fakedboxcursor\normalhbox
+ {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint}
+
+\def\boxcursor% overloaded in core-vis
{\iftraceboxplacement
\bgroup
- \setbox0=\hbox
- {\hskip-1pt\vrule\!!width2pt\!!height2pt\!!depth2pt}%
- \smashbox0\box0
+ \scratchdimen2pt
+ \setbox\scratchbox\normalhbox to \zeropoint
+ {\hss
+ \vrule
+ \!!width \scratchdimen
+ \!!height\scratchdimen
+ \!!depth \scratchdimen
+ \hss}%
+ \smashbox\scratchbox
+ \box\scratchbox
\egroup
\else
- \hbox
- {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint}%
+ \copy\fakedboxcursor
\fi}
\def\placedbox%
- {\iftraceboxplacement\ruledhbox\else\hbox\fi}
+ {\iftraceboxplacement\ruledhbox\else\normalhbox\fi}
\newdimen\boxoffset
\def\rightbox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=.5\ht0\advance\dimen0 by -.5\dp0
+ \dimen0=.5\ht0\advance\dimen0 -.5\dp0
\boxcursor\hskip\boxoffset\lower\dimen0\box0}}
\def\leftbox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=.5\ht0\advance\dimen0 by -.5\dp0
+ \dimen0=.5\ht0\advance\dimen0 -.5\dp0
\boxcursor\hskip-\wd0\hskip-\boxoffset\lower\dimen0\box0}}
\def\topbox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \dp0
+ \dimen0=\boxoffset\advance\dimen0 \dp0
\boxcursor\hskip-.5\wd0\raise\dimen0\box0}}
\def\bottombox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \ht0
+ \dimen0=\boxoffset\advance\dimen0 \ht0
\boxcursor\hskip-.5\wd0\lower\dimen0\box0}}
\def\lefttopbox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \dp0
+ \dimen0=\boxoffset\advance\dimen0 \dp0
\advance\boxoffset\wd0
\boxcursor\hskip-\boxoffset\raise\dimen0\box0}}
\def\righttopbox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \dp0
+ \dimen0=\boxoffset\advance\dimen0 \dp0
\boxcursor\hskip\boxoffset\raise\dimen0\box0}}
\def\leftbottombox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \ht0
+ \dimen0=\boxoffset\advance\dimen0 \ht0
\advance\boxoffset\wd0
\boxcursor\hskip-\boxoffset\lower\dimen0\box0}}
\def\rightbottombox#1%
- {\hbox
+ {\normalhbox
{\setbox0=\placedbox{#1}%
- \dimen0=\boxoffset\advance\dimen0 by \ht0
+ \dimen0=\boxoffset\advance\dimen0 \ht0
\boxcursor\hskip\boxoffset\lower\dimen0\box0}}
\let\topleftbox \lefttopbox
@@ -2053,7 +2049,7 @@
\let\bottomrightbox\rightbottombox
\def\middlebox#1%
- {\hbox{\setbox0=\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}}
+ {\normalhbox{\setbox0=\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}}
%D \macros
%D {initializeboxstack,savebox,foundbox}
@@ -2068,11 +2064,11 @@
%D \savebox{one}{p}{test p}
%D \savebox{one}{q}{test q}
%D
-%D \hbox{a:\foundbox{one}{a}} \par
-%D \hbox{q:\foundbox{one}{q}} \par
-%D \hbox{p:\foundbox{one}{p}} \par
-%D \hbox{x:\foundbox{one}{x}} \par
-%D \hbox{y:\foundbox{two}{a}} \par
+%D \normalhbox{a:\foundbox{one}{a}} \par
+%D \normalhbox{q:\foundbox{one}{q}} \par
+%D \normalhbox{p:\foundbox{one}{p}} \par
+%D \normalhbox{x:\foundbox{one}{x}} \par
+%D \normalhbox{y:\foundbox{two}{a}} \par
%D \stoptypen
% a first version
@@ -2085,7 +2081,7 @@
% {\ifundefined{\@@stackbox#1}%
% \@EA\newbox\csname\@@stackbox#1\endcsname
% \else
-% \@EA\global\@EA\setbox\csname\@@stackbox#1\endcsname\vbox{}%
+% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox{}%
% \fi
% % actually we should erase the old values
% \setgvalue{\@@stackmax#1}{0}}
@@ -2095,22 +2091,22 @@
% {\doifdefined{\@@stackbox#1}
% {\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname
% \setxvalue{\@@stacktag#2}{\csname\@@stackmax#1\endcsname}%
-% \global\setbox\csname\@@stackbox#1\endcsname=\vbox
+% \global\setbox\csname\@@stackbox#1\endcsname=\normalvbox
% {\forgetall
-% \setbox\scratchbox=\vbox{\box\nextbox}
+% \setbox\scratchbox=\normalvbox{\box\nextbox}
% \ht\scratchbox=\!!onepoint
-% \dp\scratchbox=\!!zeropoint
+% \dp\scratchbox=\zeropoint
% \unvbox\csname\@@stackbox#1\endcsname
% \offinterlineskip
% \allowbreak
% \box\scratchbox}}}%
-% \vbox}
+% \normalvbox}
%
% \def\foundbox#1#2%
-% {\vbox
+% {\normalvbox
% {\doifdefined{\@@stackbox#1}
% {\doifdefined{\@@stacktag#2}
-% {\setbox\scratchbox=\vbox
+% {\setbox\scratchbox=\normalvbox
% {\splittopskip\zeropoint
% \setbox0=\copy\csname\@@stackbox#1\endcsname
% \dimen0=\getvalue{\@@stacktag#2}pt
@@ -2133,7 +2129,7 @@
{\ifundefined{\@@stackbox#1}%
\@EA\newbox\csname\@@stackbox#1\endcsname
\else
- \@EA\global\@EA\setbox\csname\@@stackbox#1\endcsname\vbox{}%
+ \global\setbox\csname\@@stackbox#1\endcsname\normalvbox{}%
\def\docommando##1{\global\letbeundefined{\@@stacktag#1:##1}}%
\processcommacommand[\getvalue{\@@stacklst#1}]\docommando
\fi
@@ -2146,22 +2142,22 @@
{\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname
\setxvalue{\@@stacktag#1:#2}{\csname\@@stackmax#1\endcsname}%
\setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}%
- \global\setbox\csname\@@stackbox#1\endcsname=\vbox
+ \global\setbox\csname\@@stackbox#1\endcsname=\normalvbox
{\forgetall
- \setbox\scratchbox=\vbox{\box\nextbox}
+ \setbox\scratchbox=\normalvbox{\box\nextbox}
\ht\scratchbox=\!!onepoint
- \dp\scratchbox=\!!zeropoint
+ \dp\scratchbox=\zeropoint
\unvbox\csname\@@stackbox#1\endcsname
\offinterlineskip
\allowbreak
\box\scratchbox}}}%
- \vbox}
+ \normalvbox}
\def\foundbox#1#2%
- {\vbox
+ {\normalvbox
{\doifdefined{\@@stackbox#1}
{\doifdefined{\@@stacktag#1:#2}
- {\setbox\scratchbox=\vbox
+ {\setbox\scratchbox=\normalvbox
{\splittopskip\zeropoint
\setbox0=\copy\csname\@@stackbox#1\endcsname
\dimen0=\getvalue{\@@stacktag#1:#2}pt
@@ -2187,7 +2183,7 @@
{\ifcsname\@@stackbox:#1:#2\endcsname\else
\expandafter\newbox\csname\@@stackbox:#1:#2\endcsname
\fi
- \global\setbox\csname\@@stackbox:#1:#2\endcsname\vbox}
+ \global\setbox\csname\@@stackbox:#1:#2\endcsname\normalvbox}
\def\initializeboxstack#1%
{\def\docommando##1{\setstackbox{#1}{##1}{}}%
@@ -2201,7 +2197,7 @@
\setstackbox{#1}{#2}}
\def\foundbox#1#2%
- {\vbox
+ {\normalvbox
{\ifcsname\@@stackbox:#1:#2\endcsname
\copy\csname\@@stackbox:#1:#2\endcsname
\fi}}
@@ -2247,15 +2243,15 @@
%D article.
%D
%D \starttypen
-%D \raisebox{100pt}\hbox{test}
-%D \raisebox50pt\hbox{test}
-%D \hsmash{\raisebox{100pt}\hbox{test}}
+%D \raisebox{100pt}\normalhbox{test}
+%D \raisebox50pt\normalhbox{test}
+%D \hsmash{\raisebox{100pt}\normalhbox{test}}
%D \stoptypen
\def\doraiselowerbox#1#2% a nice trick us used to accept
{\def\next% % both direct and {} dimensions
{\dowithnextbox
- {\setbox\nextbox=\hbox{#1\scratchdimen\box\nextbox}%
+ {\setbox\nextbox=\normalhbox{#1\scratchdimen\box\nextbox}%
\ht\nextbox=\ht\strutbox
\dp\nextbox=\dp\strutbox
\box\nextbox}}%
@@ -2270,7 +2266,7 @@
% {\bgroup
% \ifdim\prevdepth<\zeropoint
% \ifdim\pagetotal=\zeropoint
-% \setbox8=\vtop{\unvcopy#1}%
+% \setbox8=\normalvtop{\unvcopy#1}%
% \hrule\c!!height\zeropoint
% \kern-\ht8
% \box#1\relax
@@ -2280,7 +2276,7 @@
% \else
% \dimen0=\prevdepth
% \hrule\c!!height\zeropoint
-% \setbox8=\vtop{\unvcopy#1}%
+% \setbox8=\normalvtop{\unvcopy#1}%
% \dimen2=\baselineskip
% \advance\dimen2 by -\dimen0
% \advance\dimen2 by -\ht8
@@ -2313,15 +2309,15 @@
% \def\donormbox[#1][#2]%
% {\bgroup
% \doifinstringelse{v}{#2}
-% {\let\next\vbox}
-% {\let\next\hbox}%
+% {\let\next\normalvbox}
+% {\let\next\normalhbox}%
% \dowithnextbox
% {\ifvbox\nextbox
% \let\\=\par
-% \dodonormbox{#1}{#2}\vbox\ruledvbox\ht\vfil\unvbox
+% \dodonormbox{#1}{#2}\normalvbox\ruledvbox\ht\vfil\unvbox
% \else
% \let\\=\space
-% \dodonormbox{#1}{#2}\hbox\ruledhbox\wd\hfil\unhbox
+% \dodonormbox{#1}{#2}\normalhbox\ruledhbox\wd\hfil\unhbox
% \fi
% \egroup}%
% \next}
@@ -2334,16 +2330,34 @@
\def\halfwaybox%
{\dowithnextbox
{\dp\nextbox\zeropoint
- \setbox\nextbox=\hbox{\lower.5\ht\nextbox\box\nextbox}%
+ \setbox\nextbox=\normalhbox{\lower.5\ht\nextbox\box\nextbox}%
\box\nextbox}
- \hbox}
-
+ \normalhbox}
-% new
+%D New:
\def\setdimentoatleast#1#2%
{\ifdim#1>\zeropoint\else#1=#2\fi}
-
-\protect
+
+%D \macros
+%D {vcenter}
+%D
+%D Also new: tex mode \type {\vcenter}.
+
+\ifx \normalhbox \undefined \let \normalhbox = \hbox \fi
+\ifx \normalvbox \undefined \let \normalvbox = \vbox \fi
+\ifx \normalvtop \undefined \let \normalvtop = \vtop \fi
+\ifx \normalvcenter \undefined \let \normalvcenter = \vcenter \fi
+
+\let\verynormalvcenter \vcenter % since \vcenter can be visualized
+
+\def\vcenter%
+ {\normalvbox\bgroup
+ \dowithnextbox{\normalhbox{$\verynormalvcenter{\box\nextbox}$}\egroup}
+ \normalvbox}
+
+\prependtoks \let\vcenter\normalvcenter \to \everymath
+
+ \protect
\endinput
diff --git a/tex/context/base/supp-emp.tex b/tex/context/base/supp-emp.tex
index b8ff6dbf8..0a59a1970 100644
--- a/tex/context/base/supp-emp.tex
+++ b/tex/context/base/supp-emp.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%M \input supp-emp
+
%D When \THANH, the author of \PDFTEX, and I were exchanging
%D some emails on \PDFTEX\ functionality, positional
%D information popped up as potential extension. Actually, it
@@ -264,6 +266,8 @@
\ifx\dosetpositionpt\undefined \else % context part
+\edef\EMlinewd{\the\linewidth}
+
%D A few pages ago, we mentioned that \CONTEXT\ has built||in
%D position tracking. This means that when we want to implement
%D this kind of trickery in this macro package, we can fall
diff --git a/tex/context/base/supp-eps.tex b/tex/context/base/supp-eps.tex
index a7d84344f..7370c0fbc 100644
--- a/tex/context/base/supp-eps.tex
+++ b/tex/context/base/supp-eps.tex
@@ -56,25 +56,35 @@
\unprotect
-\let\EPSllx\!!zeropoint \let\MPllx\EPSllx % just in case these
-\let\EPSlly\!!zeropoint \let\MPlly\EPSlly % are used while running
-\let\EPSurx\!!zeropoint \let\MPurx\EPSurx % in fast mode we set
-\let\EPSury\!!zeropoint \let\MPury\EPSury % them to 0pt.
+\def\EPSllx{0} \let\MPllx\EPSllx % just in case these
+\def\EPSlly{0} \let\MPlly\EPSlly % are used while running
+\def\EPSurx{0} \let\MPurx\EPSurx % in fast mode we set
+\def\EPSury{0} \let\MPury\EPSury % them to 0.
\chardef\EPSfound =0
\chardef\EPScreator=0
\chardef\EPSspecial=0
-\chardef\EPSstatus =0
+\chardef\EPSstatus =0
+
+\let\EPScreatorstring\empty
+
+\newtoks\extraEPSpreambleresets
+\newtoks\extraEPSpreambleparsers
+
+\def\dofinishEPSfile{\dofinishfile} % no \let, can be overloaded
\def\dogetEPSboundingbox#1#2#3#4#5%
{\bgroup
- \global\chardef\EPSfound=0
- \global\chardef\EPScreator=0
- \global\chardef\EPSspecial=0
- \global\chardef\EPSstatus=0
+ \global\chardef\EPSfound 0
+ \global\chardef\EPScreator0
+ \global\chardef\EPSspecial0
+ \global\chardef\EPSstatus 0
+ \global\let\EPScreatorstring\empty
+ \the\extraEPSpreambleresets
\uncatcodespecials
- \def\doprocessEPSline%
- {\expandafter\checkEPSboundingbox\fileline:. \end}%
+ \catcode`\^^M=\@@ignore
+ \def\doprocessEPSline
+ {\expandafter\checkEPSboundingbox\fileline\empty\empty:.:.\end}%
\doprocessfile\scratchread{#1}\doprocessEPSline
\egroup
\ifnum\EPSfound>0
@@ -82,77 +92,104 @@
#4=\EPSurx bp% \dimen0=1bp and \EPSllx\dimen0
#3=\EPSlly bp% is more accurate (.005pt).
#5=\EPSury bp%
- \scratchdimen=\EPSllx bp\advance#4 -\scratchdimen
- \scratchdimen=\EPSlly bp\advance#5 -\scratchdimen
+ \scratchdimen\EPSllx bp\advance#4 -\scratchdimen
+ \scratchdimen\EPSlly bp\advance#5 -\scratchdimen
\else
#2=\zeropoint
#3=\zeropoint
#4=\zeropoint
#5=\zeropoint
\fi
- %\message{[bbox #1: \EPSllx\space\EPSurx\space\EPSlly\space\EPSury]}%
+ %\message{[bbox #1: \EPSllx\space\EPSurx\space\EPSlly\space\EPSury]}\wait
\global\let\MPllx\EPSllx \global\let\MPlly\EPSlly
\global\let\MPurx\EPSurx \global\let\MPury\EPSury}
-\bgroup
-\catcode`\%=\@@other
-\global\let\EPSpercenttag =%
-\gdef\EPSboundingboxtag {%BoundingBox}
-\gdef\EPShiresboundingboxtag{%HiResBoundingBox}
-\gdef\EPSexactboundingboxtag{%ExactBoundingBox}
-\gdef\EPScreatortag {%Creator}
-\gdef\EPSmetaposttag { MetaPost :. }
-\gdef\EPSmetapostspecialtag {%MetaPostSpecial}
-\gdef\EPSmetapostspecialstag{%MetaPostSpecials}
-\gdef\EPSpagetag {%Page}
-\egroup
-
-\long\def\checkEPSboundingbox#1#2:#3\end%
- {\ifx#1\EPSpercenttag
- \def\!!stringa{#2}%
- \ifx\!!stringa\EPScreatortag
- \edef\!!stringa{#3}%
- \global\chardef\EPScreator=\ifx\!!stringa\EPSmetaposttag1 \else0 \fi
- \else\ifx\!!stringa\EPSboundingboxtag
- \expandafter \getEPSboundingbox #3 . . . \end
- \global\chardef\EPSfound=1
- \else\ifx\!!stringa\EPShiresboundingboxtag
- \expandafter \getEPSboundingbox #3 . . . \end
- \global\chardef\EPSfound=2
- \dofinishfile
- \else\ifx\!!stringa\EPSexactboundingboxtag
- \expandafter \getEPSboundingbox #3 . . . \end
- \global\chardef\EPSfound=2
- \dofinishfile
- \else\ifx\!!stringa\EPSmetapostspecialtag % only before finish!
- \global\chardef\EPSspecial=1 % ah, we've met some MP extensions
- \else\ifx\!!stringa\EPSmetapostspecialstag % only before finish!
- \global\chardef\EPSspecial=1 % ah, we've met some MP extensions
- \else\ifx\!!stringa\EPSpagetag
- \global\chardef\EPSstatus=1 % we passed MP font defs
- \fi\fi\fi\fi\fi\fi\fi
+\bgroup \catcode`\%=\@@other \gdef\letterpercent{\string%} \egroup
+
+\def\EPSboundingboxtag {BoundingBox}
+\def\EPShiresboundingboxtag{HiResBoundingBox}
+\def\EPSexactboundingboxtag{ExactBoundingBox}
+\def\EPScreatortag {Creator}
+\def\EPSmetaposttag {MetaPost}
+\def\EPSmetapostspecialtag {MetaPostSpecial}
+\def\EPSmetapostspecialstag{MetaPostSpecials}
+\def\EPSpagetag {Page}
+
+\let\EPSspecialstring \empty
+\let\EPSspecialcontent\empty
+
+\long\def\checkEPSboundingbox#1#2#3:#4:.#5\end
+ {\if\string#1\letterpercent
+ \if\string#2\letterpercent
+ \edef\EPSspecialstring{#3}%
+ \edef\EPSspecialcontent{#4}%
+ \ifx\EPSspecialstring\EPScreatortag
+ \getEPScreatorspec
+ \else\ifx\EPSspecialstring\EPSboundingboxtag
+ \getEPSboundingboxspec
+ \global\chardef\EPSfound 1
+ \else\ifx\EPSspecialstring\EPShiresboundingboxtag
+ \getEPSboundingboxspec
+ \global\chardef\EPSfound 2
+ \dofinishEPSfile
+ \else\ifx\EPSspecialstring\EPSexactboundingboxtag
+ \getEPSboundingboxspec
+ \global\chardef\EPSfound 2
+ \dofinishEPSfile
+ \else\ifx\EPSspecialstring\EPSmetapostspecialtag % only before finish!
+ \global\chardef\EPSspecial 1 % ah, we've met some MP extensions
+ \else\ifx\EPSspecialstring\EPSmetapostspecialstag % only before finish!
+ \global\chardef\EPSspecial 1 % ah, we've met some MP extensions
+ \else\ifx\EPSspecialstring\EPSpagetag
+ \global\chardef\EPSstatus 1 % we passed MP font defs
+ \else
+ \the\extraEPSpreambleparsers
+ \fi\fi\fi\fi\fi\fi\fi
+ \fi
\else\ifnum\EPSfound>0
\ifnum\EPScreator=1 % that is, we are dealing with MP output
\ifcase\EPSstatus
% we've run into MP fontdefs
\or
- \dofinishfile
+ \dofinishEPSfile
\fi
\else
- \dofinishfile
+ \dofinishEPSfile
\fi
\fi\fi}
-\def\getEPSboundingbox #1 #2 #3 #4 #5\end%
+\def\getEPSboundingboxspec
+ {\edef\EPSspecialstring{\EPSspecialcontent\space . . . . }%
+ \expandafter\dogetEPSboundingboxspec\EPSspecialstring\end}
+
+\def\dogetEPSboundingboxspec#1 #2 #3 #4 #5\end
{\gdef\EPSllx{#1}%
\ifx\EPSllx\empty
- \getEPSboundingbox #2 #3 #4 #5 .\end
+ \dogetEPSboundingboxspec#2 #3 #4 #5\end
\else
\gdef\EPSlly{#2}%
\gdef\EPSurx{#3}%
\gdef\EPSury{#4}%
+ \fi}
+
+\def\getEPScreatorspec
+ {\edef\EPSspecialstring{\EPSspecialcontent. . .}%
+ \expandafter\dogetEPScreatorspec\EPSspecialstring\end}
+
+\def\dogetEPScreatorspec#1#2. . #3\end
+ {\edef\EPSspecialstring{#1}%
+ \ifx\EPSspecialstring\empty
+ \dogetEPScreatorspec#2. . #3\end
+ \else
+ \edef\EPScreatorstring{#1#2}%
+ \global\chardef\EPScreator
+ \ifx\EPScreatorstring\EPSmetaposttag1\else0\fi\relax
\fi}
-\protect
+\def\dogetEPSpreambledata#1% can be combined with \extraEPSpreambleparsers
+ {\bgroup
+ \let\dofinishEPSfile\relax % dirty trick, read past all bboxes
+ \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb
+ \egroup}
-\endinput
+\protect \endinput
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index c7d447c29..bf5e6fed5 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -64,14 +64,14 @@
%D Just to be sure, we save the current meaning of \type{^^M}
%D in \type{\poppedendofline}.
-\chardef\poppedendofline=\the\catcode`\^^M
+\chardef\poppedendofline\catcode`\^^M
\def\pushendofline
- {\chardef\poppedendofline=\the\catcode`\^^M\relax
- \catcode`\^^M=\@@comment\relax}
+ {\chardef\poppedendofline\catcode`\^^M\relax
+ \catcode`\^^M\@@comment\relax}
\def\popendofline
- {\catcode`\^^M=\poppedendofline}
+ {\catcode`\^^M\poppedendofline}
%D \macros
%D {scratchread, scratchwrite}
@@ -122,10 +122,10 @@
\fileprocessedtrue
\gdef\dofinishfile%
{\closein#1\relax
- \global\let\doprocessline=\relax}%
+ \global\let\doprocessline\relax}%
\gdef\doprocessline%
{\ifeof#1%
- \dofinishfile
+ \expandafter\dofinishfile
\else
\global\read#1 to \fileline
#3\relax
@@ -149,24 +149,17 @@
\def\pathplusfile#1#2{#1\f!pathseparator#2}
%D This one constructs a filename from a (possible empty)
-%D path and filename. % The special \type {system} is ignored.
+%D path and filename.
\def\assignfullfilename#1#2\to#3%
{\doifelsenothing{#1}
{\edef#3{#2}}
{\edef#3{#1\f!pathseparator#2}}}
-% \def\assignfullfilename#1#2\to#3%
-% {\doifelsenothing{#1}
-% {\edef#3{#2}}
-% {\doifelse{#1}{system} % special case, honors default searching
-% {\edef#3{#2}}
-% {\edef#3{#1\f!pathseparator#2}}}}
-
%D For the moment, we limit sanitizing to taking care of
%D active \type {/}.
-\bgroup
+\bgroup % todo: _ cleanup
\catcode`\/=\@@active
@@ -236,9 +229,12 @@
%D \type{\input} when needed, for instance when loading third
%D party libraries.
-\newevery \everyreadfile \EveryReadFile
+\newevery \everybeforereadfile \EveryBeforeReadFile
+\newevery \everyafterreadfile \EveryAfterReadFile
+
+\let \everyreadfile \everybeforereadfile
-\let\normalinput=\input
+\ifx\normalinput\undefined \let\normalinput\input \fi
\def\maxreadlevel{3}
@@ -258,16 +254,18 @@
\fi
\next}
-\def\dodoreadfile%
- {\the\everyreadfile % hook, for instance for \enableXML
- \normalinput\readfilename\relax}
+\def\dodoreadfile % we provide hooks, for instance for \enableXML
+ {\the\everybeforereadfile
+ \normalinput\readfilename\relax
+ \the\everyafterreadfile}
-\def\readfile#1%
- {\let\readlevel=\maxreadlevel
- \doreadfile{#1}}
+\def\readfile% #1%
+ {\let\readlevel\maxreadlevel
+ \doreadfile} % {#1}
\def\ReadFile#1%
- {\readfile{#1}{}{}}
+ {\readfile{#1}\donothing\donothing}
+
%D \macros
%D {readjobfile,readlocfile,readsysfile,
@@ -384,15 +382,25 @@
%D \doiflocfileelse {filename} {before loading} {not found}
%D \stoptypen
-\def\doiffileelse#1#2#3%
+%\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%
{\immediate\openin\scratchread=#1\relax
\ifeof\scratchread
- \def\next{#3}%
+ \immediate\closein\scratchread
+ \expandafter\secondoftwoarguments
\else
- \def\next{#2}%
- \fi
- \immediate\closein\scratchread
- \next}
+ \immediate\closein\scratchread
+ \expandafter\firstoftwoarguments
+ \fi}
\def\doiflocfileelse#1%
{\doiffileelse{\pathplusfile{\f!currentpath}{#1}}}
@@ -506,7 +514,7 @@
\def\startreadingfile% beter een every
{\doglobal\increment\readingfilelevel
- \setxvalue{popfilecharacters::\readingfilelevel}%
+ \setxvalue{\string\readingfilelevel::\readingfilelevel}%
{\catcode`/ =\the\catcode`/%
\catcode`" =\the\catcode`"%
\catcode`< =\the\catcode`<%
@@ -525,7 +533,7 @@
\catcode`\%=\@@comment}
\def\stopreadingfile%
- {\getvalue{popfilecharacters::\readingfilelevel}%
+ {\getvalue{\string\readingfilelevel::\readingfilelevel}%
\doglobal\decrement\readingfilelevel}
%% % gebruikt voor normale (!) files, will change to proper
diff --git a/tex/context/base/supp-fun.tex b/tex/context/base/supp-fun.tex
index a2220996e..fd95d6691 100644
--- a/tex/context/base/supp-fun.tex
+++ b/tex/context/base/supp-fun.tex
@@ -550,6 +550,11 @@
\let\TheNormalizedFontSize\!!zeropoint
+%D Extra:
+
+\def\WidthSpanningText #1#2#3% text width font
+ {\hbox{\NormalizeFontWidth \temp{#1}{#2}{#3}\temp#1}}
+
%D Consider for instance:
%D
%D \startbuffer
diff --git a/tex/context/base/supp-ini.tex b/tex/context/base/supp-ini.tex
index 4eca9b051..15d80d5ab 100644
--- a/tex/context/base/supp-ini.tex
+++ b/tex/context/base/supp-ini.tex
@@ -8,11 +8,51 @@
%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 Support Macros / Initializations}
-\newif\ifeightbitcharacters \eightbitcharactersfalse
+\unprotect
-\endinput
+%D If you want control, you can have it:
+
+\newif\ifeightbitcharacters \eightbitcharacterstrue
+
+%D We want to have access to the raw alternatives of the
+%D special characters. We use a \type {\xdef} instead of
+%D \type {\let} because we need an expandable token in a
+%D \type {\write}.
+
+\bgroup
+
+\catcode`B=\@@begingroup
+\catcode`E=\@@endgroup
+\catcode`.=\@@escape
+
+
+.catcode `.{ 12 .xdef .letteropenbrace B.string{E
+.catcode `.} 12 .xdef .letterclosebrace B.string{E
+.catcode `.& 12 .xdef .letterampersand B.string&E
+.catcode `.< 12 .xdef .letterless B.string<E
+.catcode `.> 12 .xdef .lettermore B.string>E
+.catcode `.# 12 .xdef .letterhash B.string#E
+.catcode `.$ 12 .xdef .letterdollar B.string$E
+.catcode `.% 12 .xdef .letterpercent B.string%E
+.catcode `.^ 12 .xdef .letterhat B.string^E
+.catcode `._ 12 .xdef .letterunderscore B.string_E
+.catcode `.| 12 .xdef .letterbar B.string|E
+.catcode `.~ 12 .xdef .lettertilde B.string~E
+.catcode `.\ 12 .xdef .letterbackslash B.string\E
+.catcode `./ 12 .xdef .letterslash B.string/E
+.catcode `.? 12 .xdef .letterquestionmark B.string?E
+.catcode `.! 12 .xdef .letterexclamationmark B.string!E
+.catcode `.@ 12 .xdef .letterat B.string@E
+
+ .global .let .letterescape .letterbackslash
+ .global .let .letterbgroup .letteropenbrace
+ .global .let .letteregroup .letterclosebrace
+
+.egroup
+
+\protect \endinput
diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex
index 5163f4636..50aec294b 100644
--- a/tex/context/base/supp-lan.tex
+++ b/tex/context/base/supp-lan.tex
@@ -11,6 +11,9 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D This module needs a drastic update: can be made simplier
+%D and faster.
+
%D \gdef\starttest%
%D {\blanko
%D \noindent
@@ -160,15 +163,16 @@
%D \macros
%D {compoundhyphen,
%D beginofsubsentence,endofsubsentence}
-%D {}
%D
%D Now let's go to the macros. First we define some variables.
%D In the main \CONTEXT\ modules these can be tuned by a setup
%D command. Watch the (maybe) better looking compound hyphen.
-\def\compoundhyphen {{-}\kern-.25ex{-}}
-\def\beginofsubsentence {---}
-\def\endofsubsentence {---}
+% I've added \hbox's so that in mathmode we get proper chars
+
+\def\compoundhyphen {\hbox{-\kern-.25ex-}}
+\def\beginofsubsentence {\hbox{---}}
+\def\endofsubsentence {\hbox{---}}
%D The last two variables are needed for subsentences
%D |<|like this one|>| which we did not yet mention.
@@ -298,8 +302,8 @@
\def\installdiscretionaries#1#2#3%
{\convertargument#1\to\ascii
- \setevalue{mathmodediscretionary\string#1}{\ascii}%
- \setvalue{textmodediscretionary\string#1}{#3}%
+ \setevalue{\strippedcsname\mathmodediscretionary\string#1}{\ascii}%
+ \setvalue{\strippedcsname\textmodediscretionary\string#1}{#3}%
\catcode`#1=\@@active
\scratchcounter=\the\uccode`~
\uccode`~=`#1
@@ -311,8 +315,8 @@
\beginETEX \detokenize
\def\installdiscretionaries#1#2#3%
- {\setevalue{mathmodediscretionary\string#1}{\detokenize{#1}}%
- \setvalue{textmodediscretionary\string#1}{#3}%
+ {\setevalue{\strippedcsname\mathmodediscretionary\string#1}{\detokenize{#1}}%
+ \setvalue{\strippedcsname\textmodediscretionary\string#1}{#3}%
\catcode`#1=\@@active
\scratchcounter=\the\uccode`~
\uccode`~=`#1
@@ -322,7 +326,7 @@
\endETEX
\def\dohandlemathmodebar#1%
- {\getvalue{mathmodediscretionary\string#1}}
+ {\getvalue{\strippedcsname\mathmodediscretionary\string#1}}
\def\discretionarycommand%
{\relax\ifmmode
@@ -384,18 +388,37 @@
%D The next alternative also supports character numbers:
\def\defineactivecharacter #1 #2%
- {\scratchcounter=\the\uccode`~
+ {\scratchcounter\the\uccode`~
\expandafter\doifnumberelse\expandafter{\string#1}
{\catcode #1=\@@active \uccode`~= #1\relax}
{\catcode`#1=\@@active \uccode`~=`#1\relax}%
\uppercase{\def\next{~}}%
%\expandafter\unexpanded\expandafter\def\next{#2}%
\expandafter\def\next{#2}% unexpanded goes wrong in pdfdoc
- \uccode`~=\scratchcounter}
+ \uccode`~\scratchcounter}
%D One reason for abusing the \type{~} is that it is already
%D an active character, so it is unlikely to appear as argument.
+%D The next implementation is about 20\% faster; 1M
+%D definitions on a 1Gig machine takes about 19 seconds
+%D (against 24 for the previous alternative).
+
+\chardef\activehackcode=`~
+
+\def\defineactivecharacter #1 %
+ {\scratchcounter\the\uccode\activehackcode
+ \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1}\empty`#1%
+ \catcode\uccode\activehackcode\@@active
+ \uppercase{\def\next{~}}%
+ \uccode\activehackcode\scratchcounter
+ \expandafter\def\next}% unexpanded goes wrong in pdfdoc
+
+%D A goody:
+
+\def\makecharacteractive #1 %
+ {\catcode`#1\active}
+
%D Although adapting character codes and making characters
%D active can interfere with other features of macropackages,
%D normally there should be no problems with things like:
@@ -415,7 +438,8 @@
{\def\betweendiscretionary{##1}%
\futurelet\nextnext\dododotextmodediscretionary}%
\let\discretionarycommand=#1%
- \def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}%
+ \def\textmodediscretionary%
+ {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
\futurelet\next\dodotextmodediscretionary}
\def\dododotextmodediscretionary%
@@ -572,7 +596,8 @@
\nextuccode##1@\relax
\futurelet\nextnext\dododotextmodediscretionary}%
\let\discretionarycommand=#1%
- \def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}%
+ \def\textmodediscretionary%
+ {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
\futurelet\next\dodotextmodediscretionary}
%D This time we use \type{\ifnum}:
@@ -662,7 +687,8 @@
\def\activedododotextmodediscretionary#1#2%
{\convertargument#2\to\discretionarytoken
- \def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}%
+ \def\textmodediscretionary%
+ {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
\ifx#1\nextnext % takes care of ||| and +++ and ......
\prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
\allowbreak\postwordbreak
@@ -720,17 +746,20 @@
\def\activedododotextmodediscretionary#1#2%
{\convertargument#2\to\discretionarytoken
- \def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}%
- \ifx#1\nextnext % takes care of ||| and +++ and ......
- \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
- \allowbreak\postwordbreak
- \def\nextnextnext{\afterassignment\egroup\let\next=}%
- \else\ifx\discretionarytoken\empty
- \checkafterdiscretionary
- \bgroup
- \checkbeforediscretionary
- \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak
- \egroup
+ \def\textmodediscretionary%
+ {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
+ \ifx\discretionarytoken\empty
+ \ifx#1\nextnext % takes care of ||| and +++ and ......
+ \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
+ \allowbreak\postwordbreak
+ \def\nextnextnext{\afterassignment\egroup\let\next=}%
+ \else
+ \checkafterdiscretionary
+ \bgroup
+ \checkbeforediscretionary
+ \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak
+ \egroup
+ \fi
\else\expandafter\ifx\csname @tmd@\discretionarytoken\endcsname\relax
\checkafterdiscretionary
\bgroup
@@ -741,7 +770,7 @@
\egroup
\else
\csname @tmd@\discretionarytoken\endcsname
- \fi\fi\fi
+ \fi\fi
\nextnextnext}
\def\definetextmodediscretionary #1
@@ -793,8 +822,8 @@
\definetextmodediscretionary ;
{\prewordbreak\kern.25em;\space\ignorespaces}
-\definetextmodediscretionary *
- {\prewordbreak\discretionary{-}{}{\kern.05em}\postwordbreak}
+\definetextmodediscretionary *
+ {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak}
%D Since we don't have to bother about active characters any
%D longer, we end up with a pretty simple activating macro:
@@ -874,7 +903,7 @@
%D \stoptypen
\def\restorecompoundcharacter#1% new
- {\catcode`#1=\getvalue{\@nn@\string#1}\relax}
+ {\catcode`#1=\csname\@nn@\string#1\endcsname\relax}
%D In handling the compound characters we have to take care of
%D \type{\bgroup} and \type{\egroup} tokens, so we end up with
@@ -934,7 +963,8 @@
\beginTEX
\long\def\handlecompoundcharacterone#1#2%
- {\ifx#1#2%
+% {\ifx#1#2%
+ {\if\string#1\string#2%
%\def\next{\getvalue{\@nc@\string#1}\getvalue{\@nc@\string#2}}%
\def\next{\getvalue{\@nc@\string#1}}%
\else\expandafter\ifx\csname\@cc@\string#1\string#2\endcsname\relax
@@ -945,7 +975,8 @@
\next}
\long\def\handlecompoundcharactertwo#1#2#3%
- {\ifx#1#2%
+% {\ifx#1#2%
+ {\if\string#1\string#2%
%\def\next{\getvalue{\@nc@\string#1}\getvalue{\@nc@\string#2}#3}%
\def\next{\getvalue{\@nc@\string#1}#3}%
\else\@EA\ifx\csname\@cs@\string#1\string#2\string#3\endcsname\relax
@@ -964,7 +995,8 @@
\beginETEX \ifcsname
\long\def\handlecompoundcharacterone#1#2%
- {\ifx#1#2%
+% {\ifx#1#2%
+ {\if\string#1\string#2%
%\def\next{\getvalue{\@nc@\string#1}\getvalue{\@nc@\string#2}}%
\def\next{\getvalue{\@nc@\string#1}}%
\else\ifcsname\@cc@\string#1\string#2\endcsname
@@ -975,7 +1007,8 @@
\next}
\long\def\handlecompoundcharactertwo#1#2#3%
- {\ifx#1#2%
+% {\ifx#1#2%
+ {\if\string#1\string#2%
%\def\next{\getvalue{\@nc@\string#1}\getvalue{\@nc@\string#2}#3}%
\def\next{\getvalue{\@nc@\string#1}#3}%
\else\ifcsname\@cs@\string#1\string#2\string#3\endcsname
@@ -1081,20 +1114,9 @@
% 2 => alles na
% 3 => alles voor
-\bgroup
-\catcode`\&=12\gdef\ampercentletter {&}
-\catcode`\#=12\gdef\hashletter {#}
-\catcode`\_=12\gdef\underscoreletter {_}
-\catcode`\~=12\gdef\tildeletter {~}
-\catcode`\%=12\gdef\percentletter {%}
-\catcode`\?=12\gdef\questionmarkletter{?}
-\catcode`\@=12\gdef\atletter {@}
-\catcode`\/=12\gdef\slashletter {/}
-\egroup
-
\bgroup \catcode`\~=\active \catcode`\/=\active
-% why not convert to ascii first?
+% Why not convert to ascii first? I will redo this one!
% \unexpanded\gdef\hyphenatedurl#1% {}{} handles accents
% {\bgroup
@@ -1124,8 +1146,8 @@
% {\savedurl\let\savedurl\empty}%
% \def\\%
% {\spliturl\#}%
-% \let\~=\tildeletter \let~=\~%
-% \let\/=\slashletter \let/=\/%
+% \let\~=\lettertilde \let~=\~%
+% \let\/=\letterslash \let/=\/%
% \let\savedurl\empty
% \handletokens#1\with\scanurl
% \egroup}
@@ -1165,8 +1187,8 @@
{\savedurl\let\savedurl\empty}%
\def\\%
{\spliturl\#}%
- \let\~=\tildeletter \let~=\~%
- \let\/=\slashletter \let/=\/%
+ \let\~=\lettertilde\let~=\~%
+ \let\/=\letterslash\let/=\/%
\let\savedurl\empty
\handletokens#1\with\scanurl\savedurl
\egroup}
@@ -1201,18 +1223,18 @@
\flushurl\splitbefore\#%
\else\ifnum\catcode`#1=4
\flushurl\splitbefore\&%
- \else\if#1\tildeletter
+ \else\if#1\lettertilde
\flushurl\splitbefore\~%
- \else\if#1\percentletter
+ \else\if#1\letterpercent
\flushurl\splitbefore\%%
- \else\if#1\underscoreletter
+ \else\if#1\letterunderscore
\flushurl\splitbefore\_%
- \else\if#1\questionmarkletter
- \flushurl\splitafter\questionmarkletter
- \else\if#1\atletter
- \flushurl\splitafter\atletter
- \else\if#1\slashletter
- \edef\savedurl{\savedurl\slashletter}%
+ \else\if#1\letterquestionmark
+ \flushurl\splitafter\letterquestionmark
+ \else\if#1\letterat
+ \flushurl\splitafter\letterat
+ \else\if#1\letterslash
+ \edef\savedurl{\savedurl\letterslash}%
\else\if#1+%
\flushurl\splitafter+%
\else\if#1:%
@@ -1236,7 +1258,7 @@
%D {{\def~{\string~}\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}}
%D
%D \def\whateverurl#1%
-%D {{\let~\tildeletter\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}}
+%D {{\let~\lettertilde\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}}
%D
%D \def\whateverurl#1%
%D {\convertargument#1\to\ascii
diff --git a/tex/context/base/supp-mat.tex b/tex/context/base/supp-mat.tex
index a2a436fee..fcd64b709 100644
--- a/tex/context/base/supp-mat.tex
+++ b/tex/context/base/supp-mat.tex
@@ -19,7 +19,7 @@
\unprotect
%D \macros
-%D {mathematics, startmathmode}
+%D {mathematics, nomathematics, startmathmode}
%D
%D The \type{$} can be both an begin and end math character.
%D This can lead to confusing and errorprone situations when
@@ -55,6 +55,9 @@
$\def\stopmathmode{$}% \let\stopmathmode=$
\fi}
+\def\nomathematics#1%
+ {\ifmmode\hbox{#1}\else#1\fi}
+
%D \macros
%D {dimension, nodimension}
%D
diff --git a/tex/context/base/supp-mis.tex b/tex/context/base/supp-mis.tex
index a2a7a925d..053497f47 100644
--- a/tex/context/base/supp-mis.tex
+++ b/tex/context/base/supp-mis.tex
@@ -17,6 +17,8 @@
\ifx \undefined \writestatus \else \expandafter \endinput \fi
+\ifx \undefined \pdfoutput \chardef\pdfoutput=0 \fi
+
%D Because \LATEX\ has no safe package loading mechanism, we
%D need to take care of possible interference.
@@ -417,6 +419,15 @@
%D alternative is a bit different, but we hope this one works
%D here.
+\ifx\dospecials\undefined
+
+ \def\dospecials
+ {\do\ \do\\\do\{\do\}\do\$%
+ \do\#\do\^\do\_\do\&\do\%%
+ \do\~\do\^^A\do\^^K}
+
+\fi
+
\ifnocontextobject \uncatcodespecials \do
\def\uncatcodespecials%
@@ -441,7 +452,8 @@
\catcode`\:=\@@other \catcode`\;=\@@other
\catcode`\,=\@@other \catcode`\.=\@@other \catcode`\~=\@@other
\catcode`\(=\@@other \catcode`\)=\@@other
- \catcode`\{=\@@other \catcode`\}=\@@other}
+ \catcode`\{=\@@other \catcode`\}=\@@other
+ \catcode`\\=\@@other \catcode`\%=\@@other }
\fi
@@ -505,14 +517,17 @@
{\recursecounter=\maxdimen}
%D \macros
-%D {doifdefined,doifundefined,
+%D {ifundefined,doifdefined,doifundefined,
%D doifdefinedelse,doifundefinedelse}
%D
%D These alteratives are not robust but suitable for simple
-%D usage.
+%D usage. The official ones are a bit faster.
\ifnocontextobject \doifdefined \do
+ \def\ifundefined#1%
+ {\expandafter\ifx\csname#1\endcsname\relax}
+
\def\doifdefinedelse#1#2#3%
{\expandafter\ifx\csname#1\endcsname\relax#3\else#2\fi}
diff --git a/tex/context/base/supp-mpe.tex b/tex/context/base/supp-mpe.tex
index 0becad3fc..6d8a8a18c 100644
--- a/tex/context/base/supp-mpe.tex
+++ b/tex/context/base/supp-mpe.tex
@@ -17,8 +17,8 @@
%D preamble definitions, but when producing \PDF\ we have to
%D set up the appropriate datastructures ourselves. It acts as
%D a plug in into \type {supp-pdf}. As soon as we need more
-%D extensions, we will generalize these macro. Some
-%D definitions will move to the special drivers.
+%D extensions, we will generalize these macro. Some
+%D definitions will move to the special drivers.
\writestatus{loading}{MetaPost Special Extensions}
@@ -81,29 +81,26 @@
%D The \type {%%MetaPostSpecials: version.revision signal} line
%D triggers this module into handling color specifications kind
-%D of special. We need this safeguard for non||special
-%D usage.
+%D of special. We need this safeguard for non||special
+%D usage.
\chardef\MPspecialversion = 0 % specials when >1
\chardef\MPspecialrevision = 0 % specials when >1
\chardef\MPspecialsignal = 0 % passed on by graphic
-\newcount\currentPDFshade % 0 % global (document wide) counter
\chardef\inlineMPspecials = 1 % only needed for stack resetting
-\let\currentMPshades\empty
-
-%D This macro handles the special definitions that are
-%D passed as comment.
+%D This macro handles the special definitions that are
+%D passed as comment.
\def\dohandleMPspecialcomment#1
{\setMPargument{#1}%
- \advance\scratchcounter by -1\relax
+ \advance\scratchcounter -1
\ifcase\scratchcounter\relax
\handleMPspecialcommand
\donetrue
\doresetMPstack
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\expandafter\handleMPsequence
\else
\expandafter\dohandleMPspecialcomment
@@ -113,69 +110,60 @@
{\doresetMPstack
\scratchcounter=#1\relax
\ifcase\scratchcounter % when zero, inline shading is used
- \chardef\inlineMPspecials=1
- \let\handleMPsequence=\dohandleMPsequence
+ \chardef\inlineMPspecials1
+ \let\handleMPsequence\dohandleMPsequence
\expandafter\handleMPsequence
\else
- \chardef\inlineMPspecials=0
+ \chardef\inlineMPspecials0
\expandafter\dohandleMPspecialcomment
\fi}
-%D When defined inline, we use another macro to handle the
-%D definitions. Actually, this macro is called by the
-%D previous ones.
+%D When defined inline, we use another macro to handle the
+%D definitions. Actually, this macro is called by the
+%D previous ones.
\def\handleMPspecialcommand%
{\ifcase\inlineMPspecials\or
- \advance\nofMParguments by -1 % pop the size
+ \advance\nofMParguments -1 % pop the size
+ \fi
+ \ifundefined\MPspecial
+ \message{[unknown \MPspecial]}%
+ \else
+ \csname\MPspecial\endcsname
\fi
- \doifundefinedelse{\MPspecial}
- {\message{[unknown \MPspecial]}}
- {\getvalue{\MPspecial}}%
\ifcase\inlineMPspecials
\doresetMPstack % 0
\else
\resetMPstack % 1
\fi}
-%D This macro triggers special support. Currently, the
+%D This macro triggers special support. Currently, the
%D version and revision number are not used. Any version number
-%D greater than zero will enable special support.
+%D greater than zero will enable special support.
\def\handleMPspecialscomment #1.#2 #3 % version.revision signal
{\doresetMPstack
- \chardef\MPspecialversion =#1
- \chardef\MPspecialrevision=#2
- \chardef\MPspecialsignal =#3
- \let\handleMPsequence=\dohandleMPsequence
+ \chardef\MPspecialversion #1
+ \chardef\MPspecialrevision#2
+ \chardef\MPspecialsignal #3
+ \let\handleMPsequence\dohandleMPsequence
\handleMPsequence}
-%D In case of \PDF, we need to prepare resourcs.
+%D In case of \PDF, we need to prepare resourcs.
+
+\newtoks\MPstartresources
+\newtoks\MPstopresources
\def\startMPresources%
- {\global\let\currentMPshades\empty
+ {\the\MPstartresources
\ifx\currentPDFresources\empty\else
- \message{[unused resources before shade \the\currentPDFshade]}%
+ \message{[unused resources]}%
\fi
\global\let\currentPDFresources\empty}
\def\stopMPresources%
- {\ifx\currentMPshades\empty
- \global\let\currentPDFresources\empty
- \else
- \xdef\currentPDFresources%
- {/Shading << \currentMPshades >>}%
- \fi}
-
-\def\startMPshading#1%
- {\edef\currentMPspecial{\gMPs{#1}}}
-
-\def\stopMPshading%
- {\global\advance\currentPDFshade by 1
- \setxvalue{obj:Sh:\currentMPspecial}%
- {/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }%
- \setxvalue{mps:Sh:\currentMPspecial}%
- {\the\currentPDFshade}}
+ {\let\currentPDFresources\empty
+ \the\MPstopresources}
%D Since colors are not subjected to transformations, we can
%D only use colors as signal. In our case, we use a dummy colored
@@ -183,7 +171,7 @@
%D {0.001} is the first path and \type {0.010} the tenth. Since
%D \METAPOST strips trailing zeros, we have to padd the string.
-\newif\ifMPcmyk
+\newif\ifMPcmyk
\ifx\normalhandleMPrgbcolor\undefined % in case we reload this module
@@ -191,45 +179,45 @@
\let\normalhandleMPcmykcolor\handleMPcmykcolor
\let\normalhandleMPgraycolor\handleMPgraycolor
-\fi
+\fi
-%D When we are using \CONTEXT, we will fall back to the
+%D When we are using \CONTEXT, we will fall back to the
%D better color conversion routines. This also has the advantage
-%D that we don't have to parse and convert the file. In this
+%D that we don't have to parse and convert the file. In this
%D alternative, \type {\!MP} is not (yet) supported. Because
-%D we can (for efficiency reasons) turn off strokecolor,
-%D something we cannot do in \METAPOST\ converted code.
+%D we can (for efficiency reasons) turn off strokecolor,
+%D something we cannot do in \METAPOST\ converted code.
-\newif\ifPDFMPstrokecolor \PDFMPstrokecolortrue
+\newif\ifPDFMPstrokecolor \PDFMPstrokecolortrue
%D [This code should move to meta-ini.]
-\ifCONTEXT
+\ifCONTEXT % we can use this for a better xgstate handling
\def\checkPDFMPstrokecolor%
{\ifPDFMPstrokecolor \PDFstrokecolortrue \fi}
- \def\normalhandleMPrgbcolor%
- {{\checkPDFMPstrokecolor\dostartcolormodeR\gMPa1:\gMPa2:\gMPa3\od}}
+ \def\normalhandleMPrgbcolor
+ {{\checkPDFMPstrokecolor\execcolorR\gMPa1:\gMPa2:\gMPa3:0:0\od}}
- \def\normalhandleMPcmykcolor%
- {{\checkPDFMPstrokecolor\dostartcolormodeC\gMPa1:\gMPa2:\gMPa3:\gMPa4\od}}
+ \def\normalhandleMPcmykcolor
+ {{\checkPDFMPstrokecolor\execcolorC\gMPa1:\gMPa2:\gMPa3:\gMPa4:0:0\od}}
- \def\normalhandleMPgraycolor%
- {{\checkPDFMPstrokecolor\dostartcolormodeS\gMPa1\od}}
+ \def\normalhandleMPgraycolor
+ {{\checkPDFMPstrokecolor\execcolorS\gMPa1:0:0\od}}
\fi
% In the previous macros we use the special drivers. A more
-% direct approach would have been:
+% direct approach would have been:
%
-% \def\doPDFstartrgbcolormode#1#2#3%
+% \def\doPDFstartrgbcolormode#1#2#3%
% {\PDFcode{#1 #2 #3 rg #1 #2 #3 RG}}
%
% \def\doPDFstartcmykcolormode#1#2#3#4%
% {\PDFcode{#1 #2 #3 #4 k #1 #2 #3 #4 K}}
%
-% \def\doPDFstartgraycolormode#1%
+% \def\doPDFstartgraycolormode#1%
% {\PDFcode{#1 g #1 G}}
%
% \appendtoks
@@ -238,15 +226,15 @@
% \let\dostartgraycolormode\doPDFstartgraycolormode
% \to \everyMPtoPDFconversion
-%D Now we can handle special color signals. We only do this
-%D when special are detected.
+%D Now we can handle special color signals. We only do this
+%D when special are detected.
\def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1000.0000\relax}
\def\doMPrgbnumber#1.#2#3#4#5\relax{#2#3#4}
-%D The naive case looks like:
-%D
-%D \starttypen
+%D The naive case looks like:
+%D
+%D \starttypen
%D \def\handleMPrgbcolor%
%D {\setMPcolor
%D \ifcase\MPspecialversion
@@ -256,124 +244,150 @@
%D \else
%D \resetMPcolor\normalhandleMPrgbcolor
%D \fi\fi}
-%D \stoptypen
+%D \stoptypen
%D
-%D However, since we want \CMYK\ support, we will use the
-%D following implementation:
+%D However, since we want \CMYK\ support, we will use the
+%D following implementation:
-\def\handleMPrgbcolor%
- {\setMPcolor
- \ifcase\MPspecialversion
- \resetMPcolor\normalhandleMPrgbcolor
- \else\ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal\relax
- \ifMPcmyk \ifnum\MPrgbnumber\lastMPgvalue=1 % cmyk color spec
- \doifdefined{mps:k:\number\MPrgbnumber\lastMPbvalue}
- {\getvalue{mps:k:\number\MPrgbnumber\lastMPbvalue}%
- \resetMPcolor\normalhandleMPcmykcolor}%
- \fi \fi
- \else
- \resetMPcolor\normalhandleMPrgbcolor
- \fi\fi}
+% \def\setMPcolor
+% {\edef\lastMPrvalue{\gMPa1}%
+% \edef\lastMPgvalue{\gMPa2}%
+% \edef\lastMPbvalue{\gMPa3}}
+%
+% speed up:
-\def\handleMPcmykcolor%
- {\resetMPcolor\normalhandleMPcmykcolor}
+\def\setMPcolor%
+ {\edef\lastMPrvalue{\csname\@@MP01\endcsname}%
+ \edef\lastMPgvalue{\csname\@@MP02\endcsname}%
+ \edef\lastMPbvalue{\csname\@@MP03\endcsname}}
+
+\def\zeroMPrgbvalue{0.0}
+
+\def\resetMPcolor
+ {\let\lastMPrvalue\zeroMPrgbvalue
+ \let\lastMPgvalue\zeroMPrgbvalue
+ \let\lastMPbvalue\zeroMPrgbvalue}
+
+\resetMPcolor
+
+% \def\handleMPrgbcolor%
+% {\ifcase\MPspecialversion
+% \normalhandleMPrgbcolor
+% \else
+% \setMPcolor
+% \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal\relax
+% \ifMPcmyk \interceptMPcmykcolor \fi
+% \else
+% \resetMPcolor\normalhandleMPrgbcolor
+% \fi
+% \fi}
+
+\def\@@MPSK{@MPSK@}
+
+% \def\interceptMPcmykcolor
+% {\ifMPcmyk
+% \ifnum\MPrgbnumber\lastMPgvalue=1 % cmyk color spec
+% \doifdefined{\@@MPSK\number\MPrgbnumber\lastMPbvalue}
+% {\getvalue{\@@MPSK\number\MPrgbnumber\lastMPbvalue}%
+% \resetMPcolor\normalhandleMPcmykcolor}%
+% \fi
+% \fi}
+
+%\def\interceptMPcmykcolor % can be used often, so sped up
+% {\ifcase\MPrgbnumber\lastMPgvalue \or % 1 == cmyk color spec
+% \expandafter\dointerceptMPcmykcolor
+% \fi}
+
+\def\interceptMPcmykcolor % todo : \ifMPcmyk
+ {\ifcase\MPrgbnumber\lastMPgvalue
+ % cannot happen
+ \or
+ % 1 == cmyk color spec
+ \ifMPcmyk \dointerceptMPcmykcolor \fi
+ \or
+ % 2 == rgb transparency
+ \invokeMPtransparencyspecial
+ \else
+ % 3 == cmyk transparency
+ \ifMPcmyk \invokeMPtransparencyspecial \fi
+ \fi}
-\def\handleMPgraycolor%
- {\resetMPcolor\normalhandleMPgraycolor}
+%\def\dointerceptMPcmykcolor % can be used often, so sped up
+% {\@EA\ifx\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else
+% \csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname
+% \resetMPcolor\normalhandleMPcmykcolor
+% \fi}
+
+\def\dointerceptMPcmykcolor % can be used often, so sped up
+ {\revokeMPtransparencyspecial
+ \@EA\ifx\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else
+ \csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname
+ \normalhandleMPcmykcolor
+ \fi}
-\def\resetMPcolor%
- {\def\lastMPrvalue{0.0}%
- \def\lastMPgvalue{0.0}%
- \def\lastMPbvalue{0.0}}
+\def\handleMPrgbcolor
+ {\resetMPcolor
+ \ifcase\MPspecialversion
+ \normalhandleMPrgbcolor
+ \else
+ \setMPcolor
+ \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal\relax
+ \interceptMPcmykcolor
+ \else
+ \revokeMPtransparencyspecial
+ \normalhandleMPrgbcolor
+ \fi
+ \fi}
-\def\setMPcolor%
- {\edef\lastMPrvalue{\gMPa1}%
- \edef\lastMPgvalue{\gMPa2}%
- \edef\lastMPbvalue{\gMPa3}}
+\def\handleMPgraycolor
+ {\resetMPcolor
+ \ifcase\MPspecialversion \else \revokeMPtransparencyspecial \fi
+ \normalhandleMPgraycolor}
-\resetMPcolor
+\def\handleMPcmykcolor
+ {\resetMPcolor
+ \ifcase\MPspecialversion \else \revokeMPtransparencyspecial \fi
+ \normalhandleMPcmykcolor}
-%D Specials are define and recalled using:
+%D Specials are define and recalled using:
-\def\MPspecial%
+\def\MPspecial
{MP special \gMPs\nofMParguments}
\def\defineMPspecial#1#2%
{\setvalue{MP special #1}{#2}}
-%D The path processing macro is slightly extended.
-
-% \def\processMPpath%
-% {\ifcase\MPspecialversion\else
-% \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal
-% \scratchcounter=\MPrgbnumber\lastMPbvalue
-% \edef\currentMPspecial{\the\scratchcounter}%
-% \ifnum\finiMPpath=2
-% \doifdefined{mps:Sh:\currentMPspecial}
-% {\edef\currentMPshade{\getvalue{obj:Sh:\currentMPspecial}}%
-% \doifinstringelse{\currentMPshade}{\currentMPshades}
-% {}{\xdef\currentMPshades{\currentMPshades\currentMPshade}}%
-% \chardef\finiMPpath=4 \PDFcode{q /Pattern cs}}%
-% \fi
-% \fi
-% \fi
-% \flushMPpath
-% \closeMPpath
-% \PDFcode
-% {\ifcase\finiMPpath
-% W n\or S\or f\or B\or W n /Sh\getvalue{mps:Sh:\currentMPspecial} sh Q%
-% \fi}%
-% \let\handleMPsequence=\dohandleMPsequence
-% \resetMPstack
-% \nofMPsegments=0
-% \handleMPsequence}
+%D The path processing macro is slightly extended.
\newtoks \invokeMPspecials
-% \def\processMPpath%
-% {\let\extraMPpathcode\empty
-% \ifcase\MPspecialversion\else
-% \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal
-% \scratchcounter=\MPrgbnumber\lastMPbvalue
-% \edef\currentMPspecial{\the\scratchcounter}%
-% \ifnum\finiMPpath=2 % to outer level
-% \the\invokeMPspecials
-% \fi
-% \fi
-% \fi
-% \flushMPpath
-% \closeMPpath
-% \PDFcode{\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi \extraMPpathcode}%
-% \let\handleMPsequence=\dohandleMPsequence
-% \resetMPstack
-% \nofMPsegments=0
-% \handleMPsequence}
-
\def\finishMPpath%
{\PDFcode
- {\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi
+ {\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi
\extraMPpathcode}}
\def\processMPpath%
- {\checkMPpath % !
+ {\checkMPpath % !
\ifcase\nofMPsegments\else
\let\extraMPpathcode\empty
\ifcase\MPspecialversion\else
- \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal
- \scratchcounter=\MPrgbnumber\lastMPbvalue
- \edef\currentMPspecial{\the\scratchcounter}%
- \ifnum\finiMPpath=2 % to outer level
- \the\invokeMPspecials
+ \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal
+ \ifnum\MPrgbnumber\lastMPgvalue>10 % really needed
+ \scratchcounter\MPrgbnumber\lastMPbvalue
+ \edef\currentMPspecial{\the\scratchcounter}%
+ \ifnum\finiMPpath=2 % to outer level
+ \the\invokeMPspecials
+ \fi
\fi
\fi
\fi
\flushMPpath
\closeMPpath
\finishMPpath
- \fi
- \let\handleMPsequence=\dohandleMPsequence
+ \fi
+ \let\handleMPsequence\dohandleMPsequence
\resetMPstack
- \nofMPsegments=0
+ \nofMPsegments0
\handleMPsequence}
%D Shading is an example of a more advanced graphic feature,
@@ -510,18 +524,42 @@
%D \NC /N \NC smaller values, bigger inner circles \NC \NR
%D \stoptabulatie
+\newcount\currentPDFshade % 0 % global (document wide) counter
+\let\currentMPshades\empty
+
+\def\startMPshading#1%
+ {\edef\currentMPspecial{\gMPs{#1}}}
+
+\def\stopMPshading%
+ {\global\advance\currentPDFshade 1
+ \setxvalue{obj:Sh:\currentMPspecial}%
+ {/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }%
+ \setxvalue{mps:Sh:\currentMPspecial}%
+ {\the\currentPDFshade}}
+
+\appendtoks
+ \global\let\currentMPshades\empty
+\to \MPstartresources
+
+\appendtoks
+ \ifx\currentMPshades\empty \else
+ \xdef\currentPDFresources{\currentPDFresources
+ /Shading <<\currentMPshades>>}%
+ \fi
+\to \MPstopresources
+
\def\invokeMPshadespecial%
{\doifdefined{mps:Sh:\currentMPspecial}
- {\edef\currentMPshade{\getvalue{obj:Sh:\currentMPspecial}}%
+ {\edef\currentMPshade{\getvalue{obj:Sh:\currentMPspecial}}%
\doifinstringelse{\currentMPshade}{\currentMPshades}
- {}{\xdef\currentMPshades{\currentMPshades\currentMPshade}}%
+ {}{\xdef\currentMPshades{\currentMPshades\currentMPshade}}%
\def\extraMPpathcode{/Sh\getvalue{mps:Sh:\currentMPspecial} sh Q}%
- \chardef\finiMPpath=0
+ \chardef\finiMPpath=0
\PDFcode{q /Pattern cs}}}
\appendtoks \invokeMPshadespecial \to \invokeMPspecials
-\defineMPspecial{2}
+\defineMPspecial{30}
{\startMPshading{14}% type 2
\immediate\pdfobj
{<</FunctionType 2
@@ -537,7 +575,7 @@
/Extend [true true]>>}%
\stopMPshading}
-\defineMPspecial{3}
+\defineMPspecial{31}
{\startMPshading{16}% type 3
\immediate\pdfobj
{<</FunctionType 2
@@ -553,12 +591,12 @@
/Extend [true true]>>}%
\stopMPshading}
-%D Figure inclusion is kind of strange to \METAPOST, but when
+%D Figure inclusion is kind of strange to \METAPOST, but when
%D Santiago Muelas started discussing this with me, I was able
-%D to cook up a solution using specials.
+%D to cook up a solution using specials.
\def\invokeMPfigurespecial%
- {\getvalue{mps:gr:\currentMPspecial}} % or \relax
+ {\getvalue{mps:gr:\currentMPspecial}} % or \relax
\appendtoks \invokeMPfigurespecial \to \invokeMPspecials
@@ -571,50 +609,50 @@
% \def\handleMPfigurespecial#1#2#3#4#5#6#7%
% {\vbox to 0pt
% {\vss
-% \hbox to 0pt
-% {\pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
-% \pdfimage width 1bp height 1bp {#7}% maybe 10 is better
-% \pdfliteral{Q}%
+% \hbox to 0pt
+% {\pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
+% \pdfimage width 1bp height 1bp {#7}% maybe 10 is better
+% \pdfliteral{Q}%
% \hss}}}
-%
-% better, since xform reuse
+%
+% better, since xform reuse
-\def\handleMPfigurespecial#1#2#3#4#5#6#7%
- {\vbox to \!!zeropoint
+\def\handleMPfigurespecial#1#2#3#4#5#6#7% todo : combine with ext fig
+ {\vbox to \zeropoint
{\vss
- \hbox to \!!zeropoint
+ \hbox to \zeropoint
{\ifcase\pdfoutput\or % will be hooked into the special driver
\doiffileelse{#7}
{\doifundefinedelse{mps:x:#7}
- {\immediate\pdfximage width 1bp height 1bp {#7}%
+ {\immediate\pdfximage width 1bp height 1bp {#7}%
\setxvalue{mps:x:#7}{\pdfrefximage\the\pdflastximage}}%
- {\message{[reusing figure #7]}}%
- \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
+ {\message{[reusing figure #7]}}%
+ \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
\rlap{\getvalue{mps:x:#7}}%
\pdfliteral{Q}}
- {\message{[unknown figure #7]}}%
+ {\message{[unknown figure #7]}}%
\fi
\hss}}}
-%D An example of using both special features is the
-%D following.
+%D An example of using both special features is the
+%D following.
%D
-%D \starttypen
-%D \startMPpage
-%D externalfigure "hakker1b.png" scaled 22cm rotated 10 shifted (-2cm,0cm);
-%D externalfigure "hakker1b.png" scaled 10cm rotated -10 ;
-%D externalfigure "hakker1b.png" scaled 7cm rotated 45 shifted (8cm,12cm) ;
+%D \starttypen
+%D \startMPpage
+%D externalfigure "hakker1b.png" scaled 22cm rotated 10 shifted (-2cm,0cm);
+%D externalfigure "hakker1b.png" scaled 10cm rotated -10 ;
+%D externalfigure "hakker1b.png" scaled 7cm rotated 45 shifted (8cm,12cm) ;
%D path p ; p := unitcircle xscaled 15cm yscaled 20cm;
-%D path q ; q := p rotatedaround(center p,90) ;
-%D path r ; r := buildcycle(p,q) ; clip currentpicture to r ;
-%D path s ; s := boundingbox currentpicture enlarged 5mm ;
-%D picture c ; c := currentpicture ; currentpicture := nullpicture ;
+%D path q ; q := p rotatedaround(center p,90) ;
+%D path r ; r := buildcycle(p,q) ; clip currentpicture to r ;
+%D path s ; s := boundingbox currentpicture enlarged 5mm ;
+%D picture c ; c := currentpicture ; currentpicture := nullpicture ;
%D circular_shade(s,0,.2red,.9red) ;
-%D addto currentpicture also c ;
+%D addto currentpicture also c ;
%D \stopMPpage
-%D \stoptypen
+%D \stoptypen
-%D This is some experimental hyperlink driver that I wrote
+%D This is some experimental hyperlink driver that I wrote
%D for Mark Wicks.
\defineMPspecial{20}
@@ -625,7 +663,7 @@
\def\handleMPhyperlink#1#2#3#4#5%
{%\ifcase\pdfoutput\or
- \setbox\scratchbox=\hbox
+ \setbox\scratchbox=\hbox
{\setbox\scratchbox=\null
\scratchdimen=#1bp\scratchdimen=-\scratchdimen
\advance\scratchdimen#3bp
@@ -633,10 +671,10 @@
\scratchdimen=#2bp\scratchdimen=-\scratchdimen
\advance\scratchdimen#4bp
\ht\scratchbox=\scratchdimen
- \incolorfalse
+ \incolorfalse
\gotobox{\box\scratchbox}[#5]}%
\setbox\scratchbox=\hbox
- {\scratchdimen\MPxoffset bp \advance\scratchdimen#1bp
+ {\scratchdimen\MPxoffset bp \advance\scratchdimen#1bp
\hskip\scratchdimen
\scratchdimen=\MPyoffset bp \advance\scratchdimen#2bp
\raise\scratchdimen\box\scratchbox}%
@@ -645,45 +683,45 @@
}%\fi}
\def\invokeMPhyperlinkspecial%
- {\getvalue{mps:hl:\currentMPspecial}} % or \relax
+ {\getvalue{mps:hl:\currentMPspecial}} % or \relax
\appendtoks \invokeMPhyperlinkspecial \to \invokeMPspecials
-%D Special number~1 is dedicated to \CMYK\ support. If you
-%D want to know why: look at this:
-%D
+%D Special number~1 is dedicated to \CMYK\ support. If you
+%D want to know why: look at this:
+%D
%D \startbuffer[mp]
%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ;
%D \stopbuffer
-%D
+%D
%D \startbuffer[cmyk]
%D \startcombinatie[4*1]
-%D {\definecolor[test][c=1,y=.3,k=.3] \processMPbuffer[mp]} {c=1 y=.3 k=.3}
-%D {\definecolor[test][c=.9,y=.15] \processMPbuffer[mp]} {c=.9 y=.15}
-%D {\definecolor[test][c=.25,y=.8] \processMPbuffer[mp]} {c=.25 y=.8}
-%D {\definecolor[test][c=.45,y=.1] \processMPbuffer[mp]} {c=.45 y=.1}
+%D {\definecolor[test][c=1,y=.3,k=.3] \processMPbuffer[mp]} {c=1 y=.3 k=.3}
+%D {\definecolor[test][c=.9,y=.15] \processMPbuffer[mp]} {c=.9 y=.15}
+%D {\definecolor[test][c=.25,y=.8] \processMPbuffer[mp]} {c=.25 y=.8}
+%D {\definecolor[test][c=.45,y=.1] \processMPbuffer[mp]} {c=.45 y=.1}
%D \stopcombinatie
%D \stopbuffer
-%D
+%D
%D \plaatsfiguur
-%D {\CMYK\ support disabled,
+%D {\CMYK\ support disabled,
%D conversion to \RGB.}
%D {\setupcolors[cmyk=nee,status=start]\haalbuffer[cmyk]}
-%D
+%D
%D \plaatsfiguur
-%D {\CMYK\ support enabled,
+%D {\CMYK\ support enabled,
%D no support in \METAPOST.}
%D {\setupcolors[cmyk=ja,mpcmyk=nee,status=start]\haalbuffer[cmyk]}
-%D
+%D
%D \plaatsfiguur
-%D {\CMYK\ support enabled,
-%D no conversion to \RGB,
+%D {\CMYK\ support enabled,
+%D no conversion to \RGB,
%D support in \METAPOST}
%D {\setupcolors[cmyk=ja,status=start]\haalbuffer[cmyk]}
\defineMPspecial{1}
- {\ifMPcmyk
- \setxvalue{mps:k:\gMPs1}{\noexpand\setMPcmyk\gMPs2 \gMPs3 \gMPs4 \gMPs5 }%
+ {\ifMPcmyk
+ \setxvalue{\@@MPSK\gMPs1}{\noexpand\setMPcmyk\gMPs2 \gMPs3 \gMPs4 \gMPs5 }%
\fi}
\def\setMPcmyk#1 #2 #3 #4 %
@@ -692,67 +730,267 @@
\setvalue{\@@MP03}{#3}%
\setvalue{\@@MP04}{#4}}
-%D This special (number 50) passes positions to a tex file.
-%D This method uses a two||pass approach an (mis|)|used the
-%D context positioning macros. In \type {core-pos} we will
-%D implement the low level submacro needed.
+%D This special (number 50) passes positions to a tex file.
+%D This method uses a two||pass approach an (mis|)|used the
+%D context positioning macros. In \type {core-pos} we will
+%D implement the low level submacro needed.
%D
%D \startbuffer
-%D \definelayer[test]
+%D \definelayer[test]
%D
%D \setlayer
%D [test]
%D [x=\MPx{somepos-1},y=\MPy{somepos-1}]
%D {Whatever we want here!}
-%D
+%D
%D \setlayer
%D [test]
%D [x=\MPx{somepos-2},y=\MPy{somepos-2}]
%D {Whatever we need there!}
-%D
+%D
%D \startuseMPgraphic{oeps}
-%D draw fullcircle scaled 6cm withcolor red ;
-%D register ("somepos-1",1cm,2cm,center currentpicture) ;
-%D register ("somepos-2",4cm,3cm,(-1cm,-2cm)) ;
+%D draw fullcircle scaled 6cm withcolor red ;
+%D register ("somepos-1",1cm,2cm,center currentpicture) ;
+%D register ("somepos-2",4cm,3cm,(-1cm,-2cm)) ;
%D \stopuseMPgraphic
-%D
+%D
%D \framed[background=test,offset=overlay]{\useMPgraphic{oeps}}
%D \stopbuffer
-%D
-%D \typebuffer
-%D
+%D
+%D \typebuffer
+%D
%D Here the width and height are not realy used, but one can
-%D imagine situations where tex has to work with values
-%D calculated by \METAPOST.
-%D
+%D imagine situations where tex has to work with values
+%D calculated by \METAPOST.
+%D
%D \startlinecorrection
%D \getbuffer
%D \stoplinecorrection
%D
-%D Later we will implement a more convenient macro:
+%D Later we will implement a more convenient macro:
%D
-%D \starttyping
+%D \starttyping
%D \setMPlayer [test] [somepos-1] {Whatever we want here!}
%D \setMPlayer [test] [somepos-2] {Whatever we need there!}
%D \stoptyping
-
+
\ifx\dosavepositionwhd\undefined
\let\dosavepositionwhd\gobblesevenarguments
\fi
-\defineMPspecial{50} % x y width height label
+\defineMPspecial{50} % x y width height label
{\bgroup
- \scratchdimen\MPllx bp \scratchdimen=-\scratchdimen
- \advance\scratchdimen\gMPs1bp
+ \scratchdimen\MPllx bp \scratchdimen-\scratchdimen
+ \advance\scratchdimen\gMPs1bp
\edef\x{\number\scratchdimen}%
- \scratchdimen\gMPs2bp \scratchdimen=-\scratchdimen
- \advance\scratchdimen\MPury bp
+ \scratchdimen\gMPs2bp \scratchdimen-\scratchdimen
+ \advance\scratchdimen\MPury bp
\edef\y{\number\scratchdimen}%
- \scratchdimen=\gMPs3bp
+ \scratchdimen\gMPs3bp
\edef\w{\number\scratchdimen}%
- \scratchdimen=\gMPs4bp
+ \scratchdimen\gMPs4bp
\edef\h{\number\scratchdimen}%
\dosavepositionwhd{\gMPs5}{0}{\x}{\y}{\w}{\h}{0}%
\egroup}
+%D Transparency support used specials 60 (rgb) and 61
+%D (cmyk).
+%D
+%D \startbuffer
+%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0);
+%D
+%D color cyan ; cyan := cmyk(1,0,0,0) ;
+%D color magenta ; magenta := cmyk(0,1,0,0) ;
+%D color yellow ; yellow := cmyk(0,0,1,0) ;
+%D
+%D fill p rotated 90 withcolor transparent(1,.5,yellow) ;
+%D fill p rotated 210 withcolor transparent(1,.5,green) ;
+%D fill p rotated 330 withcolor transparent(1,.5,blue) ;
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \startlinecorrection \processMPbuffer \stoplinecorrection
+%D
+%D One can also communicate colors between \CONTEXT\ and
+%D \METAPOST:
+%D
+%D \startbuffer
+%D \definecolor[tcyan] [c=1,k=.2,t=.5]
+%D \definecolor[tmagenta][m=1,k=.2,t=.5]
+%D \definecolor[tyellow] [y=1,k=.2,t=.5]
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+%D
+%D \startbuffer
+%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0);
+%D
+%D fill p rotated 90 withcolor \MPcolor{tcyan} ;
+%D fill p rotated 210 withcolor \MPcolor{tmagenta} ;
+%D fill p rotated 330 withcolor \MPcolor{tyellow} ;
+%D \stopbuffer
+%D
+%D \startlinecorrection \processMPbuffer \stoplinecorrection
+%D
+%D We save all the three components needed in one macro,
+%D just to save hash space.
+
+\def\@@MPST{@MPST@}
+
+\def\assignMPStransparency#1#2#3%
+ {\edef\PDFtransparencyidentifier{#1}%
+ \edef\PDFtransparencyreference {#2}%
+ \edef\PDFtransparencycolorspecs{#3}}
+
+\defineMPspecial{2}
+ {\edef\currentMPspecial{\gMPs6}%
+ \presetPDFtransparency{\gMPs1}{\gMPs2}%
+ \setxvalue{\@@MPST\currentMPspecial}%
+ {\noexpand\assignMPStransparency
+ {\PDFtransparencyidentifier}%
+ {\PDFtransparencyreference}%
+ {\gMPs3 \gMPs4 \gMPs5 rg \gMPs3 \gMPs4 \gMPs5 RG}}}
+
+\defineMPspecial{3}
+ {\edef\currentMPspecial{\gMPs7}%
+ \presetPDFtransparency{\gMPs1}{\gMPs2}%
+ \setxvalue{\@@MPST\currentMPspecial}%
+ {\noexpand\assignMPStransparency
+ {\PDFtransparencyidentifier}%
+ {\PDFtransparencyreference}%
+ {\gMPs3 \gMPs4 \gMPs5 \gMPs6 k \gMPs3 \gMPs4 \gMPs5 \gMPs6 K}}}
+
+%D For efficiency reasons, we fall back on the allocation
+%D mechanisms already present. For use within \MPTOPDF, we
+%D provide a fall back routine.
+
+\let\currentMPtransparencies\empty
+
+% \def\invokeMPtransparencyspecial
+% {\doifdefined{\@@MPST\currentMPspecial}
+% {\getvalue{\@@MPST\currentMPspecial}%
+% \doifinstringelse
+% {\PDFtransparencyidentifier}{\currentMPtransparencies}
+% {}
+% {\xdef\currentMPtransparencies
+% {\currentMPtransparencies
+% \PDFtransparencyidentifier\space
+% \PDFtransparencyreference\space}}%
+% \def\extraMPpathcode{ Q}%
+% \PDFcode{q
+% \PDFtransparencycolorspecs\space
+% \PDFtransparencyidentifier\space gs}}}
+
+% this one triggers a new graphic state
+
+\def\invokeMPtransparencyspecial
+ {\scratchcounter\MPrgbnumber\lastMPbvalue
+ \edef\currentMPspecial{\the\scratchcounter}%
+ \ifundefined{\@@MPST\currentMPspecial}\else
+ \getvalue{\@@MPST\currentMPspecial}%
+ \doifinstringelse\PDFtransparencyidentifier\currentMPtransparencies
+ \donothing\registerMPtransparencyresource % slow
+ \PDFcode
+ {\PDFtransparencycolorspecs\space
+ \PDFtransparencyidentifier\space gs}%
+ % potential optimization
+ % \setevalue{\@@MPST\currentMPspecial}%
+ % {\PDFcode
+ % {\PDFtransparencycolorspecs\space
+ % \PDFtransparencyidentifier\space gs}}%
+ % \getvalue{\@@MPST\currentMPspecial}%
+ \let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial
+ \fi}
+
+% this one does a reset
+
+\let\revokeMPtransparencyspecial\relax
+
+\def\dorevokeMPtransparencyspecial % only called if state is set
+ {\ifx\PDFtransparencyresetidentifier\empty\else
+ \doifinstringelse\PDFtransparencyresetidentifier\currentMPtransparencies
+ \donothing\registerMPtransparencyresetresource
+ \PDFcode{\PDFtransparencyresetidentifier\space gs}%
+ % potential optimization
+ % \def\dorevokeMPtransparencyspecial
+ % {\PDFcode
+ % {\PDFtransparencycolorspecs\space
+ % \PDFtransparencyidentifier\space gs}}%
+ \let\dorevokeMPtransparencyspecial\dodorevokeMPtransparencyspecial
+ \let\revokeMPtransparencyspecial\relax % invoke sets it
+ \fi}
+
+% and this one a simplified reset
+
+% \def\dodorevokeMPtransparencyspecial % used after first invocation
+% {\getvalue{\@@MPST0}%
+% \PDFcode{\PDFtransparencyidentifier\space gs}}
+
+\def\dodorevokeMPtransparencyspecial % used after first invocation
+ {\PDFcode{\PDFtransparencyresetidentifier\space gs}%
+ \let\revokeMPtransparencyspecial\relax} % invoke sets it
+
+% add a resource entry
+
+\def\registerMPtransparencyresource
+ {\xdef\currentMPtransparencies
+ {\currentMPtransparencies
+ \PDFtransparencyidentifier\space
+ \PDFtransparencyreference\space}}
+
+\def\registerMPtransparencyresetresource
+ {\xdef\currentMPtransparencies
+ {\currentMPtransparencies
+ \PDFtransparencyresetidentifier\space
+ \PDFtransparencyresetreference\space}}
+
+\appendtoks \invokeMPtransparencyspecial \to \invokeMPspecials
+
+\ifCONTEXT \else
+
+ \def\@@MPSTN{@MPSTN@}
+ \def\@@MPSTO{@MPSTO@}
+
+ \newcount\PDFcurrenttransparency
+
+ \let\PDFtransparencyresetidentifier\empty
+ \let\PDFtransparencyresetreference \empty
+
+ \let\PDFtransparencyidentifier\empty
+ \let\PDFtransparencyreference \empty
+
+ \def\initializePDFtransparency
+ {\presetPDFtransparency{1}{1}%
+ \xdef\PDFtransparencyresetidentifier{/Tr0}%
+ \xdef\PDFtransparencyresetreference{\the\pdflastobj\space 0 R}%
+ \global\initializePDFtransparency\relax}
+
+ \def\presetPDFtransparency#1#2%
+ {\initializePDFtransparency
+ \@EA\ifx\csname\@@MPSTO#1:#2\endcsname\relax
+ \global\advance\PDFcurrenttransparency 1
+ \immediate\pdfobj{\PDFtransparancydictionary{#1}{#2}{}}%
+ \setxvalue{\@@MPSTN#1:#2}{\the\PDFcurrenttransparency}%
+ \setxvalue{\@@MPSTO#1:#2}{\the\pdflastobj}%
+ \fi
+ \edef\PDFtransparencyidentifier{/Tr\getvalue{\@@MPSTN#1:#2}}%
+ \edef\PDFtransparencyreference{\getvalue{\@@MPSTO#1:#2} 0 R}}
+
+\fi
+
+\appendtoks
+ \global\let\currentMPtransparencies\empty
+\to \MPstartresources
+
+\appendtoks
+ \ifx\currentMPtransparencies\empty \else
+ \xdef\currentPDFresources{\currentPDFresources
+ /ExtGState <<\currentMPtransparencies>>}%
+ \fi
+\to \MPstopresources
+
+%D In all cases, we need to keep track of the resources
+%D used.
+
\protect \endinput
diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex
index 6bde0b2c5..7f9ad6b7b 100644
--- a/tex/context/base/supp-mps.tex
+++ b/tex/context/base/supp-mps.tex
@@ -37,12 +37,15 @@
%D Ok then, let's start:
\ifx \undefined \writestatus \input supp-mis.tex \relax \fi
+\ifx \undefined \letterhash \else \input supp-ini.tex \relax \fi
\ifx \undefined \startMPgraphic \else \expandafter \endinput \fi
\writestatus{loading}{Context Support Macros / MetaPost Inclusion}
\unprotect
+\def\@@MPG{@MPG@}
+
%D \macros
%D {startMPgraphic}
%D
@@ -56,7 +59,7 @@
%D
%D This is implemented as:
-\long\def\startMPgraphic#1\stopMPgraphic%
+\long\def\startMPgraphic#1\stopMPgraphic
{\checkMPTEXgraphic{#1}%
\startwritingMPgraphic
\writeMPgraphic{#1}%
@@ -92,7 +95,7 @@
\ifCONTEXT
- \long\def\dostartMPrun#1#2\stopMPrun%
+ \long\def\dostartMPrun#1#2\stopMPrun
{\bgroup
\MPruntrue
\doifsomething{#1}{\def\MPgraphicfile{#1}}%
@@ -102,12 +105,12 @@
\stopwritingMPgraphic
\egroup}
- \def\startMPrun%
+ \def\startMPrun
{\dosinglegroupempty\dostartMPrun}
\else
- \long\def\startMPrun#1\stopMPrun%
+ \long\def\startMPrun#1\stopMPrun
{\MPruntrue
\checkMPTEXgraphic{#1}%
\startwritingMPgraphic
@@ -169,6 +172,7 @@
%D characterized bij a \COUNTER. This counter is available
%D in \type{\MPgraphic}.
+\newcount\nofMPgraphics
\newcount\currentMPgraphic
\def\MPgraphic{0}
@@ -199,8 +203,8 @@
\newtoks \MPinitializations
-\long\def\startMPinclusions#1\stopMPinclusions%
- {\long\def\theMPinclusions%
+\long\def\startMPinclusions#1\stopMPinclusions
+ {\long\def\theMPinclusions
{\@EA\expanded\@EA{\@EA\writeMPgraphic\@EA{\the\MPinitializations;}}%
\writeMPgraphic{#1}}}
@@ -232,27 +236,39 @@
\edef\currentwidth {\the\hsize \space}%
\edef\currentheight {\the\vsize \space}}
-\long\def\writeMPgraphic#1% \expanded testen
+\def\writeMPgraphic % no big #1 passing here
+ {\iflongMPlines
+ \expandafter\writeMPgraphiclong
+ \else
+ \expandafter\writeMPgraphicshort
+ \fi}
+
+\long\def\writeMPgraphiclong#1%
{\bgroup
\presetMPdefinitions
- \let\par=\space
- \iflongMPlines
- \long\def\flush##1##2\par%
- {\ifx##1\relax \else
- \immediate\write\MPwrite{##1##2}%
- \expandafter\flush
- \fi}%
- \flush#1\empty\par\relax\par
- \else
- \long\def\flush##1##2;%
- {\ifx##1\relax \else
- \dowriteMPgraphicline##1##2tex \relax etex\MPend
- \expandafter\flush
- \fi}%
- \flush#1\empty;\relax;%
- \fi
+ \let\par\space
+ \longMPflush#1\empty\par\relax\par
+ \egroup}
+
+\long\def\writeMPgraphicshort#1%
+ {\bgroup
+ \presetMPdefinitions
+ \let\par\space
+ \shortMPflush#1\empty;\relax;%
\egroup}
+\long\def\longMPflush#1#2\par
+ {\ifx#1\relax \else
+ \immediate\write\MPwrite{#1#2}%
+ \expandafter\longMPflush
+ \fi}
+
+\long\def\shortMPflush#1#2;%
+ {\ifx#1\relax \else
+ \dowriteMPgraphicline#1#2tex \relax etex\MPend
+ \expandafter\shortMPflush
+ \fi}
+
%D The \type {;} aware method (the \type {\else} branch) also
%D takes care of \type {btex}||\type {etex}, \type
%D {verbatimtex}||\type {etex}. The space after \type {tex}
@@ -289,43 +305,70 @@
\newif\ifforceMPTEXgraphic
+\convertargument etex\to\MPasciiB
+\convertargument textext\to\MPasciiC % geen "text"
+\convertargument graphictext\to\MPasciiD % geen "text"
+
\long\def\checkMPTEXgraphic#1%
{\ifforceMPTEXgraphic
\global\MPTEXgraphictrue
\else
- \expandafter\convertargument #1\to\asciiA
- \convertargument etex\to\asciiB
- \convertargument textext\to\asciiC % geen "text"
- \convertargument graphictext\to\asciiD % geen "text"
- \expandtwoargsafter\doifinstringelse{\asciiB}{\asciiA}
+ \expandafter\convertargument#1\to\MPasciiA
+ \doifstringinstringelse\MPasciiB\MPasciiA
{\global\MPTEXgraphictrue}
- {\expandtwoargsafter\doifinstringelse{\asciiC}{\asciiA}
+ {\doifstringinstringelse\MPasciiC\MPasciiA
{\global\MPTEXgraphictrue}
- {\expandtwoargsafter\doifinstringelse{\asciiD}{\asciiA}
+ {\doifstringinstringelse\MPasciiD\MPasciiA
{\global\MPTEXgraphictrue}
{\global\MPTEXgraphicfalse}}}%
\fi}
-\def\flushMPTEXgraphic%
+\def\flushMPTEXgraphic
{\ifMPTEXgraphic \ifx\everyMPTEXgraphic\emptytoks \else
\immediate\write\MPwrite{verbatimtex \the\everyMPTEXgraphic\space etex;}%
\fi \fi}
-\long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend%
+% \long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend%
+% {\ifx\next\empty\else\ifx\next\relax\else
+% \bgroup
+% \let\par=\space
+% \ifx#2\relax
+% \iflongMPlines
+% \immediate\write\MPwrite{#1;}%
+% \else
+% \edef\ascii{#1}%
+% \long\def\flush##1##2;%
+% {\ifx##1\relax \else
+% \immediate\write\MPwrite{##1##2;}%
+% \expandafter\flush
+% \fi}%
+% \expandafter\flush\ascii\empty;\relax;%
+% \fi
+% \egroup
+% \else
+% \convertargument#2#3\to\ascii
+% \immediate\write\MPwrite{#1tex \ascii etex}%
+% \egroup
+% \dowriteMPgraphicline#4tex \relax etex\MPend
+% \fi
+% \fi\fi}
+
+\long\def\flushMPgraphicline#1#2;%
+ {\ifx#1\relax \else
+ \immediate\write\MPwrite{#1#2;}%
+ \expandafter\flushMPgraphicline
+ \fi}
+
+\long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend
{\ifx\next\empty\else\ifx\next\relax\else
\bgroup
- \let\par=\space
+ \let\par\space
\ifx#2\relax
\iflongMPlines
\immediate\write\MPwrite{#1;}%
\else
\edef\ascii{#1}%
- \long\def\flush##1##2;%
- {\ifx##1\relax \else
- \immediate\write\MPwrite{##1##2;}%
- \expandafter\flush
- \fi}%
- \expandafter\flush\ascii\empty;\relax;%
+ \expandafter\flushMPgraphicline\ascii\empty;\relax;%
\fi
\egroup
\else
@@ -347,57 +390,67 @@
%D Because some graphics interact with \TEX\ (i.e.\ \CONTEXT), we
%D provide a hook for additional actions: \type {\everyMPgraphic}.
-\bgroup
-\catcode`\%=12\gdef\percentletter{%}
-\egroup
-
\newtoks\everyMPgraphic
-\def\writeMPgraph%
+\def\writeMPgraph
{\immediate\write\MPwrite{mpgraph:=\the\currentMPgraphic;}}
-\def\startwritingMPgraphic%
+\newconditional\firstMPgraphic \settrue\firstMPgraphic
+
+\appendtoks
+ \let \# \letterhash
+ \let \_ \letterunderscore
+ \let \& \letterampersand
+ \let \{ \letteropenbrace
+ \let \} \letterclosebrace
+\to \everyMPgraphic
+
+\def\startwritingMPgraphic
{\bgroup
- % will go to \appendtoks ... \to \everyMPgraphic
- \let\#\hashletter
- \let\_\underscoreletter
- \let\&\ampercentletter
- \def\{{\iftrue \string{\else}\fi}% ook nog ....letter
- \def\}{\iffalse{\else\string}\fi}% ook nog ....letter
- %
+ \global\advance\nofMPgraphics 1
\ifMPrun \else
\allocateMPslot\currentMPgraphic
\fi
\enableincludeMPgraphics
+ \xdef\MPgraphic{\the\currentMPgraphic}%
+ \the\everyMPgraphic
\ifrunMPgraphics
- \the\everyMPgraphic
- \xdef\MPgraphic{\the\currentMPgraphic}%
- \immediate\openout\MPwrite=\MPgraphicfile.mp
- \immediate\write\MPwrite{\percentletter\space runtime generated graphics of job "\jobname"}%
- \writeMPgraph
- \setMPrandomseed
+ \openMPgraphicfile{1}{runtime}%
\theMPinclusions % no reset here !
\else
- \xdef\MPgraphic{\the\currentMPgraphic}%
- \the\everyMPgraphic % here ?
- \ifnum\currentMPgraphic<2 % mprun (0) or mpgraph (1)
- \immediate\openout\MPwrite=\MPgraphicfile.mp
- \immediate\write\MPwrite{\percentletter\space collected graphics of job "\jobname"}%
- \writeMPgraph
- \setMPrandomseed
- \fi
+ \openMPgraphicfile{0}{collected}%
\theMPinclusions \let\theMPinclusions\relax % reset here !
\fi
\flushMPTEXgraphic
\ifMPrun \else
+ \immediate\write\MPwrite{let mprunend = end ;}%
\immediate\write\MPwrite{beginfig(\the\currentMPgraphic);}%
\fi
\global\let\flushMPgraphics\dodostopwritingMPgraphic
\global\let\stopwritingMPgraphic=\dostopwritingMPgraphic}
+\def\openMPgraphicfile#1#2% #1=alwaysopen #2=message
+ {%\doifundefinedelse{\@@MPG\@@MPG\MPgraphicfile}
+ % {\donetrue
+ % \@EA\newwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname}%
+ % {\ifcase#1\donefalse\else\donetrue\fi}%
+ \@EA\ifx\csname\@@MPG\@@MPG\MPgraphicfile\endcsname\relax
+ \donetrue \@EA\newwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname
+ \else
+ \ifcase#1\relax\donefalse\else\donetrue\fi
+ \fi
+ \@EA\let\@EA\MPwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname
+ \ifdone
+ \immediate\openout\MPwrite=\MPgraphicfile.mp
+ \immediate\write\MPwrite{\letterpercent\space #2 graphics of job "\jobname"}%
+ \writeMPgraph
+ \setMPrandomseed
+ \fi}
+
\def\dostopwritingMPgraphic%
{\ifMPrun \else
\immediate\write\MPwrite{endfig;}%
+ \immediate\write\MPwrite{let end = mprunend ;}%
\fi
\ifrunMPgraphics
\dodostopwritingMPgraphic
@@ -415,17 +468,17 @@
\ifdone
\immediate\write\MPwrite{end.}%
\immediate\closeout\MPwrite
- \runMPgraphic{\MPgraphicfile}%
+ \runMPgraphic\MPgraphicfile
\fi
- \global\let\flushMPgraphics=\relax}
+ \global\let\flushMPgraphics\relax}
-\let\stopwritingMPgraphic=\relax
-\let\flushMPgraphics =\relax
+\let\stopwritingMPgraphic\relax
+\let\flushMPgraphics \relax
%D By default each graphic gets its own slot (number). Later
%D on we will define a recycle bin.
-\def \allocateMPslot#1{\global\advance#1 by 1 }
+\def \allocateMPslot#1{\global\advance#1 1 }
\def\deallocateMPslot#1{}
%D \macros
@@ -495,17 +548,29 @@
{\setbox\MPgraphicbox=\hbox
{\ifinsertMPgraphics\insertMPfile{#1}{#2}\fi}}
+\def\MPllx{0}
+\def\MPlly{0}
+
% \def\placeMPgraphic%
-% {\box\MPgraphicbox}
+% {\ifMPshiftdrawing
+% \hbox{\hskip\MPllx bp\raise\MPlly bp\box\MPgraphicbox}%
+% \else
+% \box\MPgraphicbox
+% \fi}
+%
+% experimental:
-\def\placeMPgraphic%
+\def\placeMPgraphic
{\ifMPshiftdrawing
- \dimen0=\MPllx bp
- \dimen2=\MPlly bp
- \hbox{\hskip\dimen0\raise\dimen2\box\MPgraphicbox}%
- \else
- \box\MPgraphicbox
- \fi}
+ \edef\next
+ {\wd\MPgraphicbox\the\wd\MPgraphicbox
+ \ht\MPgraphicbox\the\ht\MPgraphicbox
+ \dp\MPgraphicbox\the\dp\MPgraphicbox}%
+ \setbox\MPgraphicbox\hbox
+ {\hskip\MPllx bp\raise\MPlly bp\box\MPgraphicbox}%
+ \next
+ \fi
+ \box\MPgraphicbox}
%D \macros
%D {startreusableMPgraphic, reuseMPgraphic, useMPbox}
@@ -516,96 +581,94 @@
\newif\ifuseMPbox \useMPboxtrue
+%D We assume that one can set objects:
+%D
+%D \starttypen
+%D \def\douseMPbox#1%
+%D {\setobject{MP}{#1}\vbox
+%D {\forgetall
+%D \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+%D \deallocateMPslot\currentMPgraphic
+%D \placeMPgraphic}%
+%D \setgvalue{#1}{\getobject{MP}{#1}}}
+%D \stoptypen
+%D
+%D More save is to use a number for {MP}{#1} which permits
+%D redefinition.
+
+\newcounter\MPobjectcounter
+
\def\douseMPbox#1%
- {\setobject{MP}{#1}
- \vbox
- {\forgetall
- \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
- \deallocateMPslot\currentMPgraphic
- \placeMPgraphic}%
- \setgvalue{#1}%
- {\getobject{MP}{#1}}}
-
-% More save is to use a number for {MP}{#1} which permits
-% redefinition. I have to test it first.
-%
-% \newcounter\MPobjectcounter
-%
-% \def\douseMPbox#1%
-% {\doglobal\increment\MPobjectcounter
-% \setobject{MP}{\MPobjectcounter}
-% \vbox
-% {\forgetall
-% \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
-% \deallocateMPslot\currentMPgraphic
-% \placeMPgraphic}%
-% \setxvalue{#1}%
-% {\noexpand\getobject{MP}{\MPobjectcounter}}}
+ {\doglobal\increment\MPobjectcounter
+ \setobject{MP}{\MPobjectcounter}\vbox
+ {\forgetall
+ \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+ \deallocateMPslot\currentMPgraphic
+ \placeMPgraphic}%
+ \setxvalue{#1}{\noexpand\getobject{MP}{\MPobjectcounter}}}
\def\nouseMPbox#1%
{\setxvalue{#1}%
{\noexpand\forgetall
\noexpand\loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
- \deallocateMPslot\currentMPgraphic
+ \noexpand\deallocateMPslot{\currentMPgraphic}%
\noexpand\placeMPgraphic}}
\ifCONTEXT \else \let\douseMPbox=\nouseMPbox \fi
\ifCONTEXT \else \let\doifobjectssupportedelse=\relax \fi
-% \long\def\startreusableMPgraphic#1#2\stopreusableMPgraphic%
-% {\ifundefined{MP:#1}%
-% \long\setgvalue{MP:#1}%
-% {\startMPgraphic#2\stopMPgraphic
-% \doifobjectssupportedelse{}{\useMPboxfalse}%
-% \ifuseMPbox
-% \douseMPbox{MP:#1}%
-% \else
-% \nouseMPbox{MP:#1}%
-% \fi
-% \getvalue{MP:#1}}%
-% \fi}
-
\long\def\handlereusableMPgraphic#1#2%
{\bgroup
\enableincludeMPgraphics
\startMPgraphic#2\stopMPgraphic
- \doifobjectssupportedelse{}{\useMPboxfalse}%
+ \doifobjectssupportedelse\donothing\useMPboxfalse
\ifuseMPbox
\expandafter \douseMPbox
\else
\expandafter \nouseMPbox
- \fi {MP:#1}%
- \getvalue{MP:#1}%
+ \fi {\@@MPG#1}%
+ \getvalue{\@@MPG#1}%
\egroup}
-\long\def\startreusableMPgraphic#1#2\stopreusableMPgraphic%
- {\ifundefined{MP:#1}%
- \long\setgvalue{MP:#1}{\handlereusableMPgraphic{#1}{#2}}%
- \fi}
+% \long\def\startreusableMPgraphic#1#2\stopreusableMPgraphic
+% {\ifundefined{\@@MPG#1}%
+% \long\setgvalue{\@@MPG#1}{\handlereusableMPgraphic{#1}{#2}}%
+% \fi}
+
+\long\def\dostartreusableMPgraphic#1#2\stopreusableMPgraphic
+ {\long\setgvalue{\@@MPG#1}{\handlereusableMPgraphic{#1}{#2}}}
\def\reuseMPgraphic#1%
- {\getvalue{MP:#1}}
+ {\getvalue{\@@MPG#1}}
%D \macros
%D {startuseMPgraphic,useMPgraphic}
%D
%D The every||time||it's||used original one is defined below.
%D This one makes sense when the graphic uses random numbers.
+%D
+%D We can run (process graphic) without including them at that
+%D particular place. Therefore we explicitly disable
+%D inclusions (resulting in an dummy figure) when we are in MP
+%D run mode (see mfun-004 for an example, we process an
+%D example buffer which produced graphics).
\long\def\handleuseMPgraphic#1#2%
{\bgroup
\enableincludeMPgraphics
\startMPgraphic#2\stopMPgraphic
- \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+ \ifMPrun \else
+ \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
+ \placeMPgraphic
+ \fi
\deallocateMPslot\currentMPgraphic
- \placeMPgraphic
\egroup}
-\long\def\startuseMPgraphic#1#2\stopuseMPgraphic%
- {\long\setgvalue{MP:#1}{\handleuseMPgraphic{#1}{#2}}}
+\long\def\startuseMPgraphic#1#2\stopuseMPgraphic
+ {\long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}}}
-\long\def\startusableMPgraphic#1#2\stopusableMPgraphic% dummy
- {\long\setgvalue{MP:#1}{\handleuseMPgraphic{#1}{#2}}} % unsafe {}{}
+\long\def\startusableMPgraphic#1#2\stopusableMPgraphicv% dummy
+ {\long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}}} % unsafe {}{}
\let\useMPgraphic=\reuseMPgraphic
@@ -615,7 +678,7 @@
%D For (mainly internal) pusposes we provide a test macro.
\def\doifMPgraphicelse#1%
- {\doifdefinedelse{MP:#1}}
+ {\doifdefinedelse{\@@MPG#1}}
%D \macros
%D {includeMPgraphic}
@@ -637,10 +700,9 @@
%D \stoptypen
\def\includeMPgraphic#1%
- %{\getvalue{MP:#1}}
- {\csname MP:#1\endcsname}
+ {\csname\@@MPG#1\endcsname}
-\def\enableincludeMPgraphics%
+\def\enableincludeMPgraphics
{\let\handleuseMPgraphic \secondoftwoarguments
\let\handlereusableMPgraphic\secondoftwoarguments}
@@ -659,7 +721,7 @@
%D
%D For faster running, one can generate a format, saying
%D
-%D \startypen
+%D \starttypen
%D mpost -ini context
%D \stoptypen
%D
@@ -708,15 +770,26 @@
--output=\MPOSTdriver\space
\ifuseMETAFUNformat --mpformat=metafun \fi --mptex --nomp --once #1}
- \def\executeMetaPost#1%
+% \def\executeMetaPost#1% @EA's
+% {\ifrunMPTEXgraphics
+% \ifMPTEXgraphic
+% \executeMPTEX{#1}%
+% \else
+% \executeMPOST{#1}%
+% \fi
+% \else
+% \executeMPOST{#1}%
+% \fi}
+
+ \def\executeMetaPost
{\ifrunMPTEXgraphics
\ifMPTEXgraphic
- \executeMPTEX{#1}%
+ \@EAEAEA\executeMPTEX
\else
- \executeMPOST{#1}%
+ \@EAEAEA\executeMPOST
\fi
\else
- \executeMPOST{#1}%
+ \@EA\executeMPOST
\fi}
\fi
@@ -812,10 +885,16 @@
%D \starttypen
%D \includeMPfontsfalse
%D \stoptypen
+%D
+%D {\em Currently this method fails for situations where the
+%D font definition is not on one line, which is he case when
+%D unkerned fonts are used along with long lines. One solution
+%D for this is to increase the value of \type {max_print_line}
+%D in \type {texmf.cnf}.}}
\newif\ifincludeMPfonts \includeMPfontstrue
-\def\includeMPfonts#1%
+\def\includeMPfonts#1%
{\ifincludeMPfonts
\bgroup
\message{[MP fonts #1]}%
@@ -823,11 +902,11 @@
\endlinechar=-1
\setMPspecials
\obeyMPspecials
- \setbox0=\hbox
+ \setbox\scratchbox=\hbox
{\hskip-\maxdimen
\doprocessfile\scratchread{#1}\handleMPfont}%
- \smashbox0%
- \box0
+ \smashbox\scratchbox
+ \box\scratchbox
\egroup
\fi}
@@ -887,10 +966,10 @@
%D Font definitions specified in the preamble are simply
%D ignored. Only lines starting with \type{(} are interpreted.
-\def\dohandleMPfont#1#2\relax%
+\def\dohandleMPfont#1#2\relax
{\if#1(\expandafter\includeMPcharacters\fileline\relax\fi}
-\def\handleMPfont%
+\def\handleMPfont
{\expandafter\dohandleMPfont\fileline\relax}
%D Before we start scanning for data, we first change some
@@ -966,7 +1045,7 @@
\def\PSnfont{nfont}
-\def\includeMPcharacters(#1) #2 #3 #4#5#6#7#8#9\relax%
+\def\includeMPcharacters(#1) #2 #3 #4#5#6#7#8#9\relax
{\edef\temp{#4#5#6#7#8}%
\ifx\temp\PSnfont % round font size (to pt)
\scratchdimen=#3pt
@@ -1047,7 +1126,7 @@
\def\convertMPcolorpath{}
\def\convertMPcolorfile{metacmyk.tmp}
-\def\convertMPcolors#1%
+\def\convertMPcolors#1% todo: open on local path, no copy
{\bgroup
\ifforcegrayMPcolors
\donetrue
@@ -1101,18 +1180,18 @@
\immediate\write\scratchwrite
{\@@cl@@s \space setgray #4}%
\else
- \dimen0=1pt \advance\dimen0 by -#1pt
- \dimen2=1pt \advance\dimen2 by -#2pt
- \dimen4=1pt \advance\dimen4 by -#3pt
+ \dimen0=1pt \advance\dimen0 -#1pt
+ \dimen2=1pt \advance\dimen2 -#2pt
+ \dimen4=1pt \advance\dimen4 -#3pt
\ifreduceMPcolors
\dimen6=\dimen0
\ifdim\dimen2<\dimen6 \dimen6=\dimen2 \fi
\ifdim\dimen4<\dimen6 \dimen6=\dimen4 \fi
- \advance\dimen0 by -\dimen6
- \advance\dimen2 by -\dimen6
- \advance\dimen4 by -\dimen6
+ \advance\dimen0 -\dimen6
+ \advance\dimen2 -\dimen6
+ \advance\dimen4 -\dimen6
\else
- \dimen6=\!!zeropoint
+ \dimen6=\zeropoint
\fi
\immediate\write\scratchwrite
{\withoutpt{\the\dimen0} \space
@@ -1271,29 +1350,29 @@
\newif\ifMPdrawingdone \MPdrawingdonefalse
\newif\ifMPshiftdrawing \MPshiftdrawingfalse
-\def\resetMPdrawing%
+\def\resetMPdrawing
{\global\let\MPdrawingdata\empty
\global\MPdrawingdonefalse}
-\def\pushMPdrawing%
+\def\pushMPdrawing
{\pushmacro\MPdrawingdata
\global\let\MPdrawingdata\empty}
-\def\popMPdrawing%
+\def\popMPdrawing
{\popmacro\MPdrawingdata}
-\def\getMPdrawing%
+\def\getMPdrawing
{\ifMPdrawingdone
\expandafter\startMPgraphic\MPdrawingdata\stopMPgraphic
\loadcurrentMPgraphic\empty
- \deallocateMPslot\currentMPgraphic % new
+ \deallocateMPslot\currentMPgraphic
\placeMPgraphic
\fi}
-\def\startMPdrawing%
+\def\startMPdrawing
{\dosingleempty\dostartMPdrawing}
-\long\def\dostartMPdrawing[#1]#2\stopMPdrawing%
+\long\def\dostartMPdrawing[#1]#2\stopMPdrawing
{\relax
\bgroup
\enableincludeMPgraphics
@@ -1402,6 +1481,45 @@
\newif\ifrecycleMPslots \recycleMPslotsfalse
+% \def\allocateMPslot#1%
+% {\ifrunMPgraphics
+% \ifcase\pdfoutput \recycleMPslotsfalse \fi
+% \else
+% \recycleMPslotsfalse
+% \fi
+% \ifrecycleMPslots
+% \doloop % slow but used seldom
+% {\doifundefined{\recurselevel MP}
+% {\global\letvalue{\recurselevel MP}=\empty
+% \global#1=\recurselevel\exitloop}}%
+% %\message{[MP slot + \number#1]%
+% \else
+% \global\advance#1 1
+% \fi}
+
+%D When a graphic takes space in the text flow, we can run
+%D into deadlock typesetting. In the first pass, the graphic
+%D is not available, but in the second pass it is. The
+%D placeholder that was put there in the first pass in now
+%D replace by the real graphic and as a result the document
+%D shrinks or grows and pages are removed or added. This in
+%D turn can trigger generation of other graphics, like those
+%D in the background. Graphics start swapping place and again
+%D page breaks change. You can imagine the mess we en dup
+%D with.
+%D
+%D This is why we provide was to use a dedicate range if
+%D numbers for fixed graphcis. Such graphics will not en dup
+%D in the text flow (at least their dimensions don't
+%D contribute to the main vertical list, and thereby they
+%D cannot interfere. We use a rather safe maximum of 4000
+%D graphics here and 8000 in \type {meta-ini}.
+
+\newcount \maxnofMPgraphics \maxnofMPgraphics = 4000 %8000
+\newcount \minnofMPgraphics \minnofMPgraphics = 1
+
+\newif \ifMPstaticgraphic \MPstaticgraphicfalse
+
\def\allocateMPslot#1%
{\ifrunMPgraphics
\ifcase\pdfoutput \recycleMPslotsfalse \fi
@@ -1409,13 +1527,21 @@
\recycleMPslotsfalse
\fi
\ifrecycleMPslots
- \doloop
+ \doloop % slow but used seldom
{\doifundefined{\recurselevel MP}
- {\global\letvalue{\recurselevel MP}=\empty
- \global#1=\recurselevel\exitloop}}%
- %\message{[MP slot + \number#1]%
+ {\global\letvalue{\recurselevel MP}\empty
+ \global#1=\recurselevel
+ \exitloop}}%
+ % \message{[MP slot + \number#1]%
+ \else\ifMPstaticgraphic
+ \global#1\maxnofMPgraphics
+ \global\advance\maxnofMPgraphics -1
\else
- \global\advance#1 by 1
+ \global#1\minnofMPgraphics
+ \global\advance\minnofMPgraphics 1
+ \fi\fi
+ \ifnum\minnofMPgraphics<\maxnofMPgraphics \else
+ \writestatus{\m!systems}{increase \string\maxnofMPgraphics}%
\fi}
\def\deallocateMPslot#1%
@@ -1460,6 +1586,4 @@
\long\def\startMPcode#1\stopMPcode%
{\startuseMPgraphic{@@}#1\stopuseMPgraphic\useMPgraphic{@@}}
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/supp-mrk.tex b/tex/context/base/supp-mrk.tex
index 40458a621..8be8dd18f 100644
--- a/tex/context/base/supp-mrk.tex
+++ b/tex/context/base/supp-mrk.tex
@@ -14,72 +14,9 @@
%D Remark: due to the lack of \type {\clearmark}, the \ETEX\
%D dedicated mechanism is not yet operational.
-%D This module has deverted so much from the original that i
-%D can probably rewrite it to a more efficient one now.
-
-% for testing etex, can be much faster than normal
-%
-% \unprotect
-%
-% \newif\ifexpandmarks \expandmarkstrue
-%
-% \let\normalmark = \mark
-% \let\normaltopmark = \topmark
-% \let\normalbotmark = \botmark
-% \let\normalfirstmark = \firstmark
-% \let\normalsplitbotmark = \splitbotmark
-% \let\normalsplitfirstmark = \splitfirstmark
-%
-% \let\normalmarks = \marks
-% \let\normaltopmarks = \topmarks
-% \let\normalbotmarks = \botmarks
-% \let\normalfirstmarks = \firstmarks
-% \let\normalsplitbotmarks = \splitbotmarks
-% \let\normalsplitfirstmarks = \splitfirstmarks
-%
-% \def\newmark #1{\setgvalue{mrk\strippedcsname#1}{0}\newmarks#1}
-%
-% \def\gettopmark {\getmark\topmarks}
-% \def\getbottommark {\getmark\botmarks}
-% \def\getfirstmark {\getmark\firstmarks}
-% \def\getsplitbottommark{\getmark\splitbotmarks}
-% \def\getsplitfirstmark {\getmark\splitfirstmarks}
-%
-% \def\getbotmark {\getmark\botmarks}
-% \def\getsplitbotmark {\getmark\splitbotmarks}
-% \def\getsplittopmark {\getmark\splitfirstmarks}
-%
-% \def\getmark#1#2%
-% {\ifcase\csname mrk\strippedcsname#2\endcsname\else
-% \expandafter#1\expandafter#2%
-% \fi}
-%
-% \long\def\setmark#1#2%
-% {\setgvalue{mrk\strippedcsname#1}{0}%
-% \ifexpandmarks
-% \expanded{\normalmarks#1{#2}}%
-% \else
-% \normalmarks#1{#2}%
-% \fi}
-%
-% \def\resetmark#1%
-% {\setgvalue{mrk\strippedcsname#1}{1}\marks#1{}}
-%
-% \def\noninterferingmarks%
-% {\let\savedsetmark\setmark
-% \let\noninterferingmarks\relax
-% \long\def\setmark##1##2%
-% {\ifhmode\prewordbreak\hbox\fi{\savedsetmark{##1}{##2}}}}
-%
-% \let\getmarks \gobbleoneargument
-% \let\getallmarks \relax
-% \let\getsplitmarks \gobbleoneargument
-% \let\getallsplitmarks\relax
-%
-% \let\newpersistentmark \newmark % checken
-% \newif\ifnofirstmarker % checken
-%
-% \protect \endinput
+%D This module has deverted so much from the original that I
+%D can probably rewrite it to a more efficient one now and
+%D I will do so.
%D There are 256 \COUNTERS, \DIMENSIONS, \SKIPS, \MUSKIPS\ and
%D \BOXES, 16~in- and output buffers, but there is only one
@@ -96,9 +33,58 @@
\writestatus{loading}{Context Support Macros / Marks}
+\let\normalmark = \mark
+\let\normaltopmark = \topmark
+\let\normalbotmark = \botmark
+\let\normalfirstmark = \firstmark
+\let\normalsplitbotmark = \splitbotmark
+\let\normalsplitfirstmark = \splitfirstmark
+
+\beginETEX \marks cum suis
+
+\let\normalmarks = \marks
+\let\normaltopmarks = \topmarks
+\let\normalbotmarks = \botmarks
+\let\normalfirstmarks = \firstmarks
+\let\normalsplitbotmarks = \splitbotmarks
+\let\normalsplitfirstmarks = \splitfirstmarks
+
+\endETEX
+
\unprotect
-%% \beginTEX
+%D We start with the presetting the interface macros.
+%D
+%D \starttabulatie[|||]
+%D \NC \type{\getmarks} \NC sets the marks to their values \NC \NR
+%D \NC \type{\getallmarks} \NC sets all marks to their values \NC \NR
+%D \NC \type{\getsplitmarks} \NC sets the splitmarks to their values\NC \NR
+%D \NC \type{\getallsplitmarks} \NC sets all splitmarks to their values\NC \NR
+%D \NC \type{\setmarks} \NC synchronizes topmarks (\ETEX) \NC \NR
+%D \stoptabulatie
+%D
+%D Later we will overload these, dependent of the brand of
+%D \TEX\ that we use.
+
+\let \getmarks \gobbleoneargument
+\let \getallmarks \relax
+\let \getsplitmarks \gobbleoneargument
+\let \getallsplitmarks \relax
+\let \setallmarks \relax
+
+\let \newmark \gobbleoneargument
+\let \newpersistentmark \gobbleoneargument
+\let \resetmark \gobbleoneargument
+\let \setmark \gobbletwoargument
+
+%D \macros
+%D {expandmarks}
+%D
+%D We can force expansion of marks with the following switch.
+
+\newif\ifexpandmarks \expandmarkstrue % hm, true indeed ?
+
+\beginTEX
%D This implementation is more or less compatible with the
%D other \type {\new} macros in \PLAIN\ \TEX. A mark is
@@ -178,19 +164,19 @@
%D our scratch counter.
%D
%D \starttypen
-%D % \newcount\topmarker
-%D % \newcount\botmarker
-%D % \newcount\foundmarker
+%D \newcount\topmarker
+%D \newcount\botmarker
+%D \newcount\foundmarker
%D \stoptypen
%D
%D We've also introduced some constants, one for the lists and
%D three for composing the mark commands.
-\def\@@marklist@@ {marklist}
-\def\@@marktop@@ {top}
-\def\@@markbot@@ {bot}
-\def\@@markfirst@@ {first}
-\def\@@markcurrent@@ {current}
+\def\@@marklist@@ {*m*} % {marklist}
+\def\@@marktop@@ {*t*} % {top}
+\def\@@markbot@@ {*b*} % {bot}
+\def\@@markfirst@@ {*f*} % {first}
+\def\@@markcurrent@@ {*c*} % {current}
%D The next one is new too. All defined marks are packed in a
%D comma seperated list. This could of course have been a token
@@ -198,25 +184,6 @@
\let\allmarks=\empty
-%D \macros
-%D {expandmarks}
-%D
-%D There are two booleans. The first one handles the first
-%D marks, the second concerns expansion. This second one is
-%D new.
-
-\newif\ifnofirstmarker
-\newif\ifexpandmarks \expandmarkstrue
-
-%D We use an indirect call to the mark mechanism.
-
-\let\normalmark = \mark
-\let\normaltopmark = \topmark
-\let\normalbotmark = \botmark
-\let\normalfirstmark = \firstmark
-\let\normalsplitbotmark = \splitbotmark
-\let\normalsplitfirstmark = \splitfirstmark
-
%D The next macro replaces the multiple step expansion and
%D command name constructors of Jim. This alternative leads to
%D a more readable source (we hope).
@@ -254,7 +221,13 @@
\def\newmark#1%
{\definenewmark#1{\doglobal\addtocommalist\markname\allmarks}}
-\let\setmark\empty
+%D Don't ask me, but sometimes we need more control over
+%D updating the marks, thereby we have:
+
+\def\newpersistentmark#1% for an example see core-grd.tex
+ {\definenewmark#1\relax}
+
+\let\setmark \empty
\let\resetmark\newmark
%D Some more natural interfacing macros:
@@ -266,16 +239,6 @@
\def\getsplitbottommark#1{\getvalue{\@@markbot@@ \strippedcsname#1}}
\def\getsplitfirstmark #1{\getvalue{\@@markfirst@@ \strippedcsname#1}}
-\let\getbotmark \getbottommark
-\let\getsplitbotmark\getsplitbottommark
-\let\getsplittopmark\getsplitfirstmark
-
-%D Don't ask me, but sometimes we need more control over
-%D updating the marks, thereby we have:
-
-\def\newpersistentmark#1% for an example see core-grd.tex
- {\definenewmark#1\relax}
-
%D \macros
%D {setmark}
%D
@@ -296,14 +259,14 @@
\setgvalue{\@@markcurrent@@\markname}{#2}%
\global\advance\currentmarker by 1
\normalmark{\the\currentmarker}%
- \@EA\!!toksa\@EA=\@EA\@EA\@EA{\csname\marklist\endcsname}%
+ \!!toksa\@EA\@EA\@EA{\csname\marklist\endcsname}%
\ifexpandmarks
\setxvalue{\marklist}%
{\the\!!toksa
\noexpand\domark
\the\currentmarker{#2}}%
\else
- \!!toksb=\@EA{#2}% one level, why ? handy for cs
+ \!!toksb\@EA{#2}% one level, why ? handy for cs
\setxvalue{\marklist}%
{\the\!!toksa
\noexpand\domark
@@ -334,47 +297,55 @@
\let\normalelse \else % replaces \@else
\let\normalor \or % replaces \@or
+% Hm, resetting \!!toksa got lost and took me a half a day to
+% trace down ([] showed up in the pagebody); I really have
+% to clean up this messy module (write it from scratch).
+
+\newif\ifnofirstmarker % an auxiliary switch
+
\def\getmarks#1%
{\bgroup
\makemarknames{#1}%
\edef\topmarker{0\normaltopmark}%
\edef\botmarker{0\normalbotmark}%
- \!!toksb={}%
- \nofirstmarkertrue
-% does more worse than good
- \let\fi=\relax
- \let\or=\relax
- \let\else=\relax
-%
- \let\domark=\doscanmarks
+ \!!toksa\emptytoks
+ \!!toksb\emptytoks
+ \nofirstmarkertrue
+ % does more worse than good
+ \let\fi\relax
+ \let\or\relax
+ \let\else\relax
+ %
+ \let\domark\doscanmarks
\getvalue{\marklist}\lastmark
%\message{markstatus : [\the\!!toksa\the\!!toksb\the\!!toksc]}%
\long\setxvalue{\marklist}{\the\!!toksa\the\!!toksb\the\!!toksc}%
\egroup}
-\def\getallmarks%
- {\processcommacommand[\allmarks]\getmarks}
-
\def\getsplitmarks#1%
{\bgroup
\makemarknames{#1}%
-% \@EA\let\@EA\savedmarklist\@EA=\csname\marklist\endcsname
+ % \@EA\let\@EA\savedmarklist\@EA\csname\marklist\endcsname
\edef\topmarker{0\normalsplitfirstmark}%
\edef\botmarker{0\normalsplitbotmark}%
- \!!toksb={}%
+ \!!toksa\emptytoks
+ \!!toksb\emptytoks
\nofirstmarkertrue
-% does more worse than good
- \let\fi=\relax
- \let\or=\relax
- \let\else=\relax
-%
- \let\domark=\doscanmarks
+ % does more worse than good
+ \let\fi\relax
+ \let\or\relax
+ \let\else\relax
+ %
+ \let\domark\doscanmarks
\getvalue{\marklist}\lastmark
-% \@EA\global\@EA\let\csname\marklist\endcsname=\savedmarklist
+ % \global\@EA\let\csname\marklist\endcsname\savedmarklist
\egroup}
-\def\getallsplitmarks%
- {\processcommacommand[\allmarks]\getsplitmarks}
+\def\getallmarks {\processcommacommand[\allmarks]\getmarks}
+\def\getallsplitmarks{\processcommacommand[\allmarks]\getsplitmarks}
+
+\def\getallmarks {\@EA\processcommalist\@EA[\allmarks]\getmarks}
+\def\getallsplitmarks{\@EA\processcommalist\@EA[\allmarks]\getsplitmarks}
\long\def\dodoscanmarks#1%
{\ifnum\scratchcounter>\topmarker\relax
@@ -382,8 +353,8 @@
\long\setgvalue{\@@marktop@@\markname}{#1}%
\normalfi
\ifnum\scratchcounter>\botmarker\relax
- \let\domark=\dorecovermarks
- \!!toksb=\@EA{\@EA\domark\the\scratchcounter{#1}}%
+ \let\domark\dorecovermarks
+ \!!toksb\@EA{\@EA\domark\the\scratchcounter{#1}}%
\normalelse
\ifnofirstmarker
\long\setgvalue{\@@markfirst@@\markname}{#1}%
@@ -392,204 +363,245 @@
\normalfi
\normalfi
\long\setgvalue{\@@markbot@@\markname}{#1}%
- \!!toksa=\@EA{\@EA\domark\the\scratchcounter{#1}}%
+ \!!toksa\@EA{\@EA\domark\the\scratchcounter{#1}}%
\normalfi}
\def\doscanmarks%
{\afterassignment\dodoscanmarks\scratchcounter=}
-\long\def\dorecovermarks#1\lastmark%
- {\!!toksc={\domark#1}}
+\long\def\dorecovermarks#1\lastmark% nice trick
+ {\!!toksc{\domark#1}}
-\def\lastmark%
- {\!!toksc={}}
+\def\lastmark% rest of trick
+ {\!!toksc\emptytoks}
-%D \macros
-%D {noninterferingmarks}
-%D
-%D Marks can interfere badly with for instance postprocessing
-%D paragraphs, for instance when we want to grab the last box
-%D using \type {\lastbox}, when at the same time using colors.
+\endTEX
+
+% %D Here starts the \ETEX\ alternative.
+%
+% \beginETEX \marks cum suis
+%
+% \newtoks \listofmarks
+%
+% \def\@@mrk{mrk:}
+% \def\@@trk{trk:}
+% \def\@@crk{crk:}
+%
+% \def\getcurrentmark {\getsomemark\thecurrentmarks}
+% \def\gettopmark {\getsomemark\checkedtopmarks}
+% \def\getbottommark {\getsomemark\normalbotmarks}
+% \def\getfirstmark {\getsomemark\normalfirstmarks}
+% \def\getsplitbottommark{\getsomemark\normalsplitbotmarks}
+% \def\getsplitfirstmark {\getsomemark\normalsplitfirstmarks}
+%
+% \def\getbotmark {\getsomemark\normalbotmarks}
+% \def\getsplitbotmark {\getsomemark\normalsplitbotmarks}
+% \def\getsplittopmark {\getsomemark\normalsplitfirstmarks}
+%
+% %D \starttypen
+% %D \def\getsomemark#1#2%
+% %D {\ifnum\getvalue{\@@mrk\string#2}=0\else % still reset
+% %D \expandafter\gobbletwoarguments
+% %D \fi#1#2}
+% %D \stoptypen
+% %D
+% %D We need a fully expandable (in \type {\edef}) version of
+% %D this one ...
+%
+% \letvalue{@@0}\empty
+% \letvalue{@@1}\gobbletwoarguments
+%
+% \def\getsomemark#1#2% (0,min(1,savedpage))
+% {\csname
+% @@\ifcase\csname\@@mrk\string#2\endcsname\space0\else1\fi
+% \endcsname#1#2}
+%
+% %D ... and so we have another ugly but useful hack.
+% %D
+% %D We will use two state variables per mark, one to signal
+% %D that a new mark value is set, and one to trigger (on the
+% %D next page) the setting of the top mark.
+%
+% \def\checkedtopmarks#1{\csname\@@trk\string#1\endcsname}
+% \def\thecurrentmarks#1{\csname\@@crk\string#1\endcsname}
+%
+% \long\def\setmark#1%
+% {\global\@EA\let\csname\@@mrk\string#1\endcsname\zerocountervalue
+% \ifexpandmarks
+% \expandafter\setexpandedmark
+% \else
+% \expandafter\setnormalmark
+% \fi#1}
+%
+% \def\setexpandedmark#1#2% % marks expand anyway
+% {\@EA\xdef\csname\@@crk\string#1\endcsname{#2}%
+% \normalmarks#1{#2}}
+%
+% \def\setnormalmark#1#2% using a tok prevents unwanted expansion in mark
+% {\scratchtoks{#2}%
+% \@EA\xdef\csname\@@crk\string#1\endcsname{\the\scratchtoks}%
+% \normalmarks#1{\the\scratchtoks}} % one level expansion
+%
+% \def\checktopmark#1% is called often, so its minimized
+% {\ifcase\csname\@@mrk\string#1\endcsname\else
+% \@EA\dochecktopmark\@EA#1%
+% \fi}
+%
+% \def\dochecktopmark#1%
+% {\ifnum\realpageno>\csname\@@mrk\string#1\endcsname\relax
+% \@EA\xdef\csname\@@trk\string#1\endcsname{\normalbotmarks#1}%
+% \fi}
+%
+% \def\resetmark#1% we cannot use \normalmarks#1{}}
+% {\@EA\xdef\csname\@@mrk\string#1\endcsname{\realfolio}%
+% \global\@EA\let\csname\@@trk\string#1\endcsname\empty}
+%
+% \def\definenewmark#1%
+% {\ifcsname\@@mrk\string#1\endcsname\else % this is etex -)
+% \newmarks#1%
+% \appendtoks\checktopmark#1\to\listofmarks
+% \fi
+% \global\@EA\let\csname\@@crk\string#1\endcsname\empty
+% \global\@EA\let\csname\@@mrk\string#1\endcsname\zerocountervalue
+% \@EA\gdef\csname\@@trk\string#1\endcsname{\normaltopmarks#1}}%
+%
+% \let \newmark \definenewmark
+% \let \newpersistentmark \definenewmark
+% \let \normalsetmark \setmark
+%
+% \def\setallmarks{\the\listofmarks}
+%
+% %D In \type {page-ini} or \type {core-mar} we should say:
+% %D
+% %D \starttypen
+% %D \appendtoks \getallmarks \to \everybeforepagebody
+% %D \appendtoks \setallmarks \to \everyafterpagebody
+% %D \stoptypen
+%
+% \endETEX
-\def\noninterferingmarks%
- {\let\savednormalmark\normalmark
- \let\noninterferingmarks\relax
- \def\normalmark##1%
- {\ifhmode\prewordbreak\hbox\fi{\savednormalmark{##1}}}}
+\beginETEX \marks cum suis
-%D This macro is for instance used in the inline headings
-%D postprocessing, as needed when we want to make those
-%D clickable.
+\newtoks \listofmarks
-%% \endTEX
+\def\@@mrk{mrk:} \def\@@trk{trk:} \def\@@crk{crk:}
-\protect \endinput
+%D We will use two state variables per mark, one to signal
+%D that a new mark value is set, and one to trigger (on the
+%D next page) the setting of the top mark.
-%D Right from the beginning, \CONTEXT\ supported more than one
-%D mark, using an extended version of Jim Fox multiple mark
-%D mechanism. In \ETEX\ we can however directly access more
-%D marks than we will ever need.
+\def\checkedtopmarks#1{\csname\@@trk\string#1\endcsname}
+\def\thecurrentmarks#1{\csname\@@crk\string#1\endcsname}
-\beginETEX \marks \topmarks \botmarks \firstmarks
+\long\def\setmark#1%
+ {\global\@EA\mathchardef\csname\@@mrk\string#1\endcsname\zerocount
+ \ifexpandmarks\@EA\setexpandedmark\else\@EA\setnormalmark\fi#1}
-\let\normalmark = \mark
-\let\normaltopmark = \topmark
-\let\normalbotmark = \botmark
-\let\normalfirstmark = \firstmark
-\let\normalsplitbotmark = \splitbotmark
-\let\normalsplitfirstmark = \splitfirstmark
+\def\setexpandedmark#1#2% % marks expand anyway
+ {\@EA\xdef\csname\@@crk\string#1\endcsname{#2}%
+ \normalmarks#1{#2}}
-\let\normalmarks\marks
+\def\setnormalmark#1#2% using a tok prevents unwanted expansion in mark
+ {\scratchtoks{#2}%
+ \@EA\xdef\csname\@@crk\string#1\endcsname{\the\scratchtoks}%
+ \normalmarks#1{\the\scratchtoks}} % one level expansion
-%D The 100\% compatible solution is:
-%D
-%D \starttypen
-%D \def\@@marktop@@ {top}
-%D \def\@@markbot@@ {bot}
-%D \def\@@markfirst@@ {first}
-%D \def\@@marksplitbot@@ {splitbot}
-%D \def\@@marksplitfirst@@ {splitfirst}
-%D
-%D \def\newmark#1% temporary 5 \cs's, will be rewritten ; global needed
-%D {\newmarks#1%
-%D \setxvalue{\@@marktop@@ \strippedcsname#1}{\noexpand\topmarks \the#1 }%
-%D \setxvalue{\@@markbot@@ \strippedcsname#1}{\noexpand\botmarks \the#1 }%
-%D \setxvalue{\@@markfirst@@ \strippedcsname#1}{\noexpand\firstmarks\the#1 }%
-%D \setxvalue{\@@marksplitbot@@ \strippedcsname#1}{\noexpand\splitbotmarks \the#1 }%
-%D \setxvalue{\@@marksplitfirst@@\strippedcsname#1}{\noexpand\splitfirstmarks\the#1 }%
-%D \xdef#1{\noexpand\donormalmarks{\the#1}}}
-%D
-%D \def\gettopmark #1{\getvalue{\@@marktop@@ \strippedcsname#1}}
-%D \def\getbottommark #1{\getvalue{\@@markbot@@ \strippedcsname#1}}
-%D \def\getfirstmark #1{\getvalue{\@@markfirst@@ \strippedcsname#1}}
-%D \def\getsplitbottommark#1{\getvalue{\@@marksplitbot@@ \strippedcsname#1}}
-%D \def\getsplitfirstmark #1{\getvalue{\@@marksplitfirst@@\strippedcsname#1}}
-%D
-%D \def\getsplitmarks#1%
-%D {\setvalue{\@@markbot@@\strippedcsname#1}%
-%D {\getvalue{\@@marksplitbot@@\strippedcsname#1}}%
-%D \setvalue{\@@marktop@@\strippedcsname#1}%
-%D {\getvalue{\@@marksplitfirst@@\strippedcsname#1}}%
-%D \setvalue{\@@markfirst@@\strippedcsname#1}%
-%D {\getvalue{\@@marksplitfirst@@\strippedcsname#1}}}
-%D
-%D \def\noninterferingmarks%
-%D {\let\saveddonormalmarks\donormalmarks
-%D \let\noninterferingmarks\relax
-%D \long\def\donormalmarks##1##2%
-%D {\ifhmode\prewordbreak\hbox\fi{\saveddonormalmarks{##1}{##2}}}}
-%D
-%D \long\def\donormalmarks#1#2%
-%D {\bgroup
-%D \scratchcounter=#1\relax
-%D \ifexpandmarks
-%D \expanded{\normalmarks\scratchcounter{#2}}%
-%D \else
-%D \normalmarks\scratchcounter{#2}%
-%D \fi
-%D \egroup}
-%D
-%D \let\setmark\empty
-%D \def\resetmark#1{#1{}}
-%D \stoptypen
-%D
-%D However, I prefer the less \type{\cs} hungry ones. Beware,
-%D these ones (and the next) do no longer support direct marks.
-%D
-%D \starttypen
-%D \newif\ifexpandmarks \expandmarkstrue
-%D
-%D \let\newmark \newmarks
-%D \let\gettopmark \topmarks
-%D \let\getbottommark \botmarks
-%D \let\getfirstmark \firstmarks
-%D \let\getsplitbottommark\splitbotmarks
-%D \let\getsplitfirstmark \splitfirstmarks
-%D
-%D \let\getbotmark \botmarks
-%D \let\getsplitbotmark \splitbotmarks
-%D \let\getsplittopmark \splitfirstmarks
-%D
-%D \long\def\setmark#1#2%
-%D {\ifexpandmarks
-%D \expanded{\normalmarks#1{#2}}%
-%D \else
-%D \normalmarks#1{#2}%
-%D \fi}
-%D \stoptypen
+\def\checktopmark#1% is called often, so its minimized
+ {\ifcase\csname\@@mrk\string#1\endcsname\else
+ \@EA\dochecktopmark\@EA#1%
+ \fi}
-%D Resetting marks in not compatible with the old method.
-%D Here a node is inserted, which can interfere badly. In
-%D fact, a real \type {\clearmarks\name} is needed.
-%D
-%D \starttypen
-%D \def\resetmark#1%
-%D {\marks#1{}}
-%D \stoptypen
+\def\dochecktopmark#1%
+ {\ifnum\realpageno>\csname\@@mrk\string#1\endcsname\relax
+ \global\@EA\let\csname\@@trk\string#1\endcsname\normalbotmarks
+ \fi}
-%D A possible macro solution is presented here. When discussing
-%D \type {\clearmarks} on the \ETEX\ discussion list, Chris
-%D Rowley suggested to use a reset flag. Although suitable, a
-%D more natural low level solution would be better. So, for the
-%D moment, we could end up with a solution similar to the macro
-%D based multiple marks as implemented before. Alas, this
-%D alternative is useless too, because it does not synchronize
-%D well with previous values.
+\def\resetmark#1% we cannot use \normalmarks#1{}}
+ {\@EA\mathchardef\csname\@@mrk\string#1\endcsname\realfolio
+ \global\@EA\let\csname\@@trk\string#1\endcsname\gobbleoneargument}
-\def\@m@{@m@}
+\def\definenewmark#1%
+ {\ifcsname\@@mrk\string#1\endcsname\else % this is etex -)
+ \newmarks#1\appendtoks\checktopmark#1\to\listofmarks
+ \fi
+ \global\@EA\let\csname\@@crk\string#1\endcsname\empty
+ \global\@EA\mathchardef\csname\@@mrk\string#1\endcsname\zerocount
+ \global\@EA\let\csname\@@trk\string#1\endcsname\normaltopmarks}
-\def\newmark#1%
- {\newmarks#1%
- \global\letvalue{\@@markcurrent@@\string#1}\empty
- \expandafter\gdef\csname\@m@\number#1\endcsname{0}}
+\let \newmark \definenewmark
+\let \newpersistentmark \definenewmark
+\let \normalsetmark \setmark
-\long\def\setmark#1#2%
- {\setgvalue{\@m@\number#1}{1}%
- \setgvalue{\@@markcurrent@@\string#1}{#2}%
- \ifexpandmarks
- \expanded{\normalmarks#1{#2}}%
- \else
- \normalmarks#1{#2}%
- \fi}
+\def\setallmarks{\the\listofmarks}
+
+%D In \type {page-ini} or \type {core-mar} we should say:
+%D
+%D \starttypen
+%D \appendtoks \getallmarks \to \everybeforepagebody
+%D \appendtoks \setallmarks \to \everyafterpagebody
+%D \stoptypen
-\def\getcurrentmark #1{\getvalue{\@@markcurrent@@\strippedcsname#1}}
+\let\getcurrentmark \thecurrentmarks
+\let\gettopmark \checkedtopmarks
+\let\getbottommark \normalbotmarks
+\let\getfirstmark \normalfirstmarks
+\let\getsplitbottommark \normalsplitbotmarks
+\let\getsplitfirstmark \normalsplitfirstmarks
-\def\gettopmark {\getsomemark\topmarks}
-\def\getbottommark {\getsomemark\botmarks}
-\def\getfirstmark {\getsomemark\firstmarks}
-\def\getsplitbottommark{\getsomemark\splitbotmarks}
-\def\getsplitfirstmark {\getsomemark\splitfirstmarks}
+\let\getbotmark \normalbotmarks
+\let\getsplitbotmark \normalsplitbotmarks
+\let\getsplittopmark \normalsplitfirstmarks
-\def\getsomemark#1#2%
- {\ifnum\csname\@m@\number#2\endcsname=1 #1#2\fi}
+\endETEX
-\def\clearmarks#1%
- {\expandafter\gdef\csname\@m@\number#1\endcsname{0}}
+%D A couple of goodies:
-\def\resetmark%
- {\clearmarks}
+\let\getbotmark \getbottommark
+\let\getsplitbotmark\getsplitbottommark
+\let\getsplittopmark\getsplitfirstmark
-\let\getbotmark \getbottommark
-\let\getsplitbotmark \getsplitbottommark
-\let\getsplittopmark \getsplitfirstmark
+%D \macros
+%D {noninterferingmarks}
+%D
+%D Marks can interfere badly with for instance postprocessing
+%D paragraphs, for instance when we want to grab the last box
+%D using \type {\lastbox}, when at the same time using colors.
-%D Hm.
+\let\normalsetmark\setmark
-\def\noninterferingmarks%
- {\let\savedsetmark\setmark
- \let\noninterferingmarks\relax
- \long\def\setmark##1##2%
- {\ifhmode\prewordbreak\hbox\fi{\savedsetmark{##1}{##2}}}}
+\def\noninterferingsetmark#1#2%
+ {\ifhmode\prewordbreak\hbox\fi{\normalsetmark{#1}{#2}}}
-\let\getmarks \gobbleoneargument
-\let\getallmarks \relax
-\let\getsplitmarks \gobbleoneargument
-\let\getallsplitmarks\relax
+\def\noninterferingmarks
+ {\let\noninterferingmarks\relax
+ \let\setmark\noninterferingsetmark}
-\let\newpersistentmark \newmark % checken
-\newif\ifnofirstmarker % checken
+%D This macro is for instance used in the inline headings
+%D postprocessing, as needed when we want to make those
+%D clickable.
-\endETEX
+%D Right from the beginning, \CONTEXT\ supported more than one
+%D mark, using an extended version of Jim Fox multiple mark
+%D mechanism. In \ETEX\ we can however directly access more
+%D marks than we will ever need.
+
+%D Resetting marks in not compatible with the old method.
+%D Here a node is inserted, which can interfere badly. In
+%D fact, a real \type {\clearmarks\name} is needed.
+%D
+%D \starttypen
+%D \def\resetmark#1{\marks#1{}}
+%D \stoptypen
+%D
+%D A possible macro solution is presented here. When discussing
+%D \type {\clearmarks} on the \ETEX\ discussion list, Chris
+%D Rowley suggested to use a reset flag. Unfortunately this
+%D is not enough since we need to keep track of both set and
+%D reset state then. This means that we must postpone resetting
+%D to the page following the set, and as a result we need
+%D another auxiliary macro. The current solution is the best
+%D I could come up with so far, especially given that we
+%D need a fast mechanism.
%D For those who want to know the story behind resetting
%D marks, here are some examples of interference
@@ -626,20 +638,11 @@
%D
%D \typebuffer\blanko\haalbuffer\blanko
-%D Because we used an indirect call to the mark mechanism
-%D we can redefine the original \type{\mark} command.
-
-\beginTEX
-
-\newmark\mark
-
-\endTEX
-
%D One final advice. Use marks with care. When used in globally
%D assigned boxes, the list can grow quite big, and processing
%D can slow down considerably. This drawback is removed in
%D \ETEX\ mode.
-\protect
+\readfile{supp-nmk}{}{}
-\endinput
+\protect \endinput
diff --git a/tex/context/base/supp-num.tex b/tex/context/base/supp-num.tex
index 8b30500eb..a39733ceb 100644
--- a/tex/context/base/supp-num.tex
+++ b/tex/context/base/supp-num.tex
@@ -165,7 +165,10 @@
% {\def\saveddigits{#1}}%
\fi\fi\fi\fi
\grabdigit}
-
+
+\let\handlemathdigits\firstofoneargument
+\let\handletextdigits\mathematics
+
\def\handledigits%
{%\ifcase\powerdigits
% \edef\collecteddigits{\collecteddigits\saveddigits}%
@@ -173,9 +176,9 @@
% \edef\savedpowerdigits{\savedpowerdigits\saveddigits}%
%\fi
\ifmmode
- \dohandledigits
+ \handlemathdigits{\dohandledigits}%
\else
- \dontleavehmode\hbox{$\dohandledigits$}%
+ \dontleavehmode\hbox{\handletextdigits{\dohandledigits}}%
\fi
\egroup}
@@ -321,9 +324,9 @@
%D \digits 123.222,00^10
%D \stoptypen
%D
-%D The seperator is defined as:
+%D The separator is defined as:
-\def\digitpowerseperator%
+\def\digitpowerseparator%
{\cdot10} % {\times10}
%D \macros
diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex
index 387c208da..a8db878b6 100644
--- a/tex/context/base/supp-pdf.tex
+++ b/tex/context/base/supp-pdf.tex
@@ -11,6 +11,17 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% This method is not that accurate with small files that use
+% penshapes. I tried several methods but so far I could not
+% come up with a better alternative. \TEX's real calculation
+% options are simply to simple. Using \ETEX's expression
+% mechanism does not lead to better results.
+
+% beware, we cannot use \zeropoint here since it may be
+% defined in the range \dimen 0 - 20 which we happen to use
+% as scratch registers ; inside context we may consider
+% using dedicated registers
+
%D These macros are written as generic as possible. Some
%D general support macro's are loaded from a small module
%D especially made for non \CONTEXT\ use. In this module I
@@ -344,6 +355,12 @@
%D uses. We don't define irrelevant ones, because these are
%D skipped anyway.
+%D The converter can be made a bit faster by replacing the
+%D two test macros (the ones with the many \type {\if's}) by
+%D a call to named branch macros (something \typ {\getvalue
+%D {xPSmoveto}}. For everyday documents with relatively
+%D small graphics the gain in speed can be neglected.
+
\def \PScurveto {curveto}
\def \PSlineto {lineto}
\def \PSmoveto {moveto}
@@ -442,10 +459,21 @@
\def\@@MP{@@MP}
-\def\setMPargument#1%
- {\advance\nofMParguments by 1
+\def\setMPargument% #1%
+ {\advance\nofMParguments 1
\expandafter\def
- \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname{\do#1}}
+ \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname} % {#1}
+
+\def\letMPargument
+ {\advance\nofMParguments 1
+ \expandafter\let
+ \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname}
+
+\def\setMPsequence#1 %
+ {\advance\nofMParguments 1
+ \expandafter\def
+ \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname{#1}%
+ \handleMPsequence}
\def\gMPa#1%
{\csname\@@MP0\number#1\endcsname}
@@ -453,10 +481,13 @@
\def\gMPs#1%
{\csname\@@MP\the\nofMPsegments\number#1\endcsname}
-\def\setMPkeyword#1
+\def\dogMPa#1%
+ {\@EAEAEA\do\csname\@@MP0\number#1\endcsname}
+
+\def\setMPkeyword#1 %
{\expandafter\def\csname\@@MP\the\nofMPsegments0\endcsname{#1}%
- \advance\nofMPsegments by 1
- \nofMParguments=0\relax}
+ \advance\nofMPsegments1
+ \nofMParguments0 }
\def\getMPkeyword#1%
{\csname\@@MP#10\endcsname}
@@ -469,11 +500,11 @@
%D when dealing with comments.
\def\doresetMPstack%
- {\nofMParguments=0 }
+ {\nofMParguments0 }
\def\resetMPstack%
{\catcode`\%=\@@active
- \let\handleMPgraphic=\handleMPendgraphic
+ \let\handleMPgraphic\handleMPendgraphic
\let\resetMPstack\doresetMPstack
\resetMPstack}
@@ -574,105 +605,120 @@
%D speed up the conversion by handling the \type{path}
%D seperately.
-\def\dohandleMPsequence#1#2 %
+\def\@EAEAEA{\expandafter\expandafter\expandafter} % to be sure
+
+\def\dohandleMPsequence#1%
{\ifdone
- \ifnum\lccode`#1=0
- \setMPargument{#1#2}%
+ \ifcase\lccode`#1\relax
+ \@EAEAEA\dohandleMPsequenceA
\else
- \edef\somestring{#1#2}%
- \ifx\somestring\PSmoveto
- \edef\lastMPmoveX{\gMPa1}%
- \edef\lastMPmoveY{\gMPa2}%
- \PDFcode{\!MP{\gMPa1} \!MP{\gMPa2} m}%
- \resetMPstack
- \else\ifx\somestring\PSnewpath
- \let\handleMPsequence=\handleMPpath
- \else\ifx\somestring\PSgsave
- \PDFcode{q}%
- \resetMPstack
- \else\ifx\somestring\PSgrestore
- \PDFcode{Q}%
- \resetMPstack
- \else\ifx\somestring\PSdtransform % == setlinewidth
- \let\handleMPsequence=\handleMPdtransform
- \else\ifx\somestring\PSconcat
- \PDFcode{\gMPa1 \gMPa2 \gMPa3 \gMPa4 \gMPa5 \gMPa6 cm}%
- \resetMPstack
- \else\ifx\somestring\PSsetrgbcolor
- \handleMPrgbcolor
- \resetMPstack
- \else\ifx\somestring\PSsetcmykcolor
- \handleMPcmykcolor
- \resetMPstack
- \else\ifx\somestring\PSsetgray
- \handleMPgraycolor
- \resetMPstack
- \else\ifx\somestring\PStranslate
- \PDFcode{1 0 0 1 \gMPa1 \gMPa2 cm}%
- \resetMPstack
- \else\ifx\somestring\PSsetdash
- \handleMPsetdash
- \resetMPstack
- \else\ifx\somestring\PSsetlinejoin
- \PDFcode{\gMPa1 j}%
- \resetMPstack
- \else\ifx\somestring\PSsetmiterlimit
- \PDFcode{\gMPa1 M}%
- \resetMPstack
- \else\ifx\somestring\PSfshow
- \PDFcode{n}%
- \handleMPfshow
- \resetMPstack
- \else\ifx\somestring\PSsetlinecap
- \PDFcode{\gMPa1 J}%
- \resetMPstack
- \else\ifx\somestring\PSrlineto
- \PDFcode{\!MP{\lastMPmoveX} \!MP{\lastMPmoveY} l S}%
- \resetMPstack
- \else\ifx\somestring\PSscale
- \PDFcode{\gMPa1 0 0 \gMPa2 0 0 cm}%
- \resetMPstack
- \else\ifx\somestring\PSspecial
- \handleMPspecialcommand
- \resetMPstack
- \else
- \handleMPgraphic{#1#2}%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \@EAEAEA\dohandleMPsequenceB
\fi
\else
- \edef\somestring{#1#2}%
- \handleMPgraphic{#1#2}%
- \fi
+ \@EA\dohandleMPsequenceC
+ \fi#1}
+
+%\def\dohandleMPsequenceA#1 %
+% {\setMPargument{#1}%
+% \handleMPsequence}
+
+\let\dohandleMPsequenceA\setMPsequence
+
+\def\dohandleMPsequenceB#1 %
+ {\edef\somestring{#1}%
+ \ifx\somestring\PSmoveto
+ \edef\lastMPmoveX{\gMPa1}%
+ \edef\lastMPmoveY{\gMPa2}%
+ \PDFcode{\!MPgMPa1 \!MPgMPa2 m}%
+ \resetMPstack
+ \else\ifx\somestring\PSnewpath
+ \let\handleMPsequence\handleMPpath
+ \else\ifx\somestring\PSgsave
+ \PDFcode{q}%
+ \resetMPstack
+ \else\ifx\somestring\PSgrestore
+ \PDFcode{Q}%
+ \resetMPstack
+ \else\ifx\somestring\PSdtransform % == setlinewidth
+ \let\handleMPsequence\handleMPdtransform
+ \else\ifx\somestring\PSconcat
+ \PDFcode{\gMPa1 \gMPa2 \gMPa3 \gMPa4 \gMPa5 \gMPa6 cm}%
+ \resetMPstack
+ \else\ifx\somestring\PSsetrgbcolor
+ \handleMPrgbcolor
+ \resetMPstack
+ \else\ifx\somestring\PSsetcmykcolor
+ \handleMPcmykcolor
+ \resetMPstack
+ \else\ifx\somestring\PSsetgray
+ \handleMPgraycolor
+ \resetMPstack
+ \else\ifx\somestring\PStranslate
+ \PDFcode{1 0 0 1 \gMPa1 \gMPa2 cm}%
+ \resetMPstack
+ \else\ifx\somestring\PSsetdash
+ \handleMPsetdash
+ \resetMPstack
+ \else\ifx\somestring\PSsetlinejoin
+ \PDFcode{\gMPa1 j}%
+ \resetMPstack
+ \else\ifx\somestring\PSsetmiterlimit
+ \PDFcode{\gMPa1 M}%
+ \resetMPstack
+ \else\ifx\somestring\PSfshow
+ \PDFcode{n}%
+ \handleMPfshow
+ \resetMPstack
+ \else\ifx\somestring\PSsetlinecap
+ \PDFcode{\gMPa1 J}%
+ \resetMPstack
+ \else\ifx\somestring\PSrlineto
+ \PDFcode{\!MP\lastMPmoveX\space\!MP\lastMPmoveY\space l S}%
+ \resetMPstack
+ \else\ifx\somestring\PSscale
+ \PDFcode{\gMPa1 0 0 \gMPa2 0 0 cm}%
+ \resetMPstack
+ \else\ifx\somestring\PSspecial
+ \handleMPspecialcommand
+ \resetMPstack
+ \else
+ \handleMPgraphic% {#1}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \handleMPsequence}
+
+\def\dohandleMPsequenceC#1 %
+ {\edef\somestring{#1}%
+ \handleMPgraphic % {#1}%
\handleMPsequence}
%D Since colors are not sensitive to transformations, they
%D are sometimes used for signaling. Therefore, we handle them
%D separately. The next macro can be redefined if needed.
-\def\handleMPrgbcolor%
- {\PDFcode{\!MP{\gMPa1} \!MP{\gMPa2} \!MP{\gMPa3} rg
- \!MP{\gMPa1} \!MP{\gMPa2} \!MP{\gMPa3} RG}}
+\def\handleMPrgbcolor
+ {\PDFcode{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 rg
+ \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 RG}}
-\def\handleMPcmykcolor%
- {\PDFcode{\!MP{\gMPa1} \!MP{\gMPa2} \!MP{\gMPa3} \!MP{\gMPa4} k
- \!MP{\gMPa1} \!MP{\gMPa2} \!MP{\gMPa3} \!MP{\gMPa4} K}}
+\def\handleMPcmykcolor
+ {\PDFcode{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 k
+ \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 K}}
-\def\handleMPgraycolor%
- {\PDFcode{\!MP{\gMPa1} g
- \!MP{\gMPa1} G}}
+\def\handleMPgraycolor
+ {\PDFcode{\!MPgMPa1 g
+ \!MPgMPa1 G}}
%D Beginning and ending the graphics is taken care of by the
%D macro \type{\handleMPgraphic}, which is redefined when
%D the first graphics operator is met.
-\def\handleMPendgraphic#1%
+\def\handleMPendgraphic % #1%
{\ifx\somestring\PSshowpage
- \let\handleMPsequence=\finishMPgraphic
+ \let\handleMPsequence\finishMPgraphic
\else
- \setMPargument{#1}%
+ \letMPargument\somestring % {#1}%
\fi}
-\def\handleMPbegingraphic#1%
+\def\handleMPbegingraphic % #1%
{\ifx\somestring\PSBoundingBox
\def\handleMPsequence{\handleMPboundingbox1}%
\else\ifx\somestring\PSHiResBoundingBox
@@ -680,15 +726,15 @@
\else\ifx\somestring\PSExactBoundingBox
\def\handleMPsequence{\handleMPboundingbox3}%
\else\ifx\somestring\PSshowpage
- \let\handleMPsequence=\finishMPgraphic
+ \let\handleMPsequence\finishMPgraphic
\else\ifx\somestring\PSPage
- \let\handleMPsequence=\handleMPpage
+ \let\handleMPsequence\handleMPpage
\else\ifx\somestring\PSMetaPostSpecials
- \let\handleMPsequence=\handleMPspecialscomment
+ \let\handleMPsequence\handleMPspecialscomment
\else\ifx\somestring\PSMetaPostSpecial
- \let\handleMPsequence=\handleMPspecialcomment
+ \let\handleMPsequence\handleMPspecialcomment
\else
- \setMPargument{#1}% kan weg
+ \letMPargument\somestring % {#1}%
\fi\fi\fi\fi\fi\fi\fi}
\let\handleMPgraphic=\handleMPbegingraphic
@@ -729,8 +775,8 @@
\chardef\currentMPboundingbox=#1\relax
\fi
\doresetMPstack
- \let\handleMPsequence=\dohandleMPsequence
- \let\next=\handleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
+ \let\next\handleMPsequence
\ifskipemptyMPgraphic
\ifdim\MPheight=\!!zeropoint\relax\ifdim\MPwidth=\!!zeropoint\relax
\def\next{\endinput\finishMPgraphic}%
@@ -742,7 +788,7 @@
\def\handleMPspecialcomment%
{\doresetMPstack
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\handleMPsequence}
\let\handleMPspecialscomment\handleMPspecialcomment
@@ -753,14 +799,14 @@
\def\handleMPpage #1 #2
{\doresetMPstack
\donetrue
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\handleMPsequence}
%D The same applies to the special extensions.
\def\handleMPspecialcommand
{\doresetMPstack
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\handleMPsequence}
%D \METAPOST\ draws its dots by moving to a location and
@@ -789,41 +835,43 @@
{\obeyMPspecials
\edef\size{\gMPa\nofMParguments}%
\ifx\size\PSnfont % round font size (to pt)
- \advance\nofMParguments by -1
+ \advance\nofMParguments -1
\expandafter\scratchdimen\gMPa\nofMParguments pt\relax
\ifdim\scratchdimen<1pt
\def\size{1pt}%
\else
- \advance\scratchdimen by .5pt
+ \advance\scratchdimen .5pt
\def\size##1.##2\relax{\def\size{##1pt}}%
\expandafter\size\the\scratchdimen\relax
\fi
\else
\edef\size{\size bp}%
\fi
- \advance\nofMParguments by -1
+ \advance\nofMParguments -1
%\font\temp=\gMPa\nofMParguments\space at \size
+ \let\temp\relax % to be sure
\setMPfshowfont{\gMPa\nofMParguments}\size
- \advance\nofMParguments by -1
+ \advance\nofMParguments -1
\temp
\MPfshowcommand
{\ifnum\nofMParguments=1
\def\do(##1){##1}%
- \gMPa1%
+ \dogMPa1%
\else
+ % we need to catch ( a ) (a a a) (\123 \123 \123) etc
\scratchcounter=1
- \def\dodo##1%
- {\edef\!!stringa{##1}\ifx\!!stringa\space\MPspacechar\else##1\fi}%
+ \def\dodo##1% Andreas Fieger's bug: (\304...)
+ {\ifx##1\MPspacechar\MPspacechar\else\expandafter##1\fi}%
\def\do(##1{\dodo{##1}}%
- \gMPa\scratchcounter\MPspacechar
+ \dogMPa\scratchcounter\MPspacechar
\let\do\relax
\loop
- \advance\scratchcounter by 1
+ \advance\scratchcounter 1
\ifnum\scratchcounter<\nofMParguments\relax
\gMPa\scratchcounter\MPspacechar
\repeat
\def\do##1){\dodo{##1}}%
- \gMPa\scratchcounter
+ \dogMPa\scratchcounter
\fi
\unskip}}%
%
@@ -851,8 +899,7 @@
%D You could consider the following definition to be the most
%D natural one.
-\def\MPspacechar% normal case
- {\space}
+\def\MPspacechar{\space} % normal case
%D However, the following implementation is more robust, since
%D some fonts have funny visible spaces in the space slot. This
@@ -864,8 +911,7 @@
%D safely assume that \METAPOST\ considers \type {\char32} to
%D be the space.
-\def\MPspacechar%
- {\setbox\scratchbox=\hbox{\char32}\kern\wd\scratchbox}%
+\def\MPspacechar{\setbox\scratchbox=\hbox{\char32}\kern\wd\scratchbox}
%D Most operators are just converted and keep their
%D arguments. Dashes however need a bit different treatment,
@@ -881,9 +927,9 @@
\def\somestring{[}%
\scratchcounter=1
\loop
- \ifnum\scratchcounter<\nofMParguments
- \edef\somestring{\somestring\space\gMPa\scratchcounter}%
- \advance\scratchcounter by 1
+ \ifnum\scratchcounter<\nofMParguments
+ \edef\somestring{\somestring\space\gMPa\scratchcounter}%
+ \advance\scratchcounter 1
\repeat
\edef\somestring{\somestring]\gMPa\scratchcounter\space d}%
\PDFcode{\somestring}%
@@ -924,7 +970,7 @@
\PDFcode{\gMPa2 w}%
\def\next##1 ##2 ##3 ##4 {\handleMPsequence}%
\fi
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\resetMPstack
\next}
@@ -957,62 +1003,70 @@
%D macro \type{\handleMPsequence}.
\def\handleMPpath%
- {\chardef\finiMPpath=0
- \let\closeMPpath=\relax
- \let\flushMPpath=\flushnormalMPpath
+ {\chardef\finiMPpath0
+ \let\closeMPpath\relax
+ \let\flushMPpath\flushnormalMPpath
\resetMPstack
- \nofMPsegments=1
- \let\handleMPsequence=\dohandleMPpath
+ \nofMPsegments1
+ \let\handleMPsequence\dohandleMPpath
\dohandleMPpath}
%D Most paths are drawn with simple round pens. Therefore we've
%D split up the routine in two.
+\def\flushnormalMPsegment
+ {\expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax
+ \PDFcode{\!MPgMPs1 \!MPgMPs2 l}%
+ \or
+ \PDFcode{\!MPgMPs1 \!MPgMPs2 \!MPgMPs3 \!MPgMPs4 \!MPgMPs5 \!MPgMPs6 c}%
+ \or
+ \PDFcode{\!MP\lastMPmoveX\space\!MP\lastMPmoveY\space l S}%
+ \or
+ \edef\lastMPmoveX{\gMPs1}% evt \!MP here
+ \edef\lastMPmoveY{\gMPs2}%
+ \PDFcode{\!MP\lastMPmoveX\space \!MP\lastMPmoveY\space m}%
+ \fi}
+
\def\flushnormalMPpath%
- {\scratchcounter=\nofMPsegments
- \nofMPsegments=1
+ {\scratchcounter\nofMPsegments
+ \nofMPsegments1
\loop
- \expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax
- \PDFcode{\!MP{\gMPs1} \!MP{\gMPs2} l}%
- \or
- \PDFcode{\!MP{\gMPs1} \!MP{\gMPs2} \!MP{\gMPs3} \!MP{\gMPs4} \!MP{\gMPs5} \!MP{\gMPs6} c}%
- \or
- \PDFcode{\!MP{\lastMPmoveX} \!MP{\lastMPmoveY} l S}%
- \or
- \edef\lastMPmoveX{\gMPs1}%
- \edef\lastMPmoveY{\gMPs2}%
- \PDFcode{\!MP{\lastMPmoveX} \!MP{\lastMPmoveY} m}%
- \fi
- \advance\nofMPsegments by 1\relax
- \ifnum\nofMPsegments<\scratchcounter
+ \flushnormalMPsegment
+ \advance\nofMPsegments 1
+ \ifnum\nofMPsegments<\scratchcounter
\repeat}
+\def\flushconcatMPsegment
+ {\expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax
+ \doMPconcat{\gMPs1}\a{\gMPs2}\b%
+ \PDFcode{\!MP\a\space\!MP\b\space l}%
+ \or
+ \doMPconcat{\gMPs1}\a{\gMPs2}\b%
+ \doMPconcat{\gMPs3}\c{\gMPs4}\d%
+ \doMPconcat{\gMPs5}\e{\gMPs6}\f%
+ \PDFcode{\!MP\a\space\!MP\b\space
+ \!MP\c\space\!MP\d\space
+ \!MP\e\space\!MP\f\space c}%
+ \or
+ \bgroup
+ \noMPtranslate
+ \doMPconcat\lastMPmoveX\a\lastMPmoveY\b%
+ \PDFcode{\!MP\a\space\!MP\b\space l S}%
+ \egroup
+ \or
+ \edef\lastMPmoveX{\gMPs1}%
+ \edef\lastMPmoveY{\gMPs2}%
+ \doMPconcat\lastMPmoveX\a\lastMPmoveY\b%
+ \PDFcode{\!MP\a\space\!MP\b\space m}%
+ \fi}
+
\def\flushconcatMPpath%
{\scratchcounter=\nofMPsegments
\nofMPsegments=1
\loop
- \expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax
- \doMPconcat{\gMPs1}\a{\gMPs2}\b%
- \PDFcode{\!MP{\a} \!MP{\b} l}%
- \or
- \doMPconcat{\gMPs1}\a{\gMPs2}\b%
- \doMPconcat{\gMPs3}\c{\gMPs4}\d%
- \doMPconcat{\gMPs5}\e{\gMPs6}\f%
- \PDFcode{\!MP{\a} \!MP{\b} \!MP{\c} \!MP{\d} \!MP{\e} \!MP{\f} c}%
- \or
- \bgroup
- \noMPtranslate
- \doMPconcat\lastMPmoveX\a\lastMPmoveY\b%
- \PDFcode{\!MP{\a} \!MP{\b} l S}%
- \egroup
- \or
- \edef\lastMPmoveX{\gMPs1}%
- \edef\lastMPmoveY{\gMPs2}%
- \doMPconcat\lastMPmoveX\a\lastMPmoveY\b%
- \PDFcode{\!MP{\a} \!MP{\b} m}%
- \fi
- \advance\nofMPsegments by 1\relax
- \ifnum\nofMPsegments<\scratchcounter
+ \flushconcatMPsegment
+ \advance\nofMPsegments 1
+ \ifnum\nofMPsegments<\scratchcounter
\repeat}
%D The transformation of the coordinates is handled by one of
@@ -1038,15 +1092,17 @@
\def\MPconcatfactor{256}
-% \def\doMPreducedimen#1
-% {\count0=\MPconcatfactor
-% \advance\dimen#1 \ifdim\dimen#1>\!!zeropoint .5\else -.5\fi\count0
-% \divide\dimen#1 \count0\relax}
-
\def\doMPreducedimen#1
{\count0=\MPconcatfactor
+ \advance\dimen#1 \ifdim\dimen#1>\!!zeropoint .5\else -.5\fi\count0
\divide\dimen#1 \count0\relax}
+% too inaccurate (see old pragma logo)
+%
+% \def\doMPreducedimen#1
+% {\count0=\MPconcatfactor
+% \divide\dimen#1 \count0\relax}
+
\def\doMPexpanddimen#1
{\multiply\dimen#1 \MPconcatfactor\relax}
@@ -1113,10 +1169,70 @@
%D The following optimization resulted from some tests by
%D and email exchanges with Sanjoy Mahajan.
+%D
+%D \starttypen
+%D \def\doMPconcat#1#2#3#4%
+%D {\dimen12=#1 pt \doMPreducedimen12 % p_x
+%D \dimen14=#3 pt \doMPreducedimen14 % p_y
+%D %
+%D \dimen16 \dimen 0
+%D \multiply \dimen16 \dimen 6
+%D \dimen20 \dimen 2
+%D \multiply \dimen20 \dimen 4
+%D \advance \dimen16 -\dimen20
+%D %
+%D \dimen18 \dimen12
+%D \multiply \dimen18 \dimen 6
+%D \dimen20 \dimen14
+%D \multiply \dimen20 \dimen 4
+%D \advance \dimen18 -\dimen20
+%D \dimen20 \dimen 4
+%D \multiply \dimen20 \dimen10
+%D \advance \dimen18 \dimen20
+%D \dimen20 \dimen 6
+%D \multiply \dimen20 \dimen 8
+%D \advance \dimen18 -\dimen20
+%D %
+%D \multiply \dimen12 -\dimen 2
+%D \multiply \dimen14 \dimen 0
+%D \advance \dimen12 \dimen14
+%D \dimen20 \dimen 2
+%D \multiply \dimen20 \dimen 8
+%D \advance \dimen12 \dimen20
+%D \dimen20 \dimen 0
+%D \multiply \dimen20 \dimen10
+%D \advance \dimen12 -\dimen20
+%D %
+%D %\ifdim\dimen16>1pt % oeps, can be < 1pt too
+%D \ifdim\dimen16=1pt \else
+%D \ifdim\dimen16>\MPconcatfactor pt
+%D \doMPreducedimen16
+%D \divide \dimen18 \dimen16 \doMPexpanddimen18
+%D \divide \dimen12 \dimen16 \doMPexpanddimen12
+%D \else
+%D \divide \dimen18 \dimen16 \doMPexpanddimen18 \doMPexpanddimen18
+%D \divide \dimen12 \dimen16 \doMPexpanddimen12 \doMPexpanddimen12
+%D \fi
+%D \fi
+%D %
+%D \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime
+%D \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime
+%D \stoptypen
+%D
+%D But, this one is still too inaccurate, so we now have:
\def\doMPconcat#1#2#3#4%
- {\dimen12=#1 pt \doMPreducedimen12 % p_x
- \dimen14=#3 pt \doMPreducedimen14 % p_y
+ {\dimen12=#1pt % p_x
+ \dimen14=#3pt % p_y
+ %
+ % we should test for >-1024 too, but for the moment take the gamble
+ \chardef\MPfactor1\ifdim\dimen12<1024pt \ifdim\dimen14<1024pt 6\fi\fi
+ %
+ \multiply\dimen12 \MPfactor
+ \multiply\dimen14 \MPfactor
+ %
+ \doMPreducedimen12
+ \doMPreducedimen14
%
\dimen16 \dimen 0
\multiply \dimen16 \dimen 6
@@ -1146,9 +1262,8 @@
\multiply \dimen20 \dimen10
\advance \dimen12 -\dimen20
%
-% \ifdim\dimen16>1pt % oeps, can be < 1pt too
\ifdim\dimen16=1pt \else
- \ifdim\dimen16>256pt
+ \ifdim\dimen16>\MPconcatfactor pt
\doMPreducedimen16
\divide \dimen18 \dimen16 \doMPexpanddimen18
\divide \dimen12 \dimen16 \doMPexpanddimen12
@@ -1158,9 +1273,12 @@
\fi
\fi
%
+ \divide\dimen18 \MPfactor
+ \divide\dimen12 \MPfactor
+ %
\edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime
\edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime
-
+
%D The following explanation of the conversion process was
%D posted to the \PDFTEX\ mailing list by Tanmoy. The original
%D macro was part of a set of macro's that included sinus and
@@ -1404,7 +1522,7 @@
\closeMPpath
\finishMPpath
\fi
- \let\handleMPsequence=\dohandleMPsequence
+ \let\handleMPsequence\dohandleMPsequence
\resetMPstack
\nofMPsegments=0
\handleMPsequence}
@@ -1446,45 +1564,54 @@
%D This macro interprets the path and saves it as compact as
%D possible.
-\def\dohandleMPpath#1#2 %
- {\ifnum\lccode`#1=0
- \setMPargument{#1#2}%
+\def\dohandleMPpath#1%
+ {\ifcase\lccode`#1\relax
+ \@EA\dohandleMPpathA
\else
- \def\somestring{#1#2}%
- \ifx\somestring\PSlineto
- \setMPkeyword0
- \else\ifx\somestring\PScurveto
- \setMPkeyword1
- \else\ifx\somestring\PSrlineto
- \setMPkeyword2
- \else\ifx\somestring\PSmoveto
- \setMPkeyword3
- \else\ifx\somestring\PSclip
- % \chardef\finiMPpath=0 % already
- \let\handleMPsequence=\processMPpath
- \else\ifx\somestring\PSgsave
- \chardef\finiMPpath=3
- \else\ifx\somestring\PSgrestore
- \else\ifx\somestring\PSfill
- \ifnum\finiMPpath=0
- \chardef\finiMPpath=2
- \let\handleMPsequence=\processMPpath
- \fi
- \else\ifx\somestring\PSstroke
- \ifnum\finiMPpath=0
- \chardef\finiMPpath=1
- \fi
- \let\handleMPsequence=\processMPpath
- \else\ifx\somestring\PSclosepath
- \def\closeMPpath{\PDFcode{h}}%
- \else\ifx\somestring\PSconcat
- \let\flushMPpath=\flushconcatMPpath
- \handleMPpathconcat
- \else\ifx\somestring\PSscale
- \let\flushMPpath=\flushconcatMPpath
- \handleMPpathscale
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
- \fi
+ \@EA\dohandleMPpathB
+ \fi#1}
+
+%\def\dohandleMPpathA#1 %
+% {\setMPargument{#1}%
+% \handleMPsequence}
+
+\let\dohandleMPpathA\setMPsequence
+
+\def\dohandleMPpathB#1 %
+ {\def\somestring{#1}%
+ \ifx\somestring\PSlineto
+ \setMPkeyword0
+ \else\ifx\somestring\PScurveto
+ \setMPkeyword1
+ \else\ifx\somestring\PSrlineto
+ \setMPkeyword2
+ \else\ifx\somestring\PSmoveto
+ \setMPkeyword3
+ \else\ifx\somestring\PSclip
+ % \chardef\finiMPpath0 % already
+ \let\handleMPsequence\processMPpath
+ \else\ifx\somestring\PSgsave
+ \chardef\finiMPpath3
+ \else\ifx\somestring\PSgrestore
+ \else\ifx\somestring\PSfill
+ \ifcase\finiMPpath
+ \chardef\finiMPpath2
+ \let\handleMPsequence\processMPpath
+ \fi
+ \else\ifx\somestring\PSstroke
+ \ifcase\finiMPpath
+ \chardef\finiMPpath1
+ \fi
+ \let\handleMPsequence\processMPpath
+ \else\ifx\somestring\PSclosepath
+ \def\closeMPpath{\PDFcode{h}}%
+ \else\ifx\somestring\PSconcat
+ \let\flushMPpath\flushconcatMPpath
+ \handleMPpathconcat
+ \else\ifx\somestring\PSscale
+ \let\flushMPpath\flushconcatMPpath
+ \handleMPpathscale
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\handleMPsequence}
%D The main conversion command is:
@@ -1541,7 +1668,7 @@
\def\processMPtoPDFfile% file xscale yscale
{\bgroup
- \let\finishMPgraphic=\egroup
+ \let\finishMPgraphic\egroup
\doprocessMPtoPDFfile}
\def\doprocessMPtoPDFfile#1#2#3% file xscale yscale
@@ -1549,14 +1676,13 @@
\the\everyMPtoPDFconversion
\catcode`\^^M=\@@endofline
\startMPscanning
- \let\do=\empty
+ \let\do\empty
\xdef\MPxscale{#2}%
\xdef\MPyscale{#3}%
\donefalse
- \let\handleMPsequence=\dohandleMPsequence
- \message{[MP to PDF #1]}%
- \input#1\relax
- \deleteMPgraphic{#1}}
+ \let\handleMPsequence\dohandleMPsequence
+ \message{[MP to PDF]}% was: [MP to PDF #1] but there is a (#1) anyway
+ \input#1\relax}
% strange rounding/clip in pdftex/viewer
%
@@ -1687,9 +1813,13 @@
%D This option only works in \CONTEXT\ combined with \ETEX.
\def\twodigitMPoutput%
- {\let\!MP\twodigitrounding}
+ {\let\!MP \twodigitrounding
+ \def\!MPgMPs##1{\twodigitrounding{\gMPs##1}}%
+ \def\!MPgMPa##1{\twodigitrounding{\gMPa##1}}}
-\def\!MP#1{#1}
+\let\!MP \empty
+\let\!MPgMPa\gMPa
+\let\!MPgMPs\gMPs
%D This kind of conversion is possible because \METAPOST\
%D does all the calculations. Converting other \POSTSCRIPT\
diff --git a/tex/context/base/supp-ran.tex b/tex/context/base/supp-ran.tex
index 20892c056..094d0f36b 100644
--- a/tex/context/base/supp-ran.tex
+++ b/tex/context/base/supp-ran.tex
@@ -61,18 +61,23 @@
\else
- \let\normalnextrandom = \nextrandom
+ \let\verynormalnextrandom = \nextrandom
- \global\chardef\randomseedfrozen=0
+ \def\normalnextrandom
+ {\bgroup
+ \let\time \normaltime
+ \let\day \normalday
+ \let\month\normalmonth
+ \let\year \normalyear
+ \verynormalnextrandom
+ \egroup}
+
+ \chardef\randomseedfrozen=0
- \def\nextrandom%
+ \def\nextrandom
{\bgroup
- \let\time =\normaltime
- \let\day =\normalday
- \let\month=\normalmonth
- \let\year =\normalyear
\normalnextrandom
- \gdef\nextrandom%
+ \gdef\nextrandom
{\ifcase\randomseedfrozen\normalnextrandom\fi}%
\egroup}
diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex
index ffa518a5a..9979e5179 100644
--- a/tex/context/base/supp-vis.tex
+++ b/tex/context/base/supp-vis.tex
@@ -118,10 +118,8 @@
%D messages we introduce \type{\dontcomplain}.
\def\dontcomplain%
- {\hbadness = \!!tenthousand
- \hfuzz = \maxdimen
- \vbadness = \!!tenthousand
- \vfuzz = \maxdimen}
+ {\hbadness=\!!tenthousand \vbadness=\hbadness
+ \hfuzz =\maxdimen \vfuzz =\hfuzz}
%D \macros
%D {normaloffinterlineskip}
@@ -143,10 +141,10 @@
%D baseline behavior. Especially \type{\vtop}'s need our
%D special attention.
-\let\normalhbox = \hbox
-\let\normalvbox = \vbox
-\let\normalvtop = \vtop
-\let\normalvcenter = \vcenter
+\ifx \normalhbox \undefined \let \normalhbox = \hbox \fi
+\ifx \normalvbox \undefined \let \normalvbox = \vbox \fi
+\ifx \normalvtop \undefined \let \normalvtop = \vtop \fi
+\ifx \normalvcenter \undefined \let \normalvcenter = \vcenter \fi
%D \macros
%D {normalhskip,
@@ -335,6 +333,8 @@
%D primitive too. By storing and restoring the height and depth
%D of box \type{#1}, we preserve the mode.
+\let\dowithruledbox\relax
+
\def\makeruledbox#1%
{\edef\ruledheight{\the\ht#1}%
\edef\ruleddepth {\the\dp#1}%
@@ -379,7 +379,9 @@
\ifbottomrule\else\!!width\!!zeropoint\fi}%
\wd#1=\!!zeropoint
\setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi
- {\normalhbox{\box#1\lower\ruleddepth\box\scratchbox}}%
+ {\normalhbox
+ {\box#1%
+ \lower\ruleddepth\normalhbox{\dowithruledbox{\box\scratchbox}}}}%
\ht#1=\ruledheight
\wd#1=\ruledwidth
\dp#1=\ruleddepth}
@@ -1707,66 +1709,66 @@
%D For those who want to manipulate the visual cues in detail,
%D we have grouped them.
-\def\showfils%
- {\let\hss = \ruledhss
- \let\hfil = \ruledhfil
- \let\hfill = \ruledhfill
- \let\hfilneg = \ruledhfilneg
- \let\hfillneg = \ruledhfillneg
- \let\vss = \ruledvss
- \let\vfil = \ruledvfil
- \let\vfill = \ruledvfill
- \let\vfilneg = \ruledvfilneg
- \let\vfillneg = \ruledvfillneg}
-
-\def\dontshowfils%
- {\let\hss = \normalhss
- \let\hfil = \normalhfil
- \let\hfill = \normalhfill
- \let\hfilneg = \normalhfilneg
- \let\hfillneg = \normalhfillneg
- \let\vss = \normalvss
- \let\vfil = \normalvfil
- \let\vfill = \normalvfill
- \let\vfilneg = \normalvfilneg
- \let\vfillneg = \normalvfillneg}
-
-\def\showboxes%
+\def\showfils
+ {\let\hss \ruledhss
+ \let\hfil \ruledhfil
+ \let\hfill \ruledhfill
+ \let\hfilneg \ruledhfilneg
+ \let\hfillneg \ruledhfillneg
+ \let\vss \ruledvss
+ \let\vfil \ruledvfil
+ \let\vfill \ruledvfill
+ \let\vfilneg \ruledvfilneg
+ \let\vfillneg \ruledvfillneg}
+
+\def\dontshowfils
+ {\let\hss \normalhss
+ \let\hfil \normalhfil
+ \let\hfill \normalhfill
+ \let\hfilneg \normalhfilneg
+ \let\hfillneg \normalhfillneg
+ \let\vss \normalvss
+ \let\vfil \normalvfil
+ \let\vfill \normalvfill
+ \let\vfilneg \normalvfilneg
+ \let\vfillneg \normalvfillneg}
+
+\def\showboxes
{\baselineruletrue
- \let\hbox = \ruledhbox
- \let\vbox = \ruledvbox
- \let\vtop = \ruledvtop
- \let\vcenter = \ruledvcenter}
-
-\def\dontshowboxes%
- {\let\hbox = \normalhbox
- \let\vbox = \normalvbox
- \let\vtop = \normalvtop
- \let\vcenter = \normalvcenter}
-
-\def\showskips%
- {\let\hskip = \ruledhskip
- \let\vskip = \ruledvskip
- \let\kern = \ruledkern
- \let\mskip = \ruledmskip
- \let\mkern = \ruledmkern
- \let\hglue = \ruledhglue
- \let\vglue = \ruledvglue}
-
-\def\dontshowskips%
- {\let\hskip = \normalhskip
- \let\vskip = \normalvskip
- \let\kern = \normalkern
- \let\mskip = \normalmskip
- \let\mkern = \normalmkern
- \let\hglue = \normalhglue
- \let\vglue = \normalvglue}
-
-\def\showpenalties%
- {\let\penalty = \ruledpenalty}
-
-\def\dontshowpenalties%
- {\let\penalty = \normalpenalty}
+ \let\hbox \ruledhbox
+ \let\vbox \ruledvbox
+ \let\vtop \ruledvtop
+ \let\vcenter \ruledvcenter}
+
+\def\dontshowboxes
+ {\let\hbox \normalhbox
+ \let\vbox \normalvbox
+ \let\vtop \normalvtop
+ \let\vcenter \normalvcenter}
+
+\def\showskips
+ {\let\hskip \ruledhskip
+ \let\vskip \ruledvskip
+ \let\kern \ruledkern
+ \let\mskip \ruledmskip
+ \let\mkern \ruledmkern
+ \let\hglue \ruledhglue
+ \let\vglue \ruledvglue}
+
+\def\dontshowskips
+ {\let\hskip \normalhskip
+ \let\vskip \normalvskip
+ \let\kern \normalkern
+ \let\mskip \normalmskip
+ \let\mkern \normalmkern
+ \let\hglue \normalhglue
+ \let\vglue \normalvglue}
+
+\def\showpenalties
+ {\let\penalty \ruledpenalty}
+
+\def\dontshowpenalties
+ {\let\penalty \normalpenalty}
%D \macros
%D {showcomposition,dontshowcomposition,
diff --git a/tex/context/base/symb-ini.tex b/tex/context/base/symb-ini.tex
index d2a0842d6..3cbfe09cc 100644
--- a/tex/context/base/symb-ini.tex
+++ b/tex/context/base/symb-ini.tex
@@ -1,8 +1,8 @@
%D \module
-%D [ file=symb-nav,
+%D [ file=symb-ini,
%D version=1998.07.20,
%D title=\CONTEXT\ Symbol Libraries,
-%D subtitle=Navigational Symbols,
+%D subtitle=Basic Symbols Commands,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
@@ -82,41 +82,93 @@
% ss:set:tag -> symbol out of set
% sstag -> list of symbols in set
+% \def\dodefinesymbol[#1][#2]%
+% {\ifx\currentsymboldef\empty
+% \setvalue{\??ss:#1}{#2}%
+% \else
+% \doifundefinedelse{\??ss\currentsymboldef}
+% {\let\currentsymbollist\empty}
+% {\edef\currentsymbollist{\csname\??ss\currentsymboldef\endcsname}}%
+% \addtocommalist{#1}\currentsymbollist
+% \setvalue{\??ss:\currentsymboldef:#1}{#2}%
+% \letvalue{\??ss\currentsymboldef}\currentsymbollist
+% \fi}
+
\def\dodefinesymbol[#1][#2]%
- {\ifx\currentsymbolset\empty
+ {\ifx\currentsymboldef\empty
\setvalue{\??ss:#1}{#2}%
\else
- \doifundefinedelse{\??ss\currentsymbolset}
- {\let\currentsymbollist\empty}
- {\edef\currentsymbollist{\csname\??ss\currentsymbolset\endcsname}}%
- \addtocommalist{#1}\currentsymbollist
- \setvalue{\??ss:\currentsymbolset:#1}{#2}%
- \letvalue{\??ss\currentsymbolset}\currentsymbollist
+ \setvalue{\??ss:\currentsymboldef:#1}{#2}%
+ \addvalue{\??ss\currentsymboldef}{#1}%
\fi}
-\def\definesymbol%
+\def\definesymbol
{\dodoubleargument\dodefinesymbol}
\unexpanded\def\symbol% % This one always gobbles spaces,
{\dodoubleempty\dosymbol} % so never change it again!
-\def\dosymbol[#1][#2]%
- {\ifsecondargument
- \doifdefinedelse{\??ss:#1:#2}
- {\dodosymbol{#1:#2}}
- {\doifdefinedelse{\??ss:#2}{\dodosymbol{#2}}{#2}}%
- \else\ifx\currentsymbolset\empty
- \doifdefinedelse{\??ss:#1}{\dodosymbol{#1}}{#1}%
- \else
- \doifdefinedelse{\??ss:\currentsymbolset:#1}
- {\dodosymbol{\currentsymbolset:#1}}
- {\doifdefinedelse{\??ss:#1}{\dodosymbol{#1}}{#1}}%
- \fi\fi}
+%D Since symbols are used frequently in interactive
+%D documents, we speed up this one.
+
+\newif\ifnosymbol \newtoks\everysymbol
\def\dodosymbol#1% \relax's prevent lookahead problems
- {{\the\everysymbol\getvalue{\??ss:#1}\relax}\relax}
+ {\nosymbolfalse{\the\everysymbol\csname\??ss:#1\endcsname\relax}\relax}
+
+\beginTEX
+
+\def\dosymbol[#1][#2]%
+ {\nosymboltrue
+ \ifsecondargument \@EA\ifx\csname\??ss:#1:#2\endcsname\relax\else
+ \dodosymbol{#1:#2}%
+ \fi \fi
+ \ifnosymbol
+ \edef\currentsymbol{#1}%
+ \the\symbolsetups
+ \ifnosymbol
+ \redosymbol\currentsymbol
+ \fi
+ \fi}
+
+\def\fetchsymbol#1%
+ {\ifnosymbol % will be a \cs anyway, so no test needed
+ %\@EA\ifx\csname\??ss:#1:\currentsymbol\endcsname\relax\else
+ \dodosymbol{#1:\currentsymbol}%
+ %\fi
+ \fi}
+
+\def\redosymbol#1%
+ {\@EA\ifx\csname\??ss:#1\endcsname\relax\else\@EA\dodosymbol\fi{#1}}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\dosymbol[#1][#2]%
+ {\nosymboltrue
+ \ifsecondargument \ifcsname\??ss:#1:#2\endcsname
+ \dodosymbol{#1:#2}%
+ \fi \fi
+ \ifnosymbol
+ \edef\currentsymbol{#1}%
+ \the\symbolsetups
+ \ifnosymbol
+ \redosymbol\currentsymbol
+ \fi
+ \fi}
+
+\def\fetchsymbol#1%
+ {\ifnosymbol
+ \ifcsname\??ss:#1:\currentsymbol\endcsname
+ \dodosymbol{#1:\currentsymbol}%
+ \fi
+ \fi}
+
+\def\redosymbol#1%
+ {\ifcsname\??ss:#1\endcsname\@EA\dodosymbol\else\fi{#1}}
-\newtoks\everysymbol
+\endETEX
% % % % %
% this should go in symb-fig, to be loaded after core-fig
@@ -129,12 +181,19 @@
%D \showsetup{\y!definefiguresymbol}
%D
%D By default, such symbols scale along the current bodyfont
-%D size.
+%D size or running font size (which is better).
\def\defaultsymbolfactor{10}
+\def\defaultsymbolheight{1.25ex}
\def\dohandlefiguresymbol#1#2%
- {\externalfigure[#1][\c!reset=\v!ja,\c!symbool=\v!ja,\c!hfactor=\defaultsymbolfactor,#2]}
+ {\externalfigure
+ [#1]
+ [\c!reset=\v!ja,
+ \c!symbool=\v!ja,
+ \c!hoogte=\defaultsymbolheight,
+ %\c!hfactor=\defaultsymbolfactor,
+ #2]}
\appendtoks \resetexternalfigures \to \everysymbol
@@ -157,12 +216,49 @@
%D
%D A handy private one:
-\def\doifsymboldefinedelse#1#2#3%
- {\ifx\currentsymbolset\empty
- \doifdefinedelse{\??ss:#1}{#2}{#3}%
+\beginTEX
+
+\def\xfetchsymbol#1%
+ {\ifnosymbol % will be a \cs anyway, so no test needed
+ %\@EA\ifx\csname\??ss:#1:\currentsymbol\endcsname\relax\else
+ \nosymbolfalse
+ %\fi
+ \fi}
+
+\def\xredosymbol#1%
+ {\@EA\ifx\csname\??ss:#1\endcsname\relax\else\nosymbolfalse\fi}
+
+\endTEX
+
+\beginETEX
+
+\def\xfetchsymbol#1%
+ {\ifnosymbol
+ \ifcsname\??ss:#1:\currentsymbol\endcsname\nosymbolfalse\fi
+ \fi}
+
+\def\xredosymbol#1%
+ {\ifcsname\??ss:#1\endcsname\nosymbolfalse\fi}
+
+\endETEX
+
+\def\doifsymboldefinedelse#1%
+ {\bgroup
+ \edef\currentsymbol{#1}%
+ \let\fetchsymbol\xfetchsymbol
+ %\let\redosymbol \xredosymbol
+ \nosymboltrue
+ \the\symbolsetups
+ \ifnosymbol
+ %\redosymbol\currentsymbol
+ \xredosymbol\currentsymbol
+ \ifnosymbol
+ \egroup\@EAEAEA\secondoftwoarguments
+ \else
+ \egroup\@EAEAEA\firstoftwoarguments
+ \fi
\else
- \doifdefinedelse{\??ss:\currentsymbolset:#1}
- {#2}{\doifdefinedelse{\??ss:#1}{#2}{#3}}%
+ \egroup\@EA\firstoftwoarguments
\fi}
%D \macros
@@ -195,59 +291,31 @@
%D \showsetup{\y!setupsymbolset}
%D \showsetup{\y!startsymbolset}
-\let\currentsymbolset\empty
+\let\currentsymboldef\empty
-\def\startsymbolset%
- {\localpushmacro\currentsymbolset
- \setupsymbolset}
+\def\startsymbolset[#1]
+ {\def\currentsymboldef{#1}}
-\def\stopsymbolset%
- {\localpopmacro\currentsymbolset}
+\def\stopsymbolset
+ {\let\currentsymboldef\empty}
+
+\newtoks\symbolsetups
\def\setupsymbolset[#1]%
- {\def\currentsymbolset{#1}}
+ {\prependtoksonce\fetchsymbol{#1}\to\symbolsetups}
+
+\def\resetsymbolset
+ {\symbolsetups\emptytoks}
+
+\def\forcesymbolset[#1]%
+ {\symbolsetups{\fetchsymbol{#1}}}
%D \macros
%D {showsymbolset}
%D
%D \showsetup{\y!showsymbolset}
-\def\doshowsymbolset[#1][#2]% looks like \showexternalfigureb
- {\vbox\bgroup
- \blanko
- \getparameters[\??ss][\c!n=5,#2]%
- \setupsymbolset[#1]%
- \doifdefined{\??ss\currentsymbolset}
- {\global\let\allfigures=\empty
- \doglobal\newcounter\figurecounter
- \setupcolors[\c!status=\v!start]% to prevent mps color conversion
- \mindermeldingen
- \def\doshowsymbols% global needed due to grouping in alignment
- {\expanded{\globalprocesscommalist[\getvalue{\??ss\currentsymbolset}]\noexpand\docommando}}%
- \def\docommando##1%
- {\vbox
- {\forgetall
- \tttf
- \halign
- {\hss\quad####\strut\quad\hss\cr
- \symbol[##1]\quad{\red\ruledhbox{\black\symbol[##1]}}\cr
- \tfx##1\cr}}%
- \doglobal\increment\figurecounter
- \ifnum\figurecounter=\@@ssn
- \doglobal\newcounter\figurecounter
- \def\next{\crcr\noalign{\vskip1ex}}%
- \else
- \def\next{&}%
- \fi
- \next}%
- \tabskip=\!!zeropoint \!!plus 1fill
- \halign to \hsize
- {&\hss##\hss\cr\doshowsymbols\crcr}}%
- \blanko
- \egroup}
-
-\def\showsymbolset%
- {\dodoubleempty\doshowsymbolset}
+\fetchruntimecommand \showsymbolset {\f!symbolprefix\s!run}
%D \macros
%D {usesymbols}
@@ -280,7 +348,7 @@
\definesymbol [circle] [\mathematics{\circ}]
\definesymbol [medcircle] [\hbox{\setsmallbodyfont\raise\!!onepoint\hbox{$\bigcirc$}}]
\definesymbol [bigcircle] [\mathematics{\bigcirc}]
-\definesymbol [square] [\hbox{\hsmash{$\sqcup$}$\sqcap$}]
+\definesymbol [square] [\mathematics{\square}]
\definesymbol [diamond] [\mathematics{\diamond}]
\definesymbol [1] [{\symbol[bullet]}]
diff --git a/tex/context/base/symb-mvs.tex b/tex/context/base/symb-mvs.tex
new file mode 100644
index 000000000..f8d996642
--- /dev/null
+++ b/tex/context/base/symb-mvs.tex
@@ -0,0 +1,215 @@
+% Insert this in font-fil.tex ( I would think):
+
+% tobias: what is the original and what the berry name?
+
+%D \module
+%D [ file=symb-nav,
+%D version=2000.03.30,
+%D title=\CONTEXT\ Symbol Libraries,
+%D subtitle=Martin Vogels Symbole,
+%D author=Tobias Burnus \& 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 implements the Martin Vogel Symbole font
+%D (marvosym). The names are derived from the \LaTeXe\ package
+%D \type {marvosym} of Thomas Henlich. The symbols are
+%D available as Type~1 font and are included in \TETEX\ and
+%D \FPTEX\ distributions.
+%D
+%D This symbol font offers the signs of the zodiac, four
+%D alternative the euro signs, some general office signs and
+%D some more.
+%D
+%D The font was designed by Martin Vogel who can be reached at
+%D \hyphenatedurl {martin.vogel@fh-bochum.de}. More information
+%D can be found at \hyphenatedurl
+%D {http://www.fh-bochum.de/fb1/vogel/marvosym.html}. The
+%D conversion to Type~1 font was done by Thomas Henlich, who
+%D can be reached at \hyphenatedurl
+%D {thenlich@rcs.urz.tu-dresden.de}.
+%D
+%D This module is based on the current \CTAN\ version (as of
+%D March 30, 2000) and is older than the TrueType version at
+%D Martin Vogel's Homepage. The definitions in this module
+%D reflect the \CTAN\ version. The font conversion was done by
+%D Thomas Henlich using \type {ttf2pt1}, a program that can be
+%D found at \hyphenatedurl
+%D {http://www.netspace.net.au/~mheath/ttf2pt1/}.
+%D
+%D Using the new version of \type {marvosymb}, the MVzero will
+%D has a slash and the FHBOLOGO, (wo)manface, and (wo)manfront
+%D are replaced by other symbols.
+
+\definefontsynonym [MartinVogel] [fmvr8x]
+
+\loadmapfile[original-vogel-symbol]
+
+\def\MartinVogelSymbol#1{\getglyph{MartinVogel}{\char#1}}
+
+% Astro signs and signs of the zodiac
+
+\startsymbolset [astronomic]
+
+ \definesymbol [Sun] [\MartinVogelSymbol{192}]
+ \definesymbol [Moon] [\MartinVogelSymbol{193}]
+ \definesymbol [Mercury] [\MartinVogelSymbol{194}]
+ \definesymbol [Venus] [\MartinVogelSymbol{195}]
+ \definesymbol [Mars] [\MartinVogelSymbol{196}]
+ \definesymbol [Jupiter] [\MartinVogelSymbol{197}]
+ \definesymbol [Saturn] [\MartinVogelSymbol{198}]
+ \definesymbol [Uranus] [\MartinVogelSymbol{199}]
+ \definesymbol [Neptune] [\MartinVogelSymbol{200}]
+ \definesymbol [Pluto] [\MartinVogelSymbol{201}]
+
+\stopsymbolset
+
+\startsymbolset [zodiac]
+
+ \definesymbol [Aries] [\MartinVogelSymbol{224}]
+ \definesymbol [Taurus] [\MartinVogelSymbol{225}]
+ \definesymbol [Gemini] [\MartinVogelSymbol{226}]
+ \definesymbol [Cancer] [\MartinVogelSymbol{227}]
+ \definesymbol [Leo] [\MartinVogelSymbol{228}]
+ \definesymbol [Virgo] [\MartinVogelSymbol{229}]
+ \definesymbol [Libra] [\MartinVogelSymbol{230}]
+ \definesymbol [Scorpio] [\MartinVogelSymbol{231}]
+ \definesymbol [Sagittarius] [\MartinVogelSymbol{232}]
+ \definesymbol [Capricorn] [\MartinVogelSymbol{233}]
+ \definesymbol [Aquarius] [\MartinVogelSymbol{234}]
+ \definesymbol [Pisces] [\MartinVogelSymbol{235}]
+
+\stopsymbolset
+
+% Euro signs and CE
+
+\startsymbolset [europe]
+
+ \definesymbol [EUR] [\MartinVogelSymbol{164}]
+ \definesymbol [EURhv] [\MartinVogelSymbol {99}]
+ \definesymbol [EURcr] [\MartinVogelSymbol{100}]
+ \definesymbol [EURtm] [\MartinVogelSymbol{101}]
+ \definesymbol [CEsign] [\MartinVogelSymbol {67}]
+
+\stopsymbolset
+
+\unexpanded\def\euro{\symbol[europe][EUR]}
+
+% Numbers 0 to 9, @, A and p
+
+% taco: are these more general, like also in zapf dingbats?
+
+\startsymbolset [martinvogel 1]
+
+ \definesymbol [MVZero] [\MartinVogelSymbol {48}]
+ \definesymbol [MVOne] [\MartinVogelSymbol {49}]
+ \definesymbol [MVTwo] [\MartinVogelSymbol {50}]
+ \definesymbol [MVThree] [\MartinVogelSymbol {51}]
+ \definesymbol [MVFour] [\MartinVogelSymbol {52}]
+ \definesymbol [MVFive] [\MartinVogelSymbol {53}]
+ \definesymbol [MVSix] [\MartinVogelSymbol {54}]
+ \definesymbol [MVSeven] [\MartinVogelSymbol {55}]
+ \definesymbol [MVEight] [\MartinVogelSymbol {56}]
+ \definesymbol [MVNine] [\MartinVogelSymbol {57}]
+ \definesymbol [MVAt] [\MartinVogelSymbol {64}]
+ \definesymbol [MVA] [\MartinVogelSymbol{240}]
+ \definesymbol [MVp] [\MartinVogelSymbol{241}]
+
+\stopsymbolset
+
+% Office signs, crosses, circles, arrows
+
+\startsymbolset [martinvogel 2]
+
+ \definesymbol [CheckedBox] [\MartinVogelSymbol {86}]
+ \definesymbol [CrossedBox] [\MartinVogelSymbol {88}]
+ \definesymbol [PointingHand] [\MartinVogelSymbol {90}]
+ \definesymbol [WritingHand] [\MartinVogelSymbol {98}]
+ \definesymbol [Heart] [\MartinVogelSymbol{140}]
+ \definesymbol [FlatSteel] [\MartinVogelSymbol{150}]
+ \definesymbol [Squarepipe] [\MartinVogelSymbol{151}]
+ \definesymbol [Rectpipe] [\MartinVogelSymbol{152}]
+ \definesymbol [Lsteel] [\MartinVogelSymbol{153}]
+ \definesymbol [TTsteel] [\MartinVogelSymbol{154}]
+ \definesymbol [Circpipe] [\MartinVogelSymbol{155}]
+ \definesymbol [Tsteel] [\MartinVogelSymbol{156}]
+
+ \definesymbol [Stopsign] [\MartinVogelSymbol {33}]
+ \definesymbol [Beam] [\MartinVogelSymbol {34}]
+ \definesymbol [Bearing] [\MartinVogelSymbol {35}]
+ \definesymbol [Loosebearing] [\MartinVogelSymbol {36}]
+ \definesymbol [Fixedbearing] [\MartinVogelSymbol {37}]
+ \definesymbol [Lefttorque] [\MartinVogelSymbol {38}]
+ \definesymbol [Righttorque] [\MartinVogelSymbol {39}]
+ \definesymbol [Force] [\MartinVogelSymbol {40}]
+ \definesymbol [Lineload] [\MartinVogelSymbol {41}]
+ \definesymbol [Circles] [\MartinVogelSymbol {46}]
+ \definesymbol [Squaredot] [\MartinVogelSymbol{247}]
+
+ \definesymbol [Correspondes] [\MartinVogelSymbol {61}]
+ \definesymbol [Vectorarrowhigh] [\MartinVogelSymbol {80}]
+ \definesymbol [Vectorarrow] [\MartinVogelSymbol{112}]
+ \definesymbol [Rightarrow] [\MartinVogelSymbol {62}]
+ \definesymbol [Lightning] [\MartinVogelSymbol {69}]
+
+ \definesymbol [Snowflake] [\MartinVogelSymbol {42}]
+ \definesymbol [Kross] [\MartinVogelSymbol {43}]
+ \definesymbol [Cross] [\MartinVogelSymbol{134}]
+ \definesymbol [Celtcross] [\MartinVogelSymbol{135}]
+ \definesymbol [Ankh] [\MartinVogelSymbol{136}]
+ \definesymbol [Yingyang] [\MartinVogelSymbol {77}]
+
+ \definesymbol [Pickup] [\MartinVogelSymbol {0}] % ?
+ \definesymbol [Letter] [\MartinVogelSymbol {0}] % ?
+ \definesymbol [Mobilephone] [\MartinVogelSymbol {72}]
+ \definesymbol [Telephone] [\MartinVogelSymbol {84}]
+ \definesymbol [fax] [\MartinVogelSymbol{116}]
+ \definesymbol [FAX] [\MartinVogelSymbol{117}]
+ \definesymbol [Faxmachine] [\MartinVogelSymbol{118}]
+
+ \definesymbol [Clocklogo] [\MartinVogelSymbol {85}]
+ \definesymbol [Industry] [\MartinVogelSymbol {73}]
+ \definesymbol [Coffeecup] [\MartinVogelSymbol {75}]
+ \definesymbol [Info] [\MartinVogelSymbol{105}]
+ \definesymbol [Football] [\MartinVogelSymbol{111}]
+ \definesymbol [Frowny] [\MartinVogelSymbol{167}]
+ \definesymbol [Smiley] [\MartinVogelSymbol{169}]
+ \definesymbol [Bicycle] [\MartinVogelSymbol{174}]
+
+ \definesymbol [Rightscissors] [\MartinVogelSymbol {81}]
+ \definesymbol [Leftscissors] [\MartinVogelSymbol {83}]
+ \definesymbol [Cutright] [\MartinVogelSymbol{113}]
+ \definesymbol [Cutleft] [\MartinVogelSymbol{115}]
+ \definesymbol [Kutline] [\MartinVogelSymbol {82}] % K ?
+ \definesymbol [Cutline] [\MartinVogelSymbol{114}]
+
+\stopsymbolset
+
+% FHBO (Fachhochschule Bochum), face, humans, bat
+
+\startsymbolset [martinvogel 3]
+
+ \definesymbol [FHBOlogo] [\MartinVogelSymbol {70}]
+ \definesymbol [FHBOLOGO] [\MartinVogelSymbol{102}]
+ \definesymbol [Womanside] [\MartinVogelSymbol{204}]
+ \definesymbol [Manside] [\MartinVogelSymbol{205}]
+ \definesymbol [Womanfront] [\MartinVogelSymbol{206}]
+ \definesymbol [Manfront] [\MartinVogelSymbol{207}]
+ \definesymbol [Bat] [\MartinVogelSymbol{253}]
+ \definesymbol [Womanface] [\MartinVogelSymbol{254}]
+ \definesymbol [MartinVogel] [\MartinVogelSymbol{255}]
+
+\stopsymbolset
+
+%D \showsymbolset[astronomic]
+%D \showsymbolset[zodiac]
+%D \showsymbolset[europe]
+%D \showsymbolset[martinvogel 1]
+%D \showsymbolset[martinvogel 2]
+%D \showsymbolset[martinvogel 3]
+
+\endinput
diff --git a/tex/context/base/symb-nav.tex b/tex/context/base/symb-nav.tex
index 2e1bc07e2..60b77ad1d 100644
--- a/tex/context/base/symb-nav.tex
+++ b/tex/context/base/symb-nav.tex
@@ -17,7 +17,9 @@
\loadmapfile [original-context-symbol.map]
-\def\ContextNavigationGlyph#1{\getglyph{ContextNavigation}{\char#1}}
+% \def\ContextNavigationGlyph#1{\getglyph{ContextNavigation}{\char#1}}
+
+\def\ContextNavigationGlyph#1{\getrawglyph{contnav}{\char#1}}
\startsymbolset [navigation 1]
diff --git a/tex/context/base/symb-run.tex b/tex/context/base/symb-run.tex
new file mode 100644
index 000000000..6668f40cd
--- /dev/null
+++ b/tex/context/base/symb-run.tex
@@ -0,0 +1,53 @@
+%D \module
+%D [ file=symb-run, % code moved from symb-ini
+%D version=1998.07.20,
+%D title=\CONTEXT\ Symbol Libraries,
+%D subtitle=Runtime Macros,
+%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
+
+\gdef\doshowsymbolset[#1][#2]% looks like \showexternalfigureb
+ {\vbox\bgroup
+ \blanko
+ \getparameters[\??ss][\c!n=5,#2]%
+ \forcesymbolset[#1]%
+ \doifdefined{\??ss#1}
+ {\global\let\allfigures\empty
+ \doglobal\newcounter\figurecounter
+ \setupcolors[\c!status=\v!start]% to prevent mps color conversion
+ \mindermeldingen
+ \def\doshowsymbols% global needed due to grouping in alignment
+ {\expanded{\globalprocesscommalist[\getvalue{\??ss#1}]\noexpand\docommando}}%
+ \def\docommando##1%
+ {\vbox
+ {\forgetall
+ \tttf
+ \halign
+ {\hss\quad####\strut\quad\hss\cr
+ \symbol[##1]\quad{\red\ruledhbox{\black\symbol[##1]}}\cr
+ \tfx##1\cr}}%
+ \doglobal\increment\figurecounter
+ \ifnum\figurecounter=\@@ssn
+ \doglobal\newcounter\figurecounter
+ \def\next{\crcr\noalign{\vskip1ex}}%
+ \else
+ \def\next{&}%
+ \fi
+ \next}%
+ \tabskip\zeropoint \!!plus 1fill
+ \halign to \hsize
+ {&\hss##\hss\cr\doshowsymbols\crcr}}%
+ \blanko
+ \egroup}
+
+\gdef\showsymbolset%
+ {\dodoubleempty\doshowsymbolset}
+
+\protect \endinput
diff --git a/tex/context/base/syst-eet.tex b/tex/context/base/syst-eet.tex
deleted file mode 100644
index 8d606366f..000000000
--- a/tex/context/base/syst-eet.tex
+++ /dev/null
@@ -1,270 +0,0 @@
-% TACO: wordt ook de eerste spatie weggefilterd? Het komt
-% voor dat (om estetische redenen we hebben:
-%
-% \definieerkorps[12pt][rm]
-% [ tf=...,
-% tfa=...]
-%
-% Is evt wel in macro weg te werken, maar ik denk dat het
-% erin moet.
-%
-% vreemd, als 1 item en dan \delitem, number reports niets
-% ipv 0
-%
-% (dat gedoe met die expansie in commalists is niet nodig,
-% ik maak een specials processaction, nu nog incompatible
-% trouwens, komt wel goed.)
-
-\ifx\eeTeXversion\undefined \endinput \fi
-
-\writestatus{loading}{Context System Macros / eeTeX replacements}
-
-\unprotect
-
-%D Test loop
-%D
-%D \starttypen
-%D \dorecurse{20}{{\switchnaarkorps[lbr,10pt]}}
-%D \stoptypen
-%D
-%D \starttabulate[|c|c|c|]
-%D \NC pdftex \NC pdfetex \NC eetex \NC \NR
-%D \HL
-%D \NC 64 sec \NC 54 sec \NC 56/54 sec \NC \NR
-%D \stoptabulate
-%D
-%D Keep in mind that the font mechanism is optimized for
-%D \ETEX\ anyway.
-
-%D \macros
-%D {listsep}
-%D
-%D The list separator is a comma, optionally followed by a
-%D space or something similar.
-
-\listsep{, }
-
-%D \macros
-%D {appendtoks, prependtoks}
-%D
-%D Must deal with:
-%D
-%D \startypen
-%D \appendtoks \bgroup \to \sometoks -> \sometoks={\bgroup}
-%D \appendtoks {oeps}\to \sometoks -> \sometoks={{oeps}}
-%D \appendtoks oeps\to \sometoks -> \sometoks={oeps}
-%D \stoptypen
-
-\def\appendtoks%
- {\bgroup
- \let\bgroup\relax
- \futurelet\scratchtoken\doappendtoks}
-
-\def\doappendtoks%
- {\ifx\scratchtoken\normalbgroup
- \egroup\expandafter\dodoappendtoks
- \else
- \egroup\expandafter\donoappendtoks
- \fi}
-
-\def\dodoappendtoks#1\to#2{\dodoglobal\apptoks#2{{#1}}}
-\def\donoappendtoks#1\to#2{\dodoglobal\apptoks#2{#1}}
-
-\def\prependtoks%
- {\bgroup
- \let\bgroup\relax
- \futurelet\scratchtoken\doprependtoks}%
-
-\def\doprependtoks%
- {\ifx\scratchtoken\bgroup
- \egroup\expandafter\dodoprependtoks
- \else
- \egroup\expandafter\donoprependtoks
- \fi}
-
-\def\dodoprependtoks#1\to#2{\dodoglobal\pretoks#2{{#1}}}
-\def\donoprependtoks#1\to#2{\dodoglobal\pretoks#2{#1}}
-
-%D \macros
-%D {addtocommalist,removefromcommalist}
-%D
-%D The first one is rather straightforward, but the second
-%D one, well maybe another primitive makes sense.
-
-\def\addtocommalist#1#2%
- {\redoglobal\einsdef#2{#1}%
- \dodoglobal\edef#2{#2}}
-
-\def\removefromcommalist#1#2%
- {\scratchcounter\@EA\itemnumber\@EA#2\@EA{#1}%
- \redoglobal\delitem#2\scratchcounter to\garbage
- \dodoglobal\edef#2{#2}}
-
-%D \macros
-%D {getcommalistsize,getfromcommalist}
-%D
-%D Pretty short, these ones. We don't optimize for case 1
-%D and 2.
-
-\def\getcommalistsize[#1]%
- {\listdef\commalisttokens{#1}%
- \edef\commalistsize{\number\commalisttokens}}
-
-\def\getfromcommalist[#1]#2[#3]%
- {\listdef\commalisttokens{#1}%
- \getitem\commalisttokens#3to\commalistelement}
-
-%D \macros
-%D {dogetparameters}
-%D
-%D We skip the parameter passing.
-
-\def\dogetparameters#1[#2]#3[#4]%
- {\listdef\commalisttokens{#4}%
- \ifcase\commalisttokens\else
- \def\p!dogetparameter##1%
- {\p!doassign#1[#2][##1==\relax]}%
- \scanlist\commalisttokens\p!dogetparameter
- \fi}
-
-% tijdelijk:
-
-\def\dogetparameters#1[#2]#3[#4]%
- {\listdef\commalisttokens{,#4}% de comma is een hack
- \writestatus{assign}{\number\commalisttokens::\detokenize{#4}}%
- \delitem\commalisttokens1to\garbage
- \writestatus{assign}{\number\commalisttokens}% leeg als 0
- \ifcase\commalisttokens\else % vreemd
- \def\p!dogetparameter##1%
- {\writestatus{assign}{\detokenize{##1}}%
- \p!doassign#1[#2][##1==\relax]}%
- \scanlist\commalisttokens\p!dogetparameter
- \fi}
-
-%D \macros
-%D {doifinsetelse, doifinset, doifnotinset}
-%D
-%D We limit the number of parameter passes and don't share
-%D the common component.
-
-\long\def\doifinsetelse#1#2#3#4%
- {\elistdef\commalisttokens{#2}%
- \ifhasitem\commalisttokens{#1}#3\else#4\fi}
-
-\long\def\doifinset#1#2#3%
- {\elistdef\commalisttokens{#2}%
- \ifhasitem\commalisttokens{#1}#3\fi}
-
-\long\def\doifnotinset#1#2#3%
- {\elistdef\commalisttokens{#2}%
- \ifhasitem\commalisttokens{#1}\else#3\fi}
-
-%D \macros
-%D {doifcommonelse, doifcommon, doifnotcommon}
-%D
-%D Again, we don't share the common component.
-
-\long\def\doifcommonelse#1#2#3#4%
- {\listdef\commalisttokensa{#1}%
- \ifcase\commalisttokensa
- #4%
- \else
- \listdef\commalisttokensb{#2}%
- \ifcase\commalisttokensb
- #4%
- \else
- \ifnum\commalisttokensb>\commalisttokensa
- \ifsubset\commalisttokensb{#1}#3\else#4\fi
- \else
- \ifsubset\commalisttokensa{#2}#3\else#4\fi
- \fi
- \fi
- \fi}
-
-\long\def\doifcommon#1#2#3%
- {\listdef\commalisttokensa{#1}%
- \ifcase\commalisttokensa\else
- \listdef\commalisttokensb{#2}%
- \ifcase\commalisttokensb\else
- \ifnum\commalisttokensb>\commalisttokensa
- \ifsubset\commalisttokensb{#1}#3\fi
- \else
- \ifsubset\commalisttokensa{#2}#3\fi
- \fi
- \fi
- \fi}
-
-\long\def\doifnotcommon#1#2#3%
- {\listdef\commalisttokensa{#1}%
- \ifcase\commalisttokensa
- #3%
- \else
- \listdef\commalisttokensb{#2}%
- \ifcase\commalisttokensb
- #3%
- \else
- \ifnum\commalisttokensb>\commalisttokensa
- \ifsubset\commalisttokensb{#1}\else#3\fi
- \else
- \ifsubset\commalisttokensa{#2}\else#3\fi
- \fi
- \fi
- \fi}
-
-%D \macros
-%D {quitcommalist,quitprevcommalist}
-%D
-%D Watch the extra level, needed to quit the macro itself.
-
-%\def\quitcommalist {\quitlist 1 }
-%\def\quitprevcommalist{\quitlist 2 }
-
-%D \macros
-%D {processcommalist, processcommacommand}
-%D
-%D The \type {\ifcase} is needed!
-
-%%%\def\listexpandafter{\@EA\appdef\@EA\commalisttokens\@EA}
-%%%
-%%%\long\def\processcommalist[#1]#2%
-%%% {\listdef\templist{#1}%
-%%% \listdef\commalisttokens{}%
-%%% \scanlist\templist\listexpandafter
-%%% \scanlist\commalisttokens#2}
-%%%
-%%%\def\processcommacommand[#1]#2%
-%%% {\elistdef\templist{#1}%
-%%% \listdef\commalisttokens{}%
-%%% \scanlist\templist\listexpandafter
-%%% \scanlist\commalisttokens#2}
-
-%\long\def\processcommalist[#1]% #2%
-% {\listdef\commalisttokens{#1}%
-% \scanlist\commalisttokens}% #2}
-%
-%\long\def\processcommalist[#1]}% #2%
-% {\elistdef\commalisttokens{#1}%
-% \scanlist\commalisttokens}% #2}
-
-% \def\expandaction#1=>{}
-%
-% \def\processaction[#1]#2[#3]%
-% {\listdef\actionstoprocess{#3}%
-% \edef\!!stringa{#1}%
-% \ifx\!!stringa\empty
-% \scratchcounter=\subitemnumber\actionstoprocess{\s!default=>}%
-% \else
-% \scratchcounter=\subitemnumber\actionstoprocess{\!!stringa=>}%
-% \ifcase\scratchcounter
-% \scratchcounter=\subitemnumber\actionstoprocess{\s!unknown=>}%
-% \fi
-% \fi
-% \ifcase\scratchcounter\else
-% \getitem\actionstoprocess\scratchcounter to\actiontoprocess
-% % wordt \lastsubitem / geen \subitem: name clash
-% \@EA\@EA\@EA\expandaction\@EA\actiontoprocess
-% \fi}
-
-\protect
-
-\endinput
diff --git a/tex/context/base/syst-etx.tex b/tex/context/base/syst-etx.tex
index db56ae6bb..865432b95 100644
--- a/tex/context/base/syst-etx.tex
+++ b/tex/context/base/syst-etx.tex
@@ -1,4 +1,21 @@
-\ifx\undefined\unprotect \catcode`\@=11 \fi
+%D \module
+%D [ file=syst-etx,
+%D version=1999.03.17, % some time ...
+%D title=\CONTEXT\ System Macros,
+%D subtitle=Efficient \PLAIN\ \TEX\ 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.
+
+%D This module prepares \CONTEXT\ for \ETEX. We don't use
+%D the definition files that come with this useful \TEX\
+%D extension, but implement our own alternatives.
+
+\unprotect
%D Constants to be used with \type {\grouptype}.
@@ -89,22 +106,22 @@
\beginETEX \tracing...
\def\tracingall%
- {\tracingonline =\@ne
- \tracingcommands =\thr@@
- \tracingstats =\tw@
- \tracingpages =\@ne
- \tracingoutput =\@ne
- \tracinglostchars =\tw@
- \tracingmacros =\tw@
- \tracingparagraphs=\@ne
- \tracingrestores =\@ne
- \showboxbreadth =\maxdimen
- \showboxdepth =\maxdimen
- \tracinggroups =\@ne
- \tracingifs =\@ne
- \tracingscantokens=\@ne
- \tracingnesting =\@ne
- \tracingassigns =\tw@
+ {\tracingonline \@ne
+ \tracingcommands \thr@@
+ \tracingstats \tw@
+ \tracingpages \@ne
+ \tracingoutput \@ne
+ \tracinglostchars \tw@
+ \tracingmacros \tw@
+ \tracingparagraphs\@ne
+ \tracingrestores \@ne
+ \showboxbreadth \maxdimen
+ \showboxdepth \maxdimen
+ \tracinggroups \@ne
+ \tracingifs \@ne
+ \tracingscantokens\@ne
+ \tracingnesting \@ne
+ \tracingassigns \tw@
\errorstopmode}
\def\loggingall%
@@ -112,22 +129,22 @@
\tracingonline=\z@}
\def\tracingnone%
- {\tracingassigns =\z@
- \tracingnesting =\z@
- \tracingscantokens=\z@
- \tracingifs =\z@
- \tracinggroups =\z@
- \showboxdepth =\thr@@
- \showboxbreadth =5
- \tracingrestores =\z@
- \tracingparagraphs=\z@
- \tracingmacros =\z@
- \tracinglostchars =\@ne
- \tracingoutput =\z@
- \tracingpages =\z@
- \tracingstats =\z@
- \tracingcommands =\z@
- \tracingonline =\z@ }
+ {\tracingassigns \z@
+ \tracingnesting \z@
+ \tracingscantokens\z@
+ \tracingifs \z@
+ \tracinggroups \z@
+ \showboxdepth \thr@@
+ \showboxbreadth 5
+ \tracingrestores \z@
+ \tracingparagraphs\z@
+ \tracingmacros \z@
+ \tracinglostchars \@ne
+ \tracingoutput \z@
+ \tracingpages \z@
+ \tracingstats \z@
+ \tracingcommands \z@
+ \tracingonline \z@ }
\endETEX
@@ -171,9 +188,9 @@
%D We use some constants in the tests.
-\mathchardef\@@minallocation= 16
-\mathchardef\@@medallocation= 256
-\mathchardef\@@maxallocation=32767
+\mathchardef\@@minallocation = 16
+\mathchardef\@@medallocation = 256
+\mathchardef\@@maxallocation = 32767
%D I cannot imagine that more than~8 extra insert classes
%D are needed, so we say:
@@ -212,4 +229,4 @@
\let\normalprotected = \protected
\let\normalunexpanded = \unexpanded
-\ifx\undefined\unprotect \catcode`\@=12 \fi \endinput
+\protect \endinput
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index afda909c2..ed2240c83 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -32,7 +32,7 @@
{\if]#1\else
\expandafter\def\csname\rawparameterprefix#1\endcsname{#2}%
\expandafter\rawsetparameter
- \fi}%
+ \fi}
%D \macros
%D {doglobal,
@@ -48,8 +48,7 @@
\def\doglobal%
{\let\redoglobal\global
- \def\dodoglobal%
- {\resetglobal\global}}
+ \def\dodoglobal{\resetglobal\global}}
\def\resetglobal%
{\let\redoglobal\relax
@@ -62,11 +61,14 @@
\def\doglobal%
{\ifx\redoglobal\relax
\let\redoglobal\global
- \def\dodoglobal{\resetglobal\global}%
+ \let\dodoglobal\@@dodoglobal
%\else
% \writestatus{system}{global not reset, warn me!}%
\fi}
+\def\@@dodoglobal
+ {\resetglobal\global}
+
\def\saveglobal
{\let\@@dodoglobal\dodoglobal
\let\@@redoglobal\redoglobal}
@@ -187,30 +189,108 @@
\def\newcounter#1%
{\dodoglobal\let#1\zerocountervalue}
-\def\dodododoincrement(#1,#2)%
+% This is the original implementation:
+%
+% \def\dodododoincrement(#1,#2)%
+% {\ifx#1\undefined
+% \redoglobal\let#1\zerocountervalue
+% \else\ifx#1\relax % \csname...\endcsname
+% \redoglobal\let#1\zerocountervalue
+% \fi\fi
+% \scratchcounter=#2\relax
+% \scratchcounter=\incrementsign\scratchcounter
+% \advance\scratchcounter #1\relax
+% \dodoglobal\edef#1{\the\scratchcounter}}
+%
+% \def\dododoincrement#1%
+% {\dodododoincrement(#1,1)}
+%
+% \def\dodoincrement(#1%
+% {\doifnextcharelse,%
+% {\dodododoincrement(#1}{\dodododoincrement(#1,1}}
+%
+% \def\doincrement#1%
+% {\def\incrementsign{#1}%
+% \doifnextcharelse(\dodoincrement\dododoincrement}
+%
+% \def\increment{\doincrement+}
+% \def\decrement{\doincrement-}
+%
+% And this is the one optimized for speed:
+
+\beginTEX
+
+\def\dodoindecrement#1(#2,#3)%
+ {\ifx#2\undefined
+ \redoglobal\let#2\zerocountervalue
+ \else\ifx#2\relax % \csname...\endcsname
+ \redoglobal\let#2\zerocountervalue
+ \fi\fi
+ \scratchcounter#3\relax
+ \scratchcounter#1\scratchcounter
+ \advance\scratchcounter#2\relax
+ \dodoglobal\edef#2{\the\scratchcounter}}
+
+\def\dodoincrement(#1%
+ {\doifnextcharelse,{\dodoindecrement+(#1}{\dodoindecrement+(#1,1}}
+
+\def\dododecrement(#1%
+ {\doifnextcharelse,{\dodoindecrement-(#1}{\dodoindecrement-(#1,1}}
+
+\def\doincrement#1% 10% faster alternative
{\ifx#1\undefined
- \redoglobal\let#1\zerocountervalue
+ \dodoglobal\edef#1{1}%
\else\ifx#1\relax % \csname...\endcsname
- \redoglobal\let#1\zerocountervalue
- \fi\fi
- \scratchcounter=#2\relax
- \scratchcounter=\incrementsign\scratchcounter
- \advance\scratchcounter #1\relax
+ \dodoglobal\edef#1{1}%
+ \else
+ \fastincrement#1%
+ \fi\fi}
+
+\def\dodecrement#1% 10% faster alternative
+ {\ifx#1\undefined
+ \dodoglobal\edef#1{\minusone}%
+ \else\ifx#1\relax % \csname...\endcsname
+ \dodoglobal\edef#1{\minusone}%
+ \else
+ \fastdecrement#1%
+ \fi\fi}
+
+\def\fastdecrement#1% 50% faster alternative
+ {\scratchcounter#1\advance\scratchcounter\minusone
+ \dodoglobal\edef#1{\the\scratchcounter}}
+
+\def\fastincrement#1% 50% faster alternative
+ {\scratchcounter#1\advance\scratchcounter\plusone
\dodoglobal\edef#1{\the\scratchcounter}}
-\def\dododoincrement#1%
- {\dodododoincrement(#1,1)}
+\endTEX
+
+\beginETEX \numexpr
+
+\def\doindecrement#1#2%
+ {\dodoglobal\edef#2%
+ {\the\numexpr(\ifx#2\undefined\else\ifx#2\relax\else#2\fi\fi#11)}}
+
+\def\doincrement{\doindecrement+}
+\def\dodecrement{\doindecrement-}
+
+\def\dodoindecrement#1#2,#3)%
+ {\dodoglobal\edef#2%
+ {\the\numexpr(\ifx#2\undefined\else\ifx#2\relax\else#2\fi\fi#1#3)}}
\def\dodoincrement(#1%
- {\doifnextcharelse,%
- {\dodododoincrement(#1}{\dodododoincrement(#1,1}}
+ {\doifnextcharelse,{\dodoindecrement+#1}{\dodoindecrement+#1,1}}
-\def\doincrement#1%
- {\def\incrementsign{#1}%
- \doifnextcharelse(\dodoincrement\dododoincrement}
+\def\dododecrement(#1%
+ {\doifnextcharelse,{\dodoindecrement-#1}{\dodoindecrement-#1,1}}
+
+\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr(#1+1)}}
+\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr(#1-1)}}
+
+\endETEX
-\def\increment{\doincrement+}
-\def\decrement{\doincrement-}
+\def\increment{\doifnextcharelse(\dodoincrement\doincrement}
+\def\decrement{\doifnextcharelse(\dododecrement\dodecrement}
%D \macros
%D {newsignal}
@@ -291,6 +371,16 @@
{\expandafter\gobbleoneargument\string}
%D \macros
+%D {savenormalmeaning}
+%D
+%D We will use this one in:
+
+\def\savenormalmeaning#1%
+ {\ifundefined{normal\strippedcsname#1}%
+ \letvalue{normal\strippedcsname#1}#1%
+ \fi}
+
+%D \macros
%D {newconditional,
%D settrue, setfalse,
%D ifconditional}
@@ -329,11 +419,8 @@
%D conditionals. The next implementation is abaou as fast
%D and just as straightforward:
-\def\settrue#1%
- {\chardef#1=0 }
-
-\def\setfalse#1%
- {\chardef#1=1 }
+\def\settrue #1{\chardef#1\zerocount}
+\def\setfalse#1{\chardef#1\plusone}
\let\newconditional = \setfalse
\let\ifconditional = \ifcase
@@ -394,57 +481,15 @@
%D macros. The real \COUNTERS\ are hidden from the user because
%D we don't want any interference.
-\def\@@irecurse{@@irecurse} % stepper
-\def\@@nrecurse{@@nrecurse} % number of steps
-\def\@@srecurse{@@srecurse} % step
-\def\@@drecurse{@@drecurse} % direction, < or >
-\def\@@arecurse{@@arecurse} % action
-
\newcount\outerrecurse
\newcount\innerrecurse
-\def\recursedepth%
- {\the\outerrecurse}
+\def\recursedepth{\the\outerrecurse}
+\def\recurselevel{0}
\let\nextrecurse\relax
-% not entirely correct
-%
-% \long\def\dostepwiserecurse#1#2#3#4%
-% {%\let\nextrecurse\relax
-% \ifcase#2\relax
-% \let\recurselevel\zerocountervalue
-% \let\nextrecurse\relax
-% \else
-% \global\advance\outerrecurse by 1
-% \setevalue{\@@irecurse\recursedepth}{\number#1}%
-% \setevalue{\@@nrecurse\recursedepth}{\number#2}%
-% \setevalue{\@@srecurse\recursedepth}{\number#3}%
-% \ifnum#3>0\relax\ifnum#2<#1\relax
-% \else
-% \setevalue{\@@drecurse\recursedepth}{>}%
-% \long\setvalue{\@@arecurse\recursedepth}{#4}%
-% \let\nextrecurse\dodorecurse
-% \fi\fi
-% \ifnum#3<0\relax\ifnum#1<#2\relax
-% \else
-% \setevalue{\@@drecurse\recursedepth}{<}%
-% \long\setvalue{\@@arecurse\recursedepth}{#4}%
-% \let\nextrecurse\dodorecurse
-% \fi\fi
-% \fi
-% \nextrecurse}
-
-\long\def\dosetstepwiserecurse#1#2#3#4#5%
- {\global\advance\outerrecurse by 1
- \setevalue{\@@drecurse\recursedepth}{#1}%
- \setevalue{\@@irecurse\recursedepth}{\number#2}%
- \setevalue{\@@nrecurse\recursedepth}{\number#3}%
- \setevalue{\@@srecurse\recursedepth}{\number#4}%
- \long\setvalue{\@@arecurse\recursedepth}{#5}%
- \dodorecurse}
-
-%D Acceptable.
+%D Acceptable:
%D
%D \starttypen
%D \long\def\dostepwiserecurse#1#2#3%
@@ -458,49 +503,158 @@
%D \nextrecurse{#1}{#2}{#3}}
%D \stoptypen
%D
-%D Better.
+%D Better:
+%D
+%D \starttypen
+%D \long\def\dostepwiserecurse#1#2#3%
+%D {\let\nextrecurse\gobblefourarguments
+%D \ifnum#3>0\relax \ifnum#2<#1\relax \else
+%D \def\nextrecurse{\dosetstepwiserecurse>}%
+%D \fi \else \ifnum#3<0\relax \ifnum#1<#2\relax \else
+%D \def\nextrecurse{\dosetstepwiserecurse<}%
+%D \fi \fi \fi
+%D \nextrecurse{#1}{#2}{#3}}
+%D
+%D \def\@@irecurse{@@irecurse} % stepper
+%D \def\@@nrecurse{@@nrecurse} % number of steps
+%D \def\@@srecurse{@@srecurse} % step
+%D \def\@@drecurse{@@drecurse} % direction, < or >
+%D \def\@@arecurse{@@arecurse} % action
+%D
+%D \long\def\dosetstepwiserecurse#1#2#3#4#5%
+%D {\global\advance\outerrecurse 1
+%D \setevalue{\@@drecurse\recursedepth}{#1}%
+%D \setevalue{\@@irecurse\recursedepth}{\number#2}%
+%D \setevalue{\@@nrecurse\recursedepth}{\number#3}%
+%D \setevalue{\@@srecurse\recursedepth}{\number#4}%
+%D \long\setvalue{\@@arecurse\recursedepth}{#5}%
+%D \dodorecurse}
+%D
+%D \def\donorecurse%
+%D {}
+%D
+%D \def\dododorecurse%
+%D {\edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}%
+%D \getvalue{\@@arecurse\recursedepth}%
+%D \edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}%
+%D \innerrecurse\recurselevel
+%D \advance\innerrecurse \csname\@@srecurse\recursedepth\endcsname
+%D \setevalue{\@@irecurse\recursedepth}{\the\innerrecurse}%
+%D \dodorecurse}
+%D
+%D \def\dodorecurse%
+%D {\ifnum\csname\@@irecurse\recursedepth\endcsname
+%D \csname\@@drecurse\recursedepth\endcsname
+%D \csname\@@nrecurse\recursedepth\endcsname\relax
+%D \expandafter\nododorecurse
+%D \else
+%D \expandafter\dododorecurse
+%D \fi}
+%D
+%D \def\nododorecurse
+%D {\global\advance\outerrecurse -1
+%D \edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}}
+%D \stoptypen
+%D
+%D Cleaner and much faster:
+
+\def\@@irecurse{@@ir@@} % ecurse} % stepper
+\def\@@arecurse{@@ar@@} % ecurse} % action
-\long\def\dostepwiserecurse#1#2#3%
- {\let\nextrecurse\gobblefourarguments
+% \mathchardef
+
+\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4
+ {\global\advance\outerrecurse \plusone
+ \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#4}%
+ \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel
\ifnum#3>0\relax
\ifnum#2<#1\relax
+ \let\nextrecurse\exitstepwiserecurse
\else
- \def\nextrecurse{\dosetstepwiserecurse>}%
+ \let\nextrecurse\dodostepwiserecurse
\fi
\else
\ifnum#3<0\relax
\ifnum#1<#2\relax
+ \let\nextrecurse\exitstepwiserecurse
\else
- \def\nextrecurse{\dosetstepwiserecurse<}%
+ \let\nextrecurse\dodostepwisereverse
\fi
+ \else
+ \let\nextrecurse\exitstepwiserecurse
\fi
- \fi
- \nextrecurse{#1}{#2}{#3}}
+ \fi\expanded{\nextrecurse{\number#1}{\number#2}{\number#3}}}
-\def\donorecurse%
- {}
+\beginETEX \numexpr
-\def\dododorecurse%
- {\edef\recurselevel{\getvalue{\@@irecurse\recursedepth}}%
- \getvalue{\@@arecurse\recursedepth}%
- \edef\recurselevel{\getvalue{\@@irecurse\recursedepth}}%
- \innerrecurse=\recurselevel
- \advance\innerrecurse by \getvalue{\@@srecurse\recursedepth}\relax
- \setevalue{\@@irecurse\recursedepth}{\the\innerrecurse}%
- \dodorecurse}
-
-\def\dodorecurse%
- {\ifnum\getvalue{\@@irecurse\recursedepth}
- \getvalue{\@@drecurse\recursedepth}
- \getvalue{\@@nrecurse\recursedepth}\relax
- \global\advance\outerrecurse by -1
- \edef\recurselevel{\getvalue{\@@irecurse\recursedepth}}%
+\long\def\dodostepwiserecurse#1#2#3% from to step
+ {\ifnum#1>#2\relax
+ \@EA\nodostepwiserecurse
\else
- \expandafter\dododorecurse
- \fi}
+ \def\recurselevel{#1}%
+ \@EAEAEA\redostepwiserecurse\@EA
+ \fi\@EA{\the\numexpr\recurselevel+#3\relax}{#2}{#3}}
+
+\endETEX
+
+\beginTEX
+
+\long\def\dodostepwiserecurse#1#2#3% from to step
+ {\ifnum#1>#2\relax
+ \@EA\nodostepwiserecurse
+ \else
+ \def\recurselevel{#1}%
+ \innerrecurse#1\advance\innerrecurse#3\relax
+ \@EAEAEA\redostepwiserecurse\@EA
+ \fi\@EA{\the\innerrecurse}{#2}{#3}}
+
+\endTEX
+
+\def\redostepwiserecurse
+ {\csname\@@arecurse\recursedepth\endcsname\dodostepwiserecurse}
+
+\beginETEX \numexpr
+
+\long\def\dodostepwisereverse#1#2#3% from to step
+ {\ifnum#1<#2\relax
+ \@EA\nodostepwiserecurse
+ \else
+ \def\recurselevel{#1}%
+ \@EAEAEA\redostepwisereverse\@EA
+ \fi\@EA{\the\numexpr\recurselevel#3\relax}{#2}{#3}}
+
+\endETEX
+
+\beginTEX
+
+\long\def\dodostepwisereverse#1#2#3% from to step
+ {\ifnum#1<#2\relax
+ \@EA\nodostepwiserecurse
+ \else
+ \def\recurselevel{#1}%
+ \innerrecurse#1\relax
+ \advance\innerrecurse#3\relax
+ \@EAEAEA\redostepwisereverse\@EA
+ \fi\@EA{\the\innerrecurse}{#2}{#3}}
+
+\endTEX
+
+\def\redostepwisereverse
+ {\csname\@@arecurse\recursedepth\endcsname\dodostepwisereverse}
+
+\def\exitstepwiserecurse
+ {\nodostepwiserecurse\relax}
+
+\def\nodostepwiserecurse#1#2#3#4%
+ {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
+ \global\advance\outerrecurse \minusone}
+
+\def\nonostepwiserecurse#1#2#3%
+ {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
+ \global\advance\outerrecurse \minusone}
\def\dorecurse#1%
- {\dostepwiserecurse{1}{#1}{1}}
+ {\dostepwiserecurse1{#1}1}
%D As we can see here, the simple command \type{\dorecurse} is
%D a special case of the more general:
@@ -518,6 +672,64 @@
%D \dostepwiserecurse {10} {1} {-2} {...}
%D \stoptypen
%D
+%D Because the simple case is used often, we implement it
+%D more efficiently:
+
+\long\def\dorecurse#1%
+ {\ifcase#1\relax
+ \expandafter\gobbletwoarguments
+ \or
+ \expandafter\ydorecurse
+ \else
+ \expandafter\xdorecurse
+ \fi{#1}}
+
+\long\def\xdorecurse#1#2%
+ {\global\advance\outerrecurse \plusone
+ \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#2}%
+ \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel
+ \@EA\dodorecurse\@EA1{\number#1}}
+
+\long\def\ydorecurse#1#2%
+ {\global\advance\outerrecurse \plusone
+ \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel
+ \def\recurselevel{1}%
+ #2%
+ \@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
+ \global\advance\outerrecurse \minusone}
+
+\beginETEX \numexpr
+
+\long\def\dodorecurse#1#2% from to
+ {\ifnum#1>#2\relax
+ \@EA\nodorecurse
+ \else
+ \def\recurselevel{#1}%
+ \@EAEAEA\redorecurse
+ \fi\@EA{\the\numexpr\recurselevel+1\relax}{#2}}
+
+\endETEX
+
+\beginTEX
+
+\long\def\dodorecurse#1#2% from to
+ {\ifnum#1>#2\relax
+ \@EA\nodorecurse
+ \else
+ \def\recurselevel{#1}%
+ \innerrecurse#1\advance\innerrecurse\plusone
+ \@EAEAEA\redorecurse
+ \fi\@EA{\the\innerrecurse}{#2}}
+
+\endTEX
+
+\def\redorecurse
+ {\csname\@@arecurse\recursedepth\endcsname\dodorecurse}
+
+\def\nodorecurse#1#2#3%
+ {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
+ \global\advance\outerrecurse \minusone }
+
%D The third alternative looks a bit different and uses a
%D pseudo counter. When this macro is nested, we have to use
%D different counters. This time we use keywords.
@@ -536,11 +748,11 @@
%D The use of \type{\od} as a dilimiter would have made nested
%D use more problematic.
+% maybe this one will becoem obsolete
+
\def\for#1=#2\to#3\step#4\do#5%
{\dostepwiserecurse{#2}{#3}{#4}
- {\edef#1{\recurselevel}%
- #5%
- \edef#1{\recurselevel}}}
+ {\let#1\recurselevel#5\let#1\recurselevel}}
%D \macros
%D {doloop,exitloop}
@@ -611,20 +823,64 @@
%D \def\looplevel{\recurselevel}
%D \def\loopdepth{\recursedepth}
%D \stoptypen
+%D
+%D We don't have to declare new counters for \type{\looplevel}
+%D and \type{\loopdepth} because we can use \type{\recurselevel}
+%D and \type{\recursedepth}.
%D
%D We prefer however a more byte saving implementation, that
%D executes of course a bit slower.
+%D
+%D \starttypen
+%D \def\doloop%
+%D {\dostepwiserecurse1\maxdimen1}
+%D
+%D \def\exitloop%
+%D {\letvalue{\@@irecurse\recursedepth}\maxdimen}
+%D \stoptypen
+%D
+%D Although, the next version is faster because it used the
+%D simple loop.
-\def\doloop%
- {\dostepwiserecurse{1}{\maxdimen}{1}}
+\let\endofloop\donothing
-\def\exitloop%
- {\setvalue{\@@irecurse\recursedepth}{\maxdimen}}
+\long\def\doloop#1%
+ {\global\advance\outerrecurse \plusone
+ \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#1}%
+ \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel
+ \let\endofloop\dodoloop
+ \dodoloop1}
+
+\beginETEX \numexpr
+
+\long\def\dodoloop#1%
+ {\def\recurselevel{#1}%
+ \@EA\redoloop\@EA{\the\numexpr\recurselevel+1\relax}}
+
+\endETEX
+
+\beginTEX
+
+\long\def\dodoloop#1%
+ {\def\recurselevel{#1}%
+ \innerrecurse#1\advance\innerrecurse\plusone
+ \@EA\redoloop\@EA{\the\innerrecurse}}
+
+\endTEX
+
+\def\redoloop
+ {\csname\@@arecurse\recursedepth\endcsname\endofloop}
+
+\def\nodoloop#1%
+ {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
+ \global\advance\outerrecurse \minusone }
+
+\def\exitloop % \exitloop quits at end
+ {\let\endofloop\nodoloop}
+
+\long\def\exitloopnow#1\endofloop % \exitloopnow quits directly
+ {\nodoloop}
-%D We don't declare new counters for \type{\looplevel} and
-%D \type{\loopdepth} because one can use \type{\recurselevel}
-%D and \type{\recursedepth}.
-%D
%D The loop is executed at least once, so beware of situations
%D like:
%D
@@ -638,6 +894,10 @@
%D \starttypen
%D \doloop {\ifwhatever \exitloop \else some commands\fi}
%D \stoptypen
+%D
+%D You can also quit a loop immediately, by using \type
+%D {\exitloopnow} instead. Beware, this is more sensitive
+%D for conditional errors.
%D \macros
%D {newevery,everyline,EveryLine,EveryPar}
@@ -707,16 +967,31 @@
%
% cleaner and more efficient
+%\def\dowithevery#1%
+% {\def\dodowithevery%
+% {\ifcase\csname c\strippedcsname#1\endcsname \expandafter\chardef
+% \csname c\strippedcsname#1\endcsname=1
+% \csname t\strippedcsname#1\endcsname=#1%
+% \fi
+% \edef\next%
+% {#1={\the\csname t\strippedcsname#1\endcsname\the\scratchtoks}}%
+% \next}%
+% \afterassignment\dodowithevery\scratchtoks}
+%
+% more efficient:
+
+\def\dodowithevery#1%
+ {\ifcase\csname c\strippedcsname#1\endcsname \expandafter\chardef
+ \csname c\strippedcsname#1\endcsname1
+ \csname t\strippedcsname#1\endcsname#1%
+ \fi
+ \edef\next%
+ {#1{\the\csname t\strippedcsname#1\endcsname\the\scratchtoks}}%
+ \next}
+
\def\dowithevery#1%
- {\def\dodowithevery%
- {\ifcase\csname c\strippedcsname#1\endcsname \expandafter\chardef
- \csname c\strippedcsname#1\endcsname=1
- \csname t\strippedcsname#1\endcsname=#1%
- \fi
- \edef\next%
- {#1={\the\csname t\strippedcsname#1\endcsname\the\scratchtoks}}%
- \next}%
- \afterassignment\dodowithevery\scratchtoks}
+ {\def\next{\dodowithevery#1}%
+ \afterassignment\next\scratchtoks}
\bgroup \let\newtoks\relax % plain safe (\outer)
@@ -724,7 +999,7 @@
{\ifx#1\undefined\csname newtoks\endcsname#1\fi % plain safe (\outer)
\ifx#2\relax\else\ifx#2\undefined
\expandafter\newtoks\csname t\strippedcsname#1\endcsname
- \expandafter\chardef\csname c\strippedcsname#1\endcsname=0
+ \expandafter\chardef\csname c\strippedcsname#1\endcsname\zerocount
\def#2{\dowithevery#1}%
\fi\fi}
@@ -961,34 +1236,27 @@
%D care of (first) arguments that are delimited by \type{[ ]},
%D but the faster \type{\ExpandAfter} does not.
-%D RECONSIDER
-
\def\simpleExpandFirstAfter#1%
- {\edef\!!stringa{#1}%
- \@EA\ExpandCommand\@EA{\!!stringa}}
+ {\edef\@@expanded{\noexpand\ExpandCommand{#1}}\@@expanded}
\def\complexExpandFirstAfter[#1]%
- {\edef\!!stringa{#1}%
- \@EA\ExpandCommand\@EA[\!!stringa]}
+ {\edef\@@expanded{\noexpand\ExpandCommand[#1]}\@@expanded}
\def\ExpandFirstAfter#1%
- {\let\ExpandCommand#1\complexorsimple\ExpandFirstAfter}
+ {\let\ExpandCommand#1%
+ \doifnextcharelse[\complexExpandFirstAfter\simpleExpandFirstAfter}
\def\ExpandSecondAfter#1#2#3%
- {\edef\!!stringa{#2}% was \def
- \edef\!!stringb{#3}%
- \@EA#1\@EA{\@EA\!!stringa\@EA}\@EA{\!!stringb}}
+ {\scratchtoks{#2}%
+ \edef\@@expanded{\noexpand#1{\the\scratchtoks}{#3}}\@@expanded}
\def\ExpandBothAfter#1#2#3%
- {\edef\!!stringa{#2}%
- \edef\!!stringb{#3}%
- \@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA\!!stringa\@EA}\@EA{\!!stringb}}
+ {\edef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded}
\def\ExpandAfter#1#2%
- {\edef\!!stringa{#2}%
- \@EA#1\@EA{\!!stringa}}
+ {\edef\@@expanded{\noexpand#1{#2}}\@@expanded}
-%D Now we can for instance redefine \type{\ifinstringelse} as:
+%D Now we can for instance define \type{\ifinstringelse} as:
\def\ifinstringelse%
{\ExpandBothAfter\p!doifinstringelse}
@@ -1057,9 +1325,9 @@
%D constructions like:
%D
%D \starttypen
-%D \setupfoottexts[...][...]
-%D \setupfoottexts[margin][...][...]
-%D \setupfoottexts[\v!margin][...][...]
+%D \setupfootertexts[...][...]
+%D \setupfootertexts[margin][...][...]
+%D \setupfootertexts[\v!margin][...][...]
%D \stoptypen
%D
%D where \type{...} can be anything legally \TEX.
@@ -1071,17 +1339,10 @@
{\expandafter\convertargument#1\to#2}
{}}
-\def\simpleConvertConstantAfter#1#2%
- {\CheckConstantAfter{#1}\asciiA
- \CheckConstantAfter{#2}\asciiB
- \ConvertCommand{\asciiA}{\asciiB}}
-
-\def\complexConvertConstantAfter[#1]%
- {\doConvertConstantAfter{#1}%
- \@EA\ConvertCommand\@EA[\!!stringa]}
-
-\def\ConvertConstantAfter#1%
- {\let\ConvertCommand#1\complexorsimple\ConvertConstantAfter}
+\def\ConvertConstantAfter#1#2#3%
+ {\CheckConstantAfter{#2}\asciiA
+ \CheckConstantAfter{#3}\asciiB
+ #1{\asciiA}{\asciiB}}
%D \macros
%D {assignifempty}
@@ -1094,12 +1355,12 @@
%D
%D We don't explicitly test if the macro is defined.
-\def\assignifempty#1#2%
- {\doifnot{#1}{}
- {\def#1{#2}}}
+\def\assignifempty#1#2% can be sped up
+ {\doifnot{#1}{}{\def#1{#2}}}
%D \macros
-%D {gobbleuntil,grabuntil,processbetween}
+%D {gobbleuntil,grabuntil,gobbleuntilrelax,
+%D processbetween,processuntil}
%D
%D In \TEX\ gobbling usually stand for skipping arguments, so
%D here are our gobbling macros.
@@ -1160,7 +1421,7 @@
%D leads to: \type{\message{Hello again!}}. The command
%D
%D \starttypen
-%D \gobbleuntil\command
+%D \gobbleuntil{sequence}
%D \stoptypen
%D
%D is related to these commands. This one simply throws away
@@ -1173,6 +1434,18 @@
\def\gobbleuntil#1%
{\long\def\next##1#1{}\next}
+\def\gobbleuntilrelax#1\relax
+ {}
+
+%D The next one simply expands the pickup up tokens.
+%D
+%D \starttypen
+%D \processuntil{sequence}
+%D \stoptypen
+
+\def\processuntil#1%
+ {\long\def\next##1#1{##1}\next}
+
%D \macros
%D {groupedcommand}
%D
@@ -1311,18 +1584,24 @@
%D line||ending token is treated as a blank space. So the final
%D implementation became:
+%\long\unexpanded\def\groupedcommand#1#2%
+% {\bgroup
+% \def\dogroupedcommand%
+% {\ifx\next\bgroup
+% \def\\{\egroup\HandleGroup{#1}{#2}}%
+% \else\ifx\next\blankspace
+% \def\\ {\egroup\groupedcommand{#1}{#2}}%
+% \else
+% \def\\{\egroup\HandleNoGroup{#1}{#2}}%
+% \fi\fi
+% \\}%
+% \futurelet\next\dogroupedcommand}
+%
+% compatible ?
+
\long\unexpanded\def\groupedcommand#1#2%
- {\bgroup
- \def\dogroupedcommand%
- {\ifx\next\bgroup
- \def\\{\egroup\HandleGroup{#1}{#2}}%
- \else\ifx\next\blankspace
- \def\\ {\egroup\groupedcommand{#1}{#2}}%
- \else
- \def\\{\egroup\HandleNoGroup{#1}{#2}}%
- \fi\fi
- \\}%
- \futurelet\next\dogroupedcommand}
+ {\doifnextcharelse\bgroup
+ {\HandleGroup{#1}{#2}}{\HandleNoGroup{#1}{#2}}}
%D Users should be aware of the fact that grouping can
%D interfere with ones paragraph settings that are executed
@@ -1417,18 +1696,32 @@
\let\endoflinetoken=^^M
+%\def\doGotoPar%
+% {\ifx\nextchar\blankspace
+% \let\donext\GotoPar
+% \else\ifx\nextchar\endoflinetoken
+% \let\donext\GotoPar
+% \else
+% \def\donext%
+% {\the\BeforePar
+% \BeforePar\emptytoks
+% \nextchar}%
+% \fi\fi
+% \donext}
+
\def\doGotoPar%
{\ifx\nextchar\blankspace
- \let\donext\GotoPar
+ \@EA\GotoPar
\else\ifx\nextchar\endoflinetoken
- \let\donext\GotoPar
+ \@EAEAEA\GotoPar
\else
- \def\donext%
- {\the\BeforePar
- \BeforePar{}%
- \nextchar}%
- \fi\fi
- \donext}
+ \@EAEAEA\dodoGotoPar
+ \fi\fi}
+
+\def\dodoGotoPar
+ {\the\BeforePar
+ \BeforePar\emptytoks
+ \nextchar}
\def\GotoPar%
{\afterassignment\doGotoPar\let\nextchar=}
@@ -1437,19 +1730,33 @@
%D primitive, which can lead to unexpected results, depending
%D in the context.
+% \def\GetPar%
+% {\edef\next%
+% {\BeforePar
+% {\the\BeforePar
+% \BeforePar\emptytoks
+% \bgroup
+% \def\par%
+% {\egroup
+% \par
+% \the\AfterPar
+% \BeforePar\emptytoks
+% \AfterPar\emptytoks}}}%
+% \next
+% \GotoPar}
+
\def\GetPar%
- {\edef\next%
+ {\expanded
{\BeforePar
{\the\BeforePar
- \BeforePar{}%
+ \BeforePar\emptytoks
\bgroup
- \def\par%
+ \def\par
{\egroup
\par
\the\AfterPar
- \BeforePar{}%
- \AfterPar{}}}}%
- \next
+ \BeforePar\emptytoks
+ \AfterPar\emptytoks}}}%
\GotoPar}
%D \macros
@@ -1515,14 +1822,19 @@
%D argument. This command permits for instance chapters to
%D have no title.
+%\def\dowithpargument#1%
+% {\def\nextpar##1 \par{#1{##1}}%
+% \def\nextarg##1{#1{##1}}%
+% \doifnextcharelse{\bgroup}
+% {\nextarg}
+% {\doifnextcharelse{\par}
+% {#1{}}
+% {\nextpar}}}
+
\def\dowithpargument#1%
{\def\nextpar##1 \par{#1{##1}}%
\def\nextarg##1{#1{##1}}%
- \doifnextcharelse{\bgroup}
- {\nextarg}
- {\doifnextcharelse{\par}
- {#1{}}
- {\nextpar}}}
+ \doifnextcharelse\bgroup\nextarg{\doifnextcharelse\par{#1{}}\nextpar}}
%D The \type{p} in the previous command stands for paragraph.
%D When we want to act upon words we can use the \type{w}
@@ -1562,12 +1874,17 @@
%D
%D We've chosen:
+%\def\dowithwargument#1%
+% {\def\nextwar##1 {#1{##1}}%
+% \def\nextarg##1{#1{##1}}%
+% \doifnextcharelse{\bgroup}
+% {\nextarg}
+% {\nextwar}}
+
\def\dowithwargument#1%
{\def\nextwar##1 {#1{##1}}%
\def\nextarg##1{#1{##1}}%
- \doifnextcharelse{\bgroup}
- {\nextarg}
- {\nextwar}}
+ \doifnextcharelse\bgroup\nextarg\nextwar}
%D \macros
%D {dorepeat,dorepeatwithcommand}
@@ -1599,25 +1916,28 @@
%D a row. In both commands, the \type{n*} is optional. When this
%D specification is missing, the command executes once.
-\long\def\dodorepeat[#1*#2*#3*]%
- {\doifelse{#3}{}
- {#1}
- {\dorecurse{#1}{#2}}}
+\def\dorepeat[#1]%
+ {\dodorepeat#1*\empty*\relax}
-\long\def\dorepeat[#1]%
- {\dodorepeat[#1***]}
+\long\def\dodorepeat#1*#2#3*#4\relax
+ {\ifx#2\empty
+ #1%
+ \else
+ \dorecurse{#1}{#2#3}%
+ \fi}
-\def\repeater%
+\def\repeater
{\recurselevel}
-\def\dorepeatwithcommand[#1]#2%
- {\def\p!dorepeatnot%
- {#2{#1}}%
- \def\p!dorepeatyes[##1*##2]%
- {\dorecurse{##1}{#2{##2}}}%
- \doifinstringelse{*}{#1}
- {\doifnumberelse{#1}{\p!dorepeatyes[#1]}{\p!dorepeatnot}}%
- {\p!dorepeatnot}}
+\def\dorepeatwithcommand[#1]%
+ {\dodorepeatwithcommand#1*\empty*\relax}
+
+\long\def\dodorepeatwithcommand#1*#2#3*#4\relax#5%
+ {\ifx#2\empty
+ #5{#1}%
+ \else
+ \dorecurse{#1}{#5{#2#3}}%
+ \fi}
%D \macros
%D {normalbgroup,normalgroup}
@@ -1627,6 +1947,35 @@
\let\normalbgroup\bgroup
\let\normalegroup\egroup
+%D \macros
+%D {doifstringinstringelse}
+%D
+%D The next macro is meant for situations where both strings
+%D are macros. This save some unneeded expansion.
+%D
+%D \starttypen
+%D \long\def\doifstringinstringelse#1#2%
+%D {\p!doifinstringelse#1#2%
+%D \@EA\firstoftwoarguments
+%D \else
+%D \@EA\secondoftwoarguments
+%D \fi}
+%D \stoptypen
+%D
+%D A bit faster is:
+
+\def\pp!doifstringinstringelse#1%
+ {\if#1@%
+ \@EA\secondoftwoarguments
+ \else
+ \@EA\firstoftwoarguments
+ \fi}
+
+\long\def\doifstringinstringelse#1#2%
+ {\long\@EA\def\@EA\p!doifstringinstringelse\@EA##\@EA1#1##2##3\war
+ {\pp!doifstringinstringelse##2}%
+ \@EA\@EA\@EA\p!doifstringinstringelse\@EA#2#1@@\war}
+
%D \macros
%D {appendtoks,prependtoks,appendtoksonce,prependtoksonce,
%D doifintokselse,flushtoks,dotoks}
@@ -1661,55 +2010,105 @@
%D
%D But here we prefer:
+\newtoks\@@scratchtoks
+
% before we had the once only alternatives, we had:
%
% \def\appendtoks {\doappendtoks \relax}
% \def\prependtoks{\doprependtoks\relax}
%
% \long\def\doappendtoks#1\to#2%
-% {\scratchtoks\@EA{\gobbleoneargument#1}%
-% \expanded{\dodoglobal\noexpand#2{\the#2\the\scratchtoks}}}
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}%
+% \expanded{\dodoglobal\noexpand#2{\the#2\the\@@scratchtoks}}}
%
% \long\def\doprependtoks#1\to#2%
-% {\scratchtoks\@EA{\gobbleoneargument#1}%
-% \expanded{\dodoglobal\noexpand#2{\the\scratchtoks\the#2}}}
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}%
+% \expanded{\dodoglobal\noexpand#2{\the\@@scratchtoks\the#2}}}
\def\appendtoks {\doappendtoks \relax}
\def\prependtoks {\doprependtoks \relax}
\def\appendtoksonce {\doappendtoksonce \relax}
\def\prependtoksonce{\doprependtoksonce\relax}
-\def\dodoappendtoks#1%
- {\expanded{\dodoglobal\noexpand#1{\the#1\the\scratchtoks}}}
+% \def\dodoappendtoks#1%
+% {\expanded{\dodoglobal\noexpand#1{\the#1\the\@@scratchtoks}}}
+%
+% \def\dodoprependtoks#1%
+% {\expanded{\dodoglobal\noexpand#1{\the\@@scratchtoks\the#1}}}
+%
+% \long\def\doappendtoks#1\to%
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}\dodoappendtoks}
+%
+% \long\def\doprependtoks#1\to%
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}\dodoprependtoks}
+%
+% \long\def\doappendtoksonce#1\to#2%
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}%
+% \doifintokselse\@@scratchtoks{#2}{}{\dodoappendtoks{#2}}}
+%
+% \long\def\doprependtoksonce#1\to#2%
+% {\@@scratchtoks\@EA{\gobbleoneargument#1}%
+% \doifintokselse\@@scratchtoks{#2}{}{\dodoprependtoks{#2}}}
+%
+% A slightly (but in the case of large arguments
+% significantly) faster alternative is given below:
+
+\def\dodoappendtoks
+ {\dodoglobal\@@toks\@EAEAEA{\@EA\the\@EA\@@toks\the\@@scratchtoks}}
-\def\dodoprependtoks#1%
- {\expanded{\dodoglobal\noexpand#1{\the\scratchtoks\the#1}}}
+\def\dodoprependtoks
+ {\dodoglobal\@@toks\@EAEAEA{\@EA\the\@EA\@@scratchtoks\the\@@toks}}
-\long\def\doappendtoks#1\to%
- {\scratchtoks\@EA{\gobbleoneargument#1}\dodoappendtoks}
+\long\def\doappendtoks#1\to#2%
+ {\def\@@toks{#2}%
+ \@@scratchtoks\@EA{\gobbleoneargument#1}\dodoappendtoks}
-\long\def\doprependtoks#1\to%
- {\scratchtoks\@EA{\gobbleoneargument#1}\dodoprependtoks}
+\long\def\doprependtoks#1\to#2%
+ {\def\@@toks{#2}%
+ \@@scratchtoks\@EA{\gobbleoneargument#1}\dodoprependtoks}
\long\def\doappendtoksonce#1\to#2%
- {\scratchtoks\@EA{\gobbleoneargument#1}%
- \doifintokselse\scratchtoks{#2}{}{\dodoappendtoks{#2}}}
+ {\def\@@toks{#2}%
+ \@@scratchtoks\@EA{\gobbleoneargument#1}%
+ \doifintokselse\@@scratchtoks\@@toks\donothing\dodoappendtoks}
\long\def\doprependtoksonce#1\to#2%
- {\scratchtoks\@EA{\gobbleoneargument#1}%
- \doifintokselse\scratchtoks{#2}{}{\dodoprependtoks{#2}}}
+ {\def\@@toks{#2}%
+ \@@scratchtoks\@EA{\gobbleoneargument#1}%
+ \doifintokselse\@@scratchtoks\@@toks\donothing\dodoprependtoks}
+
+%D The test macro:
\def\doifintokselse#1#2% #1 en #2 zijn toks
{\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA
\edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB
\doifinstringelse\asciiA\asciiB}
+%D Better:
+
+\def\doifintokselse#1#2% #1 en #2 zijn toks
+ {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA
+ \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB
+ \doifstringinstringelse\asciiA\asciiB}
+
+%D Even better:
+
+\def\doifintokselse#1#2% #1 en #2 zijn toks
+ {\@EA\convertargument\the#1\to\asciiA
+ \@EA\convertargument\the#2\to\asciiB
+ \doifstringinstringelse\asciiA\asciiB}
+
+%D Also:
+
+\def\appendetoks #1\to{\expanded{\appendtoks #1}\to}
+\def\prependetoks#1\to{\expanded{\prependtoks#1}\to}
+
%D Hm.
\def\flushtoks#1%
- {\scratchtoks=#1\relax
- \dodoglobal#1=\emptytoks
- \the\scratchtoks\relax}
+ {\@@scratchtoks#1\relax
+ \dodoglobal#1\emptytoks
+ \the\@@scratchtoks\relax}
\let\dotoks=\the
@@ -1750,10 +2149,10 @@
%D {\expandafter\newcount\csname#1\endcsname}
%D
%D \def\pluscounter#1%
-%D {\expandafter\global\expandafter\advance\csname#1\endcsname by 1 }
+%D {\global\advance\csname#1\endcsname by 1 }
%D
%D \def\minuscounter#1%
-%D {\expandafter\global\expandafter\advance\csname#1\endcsname by -1 }
+%D {\global\advance\csname#1\endcsname by -1 }
%D
%D \def\resetcounter#1%
%D {\expandafter\global\csname#1\endcsname=0 }
@@ -1774,12 +2173,12 @@
\def\pluscounter#1%
{\scratchcounter=\getvalue{#1}\relax
- \advance\scratchcounter 1
+ \advance\scratchcounter \plusone
\setxvalue{#1}{\the\scratchcounter}}
\def\minuscounter#1%
{\scratchcounter=\getvalue{#1}\relax
- \advance\scratchcounter -1
+ \advance\scratchcounter \minusone
\setxvalue{#1}{\the\scratchcounter}}
\def\resetcounter#1%
@@ -1799,10 +2198,44 @@
%D values. Only one level is saved.
\def\savecounter#1%
- {{\scratchcounter=\getvalue {#1}\setxvalue{!#1}{\the\scratchcounter}}}
+ {{\scratchcounter\getvalue {#1}\setxvalue{!#1}{\the\scratchcounter}}}
\def\restorecounter#1%
- {{\scratchcounter=\getvalue{!#1}\setxvalue {#1}{\the\scratchcounter}}}
+ {{\scratchcounter\getvalue{!#1}\setxvalue {#1}{\the\scratchcounter}}}
+
+% == {\setxvalue{#1}{\getvalue{!#1}}}
+
+%D The next \ETEX\ based solution is some 15\% faster, which
+%D goes unnoticed in any normal run, simply because these
+%D macros are not used milions of times.
+
+\beginETEX \numexpr
+
+\def\makecounter#1%
+ {\global\@EA\let\csname#1\endcsname\zerocountervalue} % see earlier
+
+\def\pluscounter#1%
+ {\@EA\xdef\csname#1\endcsname{\the\numexpr(\csname#1\endcsname+1)}}
+
+\def\minuscounter#1%
+ {\@EA\xdef\csname#1\endcsname{\the\numexpr(\csname#1\endcsname-1)}}
+
+\def\resetcounter#1%
+ {\global\@EA\let\csname#1\endcsname\zerocountervalue}
+
+\def\setcounter#1#2%
+ {\@EA\xdef\csname#1\endcsname{\the\numexpr(#2)}}
+
+\def\countervalue#1%
+ {\csname#1\endcsname}
+
+\def\savecounter#1%
+ {\@EA\xdef\csname !#1\endcsname{\the\numexpr(\csname#1\endcsname)}}
+
+\def\restorecounter#1%
+ {\@EA\xdef\csname#1\endcsname{\the\numexpr(\csname !#1\endcsname)}}
+
+\endETEX
%D \macros
%D {beforesplitstring,aftersplitstring}
@@ -1836,10 +2269,15 @@
%D
%D A bonus macro.
+%\def\splitstring#1\at#2\to#3\and#4%
+% {\def\dosplitstring##1#2##2@@@##3\\%
+% {\def#3{##1}\def#4{##2}}%
+% \@EA\dosplitstring#1@@@#2@@@\\}
+
\def\splitstring#1\at#2\to#3\and#4%
- {\def\dosplitstring##1#2##2@@@##3\\%
+ {\def\dosplitstring##1#2##2#2##3\\%
{\def#3{##1}\def#4{##2}}%
- \@EA\dosplitstring#1@@@#2@@@\\}
+ \@EA\dosplitstring#1#2#2\\}
%D \macros
%D {removesubstring}
@@ -1852,14 +2290,17 @@
%D
%D Which in terms of \TEX\ looks like:
+%\def\removesubstring#1\from#2\to#3%
+% {\doifinstringelse{#1}{#2}
+% {\beforesplitstring#2\at#1\to\!!stringa
+% \aftersplitstring #2\at#1\to\!!stringb
+% \edef#3{\!!stringa\!!stringb}%
+% \removesubstring#1\from#3\to#3}
+% {}}
+
\def\removesubstring#1\from#2\to#3%
- {\doifinstringelse{#1}{#2}
- {\beforesplitstring#2\at#1\to\!!stringa
- \aftersplitstring #2\at#1\to\!!stringb
- \edef#3{\!!stringa\!!stringb}%
- \def\next{\removesubstring#1\from#3\to#3}}
- {\let\next=\relax}%
- \next}
+ {\splitstring#2\to\!!stringa\and\!!stringb
+ \dodoglobal#3{\!!stringa\!!stringb}}
%D \macros
%D {appendtocommalist,prependtocommalist,
@@ -1898,68 +2339,117 @@
%D \appendtocommalist {something} \name
%D \prependtocommalist {something} \name
%D \stoptypen
+%D
+%D This can be implemented as follows:
+%D
+%D \starttypen
+%D \def\appendtocommalist#1#2%
+%D {\ifx#2\empty
+%D \dodoglobal\edef#2{#1}%
+%D \else % no test on empty
+%D \dodoglobal\edef#2{#2,#1}%
+%D \fi}
+%D
+%D \def\prependtocommalist#1#2%
+%D {\ifx#2\empty
+%D \dodoglobal\edef#2{#1}%
+%D \else % no test on empty
+%D \dodoglobal\edef#2{#1,#2}%
+%D \fi}
+%D \stoptypen
+%D
+%D The faster alternatives are:
\def\appendtocommalist#1#2%
- {\ifx#2\empty
- \dodoglobal\edef#2{#1}%
- \else % no test on empty
- \dodoglobal\edef#2{#2,#1}%
- \fi}
+ {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}
\def\prependtocommalist#1#2%
- {\ifx#2\empty
- \dodoglobal\edef#2{#1}%
- \else % no test on empty
- \dodoglobal\edef#2{#1,#2}%
- \fi}
+ {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}
-\def\addtocommalist#1#2%
- {\ifx#2\empty
- \dodoglobal\edef#2{#1}%
- \else
- \edef\!!stringa{#2,,}%
- \beforesplitstring#2\at,,\to#2\relax
- \ExpandBothAfter\doifinsetelse{#1}{#2}
- {\resetglobal}
- {\dodoglobal\edef#2{#2,#1}}%
- \fi}
+%D The old ones are:
+%D
+%D \starttypen
+%D \def\addtocommalist#1#2%
+%D {\ifx#2\empty
+%D \dodoglobal\edef#2{#1}%
+%D \else
+%D \edef\!!stringa{#2,,}%
+%D \beforesplitstring#2\at,,\to#2\relax
+%D \ExpandBothAfter\doifinsetelse{#1}{#2}
+%D {\resetglobal}
+%D {\dodoglobal\edef#2{#2,#1}}%
+%D \fi}
+%D
+%D \def\pretocommalist#1#2%
+%D {\ifx#2\empty
+%D \dodoglobal\edef#2{#1}%
+%D \else
+%D \edef\!!stringa{#2,,}%
+%D \beforesplitstring#2\at,,\to#2\relax
+%D \ExpandBothAfter\doifinsetelse{#1}{#2}
+%D {\resetglobal}
+%D {\dodoglobal\edef#2{#1,#2}}%
+%D \fi}
+%D
+%D \def\doremovefromcommalist#1#2#3% nog \doglobal
+%D {\edef\!!stringa{,,#3,,}%
+%D \beforesplitstring\!!stringa\at,#1#2,\to\!!stringb
+%D \aftersplitstring\!!stringa\at,#1#2,\to\!!stringc
+%D \edef#3{\!!stringb,\!!stringc}%
+%D \aftersplitstring#3\at,,\to#3\relax
+%D \beforesplitstring#3\at,,\to#3}
+%D
+%D \def\removefromcommalist#1#2%
+%D {\doremovefromcommalist{ }{#1}{#2}%
+%D \doremovefromcommalist{}{#1}{#2}%
+%D \dofrontstrip#2%
+%D \dodoglobal\edef#2{#2}}
+%D \stoptypen
+%D
+%D Significantly faster (especially for longer lists):
-\def\pretocommalist#1#2%
- {\ifx#2\empty
- \dodoglobal\edef#2{#1}%
- \else
- \edef\!!stringa{#2,,}%
- \beforesplitstring#2\at,,\to#2\relax
- \ExpandBothAfter\doifinsetelse{#1}{#2}
- {\resetglobal}
- {\dodoglobal\edef#2{#1,#2}}%
- \fi}
+\def\cleanedupcommalist#1,,#2\relax{#1}
+
+\def\xsplitstring#1#2% \cs {item}
+ {\def\dosplitstring##1#2,##2#2,##3\\%
+ {\edef\!!stringa{\cleanedupcommalist##1,,\relax}%
+ \edef\!!stringb{\cleanedupcommalist##2,,\relax}}%
+ \@EA\dosplitstring#1,#2,#2,\\}
-\def\doremovefromcommalist#1#2#3% nog \doglobal
- {\edef\!!stringa{,,#3,,}%
- \beforesplitstring\!!stringa\at,#1#2,\to\!!stringb
- \aftersplitstring\!!stringa\at,#1#2,\to\!!stringc
- \edef#3{\!!stringb,\!!stringc}%
- \aftersplitstring#3\at,,\to#3\relax
- \beforesplitstring#3\at,,\to#3}
+\def\addtocommalist#1#2% {item} \cs
+ {\expanded{\xsplitstring\noexpand#2{#1}}%
+ \dodoglobal\edef#2%
+ {\ifx\!!stringa\empty\else\!!stringa,\fi
+ \ifx\!!stringb\empty\else\!!stringb,\fi#1}}
+
+\def\pretocommalist#1#2%
+ {\expanded{\xsplitstring\noexpand#2{#1}}%
+ \dodoglobal\edef#2%
+ {#1%
+ \ifx\!!stringa\empty\else,\!!stringa\fi
+ \ifx\!!stringb\empty\else,\!!stringb\fi}}
\def\removefromcommalist#1#2%
- {\doremovefromcommalist{ }{#1}{#2}%
- \doremovefromcommalist{}{#1}{#2}%
- \dofrontstrip#2%
- \dodoglobal\edef#2{#2}}
+ {\expanded{\xsplitstring\noexpand#2{#1}}%
+ \dodoglobal\edef#2%
+ {\ifx\!!stringa\empty
+ \!!stringb
+ \else
+ \!!stringa\ifx\!!stringb\empty\else,\!!stringb\fi
+ \fi}}
+
+%D A not so useful macro:
\def\dodofrontstrip[#1#2]#3%
{\ifx#1\space
\def#3{#2}%
\else
\def#3{#1#2}%
- \fi}%
+ \fi}
\def\dofrontstrip#1%
{\edef\!!stringa{#1}%
- \ifx\!!stringa\empty
- \else
+ \ifx\!!stringa\empty \else
\@EA\dodofrontstrip\@EA[#1]#1%
\fi}
@@ -2014,7 +2504,7 @@
\fi
\fi
\fi
- \advance\commalistcounter by 1 }%
+ \advance\commalistcounter\plusone}%
\let\commalistelement\empty
\let\newcommalist\empty
\commalistcounter=1
@@ -2058,7 +2548,8 @@
\dimen0=#1\relax
\@EA\convertargument\the\dimen0\to\asciiA
\@EA\convertargument#2\to\asciiB
- \@EA\@EA\@EA\beforesplitstring\@EA\asciiA\@EA\at\asciiB\to\!!stringa%
+ %\@EA\@EA\@EA\beforesplitstring\@EA\asciiA\@EA\at\asciiB\to\!!stringa
+ \@EA\beforesplitstring\@EA\asciiA\@EA\at\asciiB\to\!!stringa
\!!stringa
\endgroup}
@@ -2105,14 +2596,14 @@
\def\numberofpoints#1%
{\scratchdimen=#1\relax
- \advance\scratchdimen by .5pt
+ \advance\scratchdimen .5pt
\withoutpt{\the\scratchdimen}}
\def\dimensiontocount#1#2%
{\scratchdimen=#1\relax
- \advance\scratchdimen by .5pt
+ \advance\scratchdimen .5pt
#2=\scratchdimen
- \divide#2 by \!!maxcard\relax}
+ \divide#2 by \maxcard}
%D \macros
%D {swapdimens,swapmacros}
@@ -2123,14 +2614,10 @@
%D argument.
\def\swapdimens#1#2%
- {\scratchdimen=#1\relax
- \redoglobal#1=#2\relax
- \dodoglobal#2=\scratchdimen}
+ {\scratchdimen #1\redoglobal #1#2\dodoglobal #2\scratchdimen}
\def\swapmacros#1#2%
- {\let\!!stringa=#1\relax
- \let#1=#2\relax
- \let#2=\!!stringa\relax}
+ {\let\!!stringa#1\redoglobal\let#1#2\dodoglobal\let#2\!!stringa}
%D \macros
%D {pushmacro,popmacro}
@@ -2146,7 +2633,9 @@
\def\@s@{@s@}
-\def\globalpushmacro#1%
+\beginTEX
+
+\def\globalpushmacro#1% we can use a faster incement here
{\@EA\doglobal\@EA\increment\csname\@s@:\string#1\endcsname
\global\@EA\let\csname\csname\@s@:\string#1\endcsname:\string#1\endcsname#1}
@@ -2164,6 +2653,42 @@
{\@EA\let\@EA#1\csname\csname\@s@::\string#1\endcsname::\string#1\endcsname
\global\@EA\decrement\csname\@s@::\string#1\endcsname}
+\endTEX
+
+% * niet nodig, in @s@ stoppen
+
+\beginETEX \newcount
+
+\def\globalpushmacro#1%
+ {\ifcsname\@s@*\string#1\endcsname \else
+ \@EA\newcount\csname\@s@*\string#1\endcsname
+ \fi
+ \global\advance\csname\@s@*\string#1\endcsname \plusone
+ \global\@EA\let\csname\the\csname\@s@*\string#1\endcsname*\string#1\endcsname#1}
+
+\def\globalpopmacro#1% \global\let
+ {%\ifcsname\@s@*\string#1\endcsname
+ \global\@EA\let\@EA#1\csname\the\csname\@s@*\string#1\endcsname*\string#1\endcsname
+ \global\advance\csname\@s@*\string#1\endcsname \minusone
+ %\else
+ % \message{error in \string#1}\wait
+ }%\fi}
+
+% this one can be used to push a value over an \egroup
+
+\def\localpushmacro#1%
+ {\ifcsname\@s@**\string#1\endcsname \else
+ \@EA\newcount\csname\@s@**\string#1\endcsname
+ \fi
+ \global\advance\csname\@s@**\string#1\endcsname \plusone
+ \global\@EA\let\csname\the\csname\@s@**\string#1\endcsname**\string#1\endcsname#1}
+
+\def\localpopmacro#1% \local\let
+ {\@EA\let\@EA#1\csname\the\csname\@s@**\string#1\endcsname**\string#1\endcsname
+ \global\advance\csname\@s@**\string#1\endcsname \minusone }
+
+\endETEX
+
\let\pushmacro\globalpushmacro
\let\popmacro \globalpopmacro
@@ -2188,13 +2713,13 @@
\def\complexsetlocalhsize[#1]% don't change !
{\localhsize=\hsize
- % \advance\localhsize by -\parindent % changed anyway
- \advance\localhsize by -\leftskip
- \advance\localhsize by -\rightskip
- \advance\localhsize by #1\relax}
+ % \advance\localhsize -\parindent % changed anyway
+ \advance\localhsize -\leftskip
+ \advance\localhsize -\rightskip
+ \advance\localhsize #1\relax}
\def\simplesetlocalhsize%
- {\complexsetlocalhsize[\!!zeropoint]}
+ {\complexsetlocalhsize[\zeropoint]}
\definecomplexorsimple\setlocalhsize
@@ -2340,9 +2865,83 @@
%D
%D Slightly more efficient:
- \def\doifnothing{\doif {}}
- \def\doifsomething{\doifnot {}}
-\def\doifelsenothing{\doifelse{}}
+ \def\doifnothing{\doif \empty}
+ \def\doifsomething{\doifnot \empty}
+\def\doifelsenothing{\doifelse\empty}
+
+%D The somewhat faster alternatives are:
+
+\long\def\doifvalue#1#2%
+ {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\doifnotvalue#1#2%
+ {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\long\def\doifelsevalue#1#2%
+ {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\long\def\doifnothing#1%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\doifsomething#1%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\long\def\doifelsenothing#1%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\long\def\doifvaluenothing#1%
+ {\edef\!!stringa{\csname#1\endcsname}%
+ \ifx\!!stringa\empty
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\doifvaluesomething#1%
+ {\edef\!!stringa{\csname#1\endcsname}%
+ \ifx\!!stringa\empty
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\long\def\doifelsevaluenothing#1%
+ {\edef\!!stringa{\csname#1\endcsname}%
+ \ifx\!!stringa\empty
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
%D \macros
%D {doifemptyelsevalue, doifemptyvalue, doifnotemptyvalue}
@@ -2365,13 +2964,30 @@
%D \type {\doifallcommonelse}, where the first two
%D arguments are sets.
-\def\doifallcommonelse#1#2#3#4%
+%\def\doifallcommonelse#1#2#3#4%
+% {\def\p!docommoncheck##1%
+% {\doifnotinset{##1}{#2}{\donefalse}%
+% \ifdone\else\quitcommalist\fi}%
+% \donetrue
+% \processcommalist[#1]\p!docommoncheck
+% \ifdone#3\else#4\fi}
+
+\def\@@doifallcommonelse#1#2#3#4% slow
{\def\p!docommoncheck##1%
- {\doifnotinset{##1}{#2}{\donefalse}%
+ {\doifnotinset{##1}{#4}\donefalse
\ifdone\else\quitcommalist\fi}%
\donetrue
- \processcommalist[#1]\p!docommoncheck
- \ifdone#3\else#4\fi}
+ \processcommalist[#3]\p!docommoncheck
+ \ifdone\expandafter#1\else\expandafter#2\fi}
+
+\def\doifallcommonelse
+ {\@@doifallcommonelse\firstoftwoarguments\secondoftwoarguments}
+
+\def\doifallcommon
+ {\@@doifallcommonelse\firstofonearguments\gobbleoneargument}
+
+\def\doifnotallcommon
+ {\@@doifallcommonelse\gobbleoneargument\firstofonearguments}
%D \macros
%D {DOIF,DOIFELSE,DOIFNOT}
@@ -2477,30 +3093,45 @@
%D \executeifdefined{name}\gobbleoneargument
%D \stoptypen
%D
-%D We can of course globble more arguments using the
-%D appropriate globbling command.
+%D We can of course gobble more arguments using the
+%D appropriate gobbling command.
-\newif\ifexecuted
+\newif\ifexecuted % general purpose
\def\executeifdefined#1#2%
{\ifundefined{#1}%
- \executedfalse
\def\next{#2}%
\else
- \executedtrue
\def\next{\getvalue{#1}}%
\fi
\next}
-% cleaner but less clear
-%
-% \def\executeifdefined#1%
-% {\ifundefined{#1}%
-% \executedfalse \let\next\gobbleoneargument
-% \else
-% \executedtrue \def\next##1{\getvalue{#1}}%
-% \fi
-% \next}
+%D Just for fun I times the next alternative: it was roughly
+%D timed about 15\% faster than the default (10+ sec to 9 sec)!
+
+\def\executeifdefined#1% #2 / never change this one again
+ {\ifundefined{#1}%
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi
+ {\csname#1\endcsname}}
+
+\beginETEX
+
+\def\executeifdefined#1% #2 / never change this one again
+ {\ifcsname#1\endcsname
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi
+ {\csname#1\endcsname}}
+
+\endETEX
+
+
+%D This one also has the advantage that it is fully
+%D expandable and that it can be used after an assignment.
%D We considered an alternative imlementation accepting
%D commands directly, like:
@@ -2510,20 +3141,7 @@
%D \stoptypen
%D
%D For the moment we don't need this one, so we stick to the
-%D faster one. The more versatile alternative is:
-%D
-%D \starttypen
-%D \def\executeifdefined#1#2%
-%D {\setnameofcommand{#1}%
-%D \@EA\ifundefined\@EA{\nameofcommand}%
-%D \def\next{#2}%
-%D \else
-%D \def\next{\getvalue{\nameofcommand}}%
-%D \fi
-%D \next}
-%D \stoptypen
-
-% ISN'T THE NEXT ONE OBSOLETE?
+%D faster one.
%D \macros
%D {doifsomespaceelse}
@@ -2539,6 +3157,8 @@
%D argument must be broken into words when made interactive.
%D Watch the use of \type{\noexpand}.
+%D Is this one still needed?
+
% \long\def\doifsomespaceelse#1#2#3%
% {\def\p!doifsomespaceelse##1 ##2##3\war%
% {\if\noexpand##2@#3\else#2\fi}%
@@ -2546,8 +3166,12 @@
\def\p!doifsomespaceelse#1 #2#3\war{\if\noexpand#2@}
-\long\def\doifsomespaceelse#1#2#3%
- {\p!doifsomespaceelse#1 @ @\war#3\else#2\fi}
+\long\def\doifsomespaceelse#1% % #2#3%
+ {\p!doifsomespaceelse#1 @ @\war % #3\else#2\fi}
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
%D \macros
%D {adaptdimension,balancedimensions}
@@ -2773,7 +3397,7 @@
{\begingroup
\catcode`\{=\@@ignore
\catcode`\}=\@@ignore
- \escapechar=-1
+ \escapechar=\minusone
\dountexsomething}
\long\def\dountexsomething#1#2\to#3%
@@ -2802,17 +3426,20 @@
%D The magic factor $72/72.27$ can be found in most \TEX\
%D related books.
-\def\ScaledPointsToBigPoints#1#2%
- {\scratchdimen=#1sp
- \scratchdimen=.996264\scratchdimen
+\def\ScaledPointsToBigPoints #1{\PointsToBigPoints {#1sp}}
+\def\ScaledPointsToWholeBigPoints#1{\PointsToWholeBigPoints{#1sp}}
+
+\def\PointsToBigPoints#1#2%
+ {\scratchdimen#1%
+ \scratchdimen.996264\scratchdimen
\edef#2{\withoutpt{\the\scratchdimen}}}
-\def\ScaledPointsToWholeBigPoints#1#2%
- {\scratchdimen=#1sp
- \scratchdimen=.996264\scratchdimen
- \scratchcounter=\scratchdimen
- \advance\scratchcounter by \!!medcard
- \divide\scratchcounter by \!!maxcard
+\def\PointsToWholeBigPoints#1#2%
+ {\scratchdimen#1%
+ \scratchdimen.996264\scratchdimen
+ \scratchcounter\scratchdimen
+ \advance\scratchcounter \medcard
+ \divide\scratchcounter \maxcard
\edef#2{\the\scratchcounter}}
%D \macros
@@ -2922,6 +3549,16 @@
%D \dohandletokens#1\end}
%D \stoptypen
+%D A bonus example:
+%D
+%D \starttypen
+%D \hbox{\handletokens tekst en meer tekst\with\ruledhbox}
+%D
+%D \def\weetikveel#1{\if#1\blankspace\space\else\ruledhbox{#1}\fi}
+%D
+%D \hbox{\handletokens tekst en meer tekst\with\weetikveel}
+%D \stoptypen
+
%D \macros
%D {counttoken}
%D
@@ -2937,14 +3574,14 @@
%D {\doglobal}.
\def\counttoken#1\in#2\to#3%
- {\redoglobal#3=0
+ {\redoglobal#3=\zerocount
\def\!!stringa{#1}%
\def\!!stringb{\end}%
\def\docounttoken##1% obeys {}
{\def\!!stringc{##1}%
\ifx\!!stringb\!!stringc \else
\ifx\!!stringa\!!stringc
- \dodoglobal\advance#3 by 1
+ \dodoglobal\advance#3 \plusone
\fi
\expandafter\docounttoken
\fi}%
@@ -2963,7 +3600,7 @@
\scratchcounter=#1\relax
\def\dosplitofftokens##1%
{\ifnum\scratchcounter>0
- \advance\scratchcounter by -1
+ \advance\scratchcounter \minusone
\edef#3{#3##1}%
\fi}%
% \let#3=\empty % #3 can be #2, so:
@@ -3107,13 +3744,13 @@
\ifnum\globaldefs#10
\globaldefs=-\globaldefs
\fi
- \advance\globaldefs by #21
+ \advance\globaldefs #21
\setevalue{@gd@\the\globaldefs}{\!!stringa}}
\def\dostopglobaldefs%
{\doifdefinedelse{@gd@\the\globaldefs}
- {\globaldefs=\getvalue{@gd@\the\globaldefs}\relax}
- {\globaldefs=0\relax}}
+ {\globaldefs\getvalue{@gd@\the\globaldefs}\relax}
+ {\globaldefs\zerocount}}
\def\startlocal {\dostartglobaldefs>-}
\def\stoplocal {\dostopglobaldefs}
@@ -3171,7 +3808,8 @@
%\endTEX
-% Hm. Side effect, spaces after \type{\test} in verbatim.
+% Hm. Side effect, spaces after \type{\test} in verbatim.
+% must set eof token
%\beginETEX \scantokens
%
@@ -3274,7 +3912,7 @@
\replaceincommalist\sortedcommalist\scratchcounter
\quitcommalist
\fi}%
- \advance\scratchcounter 1 }
+ \advance\scratchcounter \minusone}
%D The macro \type{\donumericcompare} considers everything
%D that is not a number to be larger than any number.
@@ -3292,22 +3930,6 @@
{\comparedresult=2 }}
{\comparedresult=1 }}
-%D \macros
-%D {firstofoneargument, firstoftwoarguments, firstofthreearguments
-%D secondoftwoarguments, secondofthreearguments,
-%D thirdofthreearguments}
-%D
-%D The next six macros (dedicated to Taco) can conveniently
-%D used to select arguments. Their names explain their
-%D functionality.
-
-\long\def\firstofoneargument #1{#1}
-\long\def\firstoftwoarguments #1#2{#1}
-\long\def\firstofthreearguments #1#2#3{#1}
-\long\def\secondoftwoarguments #1#2{#2}
-\long\def\secondofthreearguments#1#2#3{#2}
-\long\def\thirdofthreearguments #1#2#3{#3}
-
%D \macros
%D {@saveprimitive}
%D
@@ -3386,9 +4008,13 @@
%D Not that fast I guess, but here's a way to test for token
%D registers being empty.
-\def\doifsometokselse#1#2#3%
+\def\doifsometokselse#1% % #2#3%
{\edef\!!stringa{\the#1}%
- \ifx\!!stringa\empty#3\else#2\fi}
+ \ifx\!!stringa\empty % #3\else#2\fi}
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
%D \macros
%D {startstrictinspectnextcharacter}
diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex
index 5ee3299f5..19381d91b 100644
--- a/tex/context/base/syst-gen.tex
+++ b/tex/context/base/syst-gen.tex
@@ -1,4 +1,4 @@
-%D \module
+%D \module
%D [ file=syst-gen,
%D version=1996.3.20,
%D title=\CONTEXT\ System Macros,
@@ -8,8 +8,8 @@
%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.
% nagaan : \ifinstringelse in syst-ext.tex
% do => p! dodo pp! dododo ppp!
@@ -17,12 +17,12 @@
%D The following macros are responsible for the interaction
%D with \CONTEXT. These macros have proven their use. These
%D macros are optimized as far as possible within of course,
-%D the know how of the author.
-%D
-%D In this module we also show some of the optimizations,
-%D mainly because we don't want to forget them and start doing
-%D things over and over again. If showing them has a learing
-%D effect for others too, we've surved another purpose too.
+%D the know how of the author.
+%D
+%D In this module we also show some of the optimizations,
+%D mainly because we don't want to forget them and start doing
+%D things over and over again. If showing them has a learing
+%D effect for others too, we've surved another purpose too.
%D \macros
%D {abortinputifdefined}
@@ -37,7 +37,7 @@
%D
%D where \type{\command} is a command defined in the module
%D to be loaded only once.
-%D
+%D
%D \starttypen
%D \def\abortinputifdefined#1%
%D {\ifx#1\undefined
@@ -48,13 +48,13 @@
%D \next}
%D \stoptypen
%D
-%D This macro can be speed up in terms of speed as well as
-%D memory. Because this is a nice example of a bit strange
+%D This macro can be speed up in terms of speed as well as
+%D memory. Because this is a nice example of a bit strange
%D command (\type{\endinput}), we spend some more lines on this.
%D
-%D If we perform such actions directly, we can say:
-%D
-%D \starttypen
+%D If we perform such actions directly, we can say:
+%D
+%D \starttypen
%D \ifx\somecommand\undefined
%D \let\next=\relax
%D \else
@@ -62,38 +62,38 @@
%D \fi
%D \next
%D \stoptypen
-%D
-%D We need the \type{\next} because we need to end the
-%D \type{\fi}. The efficient one is:
-%D
-%D \starttypen
+%D
+%D We need the \type{\next} because we need to end the
+%D \type{\fi}. The efficient one is:
+%D
+%D \starttypen
%D \ifx\somecommand\undefined
%D \else
-%D \expandafter\endinput
+%D \expandafter\endinput
%D \fi
%D \stoptypen
%D
-%D Because \type{\endinput} comes into action after the current
+%D Because \type{\endinput} comes into action after the current
%D line, we can also say:
-%D
-%D \starttypen
+%D
+%D \starttypen
%D \ifx\somecommand\undefined \else \endinput \fi
%D \stoptypen
%D
-%D When we define a macro, we tend to use a format which
-%D shows as besat as can how things are done. \TEX\ however
+%D When we define a macro, we tend to use a format which
+%D shows as besat as can how things are done. \TEX\ however
%D stores the definitions as a sequence of tokens, so in fact
-%D we can use a formatted definition:
+%D we can use a formatted definition:
\def\abortinputifdefined#1%
- {\ifx#1\undefined \else
- \endinput
+ {\ifx#1\undefined \else
+ \endinput
\fi}
-%D which also works. Keep in mind that this is entirely due to
-%D the fact that \type{\endinput} after the line, i.e. at the
+%D which also works. Keep in mind that this is entirely due to
+%D the fact that \type{\endinput} after the line, i.e. at the
%D end of the macro. We therefore can burry this primitive quite
-%D deep in code.
+%D deep in code.
%D And because this module implements \type{\writestatus}, we
%D just say:
@@ -108,11 +108,11 @@
%D \writestatus{laden}{Context Systeem Macro's (a)}
%D \stoptypen
-%D The next few macros are needed in case this module is
-%D used outside \CONTEXT.
+%D The next few macros are needed in case this module is
+%D used outside \CONTEXT.
\ifx\beginTEX\undefined
- \long\def\beginETEX#1\endETEX{}
+ \long\def\beginETEX#1\endETEX{}
\let\beginTEX\relax \let\endTEX\relax
\fi
@@ -150,19 +150,23 @@
\ifx\protect\undefined
\def\protect{\message{<too much protection>}}
+\else
+ % a simple version is already defined
\fi
-\let\normalprotect=\protect
+\let\normalprotect=\protect % only for latex
%D Although we don't need the \type{%} after commands that
-%D don't take arguments, unless lines are obeyed, I decided
-%D to put it there as a reminder. I only mention this once.
+%D don't take arguments, unless lines are obeyed, I decided
+%D to put it there as a reminder. I only mention this once.
+
+\chardef\protectionthreshold=2
-\def\unprotect%
+\def\unprotect
{\ifcase\protectionlevel
\edef\doprotectcharacters%
- {\catcode`\noexpand @=\the\catcode`@
- \catcode`\noexpand !=\the\catcode`!
+ {\catcode`\noexpand @=\the\catcode`@
+ \catcode`\noexpand !=\the\catcode`!
\catcode`\noexpand ?=\the\catcode`? }%
\let\protect\doprotect
\fi
@@ -170,7 +174,7 @@
\catcode`!=11
\catcode`?=11
\advance\protectionlevel 1
- \ifnum\protectionlevel>1
+ \ifnum\protectionlevel>\protectionthreshold
\message{<unprotect \the\protectionlevel>}%
\fi}
@@ -180,10 +184,21 @@
\let\doprotectcharacters\relax
\let\protect\normalprotect
\fi
- \ifnum\protectionlevel>1
+ \ifnum\protectionlevel>\protectionthreshold
\message{<protect \the\protectionlevel>}%
\fi
\advance\protectionlevel -1 }
+
+\ifx\everyeof\undefined
+
+ \let\checkprotection\relax
+
+\else
+
+ \def\checkprotection%
+ {\everyeof{\writestatus{protection}{level: \the\protectionlevel}}}
+
+\fi
%D Now it is defined, we can make use of this very useful
%D macro.
@@ -218,8 +233,8 @@
%D \macros
%D {normalspace}
%D
-%D We often need a space as defined in \PLAIN\ \TEX. Because
-%D we cannot be sure of \type{\space} is redefined, we define:
+%D We often need a space as defined in \PLAIN\ \TEX. Because
+%D we cannot be sure of \type{\space} is redefined, we define:
\def\normalspace{ }
@@ -239,25 +254,25 @@
\newdimen \scratchdimen
\newskip \scratchskip
\newmuskip \scratchmuskip
-\newbox \scratchbox
+\newbox \scratchbox
\newtoks \scratchtoks
-\newif \ifdone
+\newif \ifdone
%D \macros
%D {ifCONTEXT}
-%D
+%D
%D In the system and support modules we sometimes show examples
%D that make use of core commands. We can skip those parts of
-%D the documentation when we use another macropackage. Of
-%D course we default to false.
+%D the documentation when we use another macropackage. Of
+%D course we default to false.
\newif \ifCONTEXT
%D \macros
-%D {!!count, !!toks, !!dimen, !!box,
-%D !!width, !!height, !!depth, !!string, !!done}
+%D {!!count, !!toks, !!dimen, !!box,
+%D !!width, !!height, !!depth, !!string, !!done}
%D
-%D We define some more \COUNTERS\ and \DIMENSIONS. We also
+%D We define some more \COUNTERS\ and \DIMENSIONS. We also
%D define some shortcuts to the local scatchregisters~0, 2, 4,
%D 6 and~8.
@@ -271,12 +286,22 @@
\let\!!stringa=\empty \let\!!stringb=\empty \let\!!stringc=\empty
\let\!!stringd=\empty \let\!!stringe=\empty \let\!!stringf=\empty
-\newdimen\!!widtha \newdimen\!!heighta \newdimen\!!deptha
-\newdimen\!!widthb \newdimen\!!heightb \newdimen\!!depthb
-\newdimen\!!widthc \newdimen\!!heightc \newdimen\!!depthc
+\newdimen\!!widtha \newdimen\!!heighta \newdimen\!!deptha
+\newdimen\!!widthb \newdimen\!!heightb \newdimen\!!depthb
+\newdimen\!!widthc \newdimen\!!heightc \newdimen\!!depthc
\newif\if!!donea \newif\if!!doneb \newif\if!!donec
+\ifx \z@\undefined \else \let\zeropoint\z@ \fi
+\ifx \@ne\undefined \else \let\plusone \@ne \fi
+\ifx\m@ne\undefined \else \let\minusone \m@ne \fi
+
+\ifx\zeropoint\undefined \newdimen\zeropoint \fi
+\ifx\plusone \undefined \chardef\plusone=1 \fi
+\ifx\minusone \undefined \count\minusone \minusone=-1 \fi
+
+\newcount\zerocount
+
%D \macros
%D {s!,c!,e!,p!,v!,@@,??}
%D
@@ -285,7 +310,7 @@
%D results.
\def\v!prefix! {v!} \def\c!prefix! {c!}
-\def\s!prefix! {s!} \def\p!prefix! {p!}
+\def\s!prefix! {s!} \def\p!prefix! {p!}
\def\s!next {next} \def\s!default {default}
\def\s!dummy {dummy} \def\s!unknown {unknown}
@@ -296,37 +321,41 @@
\def\s!simple {simple} \def\s!stop {stop}
%D \macros
-%D {@EA,expanded}
+%D {@EA,@EAEA,@EAEAEA,@EAEAEAEAEAEA,expanded}
%D
-%D When in unprotected mode, to be entered with
-%D \type{\unprotect}, one can use \type{\@EA} as equivalent
+%D When in unprotected mode, to be entered with
+%D \type{\unprotect}, one can use \type{\@EA} as equivalent
%D of \type{\expandafter}.
-\let\@EA=\expandafter
+\let\@EA =\expandafter
+\def\@EAEA {\expandafter\expandafter}
+\def\@EAEAEA{\expandafter\expandafter\expandafter}
-%D Sometimes we pass macros as arguments to commands that
+\def\@EAEAEAEAEAEA{\expandafter\@EAEAEA\expandafter}
+
+%D Sometimes we pass macros as arguments to commands that
%D don't expand them before interpretation. Such commands can
-%D be enclosed with \type{\expanded}, like:
+%D be enclosed with \type{\expanded}, like:
%D
%D \starttypen
-%D \expanded{\setupsomething[\alfa]}
+%D \expanded{\setupsomething[\alfa]}
%D \stoptypen
-%D
-%D Such situations occur for instance when \type{\alfa} is a
+%D
+%D Such situations occur for instance when \type{\alfa} is a
%D commalist or when data stored in macros is fed to index of
-%D list commands. If needed, one should use \type{\noexpand}
-%D inside the argument. Later on we will meet some more clever
-%D alternatives to this command.
+%D list commands. If needed, one should use \type{\noexpand}
+%D inside the argument. Later on we will meet some more clever
+%D alternatives to this command.
\let\@@expanded\empty
\long\def\expanded#1%
{\long\edef\@@expanded{\noexpand#1}\@@expanded}
-%D \macros
+%D \macros
%D {expandoneargafter,expandtwoargsafter}
%D
-%D These two commands make macros more readable by hiding a
+%D These two commands make macros more readable by hiding a
%D lot of \type {\expandafter}'s. They expand the arguments
%D after the first command.
%D
@@ -335,13 +364,21 @@
%D \expandtwoargsafter\command{\abc}{\def}
%D \stoptypen
%D
-%D These commands expect the arguments to be macros.
+%D These commands expect the arguments to be macros.
+
+\def\expandoneargafter#1%
+ {\@EA#1\@EA}
+
+\def\expandtwoargsafter#1#2%
+ {\@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA#2\@EA}\@EA}
+
+%D These two do a full expansion:
-\def\expandoneargafter#1#2%
- {\@EA#1\@EA{#2}}
+\def\fullexpandoneargafter#1#2%
+ {\edef\@@expanded{\noexpand#1{#2}}\@@expanded}
-\def\expandtwoargsafter#1#2#3%
- {\@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA#2\@EA}\@EA{#3}}
+\def\fullexpandtwoargsafter#1#2#3%
+ {\edef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded}
%D \macros
%D {gobbleoneargument,gobble...arguments}
@@ -358,6 +395,7 @@
\long\def\gobblesevenarguments #1#2#3#4#5#6#7{}
\long\def\gobbleeightarguments #1#2#3#4#5#6#7#8{}
\long\def\gobbleninearguments #1#2#3#4#5#6#7#8#9{}
+\long\def\gobbletenarguments #1{\gobbleninearguments}
%D \macros
%D {doifnextcharelse}
@@ -384,24 +422,35 @@
%D {\localnext} because we don't want clashes with \type
%D {\next}.
-\long\def\doifnextcharelse#1#2#3%
- {\let\charactertoken=#1%
- \def\!!stringa{#2}%
- \def\!!stringb{#3}%
- \futurelet\nexttoken\inspectnextcharacter}
+\long\def\doifnextcharelse#1#2#3% #1 should not be {} !
+ {\let\charactertoken=#1%
+ \def\!!stringa{#2}%
+ \def\!!stringb{#3}%
+ \futurelet\nexttoken\inspectnextcharacter}
+
+% \def\inspectnextcharacter%
+% {\ifx\nexttoken\blankspace
+% \let\localnext\reinspectnextcharacter
+% %\else\ifx\nexttoken\endoflinetoken
+% % \let\localnext\reinspectaftercharacter
+% \else\ifx\nexttoken\charactertoken
+% \let\localnext\!!stringa
+% \else
+% \let\localnext\!!stringb
+% \fi\fi%\fi
+% \localnext}
+%
+% faster ?
-\def\inspectnextcharacter%
+\def\inspectnextcharacter%
{\ifx\nexttoken\blankspace
- \let\localnext\reinspectnextcharacter
- %\else\ifx\nexttoken\endoflinetoken
- % \let\localnext\reinspectaftercharacter
+ \@EA\reinspectnextcharacter
\else\ifx\nexttoken\charactertoken
- \let\localnext\!!stringa
+ \@EAEAEA\!!stringa
\else
- \let\localnext\!!stringb
- \fi\fi%\fi
- \localnext}
-
+ \@EAEAEA\!!stringb
+ \fi\fi}
+
%\let\endoflinetoken=^^M
%
%\long\def\reinspectaftercharacter#1%
@@ -429,10 +478,10 @@
%D \stoptypen
%D
%D However complicated it may look, I'm still glad I stumbled
-%D into this construction. Saving and restoring \type {\:} is
-%D needed when we use \PPCHTEX\ in \LATEX.
+%D into this construction. Saving and restoring \type {\:} is
+%D needed when we use \PPCHTEX\ in \LATEX.
-\let\next\:
+\let\next\:
\def\:{\let\blankspace= } \:
@@ -467,37 +516,22 @@
%D which is mainly due to its object oriented and parameter
%D driven character.
-\def\setvalue#1%
- {\expandafter\def\csname#1\endcsname}
-
-\def\setgvalue#1%
- {\expandafter\gdef\csname#1\endcsname}
-
-\def\setevalue#1%
- {\expandafter\edef\csname#1\endcsname}
-
-\def\setxvalue#1%
- {\expandafter\xdef\csname#1\endcsname}
-
-\def\getvalue#1%
- {\csname#1\endcsname}
+\def\setvalue #1{\expandafter \def\csname#1\endcsname}
+\def\setgvalue #1{\expandafter\gdef\csname#1\endcsname}
+\def\setevalue #1{\expandafter\edef\csname#1\endcsname}
+\def\setxvalue #1{\expandafter\xdef\csname#1\endcsname}
+\def\getvalue #1{\csname#1\endcsname}
+\def\letvalue #1{\expandafter\let\csname#1\endcsname}
+\def\resetvalue #1{\expandafter\let\csname#1\endcsname\empty}
+\def\ignorevalue#1#2{\expandafter\let\csname#1\endcsname\empty}
-\def\letvalue#1%
- {\expandafter\let\csname#1\endcsname}
-
-\def\resetvalue#1%
- {\expandafter\let\csname#1\endcsname\empty}
-
-\def\ignorevalue#1#2%
- {\expandafter\let\csname#1\endcsname\empty}
-
-%D \macros
+%D \macros
%D {globallet}
%D
-%D In \CONTEXT\ of May 2000 using \type {\globallet}
-%D instead of the two tokens will save us some
-%D $300\times4=1200$ bytes of format file on a 32~bit
-%D system. So:
+%D In \CONTEXT\ of May 2000 using \type {\globallet}
+%D instead of the two tokens will save us some
+%D $300\times4=1200$ bytes of format file on a 32~bit
+%D system. So:
\def\globallet{\global\let}
@@ -517,22 +551,19 @@
%D \def\somecommand {\donottest\dosomecommand}
%D \stoptypen
%D
-%D This double definition can be made transparant by using
+%D This double definition can be made transparant by using
%D \type{\unexpanded}, as in:
-%D
+%D
%D \starttypen
%D \unexpanded\def\somecommand{... ... ...}
%D \stoptypen
-%D
+%D
%D The protection mechanism uses:
\beginTEX
-\def\dontprocesstest#1%
- {==}
-
-\def\doprocesstest#1%
- {#1}
+\def\dontprocesstest#1{==}
+\def\doprocesstest #1{#1}
\let\donottest=\doprocesstest
@@ -544,12 +575,12 @@
\endETEX
-%D By the way, we use a placeholder because we don't want
-%D interference when testing on empty strings. Using a
-%D placeholder of 8~characters increases the processing time
-%D of simple \type{\doifelse} tests by about 10 \%. When we
-%D process the test, we have to remove the braces and
-%D therefore explictly gobble \type{#1}.
+%D By the way, we use a placeholder because we don't want
+%D interference when testing on empty strings. Using a
+%D placeholder of 8~characters increases the processing time
+%D of simple \type{\doifelse} tests by about 10 \%. When we
+%D process the test, we have to remove the braces and
+%D therefore explictly gobble \type{#1}.
%D \macros
%D {honorunexpanded,forceunexpanded}
@@ -557,16 +588,16 @@
%D The fact that many macros have the same prefix, could have
%D a negative impact on searching in the hash table. Because
%D some simple testing does not show differences, we just use:
-%D
+%D
%D \starttypen
%D \def\unexpanded#1#2%
%D {\@EA#1\@EA#2\@EA{\@EA\donottest\csname\s!do\string#2\endcsname}%
%D \@EA#1\csname\s!do\string#2\endcsname}
%D \stoptypen
-%D
-%D Well, in fact we use the bit more versatile alternative. The
-%D \type {\honorunexpanded} can be used to \type {\string}
-%D the protected command, which by the way is seldom needed
+%D
+%D Well, in fact we use the bit more versatile alternative. The
+%D \type {\honorunexpanded} can be used to \type {\string}
+%D the protected command, which by the way is seldom needed
%D in \CONTEXT.
\beginTEX
@@ -589,7 +620,7 @@
\fi#1}%
\futurelet\next\dounexpanded}
-\def\honorunexpanded% for writing to a file or message
+\def\honorunexpanded% for writing to a file or message
{\def\donottest##1{\expandafter\gobblethreearguments\string##1}}
\def\forceunexpanded% for preventing expansion in \xdef
@@ -610,8 +641,8 @@
\endETEX
-%D This one accepts the more direct \type{\def} and cousins
-%D as well as the \CONTEXT\ specific \type{\setvalue} ones.
+%D This one accepts the more direct \type{\def} and cousins
+%D as well as the \CONTEXT\ specific \type{\setvalue} ones.
%D
%D And so the definition in our example turns out to be:
%D
@@ -620,13 +651,13 @@
%D \def\somecommand{\donottest\csname do\somecommand\endcsname}
%D \stoptypen
%D
-%D In which \type{do\somecommand} is hidden from the user and
-%D cannot lead to confusion. It's still permitted to define
-%D auxiliary macros like \type{\dosomecommand}.
+%D In which \type{do\somecommand} is hidden from the user and
+%D cannot lead to confusion. It's still permitted to define
+%D auxiliary macros like \type{\dosomecommand}.
%D
-%D When we are going to use e-\TEX, we'll probably end up
-%D redefining some commands, but we can probably keep the
-%D \type{\unexpanded} ones unchanged.
+%D When we are going to use e-\TEX, we'll probably end up
+%D redefining some commands, but we can probably keep the
+%D \type{\unexpanded} ones unchanged.
%D \macros
%D {doifundefined,doifdefined,
@@ -653,24 +684,24 @@
%D Although it will probably never be a big problem, it is good
%D to be aware of the difference between testing on a macro
%D name to be build by using \type{\csname} and
-%D \type{\endcsname} and testing the \type{\name} directly.
-%D
+%D \type{\endcsname} and testing the \type{\name} directly.
+%D
%D \starttypen
%D \expandafter\ifx\csname NameA\endcsname\relax ... \else ... \fi
-%D
+%D
%D \ifx\NameB\undefined ... \else ... \fi
%D \stoptypen
-%D
+%D
%D I became aware of this when I mistakenly testen the first
%D one against \type{\undefined}. When \TEX\ build a name using
%D \type{\csname} it automatically sets it to \type{\relax},
%D which is definitely not the same as \type{\undefined}. The
%D quickest way to check these things is asking \TEX\ to show
-%D the meaning of the names:
-%D
+%D the meaning of the names:
+%D
%D \starttypen
%D \expandafter\show\csname NameA\endcsname
-%D
+%D
%D \show\NameB
%D \stoptypen
%D
@@ -679,7 +710,7 @@
%D with some macroname that always is dealt with that way.
%D Confusion can however arise when one applies both testing
%D methods to the same macroname. By the way, the assignment
-%D of \type{\relax} obeys grouping.
+%D of \type{\relax} obeys grouping.
%D The first one gets rid of \type{#1}, but still expands to
%D something and the second one expands to \type{#1}. Because
@@ -736,7 +767,7 @@
{\let\donottest\dontprocesstest
\expandafter\ifx\csname#1\endcsname\relax}
-\def\doifundefinedelse#1#2#3%
+\def\doifundefinedelse#1#2#3%
{\p!doifundefined{#1}%
\let\donottest\doprocesstest#2%
\else
@@ -768,40 +799,56 @@
\beginETEX \ifcsname
-\def\ifundefined#1% ongelukkige naam
+\def\ifundefined#1% ongelukkige naam
{\unless\ifcsname#1\endcsname}
\def\p!doifundefined#1%
- {\edef\p!defined{#1}%
- \@EA\unless\@EA\ifcsname\@EA\detokenize\@EA{\p!defined}\endcsname}
+ {\edef\p!defined{#1}%
+ \unless\ifcsname\detokenize\@EA{\p!defined}\endcsname}
-\def\doifundefinedelse#1#2#3%
+\def\doifundefinedelse#1% % #2#3%
{\edef\p!defined{#1}%
- \@EA\ifcsname\@EA\detokenize\@EA{\p!defined}\endcsname#3\else#2\fi}
+ \ifcsname\detokenize\@EA{\p!defined}\endcsname % #3\else#2\fi}
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
-\def\doifdefinedelse#1#2#3%
+\def\doifdefinedelse#1% % #2#3%
{\edef\p!defined{#1}%
- \@EA\ifcsname\@EA\detokenize\@EA{\p!defined}\endcsname#2\else#3\fi}
+ \ifcsname\detokenize\@EA{\p!defined}\endcsname % #2\else#3\fi}
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
-\def\doifundefined#1#2%
+\def\doifundefined#1% % #2%
{\edef\p!defined{#1}%
- \@EA\ifcsname\@EA\detokenize\@EA{\p!defined}\endcsname\else#2\fi}
+ \ifcsname\detokenize\@EA{\p!defined}\endcsname % \else#2\fi}
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
-\def\doifdefined#1#2%
+\def\doifdefined#1% % #2%
{\edef\p!defined{#1}%
- \@EA\ifcsname\@EA\detokenize\@EA{\p!defined}\endcsname#2\fi}
+ \ifcsname\detokenize\@EA{\p!defined}\endcsname % #2\fi}
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
\endETEX
-%D \macros
+%D \macros
%D {letbeundefined}
-%D
+%D
%D Testing for being undefined comes down to testing on \type
%D {\relax} when we use \type {\csname}, but when using \type
%D {\ifx}, we test on being \type {\undefined}! In \ETEX\ we
%D have \type {\ifcsname} and that way of testing on existance
-%D is not the same as the one described here. Therefore we
-%D introduce:
+%D is not the same as the one described here. Therefore we
+%D introduce:
\beginTEX
@@ -812,23 +859,23 @@
\beginETEX \undefined
-\def\letbeundefined#1%
+\def\letbeundefined#1% potential stack buildup when used \global
{\expandafter\let\csname#1\endcsname\undefined}
\endETEX
-%D Beware, being \type {\undefined} in \ETEX\ means that the macro
-%D {\em is} defined!
+%D Beware, being \type {\undefined} in \ETEX\ means that the macro
+%D {\em is} defined!
-%D Before we start using this variant, we used another one,
-%D which is even a bit faster. This one looked like:
-%D
+%D Before we start using this variant, we used another one,
+%D which is even a bit faster. This one looked like:
+%D
%D \starttypen
%D \def\p!doifundefined%
%D {\begingroup
%D \let\donottest=\dontprocesstest
%D \ifundefined}
-%D
+%D
%D \def\doifundefinedelse#1#2#3%
%D {\p!doifundefined{#1}%
%D \endgroup#2%
@@ -836,31 +883,31 @@
%D \endgroup#3%
%D \fi}
%D \stoptypen
-%D
-%D A even more previous version used \type{\bgroup} and
+%D
+%D A even more previous version used \type{\bgroup} and
%D \type {\egroup}. In math mode however, \type{$1{x}2$} differs
-%D from \type{$1x2$}. This can been seen when one compares the
-%D output of:
-%D
-%D \starttypen
+%D from \type{$1x2$}. This can been seen when one compares the
+%D output of:
+%D
+%D \starttypen
%D $\kern10pt\showthe\lastkern$
%D $\kern10pt{\showthe\lastkern}$
%D $\kern10pt\begingroup\showthe\lastkern\endgroup$
%D \stoptypen
-%D
-%D Also in math mode, one can better use \type {\begingroup}
+%D
+%D Also in math mode, one can better use \type {\begingroup}
%D and companion instead of \type {\bgroup}.
-%D
-%D When we were developing the scientific units module, we
-%D encountered different behavior in text and math mode, which
-%D was due to this grouping subtilities. We therefore decided
-%D to use \type{\begingroup} instead of \type{\bgroup}.
-%D Later, when we had optimized some macro's the grouped
-%D solution turned out to be unsafe when typesetting this
-%D documentation, especially when using \type{\globaldefs}.
-%D
-%D We still have to define \type{\doifalldefinedelse}. Watch
-%D the use of grouping, which garantees local use of the
+%D
+%D When we were developing the scientific units module, we
+%D encountered different behavior in text and math mode, which
+%D was due to this grouping subtilities. We therefore decided
+%D to use \type{\begingroup} instead of \type{\bgroup}.
+%D Later, when we had optimized some macro's the grouped
+%D solution turned out to be unsafe when typesetting this
+%D documentation, especially when using \type{\globaldefs}.
+%D
+%D We still have to define \type{\doifalldefinedelse}. Watch
+%D the use of grouping, which garantees local use of the
%D boolean \type{\ifdone}.
\beginTEX
@@ -870,15 +917,17 @@
\donefalse
\fi}
-\def\doifalldefinedelse#1#2#3%
+\def\doifalldefinedelse#1% % #2#3%
{\begingroup
\let\donottest\dontprocesstest
\donetrue
\processcommalist[#1]\docheckonedefined
\ifdone
- \endgroup\let\donottest\doprocesstest#2%
+ \endgroup\let\donottest\doprocesstest
+ \expandafter\firstoftwoarguments % #2%
\else
- \endgroup\let\donottest\doprocesstest#3%
+ \endgroup\let\donottest\doprocesstest
+ \expandafter\secondoftwoarguments % #3%
\fi}
\endTEX
@@ -890,14 +939,13 @@
\donefalse
\fi}
-\def\doifalldefinedelse#1#2#3%
+\def\doifalldefinedelse#1% % #2#3%
{\begingroup
- \donetrue
- \processcommalist[#1]\docheckonedefined
+ \donetrue \processcommalist[#1]\docheckonedefined
\ifdone
- \endgroup#2%
+ \endgroup\expandafter\firstoftwoarguments % #2%
\else
- \endgroup#3%
+ \endgroup\expandafter\secondoftwoarguments % #3%
\fi}
\endETEX
@@ -990,11 +1038,37 @@
{\edef\!!stringa{#1}\edef\!!stringb{#2}%
\ifx\!!stringa\!!stringb#3\else#4\fi}
+% slightly faster on big arguments
+
+\long\def\doif#1#2%
+ {\edef\!!stringa{#1}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\doifnot#1#2%
+ {\edef\!!stringa{#1}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\long\def\doifelse#1#2%
+ {\edef\!!stringa{#1}\edef\!!stringb{#2}%
+ \ifx\!!stringa\!!stringb
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
\endETEX
%D One could wonder why we don't follow the the same approach
-%D as in \type{\doifdefined} c.s.\ and use \type{\begingroup}
-%D and \type{\endgroup}. In this case, this alternative is
+%D as in \type{\doifdefined} c.s.\ and use \type{\begingroup}
+%D and \type{\endgroup}. In this case, this alternative is
%D slower, which is probably due to the fact that more meanings
%D need to be restored.
%D
@@ -1031,31 +1105,34 @@
%D
%D \starttypen
%D \doifempty {string} {...}
-%D \doifnot {string} {...}
+%D \doifnotempty {string} {...}
%D \doifemptyelse {string} {then ...} {else ...}
%D \stoptypen
%D
%D This time, the string is not expanded.
-\long\def\doifemptyelse#1#2#3%
+\long\def\doifemptyelse#1% % #2#3%
{\def\!!stringa{#1}%
- \ifx\!!stringa\empty
- #2%
+ \ifx\!!stringa\empty % #2\else#3\fi}
+ \expandafter\firstoftwoarguments
\else
- #3%
+ \expandafter\secondoftwoarguments
\fi}
-\long\def\doifempty#1#2%
+\long\def\doifempty#1% % #2%
{\def\!!stringa{#1}%
- \ifx\!!stringa\empty
- #2%
+ \ifx\!!stringa\empty % #2\fi}
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
\fi}
-\long\def\doifnotempty#1#2%
+\long\def\doifnotempty#1% % #2%
{\def\!!stringa{#1}%
- \ifx\!!stringa\empty
+ \ifx\!!stringa\empty % \else#2\fi}
+ \expandafter\gobbleoneargument
\else
- #2%
+ \expandafter\firstofoneargument
\fi}
%D \macros
@@ -1108,9 +1185,9 @@
% \donetrue
% \let\p!docheckiteminset\gobbleoneargument
% \fi}
-%
+%
% \beginTEX
-%
+%
% \def\p!doifinsetelse#1#2%
% {\let\donottest\dontprocesstest
% \donefalse
@@ -1122,11 +1199,11 @@
% \fi
% \let\donottest\doprocesstest
% \ifdone}
-%
+%
% \endTEX
-%
+%
% \beginETEX \protected
-%
+%
% \def\p!doifinsetelse#1#2%
% {\donefalse
% \edef\!!stringa{#1}%
@@ -1136,7 +1213,7 @@
% \processcommalist[#2]\p!docheckiteminset
% \fi
% \ifdone}
-%
+%
% \endETEX
\def\p!docheckiteminset#1%
@@ -1161,6 +1238,8 @@
\endTEX
+% can be sped up with processnext...
+
\beginETEX \protected
\def\p!doifinsetelse#1#2%
@@ -1174,14 +1253,26 @@
\endETEX
-\long\def\doifinsetelse#1#2#3#4%
- {\p!doifinsetelse{#1}{#2}#3\else#4\fi}
+\long\def\doifinsetelse#1#2% % #3#4%
+ {\p!doifinsetelse{#1}{#2}% % #3\else#4\fi}
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
-\long\def\doifinset#1#2#3%
- {\p!doifinsetelse{#1}{#2}#3\fi}
+\long\def\doifinset#1#2% % #3%
+ {\p!doifinsetelse{#1}{#2}% % #3\fi}
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
-\long\def\doifnotinset#1#2#3%
- {\p!doifinsetelse{#1}{#2}\else#3\fi}
+\long\def\doifnotinset#1#2% % #3%
+ {\p!doifinsetelse{#1}{#2}% % \else#3\fi}
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
%D \macros
%D {doifcommon,doifnotcommon,doifcommonelse}
@@ -1239,9 +1330,9 @@
% \let\p!docommoncheck\gobbleoneargument
% \let\p!dodocommoncheck\gobbleoneargument
% \fi}
-%
+%
% \beginTEX
-%
+%
% \def\p!doifcommonelse#1#2%
% {\donefalse
% \let\donottest\dontprocesstest
@@ -1253,11 +1344,11 @@
% \processcommalist[#1]\p!docommoncheck
% \let\donottest\doprocesstest
% \ifdone}
-%
+%
% \endTEX
-%
+%
% \beginETEX \protected
-%
+%
% \def\p!doifcommonelse#1#2%
% {\donefalse
% \let\p!dodocommoncheck\p!dododocommoncheck
@@ -1267,7 +1358,7 @@
% \processcommalist[#2]\p!dodocommoncheck}%
% \processcommalist[#1]\p!docommoncheck
% \ifdone}
-%
+%
% \endETEX
\def\p!dodocommoncheck#1%
@@ -1284,7 +1375,7 @@
\let\donottest\dontprocesstest
\def\p!docommoncheck##1%
{\edef\!!stringa{##1}%
- \def\commalistelement{##1}%
+ \def\commalistelement{##1}% no let to stringa
\processcommalist[#2]\p!dodocommoncheck}%
\processcommalist[#1]\p!docommoncheck
\let\donottest\doprocesstest
@@ -1305,14 +1396,26 @@
\endETEX
-\long\def\doifcommonelse#1#2#3#4%
- {\p!doifcommonelse{#1}{#2}#3\else#4\fi}
+\long\def\doifcommonelse#1#2% % #3#4%
+ {\p!doifcommonelse{#1}{#2}% % #3\else#4\fi}
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
-\long\def\doifcommon#1#2#3%
- {\p!doifcommonelse{#1}{#2}#3\fi}
+\long\def\doifcommon#1#2% % #3%
+ {\p!doifcommonelse{#1}{#2}% % #3\fi}
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
-\long\def\doifnotcommon#1#2#3%
- {\p!doifcommonelse{#1}{#2}\else#3\fi}
+\long\def\doifnotcommon#1#2% % #3%
+ {\p!doifcommonelse{#1}{#2}% % \else#3\fi}
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
%D \macros
%D {processcommalist,processcommacommand,quitcommalist,
@@ -1326,9 +1429,9 @@
%D \stoptypen
%D
%D The user supplied command \type{\commando} receives one
-%D argument: the string. This command permits nesting and
+%D argument: the string. This command permits nesting and
%D spaces after commas are skipped. Empty sets are no problem.
-%D
+%D
%D \startbuffer
%D \def\dosomething#1{(#1)}
%D
@@ -1341,25 +1444,36 @@
%D 7: \processcommalist [] \dosomething \par
%D 8: \processcommalist [{[}] \dosomething \par
%D \stopbuffer
-%D
+%D
%D \typebuffer
%D
-%D Before we show the result, we present the macro's:
+%D Before we show the result, we present the macro's:
\newcount\commalevel
\def\dododoprocesscommaitem%
{\csname\s!next\the\commalevel\endcsname}
-\def\dodoprocesscommaitem%
+%\def\dodoprocesscommaitem%
+% {\ifx\nexttoken\blankspace
+% \let\nextcommaitem\redoprocesscommaitem
+% \else\ifx\nexttoken]%
+% \let\nextcommaitem\gobbleoneargument
+% \else
+% \let\nextcommaitem\dododoprocesscommaitem
+% \fi\fi
+% \nextcommaitem}
+%
+% faster ?
+
+\def\dodoprocesscommaitem
{\ifx\nexttoken\blankspace
- \let\nextcommaitem\redoprocesscommaitem
+ \@EA\redoprocesscommaitem
\else\ifx\nexttoken]%
- \let\nextcommaitem\gobbleoneargument
+ \@EAEAEA\gobbleoneargument
\else
- \let\nextcommaitem\dododoprocesscommaitem
- \fi\fi
- \nextcommaitem}
+ \@EAEAEA\dododoprocesscommaitem
+ \fi\fi}
\def\doprocesscommaitem%
{\futurelet\nexttoken\dodoprocesscommaitem}
@@ -1367,8 +1481,8 @@
%D Empty arguments are not processed. Empty items (\type{,,})
%D however are treated. We have to check for the special case
%D \type{[{a,b,c}]}.
-%D
-%D \starttypen
+%D
+%D \starttypen
%D \def\processcommalist[%
%D {\futurelet\nexttoken\docheckcommaitem}
%D
@@ -1388,20 +1502,20 @@
%D {#3{##1}\doprocesscommaitem}%
%D \doprocesscommaitem{#1}#2,]\relax
%D \global\advance\commalevel -1 }
-%D
+%D
%D \def\doprocesscommalistB#1]#2%
%D {\global\advance\commalevel 1
%D \long\expandafter\def\csname\s!next\the\commalevel\endcsname##1,%
%D {#2{##1}\doprocesscommaitem}%
%D \doprocesscommaitem#1,]\relax
%D \global\advance\commalevel -1 }
-%D \stoptypen
-%D
-%D However, this is not a the most straightforward solution!
-%D We can misuse one of \TEX's hidden features, and prepend
-%D and remove a \type {\relax}. By the way, although it
-%D involves less testing, this cleaner alternative is not
-%D faster.
+%D \stoptypen
+%D
+%D However, this is not a the most straightforward solution!
+%D We can misuse one of \TEX's hidden features, and prepend
+%D and remove a \type {\relax}. By the way, although it
+%D involves less testing, this cleaner alternative is not
+%D faster.
\def\processcommalist[%
{\futurelet\nexttoken\docheckcommaitem}
@@ -1412,14 +1526,14 @@
\else
\expandafter\doprocesscommalist
\fi
- \relax} % this one preserved the next {}
+ \relax} % this one preserved the next {}
\def\doprocesscommalist#1]#2%
- {\global\advance\commalevel 1
+ {\global\advance\commalevel \plusone
\long\expandafter\def\csname\s!next\the\commalevel\endcsname##1,%
{#2{##1}\doprocesscommaitem}%
\@EA\dodoprocesscommaitem\gobbleoneargument#1,]\relax
- \global\advance\commalevel -1 }
+ \global\advance\commalevel \minusone }
%D One way of quitting a commalist halfway is:
@@ -1436,7 +1550,7 @@
{\let\doprocesscommaitem\doquitcommalist}
%D The hack we used for checking the next character
-%D \type {\doifnextcharelse} is also used here.
+%D \type {\doifnextcharelse} is also used here.
\def\:{\redoprocesscommaitem}
@@ -1474,13 +1588,6 @@
%D Commands that are part of the list are expanded, so the
%D use of this macro has its limits.
-% why the \toks0? still needed?
-%
-% \def\processcommacommand[#1]%
-% {\edef\commacommand{#1}%
-% \toks0=\expandafter{\expandafter[\commacommand]}%
-% \expandafter\processcommalist\the\toks0 }
-
\def\processcommacommand[#1]%
{\expanded{\processcommalist[#1]}}
@@ -1529,7 +1636,7 @@
%D default=>\default,
%D unknown=>\unknown{... \commalistelement ...}]
%D \stoptypen
-%D
+%D
%D When \type{#1} is empty, this macro scans list \type{#2} for
%D the keyword \type{default} and executed the related action
%D if present. When \type{#1} is non empty and not in the list,
@@ -1539,8 +1646,8 @@
%D \type{\commalistelement}. An advanced example of the use of
%D this macro can be found in \PPCHTEX, where we completely
%D rely on \TEX\ for interpreting user supplied keywords like
-%D \type{SB}, \type{SB1..6}, \type{SB125} etc.
-%D
+%D \type{SB}, \type{SB1..6}, \type{SB125} etc.
+%D
%D Even a quick glance at the macros below show some overlap,
%D which means that more efficient alternatives are possible.
%D Because these macro's are very sensitive to subtle changes,
@@ -1621,7 +1728,7 @@
%D \advance\processlevel by -1 }}
%D \stoptypen
%D
-%D The gain of speed in the (again) next implementation is
+%D The gain of speed in the (again) next implementation is
%D around 20\%, depending on the application.
\newcount\processlevel
@@ -1642,12 +1749,12 @@
% \else
% \edef\!!stringb{#1}%
% \ifx\!!stringb\s!unknown
-% \def\commalistelement{#3}% beware of loops
+% \def\commalistelement{#3}% beware of loops
% #2%
% \fi
% \fi}
-% met \quitcommalist tot meer dan 25\% sneller
+% met \quitcommalist tot meer dan 25\% sneller
\def\p!compareprocessactionB[#1=>#2][#3]%
{\expandedaction\!!stringb{#1}%
@@ -1658,7 +1765,7 @@
\else
\edef\!!stringb{#1}%
\ifx\!!stringb\s!unknown
- \def\commalistelement{#3}% beware of loops
+ \def\commalistelement{#3}% beware of loops
#2%
\fi
\fi}
@@ -1683,7 +1790,7 @@
\beginETEX \protected
-\def\processaction[#1]#2[#3]%
+\def\processaction[#1]#2[#3]% faster version follows
{\expandedaction\!!stringa{#1}%
\ifx\!!stringa\empty
\let\p!compareprocessaction\p!compareprocessactionA
@@ -1728,7 +1835,7 @@
\fi
\fi}
-\def\processfirstactioninset[#1]#2[#3]%
+\def\processfirstactioninset[#1]#2[#3]% faster version follows
{\expandedaction\!!stringa{#1}%
\ifx\!!stringa\empty
\processaction[][#3]%
@@ -1774,44 +1881,132 @@
\def\doprocessallactionsinset%
{\csname\s!do\the\processlevel\endcsname}
-\def\processallactionsinset[#1]#2[#3]%
+\def\processallactionsinset[#1]#2[#3]% faster version follows
{\expandedaction\!!stringa{#1}%
\ifx\!!stringa\empty
\processaction[][#3]%
\else
- \advance\processlevel 1
+ \advance\processlevel \plusone
\expandafter\def\csname\s!do\the\processlevel\endcsname##1%
{\def\p!dodoprocessaction####1%
{\p!compareprocessactionD[####1][##1]}%
\processcommalist[#3]\p!dodoprocessaction}%
\processcommalist[#1]\doprocessallactionsinset
- \advance\processlevel -1
- \fi
+ \advance\processlevel \minusone
+ \fi
+ \expandactions}
+
+%D We can speed up these macros a bit when we use a dedicated
+%D commalist processor, one that avoids passing the (often)
+%D big action list.
+
+\beginTEX
+
+\def\processaction[#1]#2[%
+ {\let\donottest\dontprocesstest
+ \expandedaction\!!stringa{#1}%
+ \let\donottest\doprocesstest
+ \ifx\!!stringa\empty
+ \let\p!compareprocessaction\p!compareprocessactionA
+ \else
+ \let\p!compareprocessaction\p!compareprocessactionB
+ \fi
+ \def\p!doprocessaction##1%
+ {\p!compareprocessaction[##1][#1]}%
+ \processnextcommalist\relax\expandactions\p!doprocessaction[}
+
+\endTEX
+
+\beginETEX
+
+\def\processaction[#1]#2[%
+ {\expandedaction\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \let\p!compareprocessaction\p!compareprocessactionA
+ \else
+ \let\p!compareprocessaction\p!compareprocessactionB
+ \fi
+ \def\p!doprocessaction##1%
+ {\p!compareprocessaction[##1][#1]}%
+ \processnextcommalist\relax\expandactions\p!doprocessaction[}
+
+\endETEX
+
+\def\processfirstactionsinset[#1]%
+ {\expandedaction\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\processaction
+ \else
+ \expandafter\processfirstactionsinsetindeed
+ \fi
+ [#1]}
+
+\def\processfirstactioninsetindeed[#1]#2[#3]%
+ {\def\p!doprocessaction##1%
+ {\def\p!dodoprocessaction####1%
+ {\p!compareprocessactionC[####1][##1]}%
+ \processcommalist[#3]\p!dodoprocessaction}%
+ \processcommalist[#1]\p!doprocessaction
+ \expandactions}
+
+\def\processallactionsinset[#1]%
+ {\expandedaction\!!stringa{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\processaction
+ \else
+ \expandafter\processallactionsinsetindeed
+ \fi
+ [#1]}
+
+\def\processallactionsinsetindeed[#1]#2[#3]%
+ {\advance\processlevel \plusone
+ \expandafter\def\csname\s!do\the\processlevel\endcsname##1%
+ {\def\p!dodoprocessaction####1%
+ {\p!compareprocessactionD[####1][##1]}%
+ \processcommalist[#3]\p!dodoprocessaction}%
+ \processcommalist[#1]\doprocessallactionsinset
+ \advance\processlevel \minusone
\expandactions}
+\def\processnextcommalist#1#2#3[#4#5]%
+ {#1%
+ \let\nexttoken#4%
+ \global\advance\commalevel \plusone
+ \long\expandafter\def\csname\s!next\the\commalevel\endcsname##1,%
+ {#3{##1}\doprocesscommaitem}%
+ \dodoprocesscommaitem#4#5,]\relax
+ \global\advance\commalevel \minusone
+ #2}
+
+%D I do have an even faster version (saving 3 sec on a 13
+%D sec run for 50K invocations, but normally we don't have
+%D that many calls and that alternative uses more macros and is
+%D even less readable. What we did add, was \type {\@EA}, so
+%D that we can pass a command.
+
%D \macros
%D {unexpandedprocessaction,
%D unexpandedprocessfirstactioninset,
%D unexpandedprocessallactionsinset}
%D
-%D Now what are those expansion commands doing there. Well,
+%D Now what are those expansion commands doing there. Well,
%D sometimes we want to compare actions that may consist off
-%D commands (i.e. are no constants). In such occasions we can
-%D use the a bit slower alternatives:
+%D commands (i.e. are no constants). In such occasions we can
+%D use the a bit slower alternatives:
\def\unexpandedprocessfirstactioninset{\dontexpandactions\processfirstactioninset}
\def\unexpandedprocessaction {\dontexpandactions\processaction}
\def\unexpandedprocessallactionsinset {\dontexpandactions\processallactionsinset}
-%D By default we expand actions:
+%D By default we expand actions:
\def\expandactions%
{\let\expandedaction\edef}
\expandactions
-%D But when needed we convert the strings to meaningful
-%D sequences of characters.
+%D But when needed we convert the strings to meaningful
+%D sequences of characters.
\def\unexpandedaction#1>{}
@@ -1887,62 +2082,143 @@
%D #3%
%D \fi}
%D \stoptypen
-%D
+%D
%D Sometimes the second argument is passed as a macro. By
%D postponing the expansion of this macro, we gain quite some
%D run time, simply because the less tokens we pass, the faster
-%D \TEX\ runs. So finally the definition became:
+%D \TEX\ runs. So finally the definition became:
-\long\def\doifinstringelse#1#2#3#4%
- {\edef\@@@instring{#1}% expand #1 here
- \@EA\p!doifinstringelse\@EA{\@@@instring}{#2}%
- #3%
+\long\def\doifinstringelse#1%
+ {\edef\@@@instring{#1}% expand #1 here
+ \ifx\@@@instring\empty
+ \@EA\thirdofthreearguments
\else
- #4%
+ \@EA\dodoifinstringelse
\fi}
-\beginTEX
+\long\def\dodoifinstringelse#1%
+ {\p!doifinstringelse\@@@instring{#1}%
+ \@EA\firstoftwoarguments
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
-\long\def\p!doifinstringelse#1#2%
- {\long\def\pp!doifinstringelse##1#1##2##3\war%
- {\csname if\if##2@fals\else tru\fi e\endcsname}%
- \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+\long\def\doifinstring#1%%
+ {\edef\@@@instring{#1}% expand #1 here
+ \ifx\@@@instring\empty
+ \@EA\gobbletwoarguments
+ \else
+ \@EA\dodoifinstring
+ \fi}
-\endTEX
+\long\def\dodoifinstring#1%
+ {\p!doifinstringelse\@@@instring{#1}%
+ \@EA\firstofoneargument
+ \else
+ \@EA\gobbleoneargument
+ \fi}
-\beginETEX \unless
+%D \starttypen
+%D \beginTEX
+%D
+%D \long\def\p!doifinstringelse#1#2%
+%D {\long\def\pp!doifinstringelse##1#1##2##3\war%
+%D {\csname if\if##2@fals\else tru\fi e\endcsname}%
+%D \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+%D
+%D \endTEX
+%D
+%D \beginETEX \unless
+%D
+%D \long\def\p!doifinstringelse#1#2%
+%D {\long\def\pp!doifinstringelse##1#1##2##3\war%
+%D {\unless\if##2@}%
+%D \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+%D
+%D \endETEX
+%D \stoptypen
+%D
+%D And then \unknown\ after a couple of years, we ran into a
+%D situation where \type {##2} was something \type {{bla}}. So
+%D finally we need to use an auxiliary macro, otherwise we get
+%D funny strings in the output.
+
+% \long\def\p!doifinstringelse#1#2% ##2 can be {abc}
+% {\long\@EA\def\@EA\pp!doifinstringelse\@EA##\@EA1#1##2##3\war % expand #1 here
+% {\ppp!doifinstringelse##2\war}%
+% \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+%
+% \beginTEX
+%
+% \def\ppp!doifinstringelse#1#2\war%
+% {\csname if\ifx#1@fals\else tru\fi e\endcsname}%
+%
+% \endTEX
+%
+% \beginETEX \unless
+%
+% \def\ppp!doifinstringelse#1#2\war%
+% {\unless\ifx#1@}
+%
+% \endETEX
-\long\def\p!doifinstringelse#1#2%
- {\long\def\pp!doifinstringelse##1#1##2##3\war%
+\beginETEX
+
+\long\def\p!doifinstringelse#1#2% ##2 can be {abc}
+ {\long\@EA\def\@EA\pp!doifinstringelse\@EA##\@EA1#1##2##3\war % expand #1 here
{\unless\if##2@}%
- \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+% \expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+ \expanded{\pp!doifinstringelse#2#1}@@\war} % expand #2 here
\endETEX
+\beginTEX
+
+\long\def\p!doifinstringelse#1#2% ##2 can be {abc}
+ {\long\@EA\def\@EA\pp!doifinstringelse\@EA##\@EA1#1##2##3\war % expand #1 here
+ {\csname if\if##2@fals\else tru\fi e\endcsname}%
+ %\expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
+ \expanded{\pp!doifinstringelse#2#1}@@\war} % expand #2 here
+
+\endTEX
+
%D The next alternative proved to be upto twice as fast on
%D tasks like checking reserved words in pretty verbatim
%D typesetting! This is mainly due to the fact that passing
-%D (expanded) strings is much slower that passing a macro.
+%D (expanded) strings is much slower that passing a macro.
%D
%D \starttypen
%D \doifincsnameelse {substring} {\string} {then ...} {else ...}
%D \stoptypen
-%D
-%D Where \type{\doifinstringelse} does as much expansion as
-%D possible, the latter alternative does minimal (one level)
-%D expansion.
+%D
+%D Where \type{\doifinstringelse} does as much expansion as
+%D possible, the latter alternative does minimal (one level)
+%D expansion.
+
+\beginTEX
+
+\long\def\p!doifincsnameelse#1#2%
+ {\long\def\pp!doifincsnameelse##1#1##2##3\war
+ {\csname if\if##2@fals\else tru\fi e\endcsname}%
+ \@EA\pp!doifincsnameelse#2#1@@\war}
+
+\endTEX
+
+\beginETEX \unless
\long\def\p!doifincsnameelse#1#2%
- {\long\def\pp!doifincsnameelse##1#1##2##3\war%
- {\csname\if##2@iffalse\else iftrue\fi\endcsname}%
+ {\long\def\pp!doifincsnameelse##1#1##2##3\war
+ {\unless\if##2@}%
\@EA\pp!doifincsnameelse#2#1@@\war}
-\long\def\doifincsnameelse#1#2#3#4%
+\endETEX
+
+\long\def\doifincsnameelse#1#2% % #3#4%
{\edef\@@@instring{#1}%
- \@EA\p!doifincsnameelse\@EA{\@@@instring}{#2}%
- #3%
+ \@EA\p!doifincsnameelse\@EA{\@@@instring}{#2}% % #3\else#4\fi}
+ \expandafter\firstoftwoarguments
\else
- #4%
+ \expandafter\secondoftwoarguments
\fi}
%D \macros
@@ -1951,24 +2227,39 @@
%D The next macro executes a command depending of the outcome
%D of a test on numerals. This is probably one of the fastest
%D test possible, exept from a less robust 10||step
-%D \type{\if}||ladder or some tricky \type{\lcode} checking.
+%D \type{\if}||ladder or some tricky \type{\lcode} checking.
%D
%D \starttypen
%D \doifnumberelse {string} {then ...} {else ...}
%D \stoptypen
%D
%D The macro accepts \type{123}, \type{abc}, \type{{}},
-%D \type{\getal} and \type{\the\count...}. This macro is a
+%D \type{\getal} and \type{\the\count...}. This macro is a
%D rather dirty one.
-
-\long\def\doifnumberelse#1#2#3%
- {\begingroup\donefalse
- \ifcase1#1\or\or\or\or\or\or\or\or\or\else\donetrue\fi
- \ifdone\endgroup#2\else\endgroup#3\fi}
-
-%D The previous implementation was:
+%D
+%D \starttypen
+%D \long\def\doifnumberelse#1#2#3%
+%D {\begingroup\donefalse
+%D \ifcase1#1\or\or\or\or\or\or\or\or\or\else\donetrue\fi
+%D \ifdone\endgroup#2\else\endgroup#3\fi}
+%D \stoptypen
+%D
+%D Or better:
%D
%D \starttypen
+%D \long\def\doifnumberelse#1%
+%D {\begingroup\donefalse
+%D \ifcase1#1\or\or\or\or\or\or\or\or\or\else\donetrue\fi
+%D \ifdone
+%D \endgroup\expandafter\firstoftwoarguments
+%D \else
+%D \endgroup\expandafter\secondoftwoarguments
+%D \fi}
+%D \stoptypen
+%D
+%D A previous implementation was:
+%D
+%D \starttypen
%D \long\def\doifnumberelse#1#2#3%
%D {\getfirstcharacter{#1}%
%D \@EA\p!doifinstringelse\@EA{\firstcharacter}{1234567890}%
@@ -1977,8 +2268,9 @@
%D #3%
%D \fi}
%D \starttypen
-%D
-%D Before we had \type{\p!doifinstringelse} available, we used:
+%D
+%D And before we had \type{\p!doifinstringelse} available, we
+%D used:
%D
%D \starttypen
%D \def\doifnumberelse#1%
@@ -1986,19 +2278,32 @@
%D \rawdoifinsetelse{\firstcharacter}{1,2,3,4,5,6,7,8,9,0}}
%D \stoptypen
%D
-%D The current implementation is much faster, but the next
-%D one is not, not even when testing milion calls.
-%D
-%D \starttypen
+%D The implementation using \type {\ifcase} is much faster, but
+%D the next one is not, not even when testing milion calls.
+%D
+%D \starttypen
%D \newif\ifitsanumber
-%D
+%D
%D \long\def\isitanumber#1%
%D {\itsanumberfalse
%D \ifcase1#1\or\or\or\or\or\or\or\or\or\else\itsanumbertrue\fi}
-%D
+%D
%D \long\def\doifnumberelse#1#2#3%
%D {\isitanumber{#1}\ifitsanumber#2\else#3\fi}
-%D \stoptypen
+%D \stoptypen
+%D
+%D After a while the next evolved and this one is the one we
+%D will use. This one is some 5\% faster than the group/done
+%D one (partly because it does not have to pass arguments).
+%D Even more important is that this alternative is fully
+%D expandable!
+
+\long\def\doifnumberelse#1%
+ {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
%D \macros
%D {makerawcommalist,
@@ -2012,7 +2317,7 @@
%D alternatives come into focus. A major drawback is that
%D they do not take \type{\c!constants} into account, simply
%D because no expansion is done. This is no problem with
-%D \type{\rawprocesscommalist}, because this macro does not
+%D \type{\rawprocesscommalist}, because this macro does not
%D compare anything. Expandable macros are permitted as search
%D string.
%D
@@ -2024,9 +2329,9 @@
%D \stoptypen
%D
%D Spaces embedded in the list, for instance after commas,
-%D spoil the search process. The gain in speed depends on the
-%D length of the argument (the longer the argument, the less
-%D we gain).
+%D spoil the search process. The gain in speed depends on the
+%D length of the argument (the longer the argument, the less
+%D we gain).
%D
%D The slow alternative looks like:
%D
@@ -2042,11 +2347,17 @@
%D
%D But we prefer:
-\def\makerawcommalist[#1]#2%
- {\def\appendtocommalist##1%
- {\edef#2{##1}\def\appendtocommalist####1{\edef#2{#2,####1}}}%
+% \appendtocommalist is defined in syst-ext
+
+\def\makerawcommalist[#1]#2% use \processnext ... here
+ {\def\domakerawcommalist##1% we don't expand ##1
+ {\ifx#2\empty
+ \def#2{##1}%
+ \else
+ \@EA\def\@EA#2\@EA{#2,##1}%
+ \fi}%
\let#2\empty
- \processcommalist[#1]\appendtocommalist}
+ \processcommalist[#1]\domakerawcommalist}
\def\rawprocesscommaitem#1,%
{\if]#1\else
@@ -2054,14 +2365,51 @@
\expandafter\rawprocesscommaitem
\fi}
-\def\rawprocesscommalist[#1]#2%
- {\global\advance\commalevel 1
+\def\rawprocesscommalist[#1]#2% accepteert ook [\cs]
+ {\global\advance\commalevel \plusone
\expandafter\let\csname\s!next\the\commalevel\endcsname#2%
\expandafter\rawprocesscommaitem#1,],% \relax
- \global\advance\commalevel -1 }
+ \global\advance\commalevel \minusone }
+
+\def\rawprocesscommacommand[#1]% not really needed
+ {\expanded{\rawprocesscommalist[#1]}}
+
+% \def\rawdoifinsetelse#1#2{\doifinstringelse{,#1,}{,#2,}}
+% \def\rawdoifinset #1#2{\doifinstring {,#1,}{,#2,}}
+
+\def\@@rawempty{,,}
+
+\long\def\rawdoifinsetelse#1%
+ {\edef\@@@instring{,#1,}% expand #1 here
+ \ifx\@@@instring\@@rawempty
+ \@EA\thirdofthreearguments
+ \else
+ \@EA\rawdodoifinsetelse
+ \fi}
+
+\long\def\rawdodoifinsetelse#1%
+ {\p!doifinstringelse\@@@instring{,#1,}%
+ \@EA\firstoftwoarguments
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
+\long\def\rawdoifinset#1%
+ {\edef\@@@instring{,#1,}% expand #1 here
+ \ifx\@@@instring\@@rawempty
+ \@EA\gobbletwoarguments
+ \else
+ \@EA\rawdodoifinset
+ \fi}
+
+\long\def\rawdodoifinset#1%%
+ {\p!doifinstringelse\@@@instring{,#1,}%
+ \@EA\firstofoneargument
+ \else
+ \@EA\gobbleoneargument
+ \fi}
-\def\rawdoifinsetelse#1#2%
- {\doifinstringelse{,#1,}{,#2,}}
+%D Some more raw material:
\def\p!rawprocessaction[#1][#2]%
{\def\pp!rawprocessaction##1,#1=>##2,##3\war%
@@ -2072,7 +2420,7 @@
\def\rawprocessaction[#1]#2[#3]%
{\edef\!!stringa{#1}%
- \edef\!!stringb{undefined}% better \!!undefined
+ \edef\!!stringb{undefined}% better \!!undefined
\let\!!processaction\!!stringb
\ifx\!!stringa\empty
\@EA\p!rawprocessaction\@EA[\s!default][#3]%
@@ -2094,19 +2442,19 @@
% {\rawprocessaction[##1][#3]}%
% \processcommalist[#1]\docommando}
-%D When we process the list \type{a,b,c,d,e}, the raw routine
-%D takes over 30\% less time, when we feed $20+$ character
-%D strings we gain about 20\%. Alternatives which use
-%D \type{\futurelet} perform worse. Part of the speedup is
-%D due to the \type{\let} and \type{\expandafter} in the test.
+%D When we process the list \type{a,b,c,d,e}, the raw routine
+%D takes over 30\% less time, when we feed $20+$ character
+%D strings we gain about 20\%. Alternatives which use
+%D \type{\futurelet} perform worse. Part of the speedup is
+%D due to the \type{\let} and \type{\expandafter} in the test.
% %D \macros
% %D {processunexpandedcommalist}
% %D
% %D When processing commalists, the arguments are expanded. The
-% %D main reason for doing so lays in the fact that these
-% %D macros are used for interfacing. The next alternative can be used
-% %D for
+% %D main reason for doing so lays in the fact that these
+% %D macros are used for interfacing. The next alternative can be used
+% %D for
% %D
% %D \starttypen
% %D \processunexpandedcommalist
@@ -2114,8 +2462,8 @@
% %D \handleitem
% %D \stoptypen
% %D
-% %D This time nesting is not supported.
-%
+% %D This time nesting is not supported.
+%
% %\def\processunexpandedcommaitem#1,%
% % {\if]\noexpand#1%
% % \let\nextcommaitem\relax
@@ -2126,19 +2474,19 @@
% \nextcommaitem}
%
% faster:
-%
+%
% \def\processunexpandedcommaitem#1,%
% {\if]\noexpand#1\else
% \handleunexpandedcommaitem{#1}%
% \expandafter\processunexpandedcommaitem
% \fi}
-%
+%
% \def\processunexpandedcommalist[#1]#2%
% {\def\handleunexpandedcommaitem{#2}%
% \processunexpandedcommaitem#1,],}% \relax}
-%
-% %D Or faster:
-%
+%
+% %D Or faster:
+%
% \def\processunexpandedcommaitem#1,%
% {\if]\noexpand#1\else
% \handleunexpandedcommaitem{#1}%
@@ -2191,7 +2539,7 @@
%D price to pay in terms of speed. Compared to other packages
%D and taking the functionality of \CONTEXT\ into account, the
%D total size of the format file is still very acceptable. Now
-%D how are these assignments done.
+%D how are these assignments done.
%D
%D Assignments can be realized with:
%D
@@ -2214,7 +2562,7 @@
%D
%D We do check for the presence of an \type{=} and loudly
%D complain of it's missed. We will redefine this macro later
-%D on, when a more advanced message mechanism is implemented.
+%D on, when a more advanced message mechanism is implemented.
\def\showassignerror#1#2%
{\writestatus{setup}{missing '=' after '#1' in line #2}}
@@ -2329,21 +2677,14 @@
{\p!doassign#1[#2][##1==\relax]}%
\processcommalist[#4]\p!dogetparameter}
-\def\getparameters%
- {\dogetparameters\dosetvalue}
-
-\def\geteparameters%
- {\dogetparameters\dosetevalue}
-
-\def\getgparameters%
- {\dogetparameters\dosetgvalue}
-
-\def\forgetparameters%
- {\dogetparameters\doignorevalue}
+\def\getparameters {\dogetparameters\dosetvalue}
+\def\geteparameters {\dogetparameters\dosetevalue}
+\def\getgparameters {\dogetparameters\dosetgvalue}
+\def\forgetparameters{\dogetparameters\doignorevalue}
\let\getexpandedparameters=\geteparameters
-%D This one is slightly faster:
+%D This one is slightly faster:
\def\dogetparameters#1[#2]#3[#4%
{\if\noexpand#4]%
@@ -2356,6 +2697,44 @@
\def\xdogetparameters#1]%
{\processcommalist[#1]\p!dogetparameter}
+%D The next alternative is much faster but also uglier. Because
+%D in \XML\ processing we will probably set much more parameters
+%D than normally we need this faster one.
+
+\def\dogetparameters#1[#2]#3[#4%
+ {\if\noexpand#4]%
+ \expandafter\gobbleoneargument
+ \else
+ \def\p!dogetparameter{\p!doassign#1#2}%
+ \expandafter\xdogetparameters
+ \fi#4}
+
+\def\xdogetparameters#1]%
+ {\xprocesscommaitem#1,],\@relax@}
+
+\long\def\xprocesscommaitem#1,#2% #2 takes space before ,
+ {\if]#1%
+ \expandafter\gobbleoneargument
+ \else
+ \p!dogetparameter\@relax@#1==\@relax@
+ \expandafter\xprocesscommaitem
+ \fi#2}
+
+%D Here we use a slightly different assignment macro:
+
+\def\p!doassign#1#2\@relax@#3=#4=#5\@relax@
+ {\ifx\@relax@#5\@EA\xshowassignerror\else\@EA#1\fi{#2}{#3}{#4}}
+
+\def\xshowassignerror#1#2#3%
+ {\showassignerror{#2}{\the\inputlineno\space(#1)}}
+
+%D Now we also have to change the other macros that depend
+%D on this low level one.
+
+\def\doassign [#1][#2]{\p!doassign\dosetvalue #1\@relax@#2==\@relax@}
+\def\doeassign [#1][#2]{\p!doassign\dosetevalue #1\@relax@#2==\@relax@}
+\def\undoassign[#1][#2]{\p!doassign\doresetvalue#1\@relax@#2==\@relax@}
+
%D \macros
%D {getemptyparameters}
%D
@@ -2377,8 +2756,8 @@
%D Some \CONTEXT\ commands take their default setups from
%D others. All commands that are able to provide backgounds
%D or rules around some content, for instance default to the
-%D standard command for ruled boxes. Is situations like this
-%D we can use:
+%D standard command for ruled boxes. Is situations like this
+%D we can use:
%D
%D \starttypen
%D \copyparameters [to-label] [from-label] [name1,name2,...]
@@ -2428,7 +2807,7 @@
%D \doifassignmentelse {...} {then ...} {else ...}
%D \stoptypen
-% not robust
+% not robust
%
% \def\doifassignmentelse%
% {\doifinstringelse{=}}
@@ -2492,32 +2871,32 @@
\def\commalistsize{0}
\def\p!dogetcommalistsize#1%
- {\advance\commalistcounter 1 }
+ {\advance\commalistcounter\plusone}
\def\getcommalistsize[#1]%
- {\commalistcounter=0
+ {\commalistcounter\zerocount
\processcommalist[#1]\p!dogetcommalistsize % was [{#1}]
\edef\commalistsize{\the\commalistcounter}}
\def\getcommacommandsize[#1]%
{\edef\commacommand{#1}%
- \toks0=\expandafter{\expandafter[\commacommand]}%
- \expandafter\getcommalistsize\the\toks0 }
+ \scratchtoks\expandafter{\expandafter[\commacommand]}%
+ \expandafter\getcommalistsize\the\scratchtoks }
-% to be tested first
+% to be tested first
%
% \def\getcommacommandsize[#1]%
% {\expanded{\getcommalistsize[#1]}}
% \def\p!dogetfromcommalist#1%
-% {\advance\commalistcounter -1
+% {\advance\commalistcounter \minusone
% \ifcase\commalistcounter
% \def\commalistelement{#1}%
% \begingroup\def\doprocesscommaitem##1]{\endgroup}%
% \fi}
\def\p!dogetfromcommalist#1%
- {\advance\commalistcounter -1
+ {\advance\commalistcounter \minusone
\ifcase\commalistcounter
\def\commalistelement{#1}%
\expandafter\quitcommalist
@@ -2533,41 +2912,41 @@
% \toks0=\expandafter{\expandafter[\commacommand]}%
% \expandafter\getfromcommalist\the\toks0 }
-\def\getfromcommacommand[#1]%
+\def\getfromcommacommand[#1]%
{\expanded{\getfromcommalist[#1]}}
-%D Because 0, 1 and~2 are often asked for, we optimize this
-%D macro for those cases. The indirect call however slows
-%D down the other cases.
-%D
+%D Because 0, 1 and~2 are often asked for, we optimize this
+%D macro for those cases. The indirect call however slows
+%D down the other cases.
+%D
%D \starttypen
%D \def\p!dogetfirstfromcommalist [#1,#2]{\def\commalistelement{#1}}
%D \def\p!dogetsecondfromcommalist[#1,#2,#3]{\def\commalistelement{#2}}
%D \let\p!dogetotherfromcommalist=\getfromcommalist
-%D
-%D \def\getfromcommalist[#1]#2[#3]% optimized for 0,1,2
+%D
+%D \def\getfromcommalist[#1]#2[#3]% optimized for 0,1,2
%D {\ifcase#3\relax
%D \let\commalistelement\empty
%D \or
-%D \p!dogetfirstfromcommalist[#1,]%
+%D \p!dogetfirstfromcommalist[#1,]%
%D \or
-%D \p!dogetsecondfromcommalist[#1,,]%
+%D \p!dogetsecondfromcommalist[#1,,]%
%D \else
%D \p!dogetotherfromcommalist[#1][#3]%
%D \fi}
%D \stoptypen
%D
-%D Even worse, this alternative does not strip preceding
-%D spaces, which is what we want. So, we stick to the slow
-%D alternative.
+%D Even worse, this alternative does not strip preceding
+%D spaces, which is what we want. So, we stick to the slow
+%D alternative.
%D Watertight (and efficient) solutions are hard to find, due
-%D to the handling of braces during parameters passing and
-%D scanning. Nevertheless:
-%D
+%D to the handling of braces during parameters passing and
+%D scanning. Nevertheless:
+%D
%D \startbuffer
%D \def\dosomething#1{(#1=\commalistsize) }
-%D
+%D
%D \getcommalistsize [\hbox{$a,b,c,d,e,f$}] \dosomething 1
%D \getcommalistsize [{a,b,c,d,e,f}] \dosomething 1
%D \getcommalistsize [{a,b,c},d,e,f] \dosomething 4
@@ -2578,18 +2957,18 @@
%D \getcommalistsize [{[}] \dosomething 1
%D \stopbuffer
%D
-%D \typebuffer
+%D \typebuffer
+%D
+%D reports:
%D
-%D reports:
-%D
%D \haalbuffer
%D \macros
%D {dogetcommalistelement,dogetcommacommandelement}
-%D
-%D For low level (fast) purposes, we can also use the next
-%D alternative, which can handle 8~elements at most.
-%D
+%D
+%D For low level (fast) purposes, we can also use the next
+%D alternative, which can handle 8~elements at most.
+%D
%D \starttypen
%D \dogetcommalistelement1\from a,b,c\to\commalistelement
%D \stoptypen
@@ -2617,7 +2996,7 @@
%D When working with delimited arguments, spaces and
%D lineendings can interfere. The next set of macros uses
%D \TEX' internal scanner for grabbing everything between
-%D arguments. Forgive me the funny names.
+%D arguments. Forgive me the funny names.
%D
%D \starttypen
%D \dosingleargument\commando = \commando[#1]
@@ -2660,7 +3039,7 @@
%D started using some alternatives that provided empty
%D arguments (in fact optional ones) whenever the user failed
%D to supply them. Because this more complicated macros enable
-%D us to do some checking, we reimplemented the non||empty
+%D us to do some checking, we reimplemented the non||empty
%D ones.
\def\dosingleargument {\chardef\expectedarguments 1 \dosingleempty }
@@ -2751,7 +3130,7 @@
% {\noshowargumenterror#3\dodogetargument}
% {\doshowargumenterror#4\dodogetargument#1#2}}
%
-% faster ?
+% faster ?
\long\def\dogetargument#1#2#3#4%
{\let\charactertoken=#1%
@@ -2955,6 +3334,56 @@
\def\dosixtupleempty {\getsixtupleempty []}
\def\doseventupleempty{\getseventupleempty[]}
+%D Because some of these are called quite often, we will now
+%D replace the more general version by alternatives tuned for
+%D speed.
+
+\def\dosingleempty#1%
+ {\noshowargumenterror % \relax % prevents lookahead, brr
+ \doifnextcharelse[%
+ {\firstargumenttrue#1}
+ {\dosinglefakeempty#1}}
+
+\def\dodoubleempty#1%
+ {\noshowargumenterror % \relax % prevents lookahead, brr
+ \doifnextcharelse[%
+ {\dodoubletestempty#1}
+ {\dodoublefakeempty#1}}
+
+\def\dotripleempty#1%
+ {\noshowargumenterror % \relax % prevents lookahead, brr
+ \doifnextcharelse[%
+ {\dotripletestempty#1}
+ {\dotriplefakeempty#1}}
+
+\def\dosinglefakeempty#1%
+ {\firstargumentfalse#1[]}
+
+\def\dodoublefakeempty#1%
+ {\firstargumentfalse\secondargumentfalse#1[][]}
+
+\def\dotriplefakeempty#1%
+ {\firstargumentfalse\secondargumentfalse\thirdargumentfalse#1[][][]}
+
+\long\def\dodoubletestempty#1[#2]%
+ {\firstargumenttrue
+ \doifnextcharelse[%
+ {\secondargumenttrue #1[{#2}]}
+ {\secondargumentfalse#1[{#2}][]}}
+
+\long\def\dotripletestempty#1[#2]%
+ {\firstargumenttrue
+ \doifnextcharelse[%
+ {\dotripletestemptyx #1[{#2}]}
+ {\secondargumentfalse
+ \thirdargumentfalse #1[{#2}][][]}}
+
+\long\def\dotripletestemptyx#1[#2][#3]%
+ {\secondargumenttrue
+ \doifnextcharelse[%
+ {\thirdargumenttrue #1[{#2}][{#3}]}
+ {\thirdargumentfalse#1[{#2}][{#3}][]}}
+
%D \macros
%D {dosingleargumentwithset,
%D dodoubleargumentwithset,dodoubleemptywithset,
@@ -3029,6 +3458,21 @@
{\dotriplewithset\dotripleargument}
%D \macros
+%D {strippedcsname}
+%D
+%D The next macro can be very useful when using \type{\csname}
+%D like in:
+%D
+%D \starttypen
+%D \csname if\strippedcsname\something\endcsname
+%D \stoptypen
+%D
+%D This expands to \type{\ifsomething}.
+
+\def\strippedcsname%
+ {\expandafter\gobbleoneargument\string}
+
+%D \macros
%D {complexorsimple,complexorsimpleempty}
%D
%D Setups can be optional. A command expecting a setup is
@@ -3045,7 +3489,7 @@
%D \complexcommand [setup]
%D \stoptypen
%D
-%D executes, else we get
+%D executes, else we get
%D
%D \starttypen
%D \simplecommand
@@ -3057,67 +3501,118 @@
%D \complexorsimpleempty {command}
%D \stoptypen
%D
-%D Depending on the presence of \type{[setup]}, this one
-%D leads to one of:
+%D Depending on the presence of \type{[setup]}, this one
+%D leads to one of:
%D
%D \starttypen
%D \complexcommando [setup]
%D \complexcommando []
%D \stoptypen
%D
-%D Many \CONTEXT\ commands started as complex or simple ones,
+%D Many \CONTEXT\ commands started as complex or simple ones,
%D but changed into more versatile (more object oriented) ones
-%D using the \type{\get..argument} commands.
+%D using the \type{\get..argument} commands.
+
+% This method is needed when traditional tex is used with
+% the efficient definition (marked **) below.
+
+% an old one:
+%
+% \def\setnameofcommand#1% handles {abc} as well as \abc
+% {\begingroup
+% \escapechar=-1
+% \globaldefs=0 % pretty important!
+% \xdef\nameofcommand{\string#1}%
+% \endgroup}
+%
+% \def\complexorsimple#1%
+% {\setnameofcommand{#1}%
+% \doifnextcharelse{[}
+% {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
+% {\firstargumentfalse\getvalue{\s!simple \nameofcommand}}}
+%
+% \def\complexorsimpleempty#1%
+% {\setnameofcommand{#1}%
+% \doifnextcharelse{[}
+% {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
+% {\firstargumentfalse\getvalue{\s!complex\nameofcommand}[]}}
+%
+% a newer one:
\def\complexorsimple#1%
- {\setnameofcommand{#1}%
- \doifnextcharelse{[}
- {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
- {\firstargumentfalse\getvalue{\s!simple \nameofcommand}}}
+ {% \relax % prevents lookahead, brrr
+ \doifnextcharelse[%
+ {\firstargumenttrue \csname\s!complex\strippedcsname#1\endcsname}
+ {\firstargumentfalse\csname\s!simple \strippedcsname#1\endcsname}}
\def\complexorsimpleempty#1%
- {\setnameofcommand{#1}%
- \doifnextcharelse{[}
- {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
- {\firstargumentfalse\getvalue{\s!complex\nameofcommand}[]}}
-
-\def\setnameofcommand#1%
- {\begingroup
- \escapechar=-1
- \globaldefs=0 % pretty important!
- \xdef\nameofcommand{\string#1}%
- \endgroup}
+ {% \relax % prevents lookahead, brrr
+ \doifnextcharelse[%
+ {\firstargumenttrue \csname\s!complex\strippedcsname#1\endcsname}
+ {\firstargumentfalse\csname\s!complex\strippedcsname#1\endcsname[]}}
%D \macros
%D {definecomplexorsimple,definecomplexorsimpleempty}
%D
%D The previous commands are used that often that we found it
%D worthwile to offer two more alternatives. Watch the build
-%D in protection.
+%D in protection.
-\beginTEX
+% See earlier. Because we don't want \type {\simple..} and
+% \type {\complex..} commands to show up in expansions, we need
+% to pass them as \type {simple..} and \type {complex..}.
-\def\definewithnameofcommand#1#2%
- {\setnameofcommand{#2}%
- \@EA\def\@EA#2\@EA{\@EA\donottest\@EA#1\@EA{\nameofcommand}}}
+% \beginTEX
+%
+% \def\definewithnameofcommand#1#2%
+% {\setnameofcommand{#2}%
+% \@EA\def\@EA#2\@EA{\@EA\donottest\@EA#1\@EA{\nameofcommand}}}
+%
+% \def\definecomplexorsimple%
+% {\definewithnameofcommand\complexorsimple}
+%
+% \def\definecomplexorsimpleempty%
+% {\definewithnameofcommand\complexorsimpleempty}
+%
+% \endTEX
+%
+% \beginETEX \protected
+%
+% \def\definecomplexorsimple#1%
+% {\normalprotected\def#1{\complexorsimple#1}}
+%
+% \def\definecomplexorsimpleempty#1%
+% {\normalprotected\def#1{\complexorsimpleempty#1}}
+%
+% \endETEX
-\def\definecomplexorsimple%
- {\definewithnameofcommand\complexorsimple}
+% However, since this one uses an idirect method, things go
+% okay (at the cost of extra macros).
-\def\definecomplexorsimpleempty%
- {\definewithnameofcommand\complexorsimpleempty}
+% \def\definecomplexorsimple#1%
+% {\unexpanded\def#1{\complexorsimple#1}}
+%
+% \def\definecomplexorsimpleempty#1%
+% {\unexpanded\def#1{\complexorsimpleempty#1}}
+%
+% faster, since no \strippedcsname needed in call, but more spacy
-\endTEX
+\def\docomplexorsimple#1#2%
+ {\doifnextcharelse[{\firstargumenttrue#1}{\firstargumentfalse#2}}
-\beginETEX \protected
+\def\docomplexorsimpleempty#1%
+ {\doifnextcharelse[{\firstargumenttrue#1}{\firstargumentfalse#1[]}}
\def\definecomplexorsimple#1%
- {\normalprotected\def#1{\complexorsimple#1}}
+ {\unexpanded\edef#1%
+ {\noexpand\docomplexorsimple
+ \@EA\noexpand\csname\s!complex\strippedcsname#1\endcsname
+ \@EA\noexpand\csname\s!simple \strippedcsname#1\endcsname}}
\def\definecomplexorsimpleempty#1%
- {\normalprotected\def#1{\complexorsimpleempty#1}}
-
-\endETEX
+ {\unexpanded\edef#1%
+ {\noexpand\docomplexorsimpleempty
+ \@EA\noexpand\csname\s!complex\strippedcsname#1\endcsname}}
%D These commands are called as:
%D
@@ -3137,45 +3632,45 @@
%D \macros
%D {definestartstopcommand}
%D
-%D Those who get the creeps of expansion may skip the next
-%D one. It's one of the most recent additions and concerns
-%D \type{\start}||\type{\stop} pairs with complicated
+%D Those who get the creeps of expansion may skip the next
+%D one. It's one of the most recent additions and concerns
+%D \type{\start}||\type{\stop} pairs with complicated
%D arguments.
%D
-%D We won't go into details here, but the general form of
-%D this using this command is:
+%D We won't go into details here, but the general form of
+%D this using this command is:
%D
%D \starttypen
%D \definestartstopcommand\somecommand\e!specifier{arg}{arg}%
-%D {do something with arg}
+%D {do something with arg}
%D \stoptypen
%D
%D This expands to something like:
%D
%D \starttypen
%D \def\somecommand arg \startspecifier arg \stopspecifier%
-%D {do something with arg}
+%D {do something with arg}
%D \stoptypen
%D
-%D The arguments can be anything reasonable, but double
+%D The arguments can be anything reasonable, but double
%D \type{#}'s are needed in the specification part, like:
%D
%D \starttypen
%D \definestartstopcommand\somecommand\e!specifier{[##1][##2]}{##3}%
-%D {do #1 something #2 with #3 arg}
+%D {do #1 something #2 with #3 arg}
%D \stoptypen
%D
-%D which becomes:
+%D which becomes:
%D
%D \starttypen
%D \def\somecommand[#1][#2]\startspecifier#3\stopspecifier%
-%D {do #1 something #2 with #3 arg}
+%D {do #1 something #2 with #3 arg}
%D \stoptypen
%D
-%D We will see some real applications of this command in the
-%D core modules.
+%D We will see some real applications of this command in the
+%D core modules.
-\def\definestartstopcommand#1#2#3#4%
+\def\definestartstopcommand#1#2#3#4% can be done with \expanded
{\def\!stringa{#3}%
\def\!stringb{\e!start#2}%
\def\!stringc{#4}%
@@ -3191,11 +3686,11 @@
%D \macros
%D {dosinglegroupempty,dodoublegroupempty,dotriplegroupempty,
%D doquadruplegroupempty, doquintuplegroupempty}
-%D
-%D We've already seen some commands that take care of
-%D optional arguments between \type{[]}. The next two commands
-%D handle the ones with \type{{}}. They are called as:
-%D
+%D
+%D We've already seen some commands that take care of
+%D optional arguments between \type{[]}. The next two commands
+%D handle the ones with \type{{}}. They are called as:
+%D
%D \starttypen
%D \dosinglegroupempty \ineedONEargument
%D \dodoublegroupempty \ineedTWOarguments
@@ -3203,15 +3698,15 @@
%D \doquadruplegroupempty \ineedFOURarguments
%D \doquintuplegroupempty \ineedFIVEarguments
%D \stoptypen
-%D
-%D where \type{\ineedONEargument} takes one and the others
-%D two and three arguments. These macro's were first needed in
-%D \PPCHTEX.
-%D
+%D
+%D where \type{\ineedONEargument} takes one and the others
+%D two and three arguments. These macro's were first needed in
+%D \PPCHTEX.
+%D
%D \starttypen
%D \def\dogetgroupargument#1#2% redefined in mult-ini
%D {\def\nextnextargument%
-%D {\ifx\nextargument\bgroup
+%D {\ifx\nextargument\bgroup
%D \let\expectedarguments\noexpectedarguments
%D \def\nextargument{#1\dodogetargument}%
%D %\else\ifx\nextargument\lineending % this can be an option
@@ -3230,11 +3725,11 @@
%D \fi%\fi\fi % so let's get rid of it
%D \nextargument}%
%D \futurelet\nextargument\nextnextargument}
-%D \stoptypen
+%D \stoptypen
%D
-%D In order to catch \type {\nextargument}'s that expand to
-%D \type {\if} and friends, in practice we will use a
-%D slightly more complicated macro.
+%D In order to catch \type {\nextargument}'s that expand to
+%D \type {\if} and friends, in practice we will use a
+%D slightly more complicated macro.
\let\normalif \if
\let\normalifx \ifx
@@ -3243,6 +3738,8 @@
\let\normalifcat \ifcat
\let\normalifcase \ifcase
\let\normalifcsname \ifcsname
+\let\normalifhmode \ifhmode
+\let\normalifvmode \ifvmode
\let\normalor \or
\let\normalelse \else
\let\normalfi \fi
@@ -3263,8 +3760,8 @@
\let\endrobusttest\endgroup
% \def\dogetgroupargument#1#2%
-% {\def\nextnextargument%
-% {\normalifx\nextargument\bgroup
+% {\def\nextnextargument%
+% {\normalifx\nextargument\bgroup
% \endrobusttest
% \let\expectedarguments\noexpectedarguments
% \def\nextargument{#1\dodogetargument}%
@@ -3285,8 +3782,8 @@
% \futurelet\nextargument\nextnextargument}
% \def\dogetgroupargument#1#2%
-% {\def\nextnextargument%
-% {\normalifx\nextargument\bgroup
+% {\def\nextnextargument%
+% {\normalifx\nextargument\bgroup
% \endrobusttest
% \noshowargumenterror
% \def\nextargument{#1\dodogetargument}%
@@ -3325,7 +3822,7 @@
\endrobusttest
\def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}%
\normalelse
- \endrobusttest
+ \endrobusttest
\doshowargumenterror
\def\nextargument{#2\dodogetargument{}}%
\normalfi\normalfi
@@ -3370,7 +3867,7 @@
{\def\dodogetargument%
{\dontpermitspacesbetweengroups
#1{##1}{####1}{########1}}%
- \dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
+ \dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
\dogetgroupargument\thirdargumenttrue\thirdargumentfalse}%
\dogetgroupargument\secondargumenttrue\secondargumentfalse}%
\dogetgroupargument\firstargumenttrue\firstargumentfalse}
@@ -3383,31 +3880,51 @@
{\def\dodogetargument%
{\dontpermitspacesbetweengroups
#1{##1}{####1}{########1}{################1}}%
- \dogetgroupargument\fifthargumenttrue\fifthargumentfalse}%
- \dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
+ \dogetgroupargument\fifthargumenttrue\fifthargumentfalse}%
+ \dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
\dogetgroupargument\thirdargumenttrue\thirdargumentfalse}%
\dogetgroupargument\secondargumenttrue\secondargumentfalse}%
\dogetgroupargument\firstargumenttrue\firstargumentfalse}
-%D These macros can explictly take care of spaces, which means
+%D These macros can explictly take care of spaces, which means
%D that the next definition and calls are valid:
-%D
+%D
%D \starttypen
%D \def\test#1#2#3{[#1#2#3]}
-%D
+%D
%D \dotriplegroupempty\test {a}{b}{c}
-%D \dotriplegroupempty\test {a}{b}
+%D \dotriplegroupempty\test {a}{b}
%D \dotriplegroupempty\test {a}
-%D \dotriplegroupempty\test
+%D \dotriplegroupempty\test
%D \dotriplegroupempty\test {a} {b} {c}
-%D \dotriplegroupempty\test {a} {b}
-%D \dotriplegroupempty\test
-%D {a}
-%D {b}
+%D \dotriplegroupempty\test {a} {b}
+%D \dotriplegroupempty\test
+%D {a}
+%D {b}
%D \stoptypen
%D
%D And alike.
+%D \macros
+%D {firstofoneargument, firstoftwoarguments, firstofthreearguments
+%D secondoftwoarguments, secondofthreearguments,
+%D thirdofthreearguments}
+%D
+%D The next six macros (dedicated to Taco) can conveniently
+%D used to select arguments. Their names explain their
+%D functionality.
+
+\long\def\firstofoneargument #1{#1}
+\long\def\firstoftwoarguments #1#2{#1}
+\long\def\firstofthreearguments #1#2#3{#1}
+\long\def\firstoffourarguments #1#2#3#4{#1}
+\long\def\secondoftwoarguments #1#2{#2}
+\long\def\secondofthreearguments #1#2#3{#2}
+\long\def\secondoffourarguments #1#2#3#4{#2}
+\long\def\thirdofthreearguments #1#2#3{#3}
+\long\def\thirdoffourarguments #1#2#3#4{#3}
+\long\def\fourthoffourarguments #1#2#3#4{#4}
+
%D \macros
%D {wait}
%D
@@ -3440,13 +3957,13 @@
%D \type{\statuswidth}.
% \chardef\statuswidth=15
-%
+%
% \def\writestring%
% {\immediate\write16}
-%
+%
% \def\writeline%
% {\writestring{}}
-%
+%
% \def\dosplitstatus#1#2\end%
% {\ifx#1?%
% \loop
@@ -3461,7 +3978,7 @@
% \fi
% \dosplitstatus#2\end
% \fi}
-%
+%
% \def\writestatus#1#2%
% {\begingroup
% \let\messagecontentA=\empty
@@ -3483,11 +4000,11 @@
\newcount\statuscounter
\def\dosplitstatus#1%
- {\advance\statuscounter -1
+ {\advance\statuscounter \minusone
\ifcase\statuscounter
\expandafter\nosplitstatus
\else
- \@EA\scratchtoks\@EA{\the\scratchtoks#1}%
+ \scratchtoks\@EA{\the\scratchtoks#1}%
\expandafter\dosplitstatus
\fi}
@@ -3502,19 +4019,20 @@
\space\space\space\space\space\space\space
\space\space\space\space\space\space\space
\space\space\space\space\space\space\end
- \expanded{\writestring{\the\scratchtoks\space:\space#2}}%
+ %\expanded{\writestring{\the\scratchtoks\space:\space#2}}%
+ \@EA\writestring\@EA{\the\scratchtoks\space:\space#2}%
\endgroup}
-%D The next implementation saves only some 10 words of format
+%D The next implementation saves only some 10 words of format
%D memory, but we hardly gain any speed.
%D
-%D \starttypen
+%D \starttypen
%D \def\dosplitstatus#1#2#3#4#5#6#7#8#9%
%D {#1#2#3#4#5#6#7#8#9\dodosplitstatus}
%D
%D \def\dodosplitstatus#1#2#3#4#5#6\end%
%D {#1#2#3#4#5}
-%D
+%D
%D \def\writestatus#1#2%
%D {\writestring
%D {\expandafter\dosplitstatus#1%
@@ -3527,7 +4045,7 @@
%D \macros
%D {emptytoks}
%D
-%D For this we need an empty token register, analogous
+%D For this we need an empty token register, analogous
%D to \type {\empty}.
\newtoks\emptytoks
@@ -3552,7 +4070,7 @@
\writestatus{loading}{Context System Macros / General}
-%D Well, the real final command is the one that resets the
+%D Well, the real final command is the one that resets the
%D unprotected characters \type{@}, \type{?} and \type{!}.
\protect
diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex
index 3d3bee72f..eec5d6f6c 100644
--- a/tex/context/base/syst-new.tex
+++ b/tex/context/base/syst-new.tex
@@ -11,18 +11,109 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Code from this module will move. For instance to
+%D syst-dat.tex (datastructures).
+
\unprotect
+
+% For myself
+
+\newcount\nofprofiled
+
+\def\profilemacro#1%
+ {\nofprofiled=0
+ \letvalue{\string#1\string#1}#1%
+ \appendtoks
+ \writestatus{\m!systems}{profile \string#1: \number\nofprofiled}%
+ \to \everystoptext
+ \unexpanded\def#1%
+ {\global\advance\nofprofiled\plusone
+ \csname\string#1\string#1\endcsname}}
+
+% pretty ugly but fast
+
+% \copycsname xxx\endcsname\csname ..\endcsname
+
+\def\copycsname{\@EA\@EA\@EA\let\@EA\@EA\csname}
+
+% \letcscsname \crap \csname ..\endcsname
+% \letcsnamecs \csname ..\endcsname\crap
+% \letcsnamecsname\csname ..\endcsname\csname ..\endcsname
+
+\def\letcscsname {\@EA\let\@EA}
+\def\letcsnamecs {\@EA\let}
+\def\letcsnamecsname{\@EA\@EA\@EA\let\@EA\@EA}
+
+% another one, add an item to a commalist
+
+\def\addvalue#1#2% cs item
+ {\ifundefined{#1}\@EA\let\csname#1\endcsname\empty\fi
+ \expanded{\addtocommalist{#2}\@EA\noexpand\csname#1\endcsname}}
+
+% faster, and looks okay
+
+\dostepwiserecurse{0}{255}{1}
+ {\@EA\chardef\csname-\recurselevel\endcsname\recurselevel}
+
+\newtoks\withminorcharacters
+\newtoks\withlowercharacters
+\newtoks\withuppercharacters
+
+% \thewithcharacter#1 % self
+
+\dostepwiserecurse{0}{31}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withminorcharacters}}
+
+\dostepwiserecurse{32}{127}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withlowercharacters}}
+
+\dostepwiserecurse{128}{255}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withuppercharacters}}
+
+\def\doassigncatcodes#1%
+ {\def\withcharacter##1{\catcode##1#1}%
+ \the\withminorcharacters
+ \the\withlowercharacters
+ \ifeightbitcharacters\the\withuppercharacters\fi}
+
+\def\makeallother%
+ {\doassigncatcodes\@@other}
+
+\chardef\obeyedlccode=`. % so <32 and >127 chars become .
+
+%\def\obeylccodes%
+% {\def\withcharacter##1{\lccode##1##1}%
+% \the\withlowercharacters
+% \def\withcharacter##1{\lccode##1\obeyedlccode}%
+% \the\withminorcharacters
+% \ifeightbitcharacters\the\withuppercharacters\fi}
+
+\def\setownlccode #1{\lccode#1#1}
+\def\setobeyedlccode#1{\lccode#1\obeyedlccode}
+
+\def\obeylccodes%
+ {\let\withcharacter\setownlccode
+ \the\withlowercharacters
+ \let\withcharacter\setobeyedlccode
+ \the\withminorcharacters
+ \ifeightbitcharacters\the\withuppercharacters\fi}
\def\unspaced#1%
{\dounspaced#1\end}
\def\dounspaced#1%
{\ifx#1\end
- \else\ifx#1\blankspace
- \@EA\@EA\@EA\dounspaced
+ \@EA\gobbleoneargument
\else
- #1\@EA\@EA\@EA\dounspaced
- \fi\fi}
+ \ifx#1\blankspace\else#1\fi
+ \fi
+ \dounspaced}
\def\unspaceargument#1\to#2%
{\convertargument#1\to#2%
@@ -30,10 +121,53 @@
\def\unspaceafter#1#2%
{\edef\ascii{\dounspaced#2\end}\@EA#1\@EA{\ascii}}
+
+
+% etex, much faster
+%
+% \def\unspaceargument#1\to#2%
+% {\scratchcounter\catcode'32\catcode32=\@@ignore
+% \scantokens{\edef#2{#1}}%
+% \catcode32=\scratchcounter}
+
+\def\unspaceafter#1#2%
+ {\edef\ascii{\dounspaced#2\end}\@EA#1\@EA{\ascii}}
+
+% this will replace loadfile once and alike !!! todo
+
+\def\@flg@{@flg@}
+
+\def\setflag#1%
+ {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname=0 }
+
+\def\resetflag#1%
+ {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname=1 }
+
+\let\ifflagged\ifcase
+
+\def\flag#1{\csname\@flg@#1\endcsname}
+
+\def\doifelseflagged#1%
+ {\@EA\ifx\csname\@flg@#1\endcsname\relax
+ \@EA\secondoftwoarguments
+ \else\ifcase\csname\@flg@#1\endcsname
+ \@EAEAEA\firstoftwoarguments
+ \else
+ \@EAEAEA\secondoftwoarguments
+ \fi\fi}
+
+\def\doifnotflagged#1%
+ {\@EA\ifx\csname\@flg@#1\endcsname\relax
+ \@EA\firstofoneargument
+ \else\ifcase\csname\@flg@#1\endcsname
+ \@EAEAEA\gobbleoneargument
+ \else
+ \@EAEAEA\firstofoneargument
+ \fi\fi}
\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey % [bypasses k!prefix]
- {\@EA\@EA\@EA\def\@EA\csname\@EA#1\@EA#3\@EA
- \endcsname\@EA{\csname#1#5\endcsname}}
+ {\@EAEAEA\def\@EA\csname\@EA#1\@EA#3\@EA\endcsname\@EA
+ {\csname#1#5\endcsname}}
% \buildarray[test][aa,bb,cc,dd,ee,ff]
% \setarrayelement{test}{1}{qq}
@@ -89,14 +223,14 @@
% here ?
\def\dosetrawvalue#1#2#3%
- {\setvalue{#1#2}{#3}}
+ {\@EA\def\csname#1#2\endcsname{#3}}
\def\getrawparameters%
{\dogetparameters\dosetrawvalue}
\def\splitskip#1%
- {\scratchskip=0pt plus 1pt minus 1pt
- \advance\scratchskip by #1
+ {\scratchskip\zeropoint \!!plus 1pt \!!minus 1pt
+ \advance\scratchskip#1\relax % \relax is realy needed here
\expandafter\SPLITSKIP\the\scratchskip}
{\catcode`\.=\@@other
@@ -113,8 +247,8 @@
\def\DOSPLITSKIP#1 #2 #3
{\dimen0=#1pt\dimen2=#2pt\dimen4=#3pt
- \advance\dimen2 by -1pt%
- \advance\dimen4 by -1pt}
+ \advance\dimen2 -1pt%
+ \advance\dimen4 -1pt}
% \def\minimaxskip#1#2%
% {\splitskip#2\relax
@@ -140,15 +274,11 @@
\newcount\modcounter
\def\DoMod #1by#2to#3%
- {\modcounter=#1\relax
- \divide\modcounter by #2\relax
- \multiply\modcounter by #2\relax
- #3=#1\relax
- \advance#3 by -\modcounter}
+ {\modcounter#1\divide\modcounter#2\multiply\modcounter#2%
+ #3#1\advance#3 -\modcounter}
\def\DoDiv #1by#2to#3%
- {#3=#1\relax
- \divide#3 by #2\relax}
+ {#3#1\divide#3 #2\relax}
\def\dounprotected#1\par%
{#1\protect}
@@ -209,18 +339,21 @@
\newcount\featuretest
\def\testfeature#1#2%
- {\def\dotestfeature%
+ {\def\dotestfeature
{\advance\featuretest 1
\ifnum\featuretest<#1\relax#2\expandafter\dotestfeature\fi}%
\retestfeature}
-\def\retestfeature%
+\def\retestfeature
{\bgroup
\ifcase\interactionmode\let\wait\relax\fi
\message{starting feature test}\wait
\featuretest=-1 \dotestfeature
\message{feature test done}\wait
\egroup}
+
+\def\testfeatureonce#1#2%
+ {\let\wait\relax\testfeature{#1}{#2}\end}
%D \macros
%D {adddimenregister,adddimenmacro}
@@ -267,6 +400,12 @@
\def\freezedimenmacro#1%
{\scratchdimen#1\edef#1{\the\scratchdimen}}
+%D The next one is slower:
+%D
+%D \starttypen
+%D \def\freezedimenmacro#1{\edef#1{\the\dimexpr(#1)}}
+%D \stoptypen
+
% \newcount\rawrecursecounter
%
% \def\rawrecurselevel{\the\rawrecursecounter}%
@@ -346,6 +485,23 @@
\let\donothing\empty
-\protect
+% The following macros are used in XML handling.
+
+\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}
-\endinput
+\def\unstringdouble"#1"{#1}
+\def\unstringsingle'#1'{#1}
+\def\unstringspaced #1 {#1}
+
+\def\grabstring%
+ {\dowithstringed\grabstringdouble\grabstringsingle\grabstringspaced}
+
+\def\grabstringdouble"#1"{\scratchtoks{#1}}
+\def\grabstringsingle'#1'{\scratchtoks{#1}}
+\def\grabstringspaced #1 {\scratchtoks{#1}}
+
+\protect \endinput
diff --git a/tex/context/base/syst-pln.tex b/tex/context/base/syst-pln.tex
new file mode 100644
index 000000000..dd777854d
--- /dev/null
+++ b/tex/context/base/syst-pln.tex
@@ -0,0 +1,636 @@
+%D \module
+%D [ file=syst-pln,
+%D version=2001.11.16, % 1999.03.17, % an oldie: 1995.10.10
+%D title=\CONTEXT\ System Macros,
+%D subtitle=Efficient \PLAIN\ \TEX\ 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.
+
+%D We used to load plain \TEX\ in a special way, but redefining
+%D a couple of primitives so that for instance font loading was
+%D ignored. For those interested, this loader is found in
+%D \type {syst-tex.tex}.
+
+%D This is a stripped down version of plain \TEX. We need this
+%D module to get started. Whole sections are missing here,
+%D like font loading and math. Thise are taken care of in
+%D dedicated modules. A few definitions are added (and
+%D marked as such).
+
+%D Characters can have special states, that can be triggered
+%D by setting their category coded. Some are preset, others
+%D are to be set as soon as possible, otherwise we cannot
+%D define any useful macros.
+
+%catcode`\^^@ = 9 % ascii null is ignored
+%catcode`\\ = 0 % backslash is TeX escape character
+
+\catcode`\{ = 1 % left brace is begin-group character
+\catcode`\} = 2 % right brace is end-group character
+\catcode`\$ = 3 % dollar sign is math shift
+\catcode`\& = 4 % ampersand is alignment tab
+\catcode`\# = 6 % hash mark is macro parameter character
+\catcode`\^ = 7 % circumflex and uparrow are for superscripts
+\catcode`\_ = 8 % underline and downarrow are for subscripts
+\catcode`\^^I = 10 % ascii tab is a blank space
+
+%catcode`\^^M = 5 % ascii return is end-line
+%catcode`\% = 14 % percent sign is comment character
+%catcode`\ = 10 % ascii space is blank space
+%catcode`\^^? = 15 % ascii delete is invalid
+
+\catcode`\~ = 13 % tilde is active
+\catcode`\^^L = 13 % ascii form-feed
+
+%catcode`\A = 11
+%.......
+%catcode`\Z = 11
+
+%catcode`\a = 11
+%.......
+%catcode`\z = 11
+
+\chardef\active = 13
+
+\def ^^L{\par}
+\def\^^M{\ } % control <return> = control <space>
+\def\^^I{\ } % same for <tab>
+
+%D In \CONTEXT, we simply ignore end||of||file tokens:
+
+\catcode`\^^Z=9
+
+%D First we define a simplified version of the \CONTEXT\
+%D protection mechanism.
+
+\def\unprotect{\catcode`@=11}
+\def\protect {\catcode`@=12}
+
+\unprotect
+
+%D We do not set up mathcodes here, but postpone that to the
+%D math modules.
+
+\mathcode`\ = "8000 % \space
+\mathcode`\' = "8000 % ^\prime
+\mathcode`\_ = "8000 % \_
+\mathcode`\^^? = "1273 % \smallint
+
+\sfcode`\)=0
+\sfcode`\'=0
+\sfcode`\]=0
+
+\chardef\@ne = 1
+\chardef\tw@ = 2
+\chardef\thr@@ = 3
+\chardef\sixt@@n = 16
+\chardef\@cclv = 255
+
+\mathchardef\@cclvi = 256
+\mathchardef\@m = 1000
+\mathchardef\@M = 10000
+\mathchardef\@MM = 20000
+
+%D Pretty important definitions:
+
+\let\bgroup={
+\let\egroup=}
+
+%D In plain \TEX\ the following explanation about the register
+%D allocation mechanism is given:
+%D
+%D \startsmaller
+%D The following counters are reserved:
+%D
+%D \starttabulatie
+%D \NC 0--9 \NC page numbering \NC \NR
+%D \NC 10 \NC count allocation \NC \NR
+%D \NC 11 \NC dimen allocation \NC \NR
+%D \NC 12 \NC skip allocation \NC \NR
+%D \NC 13 \NC muskip allocation \NC \NR
+%D \NC 14 \NC box allocation \NC \NR
+%D \NC 15 \NC toks allocation \NC \NR
+%D \NC 16 \NC read file allocation \NC \NR
+%D \NC 17 \NC write file allocation \NC \NR
+%D \NC 18 \NC math family allocation \NC \NR
+%D \NC 19 \NC language allocation \NC \NR
+%D \NC 20 \NC insert allocation \NC \NR
+%D \NC 21 \NC the most recently allocated number \NC \NR
+%D \NC 22 \NC constant $-1$ \NC \NR
+%D \stoptabulatie
+%D
+%D New counters are allocated starting with 23, 24, etc. Other
+%D registers are allocated starting with 10. This leaves 0
+%D through 9 for the user to play with safely, except that
+%D counts 0 to 9 are considered to be the page and subpage
+%D numbers (since they are displayed during output). In this
+%D scheme, \type {\count10} always contains the number of the
+%D highest||numbered counter that has been allocated, \type
+%D {\count14} the highest||numbered box, etc. Inserts are given
+%D numbers 254, 253, etc., since they require a \type
+%D {\count}, \type {\dimen}, \type {\skip}, and \type {\box}
+%D all with the same number; \type {\count20} contains the
+%D lowest-numbered insert that has been allocated. Of course,
+%D \type {\box255} is reserved for \type {\output}; \type
+%D {\count255}, \type {\dimen255}, and \type {\skip255} can be
+%D used freely.
+%D
+%D It is recommended that macro designers always use \type
+%D {\globa}l assignments with respect to registers numbered 1,
+%D 3, 5, 7, 9, and always non||\type {\global} assignments
+%D with respect to registers 0, 2, 4, 6, 8, 255. This will
+%D prevent \quote {save stack buildup} that might otherwise
+%D occur.
+%D \stopsmaller
+%D
+%D We well overload some macros in \ETEX\ mode.
+
+\count10 = 22 % allocates \count registers 23, 24, ...
+\count11 = 9 % allocates \dimen registers 10, 11, ...
+\count12 = 9 % allocates \skip registers 10, 11, ...
+\count13 = 9 % allocates \muskip registers 10, 11, ...
+\count14 = 9 % allocates \box registers 10, 11, ...
+\count15 = 9 % allocates \toks registers 10, 11, ...
+\count16 = -1 % allocates input streams 0, 1, ...
+\count17 = -1 % allocates output streams 0, 1, ...
+\count18 = 3 % allocates math families 4, 5, ...
+\count19 = 0 % allocates \language codes 1, 2, ...
+\count20 =255 % allocates insertion classes 254, 253, ...
+
+\countdef\insc@unt = 20 % the insertion counter
+\countdef\allocationnumber= 21 % the most recent allocation
+\countdef\m@ne = 22 % a handy constant
+ \m@ne = -1
+
+\def\wlog{\immediate\write\m@ne} % write on log file (only)
+
+%D \startsmaller
+%D Here are abbreviations for the names of scratch registers
+%D that don't need to be allocated.
+%D \stopsmaller
+
+\countdef \count@ = 255
+\dimendef \dimen@ = 0
+\dimendef \dimen@i = 1 % global only
+\dimendef \dimen@ii = 2
+\skipdef \skip@ = 0
+\toksdef \toks@ = 0
+
+%D \startsmaller
+%D Now, we define \type {\newcount}, \type {\newbox}, etc. so
+%D that you can say \newcount\foo and \type {\foo} will be
+%D defined (with \type {\countdef}) to be the next counter. To
+%D find out which counter \type {\foo} is, you can look at
+%D \type {\allocationnumber}. Since there's no \type {\boxdef}
+%D command, \type {\chardef} is used to define a \type
+%D {\newbox}, \type {\newinsert}, \type {\newfam}, and so on.
+%D \stopsmaller
+
+\def\newcount {\alloc@0\count \countdef \insc@unt}
+\def\newdimen {\alloc@1\dimen \dimendef \insc@unt}
+\def\newskip {\alloc@2\skip \skipdef \insc@unt}
+\def\newmuskip {\alloc@3\muskip \muskipdef\@cclvi }
+\def\newbox {\alloc@4\box \chardef \insc@unt}
+\def\newtoks {\alloc@5\toks \toksdef \@cclvi }
+\def\newread {\alloc@6\read \chardef \sixt@@n }
+\def\newwrite {\alloc@7\write \chardef \sixt@@n }
+\def\newfam {\alloc@8\fam \chardef \sixt@@n }
+\def\newlanguage{\alloc@9\language\chardef \@cclvi }
+
+\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
+
+\def\alloc@#1#2#3#4#5%
+ {\global\advance\count1#1by\@ne
+ \ch@ck#1#4#2% make sure there's still room
+ \allocationnumber=\count1#1%
+ \global#3#5=\allocationnumber
+ \wlog{\string#5=\string#2\the\allocationnumber}}
+
+\def\newinsert#1%
+ {\global\advance\insc@unt by\m@ne
+ \ch@ck0\insc@unt\count
+ \ch@ck1\insc@unt\dimen
+ \ch@ck2\insc@unt\skip
+ \ch@ck4\insc@unt\box
+ \allocationnumber=\insc@unt
+ \global\chardef#1=\allocationnumber
+ \wlog{\string#1=\string\insert\the\allocationnumber}}
+
+\def\ch@ck#1#2#3%
+ {\ifnum\count1#1<#2\else
+ \errmessage{No room for a new #3}
+ \fi}
+
+\newdimen\maxdimen \maxdimen = 16383.99999pt
+\newskip \hideskip \hideskip = -1000pt plus 1fill
+\newskip \centering \centering = 0pt plus 1000pt minus 1000pt
+\newdimen\p@ \p@ = 1pt
+\newdimen\z@ \z@ = 0pt
+\newskip \z@skip \z@skip = 0pt plus 0pt minus 0pt
+\newbox \voidb@x % permanently void box register
+
+%D We define \type {\newif} a la plain \TEX, but will
+%D redefine it later. As Knuth says:
+%D
+%D \startsmaller
+%D And here's a different sort of allocation: for example,
+%D
+%D \starttypen
+%D \newif\iffoo
+%D \stoptypen
+%D
+%D creates \type {\footrue}, \type {\foofalse} to go
+%D with \type {\iffoo}.
+%D \stopsmaller
+
+\def\newif#1%
+ {\count@\escapechar
+ \escapechar\m@ne
+ \expandafter\expandafter\expandafter\def\@if #1{true}{\let#1\iftrue }%
+ \expandafter\expandafter\expandafter\def\@if#1{false}{\let#1\iffalse}%
+ \@if#1{false}% the condition starts out false
+ \escapechar\count@}
+
+\def\@if#1#2%
+ {\csname\expandafter\if@\string#1#2\endcsname}
+
+\bgroup % `if' is required
+
+ \uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}}
+
+\egroup
+
+%D Build||in numeric variables.
+
+\adjdemerits = 10000
+\binoppenalty = 700
+\brokenpenalty = 100
+\clubpenalty = 150
+%day = 0
+\defaulthyphenchar = `\-
+\defaultskewchar = -1
+\delimiterfactor = 901
+\displaywidowpenalty = 50
+\doublehyphendemerits = 10000
+%endlinechar = `\^^M
+\errorcontextlines = 5
+%escapechar = `\\
+\exhyphenpenalty = 50
+%fam = 0
+\finalhyphendemerits = 5000
+%floatingpenalty = 0
+%globaldefs = 0
+%hangafter = 1
+\hbadness = 1000
+%holdinginserts = 0
+\hyphenpenalty = 50
+%interlinepenalty = 0
+%language = 0
+\lefthyphenmin = 2
+\linepenalty = 10
+%looseness = 0
+%mag = 1000
+%maxdeadcycles = 25
+%month = 0
+\newlinechar = -1
+%outputpenalty = 0
+%pausing = 0
+%postdisplaypenalty = 0
+\predisplaypenalty = 10000
+\pretolerance = 100
+\relpenalty = 500
+\righthyphenmin = 3
+\showboxbreadth = 5
+\showboxdepth = 3
+%time = 0
+\tolerance = 200
+%tracingcommands = 0
+\tracinglostchars = 1
+%tracingmacros = 0
+%tracingonline = 0
+%tracingoutput = 0
+%tracingpages = 0
+%tracingparagraphs = 0
+%tracingrestores = 0
+%tracingstats = 0
+\uchyph = 1
+\vbadness = 1000
+\widowpenalty = 150
+%year = 0
+
+%D Extra numeric variables.
+
+\newcount \interdisplaylinepenalty
+\newcount \interfootnotelinepenalty
+
+\interdisplaylinepenalty = 100
+\interfootnotelinepenalty = 100
+
+%D Build in dimension variables.
+
+\abovedisplayshortskip = 0pt plus 3pt
+\abovedisplayskip = 12pt plus 3pt minus 9pt
+%baselineskip = 0pt
+\belowdisplayshortskip = 7pt plus 3pt minus 4pt
+\belowdisplayskip = 12pt plus 3pt minus 9pt
+\boxmaxdepth = \maxdimen
+\delimitershortfall = 5pt
+%displayindent = 0pt
+%displaywidth = 0pt
+%hangindent = 0pt
+\hfuzz = 0.1pt
+%hoffset = 0pt
+\hsize = 6.5in
+%leftskip = 0pt
+%lineskip = 0pt
+%lineskiplimit = 0pt
+%mathsurround = 0pt
+\maxdepth = 4pt
+\medmuskip = 4mu plus 2mu minus 4mu
+\nulldelimiterspace = 1.2pt
+\overfullrule = 5pt
+\parfillskip = 0pt plus 1fil
+\parindent = 20pt
+\parskip = 0pt plus 1pt
+%predisplaysize = 0pt
+%rightskip = 0pt
+\scriptspace = 0.5pt
+%spaceskip = 0pt
+\splitmaxdepth = \maxdimen
+\splittopskip = 10pt
+%tabskip = 0pt
+\thickmuskip = 5mu plus 5mu
+\thinmuskip = 3mu
+\topskip = 10pt
+\vfuzz = 0.1pt
+%voffset = 0pt
+\vsize = 8.9in
+%xspaceskip = 0pt
+
+%D Extra dimension parameters.
+
+\newskip \bigskipamount
+\newdimen \jot
+\newskip \medskipamount
+\newskip \normalbaselineskip
+\newskip \normallineskip
+\newdimen \normallineskiplimit
+\newskip \smallskipamount
+
+\bigskipamount = 12pt plus 4pt minus 4pt
+\jot = 3pt
+\medskipamount = 6pt plus 2pt minus 2pt
+\normalbaselineskip = 12pt
+\normallineskip = 1pt
+\normallineskiplimit = 0pt
+\smallskipamount = 3pt plus 1pt minus 1pt
+
+%D The following shortcuts are rather standard:
+
+\def\lq{`}
+\def\rq{'}
+
+\def\lbrack{[}
+\def\rbrack{]}
+
+\let\endgraf=\par
+\let\endline=\cr
+
+\def\space{ }
+\def\empty{}
+\def\null {\hbox{}}
+
+%D The next loop construct is about the fastest you can get.
+%D Beware: this macro does not support nested loops.
+
+\long\def\loop#1\repeat{\long\def\body{#1}\iterate}
+
+%D The following makes \type {\loop} \unknown\ \type {\if}
+%D \unknown\ \type {\repeat} skippable:
+
+\let\repeat=\fi
+
+%D The original:
+
+\def\iterate{\body\let\next\iterate\else\let\next\relax\fi\next}
+
+%D A more efficient alternative:
+
+\def\iterate{\body\expandafter\iterate\else\expandafter\relax\fi}
+
+%D An even more efficient one:
+
+\def\iterate{\body\expandafter\iterate\else\fi}
+
+%D Counter 0 is normally used as page counter:
+
+\countdef\pageno=0 \pageno=1 % first page is number 1
+
+%D Beside the raw counter \type {\pageno} the \type {\folio}
+%D macro provides the value.
+
+\def\folio{\the\pageno}
+
+%D Indeed, we don't define a real output routine yet:
+
+\output{\box255}
+
+%D We don't support \type {\magnification} and just consume
+%D the value.
+
+\let\magnification\count@
+
+%D The following macro will be overloaded in \ETEX.
+
+\def\tracingall
+ {\tracingonline \@ne
+ \tracingcommands \tw@
+ \tracingstats \tw@
+ \tracingpages \@ne
+ \tracingoutput \@ne
+ \tracinglostchars \@ne
+ \tracingmacros \tw@
+ \tracingparagraphs\@ne
+ \tracingrestores \@ne
+ \showboxbreadth \maxdimen
+ \showboxdepth \maxdimen
+ \errorstopmode}
+
+%D Some users expect this macro to be present. This one
+%D sends the hyphenated word to the terminal.
+
+\def\showhyphens#1%
+ {\setbox0\vbox
+ {\parfillskip\z@skip
+ \hsize\maxdimen\tenrm
+ \pretolerance\m@ne
+ \tolerance\m@ne
+ \hbadness0
+ \showboxdepth0
+ \ #1}}
+
+%D The following bunch of macros deals with basic alignment.
+%D We just include them here so that they can be used if
+%D needed. Normally, \CONTEXT\ users will fall back on one of
+%D the three table environments.
+
+\newcount \mscount
+\newif \ifus@
+\newif \if@cr
+\newbox \tabs
+\newbox \tabsyet
+\newbox \tabsdone
+
+\def\hidewidth % for alignment entries that can stick out
+ {\hskip\hideskip}
+
+\def\ialign % initialized \halign
+ {\everycr{}
+ \tabskip\z@skip
+ \halign}
+
+\def\multispan#1%
+ {\omit
+ \mscount#1\relax
+ \loop
+ \ifnum\mscount>\@ne \sp@n
+ \repeat}
+
+\def\sp@n
+ {\span
+ \omit
+ \advance\mscount\m@ne}
+
+\def\cleartabs
+ {\global\setbox\tabsyet\null
+ \setbox\tabs\null}
+
+\def\settabs
+ {\setbox\tabs\null
+ \futurelet\next\sett@b}
+
+\def\sett@b
+ {\ifx\next\+%
+ \def\nxt{\afterassignment\s@tt@b\let\nxt}%
+ \else
+ \let\nxt\s@tcols
+ \fi
+ \let\next\relax
+ \nxt}
+
+\def\s@tt@b%
+ {\let\nxt\relax
+ \us@false\m@ketabbox}
+
+\def\tabalign%
+ {\us@true\m@ketabbox}
+
+\let\+\tabalign % no outer here
+
+\def\s@tcols#1\columns%
+ {\count@#1%
+ \dimen@\hsize
+ \loop
+ \ifnum\count@>\z@ \@nother
+ \repeat}
+
+\def\@nother%
+ {\dimen@ii\dimen@
+ \divide\dimen@ii\count@
+ \setbox\tabs\hbox{\hbox to\dimen@ii{}\unhbox\tabs}%
+ \advance\dimen@-\dimen@ii
+ \advance\count@\m@ne}
+
+\def\m@ketabbox%
+ {\begingroup
+ \global\setbox\tabsyet\copy\tabs
+ \global\setbox\tabsdone\null
+ \def\cr
+ {\@crtrue\crcr\egroup\egroup
+ \ifus@\unvbox\z@\lastbox\fi\endgroup
+ \setbox\tabs\hbox{\unhbox\tabsyet\unhbox\tabsdone}}%
+ \setbox\z@\vbox\bgroup\@crfalse
+ \ialign\bgroup&\t@bbox##\t@bb@x\crcr}
+
+\def\t@bbox
+ {\setbox\z@\hbox\bgroup}
+
+\def\t@bb@x
+ {\if@cr
+ \egroup % now \box\z@ holds the column
+ \else
+ \hss\egroup
+ \global\setbox\tabsyet\hbox
+ {\unhbox\tabsyet\global\setbox\@ne\lastbox}% now \box\@ne holds its size
+ \ifvoid\@ne
+ \global\setbox\@ne\hbox to\wd\z@{}%
+ \else
+ \setbox\z@\hbox to\wd\@ne{\unhbox\z@}%
+ \fi
+ \global\setbox\tabsdone\hbox{\box\@ne\unhbox\tabsdone}%
+ \fi
+ \box\z@}
+
+%D Users are advised not to use the following macros:
+
+\def\hang
+ {\hangindent\parindent}
+
+\def\textindent#1%
+ {\indent
+ \llap{#1\enspace}%
+ \ignorespaces}
+
+\def\narrower%
+ {\advance\leftskip \parindent
+ \advance\rightskip\parindent}
+
+%D Useful, used too, but sometimes dangerous:
+
+\def\leavevmode{\unhbox\voidb@x}
+
+%D We will overload these, but may need them beforehand:
+
+\bgroup
+ \catcode`\^^M=\active%
+ \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
+ \global\let^^M\par%
+\egroup
+
+\def\obeyspaces{\catcode`\ \active}
+
+{\obeyspaces\global\let =\space}
+
+%D Useful and expected:
+
+\def~{\penalty\@M \ } % tie
+
+\chardef\%=`\%
+\chardef\&=`\&
+\chardef\#=`\#
+\chardef\$=`\$
+
+\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}
+
+%D Used at all?
+
+\def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'
+
+%D Replaced later on:
+
+\def\line {\hbox to\hsize}
+\def\leftline #1{\line{#1\hss}}
+\def\rightline #1{\line{\hss#1}}
+\def\centerline#1{\line{\hss#1\hss}}
+
+%D Let's end in the plain way:
+
+\def\fmtname {ConTeXt Minimized Plain TeX}
+\def\fmtversion{3.1415926}
+
+\protect \endinput
diff --git a/tex/context/base/syst-prm.tex b/tex/context/base/syst-prm.tex
new file mode 100644
index 000000000..a53c1cdef
--- /dev/null
+++ b/tex/context/base/syst-prm.tex
@@ -0,0 +1,85 @@
+%D \module
+%D [ file=syst-prm,
+%D version=1999.03.17,
+%D title=\CONTEXT\ System Macros,
+%D subtitle=Primitive Behavior,
+%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
+
+%D Saved primitives are preceded by \type {\normal}, as in:
+
+\let\normalfmtversion\fmtversion
+
+%D When applicable, we also load the \ETEX\ source and
+%D definition files.
+
+\bgroup \obeylines
+
+\ifx\eTeXversion\undefined
+
+ \long\gdef\beginETEX#1\endETEX%
+ {}
+
+ \gdef\beginTEX%
+ {\bgroup\obeylines\dobeginTEX}
+
+ \gdef\dobeginTEX#1
+ {\egroup}
+
+ \global\let\endTEX\relax
+
+\else
+
+ \long\gdef\beginTEX#1\endTEX%
+ {}
+
+ \gdef\beginETEX%
+ {\bgroup\obeylines\dobeginETEX}
+
+ \gdef\dobeginETEX#1
+ {\egroup\immediate\write16%
+ {system (E-TEX) : [line \the\inputlineno] \detokenize{#1}}}
+
+ \global\let\endETEX\relax
+
+\fi
+
+\egroup
+
+%D Let's get rid of this one:
+
+\def\wlog#1{}
+
+%D Just for tracing purposes we set:
+
+\tracingstats=1
+
+%D We don't like outer commands, and we always want access
+%D to the original \type {\input} primitive.
+
+\let\normalouter = \outer \let\outer\relax
+\let\normalinput = \input
+
+%D We need to make sure that we start up in \DVI\ mode, so,
+%D after testing for running \PDFTEX, we default to \DVI.
+
+\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0
+
+%D To circumvent dependencies, we can postpone certain
+%D initializations to dumping time, by appending them to the
+%D \type {\everydump} token register.
+
+\newtoks \everydump
+
+\let\normaldump \dump
+
+\def\dump{\the\everydump\normaldump}
+
+\protect \endinput
diff --git a/tex/context/base/syst-tex.tex b/tex/context/base/syst-tex.tex
index b231c7051..2ad5b77a0 100644
--- a/tex/context/base/syst-tex.tex
+++ b/tex/context/base/syst-tex.tex
@@ -1,5 +1,5 @@
%D \module
-%D [ file=syst-tex,
+%D [ file=syst-pln,
%D version=1999.03.17, % an oldie: 1995.10.10
%D title=\CONTEXT\ System Macros,
%D subtitle=Efficient \PLAIN\ \TEX\ loading,
@@ -74,13 +74,24 @@
\long\def\font#1=#2 #3%
{\ifx#3s%
\skipmessage{scaled \string\font}%
- \let\next=\skipscaled
+ \let\next\skipscaled
\else
\skipmessage{\string\font}%
- \let\next=\relax
+ \let\next\relax
\fi
\next#3}
+% or:
+%
+% \long\def\font#1=#2 #3%
+% {\ifx#3s%
+% \skipmessage{scaled \string\font}%
+% \expandafter\skipscaled
+% \else
+% \skipmessage{\string\font}%
+% \fi
+% #3}
+
%D Relaxing some font switching macros is needed because we
%D don't want any error messages during loading. These
%D unharmfull messages could be ingored.
@@ -124,7 +135,7 @@
%D initializations. We just want to default to \DVI\ output.
\ifx\pdftexversion\undefined
- \newcount\pdfoutput
+ \chardef\pdfoutput=0
\else
\pdfoutput=0
\fi
@@ -193,6 +204,12 @@
% \let\normalprotected = \protected
% \let\normalunexpanded = \unexpanded
+\beginETEX \savinghyphcodes
+
+ \savinghyphcodes=1
+
+\endETEX
+
%D We restore some redefined primitives to their old meaning.
\let\font = \normalfont
@@ -214,8 +231,9 @@
\let\normaltextfont = \undefined
\let\normalscriptfont = \undefined
\let\normalscriptscriptfont = \undefined
-\let\normalinput = \undefined
-\let\normalouter = \undefined
+
+% \let\normalinput = \undefined
+% \let\normalouter = \undefined
%D We want a bit more statistics and some less logging info
%D in the \type{log} file.
diff --git a/tex/context/base/type-buy.tex b/tex/context/base/type-buy.tex
index a986aef92..ba16cee15 100644
--- a/tex/context/base/type-buy.tex
+++ b/tex/context/base/type-buy.tex
@@ -94,13 +94,13 @@
\starttypescript [sans] [meta] [name]
- \definefontsynonym [Sans] [MetaBook-Roman]
- \definefontsynonym [SansItalic] [MetaBook-Italic]
- \definefontsynonym [SansSlanted] [MetaBook-Slanted]
+ \definefontsynonym [Sans] [MetaNormal-Roman]
+ \definefontsynonym [SansItalic] [MetaNormal-Italic]
+ \definefontsynonym [SansSlanted] [MetaNormal-Slanted]
\definefontsynonym [SansBold] [MetaBold-Roman]
\definefontsynonym [SansBoldItalic] [MetaBold-Italic]
\definefontsynonym [SansBoldSlanted][MetaBold-Slanted]
- \definefontsynonym [SansCaps] [MetaBook-Caps]
+ \definefontsynonym [SansCaps] [MetaNormal-Caps]
\stoptypescript
@@ -205,21 +205,4 @@
\stoptypescript
-% Lucas Sun, sans
-
-ontsynonym[TheAntiqua-B3Light][texnansi-tantb3][encoding=texnansi]
-ontsynonym[TheAntiqua-B3cLightCaps][texnansi-tantb3c][encoding=texnansi]
-ontsynonym[TheAntiqua-B3iLightItalic][texnansi-tantb3i][encoding=texnansi]
-ontsynonym[TheAntiqua-B4SemiLight][texnansi-tantb4][encoding=texnansi]
-ontsynonym[TheAntiqua-B4cSemiLightCaps][texnansi-tantb4c][encoding=texnansi]
-ontsynonym[TheAntiqua-B4iSemiLightItalic][texnansi-tantb4i][encoding=texnansi
-]
-ontsynonym[TheAntiqua-B5][texnansi-tantb5][encoding=texnansi]
-ontsynonym[TheAntiqua-B5cCaps][texnansi-tantb5c][encoding=texnansi]
-ontsynonym[TheAntiqua-B5iItalic][texnansi-tantb5i][encoding=texnansi]
-ontsynonym[TheAntiqua-B6SemiBold][texnansi-tantb6][encoding=texnansi]
-ontsynonym[TheAntiqua-B6cSemiBoldCaps][texnansi-tantb6c][encoding=texnansi]
-ontsynonym[TheAntiqua-B6iSemiBoldItalic][texnansi-tantb6i][encoding=texnansi]
-ontsynonym[TheAntiqua-B7Bold][texnansi-tantb7][encoding=texnansi]
-ontsynonym[TheAntiqua-B7cBoldCaps][texnansi-tantb7c][encoding=texnansi]
-ontsynonym[TheAntiqua-B7iBoldItalic][texnansi-tantb7i][encoding=texnansi]
+\endinput
diff --git a/tex/context/base/type-enc.tex b/tex/context/base/type-enc.tex
index f70ac000c..f4e4a6f42 100644
--- a/tex/context/base/type-enc.tex
+++ b/tex/context/base/type-enc.tex
@@ -273,7 +273,7 @@
\definefontsynonym [ComputerModern-Bold] [cmbx10]
\definefontsynonym [ComputerModern-BoldItalic] [cmbxti10]
\definefontsynonym [ComputerModern-BoldSlanted] [cmbxsl10]
- \definefontsynonym [ComputerModern-Caps] [cmr10]
+ \definefontsynonym [ComputerModern-Caps] [cmcsc10]
\stoptypescript
\starttypescript [sans] [computer-modern] [default]
@@ -294,6 +294,7 @@
\definefontsynonym [ComputerModernMono-BoldItalic] [cmtt10]
\definefontsynonym [ComputerModernMono-BoldSlanted] [cmtt10]
\definefontsynonym [ComputerModernMono-Caps] [cmtt10]
+ \definefontsynonym [ComputerModernMono-Variable] [cmvtt10]
\stoptypescript
\starttypescript [math] [computer-modern] [default]
@@ -368,11 +369,15 @@
% Math Times (tx)
-\starttypescript [math] [times] [ec]
- \definefontsynonym [Times-Roman-Upright] [t1xr] [encoding=ec]
- \definefontsynonym [Times-Roman-Italic] [t1xi] [encoding=ec]
- \definefontsynonym [Times-Roman-Slanted] [t1xsl] [encoding=ec]
- \definefontsynonym [Times-Roman-Caps] [t1xsc] [encoding=ec]
+\starttypescript [math] [times] [all]
+% \definefontsynonym [Times-Roman-Upright] [t1xr] [encoding=ec]
+% \definefontsynonym [Times-Roman-Italic] [t1xi] [encoding=ec]
+% \definefontsynonym [Times-Roman-Slanted] [t1xsl] [encoding=ec]
+% \definefontsynonym [Times-Roman-Caps] [t1xsc] [encoding=ec]
+ \definefontsynonym [Times-Roman-Upright] [txr]
+ \definefontsynonym [Times-Roman-Italic] [txi]
+ \definefontsynonym [Times-Roman-Slanted] [txsl]
+ \definefontsynonym [Times-Roman-Caps] [txsc]
\definefontsynonym [Times-Companion-Upright] [tcxr]
\definefontsynonym [Times-Companion-Italic] [tcxi]
\definefontsynonym [Times-Companion-Slanted] [tcxsl]
@@ -418,15 +423,19 @@
% Palatino Math (PX)
-\starttypescript [math] [palatino] [ec]
- \definefontsynonym [Palatino-Roman-Upright] [p1xr] [encoding=ec]
- \definefontsynonym [Palatino-Roman-Italic] [p1xi] [encoding=ec]
- \definefontsynonym [Palatino-Roman-Slanted] [p1xsl] [encoding=ec]
- \definefontsynonym [Palatino-Roman-Caps] [p1xsc] [encoding=ec]
- \definefontsynonym [Palatino-Companion-Upright] [pcxr]
- \definefontsynonym [Palatino-Companion-Italic] [pcxi]
- \definefontsynonym [Palatino-Companion-Slanted] [pcxsl]
- \definefontsynonym [Palatino-Math-Italic] [pxmi]
+\starttypescript [math] [palatino] [all]
+% \definefontsynonym [Palatino-Roman-Upright] [p1xr] [encoding=ec]
+% \definefontsynonym [Palatino-Roman-Italic] [p1xi] [encoding=ec]
+% \definefontsynonym [Palatino-Roman-Slanted] [p1xsl] [encoding=ec]
+% \definefontsynonym [Palatino-Roman-Caps] [p1xsc] [encoding=ec]
+ \definefontsynonym [Palatino-Roman-Upright] [pxr]
+ \definefontsynonym [Palatino-Roman-Italic] [pxi]
+ \definefontsynonym [Palatino-Roman-Slanted] [pxsl]
+ \definefontsynonym [Palatino-Roman-Caps] [pxsc]
+ \definefontsynonym [Palatino-Companion-Upright] [pcxr]
+ \definefontsynonym [Palatino-Companion-Italic] [pcxi]
+ \definefontsynonym [Palatino-Companion-Slanted] [pcxsl]
+ \definefontsynonym [Palatino-Math-Italic] [pxmi]
\definefontsynonym [Palatino-Math-Symbols] [pxsy]
\definefontsynonym [Palatino-Math-Extension] [pxex]
\definefontsynonym [Palatino-Math-SymbolsA] [pxsya]
@@ -511,34 +520,34 @@
% Lucida Bright (BH)
-\starttypescript [serif] [lucida] [texnansi]
- \definefontsynonym [LucidaBright] [lbr] [encoding=texnansi]
- \definefontsynonym [LucidaBright-Demi] [lbd] [encoding=texnansi]
- \definefontsynonym [LucidaBright-DemiItalic] [lbdi] [encoding=texnansi]
- \definefontsynonym [LucidaBright-Italic] [lbi] [encoding=texnansi]
- \definefontsynonym [LucidaBrightSmallcaps] [lbrsc] [encoding=texnansi]
- \definefontsynonym [LucidaBrightSmallcaps-Demi] [lbdsc] [encoding=texnansi]
- \definefontsynonym [LucidaBright-Oblique] [lbsl] [encoding=texnansi]
+\starttypescript [serif] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaBright] [\typefaceencoding-lbr] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBright-Demi] [\typefaceencoding-lbd] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBright-DemiItalic] [\typefaceencoding-lbdi] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBright-Italic] [\typefaceencoding-lbi] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBrightSmallcaps] [\typefaceencoding-lbrsc] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBrightSmallcaps-Demi] [\typefaceencoding-lbdsc] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaBright-Oblique] [\typefaceencoding-lbsl] [encoding=\typefaceencoding]
\stoptypescript
-\starttypescript [sans] [lucida] [texnansi]
- \definefontsynonym [LucidaSans] [lsr] [encoding=texnansi]
- \definefontsynonym [LucidaSans-Demi] [lsd] [encoding=texnansi]
- \definefontsynonym [LucidaSans-DemiItalic] [lsdi] [encoding=texnansi]
- \definefontsynonym [LucidaSans-Italic] [lsi] [encoding=texnansi]
- \definefontsynonym [LucidaSans-Bold] [lsb] [encoding=texnansi]
- \definefontsynonym [LucidaSans-BoldItalic] [lsbi] [encoding=texnansi]
+\starttypescript [sans] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaSans] [\typefaceencoding-lsr] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-Demi] [\typefaceencoding-lsd] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-DemiItalic] [\typefaceencoding-lsdi] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-Italic] [\typefaceencoding-lsi] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-Bold] [\typefaceencoding-lsb] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-BoldItalic] [\typefaceencoding-lsbi] [encoding=\typefaceencoding]
\stoptypescript
-\starttypescript [mono] [lucida] [texnansi]
- \definefontsynonym [LucidaSans-Typewriter] [lstr] [encoding=texnansi]
- \definefontsynonym [LucidaSans-TypewriterBold] [lstb] [encoding=texnansi]
- \definefontsynonym [LucidaSans-TypewriterBoldOblique] [lstbo] [encoding=texnansi]
- \definefontsynonym [LucidaSans-TypewriterOblique] [lsto] [encoding=texnansi]
+\starttypescript [mono] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaSans-Typewriter] [\typefaceencoding-lstr] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-TypewriterBold] [\typefaceencoding-lstb] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-TypewriterBoldOblique] [\typefaceencoding-lstbo] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaSans-TypewriterOblique] [\typefaceencoding-lsto] [encoding=\typefaceencoding]
\stoptypescript
-\starttypescript [math] [lucida] [texnansi]
- \definefontsynonym [LucidaBright] [lbr] [encoding=texnansi]
+\starttypescript [math] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaBright] [\typefaceencoding-lbr] [encoding=\typefaceencoding]
\definefontsynonym [LucidaNewMath-AltItalic] [lbmo]
\definefontsynonym [LucidaNewMath-Arrows] [lbma]
\definefontsynonym [LucidaNewMath-Extension] [lbme]
@@ -548,7 +557,7 @@
\definefontsynonym [LucidaBlackletter] [lbl]
\stoptypescript
-\starttypescript [boldmath] [lucida] [texnansi]
+\starttypescript [boldmath] [lucida] [texnansi,ec,8r]
\definefontsynonym [LucidaNewMath-AltDemiItalic] [lbmdo]
\definefontsynonym [LucidaNewMath-Arrows-Demi] [lbmad]
\definefontsynonym [LucidaNewMath-Extension] [lbme]
@@ -557,85 +566,25 @@
\definefontsynonym [LucidaNewMath-Symbol-Demi] [lbmsd]
\stoptypescript
-\starttypescript [calligraphy] [lucida] [texnansi]
- \definefontsynonym [LucidaCalligraphy-Italic] [lbc] [encoding=texnansi]
-\stoptypescript
-
-\starttypescript [casual] [lucida] [texnansi]
- \definefontsynonym [LucidaCasual] [lbkr] [encoding=texnansi]
- \definefontsynonym [LucidaCasual-Italic] [lbki] [encoding=texnansi]
-\stoptypescript
-
-\starttypescript [handwriting] [lucida] [texnansi]
- \definefontsynonym [LucidaHandwriting-Italic] [lbh] [encoding=texnansi]
-\stoptypescript
-
-\starttypescript [fax] [lucida] [texnansi]
- \definefontsynonym [LucidaFax] [lfr] [encoding=texnansi]
- \definefontsynonym [LucidaFax-Demi] [lfd] [encoding=texnansi]
- \definefontsynonym [LucidaFax-DemiItalic] [lfdi] [encoding=texnansi]
- \definefontsynonym [LucidaFax-Italic] [lfi] [encoding=texnansi]
-\stoptypescript
-
-% \starttypescript [serif] [lucida] [ec]
-% \definefontsynonym [LucidaBright] [hlhr8t] [encoding=ec]
-% \definefontsynonym [LucidaBright-Demi] [hlhb8t] [encoding=ec]
-% \definefontsynonym [LucidaBright-Italic] [hlhri8t] [encoding=ec]
-% \definefontsynonym [LucidaBright-Oblique] [hlhro8t] [encoding=ec]
-% \definefontsynonym [LucidaBright-DemiItalic] [hlhbi8t] [encoding=ec]
-% \definefontsynonym [LucidaBrightSmallcaps] [hlhrc8t] [encoding=ec]
-% \stoptypescript
-%
-% \starttypescript [sans] [lucida] [ec]
-% \definefontsynonym [LucidaSans] [hlsr8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-Demi] [hlsb8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-Italic] [hlsri8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-DemiItalic] [hlsbi8t] [encoding=ec]
-% \stoptypescript
-%
-% \starttypescript [mono] [lucida] [ec]
-% \definefontsynonym [LucidaSans-Typewriter] [hlsrt8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-TypewriterBold] [hlsbt8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-TypewriterOblique] [hlsrot8t] [encoding=ec]
-% \definefontsynonym [LucidaSans-TypewriterBoldOblique] [hlsbot8t] [encoding=ec]
-% \stoptypescript
-%
-% \starttypescript [math] [lucida] [ec]
-% \definefontsynonym [LucidaBright] [hlhr8t] [encoding=ec]
-% \definefontsynonym [LucidaNewMath-AltItalic] [hlcrima]
-% \definefontsynonym [LucidaNewMath-Arrows] [hlcra]
-% \definefontsynonym [LucidaNewMath-Extension] [hlcrv]
-% \definefontsynonym [LucidaNewMath-Roman] [hlcrm]
-% \definefontsynonym [LucidaNewMath-Italic] [hlcrim]
-% \definefontsynonym [LucidaNewMath-Symbol] [hlcry]
-% \stoptypescript
-%
-% \starttypescript [boldmath] [lucida] [ec]
-% \definefontsynonym [LucidaNewMath-AltDemiItalic] [hlcdima]
-% \definefontsynonym [LucidaNewMath-Arrows-Demi] [hlcda]
-% \definefontsynonym [LucidaNewMath-Extension] [hlcrv]
-% \definefontsynonym [LucidaNewMath-Demibold] [hlcdm]
-% \definefontsynonym [LucidaNewMath-DemiItalic] [hlcdim]
-% \definefontsynonym [LucidaNewMath-Symbol-Demi] [hlcdy]
-% \stoptypescript
-%
-% \starttypescript [calligraphy] [lucida] [ec]
-% \definefontsynonym [LucidaCalligraphy-Italic] [hlcrie8t] [encoding=ec]
-% \stoptypescript
-%
-% \starttypescript [handwriting] [lucida] [ec]
-% \definefontsynonym [LucidaHandwriting-Italic] [hlcriw8t] [encoding=ec]
-% \stoptypescript
-
-% \definefontsynonym [Helvetica-MathRoman] [hvrm10t1]
-% \definefontsynonym [Helvetica-MathExtendedSymbols] [hvex10]
-% \definefontsynonym [Helvetica-MathItalics] [hvmi10]
-% \definefontsynonym [Helvetica-MathSymbols] [hvsy10]
-
-% \definefontsynonym [Times-MathRoman] [tir] [encoding=texnansi]
-% \definefontsynonym [Times-MathExtension] [mtex]
-% \definefontsynonym [Times-MathItalic] [mtmi] [skewcharmi='177]
-% \definefontsynonym [Times-MathSymbol] [mtsy] [skewcharmi='60]
+\starttypescript [calligraphy] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaCalligraphy-Italic] [\typefaceencoding-lbc] [encoding=\typefaceencoding]
+\stoptypescript
+
+\starttypescript [casual] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaCasual] [\typefaceencoding-lbkr] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaCasual-Italic] [\typefaceencoding-lbki] [encoding=\typefaceencoding]
+\stoptypescript
+
+\starttypescript [handwriting] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaHandwriting-Italic] [\typefaceencoding-lbh] [encoding=\typefaceencoding]
+\stoptypescript
+
+\starttypescript [fax] [lucida] [texnansi,ec,8r]
+ \definefontsynonym [LucidaFax] [\typefaceencoding-lfr] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaFax-Demi] [\typefaceencoding-lfd] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaFax-DemiItalic] [\typefaceencoding-lfdi] [encoding=\typefaceencoding]
+ \definefontsynonym [LucidaFax-Italic] [\typefaceencoding-lfi] [encoding=\typefaceencoding]
+\stoptypescript
%D For those who want to use the existing tfm and vf files we
%D provide:
diff --git a/tex/context/base/type-exa.tex b/tex/context/base/type-exa.tex
index c88de4481..0f256ee43 100644
--- a/tex/context/base/type-exa.tex
+++ b/tex/context/base/type-exa.tex
@@ -25,12 +25,13 @@
\starttypescript [postscript] [texnansi,ec,8r]
\definetypeface [postscript] [rm] [serif] [times] [default] [encoding=\typescripttwo]
+\definetypeface [postscript] [mm] [math] [times] [default]
\definetypeface [postscript] [ss] [sans] [helvetica] [default] [rscale=.9,encoding=\typescripttwo]
\definetypeface [postscript] [tt] [mono] [courier] [default] [rscale=1.1,encoding=\typescripttwo]
\stoptypescript
-\starttypescript [times] [ec]
+\starttypescript [times] [texnansi,ec,8r]
\definetypeface [times] [rm] [serif] [times] [default] [encoding=\typescripttwo]
\definetypeface [times] [ss] [sans] [helvetica] [default] [rscale=.9,encoding=\typescripttwo]
@@ -39,7 +40,7 @@
\stoptypescript
-\starttypescript [palatino] [ec]
+\starttypescript [palatino] [texnansi,ec,8r]
\definetypeface [palatino] [rm] [serif] [palatino] [default] [encoding=\typescripttwo]
\definetypeface [palatino] [mm] [math] [palatino] [default] [encoding=\typescripttwo]
@@ -51,10 +52,13 @@
\starttypescript [lucida] [texnansi]
-\definetypeface [lucida] [rm] [serif] [lucida] [default] [encoding=\typescripttwo]
-\definetypeface [lucida] [ss] [sans] [lucida] [default] [encoding=\typescripttwo]
-\definetypeface [lucida] [tt] [mono] [lucida] [default] [encoding=\typescripttwo]
-\definetypeface [lucida] [mm] [math] [lucida] [default] [encoding=\typescripttwo]
+\definetypeface [lucida] [rm] [serif] [lucida] [default] [encoding=\typescripttwo]
+\definetypeface [lucida] [ss] [sans] [lucida] [default] [encoding=\typescripttwo]
+\definetypeface [lucida] [tt] [mono] [lucida] [default] [encoding=\typescripttwo]
+\definetypeface [lucida] [mm] [math] [lucida] [default] [encoding=\typescripttwo]
+\definetypeface [lucida] [hw] [handwriting] [lucida] [default] [encoding=\typescripttwo]
+
+\usemathcollection[lbr]
\stoptypescript
diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex
index 05680dd21..eab99156b 100644
--- a/tex/context/base/type-ini.tex
+++ b/tex/context/base/type-ini.tex
@@ -54,12 +54,14 @@
\pushmacro\typescriptone
\pushmacro\typescripttwo
\pushmacro\typescriptthree
+ \pushmacro\stoptypescript
\typescriptfoundfalse
\writestatus
{typescript}
{[\@@typescriptone] [\@@typescripttwo] [\@@typescriptthree]}%
\processcommacommand[\typescriptfiles]\dododousetypescript
\firsttypescriptpassfalse % testen
+ \popmacro\stoptypescript
\popmacro\typescriptthree
\popmacro\typescripttwo
\popmacro\typescriptone
@@ -71,10 +73,25 @@
{\startreadingfile
\pushmacro\currenttypefile
\def\currenttypefile{#1}%
- \readfile{\currenttypefile}{}{}% \relax\relax
+ \readfile\currenttypefile\donothing\donothing
\popmacro\currenttypefile
\stopreadingfile}
+\def\usetypescriptonce%
+ {\dotripleempty\dousetypescriptonce}
+
+%\def\dousetypescriptonce[#1][#2][#3]%
+% {\doifdefinedelse{@@tso@@#1:#2:#3}
+% {\writestatus{typescript}{(#1) (#2) (#3)}}
+% {\setvalue{@@tso@@#1:#2:#3}{0}%
+% \expanded{\dodousetypescript[#1][#2][#3]}}}
+
+\def\dousetypescriptonce[#1][#2][#3]%
+ {\doifelseflagged{ts:#1:#2:#3}%
+ {\writestatus{typescript}{(#1) (#2) (#3)}}
+ {\setflag{ts:#1:#2:#3}%
+ \expanded{\dodousetypescript[#1][#2][#3]}}}
+
% \definetypescriptsynonym[lbr][cmr]
\def\definetypescriptsynonym%
@@ -111,54 +128,112 @@
% script [serif] [computer-modern] [name]
% script [serif] [computer-modern] [special]
-\def\dochecktypescript#1#2#3% script use value
- {\donefalse
- \doifelsenothing{#1}\donetrue
- {\doifelse{#2}{all}\donetrue
- {\doifelse{#1}{all}\donetrue
- {\expanded{\doifcommonelse{#1}{#2}}\donetrue\donefalse
- \ifdone\let#3\commalistelement\fi}}}}
-
-\def\starttypescript%
- {\dotripleempty\dostarttypescript}
-
\newif\iffirsttypescriptpass \firsttypescriptpasstrue
\prependtoks\firsttypescriptpasstrue\to\everyjob
-\long\def\dostarttypescript[#1][#2][#3]#4\stoptypescript
+% \def\dochecktypescript#1#2#3% script use value
+% {\donefalse
+% \doifelsenothing{#1}\donetrue
+% {\doifelse{#2}{all}\donetrue
+% {\doifelse{#1}{all}\donetrue
+% {\fullexpandtwoargsafter\doifcommonelse{#1}{#2}\donetrue\donefalse
+% \ifdone\let#3\commalistelement\fi}}}}
+%
+% \def\starttypescript%
+% {\dotripleempty\dostarttypescript}
+%
+% \long\def\dostarttypescript[#1][#2][#3]#4\stoptypescript
+% {\iffirstargument
+% \let\typescriptone \@@typescriptone
+% \let\typescripttwo \@@typescripttwo
+% \let\typescriptthree\@@typescriptthree
+% \dochecktypescript{#1}\@@typescriptone \typescriptone \ifdone
+% \dochecktypescript{#2}\@@typescripttwo \typescripttwo \ifdone
+% \dochecktypescript{#3}\@@typescriptthree\typescriptthree \ifdone
+% %\writestatus
+% \debuggerinfo
+% {typescript}
+% {\currenttypefile: use=scr (val)
+% [\@@typescriptone =#1 (\typescriptone)]
+% [\@@typescripttwo =#2 (\typescripttwo)]
+% [\@@typescriptthree=#3 (\typescriptthree)]}%
+% #4\typescriptfoundtrue
+% \fi\fi\fi
+% \else\iffirsttypescriptpass
+% \pushmacro\fontclass
+% #4%
+% \popmacro\fontclass
+% \else
+% % skip this since it may do unwanted resets, like
+% % setting symbolic font names to unknown, especially
+% % in run time user type scripts
+% \fi\fi}
+
+\def\typescript@@all{all}
+
+\def\dochecktypescript#1#2#3% script use value
+ {\donefalse
+ \def\@@typescriptcheck{#1}%
+ \ifx\@@typescriptcheck\empty
+ \donetrue
+ \else\ifx#2\typescript@@all
+ \donetrue
+ \else\ifx\@@typescriptcheck\typescript@@all
+ \donetrue
+ \else\fullexpandtwoargsafter\doifcommonelse{#1}{#2}\donetrue\donefalse\ifdone
+ \let#3\commalistelement
+ \fi\fi\fi\fi}
+
+\def\starttypescript
+ {\dotripleempty\dostarttypescript}
+
+\long\def\dostarttypescript[#1][#2][#3]% #4\stoptypescript
{\iffirstargument
- \let\typescriptone \@@typescriptone
- \let\typescripttwo \@@typescripttwo
- \let\typescriptthree\@@typescriptthree
- \dochecktypescript{#1}\@@typescriptone \typescriptone \ifdone
- \dochecktypescript{#2}\@@typescripttwo \typescripttwo \ifdone
- \dochecktypescript{#3}\@@typescriptthree\typescriptthree \ifdone
- %\writestatus
- \debuggerinfo
- {typescript}
- {\currenttypefile: use=scr (val)
- [\@@typescriptone =#1 (\typescriptone)]
- [\@@typescripttwo =#2 (\typescripttwo)]
- [\@@typescriptthree=#3 (\typescriptthree)]}%
- #4\typescriptfoundtrue
- \fi\fi\fi
+ \let\typescriptone \@@typescriptone
+ \let\typescripttwo \@@typescripttwo
+ \let\typescriptthree\@@typescriptthree
+ \dochecktypescript{#1}\@@typescriptone \typescriptone
+ \ifdone
+ \dochecktypescript{#2}\@@typescripttwo \typescripttwo
+ \ifdone
+ \dochecktypescript{#3}\@@typescriptthree\typescriptthree
+ \ifdone
+ %\debuggerinfo
+ % {typescript}
+ % {\currenttypefile: use=scr (val)
+ % [\@@typescriptone =#1 (\typescriptone)]
+ % [\@@typescripttwo =#2 (\typescripttwo)]
+ % [\@@typescriptthree=#3 (\typescriptthree)]}%
+ \let\next\dostarttypescriptA
+ \else
+ \let\next\dostarttypescriptC
+ \fi
+ \else
+ \let\next\dostarttypescriptC
+ \fi
+ \else
+ \let\next\dostarttypescriptC
+ \fi
\else\iffirsttypescriptpass
- \pushmacro\fontclass
- #4%
- \popmacro\fontclass
+ \let\next\dostarttypescriptB
\else
% skip this since it may do unwanted resets, like
% setting symbolic font names to unknown, especially
% in run time user type scripts
- \fi\fi}
+ \let\next\dostarttypescriptC
+ \fi\fi
+ \next}
-\newif\ifautoloadmapfiles
+\def\dostarttypescriptA
+ %{\def\stoptypescript{\typescriptfoundtrue}}
+ {\let\stoptypescript\typescriptfoundtrue}
-\def\forgetmapfiles
- {\global\let\allfontmapsfiles\empty}
+\def\dostarttypescriptB
+ {\def\stoptypescript{\popmacro\fontclass}\pushmacro\fontclass}
-\forgetmapfiles
+\long\def\dostarttypescriptC#1\stoptypescript
+ {}
% status
%
@@ -166,21 +241,42 @@
% 2 reported
% 3 preloaded
+% flags ipv \c!status, more flag values
+
+% \def\preloadmapfile[#1]%
+% {\def\docommando##1%
+% {\doifinstringelse{.}{##1}
+% {\writestatus{pdftex}{compensate map file: ##1}%
+% \setxvalue{##1 \c!status}{3}%
+% \doglobal\removefromcommalist{##1}\allfontmapsfiles}
+% {\expanded{\docommando{##1.\f!fontmapextension}}}}%
+% \expanded{\processcommalist[#1]}\docommando}
+%
+% \def\loadmapfile[#1]% last add first
+% {\def\docommando##1%
+% {\doifinstringelse{.}{##1}
+% {\doglobal\pretocommalist{##1}\allfontmapsfiles}
+% {\expanded{\docommando{##1.\f!fontmapextension}}}}%
+% \expanded{\processcommalist[#1]}\docommando
+% \ifproductionrun \loadallfontmapfiles \fi}
+
+\def\dopreloadmapfile#1%
+ {\doifinstringelse{.}{#1}
+ {\writestatus{pdftex}{compensate map file: #1}%
+ \setxvalue{#1 \c!status}{3}%
+ \doglobal\removefromcommalist{#1}\allfontmapsfiles}
+ {\expanded{\dopreloadmapfile{#1.\f!fontmapextension}}}}
+
\def\preloadmapfile[#1]%
- {\def\docommando##1%
- {\doifinstringelse{.}{##1}
- {\writestatus{pdftex}{compensate map file: ##1}%
- \setxvalue{##1 \c!status}{3}%
- \doglobal\removefromcommalist{##1}\allfontmapsfiles}
- {\expanded{\docommando{##1.\f!fontmapextension}}}}%
- \expanded{\processcommalist[#1]\noexpand\docommando}}
-
-\def\loadmapfile[#1]% last add first
- {\def\docommando##1%
- {\doifinstringelse{.}{##1}
- {\doglobal\pretocommalist{##1}\allfontmapsfiles}
- {\expanded{\docommando{##1.\f!fontmapextension}}}}%
- \expanded{\processcommalist[#1]\noexpand\docommando}%
+ {\expanded{\processcommalist[#1]}\dopreloadmapfile}
+
+\def\doloadmapfile#1%
+ {\doifinstringelse{.}{#1}
+ {\doglobal\pretocommalist{#1}\allfontmapsfiles}
+ {\expanded{\doloadmapfile{#1.\f!fontmapextension}}}}
+
+\def\loadmapfile[#1]% last added first !
+ {\expanded{\processcommalist[#1]}\doloadmapfile
\ifproductionrun \loadallfontmapfiles \fi}
\def\doloadfontmapfile#1% will be special
@@ -213,7 +309,14 @@
\appendtoks \loadallfontmapfiles \to \everyjob
\appendtoks \loadallfontmapfiles \to \everystarttext
-\appendtoks \loadallfontmapfiles \to \everypagebody
+\appendtoks \loadallfontmapfiles \to \everybeforepagebody
+
+\newif\ifautoloadmapfiles
+
+\def\forgetmapfiles
+ {\global\let\allfontmapsfiles\empty}
+
+\forgetmapfiles
% \definetypeface [#1:joke] [#2:rm]
% \definetypeface [#1:joke] [#2:rm] [#3:...]
diff --git a/tex/context/base/type-map.tex b/tex/context/base/type-map.tex
index 5303385db..18724bd92 100644
--- a/tex/context/base/type-map.tex
+++ b/tex/context/base/type-map.tex
@@ -18,6 +18,7 @@
\starttypescript [map] [all]
\loadmapfile[original-ams-cmr.map]
\loadmapfile[original-ams-euler.map]
+ \loadmapfile[original-ams-logo.map]
\stoptypescript
\starttypescript [map] [il2]
@@ -74,19 +75,27 @@
\loadmapfile[texnansi-urw-zapfchan.map]
\stoptypescript
-\starttypescript [map] [ec]
- \loadmapfile[ec-youngryu-px.map]
- \loadmapfile[ec-youngryu-tx.map]
+\starttypescript [map] [ec,texnansi,8r]
+ \loadmapfile[original-youngryu-px.map]
+ \loadmapfile[original-youngryu-tx.map]
\stoptypescript
+% to do
+
\starttypescript [map] [default]
\loadmapfile[original-micropress-informal.map]
\stoptypescript
-% to do
-
\starttypescript [map] [texnansi]
- \loadmapfile[original-bh-lucida.map]
+ \loadmapfile[texnansi-bh-lucida.map]
+\stoptypescript
+
+\starttypescript [map] [ec]
+ \loadmapfile[ec-bh-lucida.map]
+\stoptypescript
+
+\starttypescript [map] [8r]
+ \loadmapfile[8r-bh-lucida.map]
\stoptypescript
%\starttypescript [math] [helvetica] [all]
diff --git a/tex/context/base/type-pre.tex b/tex/context/base/type-pre.tex
index cb56b77f5..c5aee8b98 100644
--- a/tex/context/base/type-pre.tex
+++ b/tex/context/base/type-pre.tex
@@ -67,7 +67,6 @@
\stoptypescript
-
%D Here we implement the symbol fonts as provided by the
%D American Mathematical Society. The names of these symbols
%D can be found in The Joy of \TeX\ by M.~Spivak.
@@ -112,19 +111,25 @@
\usetypescript [serif,sans,mono,math,handwriting] [lucida] [name,special,\defaultencoding]
\usetypescript [serif,sans,mono,math,handwriting] [default] [size]
-\usemathcollection[lbr]
+\usemathcollection[lbr]
+
+\usetypescript [map] [\defaultencoding]
\stoptypescript
-%D With thanks to Berthold Horn from YandY for providing me
-%D evaluation copies of the MathTimePlus fonts.
+% %D With thanks to Berthold Horn from YandY for providing me
+% %D evaluation copies of the MathTimePlus fonts.
+
+% todo: \starttypescript [mt,tim]
-\starttypescript [mt,tim]
+\starttypescript [tim]
\usetypescript [math] [times] [all]
\usetypescript [math] [default] [size]
-\usemathcollection[tim]
+\usemathcollection[tim]
+
+\usetypescript [map] [\defaultencoding]
\stoptypescript
@@ -137,6 +142,8 @@
\usetypescript [serif] [antykwa-torunska] [name,\defaultencoding]
\usetypescript [serif] [default] [size]
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D This script defines the Standard Adobe Courier fonts.
@@ -146,6 +153,8 @@
\usetypescript [mono] [courier] [name,\defaultencoding]
\usetypescript [mono] [default] [size]
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D This script defines the Standard Adobe Helvetica fonts.
@@ -155,6 +164,8 @@
\usetypescript [sans] [helvetica] [name,\defaultencoding]
\usetypescript [sans] [default] [size]
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D This script defines the Standard Adobe Times fonts.
@@ -164,6 +175,8 @@
\usetypescript [serif] [times] [name,\defaultencoding]
\usetypescript [serif] [default] [size]
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D This script loads the Adobe Times Roman, Helvetica and
@@ -177,6 +190,11 @@
\usetypescript [serif,sans,mono] [default] [size]
+% \usetypescript [math] [times] [all]
+% \usetypescript [math] [default] [size]
+
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D This script defines the Palatino font.
@@ -186,6 +204,8 @@
\usetypescript [serif] [palatino] [name,\defaultencoding]
\usetypescript [serif] [default] [size]
+\usetypescript [map] [\defaultencoding]
+
\stoptypescript
%D The following scripts fake the old \type {font-ber} and
diff --git a/tex/context/base/type-syn.tex b/tex/context/base/type-syn.tex
index 00517d723..3cd761979 100644
--- a/tex/context/base/type-syn.tex
+++ b/tex/context/base/type-syn.tex
@@ -313,7 +313,7 @@
% Courier :
-\starttypescript [sans] [courier] [name]
+\starttypescript [mono] [courier] [name]
\definefontsynonym [Mono] [Courier]
\definefontsynonym [MonoBold] [Courier-Bold]
\definefontsynonym [MonoItalic] [Courier-Oblique]
diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex
index 3390af3d4..f1ec48b90 100644
--- a/tex/context/base/verb-ini.tex
+++ b/tex/context/base/verb-ini.tex
@@ -244,18 +244,24 @@
%D turn them into \SPACE. We need the double \type{\bgroup}
%D construction to keep the closing command local.
+\def\setverbatimspaceskip
+ {\setbox\scratchbox\hbox{x}%
+ \spaceskip\wd\scratchbox
+ \xspaceskip\spaceskip}
+
\def\setupinlineverbatim%
- {\verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
- \let\obeytabs=\ignoretabs
- \let\obeylines=\ignorelines
- \let\obeypages=\ignorepages
+ {\verbatimfont
+ \setverbatimspaceskip
+ \let\obeytabs\ignoretabs
+ \let\obeylines\ignorelines
+ \let\obeypages\ignorepages
\setupcopyverbatim}
\def\doprocessinlineverbatim%
{\ifx\next\bgroup
\setupinlineverbatim
- \catcode`\{=\@@begingroup
- \catcode`\}=\@@endgroup
+ \catcode`\{\@@begingroup
+ \catcode`\}\@@endgroup
\def\next{\let\next=}%
\else
\setupinlineverbatim
@@ -343,13 +349,19 @@
\let\handleverbatimline=\relax
+% \def\initializeverbatimline%
+% {\global\let\savedverbatimline=\empty
+% \ifskipfirstverbatimline
+% \global\chardef\verbatimstatus=0
+% \else
+% \global\chardef\verbatimstatus=1
+% \fi}
+%
+% more efficient
+
\def\initializeverbatimline%
- {\global\let\savedverbatimline=\empty
- \ifskipfirstverbatimline
- \global\chardef\verbatimstatus=0
- \else
- \global\chardef\verbatimstatus=1
- \fi}
+ {\global\let\savedverbatimline\empty
+ \global\chardef\verbatimstatus\ifskipfirstverbatimline0 \else1 \fi}
\def\presetemptyverbatimline%
{\ifcase\verbatimstatus
@@ -363,7 +375,7 @@
\doemptyverbatimline
\global\chardef\verbatimstatus=2
\else
- \kern\!!zeropoint
+ \kern\zeropoint
\doverbatimnobreak
\doflushverbatimline
\global\let\savedverbatimline=\empty
@@ -382,7 +394,7 @@
\doflushverbatimline
\global\chardef\verbatimstatus=4
\or
- \kern\!!zeropoint
+ \kern\zeropoint
\doverbatimnobreak
\doflushverbatimline
\global\chardef\verbatimstatus=5
@@ -396,7 +408,7 @@
{\ifcase\verbatimstatus \or \or \or
\doflushverbatimline
\else
- \kern\!!zeropoint
+ \kern\zeropoint
\doverbatimnobreak
\doflushverbatimline
\fi}
@@ -449,18 +461,19 @@
\egroup
\def\endofdisplayverbatim{\csname\verbatimname\endcsname}%
\bgroup
- \parindent\!!zeropoint
+ \parindent\zeropoint
\ifdim\lastskip<\parskip
\removelastskip
\vskip\parskip
\fi
- \parskip\!!zeropoint
+ \parskip\zeropoint
\processingverbatimtrue
\global\linepartrue
\expandafter\let\csname\verbatimname\endcsname=\relax
\edef\endofverbatimcommand{\csname\verbatimname\endcsname}%
\edef\endofverbatimcommand{\meaning\endofverbatimcommand}%
- \verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
+ \verbatimfont
+ \setverbatimspaceskip
\global\linepartrue % needed for paragraph numbering
\setupcopyverbatim
\initializeverbatimline
@@ -527,24 +540,60 @@
\catcode`\^^?=\@@ignore}
\def\setcatcodes#1%
- {\doprocesscatcodes
- {\catcode\scratchcounter=#1}}
+ {\doprocesscatcodes{\catcode\scratchcounter=#1}}
+
+% \def\uncatcodecharacters%
+% {\setcatcodes\@@letter}
\def\uncatcodecharacters%
- {\setcatcodes\@@letter}
-
-\def\setnaturalcatcodes%
- {\catcode`\!=\@@other \catcode`\?=\@@other \catcode`\@=\@@other
- \catcode`\#=\@@other \catcode`\&=\@@other \catcode`\|=\@@other
- \catcode`\$=\@@other \catcode`\^=\@@other \catcode`\_=\@@other
- \catcode`\*=\@@other \catcode`\/=\@@other
- \catcode`\-=\@@other \catcode`\+=\@@other
- \catcode`\==\@@other \catcode`\<=\@@other \catcode`\>=\@@other
- \catcode`\"=\@@other \catcode`\'=\@@other \catcode`\`=\@@other
- \catcode`\:=\@@other \catcode`\;=\@@other
- \catcode`\,=\@@other \catcode`\.=\@@other \catcode`\~=\@@other
- \catcode`\(=\@@other \catcode`\)=\@@other
- \catcode`\{=\@@other \catcode`\}=\@@other}
+ {\setnaturalcatcodes}
+
+\newtoks\everycommoncatcodes
+\newtoks\everynaturalcatcodes
+\newtoks\everynormalcatcodes
+
+\def\setcommoncatcodes%
+ {\catcode`\!\@@other \catcode`\?\@@other \catcode`\@\@@other
+ \catcode`\=\@@other \catcode`\<\@@other \catcode`\>\@@other
+ \catcode`\*\@@other \catcode`\/\@@other
+ \catcode`\-\@@other \catcode`\+\@@other
+ \catcode`\:\@@other \catcode`\;\@@other
+ \catcode`\.\@@other \catcode`\,\@@other
+ \catcode`\'\@@other \catcode`\"\@@other \catcode`\`\@@other
+ \catcode`\(\@@other \catcode`\)\@@other
+ \the\everycommoncatcodes}
+
+\def\setnaturalcatcodes% see elsewhere, merge 'm
+ {\setcommoncatcodes
+ \uncatcodespacetokens
+ \catcode`\#\@@other
+ \catcode`\$\@@other
+ \catcode`\%\@@other
+ \catcode`\&\@@other
+ \catcode`\\\@@other
+ \catcode`\^\@@other
+ \catcode`\_\@@other
+ \catcode`\{\@@other
+ \catcode`\|\@@other
+ \catcode`\}\@@other
+ \catcode`\~\@@other
+ \the\everynaturalcatcodes}
+
+\def\setnormalcatcodes
+ {\setcommoncatcodes
+ \uncatcodespacetokens
+ \catcode`\#\@@parameter
+ \catcode`\$\@@mathshift
+ \catcode`\%\@@comment
+ \catcode`\&\@@alignment
+ \catcode`\\\@@escape
+ \catcode`\^\@@superscript
+ \catcode`\_\@@subscript
+ \catcode`\{\@@begingroup
+ \catcode`\|\@@active
+ \catcode`\}\@@endgroup
+ \catcode`\~\@@active
+ \the\everynormalcatcodes}
%D \macros
%D {localcatcodes,
@@ -572,18 +621,18 @@
\def\savecatcode%
{\iflocalcatcodes \else
\saverestoreactivecatcode
- {\@EA\let\csname\@@aa@@\the\scratchcounter\endcsname=~}%
+ {\@EA\let\csname\@@aa@@\the\scratchcounter\endcsname~}%
\@EA\chardef\csname\@@cc@@\the\scratchcounter\endcsname
- =\catcode\scratchcounter
+ \catcode\scratchcounter
\fi}
%D It's counterpart is:
\def\restorecatcode%
- {\@EA\catcode\@EA\scratchcounter\@EA=
+ {\@EA\catcode\@EA\scratchcounter
\csname\@@cc@@\the\scratchcounter\endcsname
\saverestoreactivecatcode
- {\@EA\let\@EA~\@EA=\csname\@@aa@@\the\scratchcounter\endcsname}}
+ {\@EA\let\@EA~\csname\@@aa@@\the\scratchcounter\endcsname}}
%D Especially when we enable pretty printing, we need to
%D restore the meaning of active characters too. Just think of
@@ -613,35 +662,39 @@
\def\beginrestorecatcodes%
{\ifx\restorecatcodes\relax
- \let\endrestorecatcodes=\relax
+ \let\endrestorecatcodes\relax
\else
\bgroup
\restorecatcodes
- \let\beginrestorecatcodes=\bgroup
- \let\endrestorecatcodes =\egroup
+ \let\beginrestorecatcodes\bgroup
+ \let\endrestorecatcodes \egroup
\fi}
%D \macros
-%D {makeallletter}
+%D {makeallother}
%D
-%D With \type {\makeallletter} each character ($>0$) gets the
+%D With \type {\makeallother} each character ($>0$) gets the
%D category code 12.
%D
%D The next alternative was okay when memory was still low.
%D
-%D \startypen
+%D \starttypen
%D \def\makeallother%
%D {\dorecurse{255}{\catcode\recurselevel=\@@other}}
%D \stoptypen
%D
%D Today we prebuild a token list:
-\newtoks\makeallothertoks
+\ifx\makeallother\undefined
+
+ \newtoks\makeallothertoks
+
+ \dorecurse{255}
+ {\@EA\appendtoks\@EA\catcode\recurselevel=\@@other\to\makeallothertoks}
-\dorecurse{255}
- {\@EA\appendtoks\@EA\catcode\recurselevel=\@@other\to\makeallothertoks}
+ \def\makeallother{\the\makeallothertoks}
-\def\makeallother{\the\makeallothertoks}
+\fi
%D The main copying routine of display verbatim does an
%D ordinary string||compare on the saved closing command and
@@ -704,11 +757,11 @@
\iflinepar\else\EveryPar{}\fi
\leavevmode
\xdef\dokeepverbatimlinedata%
- {\parindent =\the\parindent
- \hangindent=\the\hangindent
- \hangafter =\the\hangafter
- \leftskip =\the\leftskip
- \rightskip =\the\rightskip}%
+ {\parindent \the\parindent
+ \hangindent\the\hangindent
+ \hangafter \the\hangafter
+ \leftskip \the\leftskip
+ \rightskip \the\rightskip}%
\egroup
\dokeepverbatimlinedata
\doopenupverbatimline
@@ -850,16 +903,17 @@
\def\processfileverbatim#1%
{\par
\bgroup
- \parindent\!!zeropoint
+ \parindent\zeropoint
\ifdim\lastskip<\parskip
\removelastskip
\vskip\parskip
\fi
- \parskip\!!zeropoint
+ \parskip\zeropoint
\processingverbatimtrue
\global\linepartrue
\uncatcodecharacters
- \verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
+ \verbatimfont
+ \setverbatimspaceskip
\frenchspacing
\obeyspaces
\obeytabs
@@ -986,7 +1040,7 @@
%D calls for an interpreter macro.
\def\handleprettytoken#1%
- {\getvalue{\!!PRETTY#1}}
+ {\csname\!!PRETTY#1\endcsname} % \getvalue{\!!PRETTY#1}}
%D This interpreter is installed by saying
%D
@@ -1773,17 +1827,18 @@
% \egroup
% \def\endofdisplayverbatim{\csname\verbatimname\endcsname}%
% \bgroup
-% \parindent\!!zeropoint
+% \parindent\zeropoint
% \ifdim\lastskip<\parskip
% \removelastskip
% \vskip\parskip
% \fi
-% \parskip\!!zeropoint
+% \parskip\zeropoint
% \processingverbatimtrue
% \expandafter\let\csname\verbatimname\endcsname=\relax
% \expandafter\convertargument\csname\verbatimname\endcsname
% \to\endofverbatimcommand
-% \verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
+% \verbatimfont
+% \setverbatimspaceskip
% \global\linepartrue % needed for paragraph numbering
% \setupcopyverbatim
% \initializeverbatimline
@@ -1812,14 +1867,15 @@
% \let\endofdisplayverbatim\relax
% \convertargument#1\to\endofverbatimcommand
% \bgroup
-% \parindent\!!zeropoint
+% \parindent\zeropoint
% \ifdim\lastskip<\parskip
% \removelastskip
% \vskip\parskip
% \fi
-% \parskip\!!zeropoint
+% \parskip\zeropoint
% \processingverbatimtrue
-% \verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
+% \verbatimfont
+% \setverbatimspaceskip
% \global\linepartrue % needed for paragraph numbering
% \setupcopyverbatim
% \initializeverbatimline
@@ -1837,12 +1893,12 @@
\def\endofdisplayverbatim{\csname\verbatimname\endcsname}%
\fi
\bgroup
- \parindent\!!zeropoint
+ \parindent\zeropoint
\ifdim\lastskip<\parskip
\removelastskip
\vskip\parskip
\fi
- \parskip\!!zeropoint
+ \parskip\zeropoint
\processingverbatimtrue
\ifcase#1%
\convertargument#2\to\endofverbatimcommand
@@ -1851,7 +1907,8 @@
\expandafter\convertargument\csname\verbatimname\endcsname
\to\endofverbatimcommand
\fi
- \verbatimfont \spaceskip=.5em \xspaceskip=\spaceskip
+ \verbatimfont
+ \setverbatimspaceskip
\global\linepartrue % needed for paragraph numbering
\setupcopyverbatim
\initializeverbatimline
diff --git a/tex/context/base/verb-raw.tex b/tex/context/base/verb-raw.tex
new file mode 100644
index 000000000..32903db77
--- /dev/null
+++ b/tex/context/base/verb-raw.tex
@@ -0,0 +1,7 @@
+\ifx\undefined\setupprettyTEXtype \input verb-tex \relax \fi
+
+\gdef\setupprettyRAWtype%
+ {\setupprettyTEXtype
+ \def\prettyidentifier{RAW}}
+
+\endinput
diff --git a/tex/context/base/x-chemml.tex b/tex/context/base/x-chemml.tex
new file mode 100644
index 000000000..8475fe81a
--- /dev/null
+++ b/tex/context/base/x-chemml.tex
@@ -0,0 +1,212 @@
+%D \module
+%D [ file=m-chemml,
+%D version=2001.09.12,
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=Loading \CHEMML\ Filters,
+%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.
+
+\useXMLfilter[cml]
+
+%D Structural formulas are codes in a \PPCHTEX\ way; this
+%D will change -)
+%D
+%D \startbuffer
+%D <dchem>
+%D <structure>
+%D <component>
+%D <graphic>SIX,B</graphic>
+%D <graphic>R135</graphic>
+%D </component>
+%D <component>
+%D <graphic>R246</graphic>
+%D </component>
+%D <component>
+%D <graphic>RZ</graphic>
+%D <text>A,B,C,D,E,F</text>
+%D </component>
+%D <component>
+%D <graphic>Z</graphic>
+%D <oxidation n="3">A</oxidation>
+%D <text>A</text>
+%D <annotation location="t">
+%D <text>B</text>
+%D <caption>x<context:b>x<context:compound token="*"/>x</context:b>x</caption>
+%D </annotation>
+%D <oxidation n="3" sign="+">B</oxidation>
+%D <text>C,D,E,F</text>
+%D </component>
+%D </structure>
+%D <structure>
+%D <component>
+%D <graphic>SIX,B</graphic>
+%D <graphic>r135</graphic>
+%D </component>
+%D <component>
+%D <graphic>R246</graphic>
+%D </component>
+%D <component>
+%D <graphic>RZ</graphic>
+%D <text>A,B,C,D,E,F</text>
+%D </component>
+%D </structure>
+%D </dchem>
+%D \stopbuffer
+%D
+%D \typebuffer
+
+% \ifx\XMLgtoks\undefined \newtoks\XMLgtoks \fi
+% \ifx\XMLttoks\undefined \newtoks\XMLttoks \fi
+%
+% \defineXMLenvironment [structure]
+% {\startchemical\ignorespaces}
+% {\relax\stopchemical}
+%
+% \def\chemicalXMLg#1% \defineXMLcollect [graphic] \XMLgtoks
+% {\doifelsenothing{\the\XMLgtoks}
+% {\doglobal\appendtoks #1\to\XMLgtoks\ignorespaces}
+% {\doglobal\appendtoks,#1\to\XMLgtoks\ignorespaces}}
+%
+% \def\chemicalXMLt#1%
+% {\doifelsenothing{\the\XMLttoks}
+% {\doglobal\appendtoks #1\to\XMLttoks\ignorespaces}
+% {\doglobal\appendtoks,#1\to\XMLttoks\ignorespaces}}
+%
+% \defineXMLenvironment [component] [type=]
+% {\global\XMLgtoks\emptytoks
+% \global\XMLttoks\emptytoks
+% \defineXMLargument[graphic]\chemicalXMLg
+% \defineXMLargument[text]\chemicalXMLt
+% \ignorespaces}
+% {\expanded{\chemical[\the\XMLgtoks][\the\XMLttoks]}%
+% \ignorespaces}
+%
+% \defineXMLargument [oxidation] [sign=,n=1] \chemicalXMLo % +/- 1..7
+%
+% \def\chemicalXMLo#1%
+% {\expanded{\chemicalXMLt
+% {\noexpand\chemicaloxidation{\XMLop{sign}}{\XMLop{n}}{#1}}}%
+% \ignorespaces}
+%
+% \defineXMLenvironment [annotation] [location=]
+% {\bgroup
+% \defineXMLenvironmentsave[text]{\ignorespaces}{\ignorespaces}%
+% \defineXMLenvironmentsave[caption]{\ignorespaces}{\ignorespaces}%
+% \ignorespaces}
+% {\scratchtoks{\chemicalright}%
+% \processaction
+% [\XMLop{location}]
+% [ t=>\scratchtoks{\chemicaltop},
+% b=>\scratchtoks{\chemicalbottom},
+% l=>\scratchtoks{\chemicalleft},
+% r=>\scratchtoks{\chemicalright},
+% lc=>\scratchtoks{\chemicalleftcentered},
+% rc=>\scratchtoks{\chemicalrightcentered},
+% tl=>\scratchtoks{\chemicaltopleft},
+% bl=>\scratchtoks{\chemicalbottomleft},
+% tr=>\scratchtoks{\chemicaltopright},
+% br=>\scratchtoks{\chemicalbottomright},
+% lt=>\scratchtoks{\chemicallefttop},
+% lb=>\scratchtoks{\chemicalleftbottom},
+% rt=>\scratchtoks{\chemicalrighttop},
+% rb=>\scratchtoks{\chemicalrightbottom},
+% x=>\scratchtoks{\chemicaltighttext},
+% sl=>\scratchtoks{\chemicalsmashedleft},
+% sm=>\scratchtoks{\chemicalsmashedmiddle},
+% sr=>\scratchtoks{\chemicalsmashedright}]%
+% \expanded{\chemicalXMLt
+% {\the\scratchtoks{\XMLflush{text}}{\XMLflush{caption}}}}%
+% \egroup
+% \ignorespaces}
+%
+% \defineXMLenvironment [forever]
+% {\chemicalXMLt{\[}\ignorespaces}
+% {\chemicalXMLt{\]}\ignorespaces}
+
+\ifx\XMLgtoks\undefined \newtoks\XMLgtoks \fi
+\ifx\XMLttoks\undefined \newtoks\XMLttoks \fi
+
+\startXMLmapping [cml]
+
+% this will be a more natural method; this also triggers it
+
+\installXMLunknownremapping
+
+% extensions
+
+\remapXMLsequence [structure] [CPA] \doCMLstructure
+\remapXMLsequence [component] [CPA] \doCMLcomponent
+\remapXMLsequence [graphic] [CPA] \doCMLgraphic
+\remapXMLsequence [text] [CPA] \doCMLtext
+
+\remapXMLsequence [caption] [CPA] \doCMLcaption
+\remapXMLsequence [oxidation] [CPA] \doCMLoxidation
+\remapXMLsequence [annotation][CPA] \doCMLannotation
+\remapXMLsequence [forever] [CPA] \doCMLforever
+
+\def\doCMLstructure#1#2%
+ {\startchemical\ignorespaces#2\unskip\stopchemical}
+
+\def\doCMLgraphic#1#2%
+ {\doifelsenothing{\the\XMLgtoks}
+ {\uppercase{\doglobal\appendtoks #2\to\XMLgtoks\ignorespaces}}
+ {\uppercase{\doglobal\appendtoks,#2\to\XMLgtoks\ignorespaces}}%
+ \ignorespaces}
+
+\def\doCMLtext#1#2%
+ {\doifelsenothing{\the\XMLttoks}
+ {\doglobal\appendtoks #2\to\XMLttoks\ignorespaces}
+ {\doglobal\appendtoks,#2\to\XMLttoks\ignorespaces}%
+ \ignorespaces}
+
+\def\doCMLcomponent#1#2%
+ {\global\XMLgtoks\emptytoks
+ \global\XMLttoks\emptytoks
+ \ignorespaces#2\unskip
+ \expanded{\chemical[\the\XMLgtoks][\the\XMLttoks]}%
+ \ignorespaces}
+
+\def\doCMLannotation#1#2%
+ {\getXMLarguments{cml}{location="" #1}%
+ \def\dodoCMLannotation##1%
+ {\doCMLtext\empty{##1%
+ {\let\doCMLtext \secondoftwoarguments\processXMLRchild{text}{#2}}%
+ {\let\doCMLcaption\unmapXMLdata \processXMLRchild{caption}{#2}}}}%
+ \processaction
+ [\XMLpar{cml}{location}{r}]
+ [ t=>\dodoCMLannotation\chemicaltop,
+ b=>\dodoCMLannotation\chemicalbottom,
+ l=>\dodoCMLannotation\chemicalleft,
+ r=>\dodoCMLannotation\chemicalright,
+ lc=>\dodoCMLannotation\chemicalleftcentered,
+ rc=>\dodoCMLannotation\chemicalrightcentered,
+ tl=>\dodoCMLannotation\chemicaltopleft,
+ bl=>\dodoCMLannotation\chemicalbottomleft,
+ tr=>\dodoCMLannotation\chemicaltopright,
+ br=>\dodoCMLannotation\chemicalbottomright,
+ lt=>\dodoCMLannotation\chemicallefttop,
+ lb=>\dodoCMLannotation\chemicalleftbottom,
+ rt=>\dodoCMLannotation\chemicalrighttop,
+ rb=>\dodoCMLannotation\chemicalrightbottom,
+ x=>\dodoCMLannotation\chemicaltighttext,
+ sl=>\dodoCMLannotation\chemicalsmashedleft,
+ sm=>\dodoCMLannotation\chemicalsmashedmiddle,
+ sr=>\dodoCMLannotation\chemicalsmashedright]%
+ \ignorespaces}
+
+\def\doCMLoxidation#1#2%
+ {\getXMLarguments{cml}{sign="" n="1" #1}%
+ \expanded{\doCMLtext{}%
+ {\noexpand\chemicaloxidation{\XMLpar{cml}{sign}{}}{\XMLpar{cml}{n}{}}{#2}}}%
+ \ignorespaces}
+
+\def\doCMLforever#1#2{\[#2\]}
+
+\stopXMLmapping
+
+\endinput
diff --git a/tex/context/base/x-contml.tex b/tex/context/base/x-contml.tex
new file mode 100644
index 000000000..0758846cf
--- /dev/null
+++ b/tex/context/base/x-contml.tex
@@ -0,0 +1,451 @@
+% interface=en
+
+%M \usemodule [contml] \autoXMLnamespace [context]
+%M \definefilesynonym [context] [x-contml.xsd]
+
+%D \module
+%D [ file=x-contml,
+%D version=mid 2001,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Basic \CONTEXT\ commands,
+%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.
+
+% This module provides some basic \XML\ elements. These definitions
+% are highly experimental and serve as a playground for interface
+% development.
+
+\unprotect
+
+%D \elements {include}
+%D
+%D \startbuffer
+%D You can include another file in the current document with the
+%D <element>include</element> element. When including the file, &context;
+%D will look at the suffix, in order to decide how to include the file.
+%D
+%D <verbatim>
+%D <line><include name="mine"/></line>
+%D <line><include name="mine" type="txt"/></line>
+%D <line><include name="mine" type="tex"/></line>
+%D </verbatim>
+%D \stopbuffer
+%D
+%D \showelements [context] [include]
+
+\defineXMLsingular [context:include] [name=,type=xml]
+ {\doifsomethingXMLop{name}
+ {\processaction
+ [\XMLop{type}]
+ [xml=>\readfile{\XMLop{name}}{}{},
+ tex=>{{\disableXML\readfile{\XMLop{name}}{}{}}},
+ txt=>{{\disableXML\typefile{\XMLop{name}}{}{}}}]}}
+
+%D \elements {compound}
+%D
+%D \startbuffer
+%D Instead of using hard coded compound tokens, you should use the
+%D <element>compound</element> element, as in high<compound token="/" />low.
+%D The overhead in keying is rewarded with proper symbols and hyphenation.
+%D \stopbuffer
+%D
+%D \showelements [context] [compound]
+
+\let\normalcompound=|
+
+% \defineXMLsingular [context:compound] [token=]
+% {\expanded{\normalcompound\XMLop{token}}|}
+
+\defineXMLsingular [context:compound] [token=]
+ {\ifmmode
+ \doifXMLop{token}{\XMLop{token}}{\compoundhyphen}%
+ \else
+ \expanded{\normalcompound\XMLop{token}}|%
+ \fi}
+
+%D \elements {p}
+%D
+%D \startbuffer
+%D <p>Although for &tex; it is often enough to mark the end of a paragraph,
+%D in &xml; we want to add a bit more structure. <p/> This permits a more
+%D robust implementation of begin<compound/>of<compound/>par actions</p>
+%D \stopbuffer
+%D
+%D \showelements [context] [p]
+
+\defineXMLenvironment [context:p] {} \endgraf
+\defineXMLsingular [context:p] \endgraf
+
+%D \elements {pageref,textref,lineref}
+%D
+%D \startbuffer
+%D You can ask for a page (<pageref label="lastpage">the last pagenumber
+%D is</pageref> aka page <pageref label="lastpage"/>), text or line reference
+%D with the following three elements. The label may be any valid &context;
+%D reference label.
+%D \stopbuffer
+%D
+%D \showelements [context] [references]
+
+\defineXMLpickup [context:pageref] [label=] {\op} {[\XMLop{label}]}
+\defineXMLpickup [context:textref] [label=] {\in} {[\XMLop{label}]}
+\defineXMLpickup [context:lineref] [label=] {\inline} {[\XMLop{label}]}
+
+%D \elements{text}
+%D
+%D \startbuffer
+%D If you have a self contained &xml; file, you need to signal &context; the
+%D begin and end of the document. The following elements can be used for
+%D that purpose:
+%D
+%D <verbatim>
+%D <line><text></line>
+%D <line> ...</line>
+%D <line></text></line>
+%D </verbatim>
+%D \stopbuffer
+%D
+%D \showelements [context] [text]
+
+\defineXMLenvironment [context:text] \starttext \stoptext
+
+%D \elements {em}
+%D
+%D \startbuffer
+%D Authors often want some control over the way a text is typeset, which is
+%D why we provide the <element>em</element> element. We may only hope that
+%D the author is <em>consistent</em> in his decisions on what to emphasize.
+%D \stopbuffer
+%D
+%D \showelements [context] [em]
+
+\defineXMLgrouped [context:em] \em
+
+%D \elements {b}
+%D
+%D \startbuffer
+%D Bold is not always <b>beautiful</b> but if you really want it, you can
+%D get it by using this element.
+%D \stopbuffer
+%D
+%D \showelements [context] [b]
+
+\defineXMLgrouped [context:b] \bf
+
+%D \elements {verbatim,typing,line,verb,type}
+%D
+%D \startbuffer
+%D Although the following method can be used to typeset a piece of code
+%D verbatim
+%D
+%D <![CDATA[
+%D Dit \is nogal verbatim !
+%D Dit is {nogal} verbatim !
+%D Dit is <nogal> verbatim !
+%D ]]>
+%D
+%D we prefer the more structured:
+%D
+%D <verbatim>
+%D <line>Dit \is nogal verbatim !</line>
+%D <line>Dit is {nogal} verbatim !</line>
+%D <line>Dit is <nogal> verbatim !</line>
+%D </verbatim>
+%D \stopbuffer
+%D
+%D The element to tag in<compound/>line verbatim is <type><verb></type>.
+%D
+%D \showelements [context] [verbatim]
+
+\defineXMLenvironment [context:verbatim]
+ {\startopelkaar
+ \defineXMLargument[context:line]{\endgraf\type}}
+ {\stopopelkaar}
+
+\defineXMLenvironment [context:typing]
+ {\startpacked\defineXMLargument[context:line]{\endgraf\type}}
+ {\stoppacked}
+
+\defineXMLargument [context:verb] \type
+\defineXMLargument [context:type] \type
+
+%D \elements {itemize,item}
+%D
+%D \startbuffer
+%D Itemized lists are quite common in documents, al least in the ones that
+%D we produce. For the moment we only provide a few options, later we will
+%D hook it into the &context; attribute handler.
+%D
+%D <itemize type="a">
+%D <item label="bla"> test </item>
+%D <item> test </item>
+%D </itemize>
+%D
+%D <itemize packed="yes">
+%D <item label="more bla"> test </item>
+%D <item> test <em>what?</em></item>
+%D </itemize>
+%D \stopbuffer
+%D
+%D \showelements [context] [itemize]
+
+\defineXMLenvironment [context:itemize] [type=,packed=]
+ {\let\XMLoptions\empty
+ \doifsomethingXMLop{type}
+ {\addtocommalist{\XMLop{type}}\XMLoptions}
+ \doifXMLop{packed}{yes}
+ {\addtocommalist{packed}\XMLoptions}
+ \expanded{\startitemize[\XMLoptions]}}
+ {\stopitemize}
+
+\defineXMLenvironment [context:item] [label=]
+ {\expanded{\item[\XMLop{label}]}}
+ {\endgraf}
+
+%D \elements {fixed}
+%D
+%D \startbuffer
+%D Something fixed will end up at the place where it defined in the input
+%D stream. The main idea behind this element is that it gives you control
+%D over the placement.
+%D
+%D <itemize>
+%D <item>
+%D <fixed align="high">
+%D <content>
+%D <externalfigure file="koe" frame="on" height="1cm" />
+%D </content>
+%D </fixed>
+%D </item>
+%D </itemize>
+%D \stopbuffer
+%D
+%D \showelements [context] [fixed]
+
+\defineXMLenvironment [context:fixed] [type=figure,location=,label=]
+ {\bgroup
+ \defineXMLsave[context:caption]
+ \defineXMLsave[context:content]}
+ {\expanded{\startfixed[\XMLop{location}]}
+ \doifXMLdataelse{context:caption}
+ {\startcombination[1*1]
+ {\XMLflush{context:content}} {\XMLflush{context:caption}}
+ \stopcombination}
+ {\XMLflush{context:content}}
+ \stopfixed
+ \egroup}
+
+%D \elements {float}
+%D
+%D \startbuffer
+%D A floating body will be placed at the first location available, unless
+%D a location is specified. As with the <element>fixed</element> element,
+%D you can prvide a caption.
+%D
+%D <float type="figure">
+%D <content>
+%D <externalfigure file="koe" frame="on" height="3cm" />
+%D </content>
+%D <caption>This is a cow!</caption>
+%D </float>
+%D \stopbuffer
+%D
+%D \showelements [context] [float]
+
+\defineXMLenvironment [context:float] [type=figure,location=here,label=]
+ {\bgroup
+ \defineXMLsave[context:caption]
+ \defineXMLsave[context:content]}
+ {\expanded
+ {\placefloat
+ [\XMLop{type}] [\XMLop{location}] [\XMLop{label}]
+ {\XMLflush{context:caption}} {\XMLflush{context:content}}}
+ \egroup}
+
+%D \elements {externalfigure}
+%D
+%D \startbuffer
+%D The previous examples already demonstrated how we can include a graphic:
+%D
+%D <verbatim>
+%D <line><externalfigure file="koe" width="5cm" /></line>
+%D </verbatim>
+%D \stopbuffer
+%D
+%D \showelements [context] [externalfigure]
+
+\defineXMLsingular [context:externalfigure] [\??ef] [base=,label=,file=]
+ {\bgroup % \getXMLta \expandXMLta \expandXMLtp{file}%
+ \expandXMLta \getXMLta % expand entities first
+ \doifelsenothing{\XMLtp{label}}
+ {\expanded{\externalfigure[\XMLtp{file}][\XMLta]}}
+ {\doifsomething{\XMLtp{base}}{\usefigurebase[\XMLtp{base}]}%
+ \expanded{\externalfigure[\XMLtp{label}][\XMLta]}}
+ \egroup}
+
+%D \elements {quotation,quote}
+%D
+%D \startbuffer
+%D There is a (not so) subtle difference between a display
+%D <quotation>quotation</quotation> and an <quote>in<compound/>line</quote>
+%D one.
+%D \stopbuffer
+%D
+%D \showelements [context] [table]
+
+\defineXMLgrouped [context:quote] \quote
+\defineXMLgrouped [context:quotation] \quotation
+
+%D \elements {table,tr,td}
+%D
+%D \startbuffer
+%D There are (currently) three table mechanisms in &context;. One of them
+%D resembles the well known &html; tables.
+%D
+%D <?context-command \startlinecorrection[blank] ?>
+%D <table>
+%D <tr> <td>one</td> <td>a</td> <td>first </td> </tr>
+%D <tr> <td>two</td> <td>b</td> <td>second</td> </tr>
+%D </table>
+%D <?context-command \stoplinecorrection ?>
+%D
+%D As you can see here, we use a similar syntax but stick to the &context;
+%D attributes (which provide quite advanced control over the layout).
+%D
+%D <?context-command \startlinecorrection[blank] ?>
+%D <table frame="off" background="color" color="white">
+%D <tr backgroundcolor="red"> <td>xx</td> <td>xx</td> </tr>
+%D <tr backgroundcolor="green"> <td>xx</td> <td>xx</td> </tr>
+%D </table>
+%D <?context-command \stoplinecorrection ?>
+%D \stopbuffer
+%D
+%D \showelements [context] [table]
+
+\defineXMLenvironment [context:table] [\@@tbl\@@tbl]
+ {\bgroup
+ \defineXMLnested [context:tr] [\@@tbl] {\expanded{\bTR[\theXMLarguments{\@@tbl}}]} \eTR
+ \defineXMLnested [context:td] [\@@tbl] {\expanded{\bTD[\theXMLarguments{\@@tbl}}]} \eTD
+ \expanded{\bTABLE[\theXMLarguments{\@@tbl\@@tbl}]}}
+ {\eTABLE
+ \egroup}
+
+%D \elements {tabulate,tspec,thead,tbody,ttail,trule,tr,td}
+%D
+%D \startbuffer
+%D The second mechanism that we support is tabulation. The advantage of this
+%D mechanism is that it it well tuned for tables that hav emuch text in the
+%D cells and cross page boundaires.
+%D
+%D <tabulate>
+%D <tspec>
+%D <tcell align="left"/> <tcell align="middle"/> <tcell align="right"/>
+%D </tspec>
+%D <thead>
+%D <trule/>
+%D <tr> <td> bagger </td> <td> bagger </td> <td> bagger </td> </tr>
+%D <trule/>
+%D </thead>
+%D <ttail>
+%D <trule/>
+%D </ttail>
+%D <tbody>
+%D <tr> <td> bagger </td> <td> bagger </td> <td> bagger </td> </tr>
+%D <tr> <td> bagg </td> <td> ger </td> <td> gr </td> </tr>
+%D <tr> <td> bag </td> <td> er </td> <td> gger </td> </tr>
+%D </tbody>
+%D </tabulate>
+%D \stopbuffer
+%D
+%D \showelements [context] [tabulate]
+
+\newtoks\XMLtabtoks
+
+\defineXMLgrouped [context:tabulate] {\XMLtabtoks{|l|p|}}
+
+\defineXMLpickup [context:tbody]
+ {\expanded{\definetabulate[dummy][\the\XMLtabtoks]}
+ \startdummy\XMLflush{context:thead}}
+ {\XMLflush{context:ttail}\stopdummy}
+
+\defineXMLsave [context:thead]
+\defineXMLsave [context:ttail]
+
+\defineXMLenvironment[context:tspec]
+ {\XMLtabtoks\emptytoks}
+ {\appendtoks|\to\XMLtabtoks}
+
+\defineXMLsingular [context:trule] % verrrry ugly
+ {\crcr\noalign{\kern-\lineheight}\HL}
+
+\defineXMLsingular [context:tcell] [align=]
+ {\appendtoks|\to\XMLtabtoks
+ \processaction
+ [\XMLop{align}]
+ [ left=>\appendtoks l\to\XMLtabtoks,
+ right=>\appendtoks r\to\XMLtabtoks,
+ center=>\appendtoks c\to\XMLtabtoks,
+ middle=>\appendtoks c\to\XMLtabtoks]}
+
+\defineXMLenvironment [context:tr] {\ignorespaces} {\NC\NR}
+\defineXMLenvironment [context:td] {\NC} {\ignorespaces}
+
+%D \elements {hide}
+%D
+%D \startbuffer
+%D This is the way to [<hide>this is gone</hide>] something for the
+%D typesetting engine. Normally this element is only used for testing
+%D purposes.
+%D \stopbuffer
+%D
+%D \showelements [context] [tabulate]
+
+\defineXMLignore[context:hide]
+
+%D \elements {unknown}
+%D
+%D \startbuffer
+%D We can go on and on and <unknown/> with defining elements that map onto
+%D &context; commands, but why not just use &tex; input syntax then?
+%D \stopbuffer
+%D
+%D \showelements [context] [unknown]
+
+\defineXMLsingular [context:unknown] \unknown
+
+%D A (for the moment) private one.
+
+\defineXMLargument [context:element] \type
+
+%D The following common schema definitions apply:
+%D
+%D {\setupcolors[state=stop]\showXSDcomponent[context][definitions]}
+
+\defineXMLargument [context:chapter] [label=] {\chapter[\XMLop{label}]}
+\defineXMLargument [context:section] [label=] {\section[\XMLop{label}]}
+\defineXMLargument [context:subsection] [label=] {\subsection[\XMLop{label}]}
+\defineXMLargument [context:subsubsection] [label=] {\subsubsection[\XMLop{label}]}
+\defineXMLargument [context:subsubsubsection] [label=] {\subsubsubsection[\XMLop{label}]}
+
+\defineXMLargument [context:title] [label=] {\title[\XMLop{label}]}
+\defineXMLargument [context:subject] [label=] {\subject[\XMLop{label}]}
+\defineXMLargument [context:subsubject] [label=] {\subsubject[\XMLop{label}]}
+\defineXMLargument [context:subsubsubject] [label=] {\subsubsubject[\XMLop{label}]}
+\defineXMLargument [context:subsubsubsubject] [label=] {\subsubsubsubject[\XMLop{label}]}
+
+\defineXMLenvironment [context:frontmatter] \startfrontmatter \stopfrontmatter
+\defineXMLenvironment [context:bodymatter] \startbodymatter \stopbodymatter
+\defineXMLenvironment [context:backmatter] \startbackmatter \stopbackmatter
+\defineXMLenvironment [context:appendices] \startappendices \stopappendices
+
+\defineXMLargument [context:index] [key=]
+ {\doifelsenothingXMLop{key}{\index}{\expanded{\index[\XMLop{key}]}}}
+
+% \enableXMLfiledata
+
+\protect \endinput
diff --git a/tex/context/base/x-fdf-00.tex b/tex/context/base/x-fdf-00.tex
new file mode 100644
index 000000000..921757f56
--- /dev/null
+++ b/tex/context/base/x-fdf-00.tex
@@ -0,0 +1,40 @@
+% <xfdf>
+% <fields>
+% <field name="one">
+% <value>first</value>
+% </field>
+% <field name="two">
+% <value>second</value>
+% </field>
+% </fields>
+% </xfdf>
+%
+% previous method:
+%
+% object
+% data
+% fields
+% field
+
+\defineXMLprocess[fdf:xfdf]
+\defineXMLprocess[fdf:fields]
+\defineXMLignore [fdf:f]
+\defineXMLpush [fdf:value]
+
+\defineXMLenvironment [fdf:field] [name=,value=]
+ {\XMLerase{fdf:value}}
+ {\doglobal\saveXMLdata{fdf:\XMLop{name}}{fdf:value}}
+
+\defineXMLsingular [fdf:field] [name=,value=]
+ {\doglobal\saveasXMLdata{fdf:\XMLop{name}}{\XMLop{value}}}
+
+\def\flushFDFfield #1{\flushXMLelement {fdf:#1}}
+\def\processFDFfield#1{\processXMLelement{fdf:#1}}
+
+\def\loadFDFfile#1%
+ {\bgroup
+ \autoXMLnamespace[fdf]%
+ \processXMLfilegrouped{#1}%
+ \egroup}
+
+\endinput
diff --git a/tex/context/base/x-fig-00.tex b/tex/context/base/x-fig-00.tex
index 657cb56fa..e83584392 100644
--- a/tex/context/base/x-fig-00.tex
+++ b/tex/context/base/x-fig-00.tex
@@ -47,7 +47,6 @@
%D <comment>When will we talk about European cows?</comment>
%D </figure>
%D
-%D
%D </figurelibrary>
%D \stoptypen
%D
@@ -87,7 +86,7 @@
\unprotect
-\startXMLnamespace [-] [figbase]
+\startXMLmapping [-] [figbase]
\defineXMLprocess [figurelibrary]
\defineXMLignore [description]
@@ -99,7 +98,7 @@
\defineXMLpush [dummy]
\defineXMLenvironment [figure] \figbase@StartFigure \figbase@StopFigure
-\stopXMLnamespace
+\stopXMLmapping
\newcounter\figurefilepage
@@ -114,7 +113,8 @@
\def\getfigurefilename#1#2%
{\startnointerference
- \startXMLnamespace[-][figbase]
+ \traceXMLelementsfalse
+ \startXMLmapping[-][figbase]
\resetfigurefilebase
\XMLerase{file}
\XMLerase{dummy}
@@ -123,7 +123,7 @@
\doglobal\newcounter\figurefilepage
\def\askedlabel{#2}
\processXMLfilegrouped{#1.xml} % grouped ?
- \stopXMLnamespace
+ \stopXMLmapping
\stopnointerference}
\def\resetfigurefilebase%
@@ -156,7 +156,7 @@
\def\usefigurebase[#1]%
{\doifelse{#1}{\v!reset}
{\let\figurebaselist\empty}
- {\appendtocommalist{#1}\figurebaselist}}
+ {\addtocommalist{#1}\figurebaselist}}
\let\figurebaselist\empty
diff --git a/tex/context/base/x-fig-01.tex b/tex/context/base/x-fig-01.tex
index ece20f7b1..f4900fc4e 100644
--- a/tex/context/base/x-fig-01.tex
+++ b/tex/context/base/x-fig-01.tex
@@ -13,7 +13,7 @@
%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 {\inputfilename} (\TEXEXEC\ will set this
+%D named \type {\jobfilename} (\TEXEXEC\ will set this
%D variable). You can apply this style to a database by
%D saying:
%D
@@ -51,19 +51,20 @@
\usemodule[fig-00]
-\overcomePDFspacefalse
+\setupoutput[pdftex] \overcomePDFspacefalse
-\doifnothing {\inputfilename} {\end}
-\doiffileelse {\inputfilename.xml} {} {\end}
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xml} {} {\end}
-\def\StartDescription%
+
+\def\StartDescription
{\bgroup
\defineXMLpush[organization]
\defineXMLpush[project]
\defineXMLpush[product]
\defineXMLpush[comment]}
-\def\StopDescription%
+\def\StopDescription
{\subject [begin] {Figure collection}
\starttabulate[|lBe|p|]
\doifXMLdataelse{organization}
@@ -78,10 +79,10 @@
\blank[2*big]
\egroup}
-\def\StartFigureA%
+\def\StartFigureA
{\bgroup
- \XMLassign{file}{buffer}
\defineXMLpush[file]
+ \XMLassign{file}{buffer}
\defineXMLpush[dummy]
\defineXMLpush[label]
\defineXMLpush[copyright]
@@ -101,7 +102,7 @@
{\bf \XMLpop{dummy}}
\stopbuffer
-\def\StopFigureA%
+\def\StopFigureA
{\doglobal\increment\CurrentPage
\setupbackgrounds[page][background=page]
\doifelsenothing{\XMLpop{label}}
@@ -113,7 +114,7 @@
\setupbackgrounds[page][background=]
\egroup}
-\def\StartFigureB%
+\def\StartFigureB
{\StartFigureA}
\defineregister
@@ -167,7 +168,7 @@
rulethickness=1pt,
framecolor=darkred]
-\def\StopFigureB%
+\def\StopFigureB
{\par
\doglobal\increment\CurrentPage
\doifelsenothing{\XMLpop{label}}
@@ -244,10 +245,10 @@
\vskip10pt
\egroup}
-\def\StartFigureC%
+\def\StartFigureC
{\StartFigureA}
-\def\StopFigureC%
+\def\StopFigureC
{\doglobal\increment\NumberOfFigures
\egroup}
@@ -319,7 +320,7 @@
\doglobal\newcounter\CurrentPage
-\processXMLfilegrouped{\inputfilename.xml}
+\processXMLfilegrouped{\jobfilename.xml}
\increment\NumberOfFigures
@@ -333,7 +334,7 @@
\doglobal\newcounter\CurrentPage
-\processXMLfilegrouped{\inputfilename.xml}
+\processXMLfilegrouped{\jobfilename.xml}
\setuppapersize
[S6][S6]
@@ -350,7 +351,7 @@
\doglobal\newcounter\CurrentPage
-\processXMLfilegrouped{\inputfilename.xml} \page
+\processXMLfilegrouped{\jobfilename.xml} \page
\subject [list] {List of figures}
diff --git a/tex/context/base/x-fig-02.tex b/tex/context/base/x-fig-02.tex
index 13e601819..1bdfc2f11 100644
--- a/tex/context/base/x-fig-02.tex
+++ b/tex/context/base/x-fig-02.tex
@@ -34,15 +34,15 @@
\usemodule[fig-00]
-\doifnothing {\inputfilename} {\end}
-\doiffileelse {\inputfilename.xml} {} {\end}
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xml} {} {\end}
\defineXMLenvironment [figurelibrary] \StartLibrary \StopLibrary
\defineXMLignore [description]
\defineXMLenvironment [figure] \StartFigure \StopFigure
\def\StartLibrary
- {\immediate\openout \scratchwrite=\inputfilename.fig
+ {\immediate\openout \scratchwrite=\jobfilename.fig
\immediate\write\scratchwrite{\string\input\space x-fig-03.tex \string\relax}
\immediate\write\scratchwrite{}}
@@ -64,13 +64,13 @@
\immediate\write\scratchwrite
{\string\setfiguredata\space
{\XMLpop{label}}
- {\inputfilename}
+ {\jobfilename}
{\CurrentPage}}}
\doglobal\newcounter\CurrentPage
\starttext
-\processXMLfilegrouped{\inputfilename.xml}
+\processXMLfilegrouped{\jobfilename.xml}
\stoptext
diff --git a/tex/context/base/m-mathml.tex b/tex/context/base/x-mathml.tex
index f9caf56d3..5c36c35fb 100644
--- a/tex/context/base/m-mathml.tex
+++ b/tex/context/base/x-mathml.tex
@@ -27,16 +27,18 @@
%D For simple inline math, we first provide:
-% todo : nesting ! ! ! !
+\newcount\xmlmathlevel % todo : nesting ! ! ! !
-\newcount\xmlmathlevel
+\defineXMLenvironment [m] \startXMLinlinemath \stopXMLinlinemath
-\defineXMLenvironment [m]
+\def\startXMLinlinemath
{\ifmmode
\advance\xmlmathlevel1\relax
\else
\xmlmathlevel1$%
\fi}
+
+\def\stopXMLinlinemath
{\ifcase\xmlmathlevel\or
$\xmlmathlevel0\relax
\else
diff --git a/tex/context/base/x-physml.tex b/tex/context/base/x-physml.tex
new file mode 100644
index 000000000..0b9799a34
--- /dev/null
+++ b/tex/context/base/x-physml.tex
@@ -0,0 +1,16 @@
+%D \module
+%D [ file=m-physml,
+%D version=2001.09.04,
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=Loading \PHYSML\ Filters,
+%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.
+
+\usemodule[units] \useXMLfilter[pml,pmu]
+
+\endinput
diff --git a/tex/context/base/x-sch-00.tex b/tex/context/base/x-sch-00.tex
new file mode 100644
index 000000000..97b266d5e
--- /dev/null
+++ b/tex/context/base/x-sch-00.tex
@@ -0,0 +1,382 @@
+%D \module
+%D [ file=x-sch-00,
+%D version=2001.10.02,
+%D title=\CONTEXT\ Style File,
+%D subtitle=XML Schema Basics,
+%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 Schema support was implemented right after euro\TeX\ 2001,
+%D when Tobias Burnus send me a schema for the XML figure
+%D base. Since it happened that I needed schemata for other
+%D projects too, I wrote this mapper. Thanks to Tobias for
+%D testing it.
+
+\newcounter\XSDprefix
+\newif\ifXDScomposite
+
+\definelist [xsd:names]
+\defineregister [xsd:index] [xsd:indices]
+
+\setuplist [xsd:names] [expansion=yes]
+\setupregister [xsd:index] [expansion=yes]
+
+\def\dodoXSDkeyval#1#2#3%
+ {\framed
+ [width=\hsize,background=color,backgroundcolor=xsd:0,
+ framecolor=xsd:0,frame=off,align=right]
+ {\hbox to 5em % %to 8em % .2\hsize
+ {\bf
+ %\doifsomething{#1}{#1 }
+ \ignorespaces#2\unskip\hss}
+ %\ignorespaces#2\unskip:}%
+ \space
+ \ignorespaces#3\unskip}}
+
+\def\doXSDkeyval#1#2#3#4%
+ {\bgroup
+ \edef\XSDtemp{\XMLpar{#3}{#4}{}}%
+ \doifsomething{\XSDtemp}
+ {\def\doXSDtemp{\dodoXSDkeyval{#1}{#2}{\XSDtemp}}%
+ \def\doXSDtype{\dodoXSDkeyval{#1}{#2}{\XMLtyp{#3}{#4}{}}}%
+ \setupinteraction[color=,contrastcolor=,style=]%
+ \processaction
+ [#4]
+ [ value=>\doXSDtype,
+ name=>{\writetolist[xsd:names]{}{\XSDtemp}%
+ \writetoregister[xsd:index]{\XSDtemp}%
+ \ifXDScomposite \else
+ \pagereference[xsd:\XSDprefix:\XSDtemp]%
+ \fi
+ \doXSDtemp},
+ type=>{\doifinstringelse{xsd:}{\XSDtemp}
+ {\doXSDtemp}
+ {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}},
+ ref=>{\doifinstringelse{xsd:}{\XSDtemp}
+ {\doXSDtemp}
+ {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}},
+ unknown=>\doXSDtemp]}%
+ \endgraf
+ \egroup}
+
+\def\doXSDkeyvals#1#2#3%
+ {\def\docommando##1{\doXSDkeyval{#1}{##1}{#2}{##1}}%
+ \processcommalist[#3]\docommando}
+
+\def\dodoXSDbanner#1%
+ {\framed
+ [width=\hsize,framecolor=xsd:0,frame=off,
+ background=color,backgroundcolor=xsd:0]
+ {\ignorespaces#1\unskip}}
+
+\def\doXSDtitle#1#2#3%
+ {\edef\XSDtemp{\XMLpar{#2}{#3}{}}%
+ \dodoXSDbanner
+ {{\bf\ignorespaces#1\unskip}%
+ \doifsomething{\XSDtemp}
+ {:\space\ignorespaces\XSDtemp\unskip
+ \pagereference[xsd:\XSDprefix:\XSDtemp]}}}
+
+\def\doXSDbanner#1%
+ {\dodoXSDbanner{\bf#1}}
+
+%D We use colored backgrounds for meaningful blocks.
+
+\definecolor [xsd:0] [white]
+
+\definecolor [xsd:1] [s=.30]
+\definecolor [xsd:2] [s=.55]
+\definecolor [xsd:3] [s=.70]
+\definecolor [xsd:4] [s=.85]
+
+\definecolor [xsd:5] [r=.6,g=.7,b=.8]
+\definecolor [xsd:6] [r=.7,g=.8,b=.6]
+\definecolor [xsd:7] [r=1,g=1,b=.6]
+\definecolor [xsd:8] [r=.8,g=.7,b=.6]
+
+\defineframedtext [XSDannotation] [backgroundcolor=xsd:0]
+
+\defineframedtext [XSDelement] [backgroundcolor=xsd:5]
+\defineframedtext [XSDattribute] [backgroundcolor=xsd:6]
+\defineframedtext [XSDsimpleType] [backgroundcolor=xsd:7]
+\defineframedtext [XSDcomplexType] [backgroundcolor=xsd:8]
+
+\defineframedtext [XSDcomplexContent] [backgroundcolor=xsd:1]
+\defineframedtext [XSDsimpleContent] [backgroundcolor=xsd:1]
+\defineframedtext [XSDattributeGroup] [backgroundcolor=xsd:1]
+
+\defineframedtext [XSDcapsule] [backgroundcolor=xsd:2]
+\defineframedtext [XSDsequence] [backgroundcolor=xsd:3]
+
+\def\XDSstructures% handy for external settings
+ {XSDannotation,
+ XSDcomplexType,XSDsimpleType,XSDelement,XSDattribute,
+ XSDcomplexContent,XSDsimpleContent,XSDattributeGroup,
+ XSDcapsule,XSDsequence}
+
+\setupframedtexts
+ [\XDSstructures]
+ [width=\hsize,
+ offset=.5\bodyfontsize,
+ location=none,
+ background=color,
+ framecolor=xsd:0,
+ before=\ifinframed\else\blank\fi,
+ after=\ifinframed\else\blank\fi,
+ depthcorrection=off,
+ rulethickness=1pt,
+ strut=no]
+
+\definesymbol[xsd][{\blackrule[width=4em]}]
+
+\def\placeXSDlegenda
+ {\startbaselinecorrection
+ \starttabulate[|l|l|]
+ \HL
+ \NC \bf color \NC \bf meaning \NC \NR
+ \HL
+ \NC \color[xsd:1]{\symbol[xsd]} \NC complexContent \unskip\quad
+ simpleContent \unskip\quad
+ attributeGroup \NC \NR
+ \NC \color[xsd:2]{\symbol[xsd]} \NC capsule \NC \NR
+ \NC \color[xsd:3]{\symbol[xsd]} \NC sequence \NC \NR
+ \HL
+ \NC \color[xsd:5]{\symbol[xsd]} \NC element \NC \NR
+ \NC \color[xsd:6]{\symbol[xsd]} \NC attribute \NC \NR
+ \NC \color[xsd:7]{\symbol[xsd]} \NC simpleType \NC \NR
+ \NC \color[xsd:8]{\symbol[xsd]} \NC complexType \NC \NR
+ \HL
+ \stoptabulate
+ \stopbaselinecorrection}
+
+\defineXMLenvironment [xsd:all] [id=]
+ {\startXSDcapsule
+ \doXSDbanner{all}
+ \doXSDkeyvals{all}{xsd:all}{id}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:annotation]
+ {\startXSDcapsule
+ \doXSDbanner{annotation}
+ \startXSDannotation}
+ {\stopXSDannotation
+ \stopXSDcapsule}
+
+\defineXMLignore [xsd:appInfo]
+
+\defineXMLenvironment [xsd:attribute]
+ [id=,name=,ref=,type=,form=,use=,value=]
+ {\startXSDattribute
+ \doifelsenothing{\XMLpar{xsd:attribute}{ref}{}}
+ {\doXSDkeyvals{attribute}{xsd:attribute}{name,type}}
+ {\doXSDkeyvals{attribute}{xsd:attribute}{ref}}
+ \doXSDkeyvals{attribute}{xsd:attribute}{id,form,use,value}
+ \XDScompositetrue}
+ {\stopXSDattribute}
+
+\defineXMLenvironment [xsd:attributeGroup] [id=,name=,ref=]
+ {\startXSDattributeGroup
+ \doXSDtitle{attribute group}{xsd:attributeGroup}{name}
+ \doXSDkeyvals{attr group}{xsd:attributeGroup}{id,name,ref}
+ \XDScompositetrue}
+ {\stopXSDattributeGroup}
+
+\defineXMLenvironment [xsd:choice] [id=,minOccurs=,maxOccurs=]
+ {\startXSDcapsule
+ \doXSDbanner{choice}
+ \doXSDkeyvals{choice}{xsd:choice}{id,minOccurs,maxOccurs}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:complexContent] [id=,mixed=]
+ {\startXSDcomplexContent
+ \doXSDkeyvals{complex content}{xsd:complexContent}{id,mixed}
+ \XDScompositetrue}
+ {\stopXSDcomplexContent}
+
+\defineXMLenvironment [xsd:complexType]
+ [id=,abstract=,block=,final=,mixed=,name=]
+ {\startXSDcomplexType
+ \doXSDtitle{complex type}{xsd:complexType}{name}
+ \doXSDkeyvals{complex type}{xsd:complexType}{id,abstract,block,final,mixed}
+ \XDScompositetrue}
+ {\stopXSDcomplexType}
+
+\defineXMLenvironment [xsd:documentation] [source=,xml:lang=]
+ {\endgraf\bgroup\setupwhitespace[big]}
+ {\endgraf\egroup}
+
+\defineXMLenvironment [xsd:element]
+ [name=,type=,ref=,
+ abstract=,block=,default=,final=,fixed=,form=,id=,
+ minOccurs=,maxOccurs=,nullable=,substitutionGroup=]
+ {\startXSDelement
+ \doifelsenothing{\XMLpar{xsd:element}{ref}{}}
+ {\doXSDkeyvals{element}{xsd:element}{name,type}}
+ {\doXSDkeyvals{element}{xsd:element}{ref}}
+ \doXSDkeyvals{element}{xsd:element}
+ {id,abstract,block,default,final,fixed,form,
+ minOccurs,maxOccurs,nullable,substitutionGroup}
+ \XDScompositetrue}
+ {\stopXSDelement}
+
+\defineXMLenvironment [xsd:extension] [id=,base=]
+ {\startXSDcapsule
+ \doXSDbanner{extension}
+ \doXSDkeyvals{extension}{xsd:extension}{id,base}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:group]
+ [id=,name=,ref=,minOccurs=,maxOccurs=]
+ {\startXSDcapsule
+ \doXSDbanner{group}
+ \doXSDkeyvals{group}{xsd:group}{id,name,ref,minOccurs,maxOccurs}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:key] [id=,name=]
+ {\startXSDcapsule
+ \doXSDbanner{key}
+ \doXSDkeyvals{key}{xsd:key}{id,name}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:keyref] [id=,name=,refer=]
+ {\startXSDcapsule
+ \doXSDbanner{keyref}
+ \doXSDkeyvals{key ref}{xsd:keyref}{id,name,refer}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:list] [id=,itemType=]
+ {\startXSDcapsule
+ \doXSDbanner{list}
+ \doXSDkeyvals{list}{xsd:list}{id,itemType}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:redefine] [schemaLocation=]
+ {\startXSDcapsule
+ \doXSDbanner{redefine}
+ \doXSDkeyvals{redefine}{xsd:redefine}{schemaLocation}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:restriction] [id=,base=]
+ {\startXSDcapsule
+ \doXSDbanner{restriction}
+ \doXSDkeyvals{restriction}{xsd:restriction}{id,base}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:schema]
+ [attributeFormDefault=,blockDefault=,elementFormDefault=,
+ finalDefault=,id=,targetNamespace=,version=]
+ {\startXSDcapsule
+ \doglobal\increment\XSDprefix
+ \doXSDbanner{schema}
+ \doXSDkeyvals{schema}{xsd:schema}
+ {attributeFormDefault,blockDefault,elementFormDefault,
+ finalDefault,id,targetNamespace,version}
+ \stopXSDcapsule}
+ {}
+
+\defineXMLenvironment [xsd:sequence] [id=,minOccurs=,maxOccurs=]
+ {\startXSDsequence
+ \doXSDbanner{sequence}
+ \doXSDkeyvals{sequence}{xsd:sequence}{id,minOccurs,maxOccurs}
+ \XDScompositetrue}
+ {\stopXSDsequence}
+
+\defineXMLenvironment [xsd:simpleContent] [id=]
+ {\startXSDsimpleContent
+ \doXSDkeyvals{simple content}{xsd:simpleContent}{id}
+ \XDScompositetrue}
+ {\stopXSDsimpleContent}
+
+\defineXMLenvironment [xsd:simpleType] [id=,name=]
+ {\startXSDsimpleType
+ \doXSDtitle{simple type}{xsd:simpleType}{name}
+ \doXSDkeyvals{simple type}{xsd:simpleType}{id}
+ \XDScompositetrue}
+ {\stopXSDsimpleType}
+
+\defineXMLenvironment [xsd:union] [id=,memberTypes=]
+ {\startXSDcapsule
+ \doXSDbanner{union}
+ \doXSDkeyvals{union}{xsd:union}{id,memberTypes}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\defineXMLenvironment [xsd:unique] [id=,name=]
+ {\startXSDcapsule
+ \doXSDbanner{unique}
+ \doXSDkeyvals{unique}{xsd:unique}{id,name}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+
+\def\defineXSDfacet
+ {\dotripleempty\dodefineXSDfacet}
+
+\def\dodefineXSDfacet[#1][#2][#3]%
+ {\defineXMLenvironment[xsd:#1][#2]
+ {\startXSDcapsule
+ \doXSDkeyvals{#1}{xsd:#1}{#3}
+ \XDScompositetrue}
+ {\stopXSDcapsule}
+ \defineXMLsingular[xsd:#1][#2]
+ {\doXSDkeyvals{#1}{xsd:#1}{#3}}}
+
+\defineXSDfacet [duration] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [encoding] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [enumeration] [id=,value=,fixed=] [id,value,fixed]
+
+\defineXSDfacet [length] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [minLength] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [maxLength] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [minInclusive] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [maxInclusive] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [minExclusive] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [maxExclusive] [id=,value=,fixed=] [id,value,fixed]
+
+\defineXSDfacet [pattern] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [period] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [precision] [id=,value=,fixed=] [id,value,fixed]
+\defineXSDfacet [scale] [id=,value=,fixed=] [id,value,fixed]
+
+\defineXSDfacet [field] [id=,xpath=] [id,xpath]
+\defineXSDfacet [selector] [id=,xpath=] [id,xpath]
+
+\defineXSDfacet
+ [any]
+ [id=,namespace=,minOccurs=,maxOccurs=,processContents=]
+ [id,namespace,minOccurs,maxOccurs,processContent]
+
+\defineXSDfacet
+ [anyAttribute]
+ [id=,namespace=,processContents=]
+ [id,namespace,processContents]
+
+\defineXSDfacet
+ [import]
+ [id=,namespace=,schemaLocation=]
+ [id,namespace,schemaLocation]
+
+\defineXSDfacet
+ [include]
+ [id=,schemaLocation=]
+ [id,schemaLocation]
+
+\defineXSDfacet
+ [notation]
+ [id=,name=,public=,system=]
+ [id,name,public,system]
+
+\endinput
diff --git a/tex/context/base/x-sch-01.tex b/tex/context/base/x-sch-01.tex
new file mode 100644
index 000000000..f704f8e73
--- /dev/null
+++ b/tex/context/base/x-sch-01.tex
@@ -0,0 +1,122 @@
+%D \module
+%D [ file=x-sch-01,
+%D version=2001.10.04,
+%D title=\CONTEXT\ Style File,
+%D subtitle=XML Schema Presentation,
+%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 style wraps around the core schema visualizer,
+%D implemented in \type {x-sch-00}. This is an experimental
+%D style, more will follow.
+%D
+%D \starttypen
+%D texexec --use=sch-01 x-fig-00.xsd --pdf
+%D \stoptypen
+
+\doifnothing {\jobfilename} {\end}
+\doiffileelse {\jobfilename.xsd} {} {\end}
+
+\usemodule[sch-00,con-01]
+
+\remapXMLnamespace [xs] [xsd]
+
+\setuplayout
+ [backspace=1.5cm,
+ topspace=1.5cm,
+ bottomspace=1cm,
+ width=middle,
+ height=middle,
+ header=1.5cm,
+ footer=1.5cm]
+
+\setupcolors
+ [state=start]
+
+\setupbackgrounds
+ [page]
+ [background=goback]
+
+\setupbackgrounds
+ [text]
+ [background=gonext]
+
+\defineoverlay
+ [goback]
+ [\overlaybutton{PreviousJump}]
+
+\defineoverlay
+ [gonext]
+ [\overlaybutton{nextpage}]
+
+\setuppagenumbering
+ [location=footer]
+
+\usetypescript
+ [palatino]
+ [texnansi]
+
+\setupbodyfont
+ [palatino,10pt]
+
+%\setupinteraction
+% [state=start,
+% color=,
+% contrastcolor=,
+% style=]
+
+\setuplist
+ [xsd:names]
+ [interaction=all,
+ width=0pt,
+ alternative=c]
+
+\setupregister
+ [xsd:index]
+ [interaction=text,
+ symbol=none]
+
+\setuphead
+ [chapter]
+ [style=\bfd,
+ header=high]
+
+\setuphead
+ [section]
+ [style=\bfb]
+
+\lowercasestring \jobfilename \to \lcjobfilename
+
+\setupheadertexts
+ [\lcjobfilename]
+
+\starttext
+
+\title{Schema \quote{\lcjobfilename.xsd}}
+
+\subject{Names in order of definition}
+
+\startcolumns[n=3]
+ \placelist[xsd:names][criterium=current]
+\stopcolumns
+
+\subject{Names in alphabetic order}
+
+\startcolumns[n=3]
+ \placeregister[xsd:index][criterium=current]
+\stopcolumns
+
+\subject{Meaning of background colors}
+
+\placeXSDlegenda
+
+\subject{Schema components}
+
+\processXMLfilegrouped{\jobfilename.xsd}
+
+\stoptext
diff --git a/tex/context/base/x-xml-01.tex b/tex/context/base/x-xml-01.tex
new file mode 100644
index 000000000..6a1601f27
--- /dev/null
+++ b/tex/context/base/x-xml-01.tex
@@ -0,0 +1,80 @@
+% output=pdftex modes=packed
+
+%D \module
+%D [ file=x-xml-01,
+%D version=2001.10.10,
+%D title=\CONTEXT\ XML Style File,
+%D subtitle=Formatting X?? files,
+%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.
+
+% texexec --use=xml-format yourfile.x** [--mode=packed,wide]
+%
+% pdftotext yourfile.pdf yournewfile.x**
+
+\doifnothing {\inputfilename} {\end}
+\doiffileelse {\inputfilename} {} {\end}
+
+% makes pdftotext to too slow
+%
+% \definepapersize
+% [mine]
+% [height=.99\maxdimen,
+% width=200cm]
+%
+% \setuppapersize
+% [mine]
+% [mine]
+%
+% \setupbodyfont
+% [0.4pt,tt]
+%
+% this is faster
+%
+% \setuppapersize
+% [A0][A0]
+%
+% but normal A4 combined with 1 pt font size is the best
+
+% too many messages
+%
+% \setupbodyfont
+% [1pt,tt]
+%
+% so:
+
+\definedfont [Mono at 1pt]
+
+\setuplayout
+ [backspace=0cm,
+ topspace=0cm,
+ width=40em,
+ height=middle,
+ header=0cm,
+ footer=0cm]
+
+\setupXMLfile
+ [level=2]
+
+\startmode[wide]
+
+ \setuplayout[width=250cm]
+
+\stopmode
+
+\startmode[packed]
+
+ \setupXMLfile[inbetween=]
+
+\stopmode
+
+\starttext
+
+\dontcomplain \showXMLfile{\inputfilename}
+
+\stoptext
diff --git a/tex/context/base/x-xml-02.tex b/tex/context/base/x-xml-02.tex
new file mode 100644
index 000000000..df56baa36
--- /dev/null
+++ b/tex/context/base/x-xml-02.tex
@@ -0,0 +1,67 @@
+% output=pdftex modes=letter
+
+%D \module
+%D [ file=x-xml-02,
+%D version=2001.10.10,
+%D title=\CONTEXT\ XML Style File,
+%D subtitle=Pretty Printing,
+%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.
+
+% texexec --use=xml-pretty yourfile.x** [--mode=letter]
+
+\doifnothing {\inputfilename} {\end}
+\doiffileelse {\inputfilename} {} {\end}
+
+\startmode[letter]
+ \setuppapersize[letter][letter]
+\stopmode
+
+\setuplayout
+ [backspace=1.5cm,
+ topspace=1.5cm,
+ bottomspace=1cm,
+ width=middle,
+ height=middle,
+ header=1.5cm,
+ footer=1.5cm]
+
+\setupcolors
+ [state=local]
+
+\setuppagenumbering
+ [location=]
+
+\setuplayout
+ [style=type]
+
+\setupbodyfont
+ [10pt]
+
+\setuptolerance
+ [verytolerant]
+
+\setupalign
+ [right]
+
+\lowercasestring \inputfilename \to \lcinputfilename
+
+\setupheadertexts
+ [\lcinputfilename]
+
+\setupfootertexts
+ [\currentdate\space\string| \currenttime\space \string| \pagenumber]
+
+\setupXMLfile
+ [level=2]
+
+\starttext
+
+\showXMLfile{\inputfilename}
+
+\stoptext
diff --git a/tex/context/base/xtag-cml.tex b/tex/context/base/xtag-cml.tex
new file mode 100644
index 000000000..01e137f8a
--- /dev/null
+++ b/tex/context/base/xtag-cml.tex
@@ -0,0 +1,222 @@
+% see mathml, == \defineXMLdirective [mathml] \setupMMLappearance
+
+\unprotect
+
+\def\setupCMLappearance[#1]{\dodoubleargument\getparameters[@@CML#1]}
+
+\defineXMLdirective [chemml] \setupCMLappearance
+
+\defineXMLargument [chem] \doXMLchem
+\defineXMLargument [ichem] \doXMLichem
+\defineXMLargument [dchem] \doXMLdchem
+
+\unexpanded\def\doXMLchem {\ifhmode\@EA\doXMLichem\else\@EA\doXMLdchem\fi}
+\unexpanded\def\doXMLichem{\XMLremapdata[cml]{$\rm}{$}}
+\unexpanded\def\doXMLdchem{\XMLremapdata[cml]{\dostartformula{}\rm}{\dostopformula}}
+
+\startXMLmapping [cml]
+
+\remapXMLsequence [molecule] [CPA] \doCMLmolecule
+\remapXMLsequence [ion] [CPA] \doCMLion
+\remapXMLsequence [atom] [CPA] \doCMLatom
+
+\setupCMLappearance [ion] [\c!variant=\v!a]
+
+\let\CMLtopcaption\empty
+\let\CMLbotcaption\empty
+
+\def\someCMLtext#1%
+ {\ifx\CMLtopcaption\empty
+ \setbox0\null
+ \else
+ \setbox0\hbox{\txx\setstrut\strut\ignorespaces\CMLtopcaption\unskip}%
+ \fi
+ \setbox2\hbox{\ignorespaces\strut#1\unskip}%
+ \ifx\CMLbotcaption\empty
+ \setbox4\null
+ \else
+ \setbox4\hbox{\txx\setstrut\strut\ignorespaces\CMLbotcaption\unskip}%
+ \fi
+ \scratchdimen=\wd2\advance\scratchdimen-.5em
+ \ifdim\wd0>\scratchdimen
+ \setbox0\hbox spread .5em{\hss\box0\hss}%
+ \fi
+ \ifdim\wd4>\scratchdimen
+ \setbox4\hbox spread .5em{\hss\box4\hss}%
+ \fi
+ \setbox6=\vbox
+ {\offinterlineskip\halign{\hss##\hss\cr\copy0\cr\copy2\cr\copy4\cr}}%
+ \hbox{\lower\ht4\hbox{\lower\dp2\box6}}}
+
+\def\CMLscript#1%
+ {$\scriptscriptstyle\ignorespaces#1\unskip$}
+
+\def\doifnotXMLzero#1#2#3%
+ {\ifcase\XMLpar{#1}{#2}{0}\else#3{\XMLpar{#1}{#2}{0}}\fi}
+
+\newcounter\currentCMLatom
+\newcounter\nofCMLatoms
+
+\def\doCMLmolecule#1#2%
+ {\resetCMLcaption
+ \processXMLRchild{caption}{#2}%
+ \someCMLtext
+ {\bgroup
+ \newcounter\currentCMLatom
+ \newcounter\nofCMLatoms
+ \getXMLarguments{cml-m}{n="0" #1}%
+ \doifnotXMLzero{cml-m}{n}\firstofoneargument
+ \ignorespaces\processXMLRchild{atom,ion,bond/,%
+ singlebond/,doublebond/,triplebond/}{#2}\unskip
+ \egroup}%
+ \ignorespaces}
+
+\def\doCMLion#1#2%
+ {\resetCMLcaption
+ \processXMLRchild{caption}{#2}%
+ \someCMLtext
+ {\bgroup
+ \newcounter\currentCMLatom
+ \newcounter\nofCMLatoms
+ \getXMLarguments{cml-i}{n="0" charge="0" #1}%
+ \doifnotXMLzero{cml-i}{n}\firstofoneargument
+ \doifelse{\@@CMLionvariant}{\v!b}
+ {[\ignorespaces\processXMLRchild{atom,bond/,%
+ singlebond/,doublebond/,triplebond/}{#2}\unskip]%
+ \high{\doifnotXMLzero{cml-i}{charge}\CMLscript}}
+ {\countXMLRchild{atom}{\ignorespaces#2\unskip}%
+ \let\nofCMLatoms\nofXMLRchildren
+ \ignorespaces\processXMLRchild{atom,bond/,%
+ singlebond/,doublebond/,triplebond/}{#2}\unskip}%
+ \egroup}%
+ \ignorespaces}
+
+\def\doCMLatom#1#2%
+ {\getXMLarguments{cml-a}{n="0" weight="0" protons="0" charge="0" #1}%
+ \increment\currentCMLatom
+ \resetCMLcaption
+ %\processXMLRchild{caption}{#2}% not here
+ \someCMLtext
+ {\bgroup
+ \lohi
+ {\doifnotXMLzero{cml-a}{protons}\CMLscript}
+ {\doifnotXMLzero{cml-a}{weight}\CMLscript}%
+ \ignorespaces#2\unskip
+ \lohi
+ {\doifnotXMLzero{cml-a}{n}\CMLscript}
+ {\ifnum\nofCMLatoms=\currentCMLatom\relax
+ \doifnotXMLzero{cml-i}{charge}\CMLscript
+ \else
+ \doifnotXMLzero{cml-a}{charge}\CMLscript
+ \fi}%
+ \egroup}%
+ \ignorespaces}
+
+\remapXMLsequence [reaction] [CPA] \doCMLreaction
+
+\let\someCMLsymbol\gobbleoneargument
+\let\someCMLarrow \gobblethreearguments
+
+\def\doCMLreaction#1#2%
+ {\begingroup
+ \let\someCMLsymbol\dosomeCMLsymbol
+ \let\someCMLarrow \dosomeCMLarrow
+ #2%
+ \endgroup}
+
+\remapXMLsequence [plus] [CPA] \doCMLplus
+\remapXMLsingular [plus] [CPA] \doCMLplus
+\remapXMLsequence [minus] [CPA] \doCMLminus
+\remapXMLsingular [minus] [CPA] \doCMLminus
+\remapXMLsequence [equal] [CPA] \doCMLequal
+\remapXMLsingular [equal] [CPA] \doCMLequal
+
+\def\doCMLplus #1#2{\someCMLsymbol{+}}
+\def\doCMLminus#1#2{\someCMLsymbol{-}}
+\def\doCMLequal#1#2{\someCMLsymbol{=}}
+
+\def\dosomeCMLsymbol#1%
+ {\quad\mathop{#1}\quad}
+
+\remapXMLsequence [gives] [CPA] \doCMLgives
+\remapXMLsingular [gives] [CPA] \doCMLgives
+\remapXMLsequence [equilibrium] [CPA] \doCMLequilibrium
+\remapXMLsingular [equilibrium] [CPA] \doCMLequilibrium
+\remapXMLsequence [mesomeric] [CPA] \doCMLmesomeric
+\remapXMLsingular [mesomeric] [CPA] \doCMLmesomeric
+
+\def\doCMLgives #1#2{\resetCMLcaption#2\someCMLgives }
+\def\doCMLequilibrium#1#2{\resetCMLcaption#2\someCMLequilibrium}
+\def\doCMLmesomeric #1#2{\resetCMLcaption#2\someCMLmesomeric }
+
+\def\dosomeCMLarrow#1%
+ {\quad
+ \someCMLtext
+ {$\vcenter{\offinterlineskip\halign{##\cr\hskip3em\cr#1\cr}}$}%
+ \quad}
+
+\def\someCMLgives
+ {\someCMLarrow{\rightarrowfill}}
+
+\def\someCMLequilibrium
+ {\someCMLarrow{\rightarrowfill\cr\noalign{\nointerlineskip}\leftarrowfill}}
+
+\def\someCMLmesomeric
+ {\someCMLarrow{$\leftarrow\hskip-1em$\rightarrowfill}}
+
+\remapXMLsequence [cml] [caption] [CPA] \doCMLcaption
+
+\let\CMLtopcaption\empty
+\let\CMLbotcaption\empty
+
+\def\dodoCMLcaption#1#2%
+ {\def\CMLbotcaption{#2}%
+ \def\doCMLcaption##1##2%
+ {\def\CMLtopcaption{##2}%
+ \let\doCMLcaption\gobbletwoarguments}}
+
+\def\resetCMLcaption%
+ {\let\CMLtopcaption\empty
+ \let\CMLbotcaption\empty
+ \let\doCMLcaption\dodoCMLcaption}
+
+\resetCMLcaption
+
+\remapXMLsingular [bond] [CPA] \doCMLbond
+\remapXMLsingular [singlebond] [CPA] \doCMLsinglebond
+\remapXMLsingular [doublebond] [CPA] \doCMLdoublebond
+\remapXMLsingular [triplebond] [CPA] \doCMLtriplebond
+
+\def\doCMLbond#1#2%
+ {\getXMLarguments{cml-b}{n="0" #1}%
+ \ifcase\XMLpar{cml-b}{n}{0}\relax
+ \doCMLsinglebond
+ \or
+ \doCMLdoublebond
+ \or
+ \doCMLtriplebond
+ \fi}
+
+\def\someCMLbond%
+ {\hrule \!!width \hsize \!!height .1ex} % .4pt
+
+\def\dosomeCMLbond#1#2#3%
+ {{\setbox\scratchbox=\hbox{$M$}%
+ \vbox to \ht\scratchbox
+ {\hsize\wd\scratchbox
+ \vskip.1\wd\scratchbox
+ #1\vfill#2\vfill#3%
+ \vskip.1\wd\scratchbox}}}
+
+\def\doCMLsinglebond%
+ {\dosomeCMLbond\relax\someCMLbond\relax}
+
+\def\doCMLdoublebond%
+ {\dosomeCMLbond\someCMLbond\relax\someCMLbond}
+
+\def\doCMLtriplebond%
+ {\dosomeCMLbond\someCMLbond\someCMLbond\someCMLbond}
+
+\stopXMLmapping
+
+\protect \endinput
diff --git a/tex/context/base/xtag-exp.tex b/tex/context/base/xtag-exp.tex
new file mode 100644
index 000000000..fc51675cb
--- /dev/null
+++ b/tex/context/base/xtag-exp.tex
@@ -0,0 +1,81 @@
+%D \module
+%D [ file=xtag-exp,
+%D version=2001.08.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Expansion Related Things,
+%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.
+
+\beginTEX
+ \writestatus{XML}{sorry, XML is only supported in (pdf)etex}
+ \def\startXMLdefinitions{\gobbleuntil\stopXMLdefinitions}
+ \endinput
+\endTEX
+
+\writestatus{loading}{Context XML Macros (expansion)}
+
+\unprotect
+
+%D Files
+
+\newcounter\XMLfilenesting \let\restoreXMLelements\relax
+
+\def\startXMLreading
+ {\increment \XMLfilenesting \relax
+ \ifnum\XMLfilenesting=1
+ \ifprocessingXML
+ \let\restoreXMLelements\relax
+ \else
+ \let\restoreXMLelements\disableXMLelements
+ \enableXMLelements
+ \fi
+ \fi}
+
+\def\stopXMLreading
+ {\ifnum\XMLfilenesting=1
+ \restoreXMLelements
+ \let\restoreXMLelements\relax
+ \fi
+ \decrement \XMLfilenesting \relax}
+
+\def\enableXMLfiledata
+ {\prependtoks \enableXMLelements \to \mainoutput % brrr, will change
+ \appendtoks \startXMLreading \to \everybeforeutilityread
+ \appendtoks \stopXMLreading \to \everyafterutilityread
+ \appendtoks \forcefileexpansiontrue \to \everyenableXML
+ \let\enableXMLfiledata\relax}
+
+\setupXMLprocessing[\c!status=\v!start]
+
+\appendtoks \enableXMLfiledata \to \aftersetupXMLprocessing
+
+%D Here we overload the mark handler.
+
+\def\XMLexpanded#1%
+ {\bgroup
+ \honorunexpanded
+ \dontexpandencoding
+ \xdef\@@globalexpanded{\noexpand#1}%
+ \egroup
+ \@@globalexpanded}
+
+\let\normalsetnormalmark\setnormalmark
+
+\long\def\setnormalmark#1% overloaded
+ {\ifprocessingXML
+ \expandafter\setXMLexpandedmark
+ \else
+ \expandafter\normalsetnormalmark
+ \fi#1}
+
+\def\setXMLexpandedmark#1#2% using a tok prevents unwanted expansion in mark
+ {\XMLexpanded{\scratchtoks{\enableXMLelements#2}}%
+ \setxvalue{\@@crk\string#1}{\the\scratchtoks}%
+ \normalmarks#1{\the\scratchtoks}}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index 9bf9f89a9..0645cea38 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -21,54 +21,61 @@
\unprotect
%D \macros
-%D {startXMLnamespace}
+%D {startXMLmapping}
%D
%D You can define macros within a namespace, so that they
%D will not conflict (don't confuse this with \XML\
-%D namespaces.
+%D namespaces.)
%D
%D \starttypen
-%D \startXMLnamespace [tag] | [-] [tag] | [+] [tag]
+%D \startXMLmapping [tag] | [-] [tag] | [+] [tag]
%D definitions
-%D \stopXMLnamespace
+%D \stopXMLmapping
%D \stoptypen
%D
-%D When a \type {[+]} is specified, the namespaces will
+%D When a \type {[+]} is specified, the mappings will
%D nest.
\let\normal@@XMLelement\@@XMLelement
-\let\XMLnamespace\empty
-\def\startXMLnamespace%
- {\dodoubleempty\dostartXMLnamespace}
+\def\resetXMLmapping
+ {\let\@@XMLelement\normal@@XMLelement
+ \let\@@XMLmapping\empty}
-\def\dostartXMLnamespace[#1][#2]%
+\resetXMLmapping
+
+\def\startXMLmapping
+ {\dodoubleempty\dostartXMLmapping}
+
+\def\dostartXMLmapping[#1][#2]% sneller maken
{\pushmacro\@@XMLelement
- \pushmacro\@@XMLnamespace
+ \pushmacro\@@XMLmapping
\ifsecondargument
\doifelse{#1}{-}
- {\donostartXMLnamespace{#1}}
+ {\donostartXMLmapping{#2}}
{\doifelse{#1}{+}
- {\dodostartXMLnamespace{#1}{#2}}
- {\donostartXMLnamespace{#1}}}%
+ {\dodostartXMLmapping{#2}}
+ {\donostartXMLmapping{#2}}}%
\else
- \donostartXMLnamespace{#1}%
+ \donostartXMLmapping{#1}%
\fi
\unprotect}
-\def\donostartXMLnamespace#1%
- {\edef\XMLnamespace{#1}%
- \let\@@XMLelement\normal@@XMLelement}
+\def\donostartXMLmapping#1%
+ {\let\@@XMLprevelement\@@XMLelement
+ \edef\@@XMLmapping{#1}%
+ \edef\@@XMLelement{\normal@@XMLelement+#1}}
-\def\dodostartXMLnamespace#1#2%
- {\edef\XMLnamespace{\XMLnamespace:#2}%
- \edef\@@XMLelement{\@@XMLelement:#2}}
+\def\dodostartXMLmapping#1%
+ {\let\@@XMLprevelement\@@XMLelement
+ \edef\@@XMLmapping{\@@XMLmapping+#1}%
+ \edef\@@XMLelement{\@@XMLelement+#1}}
-\def\stopXMLnamespace%
+\def\stopXMLmapping%
{\protect
- \popmacro\@@XMLnamespace
+ \popmacro\@@XMLmapping
\popmacro\@@XMLelement}
-
+
%D Context Directives:
\def\@@CTXML{@@CTXML}
@@ -76,20 +83,22 @@
\def\defineXMLdirective%
{\dodoubleempty\dodefineXMLdirective}
-\def\dodefineXMLdirective[#1][#2]#3%
+\long\def\dodefineXMLdirective[#1][#2]#3%
{\defineXMLprocessor[context-#1-directive]{\dohandleXMLdirective{#1}{#3}}%
\ifsecondargument
- \setvalue{\@@CTXML-#1-#2}{#3}%
+ \long\setvalue{\@@CTXML-#1-#2}{#3}%
\fi}
\def\dohandleXMLdirective#1#2#3%
-% {\dodohandleXMLdirective#3 dummy dummy dummy\end{#1}{#2}}
{\dodohandleXMLdirective#3 @ @ @\end{#1}{#2}}
+%\def\dodohandleXMLdirective#1 #2 #3 #4\end#5#6%
+% {\doifdefinedelse{\@@CTXML-#5-#1}
+% {\getvalue{\@@CTXML-#5-#1}[#2=#3]}
+% {#6[#1][#2=#3]}}
+
\def\dodohandleXMLdirective#1 #2 #3 #4\end#5#6%
- {\doifdefinedelse{\@@CTXML-#5-#1}
- {\getvalue{\@@CTXML-#5-#1}[#2=#3]}
- {#6[#2=#3]}}
+ {\executeifdefined{\@@CTXML-#5-#1}{#6[#1]}[#2=#3]}
% \defineXMLdirective [mathml] \setupMMLappearance % [#1][#2=#3]
% \defineXMLdirective [flowchart] [shapes] \setupFLOWshapes % [#2=#3]
@@ -97,5 +106,53 @@
\defineXMLprocessor [context-begin-group] {\begingroup\gobbleoneargument}
\defineXMLprocessor [context-end-group] {\endgroup \gobbleoneargument}
+
+% \def\XMLnspart#1:#2\empty{#1} % call ...:\empty\empty
+% \def\XMLidpart#1:#2#3\empty{\ifx#2\empty#1\else\XMLidpart#2#3\empty\empty\fi}
+
+% trial macros (used in setupx), to be sped up !
+
+\bgroup \catcode`\<=\active
+
+\gdef\saveasXMLdata#1#2% name raw data
+ {\dodoglobal\setevalue{\@@XMLsave#1}{#2}} % \edef!
+
+\gdef\saveXMLdata#1#2% name data-name ; definitely no \edef
+ {\dodoglobal\copycsname\@@XMLsave#1\endcsname\csname\@@XMLdata:#2\endcsname}
+
+\gdef\saveXMLdatainelement#1#2#3% name element data
+ {\dodoglobal\setevalue{\@@XMLsave#1}% todo: one level expansion
+ {<#2 \currentXMLarguments>\XMLflush{#3}</#2>}}
+
+\gdef\saveXMLdatastructure#1#2#3#4#5#6% name element args before data after
+ {\dodoglobal\setevalue{\@@XMLsave#1}% todo: one level expansion
+ {<#2 #3 \currentXMLarguments>#4\XMLflush{#5}#6</#2>}}
+
+\gdef\doifelseXMLelement#1%
+ {\doifdefinedelse{\@@XMLsave#1}}
+
+\gdef\flushXMLelement#1%
+ {\csname\@@XMLsave#1\endcsname}
+
+\gdef\showXMLelement#1%
+ {\showvalue{\@@XMLsave#1}}
+
+\gdef\processXMLelement#1%
+ {\bgroup
+ \enableXMLelements
+ \getvalue{\@@XMLsave#1}%
+ \egroup}
+
+\gdef\texXMLelement#1%
+ {\begingroup
+ \setnormalcatcodes
+ \scantokens\@EA\@EA\@EA{\csname\@@XMLsave#1\endcsname}%
+ \endgroup}
+
+
+\egroup
+\def\potentialXMLentity#1%
+ {\doifXMLentityelse{#1}{\getXMLentity{#1}}{#1}}
+
\protect \endinput
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index 970f065df..97853ed45 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -11,20 +11,32 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\beginTEX
+% csnames
+
+\beginTEX
\writestatus{XML}{sorry, XML is only supported in (pdf)etex}
\def\startXMLdefinitions{\gobbleuntil\stopXMLdefinitions}
- \endinput
-\endTEX
+ \endinput
+\endTEX
+
+\writestatus{loading}{Context XML Macros (initialization)}
+
+% XMLelse -> elseXML
+
+%D This module is highly optimized for speed, which sometimes
+%D reads to rather unreadable code. Sorry for this.
+
+\def\gobblespacetokens % will go to syst-ext.tex + speed up
+ {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do !
\beginETEX XML
\bgroup \obeylines
- \gdef\startXMLdefinitions%
- {\bgroup\obeylines\dostartXMLdefinitions}
+ \gdef\startXMLdefinitions%
+ {\bgroup\obeylines\dostartXMLdefinitions}
- \gdef\dostartXMLdefinitions #1
+ \gdef\dostartXMLdefinitions #1
{\egroup\doifsomething{#1}{\writestatus{XML}{loading #1 support}}}
\global\let\stopXMLdefinitions\relax
@@ -42,16 +54,17 @@
%D Like it or not, this module deals with angle bracketed
%D input. Processing \XML\ alike input in \CONTEXT\ has been
-%D possible since 1994, but several methods ran in parallel
-%D and were implemented in modules like \type {m-sgml}.
+%D possible since 1995, and till 2000 several methods ran in
+%D parallel. These were implemented in modules like the semi
+%D public \type {m-sgml}.
%D
-%D There is no one optimal solution for processing \XML\ data.
+%D There is not one optimal solution for processing \XML\ data.
%D The oldest method was based on a very simple preprocessor
-%D written in \PERL: \type {<command>} was converted into
-%D \type {\begSGML[command]} and optional parameters were
-%D passed.
+%D written in \MODULA\ and later \PERL: \type {<command>} was
+%D converted into \type {\begSGML[command]} and optional
+%D parameters were passed.
%D
-%D A second method is to use a \PERL\ or \XSL\ transformation
+%D A second method uses a \PERL\ or \XSL\ transformation
%D script that produces \CONTEXT\ commands. This method is
%D much slower, mainly because the whole document is read into
%D memory and a document tree is to be build. The advantage is
@@ -60,34 +73,60 @@
%D The third method uses a basic parser written in the \TEX\
%D language, and apart from a few pitfalls, this method is
%D clean and efficient, but not always robust. Because errors
-%D in the input are not catched on forhand, processing in
+%D in the input are not catched on forehand, processing in
%D \TEX\ may fail due to errors. But, given that a document
%D can be validated on forehand, this is no big problem.
%D
-%D Each method has it's advantage, but especially the third
+%D Each method has its advantage, but especially the third
%D method puts some demands on \CONTEXT, since no interference
%D between the parser and the core commands may occur. What
%D method is used, depends on the situation.
%D
%D All three methods introduce some problems in interfacing to
%D core \CONTEXT\ functionality. This is due to the fact that
-%D sometimes we want to typeset content directly, while on
+%D sometimes we want to typeset content directly, while in
%D other cases we just want to pick up data for later usage,
%D either or not using delimited arguments. And, when moving
%D data around, there is always the expansion problem to deal
%D with.
-%D
+%D
+%D As can be expected, we have to map begin and end tags onto
+%D \CONTEXT's start- and stopcommands. This is the easy part.
+%D When we have to pass the content of an element to a macro
+%D as argument, we need to do a delimited grab. Such mappings
+%D are not that hard to implement and were part of \type
+%D {m-sgml.tex} already. New in this core module is nested
+%D grabbing. Also new here is the support for namespaces and
+%D extensive attribute handling. On the other hand, recursive
+%D traceback of attributes is no longer supported. Because
+%D this feature was not really used, we can hereby safely we
+%D declare the \type {m-sgml.tex} module obsolete.
+%D
%D In order to be able to incorporate \XML\ style definitions
%D into basic \TEX\ styles, we will provide some basic
-%D functionality in the core itself.
+%D functionality in the core itself. Some of the functionality
+%D can be set up with this general command. We use a token
+%D list register to handle post||setup actions. This permits
+%D us to extend this command.
+
+\unprotect
+
+\newtoks\aftersetupXMLprocessing
+
+\def\setupXMLprocessing
+ {\dosingleargument\dosetupXMLprocessing}
+
+\def\dosetupXMLprocessing[#1]%
+ {\getparameters[\??xp][#1]\the\aftersetupXMLprocessing}
+
+\protect
%D We will be dealing with elements, which means that we have
%D to take care of \type {<this>} and \type {</that>}, but
-%D also with \type {<such/>} and \type {<so />}. In due time
-%D this module will deal with all these animals in a
-%D convenient way. In some cases the upper and lowercase
-%D alternatives need to be dealt with, although this is not
-%D realy needed since XML is case sensitive.
+%D also with \type {<such/>} and \type {<so />}. In some cases
+%D the upper and lowercase alternatives need to be dealt with,
+%D although this is not realy needed since XML is case
+%D sensitive.
%D
%D We also have to handle entities, like \type {&you;} and
%D \type {&me;}. These are quite easy to deal with and need to
@@ -100,47 +139,47 @@
%D Since we have to handlers for each element and entity, we
%D will create a few namespaces. Special care has to be
%D given to preformated code.
+%D
+%D There are two namespace mechanisms in place: one for
+%D \TEX, and one for \XML. The later mechanism permits
+%D remapping and ignoring.
\unprotect
\def\@@XML {XML:}
-\def\@@XMLentity {\@@XML ent}
-\def\@@XMLelement {\@@XML ele}
-\def\@@XMLvariable {\@@XML var}
-\def\@@XMLvalue {\@@XML val}
-\def\@@XMLpars {\@@XML par}
-\def\@@XMLdata {\@@XML dat}
-\def\@@XMLcode {\@@XML cod}
-\def\@@XMLinstruction {\@@XML ins}
-\def\@@XMLmap {\@@XML map}
-\def\@@XMLlist {\@@XML lst}
+\def\@@XMLentity {\@@XML ent} % &crap;
+\def\@@XMLelement {\@@XML ele} % <this> </this> <that/>
+\def\@@XMLvariable {\@@XML var} % key="val"
+\def\@@XMLvalue {\@@XML val} % key="val"
+\def\@@XMLpars {\@@XML par} %
+\def\@@XMLdata {\@@XML dat} % mem buffer
+\def\@@XMLcode {\@@XML cod} % named mem buffers
+\def\@@XMLinstruction {\@@XML ins} % <?
+\def\@@XMLmap {\@@XML map} % mapping on context attr
+\def\@@XMLlist {\@@XML lst} %
+\def\@@XMLnamespace {\@@XML nam} % namespace:element
+\def\@@XMLurlspace {\@@XML url} %
+\def\@@XMLescape {\@@XML esc} % <!
+\def\@@XMLdepth {\@@XML dep} % used to track nesting
+\def\@@XMLdopth {\@@XML dop} % used to track nesting
+\def\@@XMLsave {\@@XML sav} % namespace for saved elements
\newtoks\XMLtoks
\newtoks\XMLresetlist
-\chardef\XMLargumentmode=0
-
-\newif\ifignoreXMLcase
\newif\ifignoreXMLspaces
\newif\iffixedXMLfont
+\newif\iftraceXMLelements
+\newif\ifprocessingXML
-%D \macros
-%D {compound}
-%D
-%D We will overload the already active \type {|} so we have
-%D to save its meaning in order to be able to use this handy
-%D macro.
-%D
-%D \starttypen
-%D so test\compound{}test can be used instead of test||test
-%D \stoptypen
+\newcount\XMLlevel % scratchcounter
+\newcount\XMLdepth % used here
-\let\docompound=| \def\compound#1{\docompound#1|}
+\newtoks\everyenableXML
%D We will implement the parser by making a few characters
%D active. For that reason we also have to save their
-%D original meaning. The core handlers are \type
-%D {\doXMLentity} and \type {\doXMLelement}.
+%D original meaning.
%D \macros
%D {enableXML}
@@ -156,34 +195,46 @@
\catcode`\.=\@@escape
.catcode`.B=.@@begingroup
.catcode`.E=.@@endgroup
-
-.catcode`.&=.@@active .gdef.letterampersand B.string&E
-.catcode`.<=.@@active .gdef.letterless B.string<E
-
-.catcode`.#=.@@active .gdef.letterhash B.string#E
-.catcode`.$=.@@active .gdef.letterdollar B.string$E
-.catcode`.%=.@@active
-.catcode`.\=.@@active .gdef.letterbackslash B.string\E
-.catcode`.^=.@@active .gdef.letterhat B.string^E
-.catcode`._=.@@active .gdef.letterunderscore B.string_E
-.catcode`.{=.@@active .gdef.letterbgroup B.string{E
-.catcode`.}=.@@active .gdef.letteregroup B.string}E
-.catcode`.|=.@@active .gdef.letterbar B.string|E
-.catcode`.~=.@@active .gdef.lettertilde B.string~E
-
-.gdef.enableXMLexpansion
+.catcode`.P=.@@parameter
+
+.catcode`.&=.@@active * .gdef.letterampersand B.string&E
+.catcode`.<=.@@active * .gdef.letterless B.string<E
+ * .gdef.lettermore B.string>E
+.catcode`.#=.@@active * .gdef.letterhash B.string#E
+.catcode`.$=.@@active * .gdef.letterdollar B.string$E
+.catcode`.%=.@@active * .gdef.letterpercent B.string%E
+.catcode`.\=.@@active * .gdef.letterbackslash B.string\E
+.catcode`.^=.@@active * .gdef.letterhat B.string^E
+.catcode`._=.@@active * .gdef.letterunderscore B.string_E
+.catcode`.{=.@@active * .gdef.letterbgroup B.string{E
+.catcode`.}=.@@active * .gdef.letteregroup B.string}E
+.catcode`.|=.@@active * .gdef.letterbar B.string|E
+.catcode`.~=.@@active * .gdef.lettertilde B.string~E
+
+.gdef.enableXMLexpansion
B.def<B.doXMLelementE.let&=.doXMLentityE
-.gdef.disableXMLexpansion
+.gdef.disableXMLexpansion
B.unexpanded.def<B.doXMLelementE.let&=.doXMLentityE
-.gdef.enableXML*
+* internally the # becomes two #'s (before expanding, during
+* the parsing stage) which is why we let the first # gobble
+* the second one
+*
+* since this only takes place when reading arguments, as in
+* \startXMLdata ... cum, suis, we can take place of it
+* there; this is needed because reading from file goes wrong
+* (eating up argument)
+
+.unexpanded.gdef.enableXML*
B.catcode`.!=.@@other*
- .catcode`.?=.@@other*
+ .catcode`.?=.@@other*
.catcode`.&=.@@active .let&=.doXMLentity*
.catcode`.<=.@@active .unexpanded.def<B.doXMLelementE*
- .catcode`.>=.@@other*
- .catcode`.#=.@@active .def#B&tex-hash;E*
+ .catcode`.>=.@@other .catcode`."=.@@other*
+ .catcode`./=.@@other .catcode`.'=.@@other*
+ *catcode`.#=.@@active .def#PP1B&tex-hash;E* gobbles its own dup
+ .catcode`.#=.@@active .def#B&tex-hash;E*
.catcode`.$=.@@active .def$B&tex-dollar;E*
.catcode`.%=.@@active .def%B&tex-percent;E*
.catcode`.\=.@@active .def\B&tex-backslash;E*
@@ -192,18 +243,35 @@
.catcode`.{=.@@active .def{B&tex-leftbrace;E*
.catcode`.}=.@@active .def}B&tex-rightbrace;E*
.catcode`.|=.@@active .def|B&tex-bar;E*
- .catcode`.~=.@@other* active .def~B&tex-tilde;E*
- .relax* needed for successive .if's
+ .catcode`.~=.@@other *def~B&tex-tilde;E*
+ .processingXMLtrue
+ .the.everyenableXML
E
-.gdef.enableXMLelements*
- B.catcode`.<=.@@active .unexpanded.def<B.doXMLelementE*
- .catcode`.>=.@@other*
- .relax* needed for successive .if's
+* The following macro can be invokes when reading from
+* an auxiliary file.
+
+.unexpanded.gdef.enableXMLelements*
+ B.catcode60=.@@active * .catcode`.<=.@@active
+ .catcode62=.@@other * .catcode`.>=.@@other
+ .unexpanded.def<B.doXMLelementE*
+ .processingXMLtrue
+ E
+
+.unexpanded.gdef.disableXMLelements*
+ B.catcode60=.@@active * .catcode`.<=.@@active
+ .catcode62=.@@other * .catcode`.>=.@@other
+ .let<.relax * new
+ .processingXMLfalse
E
+.global.let<.relax * new
+.global.let&.relax * new
+
.egroup
+\def\disableXML{\setnormalcatcodes\processingXMLfalse}
+
%D An element can be singular or paired. A singular element is
%D called an empty element. The following definitions are
%D equivalent:
@@ -265,45 +333,83 @@
%D to determine if we're dealing with a comment or processing
%D instruction. We need a bit of grouping because we have to
%D mess up with catcodes. We probably have to treat a few
-%D more catcode and first character cases. We need to use
-%D \type {\begingroup} here, otherwise we get funny spaces in
-%D math.
+%D more catcode and first character cases. We need to use
+%D \type {\begingroup} here, otherwise we get funny spaces in
+%D math.
-\protect
+%D Maybe I will remove grouping here and introduce \type
+%D {\obeyXMLlines}.
-\long\def\doXMLelement#1%
- {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
- \catcode`\^^M=10
- \if#1!\let\next \xdoXMLelement \else
- \if#1?\let\next \ydoXMLelement \else
- \let\next \zdoXMLelement \fi\fi
- \next#1}
-
-%D By using a few {\expandafter}'s we can us a \type {\next}
+%D By using a few {\expandafter}'s we can avoid a \type {\next}
%D construction. We could speed the first char test up a bit
%D by using an installer and something \typ {\getvalue
-%D {#1doXMLelement}} (todo).
+%D {#1doXMLelement}} (todo).
+
+\protect % we need an normal ! ?
+
+% \long\def\doXMLelement#1%
+% {\if#1!\expandafter \xparseXMLescape \else
+% \if#1?\expandafter\expandafter\expandafter \xparseXMLprocess \else
+% \expandafter\expandafter\expandafter \xparseXMLelement \fi\fi
+% #1}
+
+\def\expandthree{\expandafter\expandafter\expandafter}
\long\def\doXMLelement#1%
- {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
- \catcode`\^^M=10\relax
- \if#1!\expandafter \xdoXMLelement \else
- \if#1?\expandafter\expandafter\expandafter \ydoXMLelement \else
- \expandafter\expandafter\expandafter \zdoXMLelement \fi\fi
+ {\if#1!\expandafter \xparseXMLescape \else
+ \if#1?\expandthree \xparseXMLprocess \else
+ \expandthree \xparseXMLelement \fi\fi
#1}
-%D The (yet experimental) \type {CDATA} parser is implemented
-%D on top of the verbatim environment.
+% does it end with ? or ?>
+
+\long\def\xparseXMLescape !#1 {\parseXMLescape{#1}}
+\long\def\xparseXMLprocess ?#1 #2>{\parseXMLprocess{#1}{#2}}
+\long\def\xparseXMLelement #1>{\parseXMLelement #1 >}
+
+% this kind of optimizations are only faster in a more
+% extensive if tree combined with equally spread occurance of
+% #1 (also tested for arguments)
+%
+% \long\def\doXMLelement#1%
+% {\csname<\if#1!!\else\if#1??\else.\fi\fi>\endcsname#1}
+%
+% \long\setvalue{<!>}!#1 {\parseXMLescape{#1}}
+% \long\setvalue{<?>}?#1 {\parseXMLprocess{#1}}
+% \long\setvalue{<.>}#1>{\parseXMLelement#1 >}
+
+%D The escape handler takes care of the fuzzy \type {<!}
+%D constructs. Unfortunately, we need to catch \type {<--text}
+%D too, so we need another handler:
+
+\long\def\xparseXMLescape !#1#2%
+ {\if#1-%
+ \if#2-%
+ \expandafter\expandafter\expandafter\xxparseXMLescape
+ \else
+ \expandafter\expandafter\expandafter\xyparseXMLescape
+ \fi
+ \else
+ \expandafter\xyparseXMLescape
+ \fi#1#2}
+
+\long\def\xxparseXMLescape --#1{\parseXMLescape{--}#1}
+\long\def\xyparseXMLescape #1 {\parseXMLescape{#1}}
+
+%D Now the real work can begin.
+
+\unprotect
-\long\def\xdoXMLelement !#1 % !-- --> or !xyz >
- {\endgroup
- \doifelse{#1}{--}
- {\long\def\nextelement{\gobbleuntil{-->}}}
- {\doifelse{#1}{[CDATA[}
- {\long\def\nextelement{\skipfirstverbatimlinefalse
- \processtaggeddisplayverbatim{]]>}}}
- {\long\def\nextelement{\gobbleuntil{>}}}}%
- \nextelement}
+\def\defineXMLescape[#1]#2%
+ {\unspaceargument#1\to\ascii % get rid of {}, like in {CDATA[}
+ \long\setvalue{\@@XMLescape:\ascii}{#2}}
+
+\def\parseXMLescape#1% #2> parsing takes place in macros
+ {\executeifdefined{\@@XMLescape:#1}{\csname\@@XMLescape:\s!default\endcsname}}
+
+\let\normalparseXMLescape \parseXMLescape
+\let\normalparseXMLelement\parseXMLelement
+\let\normalparseXMLprocess\parseXMLprocess
%D In our case, processing instructions are only needed if
%D we want specific \CONTEXT\ support. This may be useful in
@@ -311,183 +417,620 @@
%D application. We will implement a \CONTEXT\ code handler
%D later.
-\long\def\ydoXMLelement#1 #2?>% ?target ?>
- {\endgroup\dodoXMLprocessor{#1}{#2}}
+%D The processing instructions handler is implemented as
+%D follows.
-%D The normal elements are handled by \type {\dodoXMLelement}.
+\long\def\defineXMLprocessor[#1]#2%
+ {\long\setvalue{\@@XMLinstruction:#1}{#2}}
-\long\def\zdoXMLelement#1>%
- {\endgroup\dodoXMLelement#1 >}
+% \def\parseXMLprocess#1#2%
+% {\executeifdefined{\@@XMLinstruction:#1}\gobbleoneargument{#2}}
-%D Now we switch to unprotected mode again.
+%D Because we support \type {.. ?>} as well as \type {.. >}
+%D end||of||pi situations, we need to clean up the ending
+%D \type {?}.
-\unprotect
+\protect
-%D The processing instructions handler is implemented as
-%D follows.
+\long\def\cleanupXMLprocess#1%
+ {\docleanupXMLprocess#1 ? \relax}
+
+\long\def\docleanupXMLprocess#1? #2\relax
+ {\def\currentXMLprocess{#1}}
+
+\unprotect
+
+\def\parseXMLprocess#1#2%
+ {\cleanupXMLprocess{#2}%
+ %\convertcommand\currentXMLprocess\to\ascii
+ %\writestatus{xml-process}{\ascii}
+ \expanded
+ {\executeifdefined
+ {\@@XMLinstruction:#1}
+ \noexpand\gobbleoneargument
+ {\expandafter\noexpand\currentXMLprocess}}}
+
+%D Next we will implement the normal element handler. This
+%D piece of code is complicated by the fact that we need to
+%D handle namespaces.
+
+\let\currentXMLarguments \empty
+\let\currentXMLelement \empty % name
+\let\currentXMLidentifier\empty % name or name/
+\let\currentXMLnamespace \empty % the (remapped) namespace
+\let\originalXMLnamespace\empty % the unremapped namespace
+\let\rawXMLidentifier \empty
-\long\def\dodoXMLprocessor#1%
- {\ifundefined{\@@XMLinstruction:#1}%
- \let\next\gobbleoneargument
+\def\rawXMLnamespace
+ {\ifx\currentXMLnamespace\empty\else\currentXMLnamespace:\fi}
+
+\def\rawXMLelement{\rawXMLnamespace\rawXMLidentifier}
+
+%D The following token list register provided the user a hook
+%D for extensions.
+
+\newtoks\everyXMLelement
+
+%D We try to keep track of the nature of an element. This
+%D flag can be used for special purposes (as in the pretty
+%D printing macros).
+
+\chardef\kindofXMLelement=0
+
+\chardef\beginXMLtag=1
+\chardef\endXMLtag =2
+\chardef\emptyXMLtag=3
+
+%D We do a rather hard coded scan for the namespace attribute. This
+%D is needed because its value determines further namespace related
+%D actions.
+
+\def\openXMLargument{ /}
+
+\long\def\parseXMLelement#1#2 #3>%
+ {\def\currentXMLarguments{#3}% including end /
+ \if#1/%
+ \chardef\kindofXMLelement\endXMLtag
+ \def\currentXMLelement{#2}%
\else
- \def\next{\getvalue{\@@XMLinstruction:#1}}%
+ \docleanupXMLelement#1#2/\empty\relax
+ \fi
+ \ifx\currentXMLarguments\openXMLargument
+ \chardef\kindofXMLelement\emptyXMLtag
\fi
- \next}
+ \@EA\splitoffXMLnamespace\currentXMLelement::\relax
+ \ifcase\kindofXMLelement
+ % can't happen
+ \or
+ % begintag or emptytag with arguments or space before /
+ \the\everyXMLelement % only for begin/empty tag !
+ \ifx\currentXMLarguments\empty \else
+ \dogetXMLarguments\rawXMLelement#3>%
+ \fi
+ \or
+ % no arguments
+ \or
+ % empty element without arguments (but possible presets)
+ \the\everyXMLelement
+ \fi
+ \ifcase\kindofXMLelement\or
+ \let\currentXMLidentifier \rawXMLidentifier
+ \edef\currentXMLfullidentifier {\rawXMLelement }%
+ \or
+ \edef\currentXMLidentifier {/\rawXMLidentifier }%
+ \edef\currentXMLfullidentifier{/\rawXMLelement }%
+ \or
+ \edef\currentXMLidentifier {\rawXMLidentifier/}%
+ \edef\currentXMLfullidentifier {\rawXMLelement /}%
+ \fi
+ \iftraceXMLelements\traceXMLelement\fi
+ \executeXMLelement}
+
+\long\def\docleanupXMLelement#1/#2#3\relax
+ {\def\currentXMLelement{#1}% watch out: \empty == begin or empty tag
+ \chardef\kindofXMLelement\ifx#2\empty\beginXMLtag\else\emptyXMLtag\fi}
+
+\def\@@traceXMLelement%
+ {\originalXMLfullidentifier
+ \ifx\originalXMLfullidentifier\currentXMLfullidentifier\else
+ \space=>\space\currentXMLfullidentifier
+ \fi
+ \ifx\currentXMLarguments\empty\else
+ \space\string|\space\currentXMLarguments
+ \fi}
+
+\long\def\traceXMLelement%
+ {\edef\originalXMLfullidentifier{\someXMLelement\currentXMLelement}%
+ \cleanupXMLarguments\writestatus{xml-element}{\@@traceXMLelement}}
+
+%D We split off the namespace part, construct the
+%D identifier, and remap the namespace if needed.
+
+\def\splitoffXMLnamespace#1:#2:#3\relax
+ {\def\rawXMLidentifier{#2}%
+ \ifx\rawXMLidentifier\empty
+ \let\currentXMLnamespace\empty
+ \edef\rawXMLidentifier{#1}%
+ \else
+ \edef\currentXMLnamespace{#1}%
+ \fi
+ \let\originalXMLnamespace\currentXMLnamespace
+ \checkXMLnamespace\rawXMLidentifier}
+
+\def\xsplitoffXMLnamespace% fast resplit
+ {\ifcsname\@@XMLnamespace:\currentXMLnamespace\endcsname
+ \csname\@@XMLnamespace:\currentXMLnamespace\endcsname
+ \fi}
+
+%D We will implement this macro later.
+
+\let\checkXMLnamespace\gobbleoneargument % see below
+
+%D The namespace attribute checking is part of the element
+%D parser, since the value of \type {xmlns} may influence other
+%D namespace mapping.
+
+\def\@@XMLns{xmlns}
+
+\def\checkXMLnamespaceattr#1% xmlns:\@@XMLname="\XMLns"
+ {\edef\XMLns{#1}%
+ \ifx\XMLns\empty \else
+ \ifcsname\@@XMLurlspace:\XMLns\endcsname
+ % get remapped namespace (from url)
+ % \edef\XMLns{\csname\@@XMLurlspace:\XMLns\endcsname}%
+ \@EA\let\@EA\XMLns\csname\@@XMLurlspace:\XMLns\endcsname
+ % remap this one
+ \ifx\@@XMLname\empty
+ % not watertight since no implicit grouping
+ \xautoXMLnamespace\XMLns
+ \else
+ \xremapXMLnamespace\@@XMLname\XMLns
+ % redo namespace remapping of self if needed
+ \ifx\XMLns\currentXMLnamespace
+ % i'm still not sure if this is ok
+ \else
+ \xsplitoffXMLnamespace
+ \fi
+ \fi
+ \fi
+ \fi}
-\long\def\defineXMLprocessor[#1]#2% watch the ?
- {\long\setvalue{\@@XMLinstruction:?#1}{#2}}
+%D Although not really needed, we clean up the arguments.
-%D As an example, we implement a \CONTEXT\ code handler:
+% \long\def\cleanupXMLarguments
+% {\ifnum\kindofXMLelement=\emptyXMLtag
+% \ifx\currentXMLarguments\empty \else
+% \@EA\docleanupXMLarguments\currentXMLarguments/\empty
+% \fi
+% \fi}
+%
+% \long\def\docleanupXMLarguments#1/#2\empty
+% {\edef\currentXMLarguments{#1}}
+%
+% we need to be ...="/" .... /> safe
-\defineXMLprocessor[context] {\contextXMLcommand}
-\defineXMLprocessor[context-command]{\contextXMLcommand}
+\long\def\cleanupXMLarguments
+ {\ifnum\kindofXMLelement=\emptyXMLtag
+ \ifx\currentXMLarguments\empty \else
+ \@EA\docleanupXMLarguments\currentXMLarguments/ \relax
+ \fi
+ \fi}
-\def\contextXMLcommand#1%
- {\pushmacro\disableXML
- \def\disableXML{\global\let\afterXMLprocessor\empty}%
- \global\let\afterXMLprocessor\enableXML
- \setnormalcatcodes\scantokens{#1}\afterXMLprocessor
- \popmacro\disableXML}
+\long\def\docleanupXMLarguments#1/ #2\relax % space added earlier
+ {\edef\currentXMLarguments{#1}}
-\defineXMLprocessor[context-directive]{\contextXMLdirective}
+\def\executeXMLelementA% no fallback
+ {\ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname
+ \csname\@@XMLelement:\currentXMLfullidentifier\endcsname
+ \fi}
-\def\contextXMLdirective#1%
- {\docontextXMLdirective#1 dummy dummy dummy\end}
+\def\executeXMLelementB% default fallback
+ {\csname \@@XMLelement:%
+ \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname
+ \currentXMLfullidentifier
+ \else
+ \defaultXMLelement
+ \fi
+ \endcsname}
+
+\def\executeXMLelementC% no namespace of default fallback
+ {\csname \@@XMLelement:%
+ \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname
+ \currentXMLfullidentifier
+ \else\ifcsname\@@XMLelement:\currentXMLidentifier\endcsname
+ \currentXMLidentifier
+ \else
+ \defaultXMLelement
+ \fi\fi
+ \endcsname}
+
+\def\setXMLfallbackmode#1%
+ {\ifcase#1\relax
+ \let\executeXMLelement\executeXMLelementA
+ \or
+ \let\executeXMLelement\executeXMLelementB
+ \or
+ \let\executeXMLelement\executeXMLelementC
+ \fi}
+
+\setXMLfallbackmode2
+
+%D An example of fall back modes is given below.
-\def\docontextXMLdirective#1 #2 #3 #4\end% class var value
- {\setvalue{\@@XMLvariable:#1:#2}{#3}}
+%D Later we will implement the error handler, here we handle
+%D the default case.
-\defineXMLprocessor[context-message]{\contextXMLmessage}
+\def\someXMLelement#1%
+ {\ifnum\kindofXMLelement=\endXMLtag /\fi
+ #1%
+ \ifnum\kindofXMLelement=\emptyXMLtag/\fi}
+
+\def\defaultXMLelement%
+ {\someXMLelement\s!default}
-\def\contextXMLmessage#1%
- {\writestatus{xml}{#1}}
+%D It is possible to keep track of nesting automatically,
+%D but this would kind of prohibit things like \type
+%D {\ignorespaces}. In the future we may provide an
+%D automatic depth tracking as an alternative (exclusive)
+%D mode of operation combined with space grabbing.
-\def\setnormalcatcodes%
- {\catcode`\!=\@@other \catcode`\?=\@@other
- \catcode`\&=\@@alignment \catcode`\<=\@@other
- \catcode`\#=\@@parameter \catcode`\$=\@@mathshift
- \catcode`\%=\@@comment \catcode`\\=\@@escape
- \catcode`\^=\@@superscript \catcode`\_=\@@subscript
- %\catcode`\|=\@@active \catcode`\~=\@@active
- \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup}
+\def\beginXMLelement
+ {\global\advance\XMLdepth \plusone % 1
+ \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement}
-\let\disableXML\setnormalcatcodes
+\def\endXMLelement
+ {\global\advance\XMLdepth \minusone } % -1 }
-%D Given the previous definition, and given that \ETEX\ is
-%D used, we can now say:
+\def\XMLancestor#1%
+ {\ifnum\numexpr(\XMLdepth-#1)>0
+ \csname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname
+ \else
+ \currentXMLelement
+ \fi}
+
+\def\XMLparent%
+ {\XMLancestor1}
+
+% todo: split #1 into raws en reconstruct, set current etc, push and pop
+%
+% \def\beginXMLelement
+% {\dosingleempty\dobeginXMLelement}
+%
+% \def\dobeginXMLelement[#1]%
+% {\global\advance\XMLdepth 1
+% \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement
+% \global\@EA\edef\csname\@@XMLdopth:\the\XMLdepth\endcsname{\ownXMLelement}%
+% \iffirstargument\edef\ownXMLelement{#1}\fi}
+%
+% \def\endXMLelement
+% {\@EA\let\@EA\ownXMLelement\csname\@@XMLdopth:\the\XMLdepth\endcsname
+% \global\advance\XMLdepth -1 }
+
+%D \defineXMLenvironment[one]
+%D {\beginXMLelement}
+%D {\endXMLelement}
+%D
+%D \defineXMLenvironment[two]
+%D {\beginXMLelement
+%D \starttabulate
+%D \NC parent 1 \NC \XMLparent{1} \NC \NR
+%D \NC parent 2 \NC \XMLparent{2} \NC \NR
+%D \NC parent 3 \NC \XMLparent{3} \NC \NR
+%D \NC parent 4 \NC \XMLparent{4} \NC \NR
+%D \stoptabulate}
+%D {\endXMLelement}
+%D
+%D \startbuffer
+%D <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one>
+%D \stopbuffer
+%D
+%D fallback A: \setXMLfallbacklevel0 \processXMLbuffer
+%D fallback B: \setXMLfallbacklevel1 \processXMLbuffer
+%D fallback C: \setXMLfallbacklevel2 \processXMLbuffer
+
+%D Here we do the namespace (re)mapping. More examples are
+%D provided in the manual.
%D
%D \starttypen
-%D <?context {\bf Start Of Some \TeX\ Text} ?>
+%D \supportXMLnamespace [test] % needed to get a namespace working
+%D \skipXMLnamespace [test] % slow
+%D \ignoreXMLnamespace [test] % faster
+%D \defineXMLenvironment [rubish:itemize] {[} {]}
+%D \defineXMLenvironment [rubish:item] {(} {)}
+%D \remapXMLnamespace [crap] [rubish]
+%D \remapXMLnamespace [con] [context]
+%D \remapXMLurlspace [http://www.pragma-ade.com/dtd/context] [context]
+%D \autoXMLnamespace [context] % fallback
+%D \autoXMLnamespace [whatever] % second fall back
%D \stoptypen
-%D
-%D A non||\ETEX\ solution is also possible, using buffers,
-%D but for the moment we assume that \ETEX\ is used.
-%D Next we will implement the normal element handler.
+\newtoks\autoXMLnamespaces
-\let\currentXMLarguments\empty
-\let\currentXMLelement \empty
+%D The automatically mapped namespaces (the fallbacks so to
+%D day) are collected in a token list.
-\newtoks\everyXMLelement
+\let\checkedXMLnamespace\empty
-\long\def\dodoXMLelement#1 #2>%
- {\def\!!stringa{#2}%
- \def\!!stringb{/ }%
- \ifx\!!stringa\empty
- \let\currentXMLarguments\empty
- \def\currentXMLelement{#1}%
- \the\everyXMLelement
- \else\ifx\!!stringa\!!stringb
- \let\currentXMLarguments\empty
- \def\currentXMLelement{#1/}%
- \the\everyXMLelement
+\def\checkXMLnamespace#1%
+ {\edef\checkedXMLnamespace{#1}%
+ \ifcsname\@@XMLnamespace:\currentXMLnamespace\endcsname
+ \csname\@@XMLnamespace:\currentXMLnamespace\endcsname
+ % forced namespace
+ \else\ifcsname\@@XMLelement:\currentXMLelement\endcsname
+ % natural element
+ \else\ifcsname\@@XMLelement:\currentXMLelement/\endcsname
+ % natural element
\else
- \def\currentXMLelement{#1}%
- \def\currentXMLarguments{#2}%
- \the\everyXMLelement
- %\getXMLarguments\currentXMLelement{#2}%
- \dogetXMLarguments\currentXMLelement#2>%
- \fi \fi
- \executeXMLelement\currentXMLelement}
-
-\def\executeXMLelement#1%
- {\getvalue{\@@XMLelement:#1}}
-
-\newif\ifXMLrawentities
+ % locate fallback
+ \donefalse\the\autoXMLnamespaces
+ \fi\fi\fi}
-% \bgroup
-%
-% \catcode`<=\@@active
-%
-% \gdef\defineXMLentity[#1]#2%
-% {\unspaceargument#1\to\ascii
-% \long\setvalue{\@@XMLelement:ent:\@EA\firstofoneargument\ascii/}{#2}}
-%
-% \gdef\doXMLentity#1;%
-% {\ifXMLrawentities#1\else\executeXMLentity{#1}\fi}
-%
-% \gdef\executeXMLentity#1%
-% {<ent:#1/>}
-%
-% \gdef\getXMLentity#1%
-% {\getvalue{\@@XMLelement:ent:#1/}}
-%
-% \gdef\doifXMLentityelse#1#2#3%
-% {\ifundefined{\@@XMLelement:ent:#1/}#3\else#2\fi}
-%
-% \egroup
+\def\skipXMLnamespace[#1]%
+ {\letvalue{\@@XMLnamespace:#1}\doXMLskipnamespace}
-\gdef\defineXMLentity[#1]#2%
- {\unspaceargument#1\to\ascii
- \long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}}
+\def\doXMLskipnamespace
+ {\long\@EA\def\csname\@@XMLelement:\checkedXMLnamespace\endcsname
+ {\getXMLgroupedignore\checkedXMLnamespace}}
+
+\def\hideXMLnamespace[#1]%
+ {\letvalue{\@@XMLnamespace:#1}\doXMLhidenamespace}
+
+\def\doXMLhidenamespace
+ {\long\@EA\def\csname\@@XMLelement:\checkedXMLnamespace\endcsname
+ {\redoXMLignore\checkedXMLnamespace}}
+
+\def\ignoreXMLnamespace[#1]%
+ {\letvalue{\@@XMLnamespace:#1}\doXMLignorenamespace}
+
+\def\doXMLignorenamespace % \let binnen def
+ {\long\@EA\def\csname\@@XMLelement:\checkedXMLnamespace\endcsname
+ {\@EA\redoXMLignore\@EA{\checkedXMLnamespace}}} % EA ?
+
+\def\remapXMLnamespace
+ {\dodoubleargument\doremapXMLnamespace}
+
+\def\doremapXMLnamespace[#1][#2]%
+ {\ifsecondargument
+ \setvalue{\@@XMLnamespace:#1}{\def\currentXMLnamespace{#2}}%
+ \else
+ \letvalue{\@@XMLnamespace:#1}\relax
+ \fi}
+
+\def\supportXMLnamespace%
+ {\dosingleargument\dosupportXMLnamespace}
+
+\def\dosupportXMLnamespace[#1]%
+ {\setvalue{\@@XMLnamespace:#1}{\def\currentXMLnamespace{#1}}}
+
+\def\xremapXMLnamespace#1#2% fast internal one
+ {\@EA\edef\csname\@@XMLnamespace:#1\endcsname
+ {\def\noexpand\currentXMLnamespace{#2}}}
+
+\def\autoXMLnamespace[#1]%
+ {\xautoXMLnamespace{#1}}
+
+\def\xautoXMLnamespace#1% fast internal one
+ {\ifcsname\@@XMLnamespace-#1\endcsname\else
+ \@EA\appendtoks\csname\@@XMLnamespace-#1\endcsname\to\autoXMLnamespaces
+ \fi
+ \@EA\edef\csname\@@XMLnamespace-#1\endcsname
+ {\noexpand\doautoXMLnamespace{#1}}}
+
+\def\doautoXMLnamespace#1% \done is set before list
+ {\ifdone\else
+ \ifcsname\@@XMLelement:#1:\checkedXMLnamespace\endcsname
+ \def\currentXMLnamespace{#1}%
+ \else\ifcsname\@@XMLelement:#1:\checkedXMLnamespace/\endcsname
+ \def\currentXMLnamespace{#1}%
+ \fi\fi
+ \fi}
+
+\def\resetXMLnamespace[#1]%
+ {\letvalue{\@@XMLnamespace-#1}\gobbleoneargument
+ \letvalue{\@@XMLnamespace:#1}\gobbleoneargument}
+
+\def\remapXMLurlspace
+ {\dodoubleargument\doremapXMLurlspace}
-% we need to be able to do:
+\def\doremapXMLurlspace[#1][#2]%
+ {\setvalue{\@@XMLurlspace:#1}{#2}}
+
+%D Entities needs a bit more work, as well as a connection
+%D with the encoding handlers.
+
+% we need to be able to do:
%
% \defineXMLentity[amp] {\FunnyAmp} \def\FunnyAmp#1;{\getXMLentity{#1}}
%
% \defineXMLentity [pound] {(why not use euro's?)}
-%
+%
% \startXMLdata
% test &amp;pound; test
% \stopXMLdata
%
-% so we need an ifless implementation of:
+% so we need an ifless implementation
-\gdef\doXMLentity#1;%
- {\ifXMLrawentities
- \expandafter\firstofoneargument
+% \eacute -> simplified -> e (via raw encoding)
+% -> raw -> eacute (via handler)
+%
+% naming sucks
+
+\newif\ifXMLrawentities % proper fallback
+\newif\ifXMLsimpleentities % last resort
+
+\def\simpleXMLencoding{raw}
+
+\def\simplifyXMLentities%
+ {\fastenableencoding\simpleXMLencoding
+ \XMLsimpleentitiestrue}
+
+\gdef\defineXMLentity%
+ {\dodoubleempty\dodefineXMLentity}
+
+\gdef\dodefineXMLentity[#1][#2]#3%
+ {\ifsecondargument
+ \defineXMLentities[#1]{#2}{#3}%
+ \else
+ \dododefineXMLentity{#1}{#3}%
+ \fi}
+
+\def\defineXMLentities[#1]#2#3%
+ {\dododefineXMLentity{#1}{\ifXMLsimpleentities#2\else#3\fi}}
+
+\gdef\dododefineXMLentity#1#2%
+ {\unspaceargument#1\to\ascii % #1 can be {[} or so
+ \long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}}
+
+%D May this wile become dodo (more in tune with rest);
+%D beware: also remapped in xtag-map.
+
+\gdef\doXMLentity#1#2;% interesting: # is now ##
+ {\if\string#1\letterhash
+ \@EA\parseXMLcharacter
+ \else\ifXMLrawentities
+ \@EAEAEA\firstofoneargument
+ \else
+ \@EAEAEA\executeXMLentity
+ \fi\fi{#1#2}}
+
+%D Here we need to get rid of the double hash and act upon the
+%D number. Proper hex/oct number support can be implemented by
+%D redefining \type {\executeXMLcharacter}.
+
+% \def\parseXMLcharacter#1% gobble the ##x
+% {\@EA\executeXMLcharacter\@EA{\gobblethreearguments#1}}
+%
+% single hash now
+%
+% \def\parseXMLcharacter#1%
+% {\@EA\executeXMLcharacter\@EA{\gobbleoneargument#1}}
+%
+% \def\executeXMLcharacter#1% can be overloaded
+% {\ifnum"#1<256
+% \@EA\getXMLcharacter
+% \else\ifXMLrawentities
+% \@EAEAEA\firstofoneargument
+% \else
+% \@EAEAEA\unknownXMLcharacter
+% \fi\fi{\number"#1}}
+%
+% \unexpanded\def\getXMLcharacter#1{\rawcharacter{#1}}
+
+\def\parseXMLcharacter#1%
+ {\@EA\executeXMLcharacter\gobbleoneargument#1\empty\relax}
+
+\def\executeXMLcharacter#1#2\relax
+ {\if#1x%
+ \@EA\executeXMLhexcharacter
+ \else
+ \@EA\executeXMLdeccharacter
+ \fi#1#2\relax}
+
+% \def\executeXMLhexcharacter x#1\relax % can be overloaded
+% {\ifnum"#1<256
+% \@EA\getXMLcharacter
+% \else\ifXMLrawentities
+% \@EAEAEA\firstofoneargument
+% \else
+% \@EAEAEA\unknownXMLcharacter
+% \fi\fi{\number"#1}}
+
+\def\executeXMLhexcharacter x#1\relax % can be overloaded
+ {\uppercase{\doexecuteXMLhexcharacter#1\relax}}
+
+\def\doexecuteXMLhexcharacter#1\relax
+ {\ifnum"#1<256
+ \@EA\getXMLcharacter
+ \else\ifXMLrawentities
+ \@EAEAEA\firstofoneargument
+ \else
+ \@EAEAEA\unknownXMLcharacter
+ \fi\fi{\number"#1}}
+
+% ==
+%
+% \def\executeXMLhexcharacter x#1\relax
+% {\uppercase{\ifnum"#1}<256
+% \@EA\getXMLcharacter
+% \else\ifXMLrawentities
+% \@EAEAEA\firstofoneargument
+% \else
+% \@EAEAEA\unknownXMLcharacter
+% \fi\fi{\uppercase{\number"#1}}}
+
+\def\executeXMLdeccharacter#1\relax % can be overloaded
+ {\ifnum#1<256
+ \@EA\getXMLcharacter
+ \else\ifXMLrawentities
+ \@EAEAEA\firstofoneargument
+ \else
+ \@EAEAEA\unknownXMLcharacter
+ \fi\fi{\number#1}}
+
+\unexpanded\def\getXMLcharacter#1%
+ {\ifcsname\@@XMLentity:#1\endcsname
+ \@EA\getXMLentity
\else
- \expandafter\executeXMLentity
+ \@EA\rawcharacter
\fi{#1}}
-\def\executeXMLentity#1% internal ! ! !
+\def\unknownXMLcharacter#1{[#1]}
+
+% \useXMLfilter[ent]
+%
+% \defineXMLsingular[test]{{\simplifyXMLentities\XMLpar{test}{bla}{}}}
+%
+% \startXMLdata
+% <test bla="&#xD3;bla&eacute;bla&tex;and$and&#xFC;ziezo&#xF99;" />
+% \stopXMLdata
+%
+% \defineXMLentity[45]{|it works|} % {|-|}
+%
+% \startXMLdata
+% text&#045;&#046;text
+% text&#x045;&#x046;text
+% \stopXMLdata
+
+%D May be this will change a bit ...
+
+\def\executeXMLentity#1% named one
{\getXMLentity{#1}}
-\def\expandedXMLentity#1%
- {\getvalue{\@@XMLentity:#1}}
+%\def\expandedXMLentity#1%
+% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi}
+%
+%\unexpanded\def\getXMLentity#1%
+% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi}
+%
+%\def\expandedXMLentity#1%
+% {\csname\@@XMLentity:#1\endcsname}
+%
+%\unexpanded\def\getXMLentity#1%
+% {\csname\@@XMLentity:#1\endcsname}
+
+\newif\ifautoXMLentities % fall back on context commands
+
+\def\expandedXMLentity#1%
+ {\ifcsname\@@XMLentity:#1\endcsname \@EA \execXMLentity
+ \else\ifautoXMLentities \@EAEAEA \autoXMLentity
+ \else \@EAEAEA \crapXMLentity
+ \fi\fi{#1}}
+
+\def\execXMLentity#1%
+ {\csname\@@XMLentity:#1\endcsname}
+
+\def\crapXMLentity#1%
+ {\inframed[\c!offset=.1ex]{\tttf#1}}
+
+\def\autoXMLentity#1%
+ {\ifcsname#1\endcsname\csname#1\endcsname\fi}
-\unexpanded\def\getXMLentity#1%
- {\getvalue{\@@XMLentity:#1}}
+\unexpanded\def\getXMLentity{\expandedXMLentity}
\gdef\doifXMLentityelse#1#2#3%
- {\ifundefined{\@@XMLentity:#1}#3\else#2\fi}
+ {\ifcsname\@@XMLentity:#1\endcsname#2\else#3\fi}
-% \long\def\getXMLarguments#1#2%
-% {\dogetXMLarguments{#1}#2>}
-%
-% \long\def\dogetXMLarguments#1%
-% {\XMLtoks\emptytoks
-% \def\@@XMLclass{#1}%
-% \let\dodoparseXMLarguments\doparseXMLarguments
-% \doparseXMLarguments}
-%
-% \def\dosetXMLargument#1%
-% {\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}%
-% %\message{[\@@XMLname=#1]}%
-% \let\dodoparseXMLarguments\doparseXMLarguments
-% \dodoparseXMLarguments}
-
-% see \defineXML... commands:
+% see \defineXML... commands:
%
% [key=val] => \presetXMLarguments{element} => default key/vals
% [blabla] => \theXMLarguments{blabla} => user key/vals
@@ -496,78 +1039,217 @@
%
% <element key="val"> stored in case of [blabla] else set as \XMLpar
%
-% see m-steps for an example of usage
+% see m-steps for an example of usage
+
+\let\@@XMLmapmap\empty
+\newif\ifXMLnamespace
\long\def\getXMLarguments#1#2%
- {\dogetXMLarguments{#1}#2>}
+ {\XMLnamespacefalse
+ \dogetXMLarguments{#1}#2>}
+
+\let\dosetXMLattributeA\gobbleoneargument
+
+\def\dosetXMLattributeB#1%
+ {\ifx\@@XMLspac\originalXMLnamespace
+ \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname{#1}%
+ \fi}
+
+% \def\dosetXMLattributeC#1%
+% {\ifx\@@XMLspac\originalXMLnamespace
+% \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname{#1}%
+% \else
+% \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLspac:\@@XMLname\endcsname{#1}%
+% \fi}
+
+\def\dosetXMLattributeC%
+ {\@EA\def\csname\@@XMLvariable:\@@XMLclass\ifx\@@XMLspac
+ \originalXMLnamespace\else:\@@XMLspac\fi:\@@XMLname\endcsname}
+
+% \def\dosetXMLattributeD#1%
+% {\ifx\@@XMLspac\originalXMLnamespace
+% \@EA\def\csname\@@XMLvariable:\@@XMLclass:\currentXMLnamespace:\@@XMLname\endcsname{#1}%
+% \else
+% \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLspac:\@@XMLname\endcsname{#1}%
+% \fi}
+
+\def\dosetXMLattributeD%
+ {\@EA\def\csname\@@XMLvariable:\@@XMLclass:\ifx\@@XMLspac
+ \originalXMLnamespace\currentXMLnamespace\else\@@XMLspac\fi
+ :\@@XMLname\endcsname}
+
+\def\setXMLattributemode#1%
+ {\ifcase#1\relax
+ \let\dosetXMLattribute\dosetXMLattributeA
+ \or
+ \let\dosetXMLattribute\dosetXMLattributeB
+ \or
+ \let\dosetXMLattribute\dosetXMLattributeC
+ \or
+ \let\dosetXMLattribute\dosetXMLattributeD
+ \fi}
+
+\setXMLattributemode{2} % a reasonable default
+
+\let\@@XMLspac\empty % argumentnamespace
\long\def\dogetXMLarguments#1%
{\XMLtoks\emptytoks
\ifcsname\@@XMLmap:#1\endcsname
- \let\dosetXMLargument\dosetXMLargumentB
+ \let\dodosetXMLargument\dodosetXMLargumentB
\else
\def\@@XMLclass{#1}%
- \let\dosetXMLargument\dosetXMLargumentA
+ \let\dodosetXMLargument\dodosetXMLargumentA
\fi
\let\dodoparseXMLarguments\doparseXMLarguments
\doparseXMLarguments}
-\def\dosetXMLargumentA#1%
- {\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}%
+\long\def\doparseXMLarguments#1% space goes ok
+ {\if#1>%
+ \let\dodoparseXMLarguments\empty
+ \else\if#1=%
+ \edef\@@XMLname{\the\XMLtoks}%
+ \XMLtoks\emptytoks
+ \else\if#1"%
+ \let\dodoparseXMLarguments\dodoparseXMLargumentsD
+ \else\if#1'%
+ \let\dodoparseXMLarguments\dodoparseXMLargumentsS
+ \else\if#1:%
+ \XMLnamespacetrue
+ \edef\@@XMLspac{\the\XMLtoks}%
+ \XMLtoks\emptytoks
+ \else\if#1/%
+ \chardef\kindofXMLelement\emptyXMLtag
+ \else
+ \XMLtoks\@EA{\the\XMLtoks#1}%
+ \fi\fi\fi\fi\fi\fi
+ \dodoparseXMLarguments}
+
+\def\dodoparseXMLargumentsD#1"{\dosetXMLargument{#1}}
+\def\dodoparseXMLargumentsS#1'{\dosetXMLargument{#1}}
+
+\def\dosetXMLargument#1%
+ {\ifXMLnamespace
+ \ifx\@@XMLspac\@@XMLns
+ \checkXMLnamespaceattr{#1}% xmlns:\@@XMLname="#1"
+ \else
+ \dosetXMLattribute{#1}% some:\@@XMLname="#1"
+ \fi
+ \XMLnamespacefalse
+ \else\ifx\@@XMLname\@@XMLns
+ \checkXMLnamespaceattr{#1}% xmlns="#1"
+ \else
+ \dodosetXMLargument{#1}%
+ \fi\fi
\let\dodoparseXMLarguments\doparseXMLarguments
- %\message{[\@@XMLclass][\@@XMLname=#1]}\wait
\dodoparseXMLarguments}
-\def\dosetXMLargumentB#1%
- {\setevalue{\@@XMLmap:\@@XMLmapmap}%
- {\@EA\ifx\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty\else
- \csname\@@XMLmap:\@@XMLmapmap\endcsname,%
- \fi
- \@@XMLname=#1}%
+\def\dosetXMLargument#1% ugly alternative
+ {\ifXMLnamespace
+ \XMLnamespacefalse
+ \ifx\@@XMLspac\@@XMLns
+ \@EAEAEA\checkXMLnamespaceattr % xmlns:\@@XMLname="#1"
+ \else
+ \@EAEAEA\dosetXMLattribute % some:\@@XMLname="#1"
+ \fi
+ \else\ifx\@@XMLname\@@XMLns
+ \@EAEAEA\checkXMLnamespaceattr % xmlns="#1"
+ \else
+ \@EAEAEA\dodosetXMLargument
+ \fi\fi{#1}%
\let\dodoparseXMLarguments\doparseXMLarguments
- %\message{[\@@XMLprefix][\@@XMLname=#1]}\wait
\dodoparseXMLarguments}
+\def\dodosetXMLargumentA%
+ {\@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname}
+
+\def\dodosetXMLargumentB#1%
+ {\@EA\edef\csname\@@XMLmap:\@@XMLmapmap\endcsname
+ {\@EA\ifx\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty\else
+ \csname\@@XMLmap:\@@XMLmapmap\endcsname,%
+ \fi
+ \@@XMLname=#1}}
+
\appendtoks
- \resetXMLarguments\currentXMLelement
+ \resetXMLarguments{\rawXMLnamespace\rawXMLidentifier}%
\to \everyXMLelement
\def\resetXMLarguments#1%
{\ifcsname\@@XMLmap:#1\endcsname
- \@EA\let\@EA\@@XMLmapmap\csname\@@XMLmap:#1\endcsname
- \@EA\let\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty
- \fi}
+ \@EA\let\@EA\@@XMLmapmap\csname\@@XMLmap:#1\endcsname
+ \@EA\let\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty
+ \fi}
\def\theXMLarguments#1%
{\ifcsname\@@XMLmap:#1\endcsname\csname\@@XMLmap:#1\endcsname\fi}
-\long\def\doparseXMLarguments#1% space goes ok
- {\if#1>%
- \let\dodoparseXMLarguments\empty
- \else\if#1=%
- \edef\@@XMLname{\the\XMLtoks}%
- \XMLtoks\emptytoks
- \else\if#1"%
- \let\dodoparseXMLarguments\dodoparseXMLargumentsD
- \else\if#1'%
- \let\dodoparseXMLarguments\dodoparseXMLargumentsS
- \else\if#1/%
- \edef\currentXMLelement{\currentXMLelement/}%
- \else
- \@EA\XMLtoks\@EA{\the\XMLtoks#1}%
- \fi\fi\fi\fi\fi
- \dodoparseXMLarguments}
+\newtoks\globalscratchtoks
+
+\def\expandXMLvalue#1%
+ {\ifcsname#1\endcsname
+ \bgroup
+\enableXMLexpansion
+ \let\getXMLentity\expandedXMLentity
+ \expanded{\global\globalscratchtoks{\csname#1\endcsname}}%
+ \egroup
+ \@EA\edef\csname#1\endcsname{\the\globalscratchtoks}%
+ \fi}
+
+\def\expandTEXpar #1#2{\expandXMLvalue{#1\interfaced{#2}}}
+\def\expandXMLpar #1#2{\expandXMLvalue{\@@XMLvariable:#1:#2}}
+\def\expandXMLarguments#1{\expandXMLvalue{\@@XMLmap:#1}}
+
+%D \startbuffer[tex]
+%D \defineXMLsingular [fx:root]
+%D {\XMLNSpar{fx:root}{xml}{lang}{}
+%D \XMLpar{fx:root}{xml:lang}{}
+%D \starttabulate[||||]
+%D \HL
+%D \NC \bf mode \NC \bf call \NC \bf result \NC\NR
+%D \HL
+%D \NC 0\NC\asciistr{\XMLpar {fx:root} {crap} {}} \NC dirt \NC\NR
+%D \NC \NC\asciistr{\XMLpar {fx:root} {junk} {}} \NC \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {fx} {crap} {}}\NC \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {xml} {lang} {}}\NC \NC\NR
+%D \HL
+%D \NC 1\NC\asciistr{\XMLpar {fx:root} {crap} {}} \NC dirt \NC\NR
+%D \NC \NC\asciistr{\XMLpar {fx:root} {junk} {}} \NC junk \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {fx} {crap} {}}\NC \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {xml} {lang} {}}\NC \NC\NR
+%D \HL
+%D \NC 2\NC\asciistr{\XMLpar {fx:root} {crap} {}} \NC dirt \NC\NR
+%D \NC \NC\asciistr{\XMLpar {fx:root} {junk} {}} \NC junk \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {fx} {crap} {}}\NC \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {xml} {lang} {}}\NC en \NC\NR
+%D \HL
+%D \NC 3\NC\asciistr{\XMLpar {fx:root} {crap} {}} \NC dirt \NC\NR
+%D \NC \NC\asciistr{\XMLpar {fx:root} {junk} {}} \NC junk \NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {fx} {crap} {}}\NC rubish\NC\NR
+%D \NC \NC\asciistr{\XMLNSpar {fx:root} {xml} {lang} {}}\NC en \NC\NR
+%D \HL
+%D \stoptabulate}
+%D
+%D \remapXMLurlspace [http://www.w3.org/1999/XSL/Format] [fx]
+%D \stopbuffer
+%D
+%D \startbuffer[xml]
+%D <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+%D fo:crap="rubish"
+%D fo:junk="junk"
+%D xml:lang="en"
+%D crap="dirt" />
+%D \stopbuffer
+%D
+%D \typebuffer[tex] \processTEXbuffer[tex]
+%D \typebuffer[xml] \processXMLbuffer[xml]
-\def\dodoparseXMLargumentsD#1"{\dosetXMLargument{#1}}
-\def\dodoparseXMLargumentsS#1'{\dosetXMLargument{#1}}
-
%D The previous macros were the basic parser and their working
%D is left to the imagination of the reader. These macros
-%D will be improved.
+%D will be improved over time. We use rather low level
+%D definitions so that the mappings will run as fast as
+%D possible.
-\bgroup
-
-\catcode`<=\@@active
+\bgroup \catcode`<=\@@active
\long\gdef\dododefineXMLsingular#1#2%
{\long\setvalue{\@@XMLelement:#1/}{#2}}
@@ -580,30 +1262,76 @@
{\long\setvalue{\@@XMLelement:#1}{\groupedcommand{#2}{}\bgroup}%
\long\setvalue{\@@XMLelement:/#1}{\egroup}}
+%\long\gdef\dododefineXMLargument#1#2% watch the {} around ##1
+% {\long\setvalue{\@@XMLelement:#1/}{#2{}}%
+% \long\setvalue{\@@XMLelement:#1}##1</#1>{#2{##1}}}
+
\long\gdef\dododefineXMLargument#1#2% watch the {} around ##1
{\long\setvalue{\@@XMLelement:#1/}{#2{}}%
- \long\setvalue{\@@XMLelement:#1}##1</#1>{#2{##1}}}
+ \long\setvalue{\@@XMLelement:#1}{\redoXMLargument{#1}{#2}}}
+
+\long\gdef\redoXMLargument#1#2%
+ {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>{#2{##1}}%
+ \next}
+
+%\long\gdef\dododefineXMLignore#1%
+% {\long\setvalue{\@@XMLelement:#1/}{}%
+% \long\setvalue{\@@XMLelement:#1}##1</#1>{}}
\long\gdef\dododefineXMLignore#1%
{\long\setvalue{\@@XMLelement:#1/}{}%
- \long\setvalue{\@@XMLelement:#1}##1</#1>{}}
+ \long\setvalue{\@@XMLelement:#1}{\redoXMLignore{#1}}}
+
+\long\gdef\redoXMLignore#1%
+ {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>{}%
+ \next}
+
+%\long\gdef\dododefineXMLpickup#1#2#3%
+% {\long\setvalue{\@@XMLelement:#1/}{#2#3}%
+% \long\setvalue{\@@XMLelement:#1}##1</#1>{#2##1#3}}
\long\gdef\dododefineXMLpickup#1#2#3%
{\long\setvalue{\@@XMLelement:#1/}{#2#3}%
- \long\setvalue{\@@XMLelement:#1}##1</#1>{#2##1#3}}
+ \long\setvalue{\@@XMLelement:#1}{\redoXMLpickup{#1}{#2}{#3}}}
+
+\long\gdef\redoXMLpickup#1#2#3%
+ {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>{#2##1#3}%
+ \next}
\long\gdef\dododefineXMLenvironment#1#2#3%
- {\long\setvalue{\@@XMLelement:#1/}{#2#3}% % genereert evt relax
+ {\long\setvalue{\@@XMLelement:#1/}{#2#3}%
\long\setvalue{\@@XMLelement:#1}{#2}%
\long\setvalue{\@@XMLelement:/#1}{#3}}
-\long\gdef\dododefineXMLpush#1%
- {\long\setvalue{\@@XMLelement:#1/}{\long\setvalue{\@@XMLdata:#1}{}}%
- \long\setvalue{\@@XMLelement:#1}##1</#1>{\long\setvalue{\@@XMLdata:#1}{##1}}}
+%\long\gdef\dododefineXMLsave#1%
+% {\letvalue{\@@XMLdata:#1}\longempty
+% \long\setvalue{\@@XMLelement:#1/}{\long\setvalue{\@@XMLdata:#1}{}}%
+% \long\setvalue{\@@XMLelement:#1}##1</#1>{\long\setvalue{\@@XMLdata:#1}{##1}}}
-\long\gdef\dododefineXMLenvironmentpush#1#2#3%
- {\long\setvalue{\@@XMLelement:#1/}{#2\long\setvalue{\@@XMLdata:#1}{}#3}%
- \long\setvalue{\@@XMLelement:#1}##1</#1>{#2\long\setvalue{\@@XMLdata:#1}{##1}#3}}
+\long\gdef\dododefineXMLsave#1%
+ {\letvalue{\@@XMLdata:#1}\longempty
+ \long\setvalue{\@@XMLelement:#1/}{\long\setvalue{\@@XMLdata:#1}{}}%
+ \long\setvalue{\@@XMLelement:#1}{\redoXMLsave{#1}}}
+
+\gdef\redoXMLsave#1%
+ {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>%
+ {\long\@EA\def\csname\@@XMLdata:#1\endcsname{##1}}%
+ \next}
+
+%\long\gdef\dododefineXMLenvironmentsave#1#2#3%
+% {\letvalue{\@@XMLdata:#1}\longempty
+% \long\setvalue{\@@XMLelement:#1/}{#2\long\setvalue{\@@XMLdata:#1}{}#3}%
+% \long\setvalue{\@@XMLelement:#1}##1</#1>{#2\long\setvalue{\@@XMLdata:#1}{##1}#3}}
+
+\long\gdef\dododefineXMLenvironmentsave#1#2#3%
+ {\letvalue{\@@XMLdata:#1}\longempty
+ \long\setvalue{\@@XMLelement:#1/}{#2\long\setvalue{\@@XMLdata:#1}{}#3}%
+ \long\setvalue{\@@XMLelement:#1}{\redoXMLenvironmentsave{#1}{#2}{#3}}}
+
+\gdef\redoXMLenvironmentsave#1#2#3%
+ {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>%
+ {#2\long\@EA\def\csname\@@XMLdata:#1\endcsname{##1}#3}%
+ \next}
\long\gdef\dododefineXMLprocess#1%
{\long\setvalue{\@@XMLelement:#1/}{}%
@@ -627,11 +1355,16 @@
\def\defineXMLignore {\dotripleempty\dodefineXMLignore}
\def\defineXMLpickup {\dotripleempty\dodefineXMLpickup}
\def\defineXMLenvironment {\dotripleempty\dodefineXMLenvironment}
-\def\defineXMLpush {\dotripleempty\dodefineXMLpush}
-\def\defineXMLenvironmentpush{\dotripleempty\dodefineXMLenvironmentpush}
+\def\defineXMLsave {\dotripleempty\dodefineXMLsave}
+\def\defineXMLenvironmentsave{\dotripleempty\dodefineXMLenvironmentsave}
\def\defineXMLprocess {\dotripleempty\dodefineXMLprocess}
-% goes for all types
+% push is (not yet) a real push, so:
+
+\def\defineXMLpush {\dotripleempty\dodefineXMLsave}
+\def\defineXMLenvironmentpush{\dotripleempty\dodefineXMLenvironmentsave}
+
+% goes for all types
\def\defineXMLnested {\dotripleempty\dodefineXMLnestedenvironment}
\def\defineXMLnestedenvironment{\dotripleempty\dodefineXMLnestedenvironment}
@@ -658,11 +1391,11 @@
\long\def\dodefineXMLenvironment[#1][#2][#3]#4#5%
{\defineXMLmethod\dododefineXMLenvironment{#1}{#2}{#3}{#4}{#5}}
-\long\def\dodefineXMLpush[#1][#2][#3]%
- {\defineXMLmethod\dododefineXMLpush{#1}{#2}{#3}{}{}}
+\long\def\dodefineXMLsave[#1][#2][#3]%
+ {\defineXMLmethod\dododefineXMLsave{#1}{#2}{#3}{}{}}
-\long\def\dodefineXMLenvironmentpush[#1][#2][#3]#4#5%
- {\defineXMLmethod\dododefineXMLenvironmentpush{#1}{#2}{#3}{#4}{#5}}
+\long\def\dodefineXMLenvironmentsave[#1][#2][#3]#4#5%
+ {\defineXMLmethod\dododefineXMLenvironmentsave{#1}{#2}{#3}{#4}{#5}}
\long\def\dodefineXMLprocess[#1][#2][#3]%
{\defineXMLmethod\dododefineXMLprocess{#1}{#2}{#3}{}{}}
@@ -678,105 +1411,151 @@
% [blabla] [key=val] => \presetXMLarguments{element} => default key/vals
% \theXMLarguments{blabla} => user key/vals
-\long\def\defineXMLmethod#1#2#3#4#5#6% command element [map] [parlst] begin end
+% command element [map] [parlst] begin end
+
+\long\def\defineXMLmethod#1#2#3#4#5#6%
{\ifsecondargument
- \setXMLarguments{#2}{#3}{#4}%
- \fi
- \ifignoreXMLcase
- \lowercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}%
- \uppercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}%
+ \setXMLarguments{#2}{#3}{#4}%
\else
- #1{#2}{#5}{#6}%
- \fi}
+ \resetXMLarguments{#2}% new
+ \fi
+ #1{#2}{#5}{#6}}
+
+%D Arguments (attributes) \unknown
-\def\setXMLarguments#1#2#3% element [tag] settings
+\long\def\setXMLarguments#1#2#3% element [tag] settings
{\doifassignmentelse{#2}
- {\setvalue{\@@XMLpars:#1}{\getrawparameters[\@@XMLvariable:#1:][#2]}}
- {\setvalue{\@@XMLmap :#1}{#2}% later we can init vars by this name
- \doifsomething{#3}{\setvalue{\@@XMLpars:#1}{\getrawparameters[#2][#3]}}}}
+ {\long\setvalue{\@@XMLpars:#1}{\getrawparameters[\@@XMLvariable:#1:][#2]}}
+ {\long\setvalue{\@@XMLmap :#1}{#2}% later we can init vars by this name
+ \doifsomething{#3}{\long\setvalue{\@@XMLpars:#1}{\getrawparameters[#2][#3]}}}}
\def\presetXMLarguments#1%
- {\getvalue{\@@XMLpars:#1}}
+ {\csname\@@XMLpars:\rawXMLnamespace#1\endcsname} % == \getvalue{}
\prependtoks
- \presetXMLarguments\currentXMLelement
+ \presetXMLarguments\rawXMLidentifier
\to \everyXMLelement
-\def\doifXMLdataelse#1#2#3% % \relax too, so no etex
-% wrong
-% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
-% slow
-% {\ifundefined{\@@XMLdata:#1}%
-% etex
- {\unless\ifcsname\@@XMLdata:#1\endcsname
- #3%
- \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty
- #3%
- \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
- #3%
+\long\def\longempty{}
+\long\def\longspace{ }
+
+\def\doifelseXMLdata#1% always empty at start [gets a long assignment]
+ {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty
+ \expandafter\secondoftwoarguments
\else
- #2%
- \fi\fi\fi}
+ \expandafter\firstoftwoarguments
+ \fi}
-\def\XMLpop#1% one level
-% wrong
-% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax\else
-% \csname\@@XMLdata:#1\endcsname
-% \fi}
-% slow, hm was not commented
-% {\ifundefined{\@@XMLdata:#1}\else\getvalue{\@@XMLdata:#1}\fi}
-% etex
- {\ifcsname\@@XMLdata:#1\endcsname\csname\@@XMLdata:#1\endcsname\fi}
-
-\def\XMLpopdata#1% see m-steps for usage
- {\unless\ifcsname\@@XMLdata:#1\endcsname
- \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty
- \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
+\def\doifXMLdata#1% always empty at start [gets a long assignment]
+ {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty
+ \expandafter\gobbleoneargument
\else
- \@EA\@EA\@EA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
- \fi\fi\fi}
+ \expandafter\firstofoneargument
+ \fi}
+
+\let\doifXMLdataelse\doifelseXMLdata
+
+\def\doifelseXMLempty#1%
+ {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty
+ \expandafter\firstoftwoarguments
+ \else\@EA\ifx\csname\@@XMLdata:#1\endcsname\longspace
+ \expandthree\firstoftwoarguments
+ \else
+ \expandthree\secondoftwoarguments
+ \fi\fi}
-\def\XMLappend#1#2%
- {\edef\!!stringa{\@@XMLdata:#1}%
- \doifXMLdataelse{#1}%
- {\@EA\@EA\@EA\setvalue\@EA\@EA\@EA\!!stringa\@EA\@EA\@EA
- {\csname\!!stringa\endcsname#2}}
- {\setvalue\!!stringa{#2}}}
+% test case:
+%
+% \defineXMLenvironmentsave[test]
+% {}
+% {\message{[\XMLflush{test}]}
+% \message{\doifelseXMLdata {test}{}{no }data}
+% \message{/}
+% \message{\doifelseXMLempty{test}{}{not }empty}
+% \wait}
+%
+% \startXMLdata
+% <test>xxx</test>
+% <test></test>
+% <test> </test>
+% <test> </test>
+% <test> </test>
+% <test> x </test>
+% \stopXMLdata
+
+\def\XMLflush#1% one level
+ {\csname\@@XMLdata:#1\endcsname}
+
+\def\XMLflushdata#1% see m-steps for usage
+ {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty\else
+ \@EAEAEA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
+ \fi}
-\def\XMLprepend#1#2%
- {\edef\!!stringa{\@@XMLdata:#1}%
- \doifXMLdataelse{#1}%
- {\@EA\@EA\@EA\setvalue\@EA\@EA\@EA\!!stringa\@EA\@EA\@EA
- {#2\csname\!!stringa\endcsname}}
- {\setvalue\!!stringa{#2}}}
+\let\XMLpop \XMLflush
+
+\let\XMLpopdata\XMLflushdata
+
+\def\XMLappend#1#2% let to empty expands to nothing -)
+ {\long\@EA\edef\csname\@@XMLdata:#1\endcsname
+ {\csname\@@XMLdata:#1\endcsname#2}}
+
+\def\XMLprepend#1#2% let to empty expands to nothing -)
+ {\long\@EA\edef\csname\@@XMLdata:#1\endcsname
+ {#2\csname\@@XMLdata:#1\endcsname}}
\def\XMLerase#1%
- {\letvalue{\@@XMLdata:#1}\empty}
+ {\@EA\let\csname\@@XMLdata:#1\endcsname\longempty}
\def\XMLassign#1%
- {\setvalue{\@@XMLdata:#1}}
+ {\long\@EA\def\csname\@@XMLdata:#1\endcsname}
+
+\def\dontparseXMLelement#1>{}
+
+\def\simplifyXMLelements{\let\parseXMLelement\dontparseXMLelement}
\def\defXMLstring#1#2%
-% {\@EA\convertcommand\csname\@@XMLdata:#2\endcsname\to#1}
{\bgroup
+ \enableXMLexpansion
+ \simplifyXMLelements
\let\getXMLentity\firstofoneargument
+ \XMLrawentitiestrue
\xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}%
- \egroup
- \@EA\convertcommand\@@XML@@string\to#1}
-
+ \egroup
+ \convertcommand\@@XML@@string\to#1}
+
+\def\defXMLclean#1#2%
+ {\bgroup
+ \enableXMLexpansion
+ \simplifyXMLelements
+ \simplifyXMLentities
+ \let\getXMLentity\expandedXMLentity % should this go in \simplify ?
+ \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}%
+ \egroup
+ \convertcommand\@@XML@@string\to#1}
+
\def\XMLshow#1%
- {\showvalue{\@@XMLdata:#1\endcsname}}
+ {\showvalue{\@@XMLdata:#1}}
-\def\XMLunspace#1%
- {\ifcsname\@@XMLdata:#1\endcsname
- \setevalue{\@@XMLdata:#1}%
- {\@EA\@EA\@EA\dounspaced\csname\@@XMLdata:#1\endcsname\end}%
+\def\XMLunspace#1% kan sneller
+ {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty\else
+ \long\@EA\edef\csname\@@XMLdata:#1\csname
+ {\@EAEAEA\dounspaced\csname\@@XMLdata:#1\endcsname\end}%
\fi}
+\chardef\asciispacecode=32
+
\def\defXMLlowerclean#1% lowercase ! evt tzt upper too
{\bgroup
- \lccode`\#=32\lccode`\$=32\lccode`\%=32\lccode`\\=32\lccode`\^=32
- \lccode`\_=32\lccode`\{=32\lccode`\}=32\lccode`\|=32\lccode`\~=32
+ \lccode`\#\asciispacecode
+ \lccode`\$\asciispacecode
+ \lccode`\%\asciispacecode
+ \lccode`\\\asciispacecode
+ \lccode`\^\asciispacecode
+ \lccode`\_\asciispacecode
+ \lccode`\{\asciispacecode
+ \lccode`\}\asciispacecode
+ \lccode`\|\asciispacecode
+ \lccode`\~\asciispacecode
\@EA\lowercase\@EA{\@EA\xdef\@EA#1\@EA{#1}}%
\egroup}
@@ -791,36 +1570,17 @@
\def\mapXMLvalue#1#2#3% td align center -> middle
{\setvalue{\@@XMLvalue:#1:#2:#3}}
-% \def\XMLvar#1#2#3% td align center
-% {\ifundefined{\@@XMLvariable:#1:#2}%
-% \XMLval{#1}{#2}{#3}%
-% \else
-% \XMLval{#1}{#2}{\getvalue{\@@XMLvariable:#1:#2}}%
-% \fi}
-%
-% \def\XMLval#1#2#3%
-% {\ifundefined{\@@XMLvalue:#1:#2}%
-% #3%
-% \else
-% \getvalue{\@@XMLvalue:#1:#2}%
-% \fi}
-%
-% \def\XMLpar#1#2#3%
-% {\ifundefined{\@@XMLvariable:#1:#2}%
-% #3%
-% \else
-% \getvalue{\@@XMLvariable:#1:#2}%
-% \fi}
-%
-% speedup
-
\def\XMLvar#1#2#3% td align center
{\ifcsname\@@XMLvariable:#1:#2\endcsname
\XMLval{#1}{#2}{\csname\@@XMLvariable:#1:#2\endcsname}%
\else
- \XMLval{#1}{#2}{#3}% evt inline code
+ \XMLval{#1}{#2}{#3}% evt inline code
\fi}
+% \def\XMLvar#1#2#3% td align center
+% {\XMLval{#1}{#2}{\ifcsname\@@XMLvariable:#1:#2\endcsname
+% \csname\@@XMLvariable:#1:#2\endcsname\else#3\fi}}
+
\def\XMLval#1#2#3%
{\ifcsname\@@XMLvalue:#1:#2\endcsname
\csname\@@XMLvalue:#1:#2\endcsname
@@ -835,76 +1595,166 @@
#3%
\fi}
-% so far for speedup
+\def\XMLNSpar#1#2#3#4% element namespace name default
+ {\ifcsname\@@XMLvariable:#1:#2:#3\endcsname
+ \csname\@@XMLvariable:#1:#2:#3\endcsname
+ \else
+ #4%
+ \fi}
+
+\def\setXMLpar#1#2%
+ {\@EA\def\csname\@@XMLvariable:#1:#2\endcsname}
+
+\def\TEXpar#1#2%
+ {\csname#1\interfaced{#2}\endcsname}
-\defineXMLsingular [begingroup] {\begingroup}
-\defineXMLsingular [endgroup] {\endgroup}
+\let\texXMLpar\TEXpar % soon obsolete
+
+\let\XMLtex\TEXpar
+
+% handy one
+
+\def\XMLtyp#1#2#3%
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \@EA\convertcommand\csname\@@XMLvariable:#1:#2\endcsname\to\ascii
+ \else
+ \convertargument#3\to\ascii
+ \fi
+ \ascii}
+
+\defineXMLsingular [begingroup] {\begingroup}
+\defineXMLsingular [endgroup] {\endgroup}
+\defineXMLsingular [gobblespacetokens] {\gobblespacetokens}
+\defineXMLsingular [disableXML] {\disableXML}
\def\XMLstr#1%
{{\enableXML\scantokens{#1}\unskip}}
-\def\XMLstr#1% test
- {\scantokens{\begingroup\enableXML#1<endgroup/>}}
-
-%\def\XMLstrpar#1#2#3%
-% {{\enableXML
-% \ifundefined{\@@XMLvariable:#1:#2}%
-% \scantokens{#3}%
-% \else
-% \scantokens\@EA\@EA\@EA
-% {\csname\@@XMLvariable:#1:#2\endcsname}\unskip
-% \fi}}
+\def\XMLstr#1% test
+ {\scantokens{\begingroup\enableXML#1<endgroup/>\gobblespacetokens}}
-\def\XMLstrpar#1#2#3% test
- {\ifundefined{\@@XMLvariable:#1:#2}%
+\def\XMLstrpar#1#2#3% test
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \scantokens\@EAEAEA{\@EA\begingroup\@EA\enableXML
+ \csname\@@XMLvariable:#1:#2\endcsname<endgroup/>}%
+ \else
\scantokens{\begingroup\enableXML#3<endgroup/>}%
+ \fi}
+
+\def\doifXMLvarelse#1#2% geen etex, \relax too
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+%\expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\relax
+% \message{#1 #2 -> relax}\wait
+%\fi
+ \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty
+ \@EAEAEA\secondoftwoarguments
+ \else
+ \@EAEAEA\firstoftwoarguments
+ \fi
\else
- \scantokens\@EA\@EA\@EA{\@EA\begingroup\@EA\enableXML
- \csname\@@XMLvariable:#1:#2\endcsname<endgroup/>}%
+ \@EA\secondoftwoarguments
\fi}
-\def\doifXMLvarelse#1#2#3#4% geen etex, \relax too
- {\expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\relax#4\else
- \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty#4\else#3\fi\fi}
+\def\doifXMLvar#1#2% geen etex, \relax too
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty
+ \@EAEAEA\gobbleoneargument
+ \else
+ \@EAEAEA\firstofoneargument
+ \fi
+ \else
+ \@EA\gobbleoneargument
+ \fi}
-\def\doifXMLvalelse#1#2#3#4% geen etex, \relax too
- {\expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\relax#4\else
- \expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\empty#4\else#3\fi\fi}
+\def\doifXMLvalelse#1#2% geen etex, \relax too
+ {\ifcsname\@@XMLvalue:#1:#2\endcsname
+ \expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\empty
+ \@EAEAEA\secondoftwoarguments
+ \else
+ \@EAEAEA\firstoftwoarguments
+ \fi
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
\let\doifXMLparelse\doifXMLvarelse
+\let\doifXMLpar \doifXMLvar
+
+\bgroup \catcode`<=\@@active
-\def\dogotoXML%
- {\ifx\nexttoken<%
- \expandafter\nexttoken
- \else
- \expandafter\gotoXML
- \fi}
+\long\gdef\ignoreuntilXMLelement#1<{<}
+\long\gdef\grabuntilXMLelement #1<\to#2{\def#2{#1}<}
-\def\gotoXML%
- {\afterassignment\dogotoXML\let\nexttoken=}
+\egroup
-%D Saves tokens and typing.
+%D Saves tokens and typing.
-\def\XMLownvar {\XMLvar \currentXMLelement}
-\def\XMLownval {\XMLval \currentXMLelement}
-\def\XMLownpar {\XMLpar \currentXMLelement}
-\def\XMLownstrpar {\XMLstrpar \currentXMLelement}
-\def\doifXMLownvarelse{\doifXMLvarelse\currentXMLelement}
-\def\doifXMLownvalelse{\doifXMLvalelse\currentXMLelement}
-\def\doifXMLownparelse{\doifXMLparelse\currentXMLelement}
+\def\XMLownvar {\XMLvar {\rawXMLnamespace\rawXMLidentifier}}
+\def\XMLownval {\XMLval {\rawXMLnamespace\rawXMLidentifier}}
+\def\XMLownpar {\XMLpar {\rawXMLnamespace\rawXMLidentifier}}
+\def\XMLownstrpar {\XMLstrpar {\rawXMLnamespace\rawXMLidentifier}}
+\def\doifXMLownvarelse{\doifXMLvarelse{\rawXMLnamespace\rawXMLidentifier}}
+\def\doifXMLownvalelse{\doifXMLvalelse{\rawXMLnamespace\rawXMLidentifier}}
+\def\doifXMLownparelse{\doifXMLparelse{\rawXMLnamespace\rawXMLidentifier}}
+
+\def\ownXMLelement{\rawXMLnamespace\rawXMLidentifier}
-%D
+\def\XMLop#1% ownpar
+ {\csname\@@XMLvariable:\ownXMLelement:#1\endcsname}
+
+\def\XMLtp#1% texpar
+ {\csname\@@XMLmapmap\interfaced{#1}\endcsname}
+
+\def\doifelseXMLop#1{\doifelse{\XMLop{#1}}}
+\def\doifXMLop #1{\doif {\XMLop{#1}}}
+\def\doifnotXMLop #1{\doifnot {\XMLop{#1}}}
+
+\def\doifelsenothingXMLop#1{\doifelsenothing{\XMLop{#1}}}
+\def\doifsomethingXMLop #1{\doifsomething {\XMLop{#1}}}
+\def\doifnothingXMLop #1{\doifnothing {\XMLop{#1}}}
-\long\def\startXMLcode[#1] #2 \stopXMLcode
- {\setgvalue{\@@XMLcode:#1}{\startXMLdata#2\stopXMLdata}}
+\def\doifelseXMLtp#1{\doifelse{\XMLtp{#1}}}
+\def\doifXMLtp #1{\doif {\XMLtp{#1}}}
+\def\doifnotXMLtp #1{\doifnot {\XMLtp{#1}}}
+
+\def\doifelsenothingXMLtp#1{\doifelsenothing{\XMLtp{#1}}}
+\def\doifsomethingXMLtp #1{\doifsomething {\XMLtp{#1}}}
+\def\doifnothingXMLtp #1{\doifnothing {\XMLtp{#1}}}
+
+\def\XMLflushself{\csname\@@XMLdata:\ownXMLelement\endcsname}
+
+\def\XMLta {\theXMLarguments\@@XMLmapmap}
+\def\getXMLta {\expanded{\getparameters[\@@XMLmapmap][\XMLta]}}
+\def\expandXMLta{\expandXMLarguments\@@XMLmapmap}
+\def\expandXMLtp{\expandTEXpar\@@XMLmapmap} % #1
+
+\def\defXMLop#1#2{\@EA\let\@EA#1\csname\@@XMLvariable:\ownXMLelement:#2\endcsname}
+\def\defXMLtp#1#2{\@EA\let\@EA#1\csname\@@XMLmapmap\interfaced{#2}\endcsname}
+
+%D ...
+
+\def\protectXMLdata
+ {\catcode`\^^I\@@space
+ \catcode`\^^M\@@space
+ \catcode`\^^L\@@space
+ \catcode`\#\@@other}
+
+\long\def\startXMLcode
+ {\begingroup
+ \protectXMLdata
+ \dostartXMLcode}
+
+\long\def\dostartXMLcode[#1] #2 \stopXMLcode
+ {\@EA\gdef\csname\@@XMLcode:#1\endcsname{\startXMLdata#2\stopXMLdata}%
+ \endgroup}
\def\getXMLcode[#1]% \expandXMLcode
- {\getvalue{\@@XMLcode:#1}}
+ {\csname\@@XMLcode:#1\endcsname}
% \long\def\startXMLdata#1\stopXMLdata%
% {\begingroup\enableXML\scantokens{#1}\endgroup}
%
-% \defineXMLentity[tex-backslash] {\catchXMLpar}
+% \defineXMLentity[tex-backslash] {\catchXMLpar}
%
% \def\catchXMLpar#1#2#3
% {\if#1p\if#2a\if#3r\ifmmode\else\endgraf\fi
@@ -912,25 +1762,38 @@
\long\def\startXMLdata
{\begingroup
- \catcode`\^^I=\@@space
- \catcode`\^^M=\@@space
- \catcode`\^^L=\@@space
+ \protectXMLdata
\dostartXMLdata}
-
-% \long\def\dostartXMLdata#1\stopXMLdata
-% {\enableXML\scantokens{#1}\endgroup}
\long\def\dostartXMLdata#1\stopXMLdata
- {\enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi\endgroup}
+ {\enableXML\scantokens{#1<gobblespacetokens/>}%
+ \endgroup
+ \ifhmode\unskip\unskip\fi}
+
+% suboptimal:
+%
+% \unexpanded\def\XMLdata#1% % \unexpanded added 22/5/2001
+% {\begingroup
+% \enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi
+% \endgroup}
+%
+% better but does not work in tables:
+%
+% \unexpanded\def\XMLdata#1% % grouping changed 20/5/2001
+% {\scantokens{\begingroup\enableXML#1<endgroup/>\gobblespacetokens}}
+%
+% currently:
-\unexpanded\def\XMLdata#1% % \unexpanded added 22/5/2001
+\unexpanded\def\XMLdata % # safe
{\begingroup
- \enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi
- \endgroup}
+ \protectXMLdata
+ \doXMLdata}
+
+\def\doXMLdata#1%
+ {\enableXML
+ \scantokens{#1<gobblespacetokens/>}%
+ \endgroup}
-\unexpanded\def\XMLdata#1% % grouping changed 20/5/2001
- {\scantokens{\begingroup\enableXML#1<endgroup/>}}
-
%D
\def\bXMLs{\ifignoreXMLspaces\ignorespaces\fi}
@@ -969,17 +1832,6 @@
\def\processXMLfile #1{\enableXML\processfile{#1}}
\def\processXMLfilegrouped#1{{\enableXML\processfile{#1}\relax\ifmmode\else\par\fi}}
-% partially defined here
-
-\fetchruntimecommand\showXMLfile {\f!xtagprefix\s!run}
-\fetchruntimecommand\showXMLbuffer{\f!xtagprefix\s!run}
-
-\fetchruntimecommand\showXMLtxt {\f!xtagprefix\s!run}
-\fetchruntimecommand\showXMLpar {\f!xtagprefix\s!run}
-\fetchruntimecommand\showXMLlin {\f!xtagprefix\s!run}
-\fetchruntimecommand\showXMLwrd {\f!xtagprefix\s!run}
-\fetchruntimecommand\showXMLemp {\f!xtagprefix\s!run}
-
%D \type
%D {processXMLbuffer}
%D
@@ -1003,6 +1855,8 @@
%D Loading specific modules takes place with \type
%D {\useXMLfilters}.
+% todo: flag
+
\def\useXMLfilter[#1]%
{\processcommalist[#1]\douseXMLfilter}
@@ -1018,141 +1872,112 @@
%D Temporarily here.
\newtoks\groupedtoks
+\newif\ifcollectXMLgrouped
-\bgroup
-
-\catcode`\<=\@@active
-
-\long\unexpanded\gdef\getXMLgrouped#1#2#3%
- {\groupedtoks\emptytoks
- \convertargument<#1>\to\xxascii
- \convertargument<#1 \to\yyascii
- \newcounter\groupedlevel
- \long\def\dogetgrouped##1</#1>%
- {\appendtoks##1\to\groupedtoks
- \convertargument##1\to\ascii
- \doloop
- {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\xxascii\to\ascii
- \ifx\ascii\empty
- \exitloop
- \else
- \increment\groupedlevel
- \fi}%
- \convertargument##1\to\ascii
- \doloop
- {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\yyascii\to\ascii
- \ifx\ascii\empty
- \exitloop
- \else
- \increment\groupedlevel
- \fi}%
- \ifnum\groupedlevel>0
- \decrement\groupedlevel
- \appendtoks</#1>\to\groupedtoks
- \else
- \edef\dogetgrouped{\noexpand#2\the\groupedtoks\noexpand#3}%
- \fi
- \dogetgrouped}%
- \dogetgrouped}
-
-%D Cleaner but hardly faster unless big strings are passed.
-
-\long\gdef\docountXMLgrouped#1\end#2\end
- {\long\def\dosplitstring##1#2##2@@##3\end%
- {\def\ascii{##2}%
- \ifx\ascii\empty \else
- \advance\scratchcounter 1
- \dosplitstring##2@@#2@@\end
- \fi}%
- \dosplitstring#1@@#2@@\end}
-
-\long\unexpanded\gdef\getXMLgrouped#1#2#3%
- {\groupedtoks\emptytoks
- \scratchcounter=0
- \long\def\dogetgrouped##1</#1>%
- {\appendtoks##1\to\groupedtoks
- \docountXMLgrouped##1\end<#1>\end
- \docountXMLgrouped##1\end<#1 \end
- \ifcase\scratchcounter
- \def\dogetgrouped{\@EA#2\the\groupedtoks#3}%
- \else
- \advance\scratchcounter -1
- \appendtoks</#1>\to\groupedtoks
- \fi
- \dogetgrouped}%
- \dogetgrouped}
+\bgroup \catcode`\<=\@@active
-%D More versatile.
+\newtoks\XMLgtoks
\long\unexpanded\gdef\getXMLgroupedenvironment#1#2#3%
- {\def\dodogetgrouped{\@EA#2\the\groupedtoks#3}%
+ {\collectXMLgroupedtrue
+ \XMLgtoks{#2}%
+ \long\def\dodogetgrouped{\@EA\the\@EA\XMLgtoks\the\groupedtoks#3}%
\getXMLgrouped{#1}}
\long\unexpanded\gdef\getXMLgroupedargument#1#2%
- {\def\dodogetgrouped{\@EA#2\@EA{\the\groupedtoks}}%
+ {\collectXMLgroupedtrue
+ \XMLgtoks{#2}%
+ \long\def\dodogetgrouped{\@EA\the\@EA\XMLgtoks\@EA{\the\groupedtoks}}%
+ \getXMLgrouped{#1}}
+
+\long\unexpanded\gdef\getXMLgroupedignore#1%
+ {\collectXMLgroupedfalse
+ \let\dodogetgrouped\relax
\getXMLgrouped{#1}}
-\long\unexpanded\gdef\getXMLgrouped#1%
+%\long\gdef\docountXMLgrouped#1\end#2\end % @@ => \relax\relax
+% {\long\def\dosplitstring##1#1##2@@##3\end%
+% {\def\ascii{##2}%
+% \ifx\ascii\empty \else
+% \advance\scratchcounter 1
+% \dosplitstring##2@@#1@@\end
+% \fi}%
+% \dosplitstring#2@@#1@@\end}
+
+\long\gdef\docountXMLgrouped#1\end#2\end % 1 relax is enough since it's
+ {\long\def\dosplitstring##1#1##2\relax\relax##3\end % another regime
+ {\def\ascii{##2}%
+ \ifx\ascii\empty \else
+ \advance\scratchcounter \plusone
+ \dosplitstring##2\relax\relax#1\relax\relax\end
+ \fi}%
+ \dosplitstring#2\relax\relax#1\relax\relax\end}
+
+\long\unexpanded\gdef\getXMLgrouped#1% #1 kan weg % klopt dit nu?
{\groupedtoks\emptytoks
\scratchcounter=0
- \long\def\dogetgrouped##1</#1>%
- {\appendtoks##1\to\groupedtoks
- \docountXMLgrouped##1\end<#1>\end
- \docountXMLgrouped##1\end<#1 \end
+ \edef\theXMLnamespace
+ {\ifx\originalXMLnamespace\empty\else\originalXMLnamespace:\fi
+ \currentXMLidentifier}%
+ \expanded{\long\noexpand\def\noexpand\dogetgrouped####1\noexpand</\currentXMLelement>}%
+ {\ifcollectXMLgrouped\appendtoks##1\to\groupedtoks\fi
+ \@EA\docountXMLgrouped\@EA<\theXMLnamespace>\end##1\end
+ \@EAEAEA\docountXMLgrouped\@EA\@EA\@EA<\@EA\theXMLnamespace\space \end##1\end
\ifcase\scratchcounter
\let\dogetgrouped\dodogetgrouped
\else
- \advance\scratchcounter -1
- \appendtoks</#1>\to\groupedtoks
+ \advance\scratchcounter \minusone
+ \ifcollectXMLgrouped\@EA\appendtoks\@EA<\@EA/\currentXMLelement>\to\groupedtoks\fi
\fi
\dogetgrouped}%
\dogetgrouped}
\egroup
-% {pre}{pos}{before}{after}
-%
-%\unexpanded\def\getgrouped#1#2#3#4%
-% {\groupedtoks\emptytoks
-% \convertargument#1\to\xxascii
-% \newcounter\groupedlevel
-% \def\dogetgrouped##1#2%
-% {\appendtoks##1\to\groupedtoks
-% \convertargument##1\to\ascii
-% \doloop
-% {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\xxascii\to\ascii
-% \ifx\ascii\empty
-% \exitloop
-% \else
-% \increment\groupedlevel
-% \fi}%
-% \ifnum\groupedlevel>0
-% \decrement\groupedlevel
-% \appendtoks#2\to\groupedtoks
-% \else
-% \edef\dogetgrouped{\noexpand#3\the\groupedtoks\noexpand#4}%
-% \fi
-% \dogetgrouped}%
-% \dogetgrouped}
-
% interesting and fully expandable
-\def\XMLifequalelse#1#2#3#4#5%
- {\ifundefined{\@@XMLvariable:#1:#2}%
- #5%
+\def\XMLifequalelse#1#2#3%
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \@EAEAEA\@@ifequal\csname\@@XMLvariable:#1:#2\endcsname\relax\@@and#3\relax\@@then
\else
- \@EA\@EA\@EA\@@ifequal\csname\@@XMLvariable:#1:#2\endcsname
- \relax\@@and#3\relax\@@then#4\@@else#5\@@fi
+ \@EA\secondoftwoarguments
\fi}
-\def\expifequalelse#1#2#3#4%
- {\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then#3\@@else#4\@@fi}
+\def\XMLownifequalelse#1#2%
+ {\@EAEAEA\@@ifequal\csname\@@XMLvariable:\ownXMLelement:#1\endcsname\relax\@@and#2\relax\@@then}
+
+\def\XMLyes#1{\XMLownifequalelse{#1}{yes}{#1}{}}
-\def\@@ifequal#1#2\@@and#3#4\@@then#5\@@else#6\@@fi%
+\def\expifequalelse#1#2%
+ {\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then}
+
+\def\@@ifequal#1#2\@@and#3%
{\ifx#1\relax
- \ifx#3\relax#5\else#6\fi
+ \ifx#3\relax
+ \@EAEAEA\@@if@@equal@@true
+ \else
+ \@EAEAEA\@@if@@equal@@false
+ \fi
\else
- \ifx#3\relax#6\else\@@ifequal#2\@@and#4\@@then#5\@@else#6\@@fi\fi
- \fi}
+ \ifx#3\relax
+ \@EAEAEAEAEAEA\@@if@@equal@@false
+ \else\ifx#1#3%
+ % go on
+ \else
+ \@EAEAEAEAEAEA\@@if@@equal@@false
+ \fi\fi
+ \fi
+ \@@ifequal#2\@@and}
+\long\def\@@if@@equal@@true #1\@@then#2#3{#2}
+\long\def\@@if@@equal@@false#1\@@then#2#3{#3}
+
+%D new stuff :
+
+\def\partialexpanded#1%
+ {\let\notexpanded\noexpand
+ \edef\@@expanded{\noexpand#1}%
+ \let\notexpanded\empty
+ \@@expanded}
+
\protect \endinput
diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex
index 32648acd7..8eda9b74b 100644
--- a/tex/context/base/xtag-map.tex
+++ b/tex/context/base/xtag-map.tex
@@ -11,107 +11,167 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D There is a more versatile mapper available in \type {xtag-rem.tex}!
+%D There is a more versatile mapper available in \type {xtag-rem.tex}!
-\beginTEX
- \endinput
-\endTEX
+%D We also need something that lets content as-is, like for
+%D instance XML embedded in a chemical caption.
-\writestatus{loading}{Context XML Macros (remap)}
+\beginTEX
+ \endinput
+\endTEX
+
+\writestatus{loading}{Context XML Macros (remapping)}
%D A fundamental characteristic of \TEX\ is that much
%D processing depends on picking up one or more arguments and
%D acting upon them. In \type {xtag-ini} we have implemented
%D the normal (high) level interface between \XML\ and
%D \CONTEXT, and there we already saw some ways to pick up an
-%D element as argument.
-%D
-%D In this module we will implement a preprocessor. An element
-%D that feeds its content to the preprocessor, becomes a token
+%D element as argument.
+%D
+%D In this module we will implement a preprocessor. An element
+%D that feeds its content to the preprocessor, becomes a token
%D list consisting of \TEX\ macros, which in turn may expand to
-%D their meanings.
-%D
+%D their meanings.
+%D
%D This module is only tested with \ETEX. In principle we can
%D make it work with good old \TEX, but we see no objection
%D against using \ETEX, especially since it's part of every
-%D grown up \TEX\ distribution.
+%D grown up \TEX\ distribution.
-\unprotect
+\unprotect
+\let\normalparseXMLescape \parseXMLescape
+\let\normalparseXMLelement\parseXMLelement
+\let\normalparseXMLprocess\parseXMLprocess
+
+\let\normaldoXMLelement \doXMLelement
+\let\normaldoXMLentity \doXMLentity
+
+\def\setnormalXMLhandler
+ {\let\doXMLelement \normaldoXMLelement
+ \let\parseXMLelement\normalparseXMLelement
+ \let\parseXMLescape \normalparseXMLescape
+ \let\parseXMLprocess\normalparseXMLprocess
+ \let\doXMLentity \normaldoXMLentity}
+
%D A careful reader will notice that we do a full expansion of
%D the content of the element, although commands that are
%D protected will stay untouched. In this stage we also
%D collect key|/|value pairs and pass them onto the \TEX\
%D macros if needed. Again, we need a fully expandable parser
%D to handle this, which make the core macros slightly
-%D unreadable.
-%D
+%D unreadable.
+%D
%D The interface presented here evolved from an older module,
%D written on top of \type {m-sgml}, that could take care of
%D \MATHML\ (version 1). The implementation here is more
-%D advanced in the sense that it permits all kind of parsers.
+%D advanced in the sense that it permits all kind of parsers.
-\def\findendofXMLelement#1% better use a few expandafters
- {\if#1>0 \else % space prevents auto \relax
+\def\findendofXMLelement#1% space after 0/1 prevents auto \relax
+ {\if#1>0 \else
+ \if#1/1 \endofXMLelementE\else
\if#1"\endofXMLelementD \else
\if#1'\endofXMLelementS \else
- \if#1/1 \endofXMLelement \else
\endofXMLelementN \fi\fi\fi\fi}
-\def\endofXMLelementD#1\fi\fi\fi\fi#2"{\fi\fi \findendofXMLelement}
-\def\endofXMLelementS#1\fi\fi\fi\fi#2'{\fi\fi\fi \findendofXMLelement}
-\def\endofXMLelementN#1\fi\fi\fi\fi {\fi\fi\fi\fi\findendofXMLelement}
-\def\endofXMLelement #1\fi\fi\fi\fi#2>{\fi\fi\fi\fi}
+\def\endofXMLelementE#1\fi\fi\fi\fi#2>{\fi\fi}
+\def\endofXMLelementD#1\fi\fi\fi\fi#2"{\fi\fi\fi \findendofXMLelement}
+\def\endofXMLelementS#1\fi\fi\fi\fi#2'{\fi\fi\fi\fi\findendofXMLelement}
+\def\endofXMLelementN \fi\fi\fi\fi {\fi\fi\fi\fi\findendofXMLelement}
+
+% not faster
+%
+% \def\findendofXMLelement#1%
+% {\csname**\if#1>>\else\if#1//\else\if#1""\else\if#1''\else.\fi\fi\fi\fi\endcsname}
+%
+% \def\findendofXMLelement#1%
+% {\csname**\ifcsname**#1\endcsname#1\else.\fi\endcsname}
+%
+% \setvalue{**>}{0 }
+% \setvalue{**/}#1>{1 }
+% \setvalue{**"}#1"{\findendofXMLelement}
+% \setvalue{**'}#1'{\findendofXMLelement}
+% \letvalue{**.}\findendofXMLelement
-\newif\ifremapXMLunknown
+\newif\ifremapXMLunknown
-\def\doremapXMLelement#1#2#3#4%
- {\expandafter\ifx\csname\@@XML#1:#2\endcsname\relax#4\else
- \csname\@@XML#1:#2\endcsname#3%
- \fi}
+%D We need three steps to avoid namespace: tag since comment
+%D and processing instructions don't have a namespace. The
+%D first step distinguishes between comment, processing
+%D instructions and elements. The second step (which is
+%D defined in the main mapping macro) either or not grabs the
+%D namespace. We may extend this model later to a more
+%D versatile one, using remapping.
+
+%D Parsing escapes is done by specific macros. For the
+%D moment we assume that the sequence ends with an \type {>}
+%D (which is definietly not the case for \type {CDATA}).
+
+\long\def\remapXMLescape#1#2>{}
+
+%D Processing instructions are remapped and only certain
+%D cases are handled.
+
+\long\def\remapXMLprocess#1#2{\xmlp{procins/}{X}{#1}{#2}}
+
+%D This one is more efficient (although no one will notice
+%D this since this macro is used seldom).
-\long\def\remapXMLelement#1#2 #3>% todo: we need to get rid of the end /
- {\if#1!%
- % ignore all comment
- \else\if#1?%
- % ignore all instructions
- \remapXMLpi#2 #3>%
- \else\ifcase\findendofXMLelement#2#3>%
+\long\def\remapXMLprocess{\xmlp{procins/}{X}}
+
+%D Element need a bit more work; \type {#4} consumes spaces.
+
+\def\remapXMLunknownONE#1#2% name args
+ {\ifremapXMLunknown\remapXMLone{\s!unknown}{#1 #2}\fi}
+
+\def\remapXMLunknownTWO#1#2% name args
+ {\ifremapXMLunknown\remapXMLtwo{\s!unknown}{#1 #2}\fi}
+
+\def\remapXMLunknownTHREE#1#2% name args
+ {\ifremapXMLunknown\remapXMLthree{\s!unknown/}{#1 #2}\fi}
+
+\long\def\remapXMLelement#1#2 #3>#4% todo: we need to get rid of the end /
+ {\ifcase\findendofXMLelement#2#3>%
\if#1/%
- \expandafter\ifx\csname\@@XML#2:M\endcsname\relax
- \ifremapXMLunknown\remapXMLone{\s!unknown}{#2}\fi
+ \expandafter\ifx\csname\@@XML\@@XMLmapping:#2:M\endcsname\relax
+ \remapXMLunknownONE{#2}{}%
\else
\remapXMLone{#2}{}%
\fi
\else
- \expandafter\ifx\csname\@@XML#1#2:M\endcsname\relax
- \ifremapXMLunknown\remapXMLtwo{\s!unknown}{#1#2}\fi
+ \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
+ \remapXMLunknownTWO{#1#2}{#3}%
\else
\remapXMLtwo{#1#2}{#3}%
\fi
\fi
\else
- \expandafter\ifx\csname\@@XML#1#2:M\endcsname\relax
- \expandafter\ifx\csname\@@XML#1#2/:M\endcsname\relax
- \ifremapXMLunknown\remapXMLthree{\s!unknown/}{#1#2}\fi
+ \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
+ \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2/:M\endcsname\relax
+ \remapXMLunknownTHREE{#1#2}{#3}%
\else
\remapXMLthree{#1#2/}{#3}%
\fi
\else
\remapXMLthree{#1#2}{#3}%
\fi
- \fi\fi\fi}
+ \fi#4}
+
+\unexpanded\def\xmlr#1#2{\csname\@@XML\@@XMLmapping:#1:#2\endcsname}
+\unexpanded\def\xmlp#1#2{\csname\@@XML :#1:#2\endcsname}
+\def \expandedxmlr#1#2{\csname\@@XML\@@XMLmapping:#1:#2\endcsname}
-\unexpanded\def\xmlr#1#2{\csname\@@XML#1:#2\endcsname}
+\def\expandXMLremapping{\let\xmlr\expandedxmlr}
\def\@@XMLremap{XMLremap}
\def\remapXMLone#1#2%
- {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ {\ifcase\csname\@@XMLremap\csname\@@XML\@@XMLmapping:#1:M\endcsname\endcsname
\or % GCPA
\XMLeg\XMLeg
\or % GCP-
- \XMLeg
+ \XMLeg
\or % GC-A
\XMLeg\XMLeg
\or % GC--
@@ -119,11 +179,11 @@
\or % -CPA
\XMLeg
\or % -CP-
- %
+ %
\or % -C-A
\XMLeg
\or % -C--
- %
+ %
\or % G---
\XMLeg
\or % GLR-
@@ -133,11 +193,11 @@
\fi}
\def\remapXMLtwo#1#2%
- {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ {\ifcase\csname\@@XMLremap\csname\@@XML\@@XMLmapping:#1:M\endcsname\endcsname
\or % GCPA
\XMLbg\xmlr{#1}{X}{#2}\XMLbg
\or % GCP-
- \XMLbg\xmlr{#1}{X}{#2}%
+ \XMLbg\xmlr{#1}{X}{#2}%
\or % GC-A
\XMLbg\xmlr{#1}{X}\XMLbg
\or % GC--
@@ -145,21 +205,21 @@
\or % -CPA
\xmlr{#1}{X}{#2}\XMLbg
\or % -CP-
- \xmlr{#1}{X}{#2}%
+ \xmlr{#1}{X}{#2}%
\or % -C-A
\xmlr{#1}{X}\XMLbg
\or % -C--
- \xmlr{#1}{X}%
+ \xmlr{#1}{X}%
\or % G---
\XMLbg
\or % GLR-
\XMLbg\xmlr{#1}{L}%
\or % -LR-
- \xmlr{#1}{L}%
+ \xmlr{#1}{L}%
\fi}
\def\remapXMLthree#1#2%
- {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ {\ifcase\csname\@@XMLremap\csname\@@XML\@@XMLmapping:#1:M\endcsname\endcsname
\or % GCPA
\XMLbg\xmlr{#1}{X}{#2}\XMLbg\XMLeg\XMLeg
\or % GCP-
@@ -169,9 +229,9 @@
\or % GC--
\XMLbg\xmlr{#1}{X}\XMLeg
\or % -CPA
- \xmlr{#1}{X}{#2}\XMLbg\XMLeg
+ \xmlr{#1}{X}{#2}\XMLbg\XMLeg
\or % -CP-
- \xmlr{#1}{X}{#2}%
+ \xmlr{#1}{X}{#2}%
\or % -C-A
\xmlr{#1}{X}\XMLbg\XMLeg
\or % -C--
@@ -180,112 +240,116 @@
\XMLbg\XMLeg
\fi}
-\@EA\scratchtoks\@EA{\string{} \edef\XMLbg{\the\scratchtoks}
-\@EA\scratchtoks\@EA{\string}} \edef\XMLeg{\the\scratchtoks}
+\scratchtoks\@EA{\string{} \edef\XMLbg{\the\scratchtoks}
+\scratchtoks\@EA{\string}} \edef\XMLeg{\the\scratchtoks}
-\chardef\XMLremapGCPA = 1 % {\command {arg} { } }
+\chardef\XMLremapGCPA = 1 % {\command {arg} { } }
\chardef\XMLremapGCP = 2 % {\command {arg} } %
-\chardef\XMLremapGCA = 3 % {\command { } }
+\chardef\XMLremapGCA = 3 % {\command { } }
\chardef\XMLremapGC = 4 % {\command } %
-\chardef\XMLremapCPA = 5 % \command {arg} { }
+\chardef\XMLremapCPA = 5 % \command {arg} { }
\chardef\XMLremapCP = 6 % \command {arg} %
-\chardef\XMLremapCA = 7 % \command { }
+\chardef\XMLremapCA = 7 % \command { }
\chardef\XMLremapC = 8 % \command %
\chardef\XMLremapG = 9 % { }
\chardef\XMLremapGLR = 10 % { \bcom \ecom }
\chardef\XMLremapLR = 11 % \bcom \ecom
-\protect
-
-\def\remapXMLpi#1 #2?#3>%
- {\xmlr{procins/}{X}{#1}{#2}}
-
-\unprotect
-
-%D The remapping is controlled by only a few definition
-%D macros, that both deal with elements. We distinguish
-%D between normal and empty elements.
-%D
+%D The remapping is controlled by only a few definition
+%D macros, that both deal with elements. We distinguish
+%D between normal and empty elements.
+%D
%D \starttypen
%D \remapXMLsequence [name] [result map] \unexpandablecommand
%D \remapXMLsequence [name] [result map] \unexpandablecommand
%D \stoptypen
-%D
-%D The \MATHML\ module demonstrates how these can be used.
+%D
+%D The \MATHML\ module demonstrates how these can be used.
%D The element is converted into a sequence with one or more
-%D of the following components.
+%D of the following components.
%D
%D \starttypen
-%D { \command {parameters} {argument} }
+%D { \command {parameters} {argument} }
%D \stoptypen
%D
-%D The following combinations are supported.
-%D
+%D The following combinations are supported.
+%D
%D \starttabulatie[|c|c|c|c|c|]
-%D \NC GCPA \NC grouped \NC command \NC parameters \NC argument \NC \NR
-%D \NC GCP \NC grouped \NC command \NC parameters \NC \NC \NR
-%D \NC GCA \NC grouped \NC command \NC \NC argument \NC \NR
-%D \NC GC \NC grouped \NC command \NC \NC \NC \NR
-%D \NC CPA \NC \NC command \NC parameters \NC argument \NC \NR
-%D \NC CP \NC \NC command \NC parameters \NC \NC \NR
-%D \NC CA \NC \NC command \NC \NC argument \NC \NR
-%D \NC C \NC \NC command \NC \NC \NC \NR
-%D \NC G \NC grouped \NC \NC \NC \NC \NR
-%D \stoptabulatie
+%D \NC GCPA \NC grouped \NC command \NC parameters \NC argument \NC \NR
+%D \NC GCP \NC grouped \NC command \NC parameters \NC \NC \NR
+%D \NC GCA \NC grouped \NC command \NC \NC argument \NC \NR
+%D \NC GC \NC grouped \NC command \NC \NC \NC \NR
+%D \NC CPA \NC \NC command \NC parameters \NC argument \NC \NR
+%D \NC CP \NC \NC command \NC parameters \NC \NC \NR
+%D \NC CA \NC \NC command \NC \NC argument \NC \NR
+%D \NC C \NC \NC command \NC \NC \NC \NR
+%D \NC G \NC grouped \NC \NC \NC \NC \NR
+%D \stoptabulatie
%D
-%D Empty elements (singular ones) never get an argument,
-%D which makes sense, since they have at most parameters.
+%D Empty elements (singular ones) never get an argument,
+%D which makes sense, since they have at most parameters.
-\def\remapXMLsequence{\dotripleargument\doremapXML []}
-\def\remapXMLsingular{\dotripleargument\doremapXML[/]}
+\def\remapXMLsequence{\doquadrupleargument\doremapXML []}
+\def\remapXMLsingular{\doquadrupleargument\doremapXML[/]}
-\def\doremapXML[#1][#2][#3]%
- {\doifinstringelse{LR}{#3}
- {\let\next\doremapXMLtwo}
- {\let\next\doremapXMLone}%
- \next[#1][#2][#3]}
+\def\doremapXML[#1][#2][#3][#4]%
+ {\iffourthargument
+ \def\next{\dodoremapXML[#2][#1][#3][#4]}%
+ \else
+ \def\next{\dodoremapXML[\@@XMLmapping][#1][#2][#3]}%
+ \fi
+ \next}
-\def\doremapXMLone[#1][#2][#3]#4%
- {\setvalue{\@@XML#2#1:M}{#3}%
- \setvalue{\@@XML#2#1:X}{#4}}
+%\def\dodoremapXML[#1][#2][#3][#4]% class / name pattern
+% {\doifinstringelse{LR}{#4}
+% {\let\next\doremapXMLtwo}
+% {\let\next\doremapXMLone}%
+% \next[#1][#2][#3][#4]}%
-\def\doremapXMLtwo[#1][#2][#3]#4#5%
- {\setvalue{\@@XML#2:M}{#3}%
- \setvalue{\@@XML#2:L}{#4}%
- \setvalue{\@@XML#2:R}{#5}}
+\def\dodoremapXML[#1][#2][#3][#4]% class / name pattern
+ {\doifinstringelse{LR}{#4}\doremapXMLtwo\doremapXMLone[#1][#2][#3][#4]}
-\let\dowithentity\empty
+\def\doremapXMLone[#1][#2][#3][#4]#5%
+ {\setvalue{\@@XML#1:#3#2:M}{#4}%
+ \setvalue{\@@XML#1:#3#2:X}{#5}}
-%D We handle unknown elements with:
+\def\doremapXMLtwo[#1][#2][#3][#4]#5#6%
+ {\setvalue{\@@XML#1:#3:M}{#4}%
+ \setvalue{\@@XML#1:#3:L}{#5}%
+ \setvalue{\@@XML#1:#3:R}{#6}}
-\remapXMLsingular[procins] [CPA] \doXMLprocins
+\let\dowithentity\empty
-\def\doXMLprocins#1#2{\dodoXMLprocessor{?#1}{#2}}
+%D We handle processing instructions and unknown elements with:
+\remapXMLsingular [procins] [CPA] \normalparseXMLprocess
\remapXMLsingular [\s!unknown] [CPA] \doXMLunknownSI
\remapXMLsequence [\s!unknown] [CPA] \doXMLunknownSE
-\def\doXMLunknownSI#1#2{\hbox{\tttf[#1]}}
-\def\doXMLunknownSE#1#2{\hbox{\tttf[#1:\enspace\ignorespaces#2\unskip]}}
+\def\doXMLunknownSI#1#2{{\tttf[#1 #2]}}
+\def\doXMLunknownSE#1#2{{\tttf[#1 #2]}}
%D In a similar way, we can remap entities.
-\def\remapXMLentity%
+\def\remapXMLentity#1;#2%
+ {\doremapXMLentity{#1}#2}%
+
+\def\doremapXMLentity%
{\xmlrent}
\unexpanded\def\xmlrent#1%
{\getXMLentity{#1}}
-%D The remapping is taken care of by the following macro,
-%D which takes three arguments.
+%D The remapping is taken care of by the following macro,
+%D which takes three arguments.
%D
-%D \starttypen
+%D \starttypen
%D \XMLremapdata{before}{after}{content}
-%D \stoptypen
+%D \stoptypen
%D
-%D After the remapping, the content is executed (expanded)
-%D under the normal \TEX\ catcode regime. The intermediate
-%D result can be traced by turning on the following switch.
+%D After the remapping, the content is executed (expanded)
+%D under the normal \TEX\ catcode regime. The intermediate
+%D result can be traced by turning on the following switch.
\newif\iftraceXMLremapping
@@ -296,10 +360,10 @@
\defineXMLentity[tex-bar]{\myspecialvert}%
\to \everyXMLremapping
-\def\setnormalXMLentities%
+\def\setnormalXMLentities% will change ! ! ! ! !
{\defineXMLentity[tex-hash]\letterhash
- \defineXMLentity[tex-dollar]\letterdollar
- \defineXMLentity[tex-percent]\letterpercent
+ \defineXMLentity[tex-dollar]\letterdollar
+ \defineXMLentity[tex-percent]\letterpercent
\defineXMLentity[tex-backslash]\letterbackslash
\defineXMLentity[tex-hat]\letterhat
\defineXMLentity[tex-underscore]\letterunderscore
@@ -309,12 +373,36 @@
\let\XMLremappedpar\empty
-\long\def\XMLremapdata#1#2#3%
+%D Here we implement the second step in the element grabber.
+
+\long\def\XMLremapdata%
+ {\dosingleempty\doXMLremapdata}
+
+\long\def\doXMLremapdata[#1]#2#3#4%
{\bgroup
- \pushmacro\doXMLelement
- \pushmacro\doXMLentity % ##2 removes leading spaces
- \long\def\doXMLelement##1>##2{\remapXMLelement##1 >##2}%
- \def\doXMLentity ##1;##2{\remapXMLentity{##1}##2}%
+ \startXMLmapping[#1]%
+ % enable unknown elements (should be macro)
+ \doifsomething{#1}
+ {\doifdefinedelse{\@@XML#1:\s!unknown:M}
+ {\remapXMLunknowntrue}{\remapXMLunknownfalse}}%
+ %
+ \pushmacro\doXMLentity % needed ?
+ % this will change, proper split in element itself
+ \ifx\currentXMLnamespace\empty
+ \let\parseXMLelement\remapXMLelement
+ \else
+ % here we need to get rid of the namespace; we also
+ % have to preserve the leaqding / if present
+ \@EA\long\@EA\def\@EA\parseXMLelement\@EA
+ ##\@EA1\currentXMLnamespace:{\remapXMLelement##1}%
+ % ##2 removes leading spaces
+ \fi
+ %
+ \let\parseXMLescape \remapXMLescape
+ \let\parseXMLprocess\remapXMLprocess
+ %
+ \let\doXMLentity \remapXMLentity
+ %
\enableXML % sets entities
\enableXMLexpansion
\let\par\XMLremappedpar
@@ -324,10 +412,9 @@
\catcode`\^^M=\@@space
\catcode`\^^L=\@@space
\catcode`\^^Z=\@@space
- \xdef\remappedXMLdata{#3\empty}%
+ \xdef\remappedXMLdata{#4\empty}%
\let\par\endgraf
- \popmacro\doXMLentity
- \popmacro\doXMLelement
+ \popmacro\doXMLentity % needed ?
\disableXMLexpansion
\catcode`\{=\@@begingroup
\catcode`\}=\@@endgroup
@@ -336,18 +423,19 @@
\bgroup
\convertcommand\remappedXMLdata\to\ascii
\tttf\veryraggedright\ascii\par
- \writestatus{XML}{\ascii}%
+ \writestatus{xml-remap}{\ascii}%
\egroup
\fi
- #1\scantokens\@EA{\remappedXMLdata\empty\empty}#2%
+ #2\scantokens\@EA{\remappedXMLdata\empty\empty}#3%
+ \stopXMLmapping
\egroup}
-% rename to better names
+% rename to better names
\newtoks \XMLRtoks
\newcount \nofXMLRchildren
-\def\naturalxmlr#1#2{\getvalue{\@@XML#1:#2}}
+\def\naturalxmlr#1#2{\getvalue{\@@XML\@@XMLmapping:#1:#2}}
\def\ignoreXMLRelement#1#2{}
\def\normalXMLRelement#1#2{#2}
@@ -363,8 +451,8 @@
% \def\nextXMLRelement{##1{##2}{##3}{##4}{##5}}%
% #1}%
% \doifnextcharelse\empty\empty\dowithnextXMLRelement}
-%
-% better and faster:
+%
+% better and faster:
\def\dowithnextXMLRelement#1#2#3#4#5#6%
{\def\nextXMLRelement{#2{#3}{#4}{#5}{#6}}#1}%
@@ -383,7 +471,7 @@
\popmacro\secondXMLRelement
\popmacro\firstXMLRelement}}}
-\def\withnextthreeXMLRelements#1% korter, met two
+\def\withnextthreeXMLRelements#1% korter, met two
{\pushmacro\firstXMLRelement
\pushmacro\secondXMLRelement
\pushmacro\thirdXMLRelement
@@ -467,7 +555,7 @@
{\let\nextXMLRelement\empty#2}%
\doifnextcharelse\xmlr\xdowithnextXMLRelement\xnowithnextXMLRelement}
-\def\encapsulatenextXMLRelements#1#2#3#4% oude bewaren
+\def\encapsulatenextXMLRelements#1#2#3#4% oude bewaren
{\pushmacro\betweenXMLRchild
\pushmacro\afterXMLRchild
\def\betweenXMLRchild{#1\def\betweenXMLRchild{#2}}%
@@ -482,7 +570,7 @@
\popmacro\betweenXMLRchild}%
#4}
-\def\collectXMLRchild#1#2%
+\def\collectXMLRchild#1#2%
{\XMLRtoks\emptytoks
\pushmacro\xmlr
\def\xmlr##1##2##3##4%
@@ -490,7 +578,7 @@
#2\empty
\popmacro\xmlr}
-\def\collectbetweenXMLRchild#1#2#3%
+\def\collectbetweenXMLRchild#1#2#3%
{\XMLRtoks\emptytoks
\pushmacro\xmlr
\pushmacro\betweenXMLRchild
@@ -502,7 +590,7 @@
\popmacro\betweenXMLRchild
\popmacro\xmlr}
-\def\dorawcollectbetweenXMLR#1#2%
+\def\dorawcollectbetweenXMLR#1#2%
{\pushmacro\xmlr
\pushmacro\betweenXMLRchild
\def\betweenXMLRchild{\def\betweenXMLRchild{#1}}%
@@ -512,16 +600,16 @@
\popmacro\betweenXMLRchild
\popmacro\xmlr}
-\def\rawcollectbetweenXMLR%
+\def\rawcollectbetweenXMLR%
{\XMLRtoks\emptytoks\dorawcollectbetweenXMLR}
-\def\docollectbetweenXMLR#1%
- {\dorawcollectbetweenXMLR{\appendtoks#1\to\XMLRtoks}}
+\def\docollectbetweenXMLR#1%
+ {\dorawcollectbetweenXMLR{\appendtoks#1\to\XMLRtoks}}
\def\collectbetweenXMLR%
{\XMLRtoks\emptytoks\docollectbetweenXMLR}
-\def\processXMLRchildren#1%
+\def\processXMLRchildren#1%
{\pushmacro\xmlr
\let\xmlr\naturalxmlr
#1\empty
@@ -544,7 +632,7 @@
#1\empty
\popmacro\xmlr}
-\def\countXMLRchild#1#2%
+\def\countXMLRchild#1#2%
{\pushmacro\xmlr
\nofXMLRchildren=0
\def\xmlr##1##2##3##4%
@@ -552,4 +640,27 @@
#2\empty
\popmacro\xmlr}
-\protect \endinput
+\def\installXMLunknownremapping
+ {\remapXMLsingular[\s!unknown][CPA]\doXMLunknownSI
+ \remapXMLsequence[\s!unknown][CPA]\doXMLunknownSE}
+
+\bgroup \catcode`<=\active
+
+\gdef\revertXMLremapping
+ {\gdef\doXMLunknownSE##1##2{<##1>##2</##1>}%
+ \gdef\doXMLunknownSI##1##2{<##1>}}
+
+\gdef\unmapXMLdata#1#2% todo: singular, evt ##2 space ervoor en ##1##2
+ {\bgroup
+ \revertXMLremapping
+ \expandXMLremapping % now we can roll back
+ \setnormalXMLhandler % using the normal parser
+ \resetXMLmapping % and leaving the mapping namespace
+ \xdef\unmappedXMLdata{#2}% recreate the original
+ \enableXMLelements % enable normal handler
+ \unmappedXMLdata % off we go ...
+ \egroup}
+
+\egroup
+
+\protect \endinput
diff --git a/tex/context/base/xtag-meh.tex b/tex/context/base/xtag-meh.tex
index 95e244d35..1636f2a2b 100644
--- a/tex/context/base/xtag-meh.tex
+++ b/tex/context/base/xtag-meh.tex
@@ -14,7 +14,7 @@
\defineMMLentity andv E391 {unknown} and with middle stem
\defineMMLentity angrt 221F {unknown} right (90 degree) angle
\defineMMLentity angsph 2222 {unknown} angle-spherical
-\defineMMLentity angst 212B {\AA} Angstrom capital A, ring
+\defineMMLentity angst 212B {\Angstrom} Angstrom capital A, ring
\defineMMLentity ap 2248 {\approx} approximate
\defineMMLentity apacir E38C {unknown} approximate, circumflex accent
\defineMMLentity awconint 2233 {unknown} contour integral, anti-clockwise
diff --git a/tex/context/base/xtag-mmc.tex b/tex/context/base/xtag-mmc.tex
index 195ea4a72..f3c46a0c8 100644
--- a/tex/context/base/xtag-mmc.tex
+++ b/tex/context/base/xtag-mmc.tex
@@ -20,8 +20,12 @@
% approach, which we needed for proper nesting, but the
% code is still too ugly
+\startXMLmapping[mml]
+
\unprotect
+\def\MMLccomma{{,}}
+
\def\getmmlarguments#1#2#3#4#5#6% {class} {defaults} mmlargs
{\getXMLarguments{#1}{#2 #5}}%
@@ -47,7 +51,7 @@
{#1}}
\def\MMLcdopolara#1%
- {\def\MMLcsep{,}\getXMLentity{polar}\left(#1\right)}
+ {\def\MMLcsep{\MMLccomma}\getXMLentity{polar}\left(#1\right)}
\def\MMLcdopolarb#1%
{\def\MMLcsep##1\empty%
@@ -130,7 +134,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcCIdefault#1#2% #1=dummy
{#2\!% \getXMLentity{NegThinSpace}%
\doifnextcharelse\xmlr
- {\encapsulatenextXMLRelements{\left(}{,}{\right)}}
+ {\encapsulatenextXMLRelements{\left(}{\MMLccomma}{\right)}}
{}}
\def\MMLcCN#1% #2% can be sped up with \doifundefined ...
@@ -207,8 +211,9 @@ complex-cartesian=>\let\next\MMLccartesian,
in/,inverse/,%
fn,%
floor/,ceiling/,%
- mean/,
- abs/,int/,limit/,sum/,product/%
+ mean/,%
+ selector/,%
+ abs/,int/,limit/,sum/,product/,%
outerproduct/,innerproduct/,scalarproduct/}
\def\MMLcfunctionlist
@@ -219,17 +224,18 @@ complex-cartesian=>\let\next\MMLccartesian,
csc/,arccsc/,csch/,arccsch/,%
sec/,arcsec/,sech/,arcsech/,%
ln/,exp/,log/,%
- abs/,int/,limit/,sum/,product/%
+ abs/,int/,limit/,sum/,product/,%
fn} % ?
\def\MMLcconstructlist
- {diff/,partialdiff/,apply}
+ {diff/,partialdiff/,root/} % apply goes wrong on 1/2 * (a_2 + b_3)
% better: no () here but explicitly when needed, which is in
% less cases
\def\MMLcAPPLY#1#2%
- {\pushmacro\xmlr
+ {\mathinner{\begingroup % new, else 1/2(1+2) problem / inner: ask taco
+ \pushmacro\xmlr
\@EA\@EA\@EA\doifXMLRchild\@EA\@EA\@EA{\@EA\MMLcmainresetlist\@EA,\MMLctempresetlist}{#2}
{\MMLcreset}%
\ifcase\@MMLlevel
@@ -246,7 +252,8 @@ complex-cartesian=>\let\next\MMLccartesian,
\endgroup % ook level push
\advance\@MMLlevel-1
\doifXMLparelse{apply}{close}{\right\XMLpar{apply}{close}{}}{}%
- \popmacro\xmlr}
+ \popmacro\xmlr
+ \endgroup}}
\remapXMLsequence [reln] [CPA] \MMLcRELN
@@ -266,20 +273,32 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcFNdefault#1#2% neg space needed because of \left
{#2\!% \getXMLentity{NegThinSpace}%
- \MMLcreset\encapsulatenextXMLRelements{\left(}{,}{\right)}}
+ \MMLcreset\encapsulatenextXMLRelements{\left(}{\MMLccomma}{\right)}}
% special function handlers
\def\MMLcFNoperator
{\getvalue{doMMLcFN\mmloperator}}
+% \def\doMMLcFNplusminus#1#2#3\empty
+% {\countXMLRchildren{#3}%
+% \ifcase\nofXMLRchildren\or
+% #2#3%
+% \else % suboptimal for instance under root
+% \encapsulateXMLR{\left(}{#2}{\right)}{\MMLcreset#3}%
+% \fi}
+
\def\doMMLcFNplusminus#1#2#3\empty
{\countXMLRchildren{#3}%
\ifcase\nofXMLRchildren\or
- #2#3%
- \else
- \encapsulateXMLR{\left(}{#2}{\right)}{\MMLcreset#3}%
- \fi}
+ \def\next{#2#3}%
+ \else
+ \def\next
+ {\doifnextcharelse\xmlr
+ {\encapsulateXMLR{\left(}{#2}{\right)}{\MMLcreset#3}}%
+ {\encapsulateXMLR{}{#2}{}{\MMLcreset#3}}}%
+ \fi
+ \next}
\let\doMMLcFNminusplus\doMMLcFNplusminus
@@ -347,11 +366,11 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcLAMBDA#1#2%
{\doifelse{\@@MMLlambdavariant}{a}
- {\encapsulateXMLR{\getXMLentity{lambda}(}{,}{)}{#2}}
+ {\encapsulateXMLR{\getXMLentity{lambda}(}{\MMLccomma}{)}{#2}}
{\countXMLRchild{bvar}{#2}%
\ifnum\nofXMLRchildren>1
\collectXMLRchild{bvar}{#2}%
- \encapsulateXMLR{\left(}{,}{\right)}{\the\XMLRtoks}%
+ \encapsulateXMLR{\left(}{\MMLccomma}{\right)}{\the\XMLRtoks}%
\else
\processXMLRchild{bvar}{#2}%
\fi
@@ -422,13 +441,13 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcDIVIDE#1#2%
{\withnexttwoXMLRelements
- {\increment\MMLcDIVIDElevel
- \ifnum\MMLcDIVIDElevel>\@@MMLdivideniveau\space
- \firstXMLRelement/\secondXMLRelement
- \else
- \frac{\MMLcreset\firstXMLRelement}{\MMLcreset\secondXMLRelement}%
- \fi
- \decrement\MMLcDIVIDElevel}}
+ {\increment\MMLcDIVIDElevel
+ \ifnum\MMLcDIVIDElevel>\@@MMLdivideniveau\space
+ \firstXMLRelement/\secondXMLRelement
+ \else
+ \frac{\MMLcreset\firstXMLRelement}{\MMLcreset\secondXMLRelement}%
+ \fi
+ \decrement\MMLcDIVIDElevel}}
\remapXMLsingular [min] [CPA] \MMLcMIN
\remapXMLsingular [max] [CPA] \MMLcMAX
@@ -436,12 +455,12 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcMIN#1#2#3\empty
{\encapsulateXMLR
{\min\doifXMLRchild{bvar}{#3}{_{\processXMLRchild{bvar}{#3}}}\left\{}
- {,}{\right\}}{#3}}
+ {\MMLccomma}{\right\}}{#3}}
\def\MMLcMAX#1#2#3\empty
{\encapsulateXMLR
{\max\doifXMLRchild{bvar}{#3}{_{\processXMLRchild{bvar}{#3}}}\left\{}
- {,}{\right\}}{#3}}
+ {\MMLccomma}{\right\}}{#3}}
\remapXMLsingular [minus] [CPA] \MMLcMINUS
\remapXMLsingular [plus] [CPA] \MMLcPLUS
@@ -529,7 +548,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\remapXMLsingular [gcd] [CPA] \MMLcGCD
-\def\MMLcGCD#1#2#3\empty{\encapsulateXMLR{\gcd(}{,}{)}{#3}}
+\def\MMLcGCD#1#2#3\empty{\encapsulateXMLR{\gcd(}{\MMLccomma}{)}{#3}}
\remapXMLsingular [and] [CPA] \MMLcAND
\remapXMLsingular [or] [CPA] \MMLcOR
@@ -559,7 +578,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcFORALLandEXISTS#1#2#3\empty
{\MMLcreset
- _{\encapsulateXMLRchildren{bvar}{}{,}{}{#3}}%
+ _{\encapsulateXMLRchildren{bvar}{}{\MMLccomma}{}{#3}}%
\doifXMLRchildelse{condition}{#3}
{\;% \getXMLentity{ThickSpace}%
\processXMLRchild{condition}{#3}
@@ -608,7 +627,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\remapXMLsingular [lcm] [CPA] \MMLcLCM
\def\MMLcLCM#1#2#3\empty
- {\encapsulateXMLR{\getXMLentity{lcm}(}{,}{)}{#3}}
+ {\encapsulateXMLR{\getXMLentity{lcm}(}{\MMLccomma}{)}{#3}}
\remapXMLsingular [floor] [CPA] \MMLcFLOOR
\remapXMLsingular [ceiling] [CPA] \MMLcCEILING
@@ -762,7 +781,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcPARTIALDIFF#1#2#3\empty
{\pushmacro\xmlr
\doifXMLRchildelse{list}{#3}
- {\getXMLentity{capitaldifferentiald}_{\encapsulateXMLRchild{list}{}{,}{}{#3}}%
+ {\getXMLentity{capitaldifferentiald}_{\encapsulateXMLRchild{list}{}{\MMLccomma}{}{#3}}%
\processXMLRchild{apply,reln,ci,cn}{#3}}
{\countXMLRchild{bvar}{#3}%
\ifnum\nofXMLRchildren>0
@@ -829,11 +848,11 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcSET#1#2%
{\doifXMLRchildelse{condition}{#2}
{\{\processXMLRchild{bvar}{#2}\,\vert\,\processXMLRchild{condition}{#2}\}}
- {\encapsulateXMLR{\{}{,}{\}}{#2}}}
+ {\encapsulateXMLR{\{}{\MMLccomma}{\}}{#2}}}
\remapXMLsequence [list] [CPA] \MMLcLIST
-\def\MMLcLIST#1#2{\encapsulateXMLR{[} {,}{]} {#2}}
+\def\MMLcLIST#1#2{\encapsulateXMLR{[}{\MMLccomma}{]}{#2}}
\remapXMLsingular [union] [CPA] \MMLcUNION
\remapXMLsingular [intersect] [CPA] \MMLcINTERSECT
@@ -1072,7 +1091,7 @@ complex-cartesian=>\let\next\MMLccartesian,
{\countXMLRchildren{#2}%
\ifnum\nofXMLRchildren>1
\doifelse{\@@MMLvectorrichting}{\v!horizontaal}
- {\encapsulateXMLR{\left(}{,}{\right)}{#2}}
+ {\encapsulateXMLR{\left(}{\MMLccomma}{\right)}{#2}}
{\collectbetweenXMLR{\crcr}{#2}%
\MMLcreset\left(\matrix{\the\XMLRtoks}\right)}%
\else
@@ -1128,7 +1147,7 @@ complex-cartesian=>\let\next\MMLccartesian,
\popmacro\xmlr}
\def\doMMLcSELECTOR#1\empty
- {_{\encapsulateXMLR{}{,}{}{#1\empty}}}
+ {_{\MMLcreset\encapsulateXMLR{}{\MMLccomma}{}{#1\empty}}}
\remapXMLsingular [vectorproduct] [CPA] \MMLcVECTORPRODUCT
\remapXMLsingular [scalarproduct] [CPA] \MMLcSCALARPRODUCT
@@ -1152,11 +1171,11 @@ complex-cartesian=>\let\next\MMLccartesian,
\remapXMLsequence [annotation] [CPA] \MMLcANNOTATION
-\def\MMLcANNOTATION#1#2%
+\def\MMLcANNOTATION#1#2% we need a better unmapper
{\getXMLarguments{annotation}{encoding="" #1}%
\doif{\XMLpar{annotation}{encoding}{}}{TeX}%
{\begingroup
- \setnormalXMLentities
+ \setnormalXMLentities % better: \simplifyXMLentities ; test first
\let\xmlrent\expandedXMLentity
\edef\mmlascii{#2}%
\setnormalcatcodes
@@ -1220,4 +1239,6 @@ complex-cartesian=>\let\next\MMLccartesian,
\def\MMLcEULERGAMMA #1#2{\gamma}
\def\MMLcINFINITY #1#2{\infty}
+\stopXMLmapping
+
\protect \endinput
diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex
index 27d4d10d0..e7d8e2eda 100644
--- a/tex/context/base/xtag-mml.tex
+++ b/tex/context/base/xtag-mml.tex
@@ -11,10 +11,28 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\ifx\remapXMLsequence\undefined \input xtag-map.tex \relax \fi % temp hack
-
\writestatus{loading}{Context XML Macros (math ml)}
+%\enablemathpunctuation
+
+% First some general formula element definitions.
+
+\defineXMLenvironment [formula] [label=,sublabel=]
+ {\dostartXMLformula\placeformula}
+ {\dostopXMLformula}
+
+\defineXMLenvironment [subformula] [label=,sublabel=]
+ {\dostartXMLformula\placesubformula}
+ {\dostopXMLformula}
+
+\def\dostartXMLformula#1%
+ {\doifelsenothingXMLop{label}
+ {\startformula}
+ {\expanded{#1[\XMLop{label}]{\XMLop{sublabel}}}\startformula}}
+
+\def\dostopXMLformula
+ {\stopformula}
+
% Since I only had the draft of mml 2 as example of
% rendering, there are probably a lot of omissions and
% misinterpretations. At least I learned some bits and
@@ -35,43 +53,17 @@
\unprotect
-\def\setupMMLappearance[#1]%
- {\dodoubleargument\getparameters[@@MML#1]}
-
-\defineXMLprocessor[context-mathml-directive]{\contextXMLmathml}
-
-\def\contextXMLmathml#1%
- {\docontextXMLmathml#1 dummy dummy dummy\end}
+\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]}
-\def\docontextXMLmathml#1 #2 #3 #4\end
- {\setupMMLappearance[#1][#2=#3]}
-
-% == \defineXMLdirective [mathml] \setupMMLappearance
+\defineXMLdirective [mathml] \setupMMLappearance
\defineXMLargument [math] \doXMLmath
\defineXMLargument [imath] \doXMLimath
\defineXMLargument [dmath] \doXMLdmath
\unexpanded\def\doXMLmath {\ifhmode\@EA\doXMLimath\else\@EA\doXMLdmath\fi}
-\unexpanded\def\doXMLimath{\XMLremapdata{$}{$}}
-\unexpanded\def\doXMLdmath{\XMLremapdata{\dostartformula{}}{\dostopformula}}
-
-\defineXMLenvironment [formula]
- {\dostartXMLformula{formula}\placeformula}
- {\dostopXMLformula}
-
-\defineXMLenvironment [subformula]
- {\dostartXMLformula{subformula}\placesubformula}
- {\dostopXMLformula}
-
-\def\dostartXMLformula#1#2%
- {\doifXMLparelse{#1}{label}
- {\expanded{#2[\XMLpar{#1}{label}{}]{\XMLpar{#1}{sublabel}{}}}%
- \startformula}
- {\startformula}}
-
-\def\dostopXMLformula%
- {\stopformula}
+\unexpanded\def\doXMLimath{\XMLremapdata[mml]{$}{$}}
+\unexpanded\def\doXMLdmath{\XMLremapdata[mml]{\dostartformula{}}{\dostopformula}}
\ifx\XMLRtoks\undefined \newtoks\XMLRtoks \fi
@@ -112,12 +104,16 @@
\gdef\xdefineMMLentity #1 #2 #3 #4
{\egroup\dodefineMMLentity{#1}{#2}{#3}{#4}}
+\global\let\dodefineMMLsynonym\gobblefourarguments
+
\gdef\defineMMLsynonym%
{\bgroup\obeylines\xdefineMMLsynonym}
\gdef\xdefineMMLsynonym #1 #2
{\egroup\dodefineMMLsynonym{#1}{#2}}
+\global\let\dodefineMMLsynonym\gobbletwoarguments
+
\egroup
% some more
@@ -387,6 +383,9 @@
\defineXMLentity [OverBar] {\normalorfiller\hrule\hrulefill}
\defineXMLentity [Hat] {\normalorfiller\empty\empty} % todo
+\defineXMLentity [downarrow] {\mathortext\downarrow\empty}
+\defineXMLentity [uparrow] {\mathortext\uparrow\empty}
+
\defineXMLentity [Tab] {\hskip4em}
\defineXMLentity [NewLine] {\mathortext\empty\crlf}
\defineXMLentity [IndentingNewLine] {\mathortext\empty\crlf}
@@ -464,6 +463,8 @@
\def\myspecialvert{\mathematics{\vert}} % temp hack, should stretch
+\defineXMLentity [,] {{,}}
+\defineXMLentity [.] {{.}}
\defineXMLentity [+] {+}
\defineXMLentity [-] {-}
\defineXMLentity [(] {(}
diff --git a/tex/context/base/xtag-mmp.tex b/tex/context/base/xtag-mmp.tex
index 1748e83e6..20cc1e677 100644
--- a/tex/context/base/xtag-mmp.tex
+++ b/tex/context/base/xtag-mmp.tex
@@ -15,6 +15,8 @@
\unprotect
+\startXMLmapping [mml]
+
\def\convertasciiafter#1#2%
{\convertargument#2\to\asciiafter
\@EA#1\@EA{\asciiafter}}
@@ -70,7 +72,7 @@
{}%
{\pushmacro\myspecialvert % hack
\def\myspecialvert{\;\vrule\;}%
- \grabMMLseparator{\XMLpar{mfenced}{separators}}%
+ \grabMMLseparator{\XMLpar{mfenced}{separators}{}}%
\popmacro\myspecialvert}
{}%
{#2\empty}}
@@ -102,9 +104,11 @@
\fi
\dograbMMLseparator}
-\def\grabMMLseparatorb#1%
+\def\grabMMLseparatorb#1% better use \checkMMLoperator
{\ifnum\MMLxxcounter=\MMLyycounter\space
- \def\lastMMLseparator{#1}%
+\doifXMLentityelse{#1}
+ {\def\lastMMLseparator{\xmlrent{#1}}}
+ {\def\lastMMLseparator{#1}}%
\fi
\dograbMMLseparator}
@@ -468,5 +472,7 @@
\fi
\doif{mprescripts/}{#1}{\donefalse}% weak, the / here
\ifdone \advance\scratchcounter 1 \fi}
-
+
+\stopXMLmapping
+
\protect \endinput
diff --git a/tex/context/base/xtag-pml.tex b/tex/context/base/xtag-pml.tex
new file mode 100644
index 000000000..7371ec165
--- /dev/null
+++ b/tex/context/base/xtag-pml.tex
@@ -0,0 +1,83 @@
+%D \module
+%D [ file=xtag-pml,
+%D version=2001.09.04,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Physics ML,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context XML Macros (phys ml)}
+
+%D This filter runs on top of the mathml and units modules.
+
+\useXMLfilter[mml,mmp,mmc,unt]
+
+\defineXMLargument [phys] \doXMLphys
+\defineXMLargument [iphys] \doXMLiphys
+\defineXMLargument [dphys] \doXMLdphys
+
+\unprotect
+
+\unexpanded\def\doXMLphys {\ifhmode\@EA\doXMLiphys\else\@EA\doXMLdphys\fi}
+\unexpanded\def\doXMLiphys{\XMLremapdata[mml]{$\ignorespaces}{\unskip$}}
+\unexpanded\def\doXMLdphys{\XMLremapdata[mml]{\dostartformula{}}{\dostopformula}}
+
+\protect
+
+\doifnotmode{demo}{\endinput}
+
+\usemodule[units]
+
+\starttext
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 10 </cn>
+ <ci><unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <divide/>
+ <cn> 10 </cn>
+ <ci> <unit><Unit/><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 10 </cn>
+ <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 10 </cn>
+ <ci> <unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 10 </cn>
+ <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\stoptext
diff --git a/tex/context/base/xtag-pmu.tex b/tex/context/base/xtag-pmu.tex
new file mode 100644
index 000000000..425257b49
--- /dev/null
+++ b/tex/context/base/xtag-pmu.tex
@@ -0,0 +1,188 @@
+%D \module
+%D [ file=xtag-pmu,
+%D version=2001.06.10,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Units,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context XML Macros (units)}
+
+%D Quick and dirty in||line units:
+%D
+%D \startbuffer
+%D <phys>
+%D <cn> 10 </cn>
+%D <cu> <Newton/> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A more \MATHML||like unit application:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn>
+%D <csymbol> <Square/> <Meter/> <Per/> <Sec/> </csymbol>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A bit more compact:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn>
+%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A bit more complicated:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <apply> <divide/> <ci> a </ci> <cn> 10 </cn> </apply>
+%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D An alternative (equivalent) for \type {</cu>}:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn> <cunseq> <Square/> <Meter/> <Per/> <Sec/> </cunseq>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+
+\defineXMLsingular [unitmeaning] [label=] \doPMLunitmeaning
+
+\def\doPMLunitmeaning%
+ {\expanded{\unitmeaning{\XMLop{label}}}}
+
+\startXMLmapping [mml]
+
+\remapXMLsequence [unit] [CPA] \doPMLuseq
+\remapXMLsingular [unit] [CPA] \doPMLunit % #2\empty
+\remapXMLsequence [cunseq] [CPA] \doPMLuseq % #2
+\remapXMLsequence [cu] [CPA] \doPMLuseq % #2
+
+\newif\ifPMLunit \PMLunittrue
+
+\def\doPMLuseq#1#2{\PMLunittrue\ignorespaces#2\unskip\PMLunitfalse}
+\def\doPMLunit#1#2\empty{\ignorespaces#2\unskip}
+
+\def\handlePMLunit#1{\ifPMLunit\ignorespaces#1\fi\ignorespaces}
+
+%D All unit commands are remapped in a similar way.
+
+\remapXMLsingular [Atto] [C] {\handlePMLunit\Atto}
+\remapXMLsingular [Femto] [C] {\handlePMLunit\Femto}
+\remapXMLsingular [Pico] [C] {\handlePMLunit\Pico}
+\remapXMLsingular [Nano] [C] {\handlePMLunit\Nano}
+\remapXMLsingular [Micro] [C] {\handlePMLunit\Micro}
+\remapXMLsingular [Milli] [C] {\handlePMLunit\Milli}
+\remapXMLsingular [Centi] [C] {\handlePMLunit\Centi}
+\remapXMLsingular [Deci] [C] {\handlePMLunit\Deci}
+\remapXMLsingular [Hecto] [C] {\handlePMLunit\Hecto}
+\remapXMLsingular [Kilo] [C] {\handlePMLunit\Kilo}
+\remapXMLsingular [Mega] [C] {\handlePMLunit\Mega}
+\remapXMLsingular [Giga] [C] {\handlePMLunit\Giga}
+\remapXMLsingular [Terra] [C] {\handlePMLunit\Terra}
+\remapXMLsingular [Peta] [C] {\handlePMLunit\Peta}
+\remapXMLsingular [Exa] [C] {\handlePMLunit\Exa}
+
+\remapXMLsingular [Times] [C] {\handlePMLunit\Times}
+\remapXMLsingular [Solidus] [C] {\handlePMLunit\Solidus}
+\remapXMLsingular [Per] [C] {\handlePMLunit\Per}
+\remapXMLsingular [OutOf] [C] {\handlePMLunit\OutOf}
+
+\remapXMLsingular [Linear] [C] {\handlePMLunit\Linear}
+\remapXMLsingular [Square] [C] {\handlePMLunit\Square}
+\remapXMLsingular [Cubic] [C] {\handlePMLunit\Cubic}
+
+\remapXMLsingular [Inverse] [C] {\handlePMLunit\Inverse}
+
+\remapXMLsingular [Degrees] [C] {\handlePMLunit\Degrees}
+\remapXMLsingular [Meter] [C] {\handlePMLunit\Meter}
+\remapXMLsingular [Liter] [C] {\handlePMLunit\Liter}
+\remapXMLsingular [Sec] [C] {\handlePMLunit\Sec}
+\remapXMLsingular [Year] [C] {\handlePMLunit\Year}
+\remapXMLsingular [Month] [C] {\handlePMLunit\Month}
+\remapXMLsingular [Week] [C] {\handlePMLunit\Week}
+\remapXMLsingular [Day] [C] {\handlePMLunit\Day}
+\remapXMLsingular [Hour] [C] {\handlePMLunit\Hour}
+\remapXMLsingular [Min] [C] {\handlePMLunit\Min}
+\remapXMLsingular [Second] [C] {\handlePMLunit\Sec}
+\remapXMLsingular [Rad] [C] {\handlePMLunit\Rad}
+\remapXMLsingular [Deg] [C] {\handlePMLunit\Deg}
+\remapXMLsingular [Hertz] [C] {\handlePMLunit\Hertz}
+\remapXMLsingular [RevPerSec] [C] {\handlePMLunit\RevPerSec}
+\remapXMLsingular [RevPerMin] [C] {\handlePMLunit\RevPerMin}
+\remapXMLsingular [Gram] [C] {\handlePMLunit\Gram}
+\remapXMLsingular [Atom] [C] {\handlePMLunit\Atom}
+\remapXMLsingular [Newton] [C] {\handlePMLunit\Newton}
+\remapXMLsingular [Pascal] [C] {\handlePMLunit\Pascal}
+\remapXMLsingular [Joule] [C] {\handlePMLunit\Joule}
+\remapXMLsingular [Watt] [C] {\handlePMLunit\Watt}
+\remapXMLsingular [Celsius] [C] {\handlePMLunit\Celsius}
+\remapXMLsingular [Kelvin] [C] {\handlePMLunit\Kelvin}
+\remapXMLsingular [Fahrenheit] [C] {\handlePMLunit\Fahrenheit}
+\remapXMLsingular [Mol] [C] {\handlePMLunit\Mol}
+\remapXMLsingular [Molair] [C] {\handlePMLunit\Molair}
+\remapXMLsingular [Equivalent] [C] {\handlePMLunit\Equivalent}
+\remapXMLsingular [Farad] [C] {\handlePMLunit\Farad}
+\remapXMLsingular [Ohm] [C] {\handlePMLunit\Ohm}
+\remapXMLsingular [Siemens] [C] {\handlePMLunit\Siemens}
+\remapXMLsingular [Ampere] [C] {\handlePMLunit\Ampere}
+\remapXMLsingular [Coulomb] [C] {\handlePMLunit\Coulomb}
+\remapXMLsingular [Volt] [C] {\handlePMLunit\Volt}
+\remapXMLsingular [eVolt] [C] {\handlePMLunit\eVolt}
+\remapXMLsingular [Tesla] [C] {\handlePMLunit\Tesla}
+\remapXMLsingular [VoltAC] [C] {\handlePMLunit\VoltAC}
+\remapXMLsingular [VoltDC] [C] {\handlePMLunit\VoltDC}
+\remapXMLsingular [Baud] [C] {\handlePMLunit\Baud}
+\remapXMLsingular [Bit] [C] {\handlePMLunit\Bit}
+\remapXMLsingular [Byte] [C] {\handlePMLunit\Byte}
+\remapXMLsingular [Bequerel] [C] {\handlePMLunit\Bequerel}
+\remapXMLsingular [Sievert] [C] {\handlePMLunit\Sievert}
+\remapXMLsingular [Candela] [C] {\handlePMLunit\Candela}
+\remapXMLsingular [Bell] [C] {\handlePMLunit\Bell}
+\remapXMLsingular [At] [C] {\handlePMLunit\At}
+\remapXMLsingular [Atm] [C] {\handlePMLunit\Atm}
+\remapXMLsingular [Bar] [C] {\handlePMLunit\Bar}
+\remapXMLsingular [EVolt] [C] {\handlePMLunit\EVolt}
+\remapXMLsingular [Foot] [C] {\handlePMLunit\Foot}
+\remapXMLsingular [Inch] [C] {\handlePMLunit\Inch}
+\remapXMLsingular [Cal] [C] {\handlePMLunit\Cal}
+\remapXMLsingular [Force] [C] {\handlePMLunit\Force}
+\remapXMLsingular [Lux] [C] {\handlePMLunit\Lux}
+\remapXMLsingular [Gray] [C] {\handlePMLunit\Gray}
+\remapXMLsingular [Weber] [C] {\handlePMLunit\Weber}
+\remapXMLsingular [Henry] [C] {\handlePMLunit\Henry}
+\remapXMLsingular [Sterant] [C] {\handlePMLunit\Sterant}
+\remapXMLsingular [Angstrom] [C] {\handlePMLunit\Angstrom}
+\remapXMLsingular [Gauss] [C] {\handlePMLunit\Gauss}
+
+\remapXMLsingular [Percent] [C] {\handlePMLunit\Percent}
+\remapXMLsingular [Promille] [C] {\handlePMLunit\Promille}
+\remapXMLsingular [Permille] [C] {\handlePMLunit\Permille}
+
+\remapXMLsingular [Unit] [C] {\handlePMLunit\Unit}
+\remapXMLsingular [NoUnit] [C] {\handlePMLunit\NoUnit}
+
+\stopXMLmapping
+
+\endinput
diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex
new file mode 100644
index 000000000..6ce33ab84
--- /dev/null
+++ b/tex/context/base/xtag-pre.tex
@@ -0,0 +1,325 @@
+%D \module
+%D [ file=xtag-pre,
+%D version=2000.12.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Predefined Things
+%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.
+
+\beginTEX
+ \endinput
+\endTEX
+
+\writestatus{loading}{Context XML Macros (predefined)}
+
+%D Here we predefine some escapes, processing instructions,
+%D entities and other handy things.
+
+\unprotect
+
+%D First we define the default error handler. When tracing is
+%D activated, the unknown element is showed verbatim.
+
+\defineXMLenvironment [\s!default] \defaultXMLelement \defaultXMLelement
+\defineXMLsingular [\s!default] \defaultXMLelement
+
+\def\defaultXMLelement{\iftraceXMLelements[\currentXMLelement]\fi}
+
+%D The following entities need to be defined anyway. They
+%D may be overloaded later.
+
+\defineXMLentities [amp] {\string&} {\&}
+\defineXMLentities [gt] {\string>} {\mathematics{>}}
+\defineXMLentities [lt] {\string<} {\mathematics{<}}
+\defineXMLentities [quot] {\string"} {\mathematics{"}}
+\defineXMLentities [apos] {\string`} {\mathematics{'}}
+
+%D Of course we define:
+
+\defineXMLentities [tex] {tex} {\TeX}
+\defineXMLentities [context] {context} {\ConTeXt}
+\defineXMLentities [xml] {xml} {XML}
+\defineXMLentities [xsd] {xsd} {XSD}
+\defineXMLentities [html] {html} {HTML}
+
+%D The following entities are used for internal purposes and
+%D concern characters that are kind of problematic in \TEX\
+%D input.
+
+\defineXMLentities [tex-hash] {\letterhash} {\#}
+\defineXMLentities [tex-dollar] {\letterdollar} {\$}
+\defineXMLentities [tex-percent] {\letterpercent} {\%}
+\defineXMLentities [tex-backslash] {\letterbackslash} {\texescape}
+\defineXMLentities [tex-hat] {\letterhar} {\^{}}
+\defineXMLentities [tex-underscore] {\letterunderscore} {\_}
+\defineXMLentities [tex-leftbrace] {\letterleftbrace} {\leftargument}
+\defineXMLentities [tex-rightbrace] {\letterrightbrace} {\rightargument}
+\defineXMLentities [tex-bar] {\letterbar} {\vl}
+\defineXMLentities [tex-tilde] {\lettertilde} {\~{}}
+
+%D Some pretty printing macros will use color, for which we
+%D define a dedicated palet here.
+
+\definepalet
+ [xtag]
+ [0=darkgray, 1=darkred, 2=darkgreen,
+ 3=darkblue, 4=darkcyan, 5=darkmagenta,
+ 6=darkyellow, 7=black, 8=black]
+
+%D An example of its usage can be found in the pretty
+%D printing macros in the run time module.
+
+\newif\ifautoXMLshow \autoXMLshowtrue
+\newif\ifshowXMLarguments \showXMLargumentstrue
+
+\def\setupXMLfile{\dodoubleargument\getparameters[\??xf]}
+
+\setupXMLfile
+ [\c!tussen=\blanko,
+ \c!niveau=1]
+
+\fetchruntimecommand\showXMLfile {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLbuffer{\f!xtagprefix\s!run}
+
+\fetchruntimecommand\showXMLign {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLnop {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLtxt {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLpar {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLlin {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLwrd {\f!xtagprefix\s!run}
+\fetchruntimecommand\showXMLemp {\f!xtagprefix\s!run}
+
+%D By default, we will ignore escape commands, preceded by
+%D \type {<!} and ending in (presumably) a \type {>}.
+
+\defineXMLescape [\s!default] {\gobbleuntil{>}}
+
+%D The comment escape has the form:
+%D
+%D \starttypen
+%D <!-- a couple of remarks -->
+%D \stoptypen
+
+\defineXMLescape [--] {\gobbleuntil{-->}}
+
+%D The \type {CDATA} escape is kind of unique in its
+%D strange syntax.
+%D
+%D \starttypen
+%D <!CDATA[
+%D whatever you like to be shown verbatim
+%D ]]>
+%D \stoptypen
+%D
+%D Watch this rather obscure definition (we need to pass an
+%D \type {[} to the macro.
+
+\defineXMLescape [{CDATA[}]
+ {\skipfirstverbatimlinefalse
+ \processtaggeddisplayverbatim{]]>}}
+
+%D \starttypen
+%D <!ENTITY crap "very new [&#x7B;] crap">
+%D <!ENTITY crap SYSTEM "crapfile.xml">
+%D <!ENTITY crap SYSTEM "crapfile.pdf" NDATA ignoredanyway>
+%D \stoptypen
+
+\defineXMLescape [ENTITY] \handleXMLentityescape
+
+\def\handleXMLentityescape#1>%
+ {\dohandleXMLentityescape#1 @ @ @ @ @ @>}
+
+\def\dohandleXMLentityescape#1 #2 #3 #4>
+ {\doifnot{#1}{\letterpercent}
+ {\doifelse{#2}{SYSTEM}
+ {\dohandleXMLentitySYSTEM#1 #2 #3 #4>}
+ {\dohandleXMLentityDEFINE#1 #2 #3 #4>}}}
+
+\def\dohandleXMLentitySYSTEM#1 #2 #3 #4 #5 #6>% name SYSTEM ....
+ {\doifelse{#4}{@}
+ {\expanded{\defineXMLentity[#1]{\noexpand\readXMLsystem{\unstringed#3}}}}
+ {\doif{#4}{NDATA} % maybe we should also store the NDATA
+ {\expanded{\defineXMLentity[#1]{\noexpand\readXMLndata{\unstringed#3}}}}}}
+
+\def\readXMLsystem#1%
+ {\readfile{#1}
+ {\writestatus{xml-system}{reading #1}}
+ {\writestatus{xml-system}{unable to locate #1}}}
+
+\def\readXMLndata#1%
+ {#1} % {\externalfigure[#1]}
+
+\def\dohandleXMLentityDEFINE#1 %#2 #3 #4 #5 #6>% name replacement
+ {\def\docommando##1>{\expanded{\defineXMLentity[#1]{\the\scratchtoks}}}%
+ \afterassignment\docommando\grabstring}
+
+%D Such entities can be encapsulated in a \type {DOCTYPE}
+%D element. Therefore we remove the outer level of document
+%D type definitions.
+
+\defineXMLescape [DOCTYPE] \handleXMLdoctype
+
+\def\handleXMLdoctype#1 #2%
+ {\doifelse{#2}{[}
+ {%\writestatus{xml-doctype}{expanding #1}%
+ \def\next{\processuntil{]>}}}
+ {%\writestatus{xml-doctype}{skipping #1}%
+ \def\next{\gobbleuntil {>}}}%
+ \next}
+
+%D Some day we may need to support entities within a
+%D document type namespace.
+
+%D As an example of processing instructions, we implement a
+%D \CONTEXT\ code handler:
+
+\defineXMLprocessor [context] \contextXMLcommand
+\defineXMLprocessor [context-command] \contextXMLcommand
+
+% we need to get rid of the endlinechar inserted by \scantokens
+%
+% \def\saveendlinechar%
+% {\ifx\restoreendlinechar\undefined
+% \edef\restoreendlinechar{\endlinechar\the\endlinechar\space}%
+% \fi
+% \endlinechar=-1 }
+%
+% \def\scanXMLtokens#1%
+% {\saveendlinechar\scantokens{#1}\restoreendlinechar}
+
+%D For security reasons, we provide a switch to turn this
+%D mechanism on and off. When turned off, there is no way to
+%D turn it on from within an \XML\ encoded document, simply
+%D because the possibility to process \CONTEXT\ commands is
+%D gone.
+
+\setupXMLprocessing[\c!commando=\v!ja]
+
+%\def\contextXMLcommand#1%
+% {\doif{\@@xpcommando}{\v!ja}
+% {\pushmacro\disableXML
+% \def\disableXML{\global\let\afterXMLprocessor\empty}%
+% \global\let\afterXMLprocessor\enableXML
+% \setnormalcatcodes\scantokens{#1}\afterXMLprocessor
+% \popmacro\disableXML}}
+
+\def\contextXMLcommand#1% we don't use #1 here
+ {\doif{\@@xpcommando}{\v!ja}
+ {\disableXML\scantokens\@EA{\currentXMLprocess}\enableXML}}
+
+%D The indirect method (using the macro \type
+%D {\currentXMLprocess} instead of \type {#}) is needed
+%D because of the \type {\scantokens}. Given the previous
+%D definition, and given that \ETEX\ is used, we can now
+%D say:
+%D
+%D \starttypen
+%D <?context-command {\bf Start Of Some \TeX\ Text} ?>
+%D \stoptypen
+%D
+%D A non||\ETEX\ solution is also possible, using buffers,
+%D but for the moment we assume that \ETEX\ is used.
+
+%D Next we implement a general purpose directive. This one
+%D can be used to set variables that can be accessed with
+%D \type {\XMLvar}.
+
+\defineXMLprocessor [context-directive] \contextXMLdirective
+
+\def\contextXMLdirective#1%
+ {\docontextXMLdirective#1 @ @ @\end}
+
+\def\docontextXMLdirective#1 #2 #3 #4\end% class variable value
+ {\csname\@@XMLvariable:#1:#2\endcsname{#3}}
+
+%D A simple processing instruction is the following. It just
+%D writes a message to the screen.
+
+\defineXMLprocessor [context-message] {\writestatus{xml-message}}
+
+%D The following processing instruction permits you to tag
+%D parts of the file in such a way that you can filter data.
+%D We use this method when documenting schemas.
+
+\defineXMLprocessor [context-block] \handleXMLcontextblock
+
+\def\handleXMLcontextblock#1%
+ {\dohandleXMLcontextblock#1 \relax}
+
+\def\dohandleXMLcontextblock#1 #2 #3\relax
+ {\dodohandleXMLcontextblock{#1}{#2}}
+
+\let\dodohandleXMLcontextblock\gobbletwoarguments
+
+\def\hideXMLcontextblock[#1]%
+ {\def\dodohandleXMLcontextblock
+ {\dododohandleXMLcontextblock\doifinset{#1}}}
+
+\def\videXMLcontextblock[#1]%
+ {\def\dodohandleXMLcontextblock
+ {\dododohandleXMLcontextblock\doifnotinset{#1}}}
+
+\protect
+
+\def\dododohandleXMLcontextblock#1#2#3#4%
+ {\let\next\relax
+ \doifelse{#3}{begin}
+ {#1{#4}{#2}
+ {%\writestatus{xml-block}{skipping begin #4}%
+ \long\def\next##1?context-block end #4 ##2?>{}}}
+ {\doif{#3}{name}
+ {#1{#4}{#2}
+ {%\writestatus{xml-block}{skipping name #4}%
+ \long\def\next##1?context-block ##2?>{}}}}%
+ \next}
+
+\unprotect
+
+%D Say that a file contains blocks like the following:
+%D
+%D \starttypen
+%D <?context-block begin whatevername ?>
+%D
+%D <to/> <be> <or/> maybe <not/> so much <to/> </be>
+%D
+%D <?context-block end whatevername ?>
+%D \stoptypen
+%D
+%D The following commands will show only this block:
+%D
+%D \starttypen
+%D \videXMLcontextblock[whatevername] \showXMLfile{yourfile}
+%D \stoptypen
+%D
+%D You can also mark blocks in the following way, thereby
+%D saving yourself some work:
+%D
+%D \starttypen
+%D <?context-block what ?>
+%D
+%D <what>What do you want?</what>
+%D
+%D <?context-block how ?>
+%D
+%D <how>How do you want?</how>
+%D
+%D <?context-block done ?>
+%D \stoptypen
+
+% yet undocumented and experimental
+
+% \defineXMLprocessor [context-eof] {\endinput}
+
+% already defined in xtag-ini
+
+% \defineXMLsingular [begingroup] {\begingroup}
+% \defineXMLsingular [endgroup] {\endgroup}
+%
+% \defineXMLsingular [gobblespacetokens] {\gobblespacetokens}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex
index 8da6ab9e3..7a919d31f 100644
--- a/tex/context/base/xtag-run.tex
+++ b/tex/context/base/xtag-run.tex
@@ -13,7 +13,7 @@
\writestatus{loading}{Context XML Macros (visualization)}
-\unprotect
+\unprotect
\bgroup
@@ -46,77 +46,192 @@
.egroup
-\definepalet
- [xtag]
- [0=darkgreen,
- 1=darkred,
- 2=darkblue,
- 3=darkgray]
+\gdef\@@XMLshow {\@@XML shw}
-\newcount\XMLlevel
+\gdef\@XMLindent#1%
+ {\ifnum\XMLlevel>1\advance\leftskip#11em\relax\fi}
-\def\@XMLindent#1%
-% {\ifnum\XMLlevel>0\advance\leftskip#11em\relax\fi}
- {\advance\leftskip#11em\relax}
-
-\def\@XMLlevel#1%
+\gdef\@XMLlevel#1%
{\advance\XMLlevel#11\relax}
-\def\@XMLentity#1%
- {\noindent
- \hbox
- {\localcolortrue
- \startcolormode{xtag:3}\string&#1;\stopcolormode}}
-
-\def\@XMLelement#1%
- {\ifhmode\unskip\fi
- \noindent
- \hbox
- {\localcolortrue
- \DoMod\XMLlevel by3to\scratchcounter
- \startcolormode{xtag:\number\scratchcounter}\string<\currentXMLelement\stopcolormode
+\unexpanded\gdef\@XMLentity#1%
+ {\noindent\hbox{\localcolortrue\color[xtag:0]{\string&#1;}}}
+
+\bgroup
+
+\@EA\catcode\string`=\@@active
+\@EA\catcode\string`"\@@active
+\@EA\catcode\string``\@@active
+\@EA\catcode\string`&\@@active
+
+\gdef\showXMLarguments%
+ {\ifshowXMLarguments
+ \bgroup
+ \@EA\catcode\string`=\@@active
+ \@EA\catcode\string`"\@@active
+ \@EA\catcode\string``\@@active
+ \@EA\catcode\string`&\@@active
+ \def={\color[xtag:7]{\string=}}%
+ \def"##1"{\string"\color[xtag:8]{##1}\string"}%
+ \def`##1`{\string`\color[xtag:8]{##1}\string`}%
+ \def&##1;{\string&\color[xtag:7]{##1}\string;}%
+ \scantokens\@EA{\currentXMLarguments}%
+ \egroup
+ \else
+ \currentXMLarguments
+ \fi}
+
+\egroup
+
+\ifx\XMLprettycycle\undefined \gdef\XMLprettycycle{3} \fi
+
+\doglobal\newcounter\@XMLnofelements
+
+\gdef\@XMLelement#1%
+ {\ifnum\XMLlevel<\@@xfniveau\relax
+ \ifnum\kindofXMLelement=2\else
+ \doglobal\increment\@XMLnofelements\relax
+ \ifcase\@XMLnofelements\else\@@xftussen\fi
+ \fi
+ \fi
+\hangindent2em
+\indent
+ \bgroup
+ \localcolortrue
+ \advance\XMLlevel -1
+ \DoMod\XMLlevel by\XMLprettycycle to\scratchcounter
+ \advance\scratchcounter 1
+ \startcolor[xtag:\number\scratchcounter]%
+ \string<%
+ \ifnum\kindofXMLelement=2\string/\fi
+ \currentXMLelement
+ \stopcolor
\ifcase#1\or\ifx\currentXMLarguments\empty\else
- \startcolormode{xtag:3}\hskip.5em\currentXMLarguments\unskip\stopcolormode
+ \cleanupXMLarguments
+ \startcolor[xtag:0]\hbox{\space}\showXMLarguments\unskip\stopcolor
\fi\fi
- \startcolormode{xtag:\number\scratchcounter}\string>\stopcolormode}%
+ \startcolor[xtag:\number\scratchcounter]%
+ \ifnum\kindofXMLelement=3\string/\fi
+ \string>%
+ \stopcolor
+ \egroup
+ \ifnum\XMLlevel<\@@xfniveau\relax
+ \ifnum\kindofXMLelement=1\else
+ \doglobal\increment\@XMLnofelements\relax
+ \ifcase\@XMLnofelements\else\@@xftussen\fi
+ \fi
+ \fi
\ignorespaces}
-\def\nextXMLtext{\blank\@XMLlevel+\@XMLelement1\par}
-\def\prevXMLtext{\par\@XMLelement0\par\@XMLlevel-\blank}
-\def\nextXMLpara{\nextXMLline\par}
-\def\prevXMLpara{\par\prevXMLline}
-\def\nextXMLline{\par\@XMLlevel+\@XMLindent+\@XMLelement1}
-\def\prevXMLline{\@XMLelement0\par\@XMLlevel-\@XMLindent-}
-\def\nextXMLword{\@XMLlevel+\@XMLelement1}
-\def\prevXMLword{\@XMLelement0\@XMLlevel-}
-
-\def\someXMLword{\@XMLlevel+\@XMLelement1\@XMLlevel-}
-
-\def\setXMLshow#1#2#3[#4]%
- {\def\docommando##1{#1[##1]#2#3}\processcommalist[#4]\docommando}
-
-\def\showXMLtxt{\setXMLshow\defineXMLenvironment\nextXMLtext\prevXMLtext}
-\def\showXMLpar{\setXMLshow\defineXMLenvironment\nextXMLpara\prevXMLpara}
-\def\showXMLlin{\setXMLshow\defineXMLenvironment\nextXMLline\prevXMLline}
-\def\showXMLwrd{\setXMLshow\defineXMLenvironment\nextXMLword\prevXMLword}
-\def\showXMLemp{\setXMLshow\defineXMLsingular\someXMLword\relax}
-
-\def\showXMLfile#1%
- {{\tttf\dontcomplain
- \let\executeXMLentity\@XMLentity
- \enableXML\verbatimXML
- \processfile{#1}}}
-
-\def\showXMLbuffer%
+\gdef\nextXMLtext{\blank\@XMLlevel+\@XMLelement1\par}
+\gdef\prevXMLtext{\par\@XMLelement0\par\@XMLlevel-\blank}
+\gdef\nextXMLpara{\nextXMLline\par}
+\gdef\prevXMLpara{\par\prevXMLline}
+\gdef\nextXMLline{\par\@XMLlevel+\@XMLindent+\@XMLelement1}
+\gdef\prevXMLline{\@XMLelement0\par\@XMLindent-\@XMLlevel-}
+\gdef\nextXMLword{\@XMLlevel+\@XMLelement1}
+\gdef\prevXMLword{\@XMLelement0\@XMLlevel-}
+
+\gdef\someXMLtext{\blank\@XMLlevel+\@XMLelement1\@XMLlevel-\blank}
+\gdef\someXMLpara{\someXMLline}
+\gdef\someXMLline{\par\@XMLlevel+\@XMLindent+\@XMLelement1\par\@XMLindent-\@XMLlevel-}
+\gdef\someXMLword{\@XMLlevel+\@XMLelement1\@XMLlevel-}
+
+\gdef\@XMLindent#1%
+ {\ifnum\XMLlevel>0\advance\leftskip#11em\relax\fi}
+
+\gdef\nextXMLtext{\blank\@XMLlevel+\@XMLelement1\par\@XMLindent+}
+\gdef\prevXMLtext{\par\@XMLindent-\@XMLelement0\par\@XMLlevel-\blank}
+\gdef\nextXMLpara{\nextXMLline\par\@XMLindent+}
+\gdef\prevXMLpara{\par\@XMLindent-\prevXMLline}
+\gdef\nextXMLline{\par\@XMLlevel+\@XMLelement1}
+\gdef\prevXMLline{\@XMLelement0\par\@XMLlevel-}
+
+\gdef\someXMLline{\par\@XMLlevel+\@XMLelement1\par\@XMLlevel-}
+
+\gdef\setXMLshow#1#2#3[#4]%
+ {\def\docommando##1{#1[##1]#2#3\letvalue{\@@XMLshow:##1}\empty}%
+ \processcommalist[#4]\docommando}
+
+\gdef\showXMLign[#1]%
+ {\setXMLshow\defineXMLignore \relax\relax[#1]%
+ \setXMLshow\defineXMLsingular \relax\relax[#1]}
+
+\gdef\showXMLnop[#1]%
+ {\setXMLshow\defineXMLenvironment\relax\relax[#1]%
+ \setXMLshow\defineXMLsingular \relax\relax[#1]}
+
+\gdef\showXMLtxt[#1]%
+ {\setXMLshow\defineXMLenvironment\nextXMLtext\prevXMLtext[#1]%
+ \setXMLshow\defineXMLsingular \someXMLtext\relax [#1]}
+
+\gdef\showXMLpar[#1]%
+ {\setXMLshow\defineXMLenvironment\nextXMLpara\prevXMLpara[#1]%
+ \setXMLshow\defineXMLsingular \someXMLline\relax [#1]}
+
+\gdef\showXMLlin[#1]%
+ {\setXMLshow\defineXMLenvironment\nextXMLline\prevXMLline[#1]%
+ \setXMLshow\defineXMLsingular \someXMLword\relax [#1]}
+
+\gdef\showXMLwrd[#1]%
+ {\setXMLshow\defineXMLenvironment\nextXMLword\prevXMLword[#1]%
+ \setXMLshow\defineXMLsingular \someXMLword\relax [#1]}
+
+\gdef\showXMLemp[#1]%
+ {\setXMLshow\defineXMLsingular\someXMLword\relax[#1]}
+
+\gdef\doautoshowXMLelement%
+ {\ifcase\kindofXMLelement
+ \or \nextXMLpara \or \prevXMLpara \or \someXMLline
+ \fi}
+
+\gdef\autoshowXMLelement%
+ {\ifcsname\@@XMLshow:\currentXMLelement\endcsname
+ \expandafter\normalexecuteXMLelement
+ \else
+ \expandafter\doautoshowXMLelement
+ \fi}
+
+\global\let\normalexecuteXMLelement\executeXMLelement
+
+\gdef\showXMLfile#1%
+ {\bgroup
+ \nohyphens
+ \dontcomplain
+ \XMLlevel=0
+ \increment\@@xfniveau % hack
+ \tttf
+ \startopelkaar[\v!blanko]
+ \ifautoXMLshow \let\executeXMLelement\autoshowXMLelement \fi
+ \let\executeXMLentity\@XMLentity
+ \enableXML\verbatimXML
+ \readfile{\truefilename{#1}}{}{}\endgraf
+ \stopopelkaar
+ \egroup}
+
+\gdef\showXMLbuffer%
{\dosingleempty\doshowXMLbuffer}
-\def\doshowXMLbuffer[#1]%
+\gdef\doshowXMLbuffer[#1]%
{\doifelsenothing{#1}
{\doshowXMLbuffer[\jobname]}
{\bgroup
- \def\dodoprocessXMLbuffer##1%
- {\showXMLfile{\TEXbufferfile{##1}}}%
+ \def\dodoprocessXMLbuffer##1{\showXMLfile{\TEXbufferfile{##1}}}%
\processcommalist[#1]\dodoprocessXMLbuffer
\egroup}}
-\protect \endinput
+%D
+
+\gdef\showXSDcomponent%
+ {\dodoubleargument\doshowXSDcomponent}
+
+\gdef\doshowXSDcomponent[#1][#2]%
+ {\bgroup
+ \showXMLnop[xsd:schema]
+ \showXMLign[xsd:appInfo]
+ \showXMLign[xsd:annotation]
+ \videXMLcontextblock[#2]
+ \showXMLfile{#1}
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-xsd.tex b/tex/context/base/xtag-xsd.tex
new file mode 100644
index 000000000..e354202d5
--- /dev/null
+++ b/tex/context/base/xtag-xsd.tex
@@ -0,0 +1,28 @@
+%D \module
+%D [ file=xtag-pre,
+%D version=2001.10.04,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Schemas,
+%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
+
+%D The following commands picks up a named block from the
+%D given file and pretty prints it.
+%D
+%D \starttypen
+%D \showXSDcomponent [x-exa-tx.xsd] [sequence]
+%D \stoptypen
+%D
+%D If needed, you adapt the colors used by redefining the
+%D \type {xtag} color palet.
+
+\fetchruntimecommand\showXSDcomponent {\f!xtagprefix\s!run}
+
+\protect \endinput
diff --git a/tex/context/config/cont-usr.tex b/tex/context/config/cont-usr.tex
index e11370510..38dbab706 100644
--- a/tex/context/config/cont-usr.tex
+++ b/tex/context/config/cont-usr.tex
@@ -30,10 +30,11 @@
\definefilesynonym [lang-da.pat] [dkhyph.tex]
\definefilesynonym [lang-de.pat] [dehyphn.tex]
\definefilesynonym [lang-en.pat] [ushyph1.tex]
+\definefilesynonym [lang-es.pat] [eshyph.tex]
\definefilesynonym [lang-fi.pat] [fihyph.tex]
\definefilesynonym [lang-fr.pat] [frhyph.tex]
-\definefilesynonym [lang-hu.pat] [huhyph.tex]
\definefilesynonym [lang-hr.pat] [hrhyph.tex]
+\definefilesynonym [lang-hu.pat] [huhyph.tex]
\definefilesynonym [lang-it.pat] [ithyph.tex]
\definefilesynonym [lang-la.pat] [lahyph7.tex]
\definefilesynonym [lang-nl.pat] [nehyph.tex]
@@ -41,10 +42,11 @@
\definefilesynonym [lang-pl.pat] [plhyph.tex]
\definefilesynonym [lang-pt.pat] [pthyph.tex]
\definefilesynonym [lang-ro.pat] [rohyph.tex]
+\definefilesynonym [lang-ru.pat] [ruenhyph.tex]
\definefilesynonym [lang-sk.pat] [skhyph.tex]
-\definefilesynonym [lang-es.pat] [eshyph.tex]
\definefilesynonym [lang-sv.pat] [sehyph.tex]
\definefilesynonym [lang-tr.pat] [trhyph.tex]
+\definefilesynonym [lang-ua.pat] [ukrenhyp.tex]
\definefilesynonym [lang-uk.pat] [ukhyphen.tex]
\definefilesynonym [lang-us.pat] [ushyph1.tex]
@@ -86,9 +88,11 @@
% \installlanguage [\s!da] [\c!status=\v!start] % danish
% \installlanguage [\s!de] [\c!status=\v!start] % german
% \installlanguage [\s!en] [\c!status=\v!start] % english us
+% \installlanguage [\s!es] [\c!status=\v!start] % spanish
% \installlanguage [\s!fi] [\c!status=\v!start] % finnish
% \installlanguage [\s!fr] [\c!status=\v!start] % french
% \installlanguage [\s!hr] [\c!status=\v!start] % croatian
+% \installlanguage [\s!hu] [\c!status=\v!start] % hungarian
% \installlanguage [\s!it] [\c!status=\v!start] % italian
% \installlanguage [\s!la] [\c!status=\v!start] % latin
% \installlanguage [\s!nl] [\c!status=\v!start] % dutch
@@ -96,11 +100,11 @@
% \installlanguage [\s!pl] [\c!status=\v!start] % polish
% \installlanguage [\s!pt] [\c!status=\v!start] % portuguese
% \installlanguage [\s!ro] [\c!status=\v!start] % romanian
-% \installlanguage [\s!hu] [\c!status=\v!start] % hungarian
+% \installlanguage [\s!ru] [\c!status=\v!start] % russian
% \installlanguage [\s!sk] [\c!status=\v!start] % slovak
-% \installlanguage [\s!es] [\c!status=\v!start] % spanish
% \installlanguage [\s!sv] [\c!status=\v!start] % swedish
% \installlanguage [\s!tr] [\c!status=\v!start] % turkish
+% \installlanguage [\s!ua] [\c!status=\v!start] % ukrainian
% \installlanguage [\s!uk] [\c!status=\v!start] % english uk
% \installlanguage [deo] [\c!status=\v!start] % old german
@@ -114,9 +118,11 @@
% \setupcurrentlanguage[\s!da]
% \setupcurrentlanguage[\s!de]
% \setupcurrentlanguage[\s!en]
+% \setupcurrentlanguage[\s!es]
% \setupcurrentlanguage[\s!fi]
% \setupcurrentlanguage[\s!fr]
% \setupcurrentlanguage[\s!hr]
+% \setupcurrentlanguage[\s!hu]
% \setupcurrentlanguage[\s!it]
% \setupcurrentlanguage[\s!la]
% \setupcurrentlanguage[\s!nl]
@@ -124,11 +130,11 @@
% \setupcurrentlanguage[\s!pl]
% \setupcurrentlanguage[\s!pt]
% \setupcurrentlanguage[\s!ro]
-% \setupcurrentlanguage[\s!hu]
+% \setupcurrentlanguage[\s!ru]
% \setupcurrentlanguage[\s!sk]
-% \setupcurrentlanguage[\s!es]
% \setupcurrentlanguage[\s!sv]
% \setupcurrentlanguage[\s!tr]
+% \setupcurrentlanguage[\s!ua]
%D Local font settings can go here. Normally suitable
%D defaults are already preloaded, almost certainly the
diff --git a/tex/context/extra/setup-qr.tex b/tex/context/extra/setup-qr.tex
index 31f40f6ca..d78943cce 100644
--- a/tex/context/extra/setup-qr.tex
+++ b/tex/context/extra/setup-qr.tex
@@ -1,89 +1,40 @@
-% output=pdftex tex=pdfetex modes=cmr,nocover
-
-% This file is not part of the regular ConTeXt distribution.
-% Because this file generates the official ConTeXt command
-% references, you may not alter it.
-%
-% copyright: 19..-2001, Hans Hagen, PRAGMA-ADE, Hasselt NL
-
-% modes: cmr use cmr fonts
-% nocover don't produce a cover page
-%
-% other modes are supported by the cod driver
-
-\unprotect
-
-\startinterface dutch \def\LocalColor{green} \stopinterface
-\startinterface english \def\LocalColor{red} \stopinterface
-\startinterface german \def\LocalColor{blue} \stopinterface
-\startinterface czech \def\LocalColor{magenta} \stopinterface
-\startinterface italian \def\LocalColor{cyan} \stopinterface
-\startinterface romanian \def\LocalColor{yellow} \stopinterface
-
-\startuseMPgraphic{cover}
- def something =
- path p, q;
- color localgray, drawcolor, fillcolor, localcolor;
- localgray := (.9,.9,.9);
- localcolor := \LocalColor ;
- p := (0,0)--(200,0)--(200,50)--(0,50)--cycle;
- q := (25,25)--(175,25);
- dx := uniformdeviate 600;
- dy := uniformdeviate 900;
- sx := .3+(uniformdeviate .5);
- sy := .3+(uniformdeviate .5);
- drawcolor := (uniformdeviate 1)[.75localcolor,localcolor];
- fillcolor := (uniformdeviate 1)[.75localgray,localgray];
- rr := uniformdeviate 360;
- p := p xscaled sx yscaled sy rotated rr shifted (dx,dy);
- q := q xscaled sx yscaled sy rotated rr shifted (dx,dy);
- fill p withcolor fillcolor;
- ahlength := (.2+sy)*15;
- ahangle := (.2+sx)*45;
- draw p withpen pencircle scaled 7.5 withcolor drawcolor;
- drawarrow q withpen pencircle scaled 7.5 withcolor drawcolor;
- enddef;
- for i := 1 upto 1000:
- something;
- endfor;
- setbounds currentpicture to unitsquare
- xscaled \overlaywidth yscaled \overlayheight;
-\stopuseMPgraphic
-
-\startnotmode[cmr]
-
-\setupbodyfont[lbr]
-
-\stopnotmode
+% output=pdftex tex=pdfetex
+
+%D \module
+%D [ file=setup-qr,
+%D version=1997.07.22,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Quick Reference Document / Efficient,
+%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 is a stripped down version of the good old quick
+%D reference document. This version is more compact and
+%D therefore better suited for local processing and printing.
+%D The slightly more fancy version can be fetched from the
+%D \CONTEXT\ web site.
+
+\dontcomplain \silentmode
+
+\unprotect
\setupbodyfont
[9pt]
-\setupcolors
- [\c!status=\v!start]
-
-\startnotmode[nocover]
-
-\defineoverlay
- [cover]
- [\useMPgraphic{cover}]
-
-\stopnotmode
-
\stellayoutin
- [\c!rugwit=2cm,
- \c!kopwit=2cm,
+ [\c!rugwit=1cm,
+ \c!kopwit=1cm,
\c!hoofd=0cm,
\c!voet=0cm,
- \c!marge=0cm,
- \c!breedte=\v!passend,
- \c!hoogte=\v!passend]
+ \c!breedte=\v!midden,
+ \c!hoogte=\v!midden]
-\stelnummeringin
- [\c!status=\v!stop,
- \c!variant=\v!dubbelzijdig]
-
-\input setupa.tex
+\readfile{setupa} {} {}
\stelsetupin
[\c!criterium=\v!alles,
@@ -93,47 +44,16 @@
[setuptext]
[\c!kader=\v!aan]
-\usemodule[cod-01]
-
-\input setupb.tex
+\readfile{setupb} {} {}
\starttekst
-\setupbackgrounds
- [\v!rechterpagina]
- [\c!achtergrond=cover]
-
-\startmakeup[\v!standaard]
- \definefont[test][RegularBold at 100pt]\test\setstrut
- \steluitlijnenin[\v!midden]
- \strut Con\TeX t \par
- \definefont[test][RegularBold at 75pt]\test\setstrut
- \startinterface dutch \strut commando's \par \stopinterface
- \startinterface english \strut commands \par \stopinterface
- \startinterface german \strut befehle \par \stopinterface
- \startinterface czech \strut prikazy \par \stopinterface
- \startinterface italian \strut comandi \par \stopinterface
- \startinterface romanian \strut comenzile \par \stopinterface
- \vfill
- \definefont[test][RegularBold at 150pt]\test\setstrut
- \startinterface dutch \strut NL \stopinterface
- \startinterface english \strut EN \stopinterface
- \startinterface german \strut DE \stopinterface
- \startinterface czech \strut CZ \stopinterface
- \startinterface italian \strut IT \stopinterface
- \startinterface romanian \strut RO \stopinterface
-\stopmakeup
-
-\setupbackgrounds
- [\v!rechterpagina]
- [\c!achtergrond=]
-
\startmakeup[\v!standaard]
- \definefont[test][RegularBold at 60pt]\test\setstrut
\steluitlijnenin[\v!midden]
+ \definedfont[RegularBold at 60pt]\setstrut
\strut Con\TeX t \par
\vskip24pt
- \definefont[test][RegularBold at 45pt]\test\setstrut
+ \definedfont[RegularBold at 45pt]\setstrut
\startinterface dutch \strut commando's \par \stopinterface
\startinterface english \strut commands \par \stopinterface
\startinterface german \strut befehle \par \stopinterface
@@ -148,31 +68,10 @@
\startinterface czech \strut \^cesk\'y \par \stopinterface
\startinterface italian \strut italiano \par \stopinterface
\startinterface romanian \strut rom\^{a}n\u{a} \par \stopinterface
-
-\stopmakeup
-
-\stellayoutin
- [\c!kopwit=1.5cm]
-
-\protect \placesetup \unprotect
-
-\pagina[\v!ja,\v!blanko,\v!rechts,\v!links]
-
-\setupbackgrounds
- [\v!linkerpagina]
- [\c!achtergrond=cover]
-
-\stellayoutin
- [\c!kopwit=2cm]
-
-\startmakeup[\v!standaard][\c!pagina=]
- \definefont[test][RegularBold at 24pt]\test\stelinterliniein
- \steluitlijnenin[\v!midden]
- \vfill
- PRAGMA ADE \par
- Ridderstraat 27, 8061GH Hasselt NL
\stopmakeup
\protect
+\placesetup
+
\stoptekst
diff --git a/tex/context/user/cont-sys.rme b/tex/context/user/cont-sys.rme
index 4da61099c..a571c8c60 100644
--- a/tex/context/user/cont-sys.rme
+++ b/tex/context/user/cont-sys.rme
@@ -71,9 +71,9 @@
%
% Enabling \CONTEXT\ navigation symbols as well as \euro's.
-\usesymbols [nav,eur]
+\usesymbols [nav,mvs]
-\setupsymbolset [navigation 1]
+\setupsymbolset [navigation 1] % not that clever
\setupinteraction [\c!symboolset=navigation 1]
diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf.tex
index 665971088..9cd130fd5 100644
--- a/tex/generic/context/mptopdf.tex
+++ b/tex/generic/context/mptopdf.tex
@@ -84,7 +84,7 @@
%D are collected in the file:
\input supp-pdf
-\input supp-mpe
+\input supp-mpe \MPcmyktrue
%D We use no output routine.
diff --git a/tex/generic/context/ppchtex.noc b/tex/generic/context/ppchtex.noc
index 81ec994e9..12cc676af 100644
--- a/tex/generic/context/ppchtex.noc
+++ b/tex/generic/context/ppchtex.noc
@@ -126,8 +126,12 @@
\defineconstant number getal nummer
\defineconstant height hoogte hoehe
\defineconstant frame kader rahmen
+%defineconstant framecolor kaderkleur rahmenfarbe
+\defineconstant color kleur farbe
\defineconstant bodyfont korps fliesstext
\defineconstant style letter schriftstil
+\defineconstant rulethickness lijndikte liniendicke
+\defineconstant rulecolor lijnkleur linienfarbe
\defineconstant left links links
\defineconstant offset offset offset
\defineconstant bottom onder unten
@@ -138,6 +142,7 @@
\defineconstant scale schaal format
\defineconstant status status status
\defineconstant text tekst text
+\defineconstant textcolor tekstkleur tekstfarbe
\defineconstant textsize tekstformaat textgroesse
\defineconstant alternative variant alternative
\defineconstant x x x
@@ -201,6 +206,6 @@
\setupchemical[\c!resolutie=\outputresolution]
\fi
-\protect
+\protect
\endinput