From 2129e59b313d0a032b7b6eb3dab287dd32437ef9 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 16 Nov 2006 12:02:00 +0100 Subject: stable 2006.11.16 12:02 --- context/data/cont-cz-scite.properties | 52 +- context/data/cont-de-scite.properties | 79 +- context/data/cont-en-scite.properties | 73 +- context/data/cont-fr-scite.properties | 28 +- context/data/cont-it-scite.properties | 29 +- context/data/cont-nl-scite.properties | 33 +- context/data/cont-ro-scite.properties | 24 +- context/data/context-jedit-cz.xml | 1 + context/data/context-jedit-de.xml | 1 + context/data/context-jedit-en.xml | 1 + context/data/context-jedit-fr.xml | 1 + context/data/context-jedit-it.xml | 1 + context/data/context-jedit-nl.xml | 1 + context/data/context-jedit-ro.xml | 1 + context/data/context.properties | 4 +- doc/context/bib/bibmod-doc.pdf | Bin 271422 -> 301035 bytes doc/context/bib/bibmod-doc.tex | 27 +- doc/context/document/general/manuals/mreadme.pdf | Bin 0 -> 85996 bytes doc/context/document/general/manuals/tiptrick.pdf | Bin 0 -> 30607 bytes doc/context/manuals/allkind/mcommon.tex | 199 ++ doc/context/manuals/allkind/mreadme.tex | 361 +++ .../koeieletters/koeieletters-contour.afm | 2 +- fonts/afm/hoekwater/koeieletters/koeieletters.afm | 2 +- fonts/enc/pdftex/context/koeieletters.enc | 2 +- .../koeieletters/koeieletters-contour.pfb | Bin 44498 -> 44353 bytes .../type1/hoekwater/koeieletters/koeieletters.pfb | Bin 321235 -> 323625 bytes metapost/context/base/mp-form.mp | 288 +- metapost/context/base/mp-spec.mp | 57 +- metapost/context/base/mp-tool.mp | 3 +- scripts/context/perl/mptopdf.pl | 4 +- scripts/context/perl/texfont.pl | 525 +++- scripts/context/ruby/base/ctx.rb | 33 +- scripts/context/ruby/base/kpse.rb | 41 +- scripts/context/ruby/base/kpsefast.rb | 2 + scripts/context/ruby/base/mp.rb | 4 +- scripts/context/ruby/base/tex.rb | 196 +- scripts/context/ruby/base/texutil.rb | 37 +- scripts/context/ruby/concheck.rb | 56 +- scripts/context/ruby/ctxtools.rb | 553 +++- scripts/context/ruby/pdftools.rb | 5 +- scripts/context/ruby/pstopdf.rb | 2 +- scripts/context/ruby/rlxtools.rb | 66 +- scripts/context/ruby/texexec.rb | 83 +- scripts/context/ruby/texmfstart.rb | 102 +- scripts/context/ruby/texsync.rb | 5 +- scripts/context/ruby/textools.rb | 5 +- scripts/context/ruby/texutil.rb | 5 +- scripts/context/ruby/tmftools.rb | 5 +- scripts/context/ruby/www/exa.rb | 4 +- scripts/context/ruby/www/lib.rb | 15 +- scripts/context/ruby/wwwclient.rb | 2 +- scripts/context/ruby/wwwserver.rb | 2 +- scripts/context/ruby/wwwwatch.rb | 22 +- scripts/context/ruby/xmltools.rb | 11 +- scripts/context/stubs/mswin/luatools.bat | 2 + scripts/context/stubs/mswin/mtxtools.bat | 2 + scripts/context/stubs/unix/luatools | 2 + scripts/context/stubs/unix/mtxtools | 2 + tex/context/base/colo-ext.tex | 5 - tex/context/base/colo-ini.tex | 213 +- tex/context/base/cont-err.tex | 14 +- tex/context/base/cont-fil.tex | 2 + tex/context/base/cont-log.tex | 21 +- tex/context/base/cont-new.mkii | 14 + tex/context/base/cont-new.tex | 883 +----- tex/context/base/cont-usr.ori | 4 +- tex/context/base/context.tex | 612 ++-- tex/context/base/core-blk.tex | 678 +++++ tex/context/base/core-box.tex | 18 +- tex/context/base/core-buf.mkii | 143 + tex/context/base/core-buf.tex | 1004 +------ tex/context/base/core-con.mkii | 286 ++ tex/context/base/core-con.tex | 332 +-- tex/context/base/core-ctx.tex | 173 ++ tex/context/base/core-dat.tex | 4 +- tex/context/base/core-des.tex | 2 + tex/context/base/core-fig.tex | 2821 +++++++----------- tex/context/base/core-fld.tex | 58 +- tex/context/base/core-fnt.tex | 24 +- tex/context/base/core-grd.tex | 62 +- tex/context/base/core-hlp.tex | 6 +- tex/context/base/core-int.tex | 165 +- tex/context/base/core-itm.tex | 109 +- tex/context/base/core-job.tex | 109 +- tex/context/base/core-lme.tex | 55 + tex/context/base/core-lnt.tex | 2 +- tex/context/base/core-lst.tex | 2 +- tex/context/base/core-ltb.tex | 4 +- tex/context/base/core-mar.tex | 4 +- tex/context/base/core-mat.tex | 465 ++- tex/context/base/core-mis.tex | 497 +--- tex/context/base/core-nav.tex | 2 +- tex/context/base/core-new.tex | 103 +- tex/context/base/core-not.tex | 5 + tex/context/base/core-ntb.tex | 86 +- tex/context/base/core-num.tex | 2 +- tex/context/base/core-obj.mkii | 74 + tex/context/base/core-obj.tex | 94 +- tex/context/base/core-par.tex | 14 +- tex/context/base/core-pgr.tex | 212 +- tex/context/base/core-pos.mkii | 184 ++ tex/context/base/core-pos.tex | 432 +-- tex/context/base/core-ref.tex | 617 +--- tex/context/base/core-reg.tex | 414 ++- tex/context/base/core-rul.tex | 1040 ++++--- tex/context/base/core-sec.tex | 77 +- tex/context/base/core-spa.tex | 448 ++- tex/context/base/core-stg.tex | 72 + tex/context/base/core-syn.tex | 30 +- tex/context/base/core-sys.mkii | 14 + tex/context/base/core-sys.tex | 73 +- tex/context/base/core-tab.tex | 78 +- tex/context/base/core-tbl.tex | 22 +- tex/context/base/core-trf.tex | 543 ++++ tex/context/base/core-tsp.tex | 81 +- tex/context/base/core-two.mkii | 149 + tex/context/base/core-two.tex | 102 + tex/context/base/core-uti.mkii | 47 + tex/context/base/core-uti.tex | 441 +-- tex/context/base/core-var.tex | 135 +- tex/context/base/core-ver.mkii | 298 ++ tex/context/base/core-ver.tex | 940 ++---- tex/context/base/core-vis.tex | 46 +- tex/context/base/enco-fde.tex | 14 +- tex/context/base/enco-ffr.tex | 13 +- tex/context/base/enco-fpl.tex | 2 + tex/context/base/enco-fro.tex | 2 + tex/context/base/enco-ini.tex | 938 +----- tex/context/base/enco-mis.tex | 14 +- tex/context/base/enco-pfr.tex | 32 +- tex/context/base/enco-xtx.tex | 1986 +++++++++++++ tex/context/base/filt-ini.tex | 39 +- tex/context/base/font-ini.tex | 67 +- tex/context/base/font-run.tex | 10 +- tex/context/base/hand-ini.tex | 24 +- tex/context/base/java-ini.tex | 38 +- tex/context/base/lang-frq.tex | 12 +- tex/context/base/lang-ger.tex | 32 - tex/context/base/lang-ini.tex | 14 +- tex/context/base/lang-lab.tex | 14 +- tex/context/base/lang-mis.tex | 853 ++++++ tex/context/base/lang-sla.mkii | 30 + tex/context/base/lang-sla.tex | 43 +- tex/context/base/lang-spa.tex | 2 - tex/context/base/lang-spe.tex | 129 +- tex/context/base/m-arabtex.tex | 9 +- tex/context/base/m-chart.tex | 6 +- tex/context/base/m-cweb.tex | 38 +- tex/context/base/m-database.tex | 4 +- tex/context/base/m-gnuplot.tex | 13 +- tex/context/base/m-narrowtt.tex | 4 +- tex/context/base/m-r.tex | 44 +- tex/context/base/m-streams.tex | 8 +- tex/context/base/m-tryout.tex | 4 +- tex/context/base/m-visual.tex | 4 + tex/context/base/math-ams.tex | 6 +- tex/context/base/math-cow.tex | 5 +- tex/context/base/math-eul.tex | 30 + tex/context/base/math-ext.tex | 21 +- tex/context/base/math-ini.tex | 83 +- tex/context/base/math-pln.tex | 2 +- tex/context/base/meta-dum.tex | 2 +- tex/context/base/meta-fig.tex | 6 +- tex/context/base/meta-ini.tex | 54 +- tex/context/base/meta-mis.tex | 54 + tex/context/base/meta-pag.tex | 9 +- tex/context/base/meta-pdf.mkii | 1908 ++++++++++++ tex/context/base/meta-pdf.tex | 3123 +++----------------- tex/context/base/meta-tex.tex | 212 +- tex/context/base/meta-txt.tex | 8 +- tex/context/base/mult-com.tex | 10 +- tex/context/base/mult-con.tex | 31 +- tex/context/base/mult-fst.tex | 30 + tex/context/base/mult-ini.tex | 54 +- tex/context/base/mult-sys.tex | 42 +- tex/context/base/page-app.tex | 48 + tex/context/base/page-bck.tex | 163 +- tex/context/base/page-flt.tex | 1202 ++++---- tex/context/base/page-imp.tex | 273 +- tex/context/base/page-ini.tex | 196 +- tex/context/base/page-lay.tex | 526 ++-- tex/context/base/page-lin.tex | 92 +- tex/context/base/page-log.tex | 31 +- tex/context/base/page-lyr.tex | 117 +- tex/context/base/page-mak.tex | 25 +- tex/context/base/page-mar.tex | 147 +- tex/context/base/page-mul.tex | 76 +- tex/context/base/page-num.tex | 39 +- tex/context/base/page-plg.tex | 18 +- tex/context/base/page-set.tex | 37 +- tex/context/base/page-sid.tex | 308 +- tex/context/base/page-str.tex | 78 +- tex/context/base/page-txt.tex | 123 +- tex/context/base/ppchtex.tex | 30 +- tex/context/base/regi-ini.mkii | 153 + tex/context/base/regi-ini.tex | 178 +- tex/context/base/regi-run.mkii | 32 + tex/context/base/regi-utf.tex | 18 +- tex/context/base/rlxtools.rlx | 2 + tex/context/base/s-abr-01.tex | 11 +- tex/context/base/s-mag-01.tex | 4 +- tex/context/base/s-mod-00.tex | 4 +- tex/context/base/s-mod-01.tex | 8 +- tex/context/base/sort-ini.tex | 16 +- tex/context/base/spec-def.mkii | 16 + tex/context/base/spec-def.tex | 19 +- tex/context/base/spec-dpm.tex | 59 +- tex/context/base/spec-dpx.tex | 119 +- tex/context/base/spec-dvi.tex | 15 +- tex/context/base/spec-fdf.mkii | 156 + tex/context/base/spec-fdf.tex | 657 ++-- tex/context/base/spec-ini.tex | 6 +- tex/context/base/spec-mis.tex | 65 +- tex/context/base/spec-pdf.lua | 21 + tex/context/base/spec-pdf.tex | 20 +- tex/context/base/spec-ps.tex | 4 +- tex/context/base/spec-tpd.tex | 322 +- tex/context/base/spec-tr.tex | 41 +- tex/context/base/spec-tst.tex | 4 +- tex/context/base/spec-var.tex | 13 + tex/context/base/spec-xtx.tex | 114 +- tex/context/base/spec-yy.tex | 63 +- tex/context/base/supp-ali.tex | 5 +- tex/context/base/supp-box.tex | 239 +- tex/context/base/supp-eps.tex | 41 +- tex/context/base/supp-fil.mkii | 97 + tex/context/base/supp-fil.tex | 204 +- tex/context/base/supp-fun.tex | 4 +- tex/context/base/supp-ini.tex | 41 - tex/context/base/supp-lan.tex | 166 +- tex/context/base/supp-mat.tex | 15 +- tex/context/base/supp-mis.tex | 51 +- tex/context/base/supp-mpe.tex | 18 +- tex/context/base/supp-mps.tex | 410 ++- tex/context/base/supp-num.tex | 8 +- tex/context/base/supp-pdf.tex | 1088 +++---- tex/context/base/supp-vis.tex | 8 +- tex/context/base/symb-cow.tex | 99 +- tex/context/base/symb-ini.tex | 3 + tex/context/base/symb-mis.tex | 7 +- tex/context/base/symb-run.tex | 4 +- tex/context/base/syst-cat.mkii | 61 + tex/context/base/syst-cat.tex | 397 +++ tex/context/base/syst-chr.tex | 131 + tex/context/base/syst-con.mkii | 148 + tex/context/base/syst-con.tex | 156 +- tex/context/base/syst-etx.tex | 18 +- tex/context/base/syst-ext.tex | 427 +-- tex/context/base/syst-fnt.tex | 43 + tex/context/base/syst-gen.tex | 492 ++- tex/context/base/syst-mtx.tex | 66 + tex/context/base/syst-new.tex | 221 +- tex/context/base/syst-omg.tex | 70 +- tex/context/base/syst-pdt.tex | 48 + tex/context/base/syst-pln.tex | 47 +- tex/context/base/syst-prm.tex | 79 +- tex/context/base/syst-rtp.mkii | 18 + tex/context/base/syst-rtp.tex | 22 + tex/context/base/syst-str.mkii | 119 + tex/context/base/syst-str.tex | 40 + tex/context/base/syst-tex.tex | 2 + tex/context/base/syst-var.tex | 9 +- tex/context/base/syst-xtx.tex | 33 +- tex/context/base/thrd-tab.tex | 388 +-- tex/context/base/type-buy.tex | 1 + tex/context/base/type-enc.tex | 60 +- tex/context/base/type-gyr.tex | 89 +- tex/context/base/type-ini.tex | 5 - tex/context/base/type-run.tex | 9 +- tex/context/base/unic-004.tex | 1 + tex/context/base/unic-005.tex | 51 +- tex/context/base/unic-ini.tex | 2 + tex/context/base/verb-ini.tex | 387 +-- tex/context/base/verb-mp.tex | 177 +- tex/context/base/verb-tex.tex | 32 +- tex/context/base/x-fig-00.tex | 169 +- tex/context/base/x-fig-01.tex | 4 +- tex/context/base/x-newmme.tex | 12 +- tex/context/base/x-newmml.tex | 143 +- tex/context/base/x-newmmo.tex | 6 +- tex/context/base/x-om2cml.xsl | 29 +- tex/context/base/x-openmath.xsl | 4 +- tex/context/base/x-res-01.tex | 4 +- tex/context/base/x-res-04.tex | 109 +- tex/context/base/x-res-08.tex | 44 +- tex/context/base/x-res-12.tex | 53 + tex/context/base/x-res-20.tex | 231 ++ tex/context/base/x-sch-00.tex | 62 +- tex/context/base/x-xml-11.tex | 5 +- tex/context/base/xtag-cml.tex | 19 +- tex/context/base/xtag-ext.tex | 2 - tex/context/base/xtag-ini.tex | 427 +-- tex/context/base/xtag-map.tex | 8 +- tex/context/base/xtag-mml.tex | 9 +- tex/context/base/xtag-mmp.tex | 4 +- tex/context/base/xtag-pre.tex | 4 +- tex/context/base/xtag-run.tex | 8 +- tex/context/base/xtag-xsl.tex | 6 +- tex/context/bib/bibl-apa-de.tex | 8 +- tex/context/bib/t-bib.tex | 98 +- tex/context/config/cont-usr.tex | 4 +- tex/context/interface/cont-cz.xml | 137 +- tex/context/interface/cont-de.xml | 137 +- tex/context/interface/cont-en.xml | 137 +- tex/context/interface/cont-fr.xml | 139 +- tex/context/interface/cont-it.xml | 137 +- tex/context/interface/cont-nl.xml | 137 +- tex/context/interface/cont-ro.xml | 137 +- tex/context/interface/keys-cz.xml | 11 +- tex/context/interface/keys-de.xml | 11 +- tex/context/interface/keys-en.xml | 11 +- tex/context/interface/keys-fr.xml | 15 +- tex/context/interface/keys-it.xml | 11 +- tex/context/interface/keys-nl.xml | 11 +- tex/context/interface/keys-ro.xml | 11 +- tex/context/interface/t-bib.xml | 7 + tex/generic/context/m-metapo.tex | 46 +- tex/generic/context/mptopdf.tex | 141 +- tpm/t-bib.tpm | 10 +- web2c/context.cnf | 49 +- 320 files changed, 24263 insertions(+), 19391 deletions(-) create mode 100644 doc/context/document/general/manuals/mreadme.pdf create mode 100644 doc/context/document/general/manuals/tiptrick.pdf create mode 100644 doc/context/manuals/allkind/mcommon.tex create mode 100644 doc/context/manuals/allkind/mreadme.tex create mode 100755 scripts/context/stubs/mswin/luatools.bat create mode 100755 scripts/context/stubs/mswin/mtxtools.bat create mode 100755 scripts/context/stubs/unix/luatools create mode 100755 scripts/context/stubs/unix/mtxtools create mode 100644 tex/context/base/cont-new.mkii create mode 100644 tex/context/base/core-blk.tex create mode 100644 tex/context/base/core-buf.mkii create mode 100644 tex/context/base/core-con.mkii create mode 100644 tex/context/base/core-ctx.tex create mode 100644 tex/context/base/core-lme.tex create mode 100644 tex/context/base/core-obj.mkii create mode 100644 tex/context/base/core-pos.mkii create mode 100644 tex/context/base/core-stg.tex create mode 100644 tex/context/base/core-sys.mkii create mode 100644 tex/context/base/core-trf.tex create mode 100644 tex/context/base/core-two.mkii create mode 100644 tex/context/base/core-two.tex create mode 100644 tex/context/base/core-uti.mkii create mode 100644 tex/context/base/core-ver.mkii create mode 100644 tex/context/base/enco-xtx.tex create mode 100644 tex/context/base/lang-mis.tex create mode 100644 tex/context/base/lang-sla.mkii create mode 100644 tex/context/base/meta-mis.tex create mode 100644 tex/context/base/meta-pdf.mkii create mode 100644 tex/context/base/mult-fst.tex create mode 100644 tex/context/base/regi-ini.mkii create mode 100644 tex/context/base/regi-run.mkii create mode 100644 tex/context/base/spec-def.mkii create mode 100644 tex/context/base/spec-fdf.mkii create mode 100644 tex/context/base/spec-pdf.lua create mode 100644 tex/context/base/supp-fil.mkii create mode 100644 tex/context/base/syst-cat.mkii create mode 100644 tex/context/base/syst-cat.tex create mode 100644 tex/context/base/syst-chr.tex create mode 100644 tex/context/base/syst-con.mkii create mode 100644 tex/context/base/syst-fnt.tex create mode 100644 tex/context/base/syst-mtx.tex create mode 100644 tex/context/base/syst-pdt.tex create mode 100644 tex/context/base/syst-rtp.mkii create mode 100644 tex/context/base/syst-rtp.tex create mode 100644 tex/context/base/syst-str.mkii create mode 100644 tex/context/base/syst-str.tex create mode 100644 tex/context/base/x-res-12.tex create mode 100644 tex/context/base/x-res-20.tex diff --git a/context/data/cont-cz-scite.properties b/context/data/cont-cz-scite.properties index 1c4912372..b0cb8d6ff 100644 --- a/context/data/cont-cz-scite.properties +++ b/context/data/cont-cz-scite.properties @@ -48,29 +48,29 @@ keywordclass.macros.context.cz=\ prizpusobivepole prizpusobvzhled program propojeneznaceni propojenydokument propojenyrejstrik \ publikace ran ref reset resetznaceni rimskecislice \ rozdelplvouciobjekt rozpojeneznaceni roztazene schovejbloky scitani sedabarva \ - settextvariable setupforms setupitemgroup setuppaper setuprule setupstrut \ - setuptextposition setuptextvariable sloupec slovovpravo spodek stanovcharakteristickuseznamu \ - stanovcislonadpisu start startbarva startcitace startfakt startinteraktivnimenu \ - startkomentar startkomponenta startmarginalnilinka startpozadi startprodukt startprojekt \ - startprostredi starttextovalinka startverze startzhustene stop stopbarva \ - stopcitace stopfakt stopinteraktivnimenu stopkomentar stopkomponenta stopmarginalnilinka \ - stoppozadi stopprodukt stopprojekt stopprostredi stoptextovalinka stopverze \ - stopzhustene strana switchtorawfont sym symbol synchronizacnilista \ - synchronizovat tab tecky tenkalinka tenkelinky tex \ - texthlavicky textovalinka textpopisku textvariable tlacitko tref \ - tvrdemezery typebuffer typstrany ukazbarvu ukazexterniobrazy ukazmrizku \ - ukaznastaveni ukazpaletu ukazpodpery ukazpole ukazpostredizakladnihofontu ukazramecek \ - ukazsadusymbolu ukazskupinubarev ukazupravu ukazvytisk ukazvzhled ukazzakladnifont \ - umistikombinovanyseznam umistilegendu umistiloga umistilokalnipoznamkypodcarou umistinadsebe umistinamrizku \ - umistipodrovnici umistipoznamkypodcarou umistirejstrik umistirovnici umistiseznam umistivedlesebe \ - umistizalozky uzijURL uzijbloky uzijexternidokument uzijexterniobraz uzijexternisoubor \ - uzijexternisoubory uzijexternizvuk uzijkodovani uzijmodul uzijodkazy uzijprikazy \ - uzijspeciality uzijsymbol verze vl vlasovalinka vlevo \ - vpravo vradku vsedniden vyberbloky vyberpapir vyberverzi \ - vyplnenytext vyplnovelinky vyplnovepole vyplnovyradek vysoky zablokujinterakcnimenu \ - zachovejbloky zadnamezera zadnebilemisto zadnedalsibloky zadnedalsisoubory zadnehorniadolniradky \ - zadneodsazovani zadnezahlaviaupati zadneznaceni zadnyseznam zadnytest zalozka \ - zapisdorejstriku zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani zarovnanonastred \ - zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene ziskejbuffer \ - ziskejznaceni zlomek znaceni znak znaky zpracujbloky \ - zpracujstranu zrcadlit zref + settextcontent settextvariable setupforms setupitemgroup setuppaper setuprule \ + setupstrut setuptextposition setuptextvariable sloupec slovovpravo spodek \ + stanovcharakteristickuseznamu stanovcislonadpisu start startbarva startcitace startfakt \ + startinteraktivnimenu startkomentar startkomponenta startmarginalnilinka startpozadi startprodukt \ + startprojekt startprostredi starttextovalinka startverze startzhustene stop \ + stopbarva stopcitace stopfakt stopinteraktivnimenu stopkomentar stopkomponenta \ + stopmarginalnilinka stoppozadi stopprodukt stopprojekt stopprostredi stoptextovalinka \ + stopverze stopzhustene strana switchtorawfont sym symbol \ + synchronizacnilista synchronizovat tab tecky tenkalinka tenkelinky \ + tex texthlavicky textovalinka textpopisku textvariable tlacitko \ + tref tvrdemezery typebuffer typstrany ukazbarvu ukazexterniobrazy \ + ukazmrizku ukaznastaveni ukazpaletu ukazpodpery ukazpole ukazpostredizakladnihofontu \ + ukazramecek ukazsadusymbolu ukazskupinubarev ukazupravu ukazvytisk ukazvzhled \ + ukazzakladnifont umistikombinovanyseznam umistilegendu umistiloga umistilokalnipoznamkypodcarou umistinadsebe \ + umistinamrizku umistipodrovnici umistipoznamkypodcarou umistirejstrik umistirovnici umistiseznam \ + umistivedlesebe umistizalozky uzijURL uzijbloky uzijexternidokument uzijexterniobraz \ + uzijexternisoubor uzijexternisoubory uzijexternizvuk uzijkodovani uzijmodul uzijodkazy \ + uzijprikazy uzijspeciality uzijsymbol verze vl vlasovalinka \ + vlevo vpravo vradku vsedniden vyberbloky vyberpapir \ + vyberverzi vyplnenytext vyplnovelinky vyplnovepole vyplnovyradek vysoky \ + zablokujinterakcnimenu zachovejbloky zadnamezera zadnebilemisto zadnedalsibloky zadnedalsisoubory \ + zadnehorniadolniradky zadneodsazovani zadnezahlaviaupati zadneznaceni zadnyseznam zadnytest \ + zalozka zapisdorejstriku zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani \ + zarovnanonastred zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene \ + ziskejbuffer ziskejznaceni zlomek znaceni znak znaky \ + zpracujbloky zpracujstranu zrcadlit zref diff --git a/context/data/cont-de-scite.properties b/context/data/cont-de-scite.properties index 33323494c..ad7d38c69 100644 --- a/context/data/cont-de-scite.properties +++ b/context/data/cont-de-scite.properties @@ -35,42 +35,43 @@ keywordclass.macros.context.de=\ posten programm publikation punkt ran rechteck \ rechtecke rechtsbuendig ref referenz registrierefelder roemischezahlen \ ruecksetzten ruecksetztenbeschriftung schreibezumregister schreibezurliste schreibezurreferenzliste schreibezwischenliste \ - seite seitenreferenz seitentyp settextvariable setupforms setupitemgroup \ - setuppaper setuprule setupstrut setuptextposition setuptextvariable showsymbolset \ - spalte spatium spiegeln sprache start startfarbe \ - startgeg starthintergrund startinteraktionsmenue startkleinerdurchschuss startkommentar startkomponente \ - startmarginallinie startprodukt startprojekt starttextlinie startumgebung startversion \ - startzitat stelleabsaetzeein stelleabsatznummerierungein stelleabschnittein stelleabschnittsblockein stelleanordnenein \ - stelleausgabeein stelleausrichtungein stelleausschnittein stellebeschreibungein stellebeschriftungein stellebilderunterschriftein \ - stellebildunterschriftein stellebindestrichein stelleblankoein stelleblockein stelledrehenein stelleduennerumrissein \ - stelleeinziehenein stelleeinzuegein stelleengerein stelleexterneabbildungenein stellefarbeein stellefarbenein \ - stellefeldein stellefelderin stellefliesstextein stellefliesstextumgebungein stellefussnotendefinitionein stellefussnotenein \ - stellefusszeileein stellefusszeilentextein stellegefuelltesrechteckein stellegefuelltezeileein stellegegenueberplatzierenein stellegleitobjekteein \ - stellegleitobjektein stellehintergruendeein stellehintergrundein stelleinmarginalieein stelleinteraktionein stelleinteraktionsbalkenein \ - stelleinteraktionsbildschirmein stelleknopfein stellekombinationein stellekommentarein stellekopfzahlein stellekopfzeileein \ - stellekopfzeilentextein stellelabeltextein stellelayoutein stellelegendeein stellelinienbreiteein stellelisteein \ - stellemarginalblockein stellemarginallinieein stellenobenein stellenummerierungein stellepaletteein stellepapierformatein \ - stelleplatziegeteiltegleitobjekt stellepositionierenein stellepostenein stelleprofilein stelleprogrammein stellepublikationein \ - stellepufferein stellerasterein stellerechteckein stellereferenzierenein stellereferenzlisteein stelleregisterein \ - stelleseitennummerein stelleseitennummeriernungein stelleseitenuebergangein stellesortierenein stellespaltenein stellespatiumein \ - stellespracheein stellesymbolsetein stellesynchronisationein stellesynchronisationsbalkenein stellesynonymein stellesystemein \ - stelletabein stelletabellenein stelletabulatorein stelletextein stelletextobenein stelletexttexteein \ - stelletextumrissein stelletextuntenein stelletipein stelletippenein stelletoleranzein stelleueberschriftein \ - stelleueberschriftenein stelleueberschrifttextein stelleumbruchein stelleumrahmtein stelleumrahmtetexteein stelleuntenein \ - stelleunterseitennummerein stelleunterstreichenein stelleurlein stelleversalienein stelleversionein stellezeilenabstandein \ - stellezeilenein stellezeilennumerierungein stellezitierenein stellezusammengestelltelisteein stellezwischenraumein stop \ - stopfarbe stopgeg stophintergrund stopinteraktionsmenue stopkleinerdurchschuss stopkommentar \ - stopkomponente stopmarginallinie stopprodukt stopprojekt stoptextlinie stopumgebung \ - stopversion stopzitat switchtorawfont sym symbol synchronisationsbalken \ - synchronisieren tab teilegleitobjekt tex textlinie textreferenz \ - textvariable tief tiho tip tippedatei tippen \ - tippepuffer tooltip ueber ueberschrifttext uebersetzten ueberstreichen \ - ueberstrichen umrahmt unterstreichen unterstrichen verbergebloecke vergleichefarbengruppe \ - vergleichepalette verknuepfebeschriftung verknuepfedokument verknuepfregister version verweis \ - verweisdatum verwendeURL verwendebefehl verwendebloecke verwendeexteresdokument verwendeexterneabbildung \ - verwendeexternedatei verwendeexternedateien verwendeexternestonstueck verwendemodul verwendereferenzen verwendesymbole \ - vl von waehlebloeckeaus waehlepapieraus waehleversionaus wechselezumfliesstext \ - wochentag wortrechts zeigedruck zeigeeinstellungen zeigeexterneabbildungen zeigefarbe \ - zeigefarbengruppe zeigefelder zeigefliesstext zeigefliesstextumgebung zeigegitter zeigelayout \ - zeigepalette zeigerahmen zeigestruts zeigeumbruch zentriert ziffern \ - zitat zitieren zu zurbox zusatz zwischenraum + seite seitenreferenz seitentyp settext settextvariable setupforms \ + setupitemgroup setuppaper setuprule setupstrut setuptextposition setuptextvariable \ + showsymbolset spalte spatium spiegeln sprache start \ + startfarbe startgeg starthintergrund startinteraktionsmenue startkleinerdurchschuss startkommentar \ + startkomponente startmarginallinie startprodukt startprojekt starttextlinie startumgebung \ + startversion startzitat stelleabsaetzeein stelleabsatznummerierungein stelleabschnittein stelleabschnittsblockein \ + stelleanordnenein stelleausgabeein stelleausrichtungein stelleausschnittein stellebeschreibungein stellebeschriftungein \ + stellebilderunterschriftein stellebildunterschriftein stellebindestrichein stelleblankoein stelleblockein stelledrehenein \ + stelleduennerumrissein stelleeinziehenein stelleeinzuegein stelleengerein stelleexterneabbildungenein stellefarbeein \ + stellefarbenein stellefeldein stellefelderin stellefliesstextein stellefliesstextumgebungein stellefussnotendefinitionein \ + stellefussnotenein stellefusszeileein stellefusszeilentextein stellegefuelltesrechteckein stellegefuelltezeileein stellegegenueberplatzierenein \ + stellegleitobjekteein stellegleitobjektein stellehintergruendeein stellehintergrundein stelleinmarginalieein stelleinteraktionein \ + stelleinteraktionsbalkenein stelleinteraktionsbildschirmein stelleknopfein stellekombinationein stellekommentarein stellekopfzahlein \ + stellekopfzeileein stellekopfzeilentextein stellelabeltextein stellelayoutein stellelegendeein stellelinienbreiteein \ + stellelisteein stellemarginalblockein stellemarginallinieein stellenobenein stellenummerierungein stellepaletteein \ + stellepapierformatein stelleplatziegeteiltegleitobjekt stellepositionierenein stellepostenein stelleprofilein stelleprogrammein \ + stellepublikationein stellepufferein stellerasterein stellerechteckein stellereferenzierenein stellereferenzlisteein \ + stelleregisterein stelleseitennummerein stelleseitennummeriernungein stelleseitenuebergangein stellesortierenein stellespaltenein \ + stellespatiumein stellespracheein stellesymbolsetein stellesynchronisationein stellesynchronisationsbalkenein stellesynonymein \ + stellesystemein stelletabein stelletabellenein stelletabulatorein stelletextein stelletextobenein \ + stelletexttexteein stelletextumrissein stelletextuntenein stelletipein stelletippenein stelletoleranzein \ + stelleueberschriftein stelleueberschriftenein stelleueberschrifttextein stelleumbruchein stelleumrahmtein stelleumrahmtetexteein \ + stelleuntenein stelleunterseitennummerein stelleunterstreichenein stelleurlein stelleversalienein stelleversionein \ + stellezeilenabstandein stellezeilenein stellezeilennumerierungein stellezitierenein stellezusammengestelltelisteein stellezwischenraumein \ + stop stopfarbe stopgeg stophintergrund stopinteraktionsmenue stopkleinerdurchschuss \ + stopkommentar stopkomponente stopmarginallinie stopprodukt stopprojekt stoptextlinie \ + stopumgebung stopversion stopzitat switchtorawfont sym symbol \ + synchronisationsbalken synchronisieren tab teilegleitobjekt tex textlinie \ + textreferenz textvariable tief tiho tip tippedatei \ + tippen tippepuffer tooltip ueber ueberschrifttext uebersetzten \ + ueberstreichen ueberstrichen umrahmt unterstreichen unterstrichen verbergebloecke \ + vergleichefarbengruppe vergleichepalette verknuepfebeschriftung verknuepfedokument verknuepfregister version \ + verweis verweisdatum verwendeURL verwendebefehl verwendebloecke verwendeexteresdokument \ + verwendeexterneabbildung verwendeexternedatei verwendeexternedateien verwendeexternestonstueck verwendemodul verwendereferenzen \ + verwendesymbole vl von waehlebloeckeaus waehlepapieraus waehleversionaus \ + wechselezumfliesstext wochentag wortrechts zeigedruck zeigeeinstellungen zeigeexterneabbildungen \ + zeigefarbe zeigefarbengruppe zeigefelder zeigefliesstext zeigefliesstextumgebung zeigegitter \ + zeigelayout zeigepalette zeigerahmen zeigestruts zeigeumbruch zentriert \ + ziffern zitat zitieren zu zurbox zusatz \ + zwischenraum diff --git a/context/data/cont-en-scite.properties b/context/data/cont-en-scite.properties index f3dedd92c..0421582a4 100644 --- a/context/data/cont-en-scite.properties +++ b/context/data/cont-en-scite.properties @@ -38,39 +38,40 @@ keywordclass.macros.context.en=\ processpage program publication quotation quote ran \ ref reference referral referraldate reset resetmarking \ rightaligned romannumerals rotate scale screen selectblocks \ - selectpaper selectversion settextvariable setupalign setuparranging setupbackground \ - setupbackgrounds setupblackrules setupblank setupblock setupbodyfont setupbodyfontenvironment \ - setupbottom setupbottomtexts setupbuffer setupbuttons setupcapitals setupcaption \ - setupcaptions setupclipping setupcolor setupcolors setupcolumns setupcombinations \ - setupcombinedlist setupcomment setupdescriptions setupenumerations setupexternalfigures setupfield \ - setupfields setupfillinlines setupfillinrules setupfloat setupfloats setupfloatsplitting \ - setupfooter setupfootertexts setupfootnotedefinition setupfootnotes setupforms setupframed \ - setupframedtexts setuphead setupheader setupheadertexts setupheadnumber setupheads \ - setupheadtext setuphyphenmark setupindentations setupindenting setupinmargin setupinteraction \ - setupinteractionbar setupinteractionscreen setupinterlinespace setupitemgroup setupitems setuplabeltext \ - setuplanguage setuplayout setuplegend setuplinenumbering setuplines setuplinewidth \ - setuplist setupmakeup setupmarginblocks setupmarginrules setupmarking setupnarrower \ - setupnumbering setupoppositeplacing setupoutput setuppagenumber setuppagenumbering setuppagetransitions \ - setuppalet setuppaper setuppapersize setupparagraphnumbering setupparagraphs setuppositioning \ - setupprofiles setupprograms setuppublications setupquote setupreferencelist setupreferencing \ - setupregister setuprotate setuprule setupscreens setupsection setupsectionblock \ - setupsorting setupspacing setupstrut setupsubpagenumber setupsymbolset setupsynchronization \ - setupsynchronizationbar setupsynonyms setupsystem setuptab setuptables setuptabulate \ - setuptext setuptextposition setuptextrules setuptexttexts setuptextvariable setupthinrules \ - setuptolerance setuptop setuptoptexts setuptype setuptyping setupunderbar \ - setupurl setupversions setupwhitespace showbodyfont showbodyfontenvironment showcolor \ - showcolorgroup showexternalfigures showfields showframe showgrid showlayout \ - showmakeup showpalet showprint showsetups showstruts showsymbolset \ - someline somewhere space splitfloat start startbackground \ - startcolor startcomment startcomponent startenvironment startfact startinteractionmenu \ - startmarginrule startpacked startproduct startproject startquotation starttextrule \ - startversion stop stopbackground stopcolor stopcomment stopcomponent \ - stopenvironment stopfact stopinteractionmenu stopmarginrule stoppacked stopproduct \ - stopproject stopquotation stoptextrule stopversion stretched switchtobodyfont \ - switchtorawfont sym symbol synchronizationbar synchronize tab \ - tex textreference textrule textvariable thinrule thinrules \ - tooltip translate typ type typebuffer typefile \ - underbar underbars useURL useblocks usecommands useencoding \ - useexternaldocument useexternalfigure useexternalfile useexternalfiles useexternalsoundtrack usemodule \ - usereferences usespecials usesymbols version vl weekday \ - whitespace wordright writebetweenlist writetolist writetoreferencelist writetoregister + selectpaper selectversion settextcontent settextvariable setupalign setuparranging \ + setupbackground setupbackgrounds setupblackrules setupblank setupblock setupbodyfont \ + setupbodyfontenvironment setupbottom setupbottomtexts setupbuffer setupbuttons setupcapitals \ + setupcaption setupcaptions setupclipping setupcolor setupcolors setupcolumns \ + setupcombinations setupcombinedlist setupcomment setupdescriptions setupenumerations setupexternalfigures \ + setupfield setupfields setupfillinlines setupfillinrules setupfloat setupfloats \ + setupfloatsplitting setupfooter setupfootertexts setupfootnotedefinition setupfootnotes setupforms \ + setupframed setupframedtexts setuphead setupheader setupheadertexts setupheadnumber \ + setupheads setupheadtext setuphyphenmark setupindentations setupindenting setupinmargin \ + setupinteraction setupinteractionbar setupinteractionscreen setupinterlinespace setupitemgroup setupitems \ + setuplabeltext setuplanguage setuplayout setuplegend setuplinenumbering setuplines \ + setuplinewidth setuplist setupmakeup setupmarginblocks setupmarginrules setupmarking \ + setupnarrower setupnumbering setupoppositeplacing setupoutput setuppagenumber setuppagenumbering \ + setuppagetransitions setuppalet setuppaper setuppapersize setupparagraphnumbering setupparagraphs \ + setuppositioning setupprofiles setupprograms setuppublications setupquote setupreferencelist \ + setupreferencing setupregister setuprotate setuprule setupscreens setupsection \ + setupsectionblock setupsorting setupspacing setupstrut setupsubpagenumber setupsymbolset \ + setupsynchronization setupsynchronizationbar setupsynonyms setupsystem setuptab setuptables \ + setuptabulate setuptext setuptextposition setuptextrules setuptexttexts setuptextvariable \ + setupthinrules setuptolerance setuptop setuptoptexts setuptype setuptyping \ + setupunderbar setupurl setupversions setupwhitespace showbodyfont showbodyfontenvironment \ + showcolor showcolorgroup showexternalfigures showfields showframe showgrid \ + showlayout showmakeup showpalet showprint showsetups showstruts \ + showsymbolset someline somewhere space splitfloat start \ + startbackground startcolor startcomment startcomponent startenvironment startfact \ + startinteractionmenu startmarginrule startpacked startproduct startproject startquotation \ + starttextrule startversion stop stopbackground stopcolor stopcomment \ + stopcomponent stopenvironment stopfact stopinteractionmenu stopmarginrule stoppacked \ + stopproduct stopproject stopquotation stoptextrule stopversion stretched \ + switchtobodyfont switchtorawfont sym symbol synchronizationbar synchronize \ + tab tex textreference textrule textvariable thinrule \ + thinrules tooltip translate typ type typebuffer \ + typefile underbar underbars useURL useblocks usecommands \ + useencoding useexternaldocument useexternalfigure useexternalfile useexternalfiles useexternalsoundtrack \ + usemodule usereferences usespecials usesymbols version vl \ + weekday whitespace wordright writebetweenlist writetolist writetoreferencelist \ + writetoregister diff --git a/context/data/cont-fr-scite.properties b/context/data/cont-fr-scite.properties index 581154cb0..133f91ed0 100644 --- a/context/data/cont-fr-scite.properties +++ b/context/data/cont-fr-scite.properties @@ -60,17 +60,17 @@ keywordclass.macros.context.fr=\ regletransitionspage regletri regletype regleurl reglevariabletexte regleversions \ remplitchamp remplitligne remplitlignesreglees remplittexte sansalinea sansespace \ sansespaceblanc sanslignesenteteetpdp sanslignessupetinf sansliste sansmarquage sanstest \ - sauteblocs selectionneblocs selectionnepapier selectionneversion separeflottant setupframedtexts \ - setupitemgroup sousligne souslignetout start startarriereplan startcitation \ - startcommentaire startcomposant startcouleur startenvironement startfait startgroupe \ - startligneregleetexte startmargereglee startmenuinteraction startproduit startprojet startversion \ - stop stoparriereplan stopcitation stopcommentaire stopcomposant stopcouleur \ - stopenvironement stopfait stopgroupe stopligneregleetexte stopmargereglee stopmenuinteraction \ - stopproduit stopprojet stopversion suggestion suivantprofil suivantversion \ - suivantversionprofil surligne surlignetout sym symbole synchronise \ - tab tapebuffer tapepage tete tex textemarge \ - textenotepdp textetete traduire traiteblocs traitepage traitfin \ - traitsfins typ uneligne utiliseURL utiliseblocs utilisecommandes \ - utilisedocumentexterne utiliseencodage utilisefichierexterne utilisefichiersexternes utilisefigureexterne utilisemodule \ - utilisepsiteaudioexterne utilisereferences utilisespecialites utilisesymboles va vaalaboite \ - vaenbas variabletexte version vide vl + sauteblocs selectionneblocs selectionnepapier selectionneversion separeflottant settext \ + setupframedtexts setupitemgroup sousligne souslignetout start startarriereplan \ + startcitation startcommentaire startcomposant startcouleur startenvironement startfait \ + startgroupe startligneregleetexte startmargereglee startmenuinteraction startproduit startprojet \ + startversion stop stoparriereplan stopcitation stopcommentaire stopcomposant \ + stopcouleur stopenvironement stopfait stopgroupe stopligneregleetexte stopmargereglee \ + stopmenuinteraction stopproduit stopprojet stopversion suggestion suivantprofil \ + suivantversion suivantversionprofil surligne surlignetout sym symbole \ + synchronise tab tapebuffer tapepage tete tex \ + textemarge textenotepdp textetete traduire traiteblocs traitepage \ + traitfin traitsfins typ uneligne utiliseURL utiliseblocs \ + utilisecommandes utilisedocumentexterne utiliseencodage utilisefichierexterne utilisefichiersexternes utilisefigureexterne \ + utilisemodule utilisepsiteaudioexterne utilisereferences utilisespecialites utilisesymboles va \ + vaalaboite vaenbas variabletexte version vide vl diff --git a/context/data/cont-it-scite.properties b/context/data/cont-it-scite.properties index 683ba5a27..192a7c07e 100644 --- a/context/data/cont-it-scite.properties +++ b/context/data/cont-it-scite.properties @@ -60,17 +60,18 @@ keywordclass.macros.context.it=\ rigovuoto ruota saltablocchi sbarrati sbarrato scala \ schermo scrividentroelenco scriviinelenco scriviinlistariferimenti scriviinregistro segnalibro \ seguiprofilo seguiversione seguiversioneprofilo selezionablocchi selezionacarta selezionaversione \ - separamarcatura setupitemgroup setuppaper setvariabiletesto sfondo sim \ - simbolo sincronizza sopralinea sopralinee sottolinea sottolinee \ - spazifissi spazio spaziobianco spezzaoggettomobile spostaagriglia stackcampi \ - start startambiente startcitazione startcolore startcommento startcomponenet \ - startfatto startimpaccato startlineamargine startlineatesto startmenuinterattivo startprodotto \ - startprogetto startsfondo startversione stirato stop stopambiente \ - stopcitazione stopcolore stopcommento stopcomponenet stopfatto stopimpaccato \ - stoplineamargine stoplineatesto stopmenuinterattivo stopprodotto stopprogetto stopsfondo \ - stopversione tab testa testoetichetta testoinmargine testoinstestazioni \ - testonotapdp testoriempimento tex tieniblocchi tipopagina tooltip \ - traduci typ type typebuffer typefile usaURL \ - usablocco usacodifica usacolonnasonoraesterna usacomandi usadocumentoesterno usafiguraesterna \ - usafileesterni usafileesterno usamodulo usariferimenti usasimboli usaspecialita \ - vaia vaiabox vaigiu variabiletesto versione vl + separamarcatura settext setupitemgroup setuppaper setvariabiletesto sfondo \ + sim simbolo sincronizza sopralinea sopralinee sottolinea \ + sottolinee spazifissi spazio spaziobianco spezzaoggettomobile spostaagriglia \ + stackcampi start startambiente startcitazione startcolore startcommento \ + startcomponenet startfatto startimpaccato startlineamargine startlineatesto startmenuinterattivo \ + startprodotto startprogetto startsfondo startversione stirato stop \ + stopambiente stopcitazione stopcolore stopcommento stopcomponenet stopfatto \ + stopimpaccato stoplineamargine stoplineatesto stopmenuinterattivo stopprodotto stopprogetto \ + stopsfondo stopversione tab testa testoetichetta testoinmargine \ + testoinstestazioni testonotapdp testoriempimento tex tieniblocchi tipopagina \ + tooltip traduci typ type typebuffer typefile \ + usaURL usablocco usacodifica usacolonnasonoraesterna usacomandi usadocumentoesterno \ + usafiguraesterna usafileesterni usafileesterno usamodulo usariferimenti usasimboli \ + usaspecialita vaia vaiabox vaigiu variabiletesto versione \ + vl diff --git a/context/data/cont-nl-scite.properties b/context/data/cont-nl-scite.properties index 5ca7901d0..df32e4283 100644 --- a/context/data/cont-nl-scite.properties +++ b/context/data/cont-nl-scite.properties @@ -58,19 +58,20 @@ keywordclass.macros.context.nl=\ stelrefererenin stelregelnummerenin stelregelsin stelregisterin stelroterenin stelsamengesteldelijstin \ stelsectieblokin stelsectiein stelsmallerin stelsorterenin stelspatieringin stelstrutin \ stelsubpaginanummerin stelsymboolsetin stelsynchronisatiebalkin stelsynchronisatiein stelsynoniemenin stelsysteemin \ - steltaalin steltabellenin steltabin steltabulatiein steltekstin steltekstlijnenin \ - steltekstpositiein stelteksttekstenin steltekstvariabelein steltolerantiein steltypein steltypenin \ - steluitlijnenin steluitvoerin stelurlin stelveldenin stelveldin stelversiesin \ - stelvoetin stelvoetnootdefinitiein stelvoetnotenin stelvoettekstenin stelwitruimtein stop \ - stopachtergrond stopcitaat stopcommentaar stopgeg stopinteractiemenu stopkantlijn \ - stopkleur stopomgeving stoponderdeel stopopelkaar stopprodukt stopprojekt \ - stoptekstlijn stopversie suggestie switchnaarkorps switchtorawfont sym \ - symbool synchronisatiebalk synchroniseer taal tab tekstlijn \ - tekstreferentie tekstvariabele tex toevoegen toonexternefiguren toongrid \ - tooninstellingen toonkader toonkleur toonkleurgroep toonkorps toonkorpsomgeving \ - toonlayout toonopmaak toonpalet toonprint toonstruts toonsymboolset \ - toonvelden typ type typebuffer typefile uit \ - uitgerekt usecodering vastespaties veld veldstapel verbergblokken \ - vergelijkkleurgroep vergelijkpalet verplaatsopgrid versie vertaal verwerkblokken \ - verwerkpagina vl voetnoot voetnoottekst volgprofiel volgprofielversie \ - volgversie volledigregister weekdag wiskunde witruimte woordrechts + steltaalin steltabellenin steltabin steltabulatiein steltekstin steltekstinhoudin \ + steltekstlijnenin steltekstpositiein stelteksttekstenin steltekstvariabelein steltolerantiein steltypein \ + steltypenin steluitlijnenin steluitvoerin stelurlin stelveldenin stelveldin \ + stelversiesin stelvoetin stelvoetnootdefinitiein stelvoetnotenin stelvoettekstenin stelwitruimtein \ + stop stopachtergrond stopcitaat stopcommentaar stopgeg stopinteractiemenu \ + stopkantlijn stopkleur stopomgeving stoponderdeel stopopelkaar stopprodukt \ + stopprojekt stoptekstlijn stopversie suggestie switchnaarkorps switchtorawfont \ + sym symbool synchronisatiebalk synchroniseer taal tab \ + tekstlijn tekstreferentie tekstvariabele tex toevoegen toonexternefiguren \ + toongrid tooninstellingen toonkader toonkleur toonkleurgroep toonkorps \ + toonkorpsomgeving toonlayout toonopmaak toonpalet toonprint toonstruts \ + toonsymboolset toonvelden typ type typebuffer typefile \ + uit uitgerekt usecodering vastespaties veld veldstapel \ + verbergblokken vergelijkkleurgroep vergelijkpalet verplaatsopgrid versie vertaal \ + verwerkblokken verwerkpagina vl voetnoot voetnoottekst volgprofiel \ + volgprofielversie volgversie volledigregister weekdag wiskunde witruimte \ + woordrechts diff --git a/context/data/cont-ro-scite.properties b/context/data/cont-ro-scite.properties index 6aec0faca..b5106bc36 100644 --- a/context/data/cont-ro-scite.properties +++ b/context/data/cont-ro-scite.properties @@ -62,15 +62,15 @@ keywordclass.macros.context.ro=\ seteazasubsol seteazasus seteazatab seteazatabele seteazatabulatori seteazatext \ seteazatexteantet seteazatextejos seteazatextesubsol seteazatextesus seteazatextetext seteazatexteticheta \ seteazatexttitlu seteazatitlu seteazatitluri seteazatoleranta seteazatranzitiepagina seteazatype \ - seteazatyping seteazaurl seteazavariabilatext seteazaversiuni setupitemgroup setuppaper \ - setvariabilatext sim simbol sincronizeaza spatiifixate spatiu \ - spatiualb start startcitat startcomentariu startcomponenta startculoare \ - startfact startfundal startimpachetat startliniemargine startmediu startmeniuinteractiune \ - startprodus startproiect startriglatext startversiune stivacampuri stop \ - stopcitat stopcomentariu stopcomponenta stopculoare stopfact stopfundal \ - stopimpachetat stopliniemargine stopmediu stopmeniuinteractiune stopprodus stopproiect \ - stopriglatext stopversiune sublinie sublinii supralinie tab \ - tex texteticheta textmarginal texttitlu textumplere tippagina \ - titlu tooltip traduce trecilafontraw trecilafonttext typ \ - type typefile undeva urmeazaprofil urmeazaversiune urmeazaversiuneprofil \ - variabilatext versiune vl zidinsaptamana + seteazatyping seteazaurl seteazavariabilatext seteazaversiuni settextcontent setupitemgroup \ + setuppaper setvariabilatext sim simbol sincronizeaza spatiifixate \ + spatiu spatiualb start startcitat startcomentariu startcomponenta \ + startculoare startfact startfundal startimpachetat startliniemargine startmediu \ + startmeniuinteractiune startprodus startproiect startriglatext startversiune stivacampuri \ + stop stopcitat stopcomentariu stopcomponenta stopculoare stopfact \ + stopfundal stopimpachetat stopliniemargine stopmediu stopmeniuinteractiune stopprodus \ + stopproiect stopriglatext stopversiune sublinie sublinii supralinie \ + tab tex texteticheta textmarginal texttitlu textumplere \ + tippagina titlu tooltip traduce trecilafontraw trecilafonttext \ + typ type typefile undeva urmeazaprofil urmeazaversiune \ + urmeazaversiuneprofil variabilatext versiune vl zidinsaptamana diff --git a/context/data/context-jedit-cz.xml b/context/data/context-jedit-cz.xml index ab6fdd8f9..5b7b3e59d 100644 --- a/context/data/context-jedit-cz.xml +++ b/context/data/context-jedit-cz.xml @@ -299,6 +299,7 @@ \schovejbloky \scitani \sedabarva + \settextcontent \settextvariable \setupforms \setupitemgroup diff --git a/context/data/context-jedit-de.xml b/context/data/context-jedit-de.xml index 0be617e78..820ea8fbc 100644 --- a/context/data/context-jedit-de.xml +++ b/context/data/context-jedit-de.xml @@ -224,6 +224,7 @@ \seite \seitenreferenz \seitentyp + \settext \settextvariable \setupforms \setupitemgroup diff --git a/context/data/context-jedit-en.xml b/context/data/context-jedit-en.xml index adc81221f..34359ca15 100644 --- a/context/data/context-jedit-en.xml +++ b/context/data/context-jedit-en.xml @@ -241,6 +241,7 @@ \selectblocks \selectpaper \selectversion + \settextcontent \settextvariable \setupalign \setuparranging diff --git a/context/data/context-jedit-fr.xml b/context/data/context-jedit-fr.xml index 68e40115f..0588718a4 100644 --- a/context/data/context-jedit-fr.xml +++ b/context/data/context-jedit-fr.xml @@ -376,6 +376,7 @@ \selectionnepapier \selectionneversion \separeflottant + \settext \setupframedtexts \setupitemgroup \sousligne diff --git a/context/data/context-jedit-it.xml b/context/data/context-jedit-it.xml index d0317cd0b..ff09d98b2 100644 --- a/context/data/context-jedit-it.xml +++ b/context/data/context-jedit-it.xml @@ -372,6 +372,7 @@ \selezionacarta \selezionaversione \separamarcatura + \settext \setupitemgroup \setuppaper \setvariabiletesto diff --git a/context/data/context-jedit-nl.xml b/context/data/context-jedit-nl.xml index d9da1606d..8dee0e106 100644 --- a/context/data/context-jedit-nl.xml +++ b/context/data/context-jedit-nl.xml @@ -364,6 +364,7 @@ \steltabin \steltabulatiein \steltekstin + \steltekstinhoudin \steltekstlijnenin \steltekstpositiein \stelteksttekstenin diff --git a/context/data/context-jedit-ro.xml b/context/data/context-jedit-ro.xml index 9841a0350..f1baedbfa 100644 --- a/context/data/context-jedit-ro.xml +++ b/context/data/context-jedit-ro.xml @@ -387,6 +387,7 @@ \seteazaurl \seteazavariabilatext \seteazaversiuni + \settextcontent \setupitemgroup \setuppaper \setvariabilatext diff --git a/context/data/context.properties b/context/data/context.properties index 687527718..7668e1320 100644 --- a/context/data/context.properties +++ b/context/data/context.properties @@ -31,7 +31,7 @@ file.patterns.tex= file.patterns.latex= -file.patterns.context=*.tex;*.tui;*.tuo;*.sty; +file.patterns.context=*.tex;*.tui;*.tuo;*.sty;*.mkii;*.mkiv # ConTeXt : keywords (if not yet loaded already) @@ -47,7 +47,7 @@ import latex-scite # Example : patterns file.patterns.xml= -file.patterns.example=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd +file.patterns.example=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd;*.lmx filter.example=eXaMpLe|$(file.patterns.example)| diff --git a/doc/context/bib/bibmod-doc.pdf b/doc/context/bib/bibmod-doc.pdf index abf6359c1..1f74aca09 100644 Binary files a/doc/context/bib/bibmod-doc.pdf and b/doc/context/bib/bibmod-doc.pdf differ diff --git a/doc/context/bib/bibmod-doc.tex b/doc/context/bib/bibmod-doc.tex index 6d25650dd..b64fd018c 100644 --- a/doc/context/bib/bibmod-doc.tex +++ b/doc/context/bib/bibmod-doc.tex @@ -46,7 +46,7 @@ \module [ file=bibmod-doc, - version=2006.03.13, + version=2006.11.04, title=Module Documentation, subtitle=Bibliographies, author={Taco Hoekwater}, @@ -60,7 +60,7 @@ The bibliographic module (\type{t-bib.tex}) takes care of references to publications and the typesetting of publication lists, as well as providing an interface between \BIBTEX and \CONTEXT. This manual -documents version 2006.08.08. +documents version 2006.09.15. The bibliographic subsystem consists of the main module \type{t-bib.tex}; four \BIBTEX\ styles (\type{cont-xx.bst}); and a set @@ -182,6 +182,14 @@ heading for \type{\completepublications} \NC title\NC The sectioning command.\NC\NR \stoptabulate +A fourth option can be used to nullify the printing of `year suffixes' +in cases where the author(s) has written multiple works within a +single year. + +\starttabulate[|l|p|] +\NC maybeyear\NC either \type{on} or \type{off}. Default is \type{on}\NC\NR +\stoptabulate + The other extra options are needed to control micro||typesetting of things that are buried deep within macros. There is a separate command to handle the larger layout options @@ -335,6 +343,10 @@ and select the parts that are needed for the current article. \setup{setupbibtex} \starttabulate[|l|p|] +\NC bibtex\NC The name (with possibly a pathname or even some option settings) + of the bibtex executable. This is passed on to texexec. The default value + is simply `bibtex'\NC\NR + \NC database\NC List of bibtex database file names to be used. The module will write a very short \type{.aux} file instructing \BIBTEX\ to create a (possibly very large) \type{\jobname.bbl} file, @@ -490,6 +502,15 @@ the default one, you most likely want to call \placepublications[criterium=all] \stoptyping +If you use a numeric list style combined with multiple , each +\type{\placepublications} or \type{\completepublications} commands, +by default each one restarts the displayed number. If you do not +like that, you can add an option argument like so: +\starttyping +\placepublications[option=continue] +\stoptyping + + The module uses the following defaults for the generated head: \starttyping \setupheadtext[en][pubs=References] @@ -569,7 +590,7 @@ and the meanings are as follows: \NC \type{firstnames} \NC individual (given) name(s)\NC\NR \NC \type{inits} \NC abbreviated form(s) of \type{firstnames}.\NC\NR \NC \type{von} \NC any bits of the family name that are normally disregarded in sorting\NC\NR -\NC \type{surname} \NC reaminder of the family (last) name\NC\NR +\NC \type{surname} \NC remainder of the family (last) name\NC\NR \stoptabulate diff --git a/doc/context/document/general/manuals/mreadme.pdf b/doc/context/document/general/manuals/mreadme.pdf new file mode 100644 index 000000000..338008015 Binary files /dev/null and b/doc/context/document/general/manuals/mreadme.pdf differ diff --git a/doc/context/document/general/manuals/tiptrick.pdf b/doc/context/document/general/manuals/tiptrick.pdf new file mode 100644 index 000000000..3ced360e1 Binary files /dev/null and b/doc/context/document/general/manuals/tiptrick.pdf differ diff --git a/doc/context/manuals/allkind/mcommon.tex b/doc/context/manuals/allkind/mcommon.tex new file mode 100644 index 000000000..f0c22cff4 --- /dev/null +++ b/doc/context/manuals/allkind/mcommon.tex @@ -0,0 +1,199 @@ +% content=tex +% +% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa + +\startenvironment mcommon + +% modules + +\usemodule[abr-02] + +% layout + +\startmode[screen] + \setuppapersize[S6][S6] + \setupinteraction[state=start] + \setupinteractionscreen[options=max] +\stopmode + +\setuplayout + [footer=0cm, + width=middle, + height=middle] + +% fonts + +\startmode[atpragma] + + \startMPenvironment[global] + \usetypescriptfile[type-buy] + \usetypescript[lucida][texnansi] + \setupbodyfont[lucida,10pt] + \stopMPenvironment + + \setupbodyfont[11pt] + +\stopmode + +\startnotmode[atpragma] + + \startMPenvironment[global] + \usetypescript[palatino][ec] + \setupbodyfont[palatino,10pt] + \stopMPenvironment + + \setupbodyfont[11pt] + +\stopnotmode + +\definefont [BigFont] [SansBold at 60pt] +\definefont [MedFont] [SansBold at 30pt] + +% colors + +\setupcolors + [state=start] + +\definecolor [NopColor] [r=.6,g=.4,b=.5] +\definecolor [AltColor] [r=.4,g=.6,b=.5] +\definecolor [TheColor] [r=.4,g=.5,b=.6] +\definecolor [TmpColor] [r=.6,g=.5,b=.4] + +\definecolor [red] [NopColor] +\definecolor [green] [AltColor] +\definecolor [blue] [TheColor] +\definecolor [yellow][TmpColor] + +% spacing + +\setupwhitespace + [big] + +\setuptolerance + [verytolerant,stretch] + +% verbatim + +\setuptype + [color=AltColor] + +\setuptyping + [color=AltColor] + +% structure + +\setupitemize + [each] + [color=TheColor] + +\definedescription + [switch] + [headstyle=type, + headcolor=TheColor, + location=serried, + width=broad] + +\defineenumeration + [topic] + [location=serried, + width=broad, + headstyle=, + headcolor=TheColor, + text=, + left={[}, + right={]}] + +\setuphead + [section] + [style=\ss\bfb, + color=TheColor] + +\setuplist + [section] + [alternative=c, + color=TheColor, + textcolor=black, + pagecolor=black] + +% whatever + +\setupsystem + [random=medium] + +\setupfloats + [ntop=100] + +\setupinteraction + [style=, + color=NopColor, + contrastcolor=NopColor] + +% tables and frames + +\setuptabulate + [rulethickness=.5pt, + rulecolor=AltColor] + +\setuptables + [rulethickness=.5pt, + rulecolor=AltColor] + +\setupframedtexts + [rulethickness=.5pt, + framecolor=TheColor, + width=\textwidth] + +% quick reference things + +\usemodule[set-11] \loadsetups + +\setupframedtexts + [setuptext] + [rulethickness=.5pt, + framecolor=AltColor] + +% basic titlepage and colofon, a bit old fashioned approach, but let's not +% modernize everything now + +\def\TitlePage#1#2#3#4#5% number/name angle title author screen + {\doifnumberelse{#1} + {\ifcase#1 + \defineoverlay + [logo] + [\useMPgraphic{titlepage}{width=\overlaywidth,height=\overlayheight}] + \else + \startMPrun + logo_type := #1 ; mpgraph := #1 ; input mp-cont ; + \stopMPrun + \defineoverlay + [logo] + [{\externalfigure + [\MPrunfile{#1}] + [width=\overlaywidth,height=\overlayheight]}] + \fi} + {\defineoverlay + [logo] + [\useMPgraphic{#1}{width=\overlaywidth,height=\overlayheight}]} + \setupbackgrounds + [page] + [background=logo] + \definecolor[Gray][s=#5] + \startstandardmakeup + \dontcomplain + \BigFont \setupinterlinespace \vfill \setupalign[left] \let\\=\par + \ifcase#2\relax + \noindent\color[Gray]{#3}\par + \else + \noindent\rotate[rotation=#2]{\color[Gray]{#3}}\par + \fi + \stopstandardmakeup + \setupbackgrounds + [page] + [background=]} + +\def\ColofonPage + {\startstandardmakeup + \vfill \setups [pragma-colofon] + \stopstandardmakeup} + +\stopenvironment diff --git a/doc/context/manuals/allkind/mreadme.tex b/doc/context/manuals/allkind/mreadme.tex new file mode 100644 index 000000000..22af40afe --- /dev/null +++ b/doc/context/manuals/allkind/mreadme.tex @@ -0,0 +1,361 @@ +% interface=en output=pdftex language=uk +% +% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa + +\environment mcommon + +\useurl[gpl-simple] [http://creativecommons.org/licenses/GPL/2.0/] +\useurl[gpl-legal] [http://creativecommons.org/licenses/GPL/2.0/legalcode] +\useurl[byncsa-simple][http://creativecommons.org/licenses/by-nc-sa/2.5/] +\useurl[byncsa-legal] [http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode] + +\useurl[garden] [http://contextgarden.net] +\useurl[contextlist] [http://www.ntg.nl/mailman/listinfo/ntg-context] +\useurl[development] [http://www.ntg.nl/mailman/listinfo/dev-context] +\useurl[announce] [http://www.ntg.nl/mailman/listinfo/ann-context] +\useurl[collector] [http://context.literatesolutions.com] +\useurl[pragma] [http://www.pragma-ade.com] +\useurl[mirror] [http://context.aanhet.net] + +\setupinteraction[state=start] + +% copied from cont-log: readme_logo + +\startuseMPgraphic{titlepage}{width,height} + numeric width ; width = \MPvar{width} ; + numeric height ; height = \MPvar{height} ; + numeric delta ; delta := width/10 ; + numeric circle ; circle := 2.5delta ; + color c ; c := (.2,.4,.6) ; + path p, q, r ; + p := unitsquare xscaled width yscaled height ; + z1 = (delta,height-2delta) ; + z2 = (width-delta,height-delta) ; + z3 = (width/2-delta,2delta+circle) ; + z4 = (x3,delta+circle/2) ; + q := z1 { dir -15 } .. z2 & + z2 { dir -105 } .. z3 & + z3 { dir 135 } .. z1 & + cycle ; + r := fullcircle xscaled circle yscaled (.85circle) rotated 15 shifted z4 ; + pickup pencircle scaled (delta/1.5) ; + fill p withcolor .50c ; + fill q withcolor .75c ; + fill r withcolor .75c ; + draw p withcolor c ; + draw q withcolor c ; + pickup pencircle scaled (delta/2) ; + draw r withcolor c ; + setbounds currentpicture to p ; +\stopuseMPgraphic + +\starttext + +\TitlePage{titlepage}{90}{Read Me First}{}{1} + +\subject {Introduction} + +What licence suits best for a \TEX\ like system is a matter of +taste. Personally we dislike any licence that needs more than a few +pages of dense legal code to get the message accross. A \TEX\ +related system like \CONTEXT\ is a hybrid of programs, scripts +and|/|or macro code as well as documentation and sample code, +including graphics. \TEX\ related systems also have a long +standing tradition of providing support structures for users. In +order to make support feasable, a \TEX\ based system like +\CONTEXT\ assumes a certain logic and structure in the way the +related files are named and organized in a tree structure. Even a +small change in one of the elements may let such a system behave +differently than manuals suggest. Swap a font, change some style +defaults, leave out some pieces, and users may end up in +confusion. A licence does not give a user any guarantees! + +In order to satisfy those responsible for distributing \CONTEXT, +we need to choose a licence that makes them feel comfortable. +Unfortunately we don't feel that comfortable with a licence that does +not provide the guarantees that a system will not be adapted in +such ways that the advertised behaviour changes. On the +other hand, it is the responsibility of those distributing and +extending the system to make sure that this does not happen. +However, users should not automatically assume that what they get +shipped is the same as the original, which is why we stress that +support (from our side) will only be given on unaltered systems. + +First of all, what is \CONTEXT ? It's just a bunch of macros, +written in \TEX\ and \METAPOST, meant for typesetting documents. +The macros are accompanied by some scripts, written in \PERL\ (mainly +the older scripts) \RUBY\ (the official ones) and \LUA\ (for +embedded usage). The \CONTEXT\ distribution comes with a few fonts, +files that help manage resources (e.g.\ map files), as well as +patterns (based on official ones, so this is a derived work). + +The \CONTEXT\ distribution is packaged in a zip file organized in +the \TDS\ structure. + +\starttabulate +\NC \type {cont-tmf.zip} \NC The main distribution. \NC \NR +\NC \type {cont-img.zip} \NC A few extra resources. \NC \NR +\NC \type {cont-ext.zip} \NC Third party modules. \NC \NR +\stoptabulate + +When we talk about \CONTEXT\ we also mean its graphical companion +\METAFUN\ and \FOXET, an \XML\ related product. All these are +included in the main distribution archive. + +The documentation can be downloaded from our website, one of its +mirrors, the \TEX\ collection as distributed by \TEX\ user groups. +For some manuals, source code is available in a subversion +repository. The archives are also kept on \CTAN. + +That said, what licence does apply? We need to distinguish between +things that resemble a program on the one hand and documentation +on the other hand. We (currently) use a different licence for +either of them. + +\subject {The Code} + +The program code (i.e. anything not under the \type {/doc} +subtree) is distributed under the + +\startnarrower +\goto{Creative Commons GNU GPL}[url(gpl-simple)] +\stopnarrower + +For practical purposes distributers may also choose the \LATEX\ +project licence, which is considered to be a bit more \TEX\ +friendly. (BSD alike licences, the Ruby Licence and the Apache +are all licences that apply well for \CONTEXT.) + +In practice, users may forget about the legal part, if only +because I haven't even read (and understood) it completely myself, +so let's stick to what Creative Commons makes of it: + +\startcolor[blue] +The GNU General Public License is a Free Software license. Like +any Free Software license, it grants to you the four following +freedoms: + +\startitemize +\item The freedom to run the program for any purpose. +\item The freedom to study how the program works and adapt it to + your needs. +\item The freedom to redistribute copies so you can help your neighbour. +\item The freedom to improve the program and release your improvements + to the public, so that the whole community benefits. +\stopitemize + +You may exercise the freedoms specified here provided that you +comply with the express conditions of this license. The principal +conditions are: + +You must conspicuously and appropriately publish on each copy +distributed an appropriate copyright notice and disclaimer of +warranty and keep intact all the notices that refer to this +License and to the absence of any warranty; and give any other +recipients of the Program a copy of the GNU General Public License +along with the Program. Any translation of the GNU General Public +License must be accompanied by the GNU General Public License. + +If you modify your copy or copies of the program or any portion of +it, or develop a program based upon it, you may distribute the +resulting work provided you do so under the GNU General Public +License. Any translation of the GNU General Public License must be +accompanied by the GNU General Public License. + +If you copy or distribute the program, you must accompany it with +the complete corresponding machine-readable source code or with a +written offer, valid for at least three years, to furnish the +complete corresponding machine-readable source code. + +Any of these conditions can be waived if you get permission from +the copyright holder. + +Your fair use and other rights are in no way affected by the above. +\stopcolor + +\subject {Recommendations} + +Here are a few recommendations in case you want to distribute, +extend of embed \CONTEXT\ in applications: + +\startitemize + +\item You can best leave the code base untouched. Most of +\CONTEXT\ provides hooks and it's relatively easy to overload +code. Leave the lower level system code untouched: changes may +backfire when you update. Asking for more hooks is the best way to +go. + +\item Put your own code in the right subpaths, i.e.\ modules +approved by the development team under \type {.../third}, and +styles and whatever else under \type {.../user}. This way your +code will not interfere with existing code and updating will give +less problems. Keep in mind that \TEX\ systems have their own way +and order in locating files, and the load order often matters. + +\item Don't copy styles and change a few lines, but load the base one +and built|/|patch on top of that. In the end you may benefit from +improvements to the base style. + +\item Be original. The whole idea behind \CONTEXT\ is that you can +write your own styles. On the \CONTEXT\ mailing list as well as on +the Wiki there are enough advanced users to help you make a start. + +\item Don't hesitate to submit bugs reports and ask for +extensions. It may even be that what you want is already present +but yet undocumented. + +\item If things don't work as expected, check to what extend your +system matches the (more or less) standard. We provide so called +minimal \CONTEXT\ trees that can serve as a reference. Because +\CONTEXT\ evolves, make sure your system is up to date. + +\item The scripts can best be called using \type {texmfstart}. This +lessens dependencies on the location in the tree and ensures upward +compatibility. It also prevents clashes with similary named scripts. + +\item Some scripts depend on each other. Don't mess around with the +existing functionality and names of the scripts and then feed them +back into the standard distributions. + +\stopitemize + +\subject {Documents} + +The documentation is provided under another Creative Commons licence + +\startnarrower +\goto{Attribution NonCommercial ShareAlike}[url(byncsa-simple)] +\stopnarrower + +This one says: + +\startcolor[blue] +You are free: + +\startitemize +\item to copy, distribute, display, and perform the work +\item to make derivative works +\stopitemize + +{\sc Attribution:} You must attribute the work in the manner +specified by the author or licensor. + +{\sc NonCommercial:} You may not use this work for commercial +purposes. + +{\sc Share Alike:} If you alter, transform, or build upon this +work, you may distribute the resulting work only under a license +identical to this one. + +\startitemize +\item For any reuse or distribution, you must make clear to others + the license terms of this work. +\item Any of these conditions can be waived if you get permission from + the copyright holder. +\stopitemize + +Your fair use and other rights are in no way affected by the above. +\stopcolor + +The non||commercial part is mostly a safeguard. We don't mind if +user groups distribute printed copies, publish (parts of) manuals +and|/|or if authors use example code in manuals and books about +\CONTEXT. + +If you distribute \CONTEXT\ and related software on electronic media +as part of \TEX\ distributions (either or not for money), you may +also distribute the manuals and their sources in electronic form, +preferable as provided by the maintainers of \CONTEXT. + +Keep in mind that logos and cover designs are not meant to be +copied. We provide the source code for some manuals, but we don't +always provide all graphics and other resources. For instance, in +some manuals we use commercial fonts and you have to buy those +yourself. + +We provide the typeset manuals at our website. Those are the official +ones. We appreciate it if you do not to distribute manuals compiled +on your own system as substitutes. The manuals are a showcase for what +\CONTEXT\ provides. Help us to assure the quality. + +\subject {More information} + +We're not going to fill \mathematics{n}~pages with legal stuff, so if +you want to know more, you have to consult the web for the legalities +mentioned. Here are a few starting points: + +\startlines +\goto{\url[gpl-simple]}[url(gpl-simple)] +\goto{\url[gpl-legal]}[url(gpl-legal)] +\stoplines + +\startlines +\goto{\url[byncsa-simple]}[url(byncsa-simple)] +\goto{\url[byncsa-legal]}[url(byncsa-legal)] +\stoplines + +\CONTEXT\ itself can be fetched from the main site or its primary mirror: + +\startlines +\goto{\url[pragma]}[url(pragma)] +\goto{\url[mirror]}[url(mirror)] +\stoplines + +A starting point for support can be found at: + +\startlines +\goto{\url[contextlist]}[url(contextlist)] +\goto{\url[garden]}[url(garden)] +\stoplines + +Bugs and feature requests can be registered at the collector: + +\startlines +\goto{\url[collector]}[url(collector)] +\stoplines + +Releases are announced at: + +\startlines +\goto{\url[announce]}[url(announce)] +\stoplines + +The developers can be met at: + +\startlines +\goto{\url[development]}[url(development)] +\stoplines + +\subject {Disclaimer} + +To play safe we include a disclaimer here, taken from the BSD style +licence. For some reason such a text is in capitals, so \unknown + +\start \sc \blue +THIS SOFTWARE IS PROVIDED BY THE AUTHOR \quotation {AS IS} AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +\stop + +\unknown\ and don't bother discussing licence issues and related things +with us for the mere sake of discussing licence stuff. + +\blank[2*big] + +\startlines +Hans Hagen +PRAGMA ADE +Hasselt NL +\stoplines + +\ColofonPage + +\stoptext diff --git a/fonts/afm/hoekwater/koeieletters/koeieletters-contour.afm b/fonts/afm/hoekwater/koeieletters/koeieletters-contour.afm index 6c44a2b9d..1bd7ec716 100644 --- a/fonts/afm/hoekwater/koeieletters/koeieletters-contour.afm +++ b/fonts/afm/hoekwater/koeieletters/koeieletters-contour.afm @@ -193,7 +193,7 @@ C -1 ; WX 382 ; N bracketleft.ex ; B 25 -504 271 8 ; C -1 ; WX 376 ; N bracketright.ex ; B 116 -504 351 8 ; C -1 ; WX 382 ; N bracketleft.bot ; B 25 -480 339 8 ; C -1 ; WX 376 ; N bracketright.bot ; B 25 -482 351 8 ; -C -1 ; WX 465 ; N hacek ; B 25 611 440 821 ; +C -1 ; WX 465 ; N caron ; B 25 611 440 821 ; C -1 ; WX 534 ; N macron ; B 25 575 509 707 ; C -1 ; WX 483 ; N ringaccent ; B 160 560 370 719 ; C -1 ; WX 547 ; N arrowleft.lft ; B 25 49 555 433 ; diff --git a/fonts/afm/hoekwater/koeieletters/koeieletters.afm b/fonts/afm/hoekwater/koeieletters/koeieletters.afm index 3827ec33c..477546211 100644 --- a/fonts/afm/hoekwater/koeieletters/koeieletters.afm +++ b/fonts/afm/hoekwater/koeieletters/koeieletters.afm @@ -193,7 +193,7 @@ C -1 ; WX 382 ; N bracketleft.ex ; B 25 -504 271 8 ; C -1 ; WX 376 ; N bracketright.ex ; B 116 -504 351 8 ; C -1 ; WX 382 ; N bracketleft.bot ; B 25 -480 339 8 ; C -1 ; WX 376 ; N bracketright.bot ; B 25 -482 351 8 ; -C -1 ; WX 465 ; N hacek ; B 25 611 440 821 ; +C -1 ; WX 465 ; N caron ; B 25 611 440 821 ; C -1 ; WX 534 ; N macron ; B 25 575 509 707 ; C -1 ; WX 483 ; N ringaccent ; B 160 560 370 719 ; C -1 ; WX 547 ; N arrowleft.lft ; B 25 49 555 433 ; diff --git a/fonts/enc/pdftex/context/koeieletters.enc b/fonts/enc/pdftex/context/koeieletters.enc index 072fc8a50..e6b0405ea 100644 --- a/fonts/enc/pdftex/context/koeieletters.enc +++ b/fonts/enc/pdftex/context/koeieletters.enc @@ -19,7 +19,7 @@ /dotlessj /grave /acute - /hacek + /caron /breve /hungarumlaut /macron diff --git a/fonts/type1/hoekwater/koeieletters/koeieletters-contour.pfb b/fonts/type1/hoekwater/koeieletters/koeieletters-contour.pfb index aa4b58bbd..a6250e338 100644 Binary files a/fonts/type1/hoekwater/koeieletters/koeieletters-contour.pfb and b/fonts/type1/hoekwater/koeieletters/koeieletters-contour.pfb differ diff --git a/fonts/type1/hoekwater/koeieletters/koeieletters.pfb b/fonts/type1/hoekwater/koeieletters/koeieletters.pfb index 62037f8b1..25fef49f1 100644 Binary files a/fonts/type1/hoekwater/koeieletters/koeieletters.pfb and b/fonts/type1/hoekwater/koeieletters/koeieletters.pfb differ diff --git a/metapost/context/base/mp-form.mp b/metapost/context/base/mp-form.mp index bad87651c..a65ab6d73 100644 --- a/metapost/context/base/mp-form.mp +++ b/metapost/context/base/mp-form.mp @@ -1,58 +1,58 @@ -% Hans Hagen / October 2000 +% 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: +% 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 +% fmt_zerocheck activate extra sci notation zero check % % instead of a picture, one can format a number in a for TeX % acceptable input string -boolean mant_font ; mant_font := true ; % signals graph not to load form +boolean mant_font ; mant_font := true ; % signals graph not to load form -if known fmt_loaded : expandafter endinput fi ; +if known fmt_loaded : expandafter endinput fi ; boolean fmt_loaded ; fmt_loaded := true ; -if unknown fmt_precision : - numeric fmt_precision ; fmt_precision := 3 ; +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_initialize : + boolean fmt_initialize ; fmt_initialize := true ; +fi ; -if unknown fmt_separator : - string fmt_separator ; fmt_separator := "%" ; -fi ; +if unknown fmt_separator : + string fmt_separator ; fmt_separator := "%" ; +fi ; -if unknown fmt_zerocheck : - boolean fmt_zerocheck ; fmt_zerocheck := false ; -fi ; +if unknown fmt_zerocheck : + boolean fmt_zerocheck ; fmt_zerocheck := false ; +fi ; -boolean fmt_metapost ; fmt_metapost := true ; % == use old method +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. +% 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. +% TeX specs when using TeX instead of pseudo TeX. -string sFebraise_ ; sFebraise_ := "{" ; -string sFeeraise_ ; sFeeraise_ := "}" ; -string sFebmath_ ; sFebmath_ := "$" ; -string sFeemath_ ; sFeemath_ := "$" ; +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 := "" ; % "+" +string sFmneg_ ; sFmneg_ := "-" ; +string sFemarker_ ; sFemarker_ := "{\times}10^" ; +string sFeneg_ ; sFeneg_ := "-" ; +string sFe_plus ; sFe_plus := "" ; % "+" -def sFe_base = Fline_up_("1", sFemarker_) enddef ; +def sFe_base = Fline_up_("1", sFemarker_) enddef ; % Macros for generating typeset pictures of computed numbers % @@ -64,19 +64,19 @@ def sFe_base = Fline_up_("1", sFemarker_) enddef ; % Fe_plus plus sign if any for typesetting positive exponents % Ten_to[] powers of ten for indices 0,1,2,3,4 % -% New are: +% 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 _. +% externally visible names start with F and end with _. % Allow big numbers in token lists -begingroup interim warningcheck := 0 ; +begingroup interim warningcheck := 0 ; -%%% Load auxiliary macros. +%%% Load auxiliary macros. input string input marith @@ -87,24 +87,24 @@ picture Fmneg_, Femarker_, Feneg_, Fe_base, Fe_plus ; string Fmfont_, Fefont_ ; numeric Fmscale_, Fescale_, Feraise_ ; -% Argument +% 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. -% +% 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. +% Fe_base after calling init_numbers. -vardef init_numbers(expr s, m, x, sn, e) = +vardef init_numbers(expr s, m, x, sn, e) = Fmneg_ := s ; - for p within m : + for p within m : Fmfont_ := fontpart p ; Fmscale_ := xxpart p ; exitif true ; @@ -117,34 +117,34 @@ vardef init_numbers(expr s, m, x, sn, e) = Feraise_ := ypart llcorner p ; exitif true ; endfor - if fmt_metapost : + if fmt_metapost : Fe_base := Fline_up_("1" infont Fmfont_ scaled Fmscale_, Femarker_) ; - % else : + % else : % sFe_base := Fline_up_("1", sFemarker_) ; - fi ; + fi ; Fe_plus := nullpicture ; enddef ; %%% Low-Level Typesetting %%% vardef Fmant_(expr x) = %%% adapted by HH %%% - if fmt_metapost : + if fmt_metapost : (decimal abs x infont Fmfont_ scaled Fmscale_) - else : - (decimal abs x) - fi + else : + (decimal abs x) + fi enddef ; vardef Fexp_(expr x) = %%% adapted by HH %%% - if fmt_metapost : + if fmt_metapost : (decimal x infont Fefont_ scaled Fescale_ shifted (0,Feraise_)) - else : - (decimal x) - fi + else : + (decimal x) + fi enddef ; vardef Fline_up_(text t_) = %%% adapted by HH %%% - if fmt_metapost : + if fmt_metapost : save p_, c_ ; picture p_ ; p_ = nullpicture ; pair c_ ; c_ = (0,0) ; @@ -154,63 +154,69 @@ vardef Fline_up_(text t_) = %%% adapted by HH %%% c_ := (xpart lrcorner p_, 0) ; endfor p_ - else : - "" for q_ = t_ : & q_ endfor - fi + else : + "" for q_ = t_ : & q_ endfor + fi enddef ; vardef Fdec_o_(expr x) = %%% adapted by HH %%% - if x<0 : + if x<0 : Fline_up_(if fmt_metapost : Fmneg_ else : sFmneg_ fi, Fmant_(x)) - else : + else : Fmant_(x) fi enddef ; vardef Fsci_o_(expr x, e) = %%% adapted by HH %%% - if fmt_metapost : + 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 : + Fexp_(abs e)) + else : Fline_up_ (if x < 0 : sFmneg_, fi if abs x = 1 : sFe_base else : Fmant_(x), sFemarker_ fi, - sFebraise_, + sFebraise_, if e < 0 : sFeneg_ else : sFe_plus fi, - Fexp_(abs e), + Fexp_(abs e), sFeeraise_) - fi + 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. +% file mechanism requires separate input files here. +% +% if fmt_initialize : %%% adapted by HH +% if prologues = 1 : input troffnum else : input texnum fi +% fi ; +% +% wrong assumption, so we need: -if fmt_initialize : %%% adapted by HH - if prologues = 1 : input troffnum else : input texnum fi +if fmt_initialize : + input texnum ; 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. +% the `exponent form' of x. -vardef Feform_(expr 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 : + if abs b >= 10000 : (b/10, 1) - elseif b = 0 : + elseif b = 0 : origin - else : + else : forever : exitif abs b >= 1000 ; b := b*10 ; e := e-1 ; @@ -223,16 +229,16 @@ 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. +% large, fix it. -vardef Feadj_(expr x, y) = +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. +% round to the nearest multiple of 10 to the -d. -vardef roundd(expr x, d) = +vardef roundd(expr x, d) = if abs d > 4 : if d > 0 : x else : 0 fi elseif d > 0 : @@ -243,23 +249,23 @@ vardef roundd(expr x, d) = fi enddef ; -Ten_to0 = 1 ; -Ten_to1 = 10 ; -Ten_to2 = 100 ; -Ten_to3 = 1000 ; +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. +% Round an exponent form number p to k significant figures. -primarydef p Fprec_ k = - Feadj_(roundd(xpart p,k-4), ypart p) +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. +% decimal point. -primarydef p Fdigs_ k = - Feadj_(roundd(xpart p,k+ypart p), ypart p) +primarydef p Fdigs_ k = + Feadj_(roundd(xpart p,k+ypart p), ypart p) enddef ; %%% High-Level Routines %%% @@ -267,30 +273,30 @@ enddef ; % 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. +% 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 + 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 : +vardef Formdec_(expr z) = + if ypart z > 0 : Formsci_(z) else : Fdec_o_ - (xpart z if ypart z >= -4 : + (xpart z if ypart z >= -4 : /Ten_to[-ypart z] - else : - for i = ypart z upto -5 : /(10) endfor /10000 + else : + for i = ypart z upto -5 : /(10) endfor /10000 fi) fi enddef ; -vardef Formgen_(expr q) = +vardef Formgen_(expr q) = clearxy ; (x,y) = q ; if x = 0 : Formdec_ elseif y >= -6 : Formdec_ @@ -299,17 +305,17 @@ vardef Formgen_(expr q) = enddef ; def Fset_item_(expr s) = %%% adapted by HH %%% - if s <> "" : + if s <> "" : if fmt_metapost : s infont defaultfont scaled defaultscale, - else : - s, - fi - fi + else : + s, + fi + fi enddef ; % For each format letter, the table below tells how to -% round and typeset a quantity z in exponent form. +% round and typeset a quantity z in exponent form. % % e scientific, p significant figures % p decimal, p digits right of the point @@ -318,80 +324,80 @@ enddef ; string fmt_[] ; -fmt_[ASCII "e"] = "Formsci_(z Fprec_ p)" ; +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)" ; +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). +% an integer giving the precision (default 3). vardef isfmtseparator primary c = %%% added by HH %%% - ((c <> fmt_separator) and (c <> "%")) -enddef ; + ((c <> fmt_separator) and (c <> "%")) +enddef ; -def initialize_form_numbers = +def initialize_form_numbers = initialize_numbers ; % in context: do_initialize_numbers ; enddef ; vardef dofmt_@#(expr f, x) = %%% adapted by HH %%% - initialize_form_numbers ; - if f = "" : - if fmt_metapost : nullpicture else : "" fi + initialize_form_numbers ; + if f = "" : + if fmt_metapost : nullpicture else : "" fi else : interim warningcheck := 0 ; save k, l, s, p, z ; pair z ; z = @#(x) ; - % the next adaption is okay + % the next adaption is okay % k = 1 + cspan(f, fmt_separator <> ) ; - % but best is to support both % and fmt_separator + % but best is to support both % and fmt_separator k = 1 + cspan(f, isfmtseparator) ; - % + % l-k = cspan(substring(k,infinity) of f, isdigit) ; - p = if l > k : - scantokens substring(k,l) of f - else : - fmt_precision + 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) ; + 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 + if not fmt_metapost : sFebmath_, fi scantokens s, - if not fmt_metapost : sFeemath_, fi + if not fmt_metapost : sFeemath_, fi Fset_item_(substring (l+1,infinity) of f) - if fmt_metapost : nullpicture else : "" fi) + if fmt_metapost : nullpicture else : "" fi) fi - hide (fmt_metapost := true) + hide (fmt_metapost := true) enddef ; -%%% so far %%% +%%% so far %%% -vardef format (expr f, x) = - fmt_metapost := true ; dofmt_.Feform_(f,x) +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) +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) +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) +vardef Mformatstr(expr f, x) = + fmt_metapost := false ; dofmt_.Meform (f,x) enddef ; % Restore warningcheck to previous value. -endgroup ; +endgroup ; diff --git a/metapost/context/base/mp-spec.mp b/metapost/context/base/mp-spec.mp index a46b09e92..6c5a557b4 100644 --- a/metapost/context/base/mp-spec.mp +++ b/metapost/context/base/mp-spec.mp @@ -185,17 +185,60 @@ newinternal shadefactor ; shadefactor := 1 ; pair shadeoffset ; shadeoffset := origin ; +% vardef define_linear_shade (expr a, b, ca, cb) = +% flush_special(30, 15, "0 1 " & decimal shadefactor & " " & +% dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & +% dddecimal cb & " " & ddecimal (b shifted shadeoffset) ) ; +% _special_counter_ +% enddef ; + +% vardef define_circular_shade (expr a, b, ra, rb, ca, cb) = +% flush_special(31, 17, "0 1 " & decimal shadefactor & " " & +% dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & +% dddecimal cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; +% _special_counter_ +% enddef ; + +vardef _is_cmyk_(expr c) = + (redpart c = _special_signal_/_special_div_) and (greenpart c = 1/_special_div_) +enddef ; +vardef _is_spot_(expr c) = + (redpart c = _special_signal_/_special_div_) and (greenpart c = 2/_special_div_) +enddef ; + +numeric mp_shade_version ; mp_shade_version := 2 ; % more colors, needs new backend + vardef define_linear_shade (expr a, b, ca, cb) = - flush_special(30, 15, "0 1 " & decimal shadefactor & " " & - dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & - dddecimal cb & " " & ddecimal (b shifted shadeoffset) ) ; - _special_counter_ + if (mp_shade_version > 1) and _is_cmyk_(ca) and _is_cmyk_(cb) : + flush_special(32, 17, "0 1 " & decimal shadefactor & " " & + cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & + cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ; + elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) : + flush_special(34, 17, "0 1 " & decimal shadefactor & " " & + spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & + cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ; + else : + flush_special(30, 15, "0 1 " & decimal shadefactor & " " & + dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & + dddecimal cb & " " & ddecimal (b shifted shadeoffset) ) ; + fi ; + _special_counter_ enddef ; vardef define_circular_shade (expr a, b, ra, rb, ca, cb) = - flush_special(31, 17, "0 1 " & decimal shadefactor & " " & - dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & - dddecimal cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; + if (mp_shade_version > 1) and _is_cmyk_(ca) and _is_cmyk_(cb) : + flush_special(33, 19, "0 1 " & decimal shadefactor & " " & + cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & + cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; + elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) : + flush_special(35, 19, "0 1 " & decimal shadefactor & " " & + spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & + spotcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; + else : + flush_special(31, 17, "0 1 " & decimal shadefactor & " " & + dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & + dddecimal cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; + fi ; _special_counter_ enddef ; diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp index 3b52b9d5d..fca61cb34 100644 --- a/metapost/context/base/mp-tool.mp +++ b/metapost/context/base/mp-tool.mp @@ -58,8 +58,9 @@ vardef mpversiongt (expr s) = mpversioncmp(s, ">") enddef ; %D We always want \EPS\ conforming output, so we say: -prologues := 2 ; % 1 = troff, 2 = tex +prologues := 1 ; warningcheck := 0 ; +mpprocset := 1 ; %D Namespace handling: diff --git a/scripts/context/perl/mptopdf.pl b/scripts/context/perl/mptopdf.pl index f85c36891..b1589a9d3 100644 --- a/scripts/context/perl/mptopdf.pl +++ b/scripts/context/perl/mptopdf.pl @@ -120,9 +120,9 @@ foreach my $file (@files) { $_ = $file ; if (s/\.(\d+|mps)$// && -e $file) { if ($miktex) { - $command = "pdfetex -undump=mptopdf" ; + $command = "pdftex -undump=mptopdf" ; } else { - $command = "pdfetex -fmt=mptopdf -progname=context" ; + $command = "pdftex -fmt=mptopdf -progname=context" ; } if ($dosish) { $command = "$command \\relax $file" ; diff --git a/scripts/context/perl/texfont.pl b/scripts/context/perl/texfont.pl index 425417374..ec875e5b4 100644 --- a/scripts/context/perl/texfont.pl +++ b/scripts/context/perl/texfont.pl @@ -42,6 +42,7 @@ use Config ; use FindBin ; use File::Copy ; use Getopt::Long ; +use Data::Dumper; $Getopt::Long::passthrough = 1 ; # no error message $Getopt::Long::autoabbrev = 1 ; # partial switch accepted @@ -146,6 +147,7 @@ my $trace = 0 ; my $afmpl = 0 ; my $trees = 'TEXMFFONTS,TEXMFLOCAL,TEXMFEXTRA,TEXMFMAIN,TEXMFDIST' ; my $pattern = '' ; +my $uselmencodings = 0 ; my $fontsuffix = "" ; my $namesuffix = "" ; @@ -198,6 +200,7 @@ my @cleanup = () ; # atl: build list of generated files to delete "expert" => \$expert, "afmpl" => \$afmpl, "afm2pl" => \$afmpl, + "lm" => \$uselmencodings, "rootlist=s" => \$trees, "pattern=s" => \$pattern, "trace" => \$trace, # --verbose conflicts with --ve @@ -549,7 +552,6 @@ if ($sourcepath eq "auto") # todo uppercase root foreach my $sub ("tfm","vf") { foreach my $typ ("","-raw") { my $nam = "$path/fonts/$sub/$vendor/$collection/$encoding$varlabel$typ-$file.$sub" ; - # { my $nam = "$path/fonts/$sub/$vendor/$collection/$encoding$varlabel$typ-$file$fontsuffix.$sub" ; if (-s $nam) { report ("removing : $encoding$varlabel$typ-$file.$sub") ; unlink $nam } } } } @@ -558,11 +560,12 @@ if ($sourcepath eq "auto") # todo uppercase root { report ("removing : $nam") ; unlink "$nam" } my $mapfile = "$encoding$varlabel-$vendor-$collection" ; - my $maproot = "$fontroot/fonts/map/pdftex/context"; - if (-e "$maproot$mapfile.map") - { report ("renaming : $mapfile.map -> $mapfile.bak") ; - unlink "$maproot$mapfile.bak" ; - rename "$maproot$mapfile.map", "$maproot$mapfile.bak" } + foreach my $map ("pdftex","dvips", "dvipdfm") + { my $maproot = "$fontroot/fonts/map/$map/context/"; + if (-e "$maproot$mapfile.map") + { report ("renaming : $mapfile.map -> $mapfile.bak") ; + unlink "$maproot$mapfile.bak" ; + rename "$maproot$mapfile.map", "$maproot$mapfile.bak" } } exit } else { last } } } } @@ -576,9 +579,13 @@ my $tfmpath = "$fontroot/fonts/tfm/$vendor/$collection" ; my $vfpath = "$fontroot/fonts/vf/$vendor/$collection" ; my $pfbpath = "$fontroot/fonts/type1/$vendor/$collection" ; my $ttfpath = "$fontroot/fonts/truetype/$vendor/$collection" ; -my $mappath = "$fontroot/fonts/map/pdftex/context" ; +my $otfpath = "$fontroot/fonts/opentype/$vendor/$collection" ; my $encpath = "$fontroot/fonts/enc/dvips/context" ; +sub mappath + { my $str = shift ; + return "$fontroot/fonts/map/$str/context" } + # are not on local path ! ! ! ! foreach my $path ($afmpath, $pfbpath) @@ -597,20 +604,19 @@ if (($fontroot =~ /texmf\-fonts/o) || (-e "$fontroot/ls-R") || (-e "$fontroot/ls sub do_make_path { my $str = shift ; if ($str =~ /^(.*)\/.*?$/) - { do_make_path($1) } + { do_make_path($1); } mkdir $str, 0755 unless -d $str } sub make_path { my $str = shift ; - do_make_path("$fontroot/fonts") ; - do_make_path("$fontroot/fonts/$str") ; - do_make_path("$fontroot/fonts/$str/$vendor") ; do_make_path("$fontroot/fonts/$str/$vendor/$collection") } if ($makepath&&$install) { make_path ("afm") ; make_path ("type1") } -do_make_path($mappath) ; +do_make_path(mappath("pdftex")) ; +do_make_path(mappath("dvips")) ; +do_make_path(mappath("dvipdfm")) ; do_make_path($encpath) ; # now fonts/map and fonts/enc @@ -624,21 +630,23 @@ if ($install) error ("unknown tfm path $tfmpath") unless -d $tfmpath ; error ("unknown vf path $vfpath" ) unless -d $vfpath ; -error ("unknown map path $mappath") unless -d $mappath ; +error ("unknown map path " . mappath("pdftex")) unless -d mappath("pdftex"); +error ("unknown map path " . mappath("dvips")) unless -d mappath("dvips"); +error ("unknown map path " . mappath("dvipdfm")) unless -d mappath("dvipdfm"); my $mapfile = "$identifier.map" ; my $bakfile = "$identifier.bak" ; my $texfile = "$identifier.tex" ; - report "encoding vector : $encoding" ; + report "encoding vector : $encoding" ; if ($variant) { report "encoding variant : $variant" } report "vendor name : $vendor" ; report " source path : $sourcepath" ; report "font collection : $collection" ; report "texmf font root : $lcfontroot" ; - report "pdftex map file : $mapfile" ; + report " map file name : $mapfile" ; -if ($install) { report "source path : $sourcepath" } +if ($install) { report "source path : $sourcepath" } my $fntlist = "" ; @@ -736,45 +744,74 @@ if ($install) copy_files("ttf",$sourcepath,$ttfpath) } if ($extension eq "otf") { make_path("truetype") ; - copy_files("otf",$sourcepath,$ttfpath) } } + copy_files("otf",$sourcepath,$ttfpath) } } error ("no afm files found") unless @files ; -my $map = my $tex = 0 ; my $mapdata = my $texdata = "" ; - -copy ("$mappath/$mapfile","$mappath/$bakfile") ; - -if (open (MAP,"<$mappath/$mapfile")) - { report ("extending map file : $mappath/$mapfile") ; - while () { unless (/^\%/o) { $mapdata .= $_ } } - close (MAP) } -else - { report ("no map file at : $mappath/$mapfile") } +sub open_mapfile + { my $type = shift; + my $mappath = mappath($type); + my $mapdata = ""; + my $mapptr = undef; + my $fullmapfile = $mapfile; + $fullmapfile = "$type-$fullmapfile" unless $type eq "pdftex"; + if ($install) + { copy ("$mappath/$mapfile","$mappath/$bakfile") ; } + if (open ($mapptr,"<$mappath/$mapfile")) + { report ("extending map file : $mappath/$mapfile") ; + while (<$mapptr>) { unless (/^\%/o) { $mapdata .= $_ } } + close ($mapptr) } + else + { report ("no map file at : $mappath/$mapfile") } + #~ unless (open ($mapptr,">$fullmapfile") ) +do_make_path($mappath) ; + unless (open ($mapptr,">$mappath/$fullmapfile") ) + { report "warning : can't open $fullmapfile" } + else + { if ($type eq "pdftex") + { print $mapptr "% This file is generated by the TeXFont Perl script.\n"; + print $mapptr "%\n" ; + print $mapptr "% You need to add the following line to your file:\n" ; + print $mapptr "%\n" ; + print $mapptr "% \\pdfmapfile{+$mapfile}\n" ; + print $mapptr "%\n" ; + print $mapptr "% In ConTeXt you can best use:\n" ; + print $mapptr "%\n" ; + print $mapptr "% \\loadmapfile\[$mapfile\]\n\n" } } + return ($mapptr,$mapdata) ; } + +sub finish_mapfile + { my ($type, $mapptr, $mapdata ) = @_; + my $fullmapfile = $mapfile; + $fullmapfile = "$type-$fullmapfile" unless $type eq "pdftex"; + if (defined $mapptr) + { report ("updating map file : $mapfile (for $type)") ; + while ($mapdata =~ s/\n\n+/\n/mois) {} ; + $mapdata =~ s/^\s*//gmois ; + print $mapptr $mapdata ; + close ($mapptr) ; + if ($install) + { copy ("$fullmapfile", mappath($type) . "/$mapfile") ; } } } + + +my ($PDFTEXMAP,$pdftexmapdata) = open_mapfile("pdftex"); +my ($DVIPSMAP,$dvipsmapdata) = open_mapfile("dvips"); +my ($DVIPDFMMAP,$dvipdfmmapdata) = open_mapfile("dvipdfm"); + +my $tex = 0 ; +my $texdata = "" ; if (open (TEX,"<$texfile")) { while () { unless (/stoptext/o) { $texdata .= $_ } } close (TEX) } -$map = open (MAP,">$mapfile") ; $tex = open (TEX,">$texfile") ; -unless ($map) { report "warning : can't open $mapfile" } unless ($tex) { report "warning : can't open $texfile" } -if ($map) - { print MAP "% This file is generated by the TeXFont Perl script.\n" ; - print MAP "%\n" ; - print MAP "% You need to add the following line to your file:\n" ; - print MAP "%\n" ; - print MAP "% \\pdfmapfile{+$mapfile}\n" ; - print MAP "%\n" ; - print MAP "% In ConTeXt you can best use:\n" ; - print MAP "%\n" ; - print MAP "% \\loadmapfile\[$mapfile\]\n\n" } - if ($tex) { if ($texdata eq "") - { print TEX "% output=pdftex interface=en\n" ; + { print TEX "% interface=en\n" ; print TEX "\n" ; print TEX "\\usemodule[fnt-01]\n" ; print TEX "\n" ; @@ -811,6 +848,227 @@ if ($encoding ne "") # evt -progname=context { $encfil = `kpsewhich -progname=pdftex $encoding$varlabel.enc` ; chomp $encfil ; if ($encfil eq "") { $encfil = "$encoding$varlabel.enc" } } +sub build_pdftex_mapline + { my ($option, $usename, $fontname, $rawname, $cleanfont, $encoding, $varlabel, $strange) = @_; + my $cleanname = $fontname; + $cleanname =~ s/\_//gio ; + $option =~ s/^\s+(.*)/$1/o ; + $option =~ s/(.*)\s+$/$1/o ; + $option =~ s/ / /g ; + if ($option ne "") + { $option = "\"$option\" 4" } + else + { $option = "4" } + # adding cleanfont is kind of dangerous + my $thename = ""; + my $str = ""; + my $theencoding = "" ; + if ($strange ne "") + { $thename = $cleanname ; $theencoding = "" ; } + elsif ($lcdf) + { $thename = $usename ; $theencoding = " $encoding$varlabel-$cleanname.enc" } + elsif ($afmpl) + { $thename = $usename ; $theencoding = " $encoding$varlabel.enc" } + elsif ($virtual) + { $thename = $rawname ; $theencoding = " $encoding$varlabel.enc" } + else + { $thename = $usename ; $theencoding = " $encoding$varlabel.enc" } +if ($uselmencodings) { + $theencoding =~ s/^(ec)\.enc/lm\-$1.enc/ ; +} + # quit rest if no type 1 file + my $pfb_sourcepath = $sourcepath ; + $pfb_sourcepath =~ s@/afm/@/type1/@ ; + unless ((-e "$pfbpath/$fontname.$extension")|| + (-e "$pfb_sourcepath/$fontname.$extension")|| + (-e "$sourcepath/$fontname.$extension")|| + (-e "$ttfpath/$fontname.$extension")) + { if ($tex) { $report .= "missing file: \\type \{$fontname.pfb\}\n" } + report ("missing pfb file : $fontname.pfb") } + # now add entry to map + if ($strange eq "") { + if ($extension eq "otf") { + if ($lcdf) { + my $mapline = "" ; + if (open(ALTMAP,"texfont.map")) { + while () { + chomp ; + # atl: we assume this b/c we always force otftotfm --no-type1 + if (/<<(.*)\.otf$/oi) { + $mapline = $_ ; last ; + } + } + close(ALTMAP) ; + } else { + report("no mapfile from otftotfm : texfont.map") ; + } + if ($preproc) { + $mapline =~ s/<\[/) + { if (/^\/([^ ]+)\s*\[/) + { $encname = $1; + last; } } + close ENC; } } + if ($strange ne "") + { $thename = $cleanname ; + $optionencoding = "\"$option\"" if length($option)>1; } + elsif ($lcdf) + { $thename = $usename ; + $optionencoding = "\"$option $encname ReEncodeFont\" <$encoding$varlabel-$cleanname.enc" } + elsif ($afmpl) + { $thename = $usename ; + $optionencoding = "\"$option $encname ReEncodeFont\" <$encoding$varlabel.enc" } + elsif ($virtual) + { $thename = $rawname ; + $optionencoding = "\"$option $encname ReEncodeFont\" <$encoding$varlabel.enc" } + else + { $thename = $usename ; + $optionencoding = "\"$option $encname ReEncodeFont\" <$encoding$varlabel.enc" } +if ($uselmencodings) { + $theencoding =~ s/^(ec)\.enc/lm\-$1.enc/ ; +} + # quit rest if no type 1 file + my $pfb_sourcepath = $sourcepath ; + $pfb_sourcepath =~ s@/afm/@/type1/@ ; + unless ((-e "$pfbpath/$fontname.$extension")|| + (-e "$pfb_sourcepath/$fontname.$extension")|| + (-e "$sourcepath/$fontname.$extension")|| + (-e "$ttfpath/$fontname.$extension")) + { if ($tex) { $report .= "missing file: \\type \{$fontname.pfb\}\n" } + report ("missing pfb file : $fontname.pfb") } + # now add entry to map + if ($strange eq "") { + if ($extension eq "otf") { + if ($lcdf) { + my $mapline = "" ; + if (open(ALTMAP,"texfont.map")) { + while () { + chomp ; + # atl: we assume this b/c we always force otftotfm --no-type1 + if (/<<(.*)\.otf$/oi) { + $mapline = $_ ; last ; + } + } + close(ALTMAP) ; + } else { + report("no mapfile from otftotfm : texfont.map") ; + } + if ($preproc) { + $mapline =~ s/<\[/) { - chomp ; - # atl: we assume this b/c we always force otftotfm --no-type1 - if (/<<(.*)\.otf$/oi) { - $mapline = $_ ; last ; - } - } - close(ALTMAP) ; - } else { - report("no mapfile from otftotfm : texfont.map") ; - } - if ($preproc) { - $mapline =~ s/<\[/ #{@@scripts[k]}\n") end end + def Kpse.used_path(varname) + begin + if @@mswindows then + path = run("--expand-path=\$#{varname}") rescue '' + else + path = run("--expand-path='$#{varname}'") rescue '' + end + rescue + path = '' + end + return path.sane_path + end + def Kpse.found(filename, progname=nil, format=nil) begin tag = Kpse.key(filename) # all if @@located.key?(tag) then - return @@located[tag] + return @@located[tag].sane_path elsif FileTest.file?(filename) then setvariable(tag,filename) return filename elsif FileTest.file?(File.join(@@ownpath,filename)) then setvariable(tag,File.join(@@ownpath,filename)) - return @@located[tag] + return @@located[tag].sane_path else [progname,@@progname].flatten.compact.uniq.each do |prg| [format,@@formats].flatten.compact.uniq.each do |fmt| begin tag = Kpse.key(filename,prg,fmt) if @@located.key?(tag) then - return @@located[tag] + return @@located[tag].sane_path elsif p = Kpse.kpsewhich(filename,prg,fmt) then setvariable(tag,p.chomp) - return @@located[tag] + return @@located[tag].sane_path end rescue end end end setvariable(tag,filename) - return filename + return filename.sane_path end rescue - filename + filename.sane_path end end def Kpse.kpsewhich(filename,progname,format) - Kpse.run("-progname=#{progname} -format=\"#{format}\" #{filename}") + p = if progname && ! progname.empty? then "-progname=#{progname}" else '' end + f = if format && ! format.empty? then "-format=\"#{format}\"" else '' end + Kpse.run("#{p} #{f} #{filename}") end def Kpse.which @@ -160,7 +185,7 @@ module Kpse # maybe we should check for writeability unless @@paths.key?('formatpaths') then begin - setpath('formatpaths',run("--show-path=fmt").gsub(/\\/,'/').split_path) + setpath('formatpaths',run("--show-path=fmt").sane_path.split_path) rescue setpath('formatpaths',[]) end diff --git a/scripts/context/ruby/base/kpsefast.rb b/scripts/context/ruby/base/kpsefast.rb index 20c07c70a..24ff1a0fa 100644 --- a/scripts/context/ruby/base/kpsefast.rb +++ b/scripts/context/ruby/base/kpsefast.rb @@ -9,6 +9,8 @@ # www : www.pragma-ade.com # todo: multiple cnf files +# +# todo: cleanup, string or table store (as in lua variant) class String diff --git a/scripts/context/ruby/base/mp.rb b/scripts/context/ruby/base/mp.rb index b30be1110..5dd2948cf 100644 --- a/scripts/context/ruby/base/mp.rb +++ b/scripts/context/ruby/base/mp.rb @@ -91,8 +91,8 @@ EOT f.puts("") f.puts(@@start[method]) end - data.gsub!(/[^\\]%.*?$/mo) do - '' + data.gsub!(/([^\\])%.*?$/mo) do + $1 end data.scan(/(verbatim|b)tex\s*(.*?)\s*etex/mo) do tag, text = $1, $2 diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index a6403dcde..f6f3dc4ed 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -85,6 +85,9 @@ class TEX @@pdftex = 'pdftex' # new default, pdfetex is gone + @@luafiles = "luafiles.tmp" + @@luatarget = "lua/context" + ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| if System.unix? then pp, pe = "#{p}/pdftex" , "#{p}/pdfetex" @@ -113,7 +116,7 @@ class TEX ['pdfetex','pdftex','pdf','pdftex','standard'] .each do |b| @@backends[b] = 'pdftex' end ['dvipdfmx','dvipdfm','dpx','dpm'] .each do |b| @@backends[b] = 'dvipdfmx' end ['xetex','xtx'] .each do |b| @@backends[b] = 'xetex' end - ['dvips','ps'] .each do |b| @@backends[b] = 'dvips' end + ['dvips','ps','dvi'] .each do |b| @@backends[b] = 'dvips' end ['dvipsone'] .each do |b| @@backends[b] = 'dvipsone' end ['acrobat','adobe','distiller'] .each do |b| @@backends[b] = 'acrobat' end ['xdv','xdv2pdf'] .each do |b| @@backends[b] = 'xdv2pdf' end @@ -164,7 +167,7 @@ class TEX @@runoptions['xetex'] = ['--8bit -no-pdf'] # from now on we assume (x)dvipdfmx to be used @@runoptions['pdfetex'] = ['--8bit '] @@runoptions['pdftex'] = ['--8bit '] # pdftex is now pdfetex - @@runoptions['luatex'] = ['--8bit '] + @@runoptions['luatex'] = [''] @@runoptions['aleph'] = ['--8bit '] @@booleanvars = [ @@ -225,6 +228,29 @@ class TEX @@extrabooleanvars << vars end + # def jobvariables(names=nil) + # if [names ||[]].flatten.size == 0 then + # names = [allbooleanvars,allstringvars].flatten + # end + # data = Hash.new + # names.each do |name| + # if allbooleanvars.include?(name) then + # data[name] = if getvariable(name) then "yes" else "no" end + # else + # data[name] = getvariable(name) + # end + # end + # data + # end + + # def setjobvariables(names=nil) + # assignments = Array.new + # jobvariables(names).each do |k,v| + # assignments << "#{k}=\{#{v}\}" + # end + # "\setvariables[exe][#{assignments.join(", ")}]" + # end + @@temprunfile = 'texexec' @@temptexfile = 'texexec.tex' @@ -524,6 +550,41 @@ class TEX return version end + def cleanupluafiles + File.delete(@@luafiles) rescue false + end + + def compileluafiles + begin + Dir.glob("lua/context/*.luc").each do |luc| + File.delete(luc) rescue false + end + rescue + end + if data = (IO.readlines(@@luafiles) rescue nil) then + report("compiling lua files (using #{File.expand_path(@@luafiles)})") + begin + Dir.makedirs(@@luatarget) rescue false + data.each do |line| + luafile = line.chomp + lucfile = File.basename(luafile).gsub(/\..*?$/,'') + ".luc" + if runcommand(["luac","-s","-o",quoted(File.join(Dir.getwd,@@luatarget,lucfile)),quoted(luafile)]) then + report("#{File.basename(luafile)} converted to #{File.basename(lucfile)}") + else + report("#{File.basename(luafile)} not converted to #{File.basename(lucfile)}") + end + end + rescue + report("fatal error in compilation") + end + else + report("no lua compilations needed") + end + File.delete(@@luafiles) rescue false + end + + # we need engine methods + def makeformats checktestversion @@ -561,9 +622,18 @@ class TEX makeuserfile makeresponsefile end - texformats.each do |texformat| - report("generating tex format #{texformat}") - runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag,prefixed(texformat,texengine),texmakeextras(texformat)]) + if texengine == 'luatex' then + cleanupluafiles + texformats.each do |texformat| + report("generating tex format #{texformat}") +run_luatools("--ini --compile #{texformat}") + end + compileluafiles + else + texformats.each do |texformat| + report("generating tex format #{texformat}") + runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag,prefixed(texformat,texengine),texmakeextras(texformat)]) + end end else report("unable to make format due to lack of permissions") @@ -592,8 +662,10 @@ class TEX mpsformatpath = '' end # check for problems + report("") report("tex engine path: #{texformatpath}") unless texformatpath.empty? report("mps engine path: #{mpsformatpath}") unless mpsformatpath.empty? + report("") [['fmt','tex'],['mem','mps']].each do |f| [[texformatpath,'global'],[mpsformatpath,'global'],[savedpath,'current']].each do |p| begin @@ -601,11 +673,20 @@ class TEX rescue else Dir.glob("*.#{f[0]}").each do |file| - report("#{f[1]}format: #{filestate(file)} > #{File.expand_path(file)}") + report("#{f[1]}: #{filestate(file)} > #{File.expand_path(file)} (#{File.size(file)})") end end end end + begin + lucdir = File.join(texformatpath,@@luatarget) + Dir.chdir(lucdir) + rescue + else + Dir.glob("*.luc").each do |file| + report("luc: #{filestate(file)} > #{File.expand_path(file)} (#{File.size(file)})") + end + end # to be sure, go back to current path begin Dir.chdir(savedpath) @@ -613,6 +694,7 @@ class TEX end # finalize cleanup + report("") reportruntime end @@ -853,10 +935,10 @@ class TEX rname = File.unsuffixed(resultname) if ! rname.empty? && (rname != fname) then report("outputfile #{rname}") - ['tuo','log','dvi','pdf'].each do |s| + ['tuo','tuc','log','dvi','pdf'].each do |s| File.silentrename(File.suffixed(fname,s),File.suffixed('texexec',s)) end - ['tuo'].each do |s| + ['tuo','tuc'].each do |s| File.silentrename(File.suffixed(rname,s),File.suffixed(fname,s)) if FileTest.file?(File.suffixed(rname,s)) end end @@ -867,12 +949,12 @@ class TEX rname = File.unsuffixed(resultname) if ! rname.empty? && (rname != fname) then report("renaming #{fname} to #{rname}") - ['tuo','log','dvi','pdf'].each do |s| + ['tuo','tuc','log','dvi','pdf'].each do |s| File.silentrename(File.suffixed(fname,s),File.suffixed(rname,s)) end report("restoring #{fname}") unless $fname == 'texexec' then - ['tuo','log','dvi','pdf'].each do |s| + ['tuo','tuc','log','dvi','pdf'].each do |s| File.silentrename(File.suffixed('texexec',s),File.suffixed(fname,s)) end end @@ -1034,6 +1116,20 @@ class TEX public + def run_luatools(args) + # dirty trick: we know that the lua path is relative to the ruby path; of course this + # will not work well when stubs are used + [(ENV["_CTX_K_S_texexec_"] or ENV["_CTX_K_S_THREAD_"] or ENV["TEXMFSTART.THREAD"]), File.dirname($0)].each do |path| + if path then + script = "#{path}/../lua/luatools.lua" + if FileTest.file?(script) then + return runcommand("lua #{script} #{args}") + end + end + end + return runcommand("texmfstart luatools #{args}") + end + def processmpgraphic getarrayvariable('files').each do |filename| setvariable('filename',filename) @@ -1126,6 +1222,38 @@ class TEX reportruntime end + def processmpstatic + if filename = getvariable('filename') then + filename += ".mp" unless filename =~ /\..+?$/ + if FileTest.file?(filename) then + begin + data = IO.read(filename) + File.open("texexec.tex",'w') do |f| + f << "\\setupoutput[pdftex]\n" + f << "\\setupcolors[state=start]\n" + data.sub!(/^%mpenvironment\:\s*(.*?)$/mois) do + f << $1 + "\n" + end + f << "\\starttext\n" + f << "\\startMPpage\n" + f << data.gsub(/end\.*\s*$/m, '') # a bit of a hack + f << "\\stopMPpage\n" + f << "\\stoptext\n" + end + report("converting static '#{filename}'") + runtex("texexec.tex") + pdffile = File.suffixed(filename,'pdf') + File.silentrename("texexec.pdf",pdffile) + report ("#{filename} converted to #{pdffile}") + rescue + report("error in converting #{filename} (#{$!}") + end + end + end + reportruntime + end + def processmpxtex getarrayvariable('files').each do |filename| setvariable('filename',filename) @@ -1372,7 +1500,11 @@ class TEX report("progname: #{progname}") if texengine && texformat && progname then fixbackendvars(@@mappaths[texengine]) +if texengine == "luatex" then + run_luatools("--fmt=#{texformat} #{filename}") +else runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag,runoptions(texengine),filename,texprocextras(texformat)]) +end # true else false @@ -1451,7 +1583,25 @@ class TEX end end - # 1=tex 2=mptex 3=mpxtex 4=mpgraphic + def runluacheck(jobname) + if false then + # test-pos.tex / 6 meg tua file: 18.6 runtime + old, new = File.suffixed(jobname,'tua'), File.suffixed(jobname,'tuc') + if FileTest.file?(old) then + report("converting #{old} into #{new}") + system("luac -s -o #{new} #{old}") + end + else + # test-pos.tex / 6 meg tua file: 17.5 runtime + old, new = File.suffixed(jobname,'tua'), File.suffixed(jobname,'tuc') + if FileTest.file?(old) then + report("renaming #{old} into #{new}") + File.rename(old,new) rescue false + end + end + end + + # 1=tex 2=mptex 3=mpxtex 4=mpgraphic 5=mpstatic def runtexexec(filename=[], options=[], mode=nil) begin @@ -1470,6 +1620,7 @@ class TEX when 2 then job.processmptex when 3 then job.processmpxtex when 4 then job.processmpgraphic + when 5 then job.processmpstatic end job.inspect && Kpse.inspect if getvariable('verbose') return true @@ -1658,6 +1809,7 @@ class TEX ok = runtex(if dummyfile || forcexml then rawbase else rawname end) if ok then ok = runtexutil(rawbase) if getvariable('texutil') || getvariable('forcetexutil') + runluacheck(rawbase) runbackend(rawbase) popresult(rawbase,result) end @@ -1667,10 +1819,11 @@ class TEX end end else +# goto tmp/jobname when present mprundone, ok, stoprunning = false, true, false texruns, nofruns = 0, getvariable('runs').to_i state = FileState.new - ['tub','tuo'].each do |s| + ['tub','tuo','tuc'].each do |s| state.register(File.suffixed(rawbase,s)) end if getvariable('automprun') then # check this @@ -1690,13 +1843,16 @@ class TEX makeoptionfile(rawbase,jobname,orisuffix,false,false,2,texruns) # unknown end end +# goto . ok = runtex(File.suffixed(if dummyfile || forcexml then rawbase else rawname end,jobsuffix)) +# goto tmp/jobname when present if ok && (nofruns > 1) then unless getvariable('nompmode') then mprundone = runtexmpjob(rawbase, "mpgraph") mprundone = runtexmpjob(rawbase, "mprun") end ok = runtexutil(rawbase) + runluacheck(rawbase) state.update stoprunning = state.stable? end @@ -1704,11 +1860,16 @@ class TEX if not ok then setvariable('error','error in tex file') end - ok = runtexutil(rawbase) if (nofruns == 1) && getvariable('texutil') + if (nofruns == 1) && getvariable('texutil') then + ok = runtexutil(rawbase) + runluacheck(rawbase) + end if ok && finalrun && (nofruns > 1) then makeoptionfile(rawbase,jobname,orisuffix,true,finalrun,4,texruns) unless getvariable('nooptionfile') report("final TeX run #{texruns}") +# goto . ok = runtex(File.suffixed(if dummyfile || forcexml then rawbase else rawname end,jobsuffix)) +# goto tmp/jobname when present end if getvariable('keep') then ['top','log','run'].each do |suffix| @@ -1721,8 +1882,11 @@ class TEX # File.silentdelete(File.suffixed(rawbase,s)) # end if ok then +# goto . runbackend(rawbase) popresult(rawbase,result) +# goto tmp/jobname when present +# skip next end if true then # autopurge begin @@ -1755,14 +1919,14 @@ class TEX end end rescue - report("fatal error #{$!}") + # report("fatal error #{$!}") end end end Kpse.runscript('ctxtools',rawbase,'--purge') if getvariable('purge') Kpse.runscript('ctxtools',rawbase,'--purge --all') if getvariable('purgeall') - +# till here when 'latex' then ok = runtex(rawname) @@ -1913,7 +2077,7 @@ class TEX def purge_mpx_files(mpname) unless getvariable('keep') then - ['tex', 'log', 'tui', 'tuo', 'top'].each do |suffix| + ['tex', 'log', 'tui', 'tuo', 'tuc', 'top'].each do |suffix| File.silentdelete(File.suffixed(mpname,'temp',suffix)) end end diff --git a/scripts/context/ruby/base/texutil.rb b/scripts/context/ruby/base/texutil.rb index 2bca83167..7c402b98f 100644 --- a/scripts/context/ruby/base/texutil.rb +++ b/scripts/context/ruby/base/texutil.rb @@ -235,7 +235,11 @@ class TeXUtil end def tokenize(str) - str.gsub(/\\strchr\{(.*?)\}/o) do "\\#{$1}" end + if str then + str.gsub(/\\strchr\{(.*?)\}/o) do "\\#{$1}" end + else + "" + end end def remap(str) @@ -461,7 +465,6 @@ class TeXUtil class Synonym @@debug = false - @@debug = true def initialize(t, c, k, d) @type, @command, @key, @sortkey, @data = t, c, k, k, d @@ -559,7 +562,6 @@ class TeXUtil @@specialbanner = "" # \\relax" @@debug = false - @@debug = true @@howto = /^(.*?)\:\:(.*)$/o @@split = ' && ' @@ -598,7 +600,8 @@ class TeXUtil # end end else - @entry, @key = cleanupsplit(@entry), cleanupsplit(@key) + # @entry, @key = cleanupsplit(@entry), cleanupsplit(@key) +@entry, @key = cleanupsplit(@entry), xcleanupsplit(@key) end @sortkey = sorter.simplify(@key) # special = @sortkey =~ /^([^a-zA-Z\\])/o @@ -613,7 +616,7 @@ class TeXUtil @entry, @texthowto.ljust(10,' '), # @state, # no, messes up things - (@realpage ||'').rjust(6,' ').gsub(/0/,' '), + (@realpage.to_s || '').rjust(6,' ').gsub(/0/,' '), # (@realpage ||'').rjust(6,' '), @pagehowto ].join(@@split) @@ -628,6 +631,23 @@ class TeXUtil end end +def xcleanupsplit(target) # +a+b+c &a&b&c a+b+c a&b&c + t = Array.new + case target[0,1] + when '&' then + t = target.sub(/^./o,'').split(/([^\\])\&/o) + when '+' then + t = target.sub(/^./o,'').split(/([^\\])\+/o) + else + # t = target.split(/([^\\])[\&\+]/o) + # t = target.split(/[\&\+]/o) + t = target.split(/(?!\\)[\&\+]/o) # lookahead + end + if not t[1] then t[1] = " " end # we need some entry else we get subentries first + if not t[2] then t[2] = " " end # we need some entry else we get subentries first + return t.join(@@split) +end + def <=> (other) @sortkey <=> other.sortkey end @@ -659,11 +679,13 @@ class TeXUtil alphaclass, alpha = '', '' @@savedhowto, @@savedfrom, @@savedto, @@savedentry = '', '', '', '' if @@debug then + # if true then list.each do |entry| handle << "% [#{entry.sortkey.gsub(/#{@@split}/o,'] [')}]\n" end end list.each do |entry| +# puts(entry.sortkey.gsub(/\s+/,"")) if entry.sortkey =~ /^(\S+)/o then if sorter.division?($1) then testalpha = sorter.getdivision($1) @@ -738,6 +760,7 @@ class TeXUtil elsif @@savedhowto != entry.pagehowto and ! entry.pagehowto.empty? then @@savedhowto = entry.pagehowto end + # beware, we keep multiple page entries per realpage because of possible prefix usage if copied || ! ((lastpage == entry.page) && (lastrealpage == entry.realpage)) then nextentry = "{#{entry.type}}{#{previous[0]}}{#{previous[1]}}{#{previous[2]}}{#{entry.pagehowto},#{entry.texthowto}}" savedline = "{#{entry.type}}{#{@@savedhowto},#{entry.texthowto}}{#{entry.location}}{#{entry.page}}{#{entry.realpage}}" @@ -791,7 +814,8 @@ class TeXUtil @@registers[data[1]].push(Register.new(3,data[1],data[2],data[3],data[4],nil,data[5],data[6])) when 's' then @@registers[data[1]] = Array.new unless @@registers.key?(data[1]) - @@registers[data[1]].push(Register.new(4,data[1],data[2],data[3],data[4],data[5],data[6],nil)) + # was this but wrong sort order (4,data[1],data[2],data[3],data[4],data[5],data[6],nil)) + @@registers[data[1]].push(Register.new(4,data[1],data[2],data[3],data[4],data[5],data[6],0)) when 'l' then @@languages[data[1]] = data[2] || '' end @@ -820,6 +844,7 @@ class TeXUtil @@registers[s].each_index do |i| @@registers[s][i].build(@@sorter[s]) end + # @@registers[s].uniq! @@registers[s] = @@registers[s].sort end end diff --git a/scripts/context/ruby/concheck.rb b/scripts/context/ruby/concheck.rb index bf09bbdc8..6c7512bff 100644 --- a/scripts/context/ruby/concheck.rb +++ b/scripts/context/ruby/concheck.rb @@ -223,6 +223,7 @@ def some_chr_error(data, filename, left, right) levels = Array.new for line in 0..data.length-1 do str = data[line] + # str = data[line].gsub(/\\[\#{left}\#{right}]/,'') column = 0 while column 0 then + someerror = false + ARGV.each do |filename| + somerror = true if check_file(filename) end + exit (if someerror then 1 else 0 end) else exit 1 end + diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 0cf96e10d..567c927a5 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -46,16 +46,13 @@ banner = ['CtxTools', 'version 1.3.3', '2004/2006', 'PRAGMA ADE/POD'] -# todo dirname - -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' require 'base/system' +require 'base/kpse' +require 'base/file' require 'rexml/document' require 'net/http' @@ -86,6 +83,10 @@ class String end end + def nosuffix(suffix) + self.sub(/\.#{suffix}/,'') # no /o + end + end class Commands @@ -108,7 +109,7 @@ class Commands maincontextfile = 'context.tex' unless FileTest.file?(maincontextfile) then begin - maincontextfile = `kpsewhich -progname=context #{maincontextfile}`.chomp + maincontextfile = Kpse.found(maincontextfile,'context') rescue maincontextfile = '' end @@ -417,6 +418,8 @@ class Commands public + # faster is to glob the whole dir and regexp over that list + def purgefiles pattern = @commandline.arguments @@ -444,13 +447,16 @@ class Commands files = Dir.glob(globbed) report("purging#{if purgeall then ' all' end} temporary files : #{globbed}") else + report("purging#{if purgeall then ' all' end} temporary files : #{pattern.join(' ')}") pattern.each do |pat| - globbed = if recurse then "**/#{pat}-*.*" else "#{pat}-*.*" end + nosuf = File.unsuffixed(pat) + globbed = if recurse then "**/#{nosuf}-*.*" else "#{nosuf}-*.*" end + report("checking files that match '#{globbed}'") files = Dir.glob(globbed) - globbed = if recurse then "**/#{pat}.*" else "#{pat}.*" end + globbed = if recurse then "**/#{nosuf}.*" else "#{nosuf}.*" end + report("checking files that match '#{globbed}'") files.push(Dir.glob(globbed)) end - report("purging#{if purgeall then ' all' end} temporary files : #{pattern.join(' ')}") end files.flatten! files.sort! @@ -522,6 +528,7 @@ class Commands $dontaskprefixes = [ # "tex-form.tex", "tex-edit.tex", "tex-temp.tex", "texexec.tex", "texexec.tui", "texexec.tuo", + "texexec.tuc", "texexec.tua", "texexec.ps", "texexec.pdf", "texexec.dvi", "cont-opt.tex", "cont-opt.bak" ] @@ -531,7 +538,7 @@ class Commands "xlscript\\.xsl" ] $forsuresuffixes = [ - "tui", "tup", "ted", "tes", "top", + "tui", "tua", "tup", "ted", "tes", "top", "log", "tmp", "run", "bck", "rlg", "mpt", "mpx", "mpd", "mpo", "mpb", "ctl", @@ -541,7 +548,7 @@ class Commands "dvi", "ps", "pdf" ] $texnonesuffixes = [ - "tuo", "tub", "top" + "tuo", "tub", "top", "tuc" ] $dummyfiles = [ "mpgraph" @@ -639,7 +646,7 @@ class Commands nofdocuments, nofdefinitions, nofskips = 0, 0, 0 skiplevel, indocument, indefinition, skippingbang = 0, false, false, false if processtype.empty? then - filetype = filesuffix.downcase + filetype = filesuffix.downcase.sub(/^mk.+$/,'tex') # make sure that mkii and mkiv files are handled else filetype = processtype.downcase end @@ -1049,7 +1056,7 @@ class Language commentfile = rmename.dup begin - desfile = `kpsewhich -progname=context #{desname}`.chomp + desfile = Kpse.found(desname,'context') if f = File.new(desfile) then if doc = REXML::Document.new(f) then if e = REXML::XPath.first(doc.root,"/descriptions/description[@language='#{@language}']") then @@ -1188,7 +1195,7 @@ class Language def located(filename) begin - fname = `kpsewhich -progname=context #{filename}`.chomp + fname = Kpse.found(filename, 'context') if FileTest.file?(fname) then report("using file #{fname}") return fname @@ -1519,7 +1526,7 @@ class Language if ! encoding.empty? then begin - filename = `kpsewhich -progname=context #{filename}` + filename = Kpse.found(filename, 'context') if data = IO.readlines(filename.chomp) then report("preloading #{encoding} character mappings") accept = false @@ -1865,8 +1872,7 @@ class Commands entities = Hash.new filenames.each do |filename| - # filename = `texmfstart tmftools.rb --progname=context #{filename}`.chomp - filename = `kpsewhich --progname=context #{filename}`.chomp + filename = Kpse.found(filename, 'context') if filename and not filename.empty? and FileTest.file?(filename) then report("loading #{filename.gsub(/\\/,'/')}") unless outputname.empty? IO.readlines(filename).each do |line| @@ -1874,7 +1880,7 @@ class Commands when /^[\#\%]/io then # skip comment line when /\\definecharacter\s+([a-z]+)\s+\{\\uchar\{*(\d+)\}*\{(\d+)\}\}/io then - name, code = $1, ($2.to_i*256 + $3.to_i).to_s + name, code = $1, sprintf("%04X",$2.to_i*256 + $3.to_i) entities[name] = code.rjust(4,'0') unless entities.key?(name) when /^([A-F0-9]+)\;([a-z][a-z]+)\;(.*?)\;(.*?)\s*$/io then code, name, adobe, comment = $1, $2, $3, $4 @@ -2076,187 +2082,424 @@ class TexDeps noInputMode noOutputMode noDefaultInputMode noDefaultOutputMode /.split - @@cs_plain = %q/ - TeX - bgroup egroup endgraf space empty null - newcount newdimen newskip newmuskip newbox newtoks newhelp newread newwrite newfam newlanguage newinsert newif - maxdimen magstephalf magstep - frenchspacing nonfrenchspacing normalbaselines obeylines obeyspaces raggedright ttraggedright - thinspace negthinspace enspace enskip quad qquad - smallskip medskip bigskip removelastskip topglue vglue hglue - break nobreak allowbreak filbreak goodbreak smallbreak medbreak bigbreak - line leftline rightline centerline rlap llap underbar strutbox strut - cases matrix pmatrix bordermatrix eqalign displaylines eqalignno leqalignno - pageno folio tracingall showhyphens fmtname fmtversion - hphantom vphantom phantom smash + @@cs_metatex = %q/ /.split - @@cs_eplain = %q/ - eTeX - newmarks grouptype interactionmode nodetype iftype - tracingall loggingall tracingnone + @@cs_xetex = %q/ + /.split + + @@cs_skip = %q/ + v\! c\! s\! e\! m\! f\! + \!tf \!tt \!tq \!ta \?\? + csname endcsname relax + \!\!string[a-f] \!\!dimen[a-k] \!\!count[a-f] \!\!toks[a-e] \!\!box[a-e] + \!\!width[a-c] \!\!height[a-c] \!\!depth[a-c] + \!\!done[a-f] if\!\!done[a-f] if\:\!\!done[a-f] + scratch globalscratch + ascii[a-d] globalascii + @@expanded @@globalexpanded @EA @EAEA @EAEAEA + bgroup egroup par next nextnext docommand dodocommand dododocommand + \!\!width \!\!height \!\!depth \!\!plus \!\!minus \!\!to + /.split + + @@cs_skip = %q/ + [vcsemf]\! \?\? + \!t[ftqa] + csname endcsname relax + \!\!string[a-f] \!\!dimen[a-k] \!\!count[a-f] \!\!toks[a-e] \!\!box[a-e] + \!\!width[a-c] \!\!height[a-c] \!\!depth[a-c] + \!\!done[a-f] if\!\!done[a-f] if\:\!\!done[a-f] + scratch globalscratch + ascii[a-d] globalascii + @@expanded @@globalexpanded @(EA)+ + [be]group par next nextnext (do)+command + \!\!(width|height|depth|plus|minus|to) /.split # let's ignore \dimendef etc - @@primitives_def = "def|edef|xdef|gdef|let|newcount|newdimen|newskip|newbox|newtoks|newmarks|chardef|mathchardef|newconditional" + @@primitives_def = %q/ + def edef xdef gdef let + newcount newdimen newskip newbox newtoks newmarks newif newinsert newmuskip + chardef mathchardef dimendef countdef toksdef + newconditional definecomplexorsimple definecomplexorsimpleempty + newcounter newpersistentmark + installinsertion installspecial\s*\\[* installoutput\s*\\[* + /.split - @@cs_global = [@@cs_tex,@@cs_etex,@@cs_pdftex,@@cs_omega].sort.flatten - @@types = [['invalid','*'],['okay','='],['forward','>'],['backward','<'],['unknown','?']] + @@types = [['invalid','*'],['okay','='],['forward','>'],['backward','<'],['unknown','?']] + + @@skips = /^(#{@@cs_skip.join('|')})/o + + def initialize(logger=nil,compact=false) + @defined = Hash.new + @definitive = Hash.new + @used_before = Hash.new + @used_after = Hash.new + @dependencies = Hash.new + @fineorder = Hash.new + @forward = Hash.new + @backward = Hash.new + @disorder = Hash.new + @disordercs = Hash.new + @type = Hash.new + @filename = 'context.tex' + @files = Array.new # keep load order ! + @order = Hash.new + @logger = logger + @filefilter = nil + @namefilter = nil + @compact = compact + # + @@cs_tex.each do |cs| @defined[cs] = ['-tex--------'] end + @@cs_etex.each do |cs| @defined[cs] = ['-etex-------'] end + @@cs_pdftex.each do |cs| @defined[cs] = ['-pdftex-----'] end + @@cs_omega.each do |cs| @defined[cs] = ['-omega------'] end + @@cs_xetex.each do |cs| @defined[cs] = ['-xetex------'] end + @@cs_metatex.each do |cs| @defined[cs] = ['-metatex----'] end + end - def initialize(logger=nil) - @cs_local = Hash.new - @cs_new = Hash.new - @cs_defd = Hash.new - @cs_used = Hash.new - @filename = 'context.tex' - @files = Array.new # keep load order ! - @compact = false - @logger = logger + def report(str) + @logger.report(str) rescue false end - def load(filename='context.tex',omitlist=['mult-com.tex']) + def setfilter(data) + data.split(/\s*\,\s*/).each do |d| + if d =~ /\.tex$/ then + @filefilter = Array.new unless @filefilter + @filefilter << d + else + @namefilter = Array.new unless @namefilter + @namefilter << d + end + end + end + + def load(filename='context.tex') begin @filename = filename + n = 0 File.open(filename) do |f| f.each do |line| - if line =~ /^\\input\s+(\S+)\s*/o then - @files.push($1) unless omitlist.include?(File.basename($1)) + if line =~ /^(\\input\s+|\\load[a-z]+\{)([a-z\-\.]+)(\}*)/ then + ante, name, post = $1, $2, $3 + @files.push(name) + @order[name] = n += 1 end end end rescue @files = Array.new + @order = Hash.new + end + end + + def save(filename='context.tex') + unless @filefilter || @namefilter then + begin + data = IO.readlines(filename).each do |line| + line.gsub!(/^(\\input\s+|\\load[a-z]+\{)([a-z\-\.]+)(\}*)\s*$/) do + ante, name, post = $1, $2, $3 + fin = (@fineorder[name] || [])-[name] + dep = (@dependencies[name] || [])-[name] + dis = (@disorder[name] || [])-[name] + fin = if fin.size > 0 then " B[#{fin.join(' ')}]" else "" end + dep = if dep.size > 0 then " A[#{dep.join(' ')}]" else "" end + dis = if dis.size > 0 then " D[#{dis.join(' ')}]" else "" end + "#{ante}#{name}#{post} %#{fin}#{dep}#{dis}\n" + end + end + rescue + report("error: #{$!}") + else + begin + newname = filename.sub(/\..*$/,'.log') + report("") + report("writing to #{newname}") + report("") + File.open(newname,'w') do |f| + f << data + end + rescue + report("error: #{$!}") + end + end end end def analyze + report('') + report("loading files") + report('') + n = 0 @files.each do |filename| if f = File.open(filename) then - @logger.report("loading #{filename}") if @logger - defs, uses, n = 0, 0, 0 + defs, uses, l = 0, 0, 0 + n += 1 + report("#{n.to_s.rjust(5,' ')} #{filename}") f.each do |line| - n += 1 + l += 1 + line.chomp! + + + line.sub!(/\%.*$/, '') + line.gsub!(/\\(unexpanded|unprotected|global|protected|long)\s*(\\)/, "\\") + # the superseded, overloaded, forwarded, and predefined macros + # are at the outer level anyway, so there we may ignore leading + # spaces (could be inside an \if); other definitions are only + # accepted when they start at the beginning of a line case line - when /^%/ - # skip - when /\\newif\s*\\if([a-zA-Z@\?\!]+)/ then - pushdef(filename,n,"if:#{$1}") - when /\\([a-zA-Z@\?\!]+)(true|false)/ then - pushuse(filename,n,"if:#{$1}") - when /^\s*\\(#{@primitives_def})\\([a-zA-Z@\?\!]{3,})/o - pushdef(filename,n,$2) - when /\\([a-zA-Z@\?\!]{3,})/o - pushuse(filename,n,$1) + when /^\\ifx\s*\\[a-zA-Z\@\!\?]+\s*\\undefined\s*(\\else)*(.*?)$/ then + if $2 =~ /^\s*\\(#{@@primitives_def.join('|')})\s*\\([a-zA-Z\@\?\!]{3,})/o then + pushdef(filename,l,$2,5) # kind of auto-predefined + end + when /^\s*\\superseded\s*\\(#{@@primitives_def.join('|')})\s*\\([a-zA-Z\@\?\!]{3,})(.*)$/o + name, rest = $2, $3 + pushdef(filename,l,name,1) + moreuse(filename,l,rest) + when /^\s*\\overloaded\s*\\(#{@@primitives_def.join('|')})\s*\\([a-zA-Z\@\?\!]{3,})(.*)$/o + name, rest = $2, $3 + pushdef(filename,l,name,2) + moreuse(filename,l,rest) + when /^\s*\\forwarded\s*\\(#{@@primitives_def.join('|')})\s*\\([a-zA-Z\@\?\!]{3,})(.*)$/o + name, rest = $2, $3 + pushdef(filename,l,name,3) + moreuse(filename,l,rest) + when /^\s*\\predefined\s*\\(#{@@primitives_def.join('|')})\s*\\([a-zA-Z\@\?\!]{3,})(.*)$/o + name, rest = $2, $3 + pushdef(filename,l,name,4) + moreuse(filename,l,rest) + when /^\\(#{@@primitives_def.join('|')})[\=\s]*\\([a-zA-Z\@\?\!]{3,})(.*)$/o + name, rest = $2, $3 # \=* catches the \let \a = \b + pushdef(filename,l,name,0) + moreuse(filename,l,rest) + when /\\newevery\s*\\([a-zA-Z\@\?\!]+)\s*\\([a-zA-Z\@\?\!]+)/ then + a, b = $1, $2 + pushdef(filename,l,a,0) + pushdef(filename,l,b,0) + else + moreuse(filename,l,line) end end f.close end end + @used_after.each do |cs,files| + (@defined[cs] || []).each do |name| + @dependencies[name] = Array.new unless @dependencies[name] + files.each do |file| + @dependencies[name] << file unless @dependencies[name].include?(file) + end + end + end + @used_before.each do |cs,files| + (@defined[cs] || []).each do |name| + @disorder[name] = Array.new unless @disorder[name] + @disordercs[name] = Array.new unless @disordercs[name] + @fineorder[name] = Array.new unless @fineorder[name] + files.each do |file| + unless @disorder[name].include?(file) || name == file then + unless @defined[cs].include?(file) then + if @order[name] > @order[file] then + @disorder[name] << file + @disordercs[name] << "#{file}:#{cs}" + end + end + end + @fineorder[name] << file unless @fineorder[name].include?(file) || name == file + end + end + end end - def feedback(compact=false) + def moreuse(filename,l,line) + line.scan(/\\if([a-zA-Z@\?\!]{3,})/) do |name, rest| # rest, else array + pushuse(filename,l,"if#{name}") unless name =~ /^(true|false)$/ + end + line.scan(/\\([a-zA-Z@\?\!]{3,})/) do |name, rest| # rest, else array + if name =~ /(true|false)$/ then + pushuse(filename,l,"if#{name}") unless name =~ /^(if|set)$/ + else + pushuse(filename,l,name) + end + end + end + + def feedback begin - outputfile = File.basename(@filename).sub(/\.tex$/,'')+'.dep' - File.open(outputfile,'w') do |f| - @compact = compact - @logger.report("saving analysis in #{outputfile}") if @logger - list, len = @cs_local.keys.sort, 0 - if @compact then - list.each do |cs| - if cs.length > len then len = cs.length end + # get max length + l = 0 + list = @defined.keys.sort + list.each do |cs| + l = cs.length if cs.length > l + end + if ! @compact then + n = 0 + report('') + report("defined: #{@defined.size}") + report('') + @defined.keys.sort.each do |cs| + next if @namefilter && ! @namefilter.include?(cs) + next if @filefilter && ! @defined[cs].include?(cs) + if @defined[cs].size > 1 then + dlist = @defined[cs].collect do |d| + if d == @definitive[cs] then d else "[#{d}]" end + end + else + dlist = @defined[cs] end - len += 1 - else - f.puts "\n" - f.puts "\n" + report("#{(n += 1).to_s.rjust(5,' ')} #{cs.ljust(l,' ')} == #{dlist.join(' ')}") end - list.each do |cs| - if @cs_new.key?(cs) then - if @cs_new[cs] == @cs_local[cs] then - f.puts some_struc(cs,len,1,some_str(@cs_new,@cs_defd,cs)) - elsif @cs_new[cs].first == @cs_local[cs].first then - f.puts some_struc(cs,len,2,some_str(@cs_new,@cs_defd,cs),some_str(@cs_local,@cs_used,cs)) - else - f.puts some_struc(cs,len,3,some_str(@cs_new,@cs_defd,cs),some_str(@cs_local,@cs_used,cs)) - end + end + if true then + n = 0 + report('') + report("used before defined: #{@used_before.size}") + report('') + @used_before.keys.sort.each do |cs| + next if @namefilter && ! @namefilter.include?(cs) + next if @filefilter && (@used_before[cs] & @filefilter).size == 0 + used = @used_before[cs] - (@defined[cs] || []) + defined = (@defined[cs] || []).join(' ') + defined = "[ ? ]" if defined.empty? + if used.size > 0 then + report("#{(n += 1).to_s.rjust(5,' ')} #{cs.ljust(l,' ')} == #{defined} -> #{used.join(' ')}") else - f.puts some_struc(cs,len,4,some_str(@cs_local,@cs_used,cs)) + report("#{(n += 1).to_s.rjust(5,' ')} #{cs.ljust(l,' ')} == #{defined}") end end - if @compact then - # nothing - else - "\n" unless @compact + report(' none') if n == 0 + end + if ! @compact then + n = 0 + report('') + report("used after defined: #{@used_after.size}") + report('') + @used_after.keys.sort.each do |cs| + next if @namefilter && ! @namefilter.include?(cs) + next if @filefilter && (@used_after[cs] & @filefilter).size == 0 + used = @used_after[cs] - (@defined[cs] || []) + defined = (@defined[cs] || []).join(' ') + if used.size > 0 then + report("#{(n += 1).to_s.rjust(5,' ')} #{cs.ljust(l,' ')} == #{defined} <- #{used.join(' ')}") + else + report("#{(n += 1).to_s.rjust(5,' ')} #{cs.ljust(l,' ')} == #{defined}") + end + end + report(' none') if n == 0 + end + if ! @compact then + unless @filefilter || @namefilter then + [false,true].each do |mode| + n = 0 + report("") + report("file dependecies #{if mode then '(critical)' end}") + [@dependencies].each do |dependencies| + report("") + dependencies.keys.sort.each do |f| + if dependencies[f].size > 0 then + dependencies[f].delete(f) + end + if mode then + dep = dependencies[f].delete_if do |d| + f[0..3] == d[0..3] # same xxxx- prefix + end + else + dep = dependencies[f] + end + if dep.size > 0 then + name = f.nosuffix('tex').ljust(8,' ') + list = dep.sort.collect do |k| k.nosuffix('tex') end + report("#{(n += 1).to_s.rjust(5,' ')} #{name} !! #{list.join(' ')}") + end + end + end + report(' none') if n == 0 + end + end + end + if true then + unless @filefilter || @namefilter then + [false,true].each do |mode| + [@disorder,@disordercs].each do |disorder| + n = 0 + report("") + report("file disorder #{if mode then '(critical)' end}") + report("") + disorder.keys.sort.each do |f| + if disorder[f].size > 0 then + disorder[f].delete(f) + end + if mode then + dis = disorder[f].delete_if do |d| + f[0..3] == d[0..3] # same xxxx- prefix + end + else + dis = disorder[f] + end + if dis.size > 0 then + name = f.nosuffix('tex').ljust(8,' ') + list = dis.sort.collect do |k| k.nosuffix('tex') end + report("#{(n += 1).to_s.rjust(3,' ')} #{name} ?? #{list.join(' ')}") + end + end + end + report(' none') if n == 0 + end end end rescue + puts("fatal error: #{$!} #{$@.join("\n")}") end end private - def some_struc(cs,len,type=1,defstr='',usestr='') - if @compact then - "#{cs.ljust(len)} #{@@types[type][1]} #{defstr} #{usestr}" - else - "\n" + - if defstr.empty? then " \n" else " \n#{defstr} <\defined>\n" end + - if usestr.empty? then " \n" else " #{usestr}\n <\used>\n" end + - "\n" - end + def csdefined?(cs,filename) + @defined[cs] && @defined[cs].include?(filename) + end + def csbefore?(cs,filename) + @used_before[cs] && @used_before[cs].include?(filename) + end + def csafter?(cs,filename) + @used_after[cs] && @used_after[cs].include?(filename) end - def some_str(files, lines, cs) - return '' unless files[cs] - if @compact then - str = '[ ' - files[cs].each do |c| - str += c - str += " (#{lines[cs][c].join(' ')}) " if lines[cs][c] - str += ' ' - end - str += ']' - str.gsub(/ +/, ' ') - else - str = '' - files[cs].each do |c| - if lines[cs][c] then - str += " \n" - str += " " - lines[cs][c].each do |l| - # str += " \n" - str += "" - end - str += "\n" - str += " \n" - else - str += " \n" - end - end - str - end + def csignored?(cs) + cs.to_s =~ @@skips end - def pushdef(filename,n,cs) - unless @cs_new.key?(cs) then - @cs_new[cs] = Array.new - @cs_defd[cs] = Hash.new unless @cs_defd.key?(cs) + def pushdef(filename,n,cs,type) + if csignored?(cs) then + # nothing + elsif @defined[cs] then + case type + when 5 then + # if test, no definition done + else + @definitive[cs] = filename + unless @filefilter || @namefilter then + report("#{cs} is redefined") unless csdefined?(cs,filename) || @compact + end + end + @defined[cs] << filename unless @defined[cs].include?(filename) + else + @defined[cs] = Array.new + @defined[cs] << filename + @definitive[cs] = filename + @type[cs] = type end - @cs_defd[cs][filename] = Array.new unless @cs_defd[cs][filename] - @cs_new[cs].push(filename) unless @cs_new[cs].include?(filename) - @cs_defd[cs][filename] << n end def pushuse(filename,n,cs) - unless @@cs_global.include?(cs.to_s) then - unless @cs_local[cs] then - @cs_local[cs] = Array.new - @cs_used[cs] = Hash.new unless @cs_used.key?(cs) - end - @cs_used[cs][filename] = Array.new unless @cs_used[cs][filename] - @cs_local[cs].push(filename) unless @cs_local[cs].include?(filename) - @cs_used[cs][filename] << n + if csignored?(cs) then + # nothing + elsif @defined[cs] then + @used_after[cs] = Array.new unless @used_after[cs] + @used_after[cs] << filename unless csafter?(cs,filename) + else + @used_before[cs] = Array.new unless @used_before[cs] + @used_before[cs] << filename unless csbefore?(cs,filename) end end @@ -2271,9 +2514,9 @@ class Commands filename = if @commandline.arguments.empty? then 'context.tex' else @commandline.arguments.first end compact = @commandline.option('compact') - ['progname=context',''].each do |progname| + ['context',''].each do |progname| unless FileTest.file?(filename) then - name = `kpsewhich #{progname} #{filename}`.chomp + name = Kpse.found(filename, progname) if FileTest.file?(name) then filename = name break @@ -2281,10 +2524,12 @@ class Commands end end - if FileTest.file?(filename) && deps = TexDeps.new(logger) then + if FileTest.file?(filename) && deps = TexDeps.new(logger,compact) then + deps.setfilter(@commandline.option('filter')) deps.load deps.analyze - deps.feedback(compact) + deps.feedback + deps.save if @commandline.option('save') else report("unknown file #{filename}") end @@ -2365,9 +2610,9 @@ class Commands end def locatedlocaltree - tree = `kpsewhich --expand-path $TEXMFLOCAL`.chomp rescue nil + tree = Kpse.used_path('TEXMFLOCAL') unless tree && FileTest.directory?(tree) then - tree = `kpsewhich --expand-path $TEXMF`.chomp rescue nil + tree = Kpse.used_path('TEXMF') end return tree end @@ -2377,7 +2622,8 @@ class Commands report("fatal error, '#{archive}' has not been downloaded") return false end - unless system("unzip -uo #{archive}") then + # unless system("unzip -uo #{archive}") then + unless system("unzip -o #{archive}") then report("fatal error, make sure that you have 'unzip' in your path") return false end @@ -2441,15 +2687,18 @@ commandline.registeraction('dpxmapfiles' , 'convert pdftex mapfiles to dvi commandline.registeraction('listentities' , 'create doctype entity definition from enco-uc.tex') commandline.registeraction('brandfiles' , 'add context copyright notice [--force]') commandline.registeraction('platformize' , 'replace line-endings [--recurse --force] [pattern]') -commandline.registeraction('dependencies' , 'analyze depedencies witin context [--compact] [rootfile]') +commandline.registeraction('dependencies' , 'analyze depedencies within context [--save --compact --filter=[macros|filenames]] [filename]') commandline.registeraction('updatecontext' , 'download latest version and remake formats') commandline.registeraction('disarmutfbom' , 'remove utf bom [--force]') commandline.registervalue('type','') +commandline.registervalue('filter','') commandline.registerflag('recurse') commandline.registerflag('force') +commandline.registerflag('compact') commandline.registerflag('pipe') +commandline.registerflag('save') commandline.registerflag('all') commandline.registerflag('xml') commandline.registerflag('log') diff --git a/scripts/context/ruby/pdftools.rb b/scripts/context/ruby/pdftools.rb index 8a62a0487..d40e2d852 100644 --- a/scripts/context/ruby/pdftools.rb +++ b/scripts/context/ruby/pdftools.rb @@ -15,10 +15,7 @@ banner = ['PDFTools', 'version 1.2.1', '2003/2005', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/pstopdf.rb b/scripts/context/ruby/pstopdf.rb index 197f83961..a677cb617 100644 --- a/scripts/context/ruby/pstopdf.rb +++ b/scripts/context/ruby/pstopdf.rb @@ -12,7 +12,7 @@ banner = ['PsToPdf', 'version 2.0.1', '2002-2006', 'PRAGMA ADE/POD'] -$: << File.expand_path(File.dirname($0)) +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! # todo: paden/prefix in magick and inkscape # todo: clean up method handling (pass strings, no numbers) diff --git a/scripts/context/ruby/rlxtools.rb b/scripts/context/ruby/rlxtools.rb index 1225dedb3..40a45bd51 100644 --- a/scripts/context/ruby/rlxtools.rb +++ b/scripts/context/ruby/rlxtools.rb @@ -12,10 +12,7 @@ banner = ['RlxTools', 'version 1.0.1', '2004/2005', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' @@ -98,6 +95,9 @@ class Commands if conversion = variables['conversion'] then report("testing for conversion #{conversion}") if suffix = variables['suffix'].downcase then + if ! suffix.empty? && variables['file'] && variables['file'] !~ /\.([a-z]+)$/i then + variables['file'] += ".#{suffix}" + end if file = variables['file'] then report("conversion #{conversion} for suffix #{suffix} for file #{file}") else @@ -251,17 +251,43 @@ class Commands include CommandBase - def identify - @commandline.arguments.each do |filename| - if state = do_identify(filename) then - begin - File.open(filename+'.rli','w') do |f| - f << state + @@xmlbanner = "" + + def identify(resultfile='rlxtools.rli') + if @commandline.option('collect') then + begin + File.open(resultfile,'w') do |f| + f << "#{@@xmlbanner}\n" + f << "\n" + @commandline.arguments.each do |filename| + if state = do_identify(filename) then + report("#{filename} is identified") + f << state + else + report("unable to identify #{filename}") + end + end + f << "\n" + report("result saved in #{resultfile}") + end + rescue + report("error in writing result") + end + else + @commandline.arguments.each do |filename| + if state = do_identify(filename) then + begin + File.open(filename+'.rli','w') do |f| + f << "#{@@xmlbanner}\n" + f << state + end + rescue + report("error in identifying #{filename}") + else + report("#{filename} is identified") end - rescue - report("error in identifying #{filename}") else - report("#{filename} is identified") + report("unable to identify #{filename}") end end end @@ -269,11 +295,15 @@ class Commands private - def do_identify(filename) + def do_identify(filename,centimeters=false) begin str = nil if FileTest.file?(filename) then - result = `identify -format \"x=%x,y=%y,w=%w,h=%h,b=%b\" #{filename}`.chomp.split(',') + if centimeters then + result = `identify -units PixelsPerCentimeter -format \"x=%x,y=%y,w=%w,h=%h,b=%b\" #{filename}`.chomp.split(',') + else + result = `identify -units PixelsPerInch -format \"x=%x,y=%y,w=%w,h=%h,b=%b\" #{filename}`.chomp.split(',') + end tags = Hash.new result.each do |r| if rr = r.split("=") then @@ -285,7 +315,6 @@ class Commands height = unified(tags['h']||0,tags['y']||'1') if size > 0 then str = '' - str << "\n" str << "\n" str << " #{size}\n" str << " #{File.dirname(filename).sub(/\\/o,'/')}\n" @@ -322,13 +351,14 @@ end logger = Logger.new(banner.shift) commandline = CommandLine.new -commandline.registeraction('manipulate', ' [--test] manipulatorfile resourselog') -commandline.registeraction('identify', 'filename') +commandline.registeraction('manipulate', '[--test] manipulatorfile resourselog') +commandline.registeraction('identify' , '[--collect] filename') commandline.registeraction('help') commandline.registeraction('version') commandline.registerflag('test') +commandline.registerflag('collect') commandline.expand diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb index 1a7175f23..f1c8059c9 100644 --- a/scripts/context/ruby/texexec.rb +++ b/scripts/context/ruby/texexec.rb @@ -1,9 +1,6 @@ banner = ['TeXExec', 'version 6.2.0', '1997-2006', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'ftools' # needed ? @@ -97,6 +94,16 @@ class Commands end end + def mpstatic + if job = TEX.new(logger) then + job.setvariable('filename',@commandline.arguments.first) + prepare(job) + job.processmpstatic + job.inspect && Kpse.inspect if @commandline.option('verbose') + exit 1 if job.error? + end + end + # hard coded goodies # to be redone as s-ctx-.. with vars passed as such def listing @@ -143,21 +150,21 @@ class Commands end def figures - # this one will be redone using rlxtools + # we replaced "texutil --figures ..." if job = TEX.new(logger) then prepare(job) job.cleanuptemprunfiles files = @commandline.arguments.sort if files.length > 0 then if f = File.open(job.tempfilename('tex'),'w') then - # will be replaced, does not work any more - Kpse.runscript('texutil.pl',files.join(' '),'--figures') + Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) figures = @commandline.checkedoption('method', 'a').downcase paperoffset = @commandline.checkedoption('paperoffset', '0pt') backspace = @commandline.checkedoption('backspace', '1.5cm') topspace = @commandline.checkedoption('topspace', '1.5cm') boxtype = @commandline.checkedoption('boxtype','') f << "% format=english\n"; + f << "\\usemodule[res-20]\n" f << "\\setuplayout\n"; f << " [topspace=#{topspace},backspace=#{backspace},\n" f << " header=1.5cm,footer=0pt,\n"; @@ -175,10 +182,9 @@ class Commands f.close job.setvariable('interface','english') job.setvariable('simplerun',true) - # job.setvariable('nooptionfile',true) job.setvariable('files',[job.tempfilename]) job.processtex - File.silentdelete('texutil.tuf') + # File.silentdelete('rlxtools.rli') unless job.getvariable('keep') else report('no figures to show') end @@ -194,7 +200,7 @@ class Commands prepare(job) job.cleanuptemprunfiles files = @commandline.arguments.sort - msuffixes = ['tex','mp','pl','pm','rb'] + msuffixes = ['tex','mkii','mkiv','mp','pl','pm','rb'] if files.length > 0 then files.each do |fname| fnames = Array.new @@ -208,6 +214,11 @@ class Commands fnames.each do |ffname| if msuffixes.include?(File.splitname(ffname)[1]) && FileTest.file?(ffname) then if mod = File.open(job.tempfilename('tex'),'w') then +if File.suffix(ffname) =~ /^(mkii|mkiv)$/o then + markfile = $1 +else + markfile = nil +end Kpse.runscript('ctxtools',ffname,'--document') if ted = File.silentopen(File.suffixed(ffname,'ted')) then firstline = ted.gets @@ -220,7 +231,7 @@ class Commands else mod << "% interface=en\n" end - mod << "\\usemodule[abr-01,mod-01]\n" + mod << "\\usemodule[mod-01]\n" mod << "\\def\\ModuleNumber{1}\n" mod << "\\starttext\n" # todo: global file too @@ -231,10 +242,15 @@ class Commands job.setvariable('simplerun',true) # job.setvariable('nooptionfile',true) job.setvariable('files',[job.tempfilename]) +result = File.unsuffixed(File.basename(ffname)) +if markfile then + result = result+'-'+markfile +end +job.setvariable('result',result) job.processtex - ["dvi", "pdf","tuo"].each do |s| - File.silentrename(job.tempfilename(s),File.suffixed(ffname,s)); - end + # ["dvi", "pdf","ps"].each do |s| + # File.silentrename(job.tempfilename(s),File.suffixed(ffname,s)); + # end end end end @@ -246,6 +262,39 @@ class Commands end end + def pdfsplit + if job = TEX.new(logger) then + prepare(job) + job.cleanuptemprunfiles + filename = File.expand_path(@commandline.arguments.first) + if FileTest.file?(filename) then + basename = filename.sub(/\..*?$/,'') + tempfile = File.suffixed(job.tempfilename,'tex') + if basename != filename then + info = `pdfinfo #{filename}` + if info =~ /Pages:\s*(\d+)/ then + nofpages = $1.to_i + nofpages.times do |i| + if f = File.open(tempfile,"w") then + n = i + 1 + report("extracting page #{n}") + f << "\\starttext\\startTEXpage\n" + f << "\\externalfigure[#{filename}][object=no,page=#{n}]\n" + f << "\\stopTEXpage\\stoptext\n" + f.close + job.setvariable('interface','english') # redundant + job.setvariable('simplerun',true) + job.setvariable('files',[tempfile]) + job.processtex + end + end + end + end + end + job.cleanuptemprunfiles + end + end + def arrangeoutput if job = TEX.new(logger) then prepare(job) @@ -391,8 +440,8 @@ class Commands f << "]\n" f << "\\definepapersize\n" f << " [copy]\n" - f << " [width=\\naturalfigurewidth,\n" - f << " height=\\naturalfigureheight]\n" + f << " [width=\\figurewidth,\n" + f << " height=\\figureheight]\n" f << "\\setuppapersize\n" f << " [copy][copy]\n" f << "\\setuplayout\n" @@ -578,6 +627,7 @@ commandline.registeraction('process', 'process file') commandline.registeraction('mptex', 'process mp file') commandline.registeraction('mpxtex', 'process mpx file') commandline.registeraction('mpgraphic', 'process mp file to stand-alone graphics') +commandline.registeraction('mpstatic', 'process mp/ctx file to stand-alone graphics') commandline.registeraction('listing', 'list of file content') commandline.registeraction('figures', 'generate overview of figures') @@ -587,6 +637,7 @@ commandline.registeraction('pdfselect', 'select pages from file(s)') commandline.registeraction('pdfcopy', 'copy pages from file(s)') commandline.registeraction('pdftrim', 'trim pages from file(s)') commandline.registeraction('pdfcombine', 'combine multiple pages') +commandline.registeraction('pdfsplit', 'split file in pages') # compatibility switch diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index 411cb9248..b9ced8813 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -31,9 +31,7 @@ # we don't depend on other libs -$ownpath = File.expand_path(File.dirname($0)) unless defined? $ownpath - -$: << $ownpath +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require "rbconfig" require "md5" @@ -176,6 +174,8 @@ end # concept : Hans Hagen # info : j.hagen@xs4all.nl +# todo: multiple cnf files +# class String @@ -1429,7 +1429,8 @@ end $mswindows = Config::CONFIG['host_os'] =~ /mswin/ $separator = File::PATH_SEPARATOR -$version = "2.0.0" +$version = "2.0.2" +$ownpath = File.dirname($0) if $mswindows then require "win32ole" @@ -1473,6 +1474,8 @@ $predefined['pdftools'] = 'pdftools.rb' $predefined['mpstools'] = 'mpstools.rb' $predefined['exatools'] = 'exatools.rb' $predefined['xmltools'] = 'xmltools.rb' +$predefined['luatools'] = 'luatools.lua' +$predefined['mtxtools'] = 'mtxtools.rb' $predefined['newpstopdf'] = 'pstopdf.rb' $predefined['newtexexec'] = 'texexec.rb' @@ -1497,6 +1500,8 @@ $makelist = [ 'exatools', 'runtools', 'rlxtools', + 'luatools', + 'mtxtools', # # no, 'texmfstart' ] @@ -1509,31 +1514,36 @@ $makelist = [ $scriptlist = 'rb|pl|py|lua|jar' $documentlist = 'pdf|ps|eps|htm|html' -$editor = ENV['TEXMFSTART_EDITOR'] || ENV['EDITOR'] || ENV['editor'] || 'scite' +$editor = ENV['TEXMFSTART_EDITOR'] || ENV['EDITOR'] || ENV['editor'] || 'scite' -$crossover = true # to other tex tools, else only local +$crossover = true # to other tex tools, else only local +$kpse = nil -$applications['unknown'] = '' -$applications['perl'] = $applications['pl'] = 'perl' -$applications['ruby'] = $applications['rb'] = 'ruby' -$applications['python'] = $applications['py'] = 'python' -$applications['lua'] = $applications['lua'] = 'lua' -$applications['java'] = $applications['jar'] = 'java' +def set_applications(page=1) -if $mswindows then - $applications['pdf'] = ['',"pdfopen --page #{$page} --file",'acroread'] - $applications['html'] = ['','netscape','mozilla','opera','iexplore'] - $applications['ps'] = ['','gview32','gv','gswin32','gs'] -else - $applications['pdf'] = ["pdfopen --page #{$page} --file",'acroread'] - $applications['html'] = ['netscape','mozilla','opera'] - $applications['ps'] = ['gview','gv','gs'] -end + $applications['unknown'] = '' + $applications['perl'] = $applications['pl'] = 'perl' + $applications['ruby'] = $applications['rb'] = 'ruby' + $applications['python'] = $applications['py'] = 'python' + $applications['lua'] = $applications['lua'] = 'lua' + $applications['java'] = $applications['jar'] = 'java' -$applications['htm'] = $applications['html'] -$applications['eps'] = $applications['ps'] + if $mswindows then + $applications['pdf'] = ['',"pdfopen --page #{page} --file",'acroread'] + $applications['html'] = ['','netscape','mozilla','opera','iexplore'] + $applications['ps'] = ['','gview32','gv','gswin32','gs'] + else + $applications['pdf'] = ["pdfopen --page #{page} --file",'acroread'] + $applications['html'] = ['netscape','mozilla','opera'] + $applications['ps'] = ['gview','gv','gs'] + end -$kpse = nil + $applications['htm'] = $applications['html'] + $applications['eps'] = $applications['ps'] + +end + +set_applications() def check_kpse if $kpse then @@ -1795,6 +1805,21 @@ def expanded(arg) # no "other text files", too restricted end end +def changeddir?(path) + if path.empty? then + return true + else + begin + Dir.chdir(path) if ! path.empty? + rescue + report("unable to change to directory: #{path}") + else + report("changed to directory: #{path}") + end + return File.expand_path(Dir.getwd) == File.expand_path(path) + end +end + def runcommand(command) if $locate then command = command.split(' ').collect do |c| @@ -1810,20 +1835,10 @@ def runcommand(command) print command # to stdout and no newline elsif $execute then report("using 'exec' instead of 'system' call: #{command}") - begin - Dir.chdir($path) if ! $path.empty? - rescue - report("unable to chdir to: #{$path}") - end - exec(command) + exec(command) if changeddir?($path) else report("using 'system' call: #{command}") - begin - Dir.chdir($path) if ! $path.empty? - rescue - report("unable to chdir to: #{$path}") - end - system(command) + system(command) if changeddir?($path) end end @@ -1961,7 +1976,10 @@ def find(filename,program) end filename.sub!(/^.*[\\\/]/, '') # next we look at the current path and the callerpath - [['.','current'],[$ownpath,'caller'],[registered("THREAD"),'thread']].each do |p| + [ ['.','current'], + [$ownpath,'caller'], ["#{$ownpath}/../#{suffixlist[0]}",'caller'], + [registered("THREAD"),'thread'], ["#{registered("THREAD")}/../#{suffixlist[0]}",'thread'], + ].each do |p| if p && ! p.empty? && ! (p[0] == 'unknown') then suffixlist.each do |suffix| fname = "#{filename}.#{suffix}" @@ -2125,9 +2143,9 @@ def find(filename,program) return '' end rescue - # error, trace = $!, $@.join("\n") - # report("fatal error: #{error}\n#{trace}") - report("fatal error") + error, trace = $!, $@.join("\n") + report("fatal error: #{error}\n#{trace}") + # report("fatal error") end end @@ -2402,7 +2420,7 @@ def execute(arguments) $program = $directives['program'] || 'context' $direct = $directives['direct'] || false $edit = $directives['edit'] || false - $page = $directives['page'] || 0 + $page = $directives['page'] || 1 $browser = $directives['browser'] || false $report = $directives['report'] || false $verbose = $directives['verbose'] || false @@ -2440,6 +2458,8 @@ def execute(arguments) $verbose = true if (ENV['_CTX_VERBOSE_'] =~ /(y|yes|t|true|on)/io) && ! $locate && ! $report + set_applications($page) + # private: $selfmerge = $directives['selfmerge'] || false diff --git a/scripts/context/ruby/texsync.rb b/scripts/context/ruby/texsync.rb index 22b7d46c0..ade307d8e 100644 --- a/scripts/context/ruby/texsync.rb +++ b/scripts/context/ruby/texsync.rb @@ -16,10 +16,7 @@ banner = ['TeXSync', 'version 1.1.1', '2002/2004', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/]\w*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/textools.rb b/scripts/context/ruby/textools.rb index 993388347..345a27572 100644 --- a/scripts/context/ruby/textools.rb +++ b/scripts/context/ruby/textools.rb @@ -15,10 +15,7 @@ banner = ['TeXTools', 'version 1.3.1', '2002/2006', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/texutil.rb b/scripts/context/ruby/texutil.rb index da9a19205..ee0fc1e5e 100644 --- a/scripts/context/ruby/texutil.rb +++ b/scripts/context/ruby/texutil.rb @@ -1,9 +1,6 @@ banner = ['TeXUtil ', 'version 9.1.0', '1997-2005', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/tmftools.rb b/scripts/context/ruby/tmftools.rb index 074e949d1..626ef1f4a 100644 --- a/scripts/context/ruby/tmftools.rb +++ b/scripts/context/ruby/tmftools.rb @@ -27,10 +27,7 @@ banner = ['TMFTools', 'version 1.1.0 (experimental, no help yet)', '2005/2006', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/www/exa.rb b/scripts/context/ruby/www/exa.rb index c6d59d864..5e9b3fd82 100644 --- a/scripts/context/ruby/www/exa.rb +++ b/scripts/context/ruby/www/exa.rb @@ -145,12 +145,12 @@ class WWW dat << "\n" if req.empty? then req << "\n" - req << "\n" + req << "\n" req << "\n" req << "'#{action}\n" unless action.empty? # req << "'#{command}\n" unless command.empty? # req << "'#{url}\n" unless url.empty? - req << "\n" + req << "\n" req << "constructed request\n" req << dat req << "\n" diff --git a/scripts/context/ruby/www/lib.rb b/scripts/context/ruby/www/lib.rb index 2a4f3e14f..f5f362b12 100644 --- a/scripts/context/ruby/www/lib.rb +++ b/scripts/context/ruby/www/lib.rb @@ -172,8 +172,8 @@ class WWW @interface.set('process:os' , platform) @interface.set('process:texos' , 'texmf-' + platform) - @interface.set('trace:run' , 'yes') if (ENV['EXA:TRACE:RUN'] || '') =~ @@re_true - @interface.set('trace:errors' , 'yes') if (ENV['EXA:TRACE:ERRORS'] || '') =~ @@re_true + @interface.set('trace:run' , 'yes') if (ENV['EXA_TRACE_RUN'] || '') =~ @@re_true + @interface.set('trace:errors' , 'yes') if (ENV['EXA_TRACE_ERRORS'] || '') =~ @@re_true yield self if block_given? end @@ -1276,12 +1276,19 @@ class WWW resultname, replyname = 'result.pdf', 'reply.exa' replyfile = File.join(tmp,replyname) resultfile = File.join(tmp,resultname) + targetname = File.join(cache_root,dir,resultname) + # make sure that there is no target left in case of an + # error; needed in case of given session name + if FileTest.directory?(File.join(cache_root,dir)) then + File.delete(targetname) rescue false + end + # now try to locate the file if FileTest.file?(fullname) then if indirect?(fullname) then begin + # check if directory exists and (if so) delete left overs File.makedirs(File.join(cache_root,dir)) - targetname = File.join(cache_root,dir,resultname) - File.delete(targetname) rescue false # left overs + File.delete(targetname) rescue false File.symlink(fullname,targetname) rescue message('Status',$!) unless FileTest.file?(targetname) then FileUtils::cp(fullname,targetname) rescue false diff --git a/scripts/context/ruby/wwwclient.rb b/scripts/context/ruby/wwwclient.rb index 8f5451a8d..d41541a09 100644 --- a/scripts/context/ruby/wwwclient.rb +++ b/scripts/context/ruby/wwwclient.rb @@ -19,7 +19,7 @@ banner = ['WWWClient', 'version 1.0.0', '2003-2006', 'PRAGMA ADE/POD'] -$: << File.dirname(File.expand_path($0)) +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/wwwserver.rb b/scripts/context/ruby/wwwserver.rb index 18ea57df1..53e1cdc51 100644 --- a/scripts/context/ruby/wwwserver.rb +++ b/scripts/context/ruby/wwwserver.rb @@ -2,7 +2,7 @@ banner = ['WWWServer', 'version 1.0.0', '2003-2006', 'PRAGMA ADE/POD'] -$: << File.dirname(File.expand_path($0)) +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' diff --git a/scripts/context/ruby/wwwwatch.rb b/scripts/context/ruby/wwwwatch.rb index 0afb9a392..0faa45aec 100644 --- a/scripts/context/ruby/wwwwatch.rb +++ b/scripts/context/ruby/wwwwatch.rb @@ -2,7 +2,7 @@ banner = ['WWWWatch', 'version 1.0.0', '2003-2006', 'PRAGMA ADE/POD'] -$: << File.dirname(File.expand_path($0)) +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' @@ -46,6 +46,7 @@ class Watch < Monitor @logger = logger @verbose = false @create = false + @onlyonerun = false # [:INT, :TERM, :EXIT].each do |signal| # trap(signal) do # kill @@ -100,7 +101,7 @@ class Watch < Monitor exit! rescue false # no checking, no at_exit done end unless File.writable?(@cache_path) then - puts "no valid work path: #{@work_path}" ; # no reason to exit + puts "no valid cache path: #{@cache_path}" ; # no reason to exit end @last_action = Time.now report("watching path #{@work_path}") if @verbose @@ -302,7 +303,7 @@ class Watch < Monitor lck = File.expand_path(sessionfile.sub(/ses$/,'lck')) start_of_run = Time.now start_of_job = start_of_run.dup - max_runtime = @max_age + max_time = @max_age begin start_of_job = vars['starttime'].to_i || start_of_run start_of_job = start_of_run if start_of_job == 0 @@ -356,7 +357,11 @@ class Watch < Monitor else report("watchdog: skipping - id (#{vars['id']}) / status (#{vars['status']})") if @verbose end - @skips[sessionfile] = true + if @onlyonerun then + @skips[sessionfile] = true + else + @skips.delete(sessionfile) + end else # not yet ok end @@ -379,6 +384,15 @@ class Watch < Monitor begin # report(Time.now.to_s) if @verbose loop do + @threads.delete_if do |k,v| + begin + v == nil || v.stop? + rescue + true + else + false + end + end if @threads.length == @max_threads then if @delay > @max_threads then sleep(@delay) diff --git a/scripts/context/ruby/xmltools.rb b/scripts/context/ruby/xmltools.rb index a10d34314..fe4fbde22 100644 --- a/scripts/context/ruby/xmltools.rb +++ b/scripts/context/ruby/xmltools.rb @@ -17,11 +17,7 @@ banner = ['XMLTools', 'version 1.2.0', '2002/2006', 'PRAGMA ADE/POD'] -unless defined? ownpath - ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') - # ownpath = File.dirname($0) - $: << ownpath -end +$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! require 'base/switch' require 'base/logger' @@ -106,6 +102,11 @@ class Commands output.xputs("#{bt}\n", 6) end output.xputs("#{File.stat(f).size}\n", 6) + permissions = '' + permissions << 'r' if File.readable?(f) + permissions << 'w' if File.writable?(f) + permissions << 'x' if File.executable?(f) + output.xputs("#{permissions}\n", 6) unless permissions.empty? end output.xputs("#{File.stat(f).mtime.strftime("%Y-%m-%d %H:%M")}\n", 6) output.xputs("\n", 4) diff --git a/scripts/context/stubs/mswin/luatools.bat b/scripts/context/stubs/mswin/luatools.bat new file mode 100755 index 000000000..707657fad --- /dev/null +++ b/scripts/context/stubs/mswin/luatools.bat @@ -0,0 +1,2 @@ +@echo off +texmfstart luatools.lua %* diff --git a/scripts/context/stubs/mswin/mtxtools.bat b/scripts/context/stubs/mswin/mtxtools.bat new file mode 100755 index 000000000..b658116a5 --- /dev/null +++ b/scripts/context/stubs/mswin/mtxtools.bat @@ -0,0 +1,2 @@ +@echo off +texmfstart mtxtools.rb %* diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools new file mode 100755 index 000000000..cb3ec1add --- /dev/null +++ b/scripts/context/stubs/unix/luatools @@ -0,0 +1,2 @@ +#!/bin/sh +texmfstart luatools.lua "$@" diff --git a/scripts/context/stubs/unix/mtxtools b/scripts/context/stubs/unix/mtxtools new file mode 100755 index 000000000..2922e0b46 --- /dev/null +++ b/scripts/context/stubs/unix/mtxtools @@ -0,0 +1,2 @@ +#!/bin/sh +texmfstart mtxtools.rb "$@" diff --git a/tex/context/base/colo-ext.tex b/tex/context/base/colo-ext.tex index 182c438fa..33e87459d 100644 --- a/tex/context/base/colo-ext.tex +++ b/tex/context/base/colo-ext.tex @@ -29,11 +29,6 @@ %D %D will negate the colors in box zero. -\def\negatecolorcomponent#1% #1 = \macro - {\scratchdimen\onepoint\advance\scratchdimen-#1\onepoint - \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi - \edef#1{\withoutpt\the\scratchdimen}} - \def\negatecolorbox#1% {\setbox#1\hbox {\dostartnegative diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index bb0b8c6e8..0042429f5 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -371,8 +371,8 @@ % {\executeifdefined{\??cr\currentpalet#1}{\executeifdefined{\??cr#1}\empty}} {\csname\??cr\currentpalet#1\endcsname} -%D Hex color support is not enabled by default. You need to say \setupcolor -%D [hex] to get this working. +%D Hex color support is not enabled by default. You need to say \type +%D {\setupcolor [hex]} to get this working. \ifx\colorHpattern\undefined \let\colorHpattern\colorZpattern \fi @@ -540,6 +540,10 @@ %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 \startbuffer +%D \definecolor [SomeKindOfRed] [r=.8,g=.05,b=.05] +%D \stopbuffer +%D %D \typebuffer %D \getbuffer %D @@ -644,11 +648,6 @@ \newif\ifconverttoGRAY -%D This module also needs: - -% \newif\ifMPgraphics -% \newif\ifinpagebody - %D \macros %D {startcolormode,stopcolormode,permitcolormode} %D @@ -659,25 +658,6 @@ \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 \starttyping -%D \def\startcolormode#1% -%D {\ifincolor\ifpermitcolormode -%D \doifcolorelse{#1} -%D {\getcurrentcolorspecs{#1}% -%D \expandafter\dostartcolormode\currentcolorspecs\od} -%D {\nostartcolormode}% -%D \fi\fi} -%D \stoptyping -%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 @@ -687,23 +667,6 @@ \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 - \handlecolorwith#1\csname\??cr#2\endcsname\od - \fi - \else - \handlecolorwith#1\csname\??cr\currentpalet#2\endcsname\od - \fi - \fi\fi} - -\endTEX - \def\startcolormode % includes \ifincolor\ifpermitcolormode {%\dostoptransparency % needed for: {test \trans test \notrans test} \conditionalstoptransparency @@ -1074,12 +1037,12 @@ %D be created. \def\registerspotcolor#1:% - {\ifundefined{\??cl:\c!p:\@@cl@@n}% + {\ifcsname\??cl:\c!p:\@@cl@@n\endcsname + \@EA\dontregisterspotcolor + \else \letgvalue{\??cl:\c!p:\@@cl@@n}\empty %\@EA\@EA\csname registerspotcolor#1\endcsname \csname registerspotcolor#1\@EA\endcsname - \else - \@EA\dontregisterspotcolor \fi} \def\dontregisterspotcolor #1\od{} @@ -1112,12 +1075,12 @@ %D Experimental too (special purpose code). \def\registerindexcolor#1:% - {\ifundefined{\??cl:i:\@@cl@@n}% + {\ifcsname\??cl:i:\@@cl@@n\endcsname + \@EA\dontregisterindexcolor + \else \letgvalue{\??cl:i:\@@cl@@n}\empty % signal \showmessage\m!colors{12}\@@cl@@n \@EA\@EA\csname registerindexcolor#1\endcsname - \else - \@EA\dontregisterindexcolor \fi} \let\dontregisterindexcolor\dontregisterspotcolor @@ -1259,10 +1222,6 @@ \def\definetransparency {\dodoubleargument\dodefinetransparency} -%\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} @@ -1570,11 +1529,6 @@ \def\colorsplitsuffix{\ifcase\currentcolorchannel\else-\@@clsplit\fi} \def\colorsplitprefix{\ifcase\currentcolorchannel\else\@@clsplit-\fi} -\ifx\resetsystemmode\undefined - \let\setsystemmode \gobbleoneargument - \let\resetsystemmode\gobbleoneargument -\fi - \def\setcolorsplitting {\resetsystemmode{\v!color\colorsplitsuffix}% \resetcolorsplitting @@ -1629,7 +1583,7 @@ \processaction [\@@clconversion] [ \v!yes=>\preferGRAYtrue, - \v!always=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]% + \v!always=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]% \ifRGBsupported \converttoGRAYfalse \forcegrayMPcolorsfalse @@ -1669,19 +1623,6 @@ \let\currentpalet\empty -\beginTEX - -\def\doifcolorelse#1% - {\@EA\ifx\csname\??cr\@EA\ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi#1\endcsname\relax - \expandafter\secondoftwoarguments - \else - \expandafter\firstoftwoarguments - \fi} - -\endTEX - -\beginETEX \ifcsname - \def\doifcolorelse#1% {\ifcsname\??cr\ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi#1\endcsname \expandafter\firstoftwoarguments @@ -1689,8 +1630,6 @@ \expandafter\secondoftwoarguments \fi} -\endETEX - %D \macros %D {localstartcolor,localstopcolor} %D @@ -1755,11 +1694,64 @@ \def\@@currentcolorstop {\??cl\the\colorlevel S} %def\@@currenttransparent{\??cl\the\colorlevel T} -\def\currentcolor +% \def\currentcolorname +% {\csname +% \ifcsname\@@currentcolorname\endcsname\@@currentcolorname\else\s!empty\fi +% \endcsname} + +\letvalue{\??cl*\s!black}\s!black + +\def\currentcolorname {\csname - \ifundefined\@@currentcolorname\s!empty\else\@@currentcolorname\fi + \ifcsname\@@currentcolorname\endcsname + \expandafter\ifx\csname\@@currentcolorname\endcsname\empty + \??cl*\s!black + \else + \@@currentcolorname + \fi + \else + \??cl*\s!black + \fi \endcsname} +% \def\outercolorname +% {\ifcsname\@@currentcolorname\endcsname currentcolor\else\s!black\fi} + +\def\outercolorname + {\ifcsname\@@currentcolorname\endcsname + \expandafter\ifx\csname\@@currentcolorname\endcsname\empty + \s!black + \else + currentcolor% + \fi + \else + \s!black + \fi} + +\def\startcurrentcolor{\startcolor[\outercolorname]} +\def\stopcurrentcolor {\stopcolor} + +% not the following, because we need a different tag in order to trick the stack +% +% \def\outercolorname{\executeifdefined\@@currentcolorname\s!black} +% +% \def\startcurrentcolor{\expanded{\startcolor[\s!black]\noexpand\startcolor[\outercolorname]}} +% \def\stopcurrentcolor {\stopcolor\stopcolor} +% +% test case: +% +% \setupcolors[state=start,textcolor=red] +% \starttext +% red +% \color[green]{green +% \startMPcode +% label(\sometxt{green\color[blue]{blue}green}, origin) withcolor red; +% draw fullcircle scaled 1cm xscaled 2; +% \stopMPcode +% green} +% red +% \stoptext + \def\dodoglobalstartcolor {\global\@EA\let\@EA\@@currentcolor\csname\@@currentcolorname\endcsname \global\advance\colorlevel \@@colorplus @@ -2244,13 +2236,13 @@ \def\dodefinepalet[#1][#2]% {\doifassignmentelse{#2} - {\showmessage\m!colors6{#1}% + {%\showmessage\m!colors6{#1}% \letvalue{\??pa#1}\empty \setevalue{\??pa\??pa#1}{#2}% \def\dodododefinepalet[##1=##2]% {\doifvaluesomething{\??pa#1} {\setevalue{\??pa#1}{\csname\??pa#1\endcsname,}}% - \setevalue{\??pa#1}{\csname\??pa\endcsname##1}% + \setevalue{\??pa#1}{\csname\??pa#1\endcsname##1}% \doifassignmentelse{##2} {% == \definepalet[test][xx={y=.4}] \definecolor[\??pa#1:##1][##2]% @@ -2298,15 +2290,12 @@ {\edef\currentpalet{#1}% \ifx\currentpalet\empty % seems to be a reset + \else\ifcsname\??pa\currentpalet\endcsname + \edef\currentpalet{#1:}% \else - % fast enough for tex and etex - \@EA\ifx\csname\??pa\currentpalet\endcsname\relax - \showmessage\m!colors7\currentpalet - \let\currentpalet\empty - \else - \edef\currentpalet{#1:}% - \fi - \fi} + \showmessage\m!colors7\currentpalet + \let\currentpalet\empty + \fi\fi} %D \macros %D {showpalet} @@ -2518,23 +2507,6 @@ \newif\ifMPcmykcolors % \MPcmykcolorsfalse \newif\ifMPspotcolors % \MPspotcolorsfalse -\beginTEX - -\def\scaledMPcolor#1#2% - {\ifMPgraphics - \handlecolorwith\doMPcolor - \csname\??cr\@EA - \ifx\csname\??cr\currentpalet#2\endcsname\relax\else\currentpalet\fi - #2\endcsname - :::::::\end#1\end - \else - #2% - \fi} - -\endTEX - -\beginETEX \ifcsname - \def\scaledMPcolor#1#2% {\ifMPgraphics \handlecolorwith\doMPcolor @@ -2546,8 +2518,6 @@ #2% \fi} -\endETEX - \def\MPcolor{\scaledMPcolor1} %D Before we had transparency available, the following @@ -2566,9 +2536,10 @@ %D expandabele. \def\doMPcolor#1:% #1 can be \relax ! ! ! i.e. an empty color - {\csname - MPc\@EA\ifx\csname MPc\string#1\endcsname\relax B\else#1\fi - \endcsname} + {\csname MPc\@EA\ifx\csname MPc\string#1\endcsname\relax B\else#1\fi\endcsname} + +% \def\doMPcolor#1:% #1 can be \relax ! ! ! i.e. an empty color +% {\csname MPc\ifcsname MPc#1\endcsname#1\else B\fi\endcsname} \def\MPcR{\doMPrgb} \def\MPcC{\ifMPcmykcolors\@EA\doMPcmykY\else\@EA\doMPcmykN\fi} @@ -2766,4 +2737,30 @@ %D As we can see, color support is turned off by default. %D Reduction of gray colors to gray scales is turned on. +%D \macros +%D {negatecolorcomponent,negatedcolorcomponent} +%D +%D These speak for themselves. See \type {colo-ext} for usage. + +\def\negatecolorcomponent#1% #1 = \macro + {\scratchdimen\onepoint\advance\scratchdimen-#1\onepoint + \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi + \edef#1{\withoutpt\the\scratchdimen}} + +\let\negatedcolorcomponent\firstofoneargument + +\beginETEX + +\def\negatedcolorcomponent#1% + {\ifdim\dimexpr\onepoint-#1\onepoint\relax<\zeropoint + \!!zerocount + \else + \expandafter\withoutpt\the\dimexpr\onepoint-#1\onepoint\relax + \fi} + +\def\negatecolorcomponent#1% #1 = \macro + {\edef#1{\negatedcolorcomponent{#1}}} + +\endETEX + \protect \endinput diff --git a/tex/context/base/cont-err.tex b/tex/context/base/cont-err.tex index 8b4ca8a54..f01ce87aa 100644 --- a/tex/context/base/cont-err.tex +++ b/tex/context/base/cont-err.tex @@ -11,16 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% todo : translate into language +\unprotect -% \writeline -% \writestring{>>>> I cannot locate your local setup file. Locate 'cont-sys.rme'} -% \writestring{>>>> and copy this file to '../tex/context/usr/cont-sys.tex'. You} -% \writestring{>>>> can set cq. uncomment your local preferences in this file.} -% \writeline +\writestatus\m!systems{no file 'cont-sys.tex', using 'cont-sys.rme' instead} -\writeline -\writestring{> User file 'cont-sys.tex' not found, 'cont-sys.rme' has been used instead. <} -\writeline - -\endinput +\protect \endinput diff --git a/tex/context/base/cont-fil.tex b/tex/context/base/cont-fil.tex index 6988f57f0..417bc437f 100644 --- a/tex/context/base/cont-fil.tex +++ b/tex/context/base/cont-fil.tex @@ -30,6 +30,7 @@ %definefilesynonym [sch-make] [sch-01] \definefilesynonym [dir-make] [dir-01] +\definefilesynonym [dir-identify] [dir-05] \definefilesynonym [xml-format] [xml-01] \definefilesynonym [xml-pretty] [xml-02] @@ -50,6 +51,7 @@ \definefilesynonym [res-crop] [res-07] \definefilesynonym [res-trace] [res-08] \definefilesynonym [res-log] [res-09] +\definefilesynonym [res-identify] [res-12] \definefilesynonym [med-show] [res-50] diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex index dae135a1c..4f9bf2d5e 100644 --- a/tex/context/base/cont-log.tex +++ b/tex/context/base/cont-log.tex @@ -213,32 +213,29 @@ %D And this is how they show up: \TeX, \MetaFont, \MetaPost, %D \PiCTeX, \TaBlE, \ConTeXt, \PPCHTeX, \AmSTeX, \LaTeX, -%D \LamSTeX. We also define some logos for the programs that -%D we wrote and use at \PRAGMA: \TeX EDIT, \TeX FORM, \TeX -%D ADRES, \TeX SPELL, \TeX UTIL and \TeX. +%D \LamSTeX. -\def\TEXEDIT {\TeX edit} -\def\TEXFORM {\TeX form} -\def\TEXADRES {\TeX adres} -\def\TEXSPELL {\TeX spell} -\def\TEXUTIL {\TeX util} -\def\TEXEXEC {\TeX exec} +% \def\TEXEDIT {\TeX edit} +% \def\TEXFORM {\TeX form} +% \def\TEXADRES {\TeX adres} +% \def\TEXSPELL {\TeX spell} +% \def\TEXUTIL {\TeX util} +% \def\TEXEXEC {\TeX exec} %D Some placeholders: \def\eTeX {\mathematics{\varepsilon}-\TeX} \def\pdfTeX {pdf\TeX} \def\pdfeTeX {pdfe-\TeX} +\def\luaTeX {lua\TeX} \def\XeTeX {X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX} \let\ETEX \eTeX \let\PDFTEX \pdfTeX \let\PDFETEX \pdfeTeX +\let\LUATEX \luaTeX \let\XETEX \XeTeX -\def\XML {XML} -\def\MATHML {MathML} - \beginXETEX depth adjustment of logos % The next patch by Adam Lindsay is needed to satisfy XeTeX's diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii new file mode 100644 index 000000000..9610dbd4b --- /dev/null +++ b/tex/context/base/cont-new.mkii @@ -0,0 +1,14 @@ +%D \module +%D [ file=cont-new, +%D version=1995.10.10, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=New 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. + +\endinput diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index aa48f5866..bd56ee258 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,192 +11,60 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2006.08.08 17:52} +% it's about time to clean up this file ... + +\newcontextversion{2006.11.16 12:02} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new %D features. -% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0 +\unprotect +\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex} + +% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0 % todo: mp-new % caption: grid=top|bottom in xml defs - -\unprotect - -% \setuplabeltext[\s!itemcount1={{I(},{)}}] -% \def\labeledcountervalue#1{\labeltexts{#1}{\countervalue{#1}}} -\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex} - -% we need to overhaul the page modules anyway - -\def\settext - {\doquintupleempty\dosettext} - -\def\dosettext[#1][#2][#3][#4][#5]% header text middle text/text - {\iffifthargument - \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% - {\dodoubletexts{\??tk#1}{#2}% - {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% - {\c!rightstyle\c!rightcolor\c!rightwidth}{#5}}% - \else\iffourthargument - \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% - {\dodoubletexts{\??tk#1}{#2}% - {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% - {\c!rightstyle\c!rightcolor\c!rightwidth}{#4}}% - \else\ifthirdargument - \setvalue{\??tk#1#2\c!middletext}% - {\dodoubletexts{\??tk#1}{#2}% - {\c!leftstyle \c!leftcolor \c!leftwidth }{#3}% - {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}% - \fi\fi\fi} - -\def\resettext - {\dotripleempty\doresettext} - -\def\doresettext[#1][#2][#3]% header text middle - {\ifthirdargument - \letvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}\empty - \else\ifsecondargument - \letvalue{\??tk#1#2\c!lefttext }\empty - \letvalue{\??tk#1#2\c!middletext}\empty - \letvalue{\??tk#1#2\c!righttext }\empty - \fi\fi} - -\setvalue{:\c!middle:\c!text:}{\c!middletext} -\setvalue{:\c!left :\c!text:}{\c!lefttext } -\setvalue{:\c!right :\c!text:}{\c!righttext } - -% \settext[header][text][middle][xxx][yyy] +\def\dividedsize#1#2#3% size gap n + {\dimexpr + \ifnum\dimexpr#1\relax>\plusone + (\dimexpr#1\relax-\numexpr#3-1\relax\dimexpr#2\relax)/#3\else#1% + \fi + \relax} -%D A nice example of a plugin: -%D -%D \startbuffer -%D \startitemize[a,random,packed] -%D \startitem first \stopitem \startitem second \stopitem -%D \startitem third \stopitem \startitem fourth \stopitem -%D \stopitemize -%D -%D \startitemize[a,random,packed] -%D \startitem first \stopitem \startitem second \stopitem -%D \startitem third \stopitem \startitem fourth \stopitem -%D \stopitemize -%D -%D \startitemize[a,packed] -%D \startitem first \stopitem \startitem second \stopitem -%D \startitem third \stopitem \startitem fourth \stopitem -%D \stopitemize -%D \stopbuffer -%D -%D \typebuffer \getbuffer +% maybe to be integrated (option=...) -% better collectitems als conditional and a real plugin mechanism (some day) +\def\directexternalfigure + {\dodoubleempty\dodirectexternalfigure} -\@EA\long\@EA\def\@EA\collectitemgroupitem\@EA#\@EA1\csname\e!stop\v!item\endcsname - {\increment\itemcollectcounter - \long\setvalue{\v!item*\itemcollectcounter}{\item#1\par}} - -\def\flushcollecteditems - {\ifconditional\randomizeitems - \getrandomnumber\itemcollectcounternow\plusone\itemcollectcounter - \else - \increment\itemcollectcounternow - \fi - \doifdefined{\v!item*\itemcollectcounternow} - {\getvalue{\v!item*\itemcollectcounternow}% - \letbeundefined{\v!item*\itemcollectcounternow}% - \increment\itemcollectcounterdone}% - \ifnum\itemcollectcounterdone<\itemcollectcounter\relax - \expandafter\flushcollecteditems - \fi} - -\def\stopcollectitems - {\ifconditional\randomizeitems - \newcounter\itemcollectcounterdone - \ifnum\itemcollectcounter>\zerocount - \@EAEAEA\flushcollecteditems - \fi - \fi} +\def\dodirectexternalfigure[#1][#2]% + {\bgroup + \getparameters[\??ef][\c!type=\splitofftype,\c!page=1,#2]% + \sanitizefilename#1\to\expandedfigurename + \splitfilename\expandedfigurename + \let\@@DriverImageWidth \!!zeropoint + \let\@@DriverImageHeight \!!zeropoint + \let\@@DriverImageFile \splitofffull + \let\@@DriverImageType \@@eftype + \let\@@DriverImageMethod \@@eftype + \let\@@DriverImageLabel \empty + \let\@@DriverImagePage \@@efpage + \doinsertfile + \egroup} -\def\startcollectitems - {\ifconditional\randomizeitems - \newcounter\itemcollectcounter - \letvalue{\e!start\v!item}\collectitemgroupitem - \fi} +% \directexternalfigure[cow.pdf] -% This will move to core-fig asap: -% -% todo: process between runs - -\startXMLmapping[rli] - \defineXMLprocess[rl:identify] - \defineXMLsavecontent[rl:width] {\!!zeropoint} - \defineXMLsavecontent[rl:height]{\!!zeropoint} -\stopXMLmapping - -\let\rliwidth \!!zeropoint -\let\rliheight\!!zeropoint - -\def\getRLIfiguredimensions#1% - {\global\let\rliwidth \!!zeropoint - \global\let\rliheight\!!zeropoint - \doifelsenothing\@@efconversion - {\doiffileelse\@@effilenametype - {\doiffileelse{\@@effilenametype.rli} - {} - {% let's try runtime running first - \writestatus\m!figures{using rlxtools to determine size of \@@effilenametype}% - \executesystemcommand{texmfstart rlxtools --identify \@@effilenametype}}% - \doiffileelse{\@@effilenametype.rli} - {} - {% we assume that runtime running failed - \installprogram{texmfstart rlxtools --identify \@@effilenametype}}% - \startnointerference - \startXMLmapping[rli]% - \startXMLignore - \processXMLfile{\@@effilenametype.rli}% - \xdef\rliwidth {\XMLflush{rl:width}}% - \xdef\rliheight{\XMLflush{rl:height}}% - \stopXMLignore - \stopXMLmapping - \stopnointerference} - {}} - {}} % no rli when rlx conversion is in place - -\def\getfiguredimensionsC - {\ifcase\figurestatus\ifcase\figurefilemode\else - \doifsomething\@@efcurrentpath - {\doifnotinset\@@effiletype{\c!tex,\c!tmp} - {\doiffileelse\@@efcurrentfile - {\@@eftrace{using rlxtools to identify \@@effilenametype}% - \getRLIfiguredimensions{\@@effilenametype}% - \ifdim\rliwidth>\zeropoint \ifdim\rliheight>\zeropoint - \geteparameters % e ! - [\??ep] - [\c!x=\!!zeropoint,\c!y=\!!zeropoint, % brrr, todo: bbox - \c!w=\rliwidth,\c!h=\rliheight]% - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile - \chardef\figurestatus\plusfour % todo, message is wrong now - \fi \fi - \@@eftrace{\ifcase\figurestatus not \fi found}} - {}}}% - \fi\fi} +% normally one does not want this to happen nested, maybe there +% is more; non public vars btw, will become conditionals -\let\doanalyzefigurefilesB\relax % obsolete -\let\doanalyzefigurefilesC\relax % obsolete +\appendtoks \writetoregisterfalse \to \everybeforeutilityread +\appendtoks \writetolistfalse \to \everybeforeutilityread +\appendtoks \notesenabledfalse \to \everybeforeutilityread -\def\environment #1 % at outermost level only (load only once) - {\pushmacro\startenvironment - \pushmacro\stopenvironment - \def\startenvironment ##1 {}% - \let\stopenvironment\relax - \startreadingfile - \doexecutefileonce{#1} - \stopreadingfile - \popmacro\startenvironment - \popmacro\stopenvironment} +% \setuplabeltext[\s!itemcount1={{I(},{)}}] +% \def\labeledcountervalue#1{\labeltexts{#1}{\countervalue{#1}}} \def\singlewidened #1{\hbox spread 1em{\hss#1\hss}} \def\complexwidened[#1]#2{\hbox spread #1{\hss#2\hss}} @@ -214,204 +82,10 @@ % % \def\getlocation#1{\executeifdefined{loc:#1}{#1}} -\def\convertencodedtokens{\stringifyencodedtokens} - -% test case: -% -% \enableregime[cp1250] -% \mainlanguage[cz] -% -% \starttext -% -% \title{Žluouècí konì úpí} -% \placelist[chapter][criterium=all] -% -% \startbuffer -% -% Žluouècí konì úpí -% -% \stopbuffer -% -% \defineXMLenvironment -% [chapter] -% {\defineXMLsave[title]} -% {\expanded{\chapter{\XMLflush{title}}}} -% \processXMLbuffer -% -% \setuphead[chapter][expansion=yes] -% \defineXMLenvironment -% [chapter] -% {\defineXMLsave[title]} -% {\chapter{\XMLflush{title}}} -% \processXMLbuffer -% -% \stoptext - % just in case we load something from a file (pdfr-ec for instance) \prependtoks \restoreendofline \to \everybeforeshipout -% \tracefilestrue -% -% \unexpanded\def\readfile#1#2#3% -% {\readlocfile{#1}{#2} -% {\readjobfile{#1}{#2} -% {\readsysfile{#1}{#2}{#3}}}} - -\unexpanded\def\readfile#1#2#3% - {\readlocfile{#1}{#2}{\readsysfile{#1}{#2}{#3}}} - -\chardef\preprocessmethod 2 % 0=no check 1=present_check 2=log_check -\chardef\preprocessstate 0 % 1=found 2=not_present (skip) -\def \preprocesssuffix {.prep} - -\def\loadctxpreplist - {\ifcase\preprocessmethod - % no checking - \or - % simple checking - \or - \doiffileexistselse{./\jobname.ctl} - {\bgroup - \defineXMLenvironment[ctx:preplist] - {\writestatus\m!systems{loading ctx log file}} - {}% - \defineXMLenvironmentsave[ctx:prepfile][done=no] - {} - {\writestatus\m!systems{registering \XMLflush{ctx:prepfile} -> \XMLop{done}}% - \setxvalue{fp..\XMLflush{ctx:prepfile}}{\XMLop{done}}}% - \processXMLfile{./\jobname.ctl}% - \egroup}% - {\global\chardef\preprocessmode\plusone}% - \fi - \global\let\loadctxpreplist\relax} - -\appendtoks\loadctxpreplist\to\everystarttext % will become: \prependtoks\loadctxpreplist\to\everyjob - -\def\docheckprepfile - {\ifcase\preprocessmethod - \iftracefiles\writestatus\m!systems{preprocessing - not needed}\fi - % no preprocessing - \or - % only check for existence - \iftracefiles\writestatus\m!systems{preprocessing - check exitence of \readfilename\preprocesssuffix}\fi - \doiffileexistselse{\readfilename\preprocesssuffix} - {\chardef\preprocessstate\plusone} - \donothing - \or - % check when in list, otherwise assume normal file - \bgroup - \splitfilename\readfilename - \ifx\splitofftype\empty - % saveguard and speed up - \iftracefiles\writestatus\m!systems{preprocessing - no suffix}\fi - \egroup - \else - \iftracefiles\writestatus\m!systems{preprocessing - check presence of \readfilename\preprocesssuffix}\fi - \doifdefinedelse{fp..\readfilename} - {\egroup - \doiffileexistselse{\readfilename\preprocesssuffix} - {\chardef\preprocessstate\plusone} - {\chardef\preprocessstate\plustwo}}% - {\doifdefinedelse{fp..\splitoffname.\splitofftype} - {\egroup - \doiffileexistselse{\readfilename\preprocesssuffix} - {\chardef\preprocessstate\plusone} - {\chardef\preprocessstate\plustwo}}% - {\egroup}}% - \fi - \fi} - -% beware, \readfilename keeps the original one, but we load and store the -% suffixed with .prep file (if present) - -\def\doreadfile#1#2#3#4% beware, this one already works at format generation time! - {\sanitizefilename#2\to\readfilename - \ifx\readfilename\empty - % silently ignore - \else - \let\trackedfilename\readfilename - \chardef\preprocessstate\zerocount - \ifconditional\trackfilenames - \doifundefinedelse{fn..\trackedfilename}\donetrue\donefalse - \else - \donetrue - \fi - \ifdone - \checkfilename\readfilename - \ifcase\kindoffile - % not a full path or url, check for existence - \doifelsenothing{#1} - {\iftracefiles\writestatus\m!systems{searching for \readfilename\space on tex path}\fi - \def\next{\redoreadfile\readfilename{#3}{#4}}}% - {\iftracefiles\writestatus\m!systems{searching for \readfilename\space on #1}\fi - \def\next{\redoreadfile{\pathplusfile{#1}{\readfilename}}{#3}{#4}}}% - \else - % a full path or url, no further checking done - \docheckprepfile - \ifcase\preprocessstate - \doiffileexistselse\readfilename - {\iftracefiles\writestatus\m!systems{located \readfilename}\fi - \def\next{#3\dodoreadfile}}% - {\iftracefiles\writestatus\m!systems{not found \readfilename}\fi - \def\next{#4}}% - \or - \iftracefiles\writestatus\m!systems{located \readfilename\preprocesssuffix}\fi - \def\next{#3\dodoreadfile}% - \or - \iftracefiles\writestatus\m!systems{not found \readfilename\preprocesssuffix}\fi - \def\next{#4}% - \fi - \fi - \else - \edef\readfilename{\getvalue{fn..\readfilename}}% - \iftracefiles\writestatus\m!systems{already located \readfilename}\fi - \def\next{#3\dodoreadfile}% - \fi - \expandafter\next - \fi} - -\def\redoreadfile#1#2#3% - {\docheckprepfile - \ifcase\preprocessstate - \doiffileexistselse{#1}% - {\edef\readfilename{#1}% - \iftracefiles\writestatus\m!systems{#1 located}\fi - \def\next{#2\dodoreadfile}}% - {\iftracefiles\writestatus\m!systems{cannot locate #1}\fi - \decrement\readlevel\relax - \ifnum\readlevel>\zerocount - \edef\readfilename{\pathplusfile{\f!parentpath}{\readfilename}}% - \def\next{\redoreadfile\readfilename{#2}{#3}}% - \else - \def\next{#3}% - \fi}% - \or - \edef\readfilename{#1}% - \iftracefiles\writestatus\m!systems{#1\preprocesssuffix\space located}\fi - \def\next{#2\dodoreadfile}% - \or - \def\next{#3}% - \fi - \next} - -\def\dodoreadfile % we provide hooks, for instance for \enableXML - {\ifconditional\trackfilenames - \setxvalue{fn..\trackedfilename}{\readfilename\ifcase\preprocessstate\or\preprocesssuffix\fi}% - \fi - \the\everybeforereadfile - \ifcase\preprocessstate - % no checking or not found when using method 1 - \normalinput\readfilename - \or - % found when using method 1 or 2 - \normalinput\readfilename\preprocesssuffix - \or - % not found when using method 2 - \fi - \relax - \the\everyafterreadfile} - % The following may be a solution for the fact that one cannot % change catcodes of characters like : and ; inside an environment. @@ -437,66 +111,6 @@ \let\cs\getvalue -%D Krzysztof Leszczynski suggested to provide access to the level by -%D means of a \type {#1}. I decided to pass the more frquently used -%D level as \type {#1} and the less favoured depth as \type {#2}. The -%D intended usage is: -%D -%D \starttyping -%D \dorecurse{3}{\definesymbol[test-#1][xx-#1]} -%D -%D \def\test{\dorecurse{3}{\definesymbol[test-##1][xx-##1]}} \test -%D -%D \symbol[test-1]\quad\symbol[test-2]\quad\symbol[test-3] -%D \stoptyping -%D -%D Since the hashed arguments are expanded, we don't need tricky -%D expansion here. -%D -%D \starttyping -%D \dorecurse{3}{\expanded{\definesymbol[test-\recurselevel][xx-\recurselevel]}} -%D \stoptyping - -\def\expandrecursecontent - {\csname\@@arecurse\recursedepth\@EA\@EA\@EA\endcsname\@EA\@EA\@EA{\@EA\recurselevel\@EA}\@EA{\recursedepth}} - -\long\def\xdorecurse#1#2% - {\global\advance\outerrecurse \plusone - \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname##1##2{#2}% - \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel - \@EA\dodorecurse\@EA1\@EA{\number#1}} - -\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##1##2{#4}% - \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel - \ifnum#3>0\relax - \ifnum#2<#1\relax - \let\nextrecurse\exitstepwiserecurse - \else - \let\nextrecurse\dodostepwiserecurse - \fi - \else - \ifnum#3<0\relax - \ifnum#1<#2\relax - \let\nextrecurse\exitstepwiserecurse - \else - \let\nextrecurse\dodostepwisereverse - \fi - \else - \let\nextrecurse\exitstepwiserecurse - \fi - \fi\expanded{\nextrecurse{\number#1}{\number#2}{\number#3}}} - -\long\def\doloop#1% - {\global\advance\outerrecurse \plusone - \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname##1##2{#1}% - \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel - \let\endofloop\dodoloop - \dodoloop1} % no \plusone else \recurselevel wrong - -\ifx\normalcompound\undefined \let\normalcompound=| \fi - % experimental so this may change \def\startdescriptions @@ -591,8 +205,6 @@ % % \shapesynonym{eacute} -% new: \forcebaselinecorrection --> core-spa & core-grd - \chardef\baselinecorrectionmode\plusone \def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone } @@ -692,47 +304,6 @@ \normalstartbaselinecorrection \fi} -% todo: fast processor - -\def\gettwopassdatalist#1% - {\loadtwopassdata - \ifcsname#1:\s!list\endcsname - \letcscsname\twopassdatalist\csname#1:\s!list\endcsname - \else - \let\twopassdatalist\empty - \fi} - -% \def\literateencodedtokens -% {% \let\dohandleaccent \keephandleaccent % assumes named chars % defineaccent "e {name} -% % \let\dohandlecommand \keephandlecommand % assumes named chars % definecommand crap {name} -% \let\dohandlecharacter\keephandlecharacter} -% -% \def\convertmeaning#1\to % watch the double expansion ! -% {\bgroup -% \honorunexpanded -% %\dontexpandencoding % new -% \literateencodedtokens % newer -% \xdef\@@globalexpanded{#1}% -% \xdef\@@globalexpanded{\@@globalexpanded}% -% \egroup -% \convertcommand\@@globalexpanded\to} - -\def\defXMLattributestring#1#2#3#4% - {\ifcsname\@@XMLvariable:#2:#3\endcsname - \@EA\convertcommand\csname\@@XMLvariable:#2:#3\endcsname\to#1% - \else - \convertargument#4\to#1% - \fi} - -\bgroup \catcode`\<=\active - -% usage: \expanded{\rescanXMLatttributes{fo:table-cell}} - -\gdef\rescanXMLattributes #1{\noexpand\dogetXMLarguments{#1}\currentXMLarguments>} -\gdef\parseXMLattributes #1#2{\dogetXMLarguments{#1}#2>} - -\egroup - % \page[left] % \definecolumntextarea[intro][left][x=1,y=1,nx=4,ny=20,state=start,background=introlayer] % \setupcolumntextareatext[intro][left][\setups{intro}] @@ -742,23 +313,6 @@ {\initializecolumntextareas \setvsize} -% And so, after a few years of keeping this potentially dangerous -% speedup in cont-exp, we now move it to the kernel: the next -% patch is 30\% faster on main interface (seconds) (9->7 sec on -% 1 million calls). Another speed up is still under testing. - -\startinterface english - - \def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} - \def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} - \def\dosetvalue #1#2{\@EA\def \csname#1#2\endcsname} - \def\docopyvalue#1#2#3{\@EA\def \csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} - -\stopinterface - -\def\XMLprocess#1% - {\begingroup\enableXML\XMLflush{#1}\endgroup} - %D (Inspired by a discussion on the \CONTEXT\ mailing list) %D %D In \TEX\ each character can have one of 16 catcodes. This way the @@ -822,6 +376,11 @@ \long\def\rescan#1{\scantokens{#1\ignorespaces}} \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantokens{#2\ignorespaces}\endgroup} + +\ifx\scantextokens\undefined \else + \long\def\rescan#1{\scantextokens{#1}} + \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantextokens{#2}\endgroup} +\fi % In 2005 we will abandon support for font encodings that don't have % the ascii characters { } $ etc in their normal slot, i.e. latin modern @@ -853,7 +412,7 @@ \honorunexpanded % \dontexpandencoding % \dontexpandutf - \let\dohandleactivecharacter\donthandleactivecharacter + \chardef\activecharactermode\zerocount \xdef\@@globalexpanded{#1}% \egroup \@@globalexpanded} @@ -862,23 +421,6 @@ {\XMLexpanded{\scratchtoks{\enableXML#2}}% \expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}} -%D Ok, I got tired of making dedicated clean up macros using the -%D same mechanism again and again, so now we have: -%D -%D \starttyping -%D \def\xxxx{abc.d} \replacecharacters\xxxx{a.}{-} \xxxx -%D \stoptyping - -\def\replacecharacters#1#2#3% macro characters replacement - {\bgroup - \edef\ascii{#1}% - \retainlccodes - \def\docommand##1{\lccode\expandafter`\csname##1\endcsname=\expandafter`\csname#3\endcsname}% - \handletokens#2\with\docommand - \lowercase\@EA{\@EA\xdef\@EA\globalascii\@EA{\ascii}}% - \egroup - \dodoglobal\let#1\globalascii} - \ifx\pagediscards\undefined \let\pagediscards\relax \fi \installoutput\synchronizeoutput % maybe add pagediscards @@ -893,43 +435,11 @@ {\expanded{\everyhbox{\the\everyhbox\noexpand\fastenableencoding{\currentencoding}}}% \def\dealwithmathtextencoding{\let\characterencoding\nocharacterencoding}% \dealwithmathtextencoding} + \appendtoks \dealwithmathtextencoding \to \everymathematics -\def\dohandlemathtoken#1% - {\csname - \ifmmode - \ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname - \@mt@\mathcollection:\outerencoding - \else\ifcsname\@mt@\mathcollection#1\endcsname - \@mt@\mathcollection - \else\ifcsname\@mt@\nomathcollection#1\endcsname - \@mt@\nomathcollection - \else\ifcsname\characterencoding#1\endcsname - \characterencoding - \else - \nocharacterencoding - \fi\fi\fi\fi - \else - \ifcsname\characterencoding#1\endcsname - \characterencoding - \else\ifcsname\nocharacterencoding#1\endcsname - \nocharacterencoding - \else\ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname - \@mt@\mathcollection:\outerencoding - \else\ifcsname\@mt@\mathcollection#1\endcsname - \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\mathcollection - \else\ifcsname\@mt@\nomathcollection#1\endcsname - \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\nomathcollection - \else - \nocharacterencoding - \fi\fi\fi\fi\fi - \fi - #1\endcsname} - -\let\dohandlecommand\dohandlemathtoken - \let\outerencoding\empty \def\checkoutermathencoding @@ -943,10 +453,10 @@ \checkoutermathencoding \to \everymathematics -% \startmathcollection[euler:texnansi] +% \startmathcollection[eul:texnansi] % \definemathsymbol [breve] [accent] [tf] ["15] % \stopmathcollection -% \startmathcollection[euler:ec] +% \startmathcollection[eul:ec] % \definemathsymbol [breve] [accent] [tf] ["08] % \stopmathcollection % @@ -978,11 +488,6 @@ % \markpage[nobackgrounds] % \doifmarkedpageelse{nobackgrounds} -\def\gettwopassdatalist#1% - {\loadtwopassdata - \letcscsname\twopassdatalist\csname#1:\s!list\endcsname - \ifx\twopassdatalist\relax\let\twopassdatalist\empty\fi} - \newcounter\nofmarkedpages \def\definemarkedpage[#1]% @@ -991,13 +496,7 @@ \def\markpage[#1]% looks very much like domarginreference {\iftrialtypesetting\else \doglobal\increment\nofmarkedpages\relax - \edef\writeparref% - {\writeutilitycommand% - {\twopassentry% - {\v!page:#1}% - {\nofmarkedpages}% - {\noexpand\realfolio}}}% - \writeparref + \lazysavetwopassdata{\v!page:#1}{\nofmarkedpages}{\noexpand\realfolio}% \fi} \def\doifmarkedpageelse#1% @@ -1095,7 +594,7 @@ \ifx\@@expanded\empty\else \bgroup \global\percentdimendonefalse - \def\%{\dimexpr(#1/100)\global\percentdimendonetrue\ignorespaces}| scantokens add's a space + \def\%{\dimexpr#1/100\relax\global\percentdimendonetrue\ignorespaces}| scantokens add's a space \catcode`%=\@@active \catcode`\\=\@@escape \let%\%| @@ -1151,52 +650,6 @@ \egroup -% \def\doshowpardata#1#2{\hbox{\string#1: \the#2}\endgraf} -% -% \def\showpardata -% {\edef\thepardata -% {\hbox{font: \fontname\font}\endgraf -% \doshowpardata{interword space}{\fontdimen2\font}% -% \doshowpardata{interword stretch}{\fontdimen3\font}% -% \doshowpardata{interword shrink}{\fontdimen4\font}% -% \doshowpardata{quad space}{\fontdimen6\font}% -% \doshowpardata{extra space}{\fontdimen7\font}% -% \doshowpardata\hsize\hsize -% \doshowpardata\leftskip\leftskip -% \doshowpardata\rightskip\rightskip -% \doshowpardata\spaceskip\spaceskip -% \doshowpardata\xspaceskip\xspaceskip -% \doshowpardata\parindent\parindent -% \doshowpardata\parfillskip\parfillskip -% \doshowpardata\hyphenpenalty\hyphenpenalty -% \doshowpardata\exhyphenpenalty\exhyphenpenalty -% \doshowpardata\displaywidowpenalty\displaywidowpenalty -% \doshowpardata\widowpenalty\widowpenalty -% \doshowpardata\clubpenalty\clubpenalty -% \doshowpardata\brokenpenalty\brokenpenalty -% \doshowpardata\doublehyphendemerits\doublehyphendemerits -% \doshowpardata\finalhyphendemerits\finalhyphendemerits -% \doshowpardata\adjdemerits\adjdemerits}% -% \begingroup -% \dontshowcomposition -% \inleftmargin{\vsmash -% {\switchtobodyfont[7pt,tt]% -% \framed[\c!align=\v!right]{\thepardata}}}% -% \endgroup} -% -% \def\startshowpardata -% {\begingroup -% \showcomposition -% \showstruts\tracepositionstrue \tracingparagraphs\maxdimen -% \appendtoksonce\showpardata\let\showpardata\relax\to\everypar} -% -% \def\stopshowpardata -% {\endgraf -% \endgroup} -% -% \defineXMLenvironment[showpardata] \startshowpardata \stopshowpardata -% \defineXMLsingular [showpardata] \showpardata - % todo : test low level translation (nl->en) and optimize script % \definestylecollection[mine] @@ -1308,12 +761,12 @@ \def\locatefilepath#1% {\let\locatedfilepath\empty \ifx\allinputpaths\empty \else - \def\docommando##1% + \def\docommand##1% {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\locatedfilepath{##1}}\donefalse \ifdone\expandafter\quitcommalist\fi}% \doifparentfileelse{#1} % new - {\processcommacommand [\allinputpaths]\docommando} - {\processcommacommand[.,\allinputpaths]\docommando}% + {\processcommacommand [\allinputpaths]\docommand} + {\processcommacommand[.,\allinputpaths]\docommand}% \fi} % todo : share symbols @@ -1482,19 +935,21 @@ % \readfile{cont-exp}\donothing\donothing % speed up (5-20%) \def\dimenratio#1#2% etex only - {\withoutpt\the\dimexpr(2\dimexpr(#1)/(\dimexpr(#2)/32768))} + {\withoutpt\the\dimexpr2\dimexpr(#1)/\dimexpr(#2)/32768\relax\relax} \def\doxprecurse#1#2% {\ifnum#1=\zerocount % no \ifcase \expandafter\gobblethreearguments \else #2\expandafter\expandafter\expandafter\doxprecurse\expandafter - \fi\expandafter{\the\numexpr(#1-1)}{#2}} + \fi\expandafter{\the\numexpr#1-1\relax}{#2}} \def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie \unexpanded\def\asciistr#1{\convertargument#1\to\ascii{\verbatimfont\ascii}} +% messy, will be improved: + \prependtoks \setnormalcatcodes \to \everyTEXinputmode \appendtoks \processingXMLfalse \to \everyTEXinputmode @@ -1520,59 +975,14 @@ \endETEX -% Currently there is a bug in \lastnodetype, so we will enable this -% feature when the bugfix is widespread. - -% \beginETEX \lastnodetype -% -% \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip -% {\ifnum\lastnodetype=\@@gluenode % \ifcase\lastskip % \ifdim\lastskip=\zeropoint\relax -% \shapeskip\lastskip -% \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% -% \unskip -% \else\ifnum\lastnodetype=\@@kernnode % \ifcase\lastkern % \ifdim\lastkern=\zeropoint\relax -% \shapekern\lastkern -% \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% -% \unkern -% \else\ifnum\lastnodetype=\@@penaltynode % \ifcase\lastpenalty % \ifnum\lastpenalty=\zerocount -% \shapepenalty\lastpenalty -% \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% -% \unpenalty -% \else -% \setbox\shapebox\lastbox -% \ifvoid\shapebox -% \unskip\unpenalty\unkern -% \else -% \ifdim\wd\shapebox=\shapesignal\relax -% \exitloop -% \else -% \shapecounter\zerocount -% \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}% -% \fi -% \fi -% \fi\fi\fi -% \ifnum\shapecounter>100 % can be less -% \message{<>}% -% \global\setbox\tmpshapebox\copy\oldshapebox -% \exitloop -% \else -% \advance\shapecounter \plusone -% \fi} -% -% \endETEX - \let\normaltype\type \beginTEX - \unexpanded\def\retype#1{\bgroup\convertargument#1\to\ascii\@EA\normaltype\@EA{\ascii}\egroup} - \endTEX \beginETEX - \unexpanded\def\retype#1{\scantokens{\normaltype{#1}\ignorespaces}} - \endETEX \def\simplifytype{\let\type\retype} @@ -1656,27 +1066,6 @@ % \headsym{xx} test \par test % \stopitemize -% \def\removeunwantedspaces -% {\ifhmode -% \doloop{\ifdim\lastskip>\zeropoint\unskip\else\exitloop\fi}% -% \fi} - -\def\removeunwantedspaces - {\ifhmode \ifdim\lastskip>\zeropoint - \unskip \@EAEAEA\removeunwantedspaces - \fi \fi} - -% wait till bugfix in etex is widespead -% -% \beginETEX \lastnodetype -% -% \def\removeunwantedspaces -% {\ifhmode -% \doloop{\ifnum\lastnodetype=\@@gluenode\unskip\else\exitloop\fi}% -% \fi} -% -% \endETEX - % \def\dodimchoice#1#2#3% % {\ifx#3\relax % #1\@EA\gobbleuntilrelax @@ -2178,12 +1567,6 @@ \long \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}} -\def\overloaded#1#2% - {\appendtoks - \writestatus\m!systems{overloaded: \string#2}% - \to \everybye - #1#2} - \def\expandifnonempty#1% {\@EA\ifx\csname#1\endcsname\empty \expandafter\secondoftwoarguments @@ -2224,16 +1607,6 @@ \def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox} \def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop} -% pretty important (esp since we now ignore shipouts) -% -% actually we should nil all writes, marks, specials - -\appendtoks \globallet\popproperties \relax \to \everylastshipout -\appendtoks \globallet\popsplitproperties\relax \to \everylastshipout - -\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} -\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} - % \translateMPinput{il2-pl} % % \startMPenvironment[global] @@ -2246,10 +1619,6 @@ % draw btex MetaPost: ± ¶ etex scaled 5 ; % \stopMPcode -% \startcolumnset[two] \input tufte -% \startcolumnsetspan[two] \input tufte \stopcolumnsetspan -% \input tufte \stopcolumnset - % now in cont-loc.tex, for the sake of testing. % % %D When \type {\somecolor} is issued, we can savely assume @@ -2356,11 +1725,6 @@ \setinnerparpositions % see "techniek" for application \to \everytabulate -\appendtoks \checkcurrentlayout \to \everystarttext - -\def\flushfootnotes {\flushnotes} -\def\doflushfootnotes{\doflushnotes} - %D This alternative is slower, since it works on top of the %D color (stack) mechanism, but it does provide nesting. @@ -2384,6 +1748,8 @@ \def\localstopraster{\ifincolor\localstopcolor\fi} \def\stopraster {\ifincolor\stopcolor\fi} + +\def\raster[#1]{\groupedcommand{\startraster[#1]}{\stopraster}} \def\fontclassname#1#2% {\ifcsname\??ff#1#2\endcsname @@ -2540,136 +1906,6 @@ %D To be documented, \type {\includemenu[menu]}. %D To be documented, \type {\emphbf} cum suis. -%D A prelude to strategies. Note for myself: overloads -%D previous stuff from local pragma test files. - -\def\s!strategy{strategy} - -\def\currentstrategypass {1} -\def\currentstrategyvariable{0} -\def\maximumstrategypass {8} - -\newconditional\strategypassneeded -\newconditional\strategypassforced - -\definetwopasslist{\s!strategy} - -\def\registerstrategypass% - {\ifnum\currentstrategypass>\maximumstrategypass \else - \ifconditional\strategypassforced - \doglobal\increment\currentstrategypass - \else%\ifconditional\strategypassneeded - %\doglobal\increment\currentstrategypass - \fi%\fi - \fi - \savecurrentvalue\currentstrategypass{\currentstrategypass}} - -\appendtoks \registerstrategypass \to \everybye % \everylastshipout - -\def\setstrategyvariable#1#2% key value - {%\doifnotstrategyvariable{#1}{\global\settrue\strategypassneeded}% - \doglobal\increment\currentstrategyvariable - \expanded{\immediatewriteutilitycommand{\noexpand - \twopassentry{\s!strategy}{\currentstrategyvariable}{#1::#2}}}} - -\def\doifstrategyvariableelse#1#2#3% - {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi} - -\def\getstrategyvariable#1% key - {\findtwopassdata{\s!strategy}{#1::}% - \setxvalue{\s!strategy:#1}{\twopassdata}} - -\def\retainstrategyvariable#1% key - {\expanded{\setstrategyvariable{#1}{\strategyvariable{#1}}}} - -\def\strategyvariable#1% key - {\csname\s!strategy:#1\endcsname} - -\let\stratvar\strategyvariable - -\def\forcestrategy{\global\settrue \strategypassforced} -\def\abortstrategy{\global\setfalse\strategypassforced} - -\def\doifstrategyvariableelse#1#2#3% - {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi} - -\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. - -% already taken care of: \definesystemvariable{ks} - -% is buggy now and does not work any longer - -\def\setupcolumnspan[#1]% - {\getparameters[\??ks][#1]} - -\presetlocalframed - [\??ks] - -\setupcolumnspan - [\c!n=2, - \c!offset=\v!overlay, - \c!frame=\v!off] - -\newbox\columnspanbox \let\postprocesscolumnspanbox\gobbleoneargument - -\def\dostartcolumnspan[#1]% - {\bgroup - \setupcolumnspan[#1]% - \forgetall - \ifinsidecolumns - \advance\hsize \intercolumnwidth - \hsize\@@ksn\hsize - \advance\hsize -\intercolumnwidth - \fi - \dowithnextbox - {\setbox\columnspanbox\flushnextbox - \ifinsidecolumns\wd\columnspanbox\hsize\fi - \postprocesscolumnspanbox\columnspanbox - \scratchdimen\ht\columnspanbox - \setbox\columnspanbox\hbox % depth to be checked, probably option! - {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}% - \ht\columnspanbox\scratchdimen - \dp\columnspanbox\strutdp - \wd\columnspanbox\hsize - \ifinsidecolumns - \ifnum\@@ksn>1 - \setvsize - \dohandleallcolumns - {\ifnum\currentcolumn>\@@ksn\else - \global\setbox\currenttopcolumnbox=\vbox - {\ifnum\currentcolumn=1 - \snaptogrid\vbox{\copy\columnspanbox} - \else - \snaptogrid\vbox{\vphantom{\copy\columnspanbox}} - \fi}% - \wd\currenttopcolumnbox\hsize - \global\advance\vsize -\ht\currenttopcolumnbox - \fi} - \global\pagegoal\vsize - \else - \snaptogrid\vbox{\box\columnspanbox} - \fi - \else - \snaptogrid\vbox{\box\columnspanbox} - \fi - \endgraf - \ifvmode\prevdepth\strutdp\fi - \egroup} - \vbox\bgroup - %\topskipcorrection % becomes an option ! - \EveryPar{\begstrut\EveryPar{}}} % also ! - -\def\startcolumnspan - {\dosingleempty\dostartcolumnspan} - -\def\stopcolumnspan - {\egroup} - %D For Ton. To be documented. \def\plaatsexterndocument[#1]% @@ -2689,7 +1925,10 @@ %D live on on my machine and are not distributed, but they may end %D up in the distributed files. +\loadmarkfile{cont-new} + \readsysfile {cont-loc} {} {} % local improvements, patches, new features \readsysfile {cont-exp} {} {} % experimental features (e.g. local speed-ups) +\readsysfile {cont-mtx} {} {} % experimental metatex features \protect \endinput diff --git a/tex/context/base/cont-usr.ori b/tex/context/base/cont-usr.ori index 67a3f4d37..ee0627836 100644 --- a/tex/context/base/cont-usr.ori +++ b/tex/context/base/cont-usr.ori @@ -91,7 +91,9 @@ %D In some languages, compound characters, like \type {"e} %D are used to get accented and non latin characters. - \useencoding[fde] % german +% Per 21/9/2006 one needs to explicitly enable this. + +% \useencoding[fde] % german % \useencoding[ffr] % french % \useencoding[fro] % romanian % \useencoding[fpl] % polish diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 81605992e..290f15efa 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -13,6 +13,7 @@ % dec 07 2001 : cont-en.efmt : 4,035,912 % aug 07 2004 : cont-en.efmt : 4,928,967 (5 more patterns) +% aug 31 2006 : cont-en.fmt : 7,048,748 (all patterns) % todo 1: each module english commands % todo 2: replace lowlevel *!* by english variants @@ -23,7 +24,16 @@ % todo 7: conditionals % todo 8: redesign tui/tuo -\catcode`\{=1 \catcode`\}=2 +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 + +%D For many years \CONTEXT\ supported both good old \TEX\ and \ETEX, but +%D the time has come (August 2006) to advance, especially now that all +%D engines provide \ETEX\ functionality and more is on the horizon. + +\ifx\eTeXversion\undefined + \immediate\write16{SORRY CONTEXT NOW NEEDS ETEX} + \expandafter \end +\fi %D From the next string (which is set by the script that assembles the %D distribution) later on we will calculate a number that can be used @@ -31,11 +41,47 @@ %D 2004.8.30 the low level interface is english. Watch out and adapt %D your styles an modules. -\def\contextversion{2006.08.08 17:52} +\edef\contextformat {\jobname} +\edef\contextversion{2006.11.16 12:02} %D For those who want to use this: -\def\fmtname{context} +\def\fmtname {context} +\def\fmtversion{3.1415926} + +\let\showcontextbanner\relax + +%D Here we will test for what branch of source files we will take. The +%D file suffix depends on the maintream engine: either lua enhanced, +%D or traditional: +%D +%D \starttyping +%D mki : low level dutch +%D mkii : low level english +%D mkiv : lua enhanced +%D \stoptyping +%D +%D There is no \type {mkiii} unless you want to tag the transition +%D version that way (going completely etex, code cleanup and such). + +\ifx\normalinput\undefined \let\normalinput\input \fi + +\edef\mksuffix {mk\ifx\directlua\undefined ii\else iv\fi} + +\def\loadcorefile#1{\normalinput#1\relax} +\def\loadmarkfile#1{\normalinput#1.\mksuffix\relax} + +\ifx\directlua\undefined + \def\loadmarkivfile#1{} \let\loadmarkiifile\loadcorefile +\else + \def\loadmarkiifile#1{} \let\loadmarkivfile\loadcorefile +\fi + +\let\loadmkiifile\loadmarkiifile +\let\loadmkivfile\loadmarkivfile +\let\loadmkfile \loadmarkfile + +\edef\contextmark{MK \ifx\directlua\undefined II\else IV\fi} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type {tex -i} or \type {whatevertex} using @@ -80,19 +126,31 @@ %D manipulation macros. The first one loads \PLAIN\ \TEX, as %D minimal as possible. -\input syst-pln.tex % stripped plain -\input syst-prm.tex % saved primitives (will be extended) +\loadcorefile{syst-pln.tex} +\loadcorefile{syst-prm.tex} + +\loadmkivfile{luat-env.tex} +\loadmkivfile{luat-lib.tex} +\loadcorefile{syst-cat.tex} -\input syst-etx.tex % etex -\input syst-omg.tex % omega-aleph -\input syst-xtx.tex % xetex -\input syst-gen.tex -\input syst-ext.tex -\input syst-new.tex -\input syst-con.tex -\input syst-var.tex +\loadcorefile{syst-etx.tex} +\loadcorefile{syst-pdt.tex} +\loadcorefile{syst-omg.tex} +\loadcorefile{syst-xtx.tex} +\loadcorefile{syst-mtx.tex} -\input math-pln.tex % basic plain math +\loadcorefile{syst-gen.tex} +\loadcorefile{syst-ext.tex} +\loadcorefile{syst-chr.tex} +\loadcorefile{syst-fnt.tex} +\loadcorefile{syst-new.tex} +\loadcorefile{syst-con.tex} +\loadcorefile{syst-var.tex} +\loadcorefile{syst-str.tex} + +\loadcorefile{syst-rtp.tex} + +\loadcorefile{math-pln.tex} %D To enable selective loading, we say: @@ -101,51 +159,63 @@ %D In order to conveniently load files, we need a few %D support modules. -\input supp-ini.tex -\input supp-fil.tex -\input supp-dir.tex +\loadcorefile{supp-ini.tex} +\loadcorefile{supp-fil.tex} +\loadcorefile{supp-dir.tex} %D After this we're ready for the multi||lingual interface %D modules. -\input mult-ini.tex -\input mult-sys.tex -\input mult-con.tex -\input mult-com.tex +\loadcorefile{mult-ini.tex} +\loadcorefile{mult-fst.tex} +\loadcorefile{mult-sys.tex} +\loadcorefile{mult-con.tex} +\loadcorefile{mult-com.tex} + +\loadmkivfile{luat-ini.tex} +% \loadmkivfile{luat-lib.tex} +\loadmkivfile{luat-lmx.tex} +\loadmkivfile{luat-deb.tex} + +\loadmkivfile{luat-uni.tex} + +\loadmkivfile{char-ini.tex} +\loadmkivfile{char-def.tex} %D We also use some third party macros. These are loaded by %D saying: -\input thrd-ran.tex % based on: Donald Arseneau -\input thrd-trg.tex % based on: David Carlisle +\loadcorefile{thrd-ran.tex} % based on: Donald Arseneau +\loadcorefile{thrd-trg.tex} % based on: David Carlisle %D Now we're ready for some general support modules. These %D modules implement some basic typesetting functionality. -\input supp-box.tex -\input supp-mrk.tex -\input supp-vis.tex -\input supp-fun.tex -\input supp-eps.tex -%input supp-pdf.tex -\input supp-spe.tex -\input supp-mps.tex -%input supp-mpe.tex -\input supp-tpi.tex -\input supp-mat.tex -\input supp-ran.tex -\input supp-ali.tex +\loadcorefile{core-var.tex} + +\loadcorefile{supp-box.tex} +\loadcorefile{supp-mrk.tex} +\loadcorefile{supp-vis.tex} +\loadcorefile{supp-fun.tex} +\loadcorefile{supp-eps.tex} +\loadcorefile{supp-spe.tex} +\loadcorefile{supp-ran.tex} +\loadcorefile{supp-mps.tex} +\loadcorefile{supp-tpi.tex} +\loadcorefile{supp-mat.tex} +\loadcorefile{supp-ali.tex} +\loadcorefile{supp-num.tex} %D The next module deals with language specific typographic %D extensions. -\input typo-ini.tex % I must not forget about this module +\loadcorefile{typo-ini.tex} %D Verbatim typesetting is implemented in a separate class of %D modules. The pretty typesetting modules are loaded at run %D time. -\input verb-ini.tex % replaces supp-ver +\loadcorefile{verb-ini.tex} %D The following modules are not sequentially dependent, %D i.e. they have ugly dependencies, which will be cleaned @@ -155,262 +225,265 @@ %D bit more advanced file handling as well as some general %D variables, and features, so next we load: -\input core-var.tex -\input core-ins.tex -\input core-fil.tex -\input core-con.tex +\loadcorefile{core-ins.tex} +\loadcorefile{core-fil.tex} +\loadcorefile{core-con.tex} %D We already need some synonyms (patterns). At runtime this %D file will be reloaded. -\input cont-fil.tex +\loadcorefile{cont-fil.tex} %D \CONTEXT\ does not implement its own table handling. We %D just go for the best there is and load \TABLE. Just to be %D sure we do it here, before we redefine \type{|}. -\input thrd-tab.tex % based on: Michael Wichura / will be reimplemented +\loadcorefile{thrd-tab.tex} % based on: Michael Wichura / will be reimplemented %D Here comes the last support modules. They take care of %D some language specific things. -\input supp-lan.tex -\input supp-num.tex -\input supp-pat.tex % generic pattern loading +%loadcorefile{supp-lan.tex} % replaced by lang-mis +\loadcorefile{supp-pat.tex} %D The next few modules do what their names state. They %D load additional definition modules when needed. -\input enco-ini.tex -\input filt-ini.tex -\input hand-ini.tex -\input regi-ini.tex -\input regi-syn.tex -\input lang-ini.tex -\input lang-ctx.tex -\input lang-dis.tex % after lang-ctx ! -\input unic-ini.tex -%input unic-ext.tex % obsolete +\loadcorefile{regi-ini.tex} +\loadcorefile{enco-ini.tex} +\loadcorefile{filt-ini.tex} +\loadcorefile{hand-ini.tex} +\loadcorefile{regi-syn.tex} +\loadcorefile{lang-ini.tex} +\loadcorefile{lang-ctx.tex} +\loadcorefile{lang-dis.tex} +\loadcorefile{unic-ini.tex} % \readfile{lang-url.pat}{}{} % test -\input colo-ini.tex -\input colo-ext.tex +\loadcorefile{core-gen.tex} +\loadcorefile{core-new.tex} +\loadcorefile{core-uti.tex} +\loadcorefile{core-two.tex} +\loadcorefile{core-stg.tex} + +\loadcorefile{spec-mis.tex} +\loadcorefile{spec-ini.tex} +\loadcorefile{spec-def.tex} +\loadcorefile{spec-var.tex} -\input spec-mis.tex -\input spec-ini.tex -\input spec-def.tex -\input spec-var.tex +\loadcorefile{colo-ini.tex} +\loadcorefile{colo-ext.tex} %D For the moment we load a lot of languages. In the future %D we'll have to be more space conservative. -\input lang-spe.tex -\input lang-lab.tex +\loadcorefile{lang-mis.tex} +\loadcorefile{lang-spe.tex} +\loadcorefile{lang-lab.tex} -\input lang-ger.tex -\input lang-ita.tex -\input lang-sla.tex +\loadcorefile{lang-ger.tex} +\loadcorefile{lang-ita.tex} +\loadcorefile{lang-sla.tex} -\input lang-alt.tex -\input lang-ana.tex -\input lang-art.tex -\input lang-bal.tex -\input lang-cel.tex -\input lang-grk.tex -\input lang-ind.tex -\input lang-ura.tex +\loadcorefile{lang-alt.tex} +\loadcorefile{lang-ana.tex} +\loadcorefile{lang-art.tex} +\loadcorefile{lang-bal.tex} +\loadcorefile{lang-cel.tex} +\loadcorefile{lang-grk.tex} +\loadcorefile{lang-ind.tex} +\loadcorefile{lang-ura.tex} -\input lang-vn.tex % vietnamese, maybe this belongs in lang-ita +\loadcorefile{lang-vn.tex} %D All kind of symbols are handled in: -\input symb-ini.tex +\loadcorefile{symb-ini.tex} + +%D Sorting: + +\loadcorefile{sort-ini.tex} %D Next we load some core macro's. These implement the %D macros' that are seen by the users. The order of loading %D is important, due to dependancies. -\input core-gen.tex -\input core-new.tex -\input core-uti.tex -\input core-mar.tex -\input core-mak.tex -\input core-dat.tex -\input core-grd.tex -\input core-ver.tex -\input core-vis.tex -%input core-con.tex -\input core-rul.tex -\input core-num.tex -\input core-tsp.tex % splitter -\input core-tab.tex -\input core-nav.tex -\input core-ref.tex -\input core-obj.tex -\input core-buf.tex -\input core-lst.tex -\input core-itm.tex -\input core-des.tex -\input core-mat.tex -\input core-syn.tex -\input core-spa.tex -\input core-sys.tex -\input core-pos.tex - -\input page-ini.tex -\input page-not.tex -\input page-one.tex -\input page-lay.tex -\input page-log.tex -\input page-txt.tex -\input page-sid.tex -\input page-flt.tex -\input page-mul.tex -\input page-set.tex -\input page-lyr.tex -\input page-mak.tex -\input page-num.tex -\input page-lin.tex -\input page-mar.tex -\input page-bck.tex -\input page-app.tex % unfinished -\input page-flw.tex % experimental: flows -\input page-spr.tex % experimental: spreads -\input page-plg.tex % experimental: plugins -\input page-str.tex % experimental: streams - -\input core-job.tex +\loadcorefile{core-spa.tex} +\loadcorefile{core-grd.tex} +\loadcorefile{core-mar.tex} +\loadcorefile{core-pos.tex} +\loadcorefile{core-mak.tex} +\loadcorefile{core-dat.tex} +\loadcorefile{core-ver.tex} +\loadcorefile{core-rul.tex} +\loadcorefile{core-vis.tex} +\loadcorefile{core-num.tex} +\loadcorefile{core-tsp.tex} +\loadcorefile{core-tab.tex} +\loadcorefile{core-nav.tex} +\loadcorefile{core-ref.tex} +\loadcorefile{core-obj.tex} +\loadcorefile{core-lst.tex} +\loadcorefile{core-itm.tex} +\loadcorefile{core-des.tex} +\loadcorefile{core-mat.tex} +\loadcorefile{core-syn.tex} +\loadcorefile{core-sys.tex} + +\loadcorefile{page-ini.tex} +\loadcorefile{page-bck.tex} +\loadcorefile{page-not.tex} +\loadcorefile{page-one.tex} +\loadcorefile{page-lay.tex} +\loadcorefile{page-log.tex} +\loadcorefile{page-txt.tex} +\loadcorefile{page-sid.tex} +\loadcorefile{page-flt.tex} +\loadcorefile{page-mul.tex} +\loadcorefile{page-set.tex} +\loadcorefile{page-lyr.tex} +\loadcorefile{page-mak.tex} +\loadcorefile{page-num.tex} +\loadcorefile{page-lin.tex} +\loadcorefile{page-mar.tex} + +\loadcorefile{core-job.tex} % why so late? % so far -\input core-sec.tex -\input page-imp.tex -\input core-tbl.tex -\input core-int.tex -\input core-ntb.tex -\input core-ltb.tex - -%D Like languages, fonts, encodings and symbols, \METAPOST\ -%D support is also organized in its own class of modules. - -\input meta-ini.tex -\input meta-pdf.tex -\input meta-pag.tex -\input meta-fig.tex - -%D On which the next one depends: - -\input core-pgr.tex -\input core-bar.tex -\input core-snc.tex +\loadcorefile{core-sec.tex} +\loadcorefile{core-buf.tex} +\loadcorefile{core-blk.tex} +\loadcorefile{page-imp.tex} +\loadcorefile{core-tbl.tex} +\loadcorefile{core-int.tex} +\loadcorefile{core-ntb.tex} +\loadcorefile{core-ltb.tex} %D A few more languages, that have specifics using core %D functionality: -\input lang-chi.tex -\input lang-jap.tex +\loadcorefile{lang-chi.tex} +\loadcorefile{lang-jap.tex} %D How about fill||in fields and related stuff? -\input java-ini.tex % needs a cleanup -\input core-fld.tex % needs a cleanup -\input core-hlp.tex % will become a m-module +\loadcorefile{java-ini.tex} +\loadcorefile{core-fld.tex} +\loadcorefile{core-hlp.tex} %D Registers can depend on fields, so we load that now. -\input core-reg.tex +\loadcorefile{core-reg.tex} %D Of course we do need fonts. There are no \TFM\ files %D loaded yet, so the format file is independant of their %D content. Here we also redefine \type{\it} as {\it italic} %D instead of italian. -\input font-ini.tex -\input font-uni.tex -\input font-bfm.tex +\loadcorefile{font-ini.tex} +\loadcorefile{font-uni.tex} +\loadcorefile{font-bfm.tex} -\input enco-pfr.tex % uses \everyfont +\loadcorefile{enco-pfr.tex} -\input type-ini.tex -\input type-def.tex +\loadcorefile{type-ini.tex} +\loadcorefile{type-def.tex} -\input meta-tex.tex % we need fonts +%D Properties. Don't ask. -\input prop-ini.tex -\input prop-lay.tex % needs core-ref.tex -\input prop-mis.tex +\loadcorefile{prop-ini.tex} +\loadcorefile{prop-lay.tex} +\loadcorefile{prop-mis.tex} -\input math-ini.tex % needs enco-ini.tex -\input math-ext.tex +%D Like languages, fonts, encodings and symbols, \METAPOST\ +%D support is also organized in its own class of modules. -%D Now we're ready for more core modules. +\loadcorefile{meta-ini.tex} +\loadcorefile{meta-pdf.tex} +\loadcorefile{meta-pag.tex} +\loadcorefile{meta-tex.tex} -\input core-fnt.tex % todo: document setupinitial ! -\input core-not.tex -\input core-lnt.tex % to be documented (with idris) +%D Special page handling (maybe even later) -\input core-mis.tex +\loadcorefile{page-flw.tex} +\loadcorefile{page-spr.tex} +\loadcorefile{page-plg.tex} +\loadcorefile{page-str.tex} -\input core-fig.tex % after page body -\input core-par.tex % maybe this should become a m-module +%D Hm. -\input core-box.tex +\loadcorefile{core-pgr.tex} +\loadcorefile{core-bar.tex} +\loadcorefile{core-snc.tex} -%D Language specific spacing. -\input lang-spa.tex +%D Math. -%D Sorting: +\loadcorefile{math-ini.tex} +\loadcorefile{math-ext.tex} -\input sort-ini.tex +%D Now we're ready for more core modules. -%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. +\loadcorefile{core-fnt.tex} +\loadcorefile{core-not.tex} +\loadcorefile{core-lnt.tex} -\input xtag-ini.tex -\input xtag-ext.tex -\input xtag-prs.tex -\input xtag-map.tex % may become obsolete -\input xtag-stk.tex -\input xtag-exp.tex -\input xtag-pre.tex -\input xtag-xsd.tex -\input xtag-rng.tex -%input xtag-ent.tex +\loadcorefile{core-mis.tex} -%D How about this: +\loadcorefile{core-trf.tex} +\loadcorefile{core-fig.tex} +\loadcorefile{core-par.tex} -\input meta-xml.tex % to be documented +\loadcorefile{core-box.tex} +\loadcorefile{page-app.tex} +\loadcorefile{meta-fig.tex} -%D Temporary hack, will go when we move to newtexexec: +%D Language specific spacing. -% \unprotect -% \appendtoks % newtexexec/newtexutil, after option file is loaded: -% \doif{\systemparameter\c!method} {2} -% {\def\TEXEXECcommand{texmfstart newtexexec} % -% \readsysfile {sort-ini} {} {}}% -% \to \everyjob -% \protect +\loadcorefile{lang-spa.tex} -% %D The next two modules implement some additional -% %D functionality concerning classes of documents and output. -% %D These modules probably will be replaced some day. -% -% \input docs-ini.tex % obsolete -% \input list-ini.tex % obsolete +%D Only the basic XML parser and remapper are part of the core. +%D These macros are loaded last since they overload and|/|or +%D extend previously defined ones. + +\loadcorefile{xtag-ini.tex} +\loadcorefile{xtag-ext.tex} +\loadcorefile{xtag-prs.tex} +\loadcorefile{xtag-map.tex} +\loadcorefile{xtag-stk.tex} +\loadcorefile{xtag-exp.tex} +\loadcorefile{xtag-pre.tex} +\loadcorefile{xtag-xsd.tex} +\loadcorefile{xtag-rng.tex} +%loadcorefile{xtag-ent.tex} + +%D How about this: + +\loadcorefile{meta-xml.tex} %D \TEX\ related logo's are always typeset in a special way. %D Here they come: -\input cont-log.tex +\loadcorefile{cont-log.tex} + +%D This one overloads af few things: + +\loadcorefile{core-ctx.tex} %D Defaults go here (more will be moved to this module %D later): -\input core-ini.tex -\input core-def.tex +\loadcorefile{core-lme.tex} +\loadcorefile{core-ini.tex} +\loadcorefile{core-def.tex} + +%D Preloaded modules (some need xml support): + +%usemodule[x][res-04] % xml resource libraries +%usemodule[x][res-08] % rlx runtime conversion +\usemodule[x][res-12] % rli external indentification %D At run time, a few more files are loaded, like: %D @@ -425,82 +498,88 @@ \startinterface english -\writestring{This package is based on Plain TeX. It uses an adapted version of the} -\writestring{extended mark mechanism of J. Fox (1987) and a few parts of the sidefloat} -\writestring{mechanism of D. Comenetz (1993). Most of D.E. Knuth's Plain TeX} -\writestring{(\fmtversion) is available and can be used without problems. This package} -\writestring{uses TaBlE, a package designed and copyrighted by M.J. Wichura (1988).} -\writestring{Only a few auxiliary files are generated, of which some must be processed} -\writestring{by TeXUtil (\utilityversion). The current blockversion is \blockversion.} +\writebanner{This package is based on Plain TeX. It uses an adapted version of the} +\writebanner{extended mark mechanism of J. Fox (1987) and a few parts of the sidefloat} +\writebanner{mechanism of D. Comenetz (1993). Most of D.E. Knuth's Plain TeX} +\writebanner{(\fmtversion) is available and can be used without problems. This package} +\writebanner{uses TaBlE, a package designed and copyrighted by M.J. Wichura (1988).} +\writebanner{Only a few auxiliary files are generated, of which some must be processed} +\writebanner{by TeXExec.} \stopinterface \startinterface dutch -\writestring{Dit pakket is gebaseerd op Plain TeX. Er wordt gebruik gemaakt van een} -\writestring{aangepaste versie van het mark mechanisme van J. Fox (1987) en onderdelen} -\writestring{van het sidefloat mechanisme van D. Comenetz (1993). De functionaliteit} -\writestring{van D.E. Knuth's Plain TeX (\fmtversion) is grotendeels beschikbaar en} -\writestring{kan zonder problemen worden gebruikt. Dit pakket gebruikt TaBlE, ontworpen door} -\writestring{M.J. Wichura (1988), die ook het auteursrecht bezit. Er worden slechts een} -\writestring{paar hulpfiles gegenereerd, waarvan er enkele moeten worden bewerkt door} -\writestring{TeXUtil (\utilityversion). Het blokmechanisme heeft versienummer \blockversion.} +\writebanner{Dit pakket is gebaseerd op Plain TeX. Er wordt gebruik gemaakt van een} +\writebanner{aangepaste versie van het mark mechanisme van J. Fox (1987) en onderdelen} +\writebanner{van het sidefloat mechanisme van D. Comenetz (1993). De functionaliteit} +\writebanner{van D.E. Knuth's Plain TeX (\fmtversion) is grotendeels beschikbaar en} +\writebanner{kan zonder problemen worden gebruikt. Dit pakket gebruikt TaBlE, ontworpen door} +\writebanner{M.J. Wichura (1988), die ook het auteursrecht bezit. Er worden slechts een} +\writebanner{paar hulpfiles gegenereerd, waarvan er enkele moeten worden bewerkt door} +\writebanner{TeXExec.} \stopinterface \startinterface german -\writestring{Dieses Paket basiert auf Plain-TeX und benutzt eine angepasste Version} -\writestring{des erweiterten mark-Mechanismus von J. Fox (1987) und einige Teile des} -\writestring{sidefloat-Mechanismus von D. Comenetz (1993). Ein Grossteil D.E. Knuths} -\writestring{Plain-TeX (\fmtversion) ist verfuegbar und kann ohne Probleme benutzt werden.} -\writestring{Dieses Paket benutzt TaBlE, ein von M.J. Wichura (1988) erstelltes und} -\writestring{geschuetztes Paket. Nur einige Hilfsdateien werden erstellt; einige davon} -\writestring{muessen von TeXUtil (\utilityversion) bearbeitet werden. Die aktuelle Block-} -\writestring{version ist \blockversion.} +\writebanner{Dieses Paket basiert auf Plain-TeX und benutzt eine angepasste Version} +\writebanner{des erweiterten mark-Mechanismus von J. Fox (1987) und einige Teile des} +\writebanner{sidefloat-Mechanismus von D. Comenetz (1993). Ein Grossteil D.E. Knuths} +\writebanner{Plain-TeX (\fmtversion) ist verfuegbar und kann ohne Probleme benutzt werden.} +\writebanner{Dieses Paket benutzt TaBlE, ein von M.J. Wichura (1988) erstelltes und} +\writebanner{geschuetztes Paket. Nur einige Hilfsdateien werden erstellt; einige davon} +\writebanner{muessen von TeXExec bearbeitet werden.} \stopinterface \startinterface czech -\writestring{Tento balik je zalozen na Plain TeXu. Pouziva prizpusobenou verzi} -\writestring{rozsireneho znackovaciho mechanismu J. Foxe (1987) a nekolik casti} -\writestring{sidefloat mechanismu D. Comenetze (1993). Vetsina prikazu Plain TeXu} -\writestring{D. E. Knutha (\fmtversion) je dostupna a muze byt bez problemu pouzita.} -\writestring{Tento balik pouziva balik TaBlE, ktery vytvoril M. J. Wichura (1988).} -\writestring{Je generovano jen nekolik pomocnych souboru, z nichz nektere musi byt} -\writestring{zpracovany programem TeXUtil (\utilityversion). Aktualni verze} -\writestring{} -\writestring{THE CZECH USER INTERFACE IS STILL UNDER DEVELOPMENT!} +\writebanner{Tento balik je zalozen na Plain TeXu. Pouziva prizpusobenou verzi} +\writebanner{rozsireneho znackovaciho mechanismu J. Foxe (1987) a nekolik casti} +\writebanner{sidefloat mechanismu D. Comenetze (1993). Vetsina prikazu Plain TeXu} +\writebanner{D. E. Knutha (\fmtversion) je dostupna a muze byt bez problemu pouzita.} +\writebanner{Tento balik pouziva balik TaBlE, ktery vytvoril M. J. Wichura (1988).} +\writebanner{Je generovano jen nekolik pomocnych souboru, z nichz nektere musi byt} +\writebanner{zpracovany programem TeXExec.} \stopinterface \startinterface italian -\writestring{Questo pacchetto è basato sul Plain TeX. Usa una versione adattata del} -\writestring{meccanismo di marcatura esteso di J. Fox (1987) ad alcune parti del} -\writestring{meccanismo per gli oggetti mobili laterali di D. Comenetz (1993).} -\writestring{La maggior parte del Plain TeX (\fmtversion) di D.E. Knuth è disponibile} -\writestring{e può essere usata senza problemi. Questo pacchetto usa TaBlE,} -\writestring{un pacchetto progettato da e con diritti di copia di M.J. Wichura (1988).} -\writestring{Vengono generati pochi file ausiliari, alcuni dei quali devono essere} -\writestring{elaborati da TeXUtil (\utilityversion). La versione attuale del blocco} -\writestring{è \blockversion.} -\writestring{} -\writestring{L'INTERFACCIA UTENTE ITALIANA E' ANCORA IN VIA DI SVILUPPO!} -\writestring{THE ITALIAN USER INTERFACE IS STILL UNDER DEVELOPMENT!} +\writebanner{Questo pacchetto è basato sul Plain TeX. Usa una versione adattata del} +\writebanner{meccanismo di marcatura esteso di J. Fox (1987) ad alcune parti del} +\writebanner{meccanismo per gli oggetti mobili laterali di D. Comenetz (1993).} +\writebanner{La maggior parte del Plain TeX (\fmtversion) di D.E. Knuth è disponibile} +\writebanner{e può essere usata senza problemi. Questo pacchetto usa TaBlE,} +\writebanner{un pacchetto progettato da e con diritti di copia di M.J. Wichura (1988).} +\writebanner{Vengono generati pochi file ausiliari, alcuni dei quali devono essere} +\writebanner{elaborati da TeXExec.} \stopinterface \startinterface romanian -\writestring{Acest pachet este bazat pe Plain TeX. Foloseste o versiune adaptata a} -\writestring{mecanismului extins de marcare a lui J. Fox (1987) si cateva parti a mecanismului } -\writestring{blocurilor marginale a lui D. Comenetz (1993). Cea mai mare parte a Plain Tex} -\writestring{(\fmtversion) a lui D.E. Knuth este disponibila si poate fi folosita fara probleme.} -\writestring{Acest pachet foloseste TaBlE, un pachet proiectat si creat de M.J. Wichura (1988).} -\writestring{Numai un numar de fisiere auxiliare sunt generate, din care unele trebuie procesate} -\writestring{de catre TeXUtil (\utilityversion). Versiunea curenta de blocuri este \blockversion.} +\writebanner{Acest pachet este bazat pe Plain TeX. Foloseste o versiune adaptata a} +\writebanner{mecanismului extins de marcare a lui J. Fox (1987) si cateva parti a mecanismului } +\writebanner{blocurilor marginale a lui D. Comenetz (1993). Cea mai mare parte a Plain Tex} +\writebanner{(\fmtversion) a lui D.E. Knuth este disponibila si poate fi folosita fara probleme.} +\writebanner{Acest pachet foloseste TaBlE, un pachet proiectat si creat de M.J. Wichura (1988).} +\writebanner{Numai un numar de fisiere auxiliare sunt generate, din care unele trebuie procesate} +\writebanner{de catre TeXExec.} + +\stopinterface + +\startinterface french + +\writebanner{Ce package est basé sur Plain TeX. Il utilise une version modifiée du} +\writebanner{mécanisme de marquage étendu de J. Fox (1987) et une partie du} +\writebanner{mécanisme de placement latéral des flottants de D. Comenetz (1993). La} +\writebanner{majeure partie de Plain TeX (\fmtversion) de D.E. Knuth est disponible} +\writebanner{et peut être utilisée sans problèmes. Ce package utilise TaBlE, un} +\writebanner{package conçu et copyrighté par M.J. Wichura (1988). Seul quelques} +\writebanner{fichiers auxiliaire sont générés, dont certains doivent être traités} +\writebanner{par TeXExec.} \stopinterface @@ -508,7 +587,7 @@ {Copyright 1990-\the\normalyear\normalspace / PRAGMA ADE / J. Hagen - A.F. Otten} -\writeline\writestring{\copyrightversion}\writeline +\writeline\writebanner{\copyrightversion}\writeline % %D Except from english, no hyphenation patterns are loaded % %D yet. Users can specify their needs in the next module: @@ -587,6 +666,15 @@ \stopinterface +\startinterface french + + \installlanguage [\s!fr] [\c!state=\v!start] + + \appendtoks \language [\s!fr] \to \everyjob + \appendtoks \mainlanguage [\s!fr] \to \everyjob + +\stopinterface + \protect %D Finally we (pre)load some fonts. diff --git a/tex/context/base/core-blk.tex b/tex/context/base/core-blk.tex new file mode 100644 index 000000000..a6e391e6e --- /dev/null +++ b/tex/context/base/core-blk.tex @@ -0,0 +1,678 @@ +%D \module +%D [ file=core-blk, % split off core-buf.tex +%D version=2000.01.05, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Blockmoves, +%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. + +% investigate etex's \readline and \scantokens + +\writestatus{loading}{Context Core Macros / Blockmoves} + +\startmessages dutch library: textblocks + title: tekstblokken + 1: nieuwe versie, tweede run nodig + 2: wegschrijven blokken naar -- + 3: inlezen blokken uit -- + 4: er is een tweede run nodig + 5: -- niet verborgen + 6: -- verborgen en verwerkt + 7: -- verborgen + 8: -- gehandhaafd + 9: -- niet gehandhaafd + 10: -- geladen en verwerkt + 11: -- geladen en geplaatst + 12: -- overgeslagen +\stopmessages + +\startmessages english library: textblocks + title: textblocks + 1: new version, second pass needed + 2: writing blocks to -- + 3: reading blocks from -- + 4: second pass needed + 5: -- not hidden + 6: -- hidden and processed + 7: -- hidden + 8: -- typeset + 9: -- not typeset + 10: -- loaded and processed + 11: -- loaded and typeset + 12: -- skipped +\stopmessages + +\startmessages german library: textblocks + title: textblock + 1: neue Version, zweiter Durchlauf benoetigt + 2: schreibe Bloecke zu -- + 3: lese Bloecke von -- + 4: zweiter Durchlauf benoetigt + 5: -- nicht verborgen + 6: -- verborgen und verarbeitet + 7: -- verborgen + 8: -- gesetzt + 9: -- nicht gesetzt + 10: -- geladen und verarbeitet + 11: -- geladen und gesetzt + 12: -- ausgelassen +\stopmessages + +\startmessages czech library: textblocks + title: textovyblok + 1: nova verze, je treba druhy beh + 2: zapisuji bloky do -- + 3: ctu bloky z -- + 4: je treba druhy beh + 5: -- neni skryto + 6: -- skryto a zpracovano + 7: -- skryto + 8: -- vysazeno + 9: -- nevysazeno + 10: -- nacteno a zpracovano + 11: -- nacteno a vysazeno + 12: -- preskoceno +\stopmessages + +\startmessages italian library: textblocks + title: blocchi di testo + 1: nuova versione, seconda passata necessaria + 2: scrittura dei blocchi su -- + 3: lettura dei blocchi da -- + 4: seconda passata necessaria + 5: -- non nascosto + 6: -- nascosto ed elaborato + 7: -- nascosto + 8: -- composto + 9: -- non composto + 10: -- caricato ed elaborato + 11: -- caricato e composto + 12: -- saltato +\stopmessages + +\startmessages norwegian library: textblocks + title: tekstblokker + 1: ny versjon, andre gjennomkjøring nødvendig + 2: skriver blokker til -- + 3: leser blokker fra -- + 4: andre gjennomkjøring nødvendig + 5: -- ikke skjult + 6: -- skjult og behandlet + 7: -- skjult + 8: -- tegnsatt + 9: -- ikke tegnsatt + 10: -- lest inn og behandlet + 11: -- lest inn og tegnsatt + 12: -- utelatt +\stopmessages + +\startmessages romanian library: textblocks + title: blocuri de text + 1: o noua versiune, este nevoie de inca o trecere + 2: se scriu blocurile in -- + 3: se citesc blocurile din -- + 4: este nevoie de inca o trecere + 5: -- nu este ascuns + 6: -- ascuns si procesat + 7: -- ascuns + 8: -- cules + 9: -- nu este cules + 10: -- incarcat si procesat + 11: -- incarcat si cules + 12: -- sarit peste +\stopmessages + +\startmessages french library: textblocks + title: blocs de texte + 1: nouvelle version, une seconde passe est nécessaire + 2: ecriture des blocs vers -- + 3: lecture des blocs en provenance de -- + 4: seconde passe nécessaire + 5: -- non caché + 6: -- caché et traité + 7: -- caché + 8: -- composé + 9: -- non composé + 10: -- chargé et traité + 11: -- chargé et composé + 12: -- sauté +\stopmessages + +\unprotect + +\def\blockversion {1996.03.10} + +\def\@@blockerrormessage + {\showmessage\m!textblocks1\empty + \global\let\@@blockerrormessage\relax} + +\def\thisisblockversion#1% + {\doifnot\blockversion{#1}{\@@blockerrormessage\endinput}} + +\def\stopcopyingblocks + {\ifcopyingblocks + \immediate\closeout\outblocks + \copyblockfile + \global\copyingblocksfalse + \fi} + +\def\dodosetblockcounters[#1]#2% + {\expanded{\setvalue{\??se\s!old#2}{\@@filterheadpart[#1]}}% + \doifnot{#2}\lastsection + {\expanded{\dodosetblockcounters[\@@filtertailpart[#1]]}% + {\getvalue{\??se#2\c!after}}}} % ???? + +\def\dosetblockcounters[#1]% + {\ifblockpermitted + \expanded{\dodosetblockcounters[\@@filtersecondpart[#1]]}\firstsection + \expanded{\setsectiontype[\@@filterfirstpart[#1]]}% + \def\@@sectionvalue##1{\getvalue{\??se\s!old##1}}% + \let\@@sectionconversion\secondoftwoarguments + \fi} + +\let\blockstatus\empty + +\def\setblockcounters + {\ifx\blockstatus\empty \else + \@EA\dosetblockcounters\@EA[\blockstatus]% + \fi} + +\def\getblockstatus#1% + {\dosetfilterlevel{\@@bscriterium}\empty + \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]} + {\global\blockpermittedtrue} + {\global\blockpermittedfalse}% + \def\blockstatus{#1}} + +\def\setupblockparameters + {\dodoubleargument\dosetupblockparameters} + +\def\dosetupblockparameters[#1][#2]% + {\getparameters[\??tb#1][#2]} + +\def\blockparameter#1#2% + {\@EA\csname\ifcsname\??tb#1#2\endcsname\??tb#1#2\else\s!empty\fi\endcsname} + +\ifx\outblocks\undefined \newwrite\outblocks \fi +\ifx\inpblocks\undefined \newread \inpblocks \fi +\ifx\tmpblocks\undefined \newwrite\tmpblocks \fi +\ifx\blockbox \undefined \newbox \blockbox \fi + +\newif\ifcopyingblocks +\newif\ifblockpermitted +\newif\iftmpblockstarted +\newif\ifoldinbijlagen +\newif\ifdoingblocks + +\newcount\blocklevel + +\def\setblocklevel#1% sign + {\global\advance\blocklevel #11 + \ifcase\blocklevel\doingblocksfalse\else\doingblockstrue\fi} + +\def\opentmpblock + {\immediate\openout\tmpblocks\TEXbufferfile{\f!utilityfilename\the\blocklevel}} + +\def\closetmpblock + {\immediate\write\tmpblocks{}% een lege regel is handig voor \par commando's + \immediate\closeout\tmpblocks} + +\def\writetmpblock#1% + {\iftmpblockstarted + \immediate\write\tmpblocks{#1}% + \else + \doifsomething{#1} + {\tmpblockstartedtrue + \immediate\write\tmpblocks{\string#1}}% + \fi} + +\def\startcopyingblocks + {\global\copyingblocksfalse} + +\def\checkcopyingblocks + {\ifcopyingblocks + \else + \immediate\openout\outblocks\f!utilityfilename.\f!blockextension% + \immediate\write\outblocks{\string\thisisblockversion{\blockversion}}% + \immediate\write\outblocks{\string\thisissectionseparator{\sectionseparator}}% + \global\copyingblockstrue + \fi} + +\def\stopcopyingblocks + {\ifcopyingblocks + \immediate\closeout\outblocks + \copyblockfile + \global\copyingblocksfalse + \fi} + +\def\nomoreblocks + {\stopcopyingblocks} + +\def\copyblockfile + {\ifcopyingblocks + \begingroup + \showmessage\m!textblocks2{\jobname.\f!blockextension}% + \openlocin\inpblocks{\f!utilityfilename.\f!blockextension}% + \immediate\openout\outblocks\jobname.\f!blockextension + \setupcopyblock + \catcode`\^^M=\@@ignore\relax + \def\copynextline + {\read\inpblocks to \!!stringa + \immediate\write\outblocks{\!!stringa}% + \ifeof\inpblocks\else\expandafter\copynextline\fi}% + \copynextline + \immediate\closein\inpblocks + \immediate\closeout\outblocks + \immediate\openout\tmpblocks\f!utilityfilename.\f!blockextension + \immediate\closeout\tmpblocks + \endgroup + \fi} + +\def\loadallblocks#1% + {\beginrestorecatcodes + \catcode`\^^M=\@@endofline\relax + \readjobfile{#1.\f!blockextension} + {\showmessage\m!textblocks3{#1.\f!blockextension}} + {\showmessage\m!textblocks4\empty}% + \endrestorecatcodes} + +\def\setupcopyblock + {\setcatcodetable\vrbcatcodes + \obeylines} + +\def\writeoutblocks + {\immediate\write\outblocks} + +\long\def\processnextblocklineAB#1% #2#3% + {\convertargument#1 \to\next + \doifinstringelse\endofblockA\next + \firstoftwoarguments + {\doifinstringelse\endofblockB\next + \firstoftwoarguments\secondoftwoarguments}} + +\bgroup +\obeylines +\long\gdef\copyblocklineAB#1 + {\processnextblocklineAB{#1}\closeblock{\writeoutblocks{#1}\writetmpblock{#1}\copyblocklineAB}} +\long\gdef\skipblocklineAB#1 + {\processnextblocklineAB{#1}\closeblock\skipblocklineAB} +\egroup + +\long\def\processnextblockline#1% #2#3% + {\convertargument#1 \to\next + \ifx\next\emptybufferline + \expandafter\secondoftwoarguments% #3% + \else + \emptybufferlinefalse + \doifinstringelse\endofblock\next + {\expandafter\firstoftwoarguments }% #2} + {\expandafter\secondoftwoarguments}% #3}% + \fi} + +\bgroup +\obeylines +\long\gdef\copyblockline#1 + {\processnextblockline{#1}\closeblock{\writeoutblocks{#1}\writetmpblock{#1}\copyblockline}} +\long\gdef\skipblockline#1 + {\processnextblockline{#1}\closeblock\skipblockline} +\egroup + +\def\skipblock#1% + {\checkcopyingblocks + \@EA\convertargument\string\thiswasblock{#1}\to\endofblock + %testen : \expanded{\convertargument\string\thiswasblock{#1}\noexpand\to\noexpand\endofblock}% + \let\openblock\begingroup + \let\closeblock\endgroup + \openblock + \setupcopyblock + \skipblockline} + +\let\doafterblock \gobbletwoarguments +\let\dobeforeblock\gobbletwoarguments + +\def\thisisblock#1% + {\executeifdefined{\s!thisisblock#1}{\skipblock{#1}}} + +\def\thiswasblock#1% + {\getvalue{\s!thiswasblock#1}} + +\def\saveblock#1#2% + {\checkcopyingblocks + \obeylines + \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA + %testen: \expanded{\convertargument\string\csname\e!end#1\endcsname\to\endofblockA}% + \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN + \def\openblock + {\dobeforeblock{#1}{#2}% + \opentmpblock + \begingroup + \makesectionformat + \immediate\write\outblocks{}% + \immediate\write\outblocks{\string\thisisblock{#1}{\sectionformat}[#2]}}% + \def\closeblock + {\immediate\write\outblocks{}% handig voor \par commando's + \immediate\write\outblocks{\string\thiswasblock{#1}}% + \endgroup + \closetmpblock + \doafterblock{#1}{#2}% + \egroup}% + \openblock + \setupcopyblock + \copyblocklineAB} + +\def\copyblock + {\let\opentmpblock\empty + \let\closetmpblock\empty + \let\writetmpblock\gobbleoneargument + \saveblock} + +\def\loadoneblock + {\edef\blockfilename{\TEXbufferfile{\f!utilityfilename\the\blocklevel}}% + \setblocklevel+% + \readjobfile\blockfilename\donothing\donothing + \setblocklevel-}% + +\def\dodefineblock[#1]% + {\bypassblock[#1]% + \keepblocks[#1]% + \setupblock + [#1] + [\c!before=\blank, + \c!after=\blank, + \c!inner=, + \c!style=, + \c!file=\jobname]} + +% \def\defineblock +% {\dosingleargumentwithset\dodefineblock} + +\def\defineblock + {\dosingleargument\dodefineblock} + +\def\dosetupblock[#1][#2]% + {\getparameters[\??tb#1][#2]} + +\def\setupblock + {\dodoubleargumentwithset\dosetupblock} + +\def\bypassblock[#1]% + {\setvalue{\s!thisisblock#1}##1[##2]{\skipblock{#1}}} + +\def\dohideblock[#1][#2][#3]% + {\doifassignmentelse{#3} + {\dodohideblock[#1][#2][][#3]} + {\dodohideblock[#1][#2][#3][]}} + +\def\dodohideblock[#1][#2][#3][#4]% + {\doifelsenothing{#2} + {\global\blockpermittedfalse + \edef\blocktitle{#1}} + {\doifelsenothing{#3} + {\global\blockpermittedtrue + \edef\blocktitle{#1}} + {\doifcommonelse{#2}{#3} + {\global\blockpermittedfalse + \edef\blocktitle{#1:#2}} + {\global\blockpermittedtrue + \edef\blocktitle{#1:#3}}}}% + \ifblockpermitted + \showwarning\m!textblocks5\blocktitle + \def\next + {\def\dobeforeblock####1####2% + {\begingroup}% + \def\doafterblock####1####2% + {\endgroup + \doexecuteloadedblock{#1}{#4}}% + \saveblock{#1}{#3#4}}% + \else + \doifinsetelse{+}{#3} + {\showwarning\m!textblocks6\blocktitle + \def\next + {\def\dobeforeblock####1####2% + {\begingroup + \visiblefalse}% + \def\doafterblock####1####2% + {{\setbox0\vbox + {\catcode`\^^M=\@@endofline\relax + \loadoneblock + \par}}% + \endgroup}% + \saveblock{#1}{#3#4}}}% + {\showwarning\m!textblocks7\blocktitle + \def\next + {\def\dobeforeblock####1####2% + {\begingroup + \globaldefs\minusone}% + \def\doafterblock####1####2% + {\endgroup}% + \copyblock{#1}{#3#4}}}% + \fi + \next} + +\def\dohideblocks[#1][#2]% + {\def\docommand##1% + {\setvalue{\e!begin##1}% + {\bgroup\obeylines\dotripleempty\dohideblock[##1][#2]}}% + \processcommalist[#1]\docommand} + +\def\hideblocks + {\dodoubleempty\dohideblocks} + +\def\doexecuteloadedblock#1#2% + {\blockpermittedtrue % ? + \bgroup % before \c!before (think of: \c!before=\startitemize) + \dosetupblockparameters[#1][#2]% voor 'voor'? + \getvalue{\??tb#1\c!before}% + \dostartattributes{\??tb#1}\c!style\c!color\empty + \visibletrue + \catcode`\^^M=\@@endofline\relax + \getvalue{\??tb#1\c!inner}% + \ignorespaces + \loadoneblock + % \par moved + \dostopattributes + \getvalue{\??tb#1\c!after}% + \par + \egroup} + +\def\dokeepblock[#1][#2][#3]% + {\doifassignmentelse{#3} + {\dodokeepblock[#1][#2][][#3]} + {\dodokeepblock[#1][#2][#3][]}} + +\def\dodokeepblock[#1][#2][#3][#4]% + {\doifelsenothing{#2} + {\global\blockpermittedtrue + \edef\blocktitle{#1}} + {\doifcommonelse{#2}{#3} + {\global\blockpermittedtrue + \edef\blocktitle{#1:#2}} + {\doifinsetelse\v!all{#2} + {\doifelsenothing{#3} + {\global\blockpermittedtrue + \edef\blocktitle{#1}} + {\global\blockpermittedfalse + \edef\blocktitle{#1:#3}}} + {\global\blockpermittedfalse + \doifelsenothing{#3} + {\edef\blocktitle{#1}} + {\edef\blocktitle{#1:#3}}}}}% + \ifblockpermitted + \showwarning\m!textblocks8\blocktitle + \def\dobeforeblock##1##2% + {\begingroup}% + \def\doafterblock##1##2% + {\endgroup + \doexecuteloadedblock{#1}{#4}}% + \else + \showwarning\m!textblocks9\blocktitle + \fi + \saveblock{#1}{#3#4}} + +\def\dokeepblocks[#1][#2]% + {\def\docommand##1% + {\setvalue{\e!begin##1}% + {\bgroup\obeylines\dotripleempty\dokeepblock[##1][#2]}}% + \processcommalist[#1]\docommand} + +\def\keepblocks + {\dodoubleempty\dokeepblocks} + +\newconditional\processblockstatus +\newconditional\dummyblockstatus +\newconditional\blockassignmentstatus + +\def\dodouseblock#1#2#3#4% + {\getblockstatus{#2}% + \ifblockpermitted + \setfalse\dummyblockstatus + \doifassignmentelse{#3} + {\settrue \blockassignmentstatus} + {\setfalse\blockassignmentstatus}% + \doifelsenothing{#4} + {\edef\blocktitle{#1}} + {\ifconditional\blockassignmentstatus + \edef\blocktitle{#1}% + \else + \doifnotcommon{#3}{#4} + {\ifconditional\processblockstatus + \settrue\dummyblockstatus + \else + \global\blockpermittedfalse + \fi}% + \edef\blocktitle{#1:#3}% + \fi}% + \else + \edef\blocktitle{#1}% + \fi + \ifblockpermitted + \setblocklevel+% + \ifconditional\blockassignmentstatus \else + \doifinset{-}{#3}{\settrue\dummyblockstatus}% + \fi + \ifconditional\dummyblockstatus + \showwarning\m!textblocks{10}\blocktitle + \setvalue{\s!thiswasblock#1}% + {\removeunwantedspaces + \par + \egroup + \setblocklevel-}% + \def\next + {\setbox0\vbox\bgroup + \ifconditional\blockassignmentstatus + \dosetupblockparameters[#1][#3]% + \fi}% + \else + \showwarning\m!textblocks{11}\blocktitle + \setvalue{\s!thiswasblock#1}% + {\removeunwantedspaces + % \par moved + \dostopattributes + \getvalue{\??tb#1\c!after}% + \par + \egroup + \setblocklevel-}% + \def\next + {\bgroup + \ifconditional\blockassignmentstatus + \dosetupblockparameters[#1][#3]% + \fi + \getvalue{\??tb#1\c!before}% + \dostartattributes{\??tb#1}\c!style\c!color\empty + \visibletrue + \getvalue{\??tb#1\c!inner}% + \ignorespaces}% + \fi + \else + \def\next + {\showwarning\m!textblocks{12}\blocktitle + \skipblock{#1}}% + \fi + \next} + +\def\douseblock[#1][#2]% + {\setvalue{\s!thisisblock#1}##1[##2]{\dodouseblock{#1}{##1}{##2}{#2}}} + +\def\dodouseblocks[#1][#2]% + {\def\docommand##1% + {\douseblock[##1][#2]}% + \processcommalist[#1]\docommand + \dogetcommalistelement1\from#1\to\commalistelement + \doifdefined{\??tb\commalistelement\c!file} + {\loadallblocks{\getvalue{\??tb\commalistelement\c!file}}}% + \endgroup} + +\def\douseblocks + {\begingroup + \doassign[\??bs][\c!criterium=\v!all]% + \dodoubleempty\dodouseblocks} + +\def\useblocks + {\setfalse\processblockstatus\douseblocks} + +\def\processblocks + {\settrue \processblockstatus\douseblocks} + +\def\doselectblocks[#1][#2][#3]% + {\begingroup + \doifelsenothing{#3} + {\getparameters[\??bs][\c!criterium=\v!all,#2]% + \dodouseblocks[#1][]} + {\getparameters[\??bs][\c!criterium=\v!all,#3]% + \dodouseblocks[#1][#2]}}% + +\def\selectblocks + {\dotripleempty\doselectblocks} + +\def\beginblock[#1]% % we also check \endblock[..] + {\getvalue{\e!begin#1}} + +\def\forceblocks[#1]% + {\def\docommand##1% + {\setvalue{\e!begin##1}% + {\setblocklevel+\bgroup + \dodoubleempty\doforceblock[##1]}% + \setvalue{\e!end##1}% + {\dostopattributes + \getvalue{\??tb##1\c!after}% + \egroup\setblocklevel-}}% + \processcommalist[#1]\docommand} + +\def\doforceblock[#1][#2]% + {\doifassignmentelse{#2} + {\settrue \blockassignmentstatus} + {\setfalse\blockassignmentstatus}% + \ifconditional\blockassignmentstatus + \dosetupblockparameters[#1][#2]% + \fi + \getvalue{\??tb#1\c!before}% + \dostartattributes{\??tb#1}\c!style\c!color\empty + \getvalue{\??tb#1\c!inner}% + \ignorespaces} + +\def\bypassblocks[#1]% + {\def\docommand##1% + {\setvalue{\e!begin##1}% + {\setblocklevel+\bgroup + \obeylines % here, since we look ahead + \dodoubleempty\dobypassblock[##1]}%}% + \setvalue{\e!end##1}% + {}}% + \processcommalist[#1]\docommand} + +\def\dobypassblock[#1][#2]% + {\def\closeblock + {\egroup\setblocklevel-}% + \checkcopyingblocks + \obeylines + \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA + \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN + \setupcopyblock + \skipblocklineAB} + +\protect \endinput diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex index 184f0647c..16a894151 100644 --- a/tex/context/base/core-box.tex +++ b/tex/context/base/core-box.tex @@ -1,8 +1,8 @@ %D \module %D [ file=core-box, %D version=2002.04.12, -%D title=\CONTEXT\ Box Macros, -%D subtitle=New Macros, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Boxes, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\writestatus{loading}{Context Core Macros / Boxes} + %D This module contains all kind of macros for moving content %D around. Many macros here come from other modules, but %D depencies made it more clear to isolate them. @@ -108,7 +110,7 @@ {\setvalue{\??an#1}{\dodefinedanchor[#2][#3][#4]}} \def\dodefinedanchor[#1][#2][#3]% - {\def\docommando[##1][##2]% + {\def\docommand[##1][##2]% {\ifsecondargument \def\next{\dodoanchorT[#1][#2,##1][#3,##2]}% \else\iffirstargument @@ -117,7 +119,7 @@ \def\next{\dodoanchorT[#1][#2][#3]}% \fi\fi \next}% - \dodoubleempty\docommando} + \dodoubleempty\docommand} \def\@@collectorbox{@@collectorbox} @@ -141,8 +143,8 @@ {\dodoubleargument\dosetupcollector} \def\dosetupcollector[#1][#2]% - {\def\docommando##1{\getparameters[\??cb##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??cb##1][#2]}% + \processcommalist[#1]\docommand} \def\setcollector {\dodoubleargument\dosetcollector} @@ -875,12 +877,12 @@ % {\dontleavehmode % \bgroup % \scratchdimen\zeropoint -% \def\docommando##1% +% \def\docommand##1% % {\setbox\scratchbox\hbox{##1}% % \ifdim\wd\scratchbox>\scratchdimen % \scratchdimen\wd\scratchbox % \fi}% -% \processcommalist[#3]\docommando +% \processcommalist[#3]\docommand % \hbox to \scratchdimen{#1#4#2}% % \egroup} % diff --git a/tex/context/base/core-buf.mkii b/tex/context/base/core-buf.mkii new file mode 100644 index 000000000..9a803764c --- /dev/null +++ b/tex/context/base/core-buf.mkii @@ -0,0 +1,143 @@ +%D \module +%D [ file=core-buf, % blocks are moved to core-blk +%D version=2000.01.05, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Buffers, +%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 + +\def\mkresetbuffer + {\unlinkfile{\TEXbufferfile\currentbuffer}} + +\long\def\mksetbuffer#1% + {\edef\bufferfilename{\TEXbufferfile{\currentbuffer}}% + \immediate\openout\tmpblocks\bufferfilename + \convertargument#1\to\ascii + \immediate\write\tmpblocks{\ascii}% + \immediate\closeout\tmpblocks} + +\def\mkstartbuffer#1#2#3#4#5% ook grabben a la mkiv / no, we need to add par anchors + {\doifelsenothing{#4} + {\letbeundefined{\e!stop\v!buffer}% % \let\stopbuffer=\relax % \undefined + \@EA\@EA\@EA\convertargument\@EA\e!start\v!buffer\to\beginofblock % else a space + \@EA\@EA\@EA\convertargument\@EA\e!stop \v!buffer\to\endofblock + \ifcase\buffernestmode + \let\processnextbufferline\processnextbufferlineB + \else + \let\processnextbufferline\processnextbufferlineA + \fi} + {\letbeundefined{#4}% \letvalue{#4}=\relax % \undefined + \@EA\convertargument\csname#3\endcsname\to\beginofblock + \@EA\convertargument\csname#4\endcsname\to\endofblock + \ifcase\buffernestmode + \let\processnextbufferline\processnextbufferlineB + \or + \let\processnextbufferline\processnextbufferlineB + \else + \let\processnextbufferline\processnextbufferlineA + \fi}% + \def\closebufferfile + {\ifsegmentatebuffer + \immediate\write\tmpblocks{\string\stopbufferparagraph}% + \fi + \immediate\closeout\tmpblocks + #5% \egroup + \getvalue{#4}}% + \doifelsenothing{#2} + {\edef\bufferfilename{\TEXbufferfile\jobname}}% + {\edef\bufferfilename{\TEXbufferfile{#2}}}% + \immediate\openout\tmpblocks\bufferfilename + \ifsegmentatebuffer + \immediate\write\tmpblocks{\string\startbufferparagraph}% + \fi + \newcounter\nestedbufferlevel + \recatcodeuppercharacterstrue + \setcatcodetable\vrbcatcodes + \obeylines + \copybufferline} + +\def\mkdobuffer#1% command + {\beginrestorecatcodes + #1% + \endrestorecatcodes} + +\def\mkgetbuffer {\readjobfile{\TEXbufferfile{\currentbuffer}}\donothing\donothing} +\def\mktypebuffer{\typefile{\TEXbufferfile{\currentbuffer}}} + +% support macros + +\expandafter \convertargument \gobbleoneargument @ \to \emptybufferline + +\ifx\tmpblocks\undefined \newwrite\tmpblocks \fi + +\newif\iftmpblockstarted + +\def\flushbufferline#1% + {\iftmpblockstarted + \ifsegmentatebuffer + \ifemptybufferline + \immediate\write\tmpblocks{\string\stopbufferparagraph }% + \immediate\write\tmpblocks{\string\startbufferparagraph}% + \else + \immediate\write\tmpblocks{#1}% + \fi + \else + \immediate\write\tmpblocks{#1}% + \fi + \else + \doifsomething{#1} + {\tmpblockstartedtrue + \immediate\write\tmpblocks{\string#1}}% + \fi} + +\long\def\processnextbufferlineA#1% + {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run + \convertargument#1 \to\next + \doifinstringelse{\delcharacter\letterpercent}{\delcharacter\next} + {\secondoftwoarguments} + {\doifincsnameelse\endofblock\next + {\ifnum\nestedbufferlevel=\zerocount + \expandafter\firstoftwoarguments + \else + \decrement\nestedbufferlevel\relax + \expandafter\secondoftwoarguments + \fi} + {\doifincsnameelse\beginofblock\next + {\increment\nestedbufferlevel\relax + \secondoftwoarguments} + {\secondoftwoarguments}}}} + +\long\def\processnextbufferlineB#1% #2#3% + {\convertargument#1 \to\next + \ifx\next\emptybufferline + \ifsegmentatebuffer \emptybufferlinetrue \fi + \expandafter\secondoftwoarguments% #3% + \else + \emptybufferlinefalse + \doifinstringelse\endofblock\next + {\expandafter\firstoftwoarguments }% #2} + {\expandafter\secondoftwoarguments}% #3}% + \fi} + +\bgroup +\obeylines +\long\gdef\copybufferline#1 + {\processnextbufferline{#1}\closebufferfile{\flushbufferline{#1}\copybufferline}} +\egroup + +% kind of obsolete with mkiv + +\def\mkstartmemorybuffer + {\dosingleempty\dostartmemorybuffer} + +\long\def\dostartmemorybuffer[#1]#2\stopbuffer + {\setbuffer[#1]#2\endbuffer} + +\protect \endinput diff --git a/tex/context/base/core-buf.tex b/tex/context/base/core-buf.tex index 73c93b356..ad98788a3 100644 --- a/tex/context/base/core-buf.tex +++ b/tex/context/base/core-buf.tex @@ -1,8 +1,8 @@ %D \module -%D [ file=core-buf, +%D [ file=core-buf, % blocks are moved to core-blk %D version=2000.01.05, %D title=\CONTEXT\ Core Macros, -%D subtitle=Buffers and Blockmoves, +%D subtitle=Buffers, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -11,196 +11,37 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% investigate etex's \readline and \scantokens +\writestatus{loading}{Context Core Macros / Buffers} -\writestatus{loading}{Context Core Macros / Buffers and Blockmoves} - -\startmessages dutch library: textblocks - title: tekstblokken - 1: nieuwe versie, tweede run nodig - 2: wegschrijven blokken naar -- - 3: inlezen blokken uit -- - 4: er is een tweede run nodig - 5: -- niet verborgen - 6: -- verborgen en verwerkt - 7: -- verborgen - 8: -- gehandhaafd - 9: -- niet gehandhaafd - 10: -- geladen en verwerkt - 11: -- geladen en geplaatst - 12: -- overgeslagen -\stopmessages - -\startmessages english library: textblocks - title: textblocks - 1: new version, second pass needed - 2: writing blocks to -- - 3: reading blocks from -- - 4: second pass needed - 5: -- not hidden - 6: -- hidden and processed - 7: -- hidden - 8: -- typeset - 9: -- not typeset - 10: -- loaded and processed - 11: -- loaded and typeset - 12: -- skipped -\stopmessages - -\startmessages german library: textblocks - title: textblock - 1: neue Version, zweiter Durchlauf benoetigt - 2: schreibe Bloecke zu -- - 3: lese Bloecke von -- - 4: zweiter Durchlauf benoetigt - 5: -- nicht verborgen - 6: -- verborgen und verarbeitet - 7: -- verborgen - 8: -- gesetzt - 9: -- nicht gesetzt - 10: -- geladen und verarbeitet - 11: -- geladen und gesetzt - 12: -- ausgelassen -\stopmessages +\unprotect -\startmessages czech library: textblocks - title: textovyblok - 1: nova verze, je treba druhy beh - 2: zapisuji bloky do -- - 3: ctu bloky z -- - 4: je treba druhy beh - 5: -- neni skryto - 6: -- skryto a zpracovano - 7: -- skryto - 8: -- vysazeno - 9: -- nevysazeno - 10: -- nacteno a zpracovano - 11: -- nacteno a vysazeno - 12: -- preskoceno -\stopmessages +\let\mkresetbuffer \donothing +\let\mksetbuffer \gobbleoneargument +\let\mkstartbuffer \gobblefivearguments +\let\mkdobuffer \gobbleoneargument +\let\mkstartmemorybuffer\startbuffer +\let\mkstartfilebuffer \startbuffer +\let\mkgetbuffer \donothing +\let\mktypebuffer \donothing -\startmessages italian library: textblocks - title: blocchi di testo - 1: nuova versione, seconda passata necessaria - 2: scrittura dei blocchi su -- - 3: lettura dei blocchi da -- - 4: seconda passata necessaria - 5: -- non nascosto - 6: -- nascosto ed elaborato - 7: -- nascosto - 8: -- composto - 9: -- non composto - 10: -- caricato ed elaborato - 11: -- caricato e composto - 12: -- saltato -\stopmessages +\chardef\buffernestmode\plusone % 0: not nested, 1: startbuffer nested, 2: all buffers nested -\startmessages norwegian library: textblocks - title: tekstblokker - 1: ny versjon, andre gjennomkjøring nødvendig - 2: skriver blokker til -- - 3: leser blokker fra -- - 4: andre gjennomkjøring nødvendig - 5: -- ikke skjult - 6: -- skjult og behandlet - 7: -- skjult - 8: -- tegnsatt - 9: -- ikke tegnsatt - 10: -- lest inn og behandlet - 11: -- lest inn og tegnsatt - 12: -- utelatt -\stopmessages +\newif\ifsegmentatebuffer +\newif\ifemptybufferline -\startmessages romanian library: textblocks - title: blocuri de text - 1: o noua versiune, este nevoie de inca o trecere - 2: se scriu blocurile in -- - 3: se citesc blocurile din -- - 4: este nevoie de inca o trecere - 5: -- nu este ascuns - 6: -- ascuns si procesat - 7: -- ascuns - 8: -- cules - 9: -- nu este cules - 10: -- incarcat si procesat - 11: -- incarcat si cules - 12: -- sarit peste -\stopmessages +\def\currentbuffer{\jobname} -\startmessages french library: textblocks - title: blocs de texte - 1: nouvelle version, une seconde passe est nécessaire - 2: ecriture des blocs vers -- - 3: lecture des blocs en provenance de -- - 4: seconde passe nécessaire - 5: -- non caché - 6: -- caché et traité - 7: -- caché - 8: -- composé - 9: -- non composé - 10: -- chargé et traité - 11: -- chargé et composé - 12: -- sauté -\stopmessages +\def\setcurrentbuffer#1% + {\doifelsenothing{#1}{\edef\currentbuffer{\jobname}}{\edef\currentbuffer{#1}}} -\unprotect - -% more accurate -% -% \@EA\convertcommand\csname\e!start\v!buffer\endcsname\to\beginofblock % else a space -% \@EA\convertcommand\csname\e!stop\v!buffer \endcsname\to\endofblock - \def\resetbuffer {\dosingleempty\doresetbuffer} \def\doresetbuffer[#1]% - {\unlinkfile{\TEXbufferfile{\iffirstargument#1\else\jobname\fi}}} - -% \EveryPar% -% {\doglobal\newcounter\NOfLines} -% -% \EveryLine% -% {\doglobal\increment\NOfLines% -% \hskip-3em% -% \hbox to 3em{\hss\NOfLines\hskip1em}} - -%D For Willy's nested commented buffers, we need the \type -%D {\delcharacter} trick. - -%\def\processnextbufferline#1% needs testing ! ! ! ! -% {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run -% \convertargument#1 \to\next -% \doifinstringelse{\delcharacter\texcommentsymbol}{\delcharacter\next} -% {\let\next\secondoftwoarguments} -% {\doifincsnameelse\endofblock\next -% {\ifnum\nestedbufferlevel=\zerocount -% \let\next\firstoftwoarguments -% \else -% \decrement\nestedbufferlevel\relax -% \let\next\secondoftwoarguments -% \fi} -% {\doifincsnameelse\beginofblock\next -% {\increment\nestedbufferlevel\relax -% \let\next\secondoftwoarguments} -% {\let\next\secondoftwoarguments}}}% -% \next} - -\long\def\processnextbufferline#1% - {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run - \convertargument#1 \to\next - \doifinstringelse{\delcharacter\texcommentsymbol}{\delcharacter\next} - {\secondoftwoarguments} - {\doifincsnameelse\endofblock\next - {\ifnum\nestedbufferlevel=\zerocount - \expandafter\firstoftwoarguments - \else - \decrement\nestedbufferlevel\relax - \expandafter\secondoftwoarguments - \fi} - {\doifincsnameelse\beginofblock\next - {\increment\nestedbufferlevel\relax - \secondoftwoarguments} - {\secondoftwoarguments}}}} + {\begingroup + \setcurrentbuffer{#1}% + \mkresetbuffer + \endgroup} \def\dostartbuffer {\bgroup @@ -209,107 +50,34 @@ \def\dodostartbuffer[#1][#2][#3][#4]% upward compatible {\iffourthargument - \def\next{\dododostartbuffer[#1][#2][#3][#4]}% + \def\next{\dododostartbuffer{#1}{#2}{#3}{#4}}% \else - \def\next{\dododostartbuffer[][#1][#2][#3]}% + \def\next{\dododostartbuffer {}{#1}{#2}{#3}}% \fi \next} -\chardef\buffernestmode\plusone % 0: not nested, 1: startbuffer nested, 2: all buffers nested - -\def\dododostartbuffer[#1][#2][#3][#4]% +\def\dododostartbuffer#1#2#3#4% {%\showmessage\m!systems{15}{#2}% \doifelsevalue{\??bu#1\c!paragraph}\v!yes - {\segmentatebuffertrue} + {\segmentatebuffertrue} % todo in mkiv {\doifnumberelse{\getvalue{\??bu#1\c!paragraph}}\segmentatebuffertrue\segmentatebufferfalse}% \doifvalue{\??bu#1\c!local}\v!yes {\chardef\buffernestmode\plustwo}% permit nesting - \doifelsenothing{#4} - {\letbeundefined{\e!stop\v!buffer}% % \let\stopbuffer=\relax % \undefined - \@EA\@EA\@EA\convertargument\@EA\e!start\v!buffer\to\beginofblock % else a space - \@EA\@EA\@EA\convertargument\@EA\e!stop \v!buffer\to\endofblock - \ifcase\buffernestmode \else - \let\processnextblockline\processnextbufferline - \fi} - {\letbeundefined{#4}% \letvalue{#4}=\relax % \undefined - \@EA\convertargument\csname#3\endcsname\to\beginofblock - \@EA\convertargument\csname#4\endcsname\to\endofblock - \ifcase\buffernestmode \or \else - \let\processnextblockline\processnextbufferline - \fi}% - \def\closeblock - {\ifsegmentatebuffer - \immediate\write\tmpblocks{\string\stopbufferparagraph}% - \fi - \immediate\closeout\tmpblocks - \egroup - \getvalue{#4}}% - \doifelsenothing{#2} - {\edef\bufferfilename{\TEXbufferfile\jobname}}% - {\edef\bufferfilename{\TEXbufferfile{#2}}}% - \message{<\bufferfilename>}% - \immediate\openout\tmpblocks\bufferfilename - \ifsegmentatebuffer - \immediate\write\tmpblocks{\string\startbufferparagraph}% - \fi - \newcounter\nestedbufferlevel - \setupcopyblock - \let\writeoutblocks\gobbleoneargument - \copyblockline} + \setcurrentbuffer{#2}% + \mkstartbuffer{#1}{#2}{#3}{#4}{\egroup}} \letvalue{\e!start\v!buffer}\dostartbuffer -% \setbuffer[name]#2\endbuffer : saves to file #1.tmp +\let\endbuffer\undefined % to please the dep parser -\def\setbuffer[#1]#2\endbuffer - {\edef\bufferfilename{\TEXbufferfile{#1}}% - \message{<\bufferfilename>}% - \immediate\openout\tmpblocks\bufferfilename - \convertargument#2\to\ascii - \immediate\write\tmpblocks{\ascii}% - \immediate\closeout\tmpblocks} - -\def\dodobuffer#1#2% - {\beginrestorecatcodes - \ifundefined{\??bu#2\c!number}% - \edef\bufferfilename{\TEXbufferfile{#2}}% - \else - \edef\bufferfilename{\TEXbufferfile{def-\getvalue{\??bu#2\c!number}}}% - \fi - #1\bufferfilename\donothing\donothing - \endrestorecatcodes} +\def\setbuffer + {\dosingleempty\dosetbuffer} -\def\dobuffer#1[#2]#3% - {\doifelsenothing{#2} - {\dodobuffer#3\jobname} - {\processcommalist[#2]{\dodobuffer#3}}} - -\def\processTEXbuffer - {\dodoubleempty\doprocessTEXbuffer} - -\def\doprocessTEXbuffer[#1][#2]% - {\ifsecondargument - \dodoprocessTEXbuffer[#1][#2]% - \else - \dodoprocessTEXbuffer[][#1]% - \fi} - -\def\dodoprocessTEXbuffer[#1][#2]% - {\getvalue{\??bu#1\c!before}% - \dobuffer{16}[#2]\readjobfile - \getvalue{\??bu#1\c!after}} - -\let\getbuffer\processTEXbuffer % handy - -\def\typebuffer - {\dodoubleempty\dotypebuffer} - -\def\dotypebuffer[#1][#2]% - {\iffirstargument - \dobuffer{17}[#1]\typefile - \else - \dobuffer{17}[#2]\typefile - \fi} +\def\dosetbuffer[#1]#2\endbuffer % seldom used so we just pass #2 + {\begingroup + \setcurrentbuffer{#1}% + \mksetbuffer{#2}% + \endgroup} \def\setupbuffer {\dodoubleempty\dosetupbuffer} @@ -324,49 +92,65 @@ \def\dodefinebuffer[#1][#2]% {\iffirstargument % else problems \doglobal\increment\nofdefinedbuffers - \letvalue{\??bu#1\c!number}\nofdefinedbuffers + \letvalue{\??bu#1\c!number }\nofdefinedbuffers \letvalue{\??bu#1\c!paragraph}\v!no - \setevalue{\e!start#1}% - {\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% - \setevalue{\e!get#1}% - {\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}% - \setevalue{\e!type#1}% - {\noexpand\dotypebuffer[#1][def-\nofdefinedbuffers]}% + \setevalue{\e!start#1}{\noexpand\dostartbuffer [#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% + \setevalue{\e!get #1}{\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}% + \setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% \getparameters[\??bu#1][#2]% \fi} \def\definebuffer {\dodoubleempty\dodefinebuffer} -% yet another undocumented feature, but who cares: +\def\getbuffer + {\dodoubleempty\dogetbuffer} -\let\startfilebuffer\startbuffer +\def\dogetbuffer[#1][#2]% + {\ifsecondargument + \dodogetbuffer[#1][#2]% + \else + \dodogetbuffer[][#1]% + \fi} -\def\usememorybuffers{\let\startbuffer\startmemorybuffer} -\def\usefilebuffers {\let\startbuffer\startfilebuffer} +\def\dodogetbuffer[#1][#2]% + {\getvalue{\??bu#1\c!before}% + \dobuffer{16}{#2}\mkgetbuffer + \getvalue{\??bu#1\c!after}} -\def\startmemorybuffer - {\dosingleempty\dostartmemorybuffer} +\def\typebuffer + {\dodoubleempty\dotypebuffer} -\long\def\dostartmemorybuffer[#1]#2\stopbuffer - {\setbuffer[\iffirstargument#1\else\jobname\fi]#2\endbuffer} +\def\dotypebuffer[#1][#2]% + {\iffirstargument + \dobuffer{17}{#1}\mktypebuffer + \else + \dobuffer{17}{#2}\mktypebuffer + \fi} -% \long\def\startcrap#1\stopcrap -% {\usememorybuffers#1\usefilebuffers} % or {{...}} -% -% \startcrap -% \startbuffer -% some awful code -% \stopbuffer -% \placefigure{crap}{\getbuffer} -% \stopcrap - -% TODO: no grouping due to sidefloats +\def\dobuffer#1#2#3% + {\doifelsenothing{#2} + {\dodobuffer#3\jobname} + {\processcommalist[#2]{\dodobuffer#3}}} -\expandafter \convertargument \gobbleoneargument @ \to \emptybufferline +\def\dodobuffer#1#2% command name + {\pushmacro\currentbuffer + \edef\currentbuffer{\ifcsname\??bu#2\c!number\endcsname def-\csname\??bu#2\c!number\endcsname\else#2\fi}% + \mkdobuffer#1% + \popmacro\currentbuffer} -\newif\ifsegmentatebuffer -\newif\ifemptybufferline +\def\processTEXbuffer{\getbuffer} % handy + +% seldom used, only in a few projects that demanded more speed + +\def\usememorybuffers{\let\startbuffer\mkstartmemorybuffer} +\def\usefilebuffers {\let\startbuffer\mkstartfilebuffer} + +% this features is soldom used (complex examns where we need to fetch +% special parts of a text +% +% this is not yet supported in mkiv (relatively easy to do but there +% we don't have the par tags but need to grab 'm \def\skippedbufferparagraphs{0} @@ -408,7 +192,7 @@ \next} \def\getparagraphedbuffer[#1]% - {\dobuffer{16}[#1]\readjobfile} + {\dobuffer{16}{#1}\mkgetbuffer} \def\dostopbufferparagraph#1% {\getvalue{\??bu#1\c!after}\par} @@ -426,27 +210,14 @@ \def\filterbufferparagraph#1#2% {\advance\currentbufferparagraph \plusone - \ifnum\currentbufferparagraph>\zerocount - \doifinsetelse{\the\currentbufferparagraph}{#2} - {\let\next\dostartbufferparagraph} - {\let\next\fakebufferparagraph}% + \ifcase\currentbufferparagraph + \@EA\gobblebufferparagraph \else - \let\next\gobblebufferparagraph + \doifinsetelse{\the\currentbufferparagraph}{#2} + {\@EA\dostartbufferparagraph} + {\@EA\fakebufferparagraph}% \fi - \next{#1}} - -% nicer, but untested -% -% \def\filterbufferparagraph#1#2% -% {\advance\currentbufferparagraph \plusone -% \ifcase\currentbufferparagraph -% \@EA\gobblebufferparagraph -% \else -% \doifinsetelse{\the\currentbufferparagraph}{#2} -% {\@EA\dostartbufferparagraph} -% {\@EA\fakebufferparagraph}% -% \fi -% {#1}} + {#1}} \long\def\gobblebufferparagraph#1#2\stopbufferparagraph {} @@ -455,606 +226,15 @@ {\bgroup \def\stopbufferparagraph{\dostopbufferparagraph{#1}\egroup\egroup}% \setbox\scratchbox\vbox\bgroup\dostartbufferparagraph{#1}} - -\def\blockversion {1996.03.10} - -\def\@@blockerrormessage% - {\showmessage\m!textblocks1\empty - \global\let\@@blockerrormessage\relax} - -\def\thisisblockversion#1% - {\doifnot\blockversion{#1}{\@@blockerrormessage\endinput}} - -\def\stopcopyingblocks - {\ifcopyingblocks - \immediate\closeout\outblocks - \copyblockfile - \global\copyingblocksfalse - \fi} - -\def\dodosetblockcounters[#1]#2% - {\expanded{\setvalue{\??se\s!old#2}{\@@filterheadpart[#1]}}% - \doifnot{#2}\lastsection - {\expanded{\dodosetblockcounters[\@@filtertailpart[#1]]}% - {\getvalue{\??se#2\c!after}}}} % ???? - -\def\dosetblockcounters[#1]% - {\ifblockpermitted - \expanded{\dodosetblockcounters[\@@filtersecondpart[#1]]}\firstsection - \expanded{\setsectiontype[\@@filterfirstpart[#1]]}% - \def\@@sectionvalue##1{\getvalue{\??se\s!old##1}}% - \let\@@sectionconversion\secondoftwoarguments - \fi} - -\let\blockstatus\empty - -\def\setblockcounters - {\ifx\blockstatus\empty \else - \@EA\dosetblockcounters\@EA[\blockstatus]% - \fi} - -\def\getblockstatus#1% - {\dosetfilterlevel{\@@bscriterium}\empty - \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]} - {\global\blockpermittedtrue} - {\global\blockpermittedfalse}% - \def\blockstatus{#1}} - -\def\setupblockparameters - {\dodoubleargument\dosetupblockparameters} - -\def\dosetupblockparameters[#1][#2]% - {\getparameters[\??tb#1][#2]} - -\beginTEX - -\def\blockparameter#1#2% - {\csname\@EA\ifx\csname\??tb#1#2\endcsname\relax\s!empty\else\??tb#1#2\fi\endcsname} - -\endTEX - -\beginETEX \ifcsname - -\def\blockparameter#1#2% - {\@EA\csname\ifcsname\??tb#1#2\endcsname\??tb#1#2\else\s!empty\fi\endcsname} - -\endETEX -\ifx\outblocks\undefined \newwrite\outblocks \fi -\ifx\inpblocks\undefined \newread \inpblocks \fi -\ifx\tmpblocks\undefined \newwrite\tmpblocks \fi -\ifx\blockbox \undefined \newbox \blockbox \fi +% plugins -\newif\ifcopyingblocks -\newif\ifvisible \visibletrue -\newif\ifblockpermitted -\newif\iftmpblockstarted -\newif\ifoldinbijlagen -\newif\ifdoingblocks +\loadmarkfile{core-buf} -\newcount\blocklevel \blocklevel=0 - -%\def\setblocklevel#1% -% {\global\advance\blocklevel by #11 -% \ifnum\blocklevel>2\relax\doingblockstrue\else\doingblocksfalse\fi} -% -% oeps, got bugged - -\def\setblocklevel#1% sign - {\global\advance\blocklevel #11 - \ifcase\blocklevel\doingblocksfalse\else\doingblockstrue\fi} - -\def\opentmpblock - {\immediate\openout\tmpblocks\TEXbufferfile{\f!utilityfilename\the\blocklevel}} - -\def\closetmpblock - {\immediate\write\tmpblocks{}% een lege regel is handig voor \par commando's - \immediate\closeout\tmpblocks} - -\def\writetmpblock#1% - {\iftmpblockstarted - \ifsegmentatebuffer - \ifemptybufferline - \immediate\write\tmpblocks{\string\stopbufferparagraph }% - \immediate\write\tmpblocks{\string\startbufferparagraph}% - \else - \immediate\write\tmpblocks{#1}% - \fi - \else - \immediate\write\tmpblocks{#1}% - \fi - \else - \doifsomething{#1} - {\tmpblockstartedtrue - \immediate\write\tmpblocks{\string#1}}% - \fi} - -\def\startcopyingblocks - {\global\copyingblocksfalse} - -\def\checkcopyingblocks - {\ifcopyingblocks - \else - \immediate\openout\outblocks\f!utilityfilename.\f!blockextension% - \immediate\write\outblocks{\string\thisisblockversion{\blockversion}}% - \immediate\write\outblocks{\string\thisissectionseparator{\sectionseparator}}% - \global\copyingblockstrue - \fi} - -\def\stopcopyingblocks - {\ifcopyingblocks - \immediate\closeout\outblocks - \copyblockfile - \global\copyingblocksfalse - \fi} - -\def\nomoreblocks - {\stopcopyingblocks} - -\def\copyblockfile - {\ifcopyingblocks - \begingroup - \showmessage\m!textblocks2{\jobname.\f!blockextension}% - \openlocin\inpblocks{\f!utilityfilename.\f!blockextension}% - \immediate\openout\outblocks\jobname.\f!blockextension - \setupcopyblock - \catcode`\^^M=\@@ignore\relax - \def\copynextline - {\read\inpblocks to \!!stringa - \immediate\write\outblocks{\!!stringa}% - \ifeof\inpblocks\else\expandafter\copynextline\fi}% - \copynextline - \immediate\closein\inpblocks - \immediate\closeout\outblocks - \immediate\openout\tmpblocks\f!utilityfilename.\f!blockextension - \immediate\closeout\tmpblocks - \endgroup - \fi} - -\def\loadallblocks#1% - {\beginrestorecatcodes - \catcode`\^^M=\@@endofline\relax - \readjobfile{#1.\f!blockextension} - {\showmessage\m!textblocks3{#1.\f!blockextension}} - {\showmessage\m!textblocks4\empty}% - \endrestorecatcodes} - -\def\setupcopyblock - {\makeallother - \obeylines} - -\def\writeoutblocks - {\immediate\write\outblocks} - -% 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 - -\long\def\processnextblocklineAB#1% #2#3% - {\convertargument#1 \to\next - \doifinstringelse\endofblockA\next - \firstoftwoarguments - {\doifinstringelse\endofblockB\next - \firstoftwoarguments\secondoftwoarguments}} - -\bgroup -\obeylines -\long\gdef\copyblocklineAB#1 - {\processnextblocklineAB{#1}\closeblock{\writeoutblocks{#1}\writetmpblock{#1}\copyblocklineAB}} -\long\gdef\skipblocklineAB#1 - {\processnextblocklineAB{#1}\closeblock\skipblocklineAB} -\egroup - -% \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 - -\long\def\processnextblockline#1% #2#3% - {\convertargument#1 \to\next - \ifx\next\emptybufferline - \ifsegmentatebuffer \emptybufferlinetrue \fi - \expandafter\secondoftwoarguments% #3% - \else - \emptybufferlinefalse - \doifinstringelse\endofblock\next - {\expandafter\firstoftwoarguments }% #2} - {\expandafter\secondoftwoarguments}% #3}% - \fi} - -\bgroup -\obeylines -\long\gdef\copyblockline#1 - {\processnextblockline{#1}\closeblock{\writeoutblocks{#1}\writetmpblock{#1}\copyblockline}} -\long\gdef\skipblockline#1 - {\processnextblockline{#1}\closeblock\skipblockline} -\egroup - -\def\skipblock#1% - {\checkcopyingblocks - \@EA\convertargument\string\thiswasblock{#1}\to\endofblock - %testen : \expanded{\convertargument\string\thiswasblock{#1}\noexpand\to\noexpand\endofblock}% - \let\openblock\begingroup - \let\closeblock\endgroup - \openblock - \setupcopyblock - \skipblockline} - -\let\doafterblock \gobbletwoarguments -\let\dobeforeblock\gobbletwoarguments - -\def\thisisblock#1% - {\executeifdefined{\s!thisisblock#1}{\skipblock{#1}}} - -\def\thiswasblock#1% - {\getvalue{\s!thiswasblock#1}} - -\def\saveblock#1#2% - {\checkcopyingblocks - \obeylines - \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA - %testen: \expanded{\convertargument\string\csname\e!end#1\endcsname\to\endofblockA}% - \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN - \def\openblock - {\dobeforeblock{#1}{#2}% - \opentmpblock - \begingroup - \makesectionformat - \immediate\write\outblocks{}% - \immediate\write\outblocks{\string\thisisblock{#1}{\sectionformat}[#2]}}% - \def\closeblock - {\immediate\write\outblocks{}% handig voor \par commando's - \immediate\write\outblocks{\string\thiswasblock{#1}}% - \endgroup - \closetmpblock - \doafterblock{#1}{#2}% - \egroup}% - \openblock - \setupcopyblock - \copyblocklineAB} - -\def\copyblock - {\let\opentmpblock\empty - \let\closetmpblock\empty - \let\writetmpblock\gobbleoneargument - \saveblock} - -\def\loadoneblock - {\edef\blockfilename{\TEXbufferfile{\f!utilityfilename\the\blocklevel}}% - \setblocklevel+% - \readjobfile\blockfilename\donothing\donothing - \setblocklevel-}% - -\def\dodefineblock[#1]% - {\bypassblock[#1]% - \keepblocks[#1]% - \setupblock - [#1] - [\c!before=\blank, - \c!after=\blank, - \c!inner=, - \c!style=, - \c!file=\jobname]} - -% \def\defineblock -% {\dosingleargumentwithset\dodefineblock} - -\def\defineblock - {\dosingleargument\dodefineblock} - -\def\dosetupblock[#1][#2]% - {\getparameters[\??tb#1][#2]} - -\def\setupblock - {\dodoubleargumentwithset\dosetupblock} - -\def\bypassblock[#1]% - {\setvalue{\s!thisisblock#1}##1[##2]{\skipblock{#1}}} - -\def\dohideblock[#1][#2][#3]% - {\doifassignmentelse{#3} - {\dodohideblock[#1][#2][][#3]} - {\dodohideblock[#1][#2][#3][]}} - -\def\dodohideblock[#1][#2][#3][#4]% - {\doifelsenothing{#2} - {\global\blockpermittedfalse - \edef\blocktitle{#1}} - {\doifelsenothing{#3} - {\global\blockpermittedtrue - \edef\blocktitle{#1}} - {\doifcommonelse{#2}{#3} - {\global\blockpermittedfalse - \edef\blocktitle{#1:#2}} - {\global\blockpermittedtrue - \edef\blocktitle{#1:#3}}}}% - \ifblockpermitted - \showwarning\m!textblocks5\blocktitle - \def\next - {\def\dobeforeblock####1####2% - {\begingroup}% - \def\doafterblock####1####2% - {\endgroup - \doexecuteloadedblock{#1}{#4}}% - \saveblock{#1}{#3#4}}% - \else - \doifinsetelse{+}{#3} - {\showwarning\m!textblocks6\blocktitle - \def\next - {\def\dobeforeblock####1####2% - {\begingroup - \visiblefalse}% - \def\doafterblock####1####2% - {{\setbox0\vbox - {\catcode`\^^M=\@@endofline\relax - \loadoneblock - \par}}% - \endgroup}% - \saveblock{#1}{#3#4}}}% - {\showwarning\m!textblocks7\blocktitle - \def\next - {\def\dobeforeblock####1####2% - {\begingroup - \globaldefs\minusone}% - \def\doafterblock####1####2% - {\endgroup}% - \copyblock{#1}{#3#4}}}% - \fi - \next} - -\def\dohideblocks[#1][#2]% - {\def\docommando##1% - {\setvalue{\e!begin##1}% - {\bgroup\obeylines\dotripleempty\dohideblock[##1][#2]}}% - \processcommalist[#1]\docommando} - -\def\hideblocks - {\dodoubleempty\dohideblocks} - -\def\doexecuteloadedblock#1#2% - {\blockpermittedtrue % ? - \bgroup % before \c!before (think of: \c!before=\startitemize) - \dosetupblockparameters[#1][#2]% voor 'voor'? - \getvalue{\??tb#1\c!before}% - \dostartattributes{\??tb#1}\c!style\c!color\empty - \visibletrue - \catcode`\^^M=\@@endofline\relax - \getvalue{\??tb#1\c!inner}% - \ignorespaces - \loadoneblock - % \par moved - \dostopattributes - \getvalue{\??tb#1\c!after}% - \par - \egroup} - -\def\dokeepblock[#1][#2][#3]% - {\doifassignmentelse{#3} - {\dodokeepblock[#1][#2][][#3]} - {\dodokeepblock[#1][#2][#3][]}} - -\def\dodokeepblock[#1][#2][#3][#4]% - {\doifelsenothing{#2} - {\global\blockpermittedtrue - \edef\blocktitle{#1}} - {\doifcommonelse{#2}{#3} - {\global\blockpermittedtrue - \edef\blocktitle{#1:#2}} - {\doifinsetelse\v!all{#2} - {\doifelsenothing{#3} - {\global\blockpermittedtrue - \edef\blocktitle{#1}} - {\global\blockpermittedfalse - \edef\blocktitle{#1:#3}}} - {\global\blockpermittedfalse - \doifelsenothing{#3} - {\edef\blocktitle{#1}} - {\edef\blocktitle{#1:#3}}}}}% - \ifblockpermitted - \showwarning\m!textblocks8\blocktitle - \def\dobeforeblock##1##2% - {\begingroup}% - \def\doafterblock##1##2% - {\endgroup - \doexecuteloadedblock{#1}{#4}}% - \else - \showwarning\m!textblocks9\blocktitle - \fi - \saveblock{#1}{#3#4}} - -\def\dokeepblocks[#1][#2]% - {\def\docommando##1% - {\setvalue{\e!begin##1}% - {\bgroup\obeylines\dotripleempty\dokeepblock[##1][#2]}}% - \processcommalist[#1]\docommando} - -\def\keepblocks - {\dodoubleempty\dokeepblocks} - -\newconditional\processblockstatus -\newconditional\dummyblockstatus -\newconditional\blockassignmentstatus - -\def\dodouseblock#1#2#3#4% - {\getblockstatus{#2}% - \ifblockpermitted - \setfalse\dummyblockstatus - \doifassignmentelse{#3} - {\settrue \blockassignmentstatus} - {\setfalse\blockassignmentstatus}% - \doifelsenothing{#4} - {\edef\blocktitle{#1}} - {\ifconditional\blockassignmentstatus - \edef\blocktitle{#1}% - \else - \doifnotcommon{#3}{#4} - {\ifconditional\processblockstatus - \settrue\dummyblockstatus - \else - \global\blockpermittedfalse - \fi}% - \edef\blocktitle{#1:#3}% - \fi}% - \else - \edef\blocktitle{#1}% - \fi - \ifblockpermitted - \setblocklevel+% - \ifconditional\blockassignmentstatus \else - \doifinset{-}{#3}{\settrue\dummyblockstatus}% - \fi - \ifconditional\dummyblockstatus - \showwarning\m!textblocks{10}\blocktitle - \setvalue{\s!thiswasblock#1}% - {\removeunwantedspaces - \par - \egroup - \setblocklevel-}% - \def\next - {\setbox0\vbox\bgroup - \ifconditional\blockassignmentstatus - \dosetupblockparameters[#1][#3]% - \fi}% - \else - \showwarning\m!textblocks{11}\blocktitle - \setvalue{\s!thiswasblock#1}% - {\removeunwantedspaces - % \par moved - \dostopattributes - \getvalue{\??tb#1\c!after}% - \par - \egroup - \setblocklevel-}% - \def\next - {\bgroup - \ifconditional\blockassignmentstatus - \dosetupblockparameters[#1][#3]% - \fi - \getvalue{\??tb#1\c!before}% - \dostartattributes{\??tb#1}\c!style\c!color\empty - \visibletrue - \getvalue{\??tb#1\c!inner}% - \ignorespaces}% - \fi - \else - \def\next - {\showwarning\m!textblocks{12}\blocktitle - \skipblock{#1}}% - \fi - \next} - -\def\douseblock[#1][#2]% - {\setvalue{\s!thisisblock#1}##1[##2]{\dodouseblock{#1}{##1}{##2}{#2}}} - -\def\dodouseblocks[#1][#2]% - {\def\docommando##1% - {\douseblock[##1][#2]}% - \processcommalist[#1]\docommando - \dogetcommalistelement1\from#1\to\commalistelement - \doifdefined{\??tb\commalistelement\c!file} - {\loadallblocks{\getvalue{\??tb\commalistelement\c!file}}}% - \endgroup} - -\def\douseblocks - {\begingroup - \doassign[\??bs][\c!criterium=\v!all]% - \dodoubleempty\dodouseblocks} - -\def\useblocks - {\setfalse\processblockstatus\douseblocks} - -\def\processblocks - {\settrue \processblockstatus\douseblocks} - -\def\doselectblocks[#1][#2][#3]% - {\begingroup - \doifelsenothing{#3} - {\getparameters[\??bs][\c!criterium=\v!all,#2]% - \dodouseblocks[#1][]} - {\getparameters[\??bs][\c!criterium=\v!all,#3]% - \dodouseblocks[#1][#2]}}% - -\def\selectblocks - {\dotripleempty\doselectblocks} - -\def\beginblock[#1]% % we also check \endblock[..] - {\getvalue{\e!begin#1}} - -\def\forceblocks[#1]% - {\def\docommando##1% - {\setvalue{\e!begin##1}% - {\setblocklevel+\bgroup - \dodoubleempty\doforceblock[##1]}% - \setvalue{\e!end##1}% - {\dostopattributes - \getvalue{\??tb##1\c!after}% - \egroup\setblocklevel-}}% - \processcommalist[#1]\docommando} - -\def\doforceblock[#1][#2]% - {\doifassignmentelse{#2} - {\settrue \blockassignmentstatus} - {\setfalse\blockassignmentstatus}% - \ifconditional\blockassignmentstatus - \dosetupblockparameters[#1][#2]% - \fi - \getvalue{\??tb#1\c!before}% - \dostartattributes{\??tb#1}\c!style\c!color\empty - \getvalue{\??tb#1\c!inner}% - \ignorespaces} - -\def\bypassblocks[#1]% - {\def\docommando##1% - {\setvalue{\e!begin##1}% - {\setblocklevel+\bgroup - \obeylines % here, since we look ahead - \dodoubleempty\dobypassblock[##1]}%}% - \setvalue{\e!end##1}% - {}}% - \processcommalist[#1]\docommando} - -\def\dobypassblock[#1][#2]% - {\def\closeblock - {\egroup\setblocklevel-}% - \checkcopyingblocks - \obeylines - \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA - \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN - \setupcopyblock - \skipblocklineAB} - -% \setvalue{\e!start\v!hiding}% -% {\dostartbuffer[buf-\nofpostponedblocks] -% [\e!start\v!hiding][\e!stop\v!hiding]} +% definitions \definebuffer[\v!hiding] \setupbuffer[\v!hiding][\c!local=\v!yes] - + \setupbuffer [\c!paragraph=\v!no, \c!before=, diff --git a/tex/context/base/core-con.mkii b/tex/context/base/core-con.mkii new file mode 100644 index 000000000..9a4a0b0ff --- /dev/null +++ b/tex/context/base/core-con.mkii @@ -0,0 +1,286 @@ +%D \module +%D [ file=core-con, +%D version=1997.26.08, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Conversion 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 + +%D When upcasing the result, we just follow the text book rules +%D of expansion. Later on we'll see some more uppercase tricks. + +\def\romannumerals#1% + {\romannumeral#1} + +%D For some years we had \unknown +%D +%D \starttyping +%D \def\Romannumerals#1% +%D {\uppercase\expandafter{\romannumeral#1}} +%D \stoptyping +%D +%D \unknown but we need to be fully expandable in order to get +%D the utility output file right, so now we have the following +%D solution. It was Patrick Gundlach who first noticed this +%D ommision. + +\def\Romannumerals#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 Big case statements but pretty fast: + +\def\character#1% + {\ifcase#1\unknowncharacter + \or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% + \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z% + \else + \unknowncharacter + \fi} + +\def\Character#1% + {\ifcase#1\unknowncharacter + \or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% + \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z% + \else + \unknowncharacter + \fi} + +\def\greeknumerals#1% + {% no longer needed: \mathematics + {\ifcase#1\unknowncharacter\or + \alpha \or \beta \or \gamma \or \delta \or + \varepsilon \or \zeta \or \eta \or \theta \or + \iota \or \kappa \or \lambda \or \mu \or + \nu \or \xi \or \omicron \or \pi \or + \varrho \or \sigma \or \tau \or \upsilon \or + \phi \or \chi \or \psi \or \omega + \else + \unknowncharacter + \fi}} + +\def\Greeknumerals#1% + {% no longer needed: \mathematics + {\ifcase#1\unknowncharacter \or + \Alpha \or \Beta \or \Gamma \or \Delta \or + \Epsilon \or \Zeta \or \Eta \or \Theta \or + \Iota \or \Kappa \or \Lambda \or \Mu \or + \Nu \or \Xi \or \Omicron \or \Pi \or + \Rho \or \Sigma \or \Tau \or \Upsilon \or + \Phi \or \Xi \or \Psi \or \Omega + \else + \unknowncharacter + \fi}} + +\beginTEX + +\def\dodoconvertcharacters#1#2#3% + {\ifnum#3>#1 + \bgroup + \!!counta#3\relax + \ifnum\!!counta>\zerocount + \advance\!!counta \minusone + \!!countb\!!counta + \divide\!!counta #1% + \!!countc\!!counta + \multiply\!!countc #1% + \advance\!!countb -\!!countc + \doconvertcharacters#3{\!!counta}% + \advance\!!countb \plusone + #3{\the\!!countb}% + \fi + \egroup + \else + #2{#3}% pure expansion, used in references + \fi} + +\endTEX + +%D A fully expandable alternative: + +\beginETEX \numexpr + +\def\dodoconvertcharacters#1#2#3% + {\ifcase#3\else + \ifnum#3>#1 + \expandafter\doconvertcharacters\expandafter#2\expandafter{\the\numexpr(#3+12)/#1-1\relax}% + \expandafter#2\expandafter{\the\numexpr#3-((#3+12)/#1-1)*#1\relax}% + \else + \expandafter#2\expandafter{\number#3}% + \fi + \fi} + +\endETEX + +\def\doconvertcharacters{\dodoconvertcharacters{26}} + +\def\characters{\doconvertcharacters\character} +\def\Characters{\doconvertcharacters\Character} + +\def\getdayoftheweek#1#2#3% + {\bgroup + \!!counta#3\relax + \advance\!!counta \minusone + \!!countb\!!counta + \multiply\!!countb 365 + \advance\!!countb \ifcase#2\relax + 0 \or 0 \or 31 \or 59 \or 90 \or120 \or151 \or + 181 \or212 \or243 \or273 \or304 \or334 \or365 \fi + \advance\!!countb #1\relax + \ifnum#2>2 + \doifleapyearelse{#3}{\advance\!!countb 1}{}\relax + \fi + \!!countc\!!counta + \dosetdivision\!!countc4\!!countc + \advance\!!countb \!!countc + \!!countc\!!counta + \dosetdivision\!!countc{100}\!!countc + \advance\!!countb -\!!countc + \!!countc\!!counta + \dosetdivision\!!countc{400}\!!countc + \advance\!!countb \!!countc + \dosetmodulo\!!countb7\!!countb + \advance\!!countb \plusone + \@EA\egroup\@EA\normalweekday\the\!!countb\relax} + +\def\dayoftheweek#1#2#3% + {\getdayoftheweek{#1}{#2}{#3}\doconvertday{\normalweekday}} + +\def\doifleapyearelse#1% #2#3% + {\bgroup + \!!doneafalse + \!!counta#1% + \dosetmodulo\!!counta4\!!countb + \ifcase\!!countb + \dosetmodulo\!!counta{100}\!!countb + \ifcase\!!countb \else \!!doneatrue \fi + \dosetmodulo\!!counta{400}\!!countb + \ifcase\!!countb \!!doneatrue \fi + \fi + \if!!donea + \egroup\@EA\firstoftwoarguments % \def\next{#2}% + \else + \egroup\@EA\secondoftwoarguments % \def\next{#3}% + \fi} % \next} + +% untested but cleaner: +% +% \def\doifleapyearelse#1% #2#3% +% {\bgroup +% \dosetmodulo{#1}{400}\scratchcounter +% \ifcase\scratchcounter +% \else +% \dosetmodulo{#1}{100}\scratchcounter +% \ifcase\scratchcounter +% \scratchcounter\plusone +% \else +% \dosetmodulo{#1}4\scratchcounter +% \fi +% \fi +% \ifcase\scratchcounter +% \egroup\@EA\firstoftwoarguments +% \else +% \egroup\@EA\secondoftwoarguments +% \fi} + +\def\getdayspermonth#1#2% + {\doifleapyearelse{#1} + {\def\numberofdays{29}} + {\def\numberofdays{28}}% + \edef\numberofdays + {\ifcase#2 \or31\or\numberofdays\or31\or30\or + 31\or30\or31\or31\or30\or31\or30\or31\fi}} + +\def\calculatecurrenttime + {\dosetdivision\time{60}\scratchcounter + \edef\currenthour {\ifnum\scratchcounter<10 0\fi \the\scratchcounter}% + \dosetmodulo \time{60}\scratchcounter + \edef\currentminute{\ifnum\scratchcounter<10 0\fi \the\scratchcounter}} + + +%D \macros +%D {defineconversionvector,conversionnumber} % bad names so no danger for clash +%D +%D For Adam and friends \unknown +%D +%D \startitemize[persiannummerals] +%D \item test \item test \item test \item test +%D \stopitemize + +\def\defineconversionvector#1#2% name base + {\bgroup + % dirty trick + \uccode`\*=`\1 + % plain: + % \uccode`\0=\numexpr#2+0\relax \uccode`\1=\numexpr#2+1\relax + % \uccode`\2=\numexpr#2+2\relax \uccode`\3=\numexpr#2+3\relax + % \uccode`\4=\numexpr#2+4\relax \uccode`\5=\numexpr#2+5\relax + % \uccode`\6=\numexpr#2+6\relax \uccode`\7=\numexpr#2+7\relax + % \uccode`\8=\numexpr#2+8\relax \uccode`\9=\numexpr#2+9\relax + % context: + \dostepwiserecurse091{\expandafter\uccode\expandafter`\recurselevel=\numexpr#2+\recurselevel}% + % prepared macro + \uppercase\expandafter{\expandafter\gdef\csname::cvn::#1::\endcsname##*% + {\ifcase##* 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\fi}}% + \egroup} + +\def\conversionnumber#1#2% + {\ifcsname::cvn::#1::\endcsname + \expandafter\doconversionnumber\csname::cvn::#1::\expandafter\endcsname\number#2\relax + \else + \number#2% + \fi} + +\def\doconversionnumber#1#2% + {\ifx#2\relax + \expandafter\gobbleoneargument + \else + #1{#2}% + \expandafter\doconversionnumber + \fi#1} + +% actually mkiii code + +\beginXETEX + +\defineconversionvector{arabicnumerals} {"0660} +\defineconversionvector{persiannumerals} {"06F0} +\defineconversionvector{thainumerals} {"0E50} +\defineconversionvector{devanagarinumerals}{"0966} +\defineconversionvector{gurmurkhinumerals} {"0A66} +\defineconversionvector{gujaratinumerals} {"0AE6} +\defineconversionvector{tibetannumerals} {"0F20} % also "half numerals?" + +\defineconversion[arabicnumerals] [\conversionnumber{arabicnumerals}] +\defineconversion[persiannumerals] [\conversionnumber{persiannumerals}] +\defineconversion[thainumerals] [\conversionnumber{thainumerals}] +\defineconversion[devanagarinumerals][\conversionnumber{devanagarinumerals}] +\defineconversion[gurmurkhinumerals] [\conversionnumber{gurmurkhinumerals}] +\defineconversion[gujaratinumerals] [\conversionnumber{gujaratinumerals}] +\defineconversion[tibetannumerals] [\conversionnumber{tibetannumerals}] + +\endXETEX + +\protect \endinput diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex index 98837ec6d..5594ccadd 100644 --- a/tex/context/base/core-con.tex +++ b/tex/context/base/core-con.tex @@ -15,6 +15,9 @@ \unprotect +\ifx\currentlanguage\undefined \let\currentlanguage\empty \fi +\ifx\labeltext \undefined \let\labeltext\firstofoneargument \fi + %D This module deals with all kind of conversions from numbers %D and dates. I considered splitting this module in a support %D one and a core one, but to keep things simple as well as @@ -58,9 +61,6 @@ \def\numbers#1{\purenumber{#1}} \def\Numbers#1{\purenumber{#1}} -\def\twodigits #1{\ifnum #1<10 0\fi\number#1} -\def\threedigits#1{\ifnum#1<100 \ifnum#1<10 0\fi0\fi\number#1} - %D \macros %D {romannumerals,Romannumerals} %D @@ -71,43 +71,9 @@ %D %D \showsetup{romannumerals} %D \showsetup{Romannumerals} -%D -%D When upcasing the result, we just follow the text book rules -%D of expansion. Later on we'll see some more uppercase tricks. - -\def\romannumerals#1% - {\romannumeral#1} -%D For some years we had \unknown -%D -%D \starttyping -%D \def\Romannumerals#1% -%D {\uppercase\expandafter{\romannumeral#1}} -%D \stoptyping -%D -%D \unknown but we need to be fully expandable in order to get -%D the utility output file right, so now we have the following -%D solution. It was Patrick Gundlach who first noticed this -%D ommision. - -\def\Romannumerals#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} +\let\romannumerals\gobbleoneargument +\let\Romannumerals\gobbleoneargument %D \macros %D {character,Character} @@ -127,21 +93,8 @@ \def\unknowncharacter{-} % else in lists \relax -\def\character#1% - {\ifcase#1\unknowncharacter - \or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% - \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z% - \else - \unknowncharacter - \fi} - -\def\Character#1% - {\ifcase#1\unknowncharacter - \or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% - \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z% - \else - \unknowncharacter - \fi} +\let\character\gobbleoneargument +\let\Character\gobbleoneargument %D \macros %D {characters,Characters} @@ -153,81 +106,16 @@ %D \showsetup{characters} %D \showsetup{Characters} -\beginTEX - -\def\dodoconvertcharacters#1#2#3% - {\ifnum#3>#1 - \bgroup - \!!counta#3\relax - \ifnum\!!counta>\zerocount - \advance\!!counta \minusone - \!!countb\!!counta - \divide\!!counta #1% - \!!countc\!!counta - \multiply\!!countc #1% - \advance\!!countb -\!!countc - \doconvertcharacters#3{\!!counta}% - \advance\!!countb \plusone - #3{\the\!!countb}% - \fi - \egroup - \else - #2{#3}% pure expansion, used in references - \fi} - -\endTEX - -%D A fully expandable alternative: - -\beginETEX \numexpr - -\def\dodoconvertcharacters#1#2#3% - {\ifcase#3\else - \ifnum#3>#1 - \expandafter\doconvertcharacters\expandafter#2\expandafter{\the\numexpr(#3+12)/#1-1\relax}% - \expandafter#2\expandafter{\the\numexpr#3-((#3+12)/#1-1)*#1\relax}% - \else - \expandafter#2\expandafter{\number#3}% - \fi - \fi} - -\endETEX - -\def\doconvertcharacters{\dodoconvertcharacters{26}} - -\def\characters{\doconvertcharacters\character} -\def\Characters{\doconvertcharacters\Character} +\let\characters\gobbleoneargument +\let\Characters\gobbleoneargument %D \macros %D {greeknumerals,Greeknumerals} %D %D Why should we only honour the romans, and not the greek? -\def\greeknumerals#1% - {% no longer needed: \mathematics - {\ifcase#1\unknowncharacter\or - \alpha \or \beta \or \gamma \or \delta \or - \varepsilon \or \zeta \or \eta \or \theta \or - \iota \or \kappa \or \lambda \or \mu \or - \nu \or \xi \or \omicron \or \pi \or - \varrho \or \sigma \or \tau \or \upsilon \or - \phi \or \chi \or \psi \or \omega - \else - \unknowncharacter - \fi}} - -\def\Greeknumerals#1% - {% no longer needed: \mathematics - {\ifcase#1\unknowncharacter \or - \Alpha \or \Beta \or \Gamma \or \Delta \or - \Epsilon \or \Zeta \or \Eta \or \Theta \or - \Iota \or \Kappa \or \Lambda \or \Mu \or - \Nu \or \Xi \or \Omicron \or \Pi \or - \Rho \or \Sigma \or \Tau \or \Upsilon \or - \Phi \or \Xi \or \Psi \or \Omega - \else - \unknowncharacter - \fi}} +\let\greeknumerals\gobbleoneargument +\let\Greeknumerals\gobbleoneargument %D \macros %D {oldstylenumerals,oldstyleromannumerals} @@ -241,52 +129,6 @@ {{\leftrulefalse\rightrulefalse\ss\txx\boxrulewidth.15ex \ruledhbox spread .15em{\hss\uppercased{\romannumerals{#1}}\hss}}} -%D \macros -%D {defineconversionvector,conversionnumber} % bad names so no danger for clash -%D -%D For Adam and friends \unknown -%D -%D \startitemize[persiannummerals] -%D \item test \item test \item test \item test -%D \stopitemize - -% \defineconversionvector{alpha}{`a} -% \edef\test{\conversionnumber{alpha}{123}} - -% \ifx\gobbleoneargument\undefined \long\def\gobbleoneargument#1{} \fi - -\def\defineconversionvector#1#2% name base - {\bgroup - % dirty trick - \uccode`\*=`\1 - % plain: - % \uccode`\0=\numexpr#2+0\relax \uccode`\1=\numexpr#2+1\relax - % \uccode`\2=\numexpr#2+2\relax \uccode`\3=\numexpr#2+3\relax - % \uccode`\4=\numexpr#2+4\relax \uccode`\5=\numexpr#2+5\relax - % \uccode`\6=\numexpr#2+6\relax \uccode`\7=\numexpr#2+7\relax - % \uccode`\8=\numexpr#2+8\relax \uccode`\9=\numexpr#2+9\relax - % context: - \dostepwiserecurse091{\expandafter\uccode\expandafter`\recurselevel=\numexpr#2+\recurselevel}% - % prepared macro - \uppercase\expandafter{\expandafter\gdef\csname::cvn::#1::\endcsname##*% - {\ifcase##* 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\fi}}% - \egroup} - -\def\conversionnumber#1#2% - {\ifcsname::cvn::#1::\endcsname - \expandafter\doconversionnumber\csname::cvn::#1::\expandafter\endcsname\number#2\relax - \else - \number#2% - \fi} - -\def\doconversionnumber#1#2% - {\ifx#2\relax - \expandafter\gobbleoneargument - \else - #1{#2}% - \expandafter\doconversionnumber - \fi#1} - %D \macros %D {protectconversion} %D @@ -385,34 +227,8 @@ \newcount\normalweekday -\def\getdayoftheweek#1#2#3% - {\bgroup - \!!counta#3\relax - \advance\!!counta \minusone - \!!countb\!!counta - \multiply\!!countb 365 - \advance\!!countb \ifcase#2\relax - 0 \or 0 \or 31 \or 59 \or 90 \or120 \or151 \or - 181 \or212 \or243 \or273 \or304 \or334 \or365 \fi - \advance\!!countb #1\relax - \ifnum#2>2 - \doifleapyearelse{#3}{\advance\!!countb 1}{}\relax - \fi - \!!countc\!!counta - \dosetdivision\!!countc4\!!countc - \advance\!!countb \!!countc - \!!countc\!!counta - \dosetdivision\!!countc{100}\!!countc - \advance\!!countb -\!!countc - \!!countc\!!counta - \dosetdivision\!!countc{400}\!!countc - \advance\!!countb \!!countc - \dosetmodulo\!!countb7\!!countb - \advance\!!countb \plusone - \@EA\egroup\@EA\normalweekday\the\!!countb\relax} - -\def\dayoftheweek#1#2#3% - {\getdayoftheweek{#1}{#2}{#3}\doconvertday{\normalweekday}} +\let\getdayoftheweek\gobblethreearguments +\let\dayoftheweek \gobblethreearguments %D Using this macro in %D @@ -485,30 +301,8 @@ %D The number of days is available in the macro \type %D {\numberofdays}. -\def\doifleapyearelse#1% #2#3% - {\bgroup - \!!doneafalse - \!!counta#1% - \dosetmodulo\!!counta4\!!countb - \ifcase\!!countb - \dosetmodulo\!!counta{100}\!!countb - \ifcase\!!countb \else \!!doneatrue \fi - \dosetmodulo\!!counta{400}\!!countb - \ifcase\!!countb \!!doneatrue \fi - \fi - \if!!donea - \egroup\@EA\firstoftwoarguments % \def\next{#2}% - \else - \egroup\@EA\secondoftwoarguments % \def\next{#3}% - \fi} % \next} - -\def\getdayspermonth#1#2% - {\doifleapyearelse{#1} - {\def\numberofdays{29}} - {\def\numberofdays{28}}% - \edef\numberofdays - {\ifcase#2 \or31\or\numberofdays\or31\or30\or - 31\or30\or31\or31\or30\or31\or30\or31\fi}} +\def\doifleapyearelse #1{\firstoftwoarguments} +\def\getdayspermonth#1#2{\let\numberofdays\!!zerocount} %D \macros %D {currentdate, date} @@ -579,47 +373,11 @@ \hskip\datesignal\relax \fi} -% \def\complexcurrentdate[#1]% -% {\bgroup -% \let\labellanguage\currentlanguage -% \def\betweendates{\let\betweendates\dobetweendates}% -% \lowercase{\edef\!!stringa{#1}}% permits usage in \smallcapped -% \@EA\processallactionsinset\@EA -% [\!!stringa] -% [ \v!day=>\betweendates\the\normalday, -% %\v!day+=>\betweendates\ordinaldaynumber\normalday, -% \v!day+=>\betweendates\convertnumber{\v!day+}\normalday, -% \v!month=>\betweendates\month\normalmonth, -% \v!year=>\betweendates\the\normalyear, -% \v!space=>\unskip\ \hskip\datesignal,% optimization -) -% \ =>\unskip\ \hskip\datesignal,% optimization -) -% d=>\convertnumber\v!day\normalday, -% %d+=>\ordinaldaynumber\normalday, -% d+=>\convertnumber{\v!day+}\normalday, -% m=>\convertnumber\v!month\normalmonth, -% j=>\convertnumber\v!year\normalyear, -% y=>\convertnumber\v!year\normalyear, -% w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, -% dd=>\ifnum\normalday >9 \else0\fi\the\normalday, -% %dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, -% dd+=>\convertnumber{\v!day+}{\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!weekday=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, -% \v!referral=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]}, -% \s!unknown=>\unskip -% \commalistelement -% \hskip\datesignal -% \def\betweendates{\let\betweendates\dobetweendates}]% -% \ifdim\lastskip=\datesignal\relax -% \unskip -% \fi -% \egroup} +\newtoks \everycurrentdate \def\complexcurrentdate[#1]% {\bgroup - \let\labellanguage\currentlanguage + \the\everycurrentdate \def\betweendates{\let\betweendates\dobetweendates}% % was \processcommacommandp[#1]\docomplexcurrentdate \safeedef\ascii{\empty#1}% keep encoded chars @@ -693,13 +451,10 @@ %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}} - {\dosetdivision\time{60}\scratchcounter - \edef\currenthour {\ifnum\scratchcounter<10 0\fi \the\scratchcounter}% - \dosetmodulo \time{60}\scratchcounter - \edef\currentminute{\ifnum\scratchcounter<10 0\fi \the\scratchcounter}} +\let\calculatecurrenttime\relax + +\let\currenthour \!!plusone +\let\currentminute\!!plusone \appendtoks \calculatecurrenttime \to \everyjob @@ -773,10 +528,10 @@ % \def\dodefineconversion[#1][#2]% % {\ConvertConstantAfter\doifinstringelse{,}{#2} % {\scratchcounter=0 -% \def\docommando##1% +% \def\docommand##1% % {\advance\scratchcounter 1 % \setvalue{\??cv#1\the\scratchcounter}{##1}}% -% \processcommalist[#2]\docommando +% \processcommalist[#2]\docommand % \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}} % {\setvalue{\??cv#1}{#2}}} % @@ -797,10 +552,10 @@ %D \def\dododefineconversion[#1][#2][#3]% %D {\ConvertConstantAfter\doifinstringelse{,}{#3} %D {\scratchcounter\zerocount -%D \def\docommando##1% +%D \def\docommand##1% %D {\advance\scratchcounter \plusone %D \setvalue{\??cv#1#2\the\scratchcounter}{##1}}% -%D \processcommalist[#3]\docommando +%D \processcommalist[#3]\docommand %D \setvalue{\??cv#1#2}##1{\executeifdefined{\??cv#1#2##1}\unknown}} % catch out-of-range numbers %D {\setvalue{\??cv#1#2}{#3}}} %D \stoptyping @@ -812,10 +567,10 @@ \def\dododefineconversion[#1][#2][#3]% {\ConvertConstantAfter\doifinstringelse{,}{#3} {\scratchcounter\zerocount - \def\docommando##1% + \def\docommand##1% {\advance\scratchcounter \plusone \setvalue{\??cv#1#2\the\scratchcounter}{##1}}% - \processcommalist[#3]\docommando + \processcommalist[#3]\docommand \setevalue{\??cv#1#2}##1% {\noexpand\docheckedconversion{#1#2}{\the\scratchcounter}{##1}}} {\setvalue{\??cv#1#2}{#3}}} @@ -885,6 +640,13 @@ \endTEX +\def\doifelseconversionnumber#1#2% slow but seldom used + {\doifdefinedelse{\??cv#1#2}} + +% \defineconversion[ctx][c,o,n,t,e,x,t] +% +% \doloop{\doifelseconversionnumber{ctx}{\recurselevel}{[\recurselevel]}{\exitloop}} + \defineconversion [\s!default] [\number] %D As longs as symbols are linked to levels or numbers, we can @@ -940,31 +702,13 @@ \defineconversion [month] [\doconvertmonthlong] \defineconversion [month:mnem] [\doconvertmonthshort] -\beginXETEX \number - -\defineconversionvector{arabicnumerals} {"0660} -\defineconversionvector{persiannumerals} {"06F0} -\defineconversionvector{thainumerals} {"0E50} -\defineconversionvector{devanagarinumerals}{"0966} -\defineconversionvector{gurmurkhinumerals} {"0A66} -\defineconversionvector{gujaratinumerals} {"0AE6} -\defineconversionvector{tibetannumerals} {"0F20} % also "half numerals?" - -\defineconversion[arabicnumerals] [\conversionnumber{arabicnumerals}] -\defineconversion[persiannumerals] [\conversionnumber{persiannumerals}] -\defineconversion[thainumerals] [\conversionnumber{thainumerals}] -\defineconversion[devanagarinumerals][\conversionnumber{devanagarinumerals}] -\defineconversion[gurmurkhinumerals] [\conversionnumber{gurmurkhinumerals}] -\defineconversion[gujaratinumerals] [\conversionnumber{gujaratinumerals}] -\defineconversion[tibetannumerals] [\conversionnumber{tibetannumerals}] - -\endXETEX - % Some bonus ones: \defineconversion [\v!empty] [\gobbleoneargument] \defineconversion [\v!none] [\numbers] +\ifx\symbol\undefined \def\symbol[#1]{#1} \fi % todo + \defineconversion [set 0] [{\symbol[bullet]}, @@ -1021,4 +765,8 @@ \mathematics{\ast\ast}, \mathematics{\ast\ast\ast}] +%D Plugins: + +\loadmarkfile{core-con} + \protect \endinput diff --git a/tex/context/base/core-ctx.tex b/tex/context/base/core-ctx.tex new file mode 100644 index 000000000..ba47f07fd --- /dev/null +++ b/tex/context/base/core-ctx.tex @@ -0,0 +1,173 @@ +%D \module +%D [ file=core-ctx, +%D version=2006.08.16, % old stuff +%D title=\CONTEXT\ Core Macros, +%D subtitle=Job Control, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{Context Core Macros / Ctx Job Files} + +%D After some experimenting this code moved into the core. It +%D overloades a few file reading macros and permits runtime +%D conversion and job control. + +\unprotect + +\chardef\preprocessmethod 2 % 0=no check 1=present_check 2=log_check +\chardef\preprocessstate 0 % 1=found 2=not_present (skip) +\def \preprocesssuffix {.prep} + +\def\loadctxpreplist + {\ifcase\preprocessmethod + % no checking + \or + % simple checking + \or + \doiffileexistselse{./\jobname.ctl} + {\bgroup + \defineXMLenvironment[ctx:preplist] + {\writestatus\m!systems{loading ctx log file}} + {}% + \defineXMLenvironmentsave[ctx:prepfile][done=no] + {} + {\writestatus\m!systems{registering \XMLflush{ctx:prepfile} -> \XMLop{done}}% + \setxvalue{fp..\XMLflush{ctx:prepfile}}{\XMLop{done}}}% + \processXMLfile{./\jobname.ctl}% + \egroup}% + {\global\chardef\preprocessmode\plusone}% + \fi + \global\let\loadctxpreplist\relax} + +\appendtoks\loadctxpreplist\to\everystarttext % will become: \prependtoks\loadctxpreplist\to\everyjob + +\def\docheckprepfile + {\ifcase\preprocessmethod + \iftracefiles\writestatus\m!systems{preprocessing - not needed}\fi + % no preprocessing + \or + % only check for existence + \iftracefiles\writestatus\m!systems{preprocessing - check exitence of \readfilename\preprocesssuffix}\fi + \doiffileexistselse{\readfilename\preprocesssuffix} + {\chardef\preprocessstate\plusone} + \donothing + \or + % check when in list, otherwise assume normal file + \bgroup + \splitfilename\readfilename + \ifx\splitofftype\empty + % saveguard and speed up + \iftracefiles\writestatus\m!systems{preprocessing - no suffix}\fi + \egroup + \else + \iftracefiles\writestatus\m!systems{preprocessing - check presence of \readfilename\preprocesssuffix}\fi + \doifdefinedelse{fp..\readfilename} + {\egroup + \doiffileexistselse{\readfilename\preprocesssuffix} + {\chardef\preprocessstate\plusone} + {\chardef\preprocessstate\plustwo}}% + {\doifdefinedelse{fp..\splitoffname.\splitofftype} + {\egroup + \doiffileexistselse{\readfilename\preprocesssuffix} + {\chardef\preprocessstate\plusone} + {\chardef\preprocessstate\plustwo}}% + {\egroup}}% + \fi + \fi} + +% beware, \readfilename keeps the original one, but we load and store the +% suffixed with .prep file (if present) + +\def\doreadfile#1#2#3#4% beware, this one already works at format generation time! + {\sanitizefilename#2\to\readfilename + \ifx\readfilename\empty + % silently ignore + \else + \let\trackedfilename\readfilename + \chardef\preprocessstate\zerocount + \ifconditional\trackfilenames + \doifundefinedelse{fn..\trackedfilename}\donetrue\donefalse + \else + \donetrue + \fi + \ifdone + \checkfilename\readfilename + \ifcase\kindoffile + % not a full path or url, check for existence + \doifelsenothing{#1} + {\iftracefiles\writestatus\m!systems{searching for \readfilename\space on tex path}\fi + \def\next{\redoreadfile\readfilename{#3}{#4}}}% + {\iftracefiles\writestatus\m!systems{searching for \readfilename\space on #1}\fi + \def\next{\redoreadfile{\pathplusfile{#1}{\readfilename}}{#3}{#4}}}% + \else + % a full path or url, no further checking done + \docheckprepfile + \ifcase\preprocessstate + \doiffileexistselse\readfilename + {\iftracefiles\writestatus\m!systems{located \readfilename}\fi + \def\next{#3\dodoreadfile}}% + {\iftracefiles\writestatus\m!systems{not found \readfilename}\fi + \def\next{#4}}% + \or + \iftracefiles\writestatus\m!systems{located \readfilename\preprocesssuffix}\fi + \def\next{#3\dodoreadfile}% + \or + \iftracefiles\writestatus\m!systems{not found \readfilename\preprocesssuffix}\fi + \def\next{#4}% + \fi + \fi + \else + \edef\readfilename{\getvalue{fn..\readfilename}}% + \iftracefiles\writestatus\m!systems{already located \readfilename}\fi + \def\next{#3\dodoreadfile}% + \fi + \expandafter\next + \fi} + +\def\redoreadfile#1#2#3% + {\docheckprepfile + \ifcase\preprocessstate + \doiffileexistselse{#1}% + {\edef\readfilename{#1}% + \iftracefiles\writestatus\m!systems{#1 located}\fi + \def\next{#2\dodoreadfile}}% + {\iftracefiles\writestatus\m!systems{cannot locate #1}\fi + \decrement\readlevel\relax + \ifnum\readlevel>\zerocount + \edef\readfilename{\pathplusfile{\f!parentpath}{\readfilename}}% + \def\next{\redoreadfile\readfilename{#2}{#3}}% + \else + \def\next{#3}% + \fi}% + \or + \edef\readfilename{#1}% + \iftracefiles\writestatus\m!systems{#1\preprocesssuffix\space located}\fi + \def\next{#2\dodoreadfile}% + \or + \def\next{#3}% + \fi + \next} + +\def\dodoreadfile % we provide hooks, for instance for \enableXML + {\ifconditional\trackfilenames + \setxvalue{fn..\trackedfilename}{\readfilename\ifcase\preprocessstate\or\preprocesssuffix\fi}% + \fi + \the\everybeforereadfile + \ifcase\preprocessstate + % no checking or not found when using method 1 + \normalinput\readfilename + \or + % found when using method 1 or 2 + \normalinput\readfilename\preprocesssuffix + \or + % not found when using method 2 + \fi + \relax + \the\everyafterreadfile} + +\protect \endinput diff --git a/tex/context/base/core-dat.tex b/tex/context/base/core-dat.tex index aab352daa..dc39f979f 100644 --- a/tex/context/base/core-dat.tex +++ b/tex/context/base/core-dat.tex @@ -227,10 +227,10 @@ \def\doprocessrecords[#1][#2][#3]% {\bgroup \ifx\\\undefined\let\\\relax\fi - \def\docommando##1% + \def\docommand##1% {\resetrecordentry{##1}% \appendtoks\resetrecordentry{##1}\to\resetrecordlist}% - \processcommacommand[\getvalue{\??db#1\c!velden}]\docommando + \processcommacommand[\getvalue{\??db#1\c!velden}]\docommand \let\setrecordentry\skiprecord \the\resetrecordlist \doifelse{#2}\v!all % 't Is nu eenmaal alles diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index 382dc8ca7..7b786ec94 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -418,6 +418,8 @@ \def\currentdescriptionnumber {\csname\??dd\currentdescription\??dd\c!number\endcsname} +\ifx\preparednumber\undefined \let\preparednumber\empty \fi + \def\special@@descriptionhandler[#1]#2#3% {\strut \doifelse{\descriptionparameter\c!number}\v!no diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index f8d58e038..2719d5677 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -1,6 +1,6 @@ %D \module %D [ file=core-fig, -%D version=1997.03.31, +%D version=2006.08.26, % overhaul of 1997.03.31 %D title=\CONTEXT\ Core Macros, %D subtitle=Figure Inclusion, %D author=Hans Hagen, @@ -11,136 +11,105 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% error in calculations : .25% (too much: 1.5pt over full page) -% -% this module will be reimplemented(read: cleaned up) +% todo: directory : system -> \allinputpaths + +%D It may be that some functionality got lost. If it concerns +%D defined features, let me know and it will be sorted out. \writestatus{loading}{Context Core Macros / Figure Inclusion} -\unprotect +%D This is a reimplementation of the original module, which +%D over time had evolved into a pretty complex whole. This +%D was partly due to the fact that we needed to handle many +%D formats, deal with substitute graphics, handle fallbacks +%D and driver specifics (objects), etc. In the meantime we +%D have more clever backends, moved away from texutil to +%D rlxtools, can use runtime or betweentime runs etc. Also, +%D more memory permits a cleaner implementation. Time to +%D move on. We can now also assume that scaling is available. +%D +%D Another mess that can go is the llx/lly handling since +%D drivers now automatically can determine such things. -% tex, tmp, mov and avi will become part of the fuzzy -% graphics and also behandled by special drivers; the -% current support is hackery - -% figurefilemode checken -% zowieso alles checken -% movie scanner - -%D Scanning for illustrations is automated to the max. Right -%D from the beginning \CONTEXT\ supported figure inclusion -%D using a dedicated figure directory file. Apart from the fact -%D that such a file enables us to include graphics that cannot -%D be parsed by \TEX\ for dimensions, by using this file we can -%D also quite easily generate figure directories. Only when -%D \PDFTEX\ started offering \PDF\ inclusion, I felt the need -%D to automate dimension detection to a higher degree. -%D Fortunately \TEXUTIL\ can scan more types now as well as -%D that we can run \TEXUTIL\ from within \TEX. +%D Messages 3 and 5 needs to be translated! + +\unprotect \startmessages dutch library: figures title: figuren 1: figuur -- is niet te vinden 2: figuur -- wordt niet preset - 3: maten van figuur -- geleend van -- + 3: maten van -- worden extern vastgesteld 4: maten van -- geladen uit figuurfile zelf - 5: maten van -- geladen uit figuurfile -- - 6: maten van -- berekend door TeXUtil - 7: figuurfile -- moet opnieuw worden aangemaakt + 5: maten van -- zijn onbekend + 6: maten van -- berekend door rlxtools 8: figuurobject -- wordt opnieuw gebruikt - 9: figuur -- wordt niet afgehandeld - 10: figuur -- heeft geen afmetingen - 11: invoegen bron -- \stopmessages \startmessages english library: figures title: figures 1: figure -- can not be found 2: figure -- is not preset - 3: dimensions of figure -- borrowed from -- + 3: dimensions of -- are determined externally 4: dimensions of -- loaded from figurefile itself - 5: dimensions of -- loaded from figurefile -- - 6: dimensions of -- calculated by TeXUtil - 7: you have to regenerate figure file -- + 5: dimensions of -- are unknown + 6: dimensions of -- calculated by rlxtools 8: figureobject -- is reused - 9: figure -- is not handled - 10: figure -- has zero dimensions - 11: including resource -- \stopmessages \startmessages german library: figures title: Abbildungen 1: Abbildung -- kann nicht gefunden werden 2: Abbildung -- wird nicht erstellt - 3: Dimensionen von -- uebernommen von -- + 3: dimensions of -- are determined externally 4: Dimensionen von -- geladen aus der Abbildungsdatei selbst - 5: Dimensionen von -- geladen aus Abbildungsdatei -- - 6: Dimensionen von -- ausgerechnet durch TeXUtil - 7: Sie muessen eine neue Abbildungsdatei -- erstellen + 5: Dimensions of -- are unknown + 6: Dimensionen von -- ausgerechnet durch rlxtools 8: Abbildungobjekt -- wurde wiederverwandt - 9: Abbildung -- wird nicht unterstuetzt - 10: figure -- has zero dimensions - 11: including resource -- \stopmessages \startmessages czech library: figures title: obrazy 1: obraz -- nelze nalezt 2: obraz -- nepritomen - 3: dimenze obrazu -- vypujceny od -- + 3: dimensions of -- are determined externally 4: dimenze obrazu -- nacteny primo z jeho souboru - 5: dimenze obrazu -- nacteny ze souboru obrazu -- - 6: dimenze obrazu -- spocteny programem TeXUtil - 7: musite znovu vygenerovat soubor obrazu -- + 5: dimensions of -- are unknown + 6: dimenze obrazu -- spocteny programem rlxtools 8: obrazovy objekt -- je znovu pouzit - 9: figure -- is not handled - 10: figure -- has zero dimensions - 11: including resource -- \stopmessages \startmessages italian library: figures title: figure 1: figura -- non trovata 2: la figura -- non è preimpostata - 3: dimensioni della figura -- prese da -- + 3: dimensions of -- are determined externally 4: dimensioni di -- caricate dal file di immagini stesso - 5: dimensioni di -- caricate dal file di immagini -- - 6: dimensioni di -- calcolate da TeXUtil - 7: bisogna rigenerare il file di immagini -- + 5: dimensions of -- are unknown + 6: dimensioni di -- calcolate da rlxtools 8: oggetto-figura -- riutilizzato - 9: figura -- non gestita - 10: la figura -- ha dimensioni nulle - 11: including resource -- \stopmessages \startmessages romanian library: figures title: figuri 1: figura -- nu poate fi gasita 2: figura -- nu este presetata - 3: dimensiunea figurii -- se imprumuta din -- + 3: dimensions of -- are determined externally 4: dimensiunea figurii -- se incarca din fisierul insusi - 5: dimensiunea figurii -- se incarca din fisierul -- - 6: dimensiunea figurii -- este calculata de TeXutil - 7: trebuie sa refaceti fisierul imagine -- + 5: dimensions of -- are unknown + 6: dimensiunea figurii -- este calculata de rlxtools 8: obiectul figura -- este refolosit - 9: sufixul -- din figura -- nu este folosit - 10: figura -- are dimensiuni nule - 11: including resource -- \stopmessages \startmessages french library: figures title: figures 1: la figure -- ne peut être trouvée 2: la figure -- n'est pas pré-sélectionnée - 3: les dimensions de la figure -- adaptées à partir de -- + 3: dimensions of -- are determined externally 4: les dimensions de -- chargées implicitement à partir du fichier de figure - 5: les dimensions de -- chargées à partir du fichier de figure -- - 6: les dimensions de -- calculées par TeXUtil - 7: regénérer le fichier de figure -- + 5: dimensions of -- are unknown + 6: les dimensions de -- calculées par rlxtools 8: figureobject -- est réutilisé - 9: la figure -- n'est pas manipulée - 10: la figure -- a des dimensions nulles - 11: inclusion de la ressource -- \stopmessages %D Due to the mere fact that \DVI|/|\PDF\ drivers differ in their @@ -153,10 +122,15 @@ %D dimensions. Whatever we calculate, the results will come %D available in the next registers. -\newcount \figxsca -\newcount \figysca -\newdimen \fighei -\newdimen \figwid +\letempty \@@DriverImageBox +\letempty \@@DriverImageOptions +\letempty \@@DriverImageWidth +\letempty \@@DriverImageHeight +\letempty \@@DriverImageFile +\letempty \@@DriverImageLabel +\letempty \@@DriverImageType +\letempty \@@DriverImageMethod +\letempty \@@DriverImagePage %D Because looking for dimensions can take many steps (locating %D the figure, maybe on more directories, scanning the figure @@ -167,863 +141,350 @@ %D we can set a switch and get some information on what takes %D place. -\newif\iftraceexternalfigures % \traceexternalfigurestrue - -\let\traceexternalfigures \traceexternalfigurestrue - -%D Another switch tells \CONTEXT\ to locate and calculate a -%D figure, but does not actually insert it. Especially when we -%D use \PDFTEX\ this saves a lot of time on trialruns. (Keep -%D in mind that \PDFTEX\ is both a \TEX\ pre|| and postprocessor.) - -\newif\ifskipexternalfigures % \skipexternalfigurestrue +\newif\iftraceexternalfigures -%newif\ifsplitexternalfigures +\let\traceexternalfigures\traceexternalfigurestrue -%D A last switch inhibits running \TEXUTIL. Lets do it when -%D possible. - -\newif\ifrunutilityfile % \runutilityfiletrue -\newif\ifconsultutilityfile \consultutilityfiletrue - -%D When I ever decide to change the format of the figure -%D directory file that \TEXUTIL\ produces, the next number -%D needs to be changed. - -\edef\figureversion{1996.06.01} - -%D We keep track of the current state by setting a variable -%D which value is related to the method that provided the -%D dimensions. - -\chardef\figurefilemode=0 - -%D The next values are set: -%D -%D \startitemize[packed] -%D \sym 0 the dimensions are not found -%D \sym 1 the dimensions are not preset at all -%D \sym 2 the dimensions are taken from other -%D \sym 3 the dimensions are taken from figure -%D \sym 4 the dimensions are taken from texutil.tuf -%D \sym 5 the dimensions are generated by texutil.tmp -%D \stopitemize -%D -%D In our search for the right file, that is, when no -%D filetype is specified, we scan for the next set of files. -%D As one can see, we prefer outlines over bitmaps. - -\def\figuretypes{\c!eps,\c!mps,\c!pdf,\c!svg,\c!svg z,\c!png,\c!jpg,\c!tif} % ,\c!tex,\c!tmp} % \c!mov - -%D Instead of using a comma separated list, we could have use a -%D faster alternative, but the current implementation is not -%D that slow either. -%D -%D Sorry for those who want to understand every bit, but I -%D will only sparse comment on the next macros. These macros -%D evolved out of the original macros and thereby lost all of -%D their beauty. -%D -%D We save the progess state in a macro. The main reason for -%D this is that otherwise the log would end up intermingled -%D with \TEX's hard coded file loading messages and launching -%D \TEXUTIL. - -\def\@@eftrace#1% +\def\doshowfigurestate {\iftraceexternalfigures - \edef\externalfigurelog{\externalfigurelog[#1]\space}% - \fi} - -\let\@@efcurrenttype\empty -\let\@@efcurrentpath\empty -\let\@@efcurrentfile\empty - -% \def\analyzefigurefiles -% {\let\externalfigurelog\empty -% \let\@@efcurrenttype\empty -% \let\@@efcurrentpath\empty -% \let\@@efcurrentfile\empty -% \doanalyzefigurefiles\doanalyzefigurefilesA -% \doanalyzefigurefiles\doanalyzefigurefilesB -% \doanalyzefigurefiles\doanalyzefigurefilesC} -% -% but, we also want to support direct paths, like e:/.... - -\def\redoanalyzefigurefiles#1% - {\ifcase\figurestatus - \def\@@efcurrenttype{#1}% - \dododoanalyzefigurefiles\empty - \fi} - -\def\analyzefigurefiles - {\let\externalfigurelog\empty - \let\@@efcurrenttype\empty - \let\@@efcurrentpath\empty - \let\@@efcurrentfile\empty - % empty path list if hard coded path - \doanalyzefigurefiles\doanalyzefigurefilesA - \doanalyzefigurefiles\doanalyzefigurefilesB - \doanalyzefigurefiles\doanalyzefigurefilesC - % new, permits rather raw names like e:/.... -\ifx\@@effilepath\empty - % we don't want a global search (happens with empty path) -\else - \@@eftrace{checking filepath "\@@effilepath"}% - \let\dodoanalyzefigurefiles\redoanalyzefigurefiles - \doanalyzefigurefiles\doanalyzefigurefilesA - \doanalyzefigurefiles\doanalyzefigurefilesB - \doanalyzefigurefiles\doanalyzefigurefilesC -\fi} - -%D The previous macro suggests that there are three main -%D methods applied. First we pass over all types and -%D directories specified and as soon as we find a suitable -%D candidate, we try to find its dimensions. When we cannot in -%D any way find the dimensions, directly, using the utility -%D file, or using \TEXUTIL\ directly, we revert to the second -%D method, and make a pass over all utility files. The last -%D method scans the utility files for files with the same name, -%D but different type. - -\let\figurepathlist\empty - -\def\doanalyzefigurefiles#1% - {\let\dodododoanalyzefigurefiles#1% - \processcommacommand[\@@eftype]\dodoanalyzefigurefiles} - -\def\dodoanalyzefigurefiles#1% - {\ifcase\figurestatus - \def\@@efcurrenttype{#1}% - \processcommacommand[\figurepathlist]\dododoanalyzefigurefiles - \fi} - -\def\dododoanalyzefigurefiles#1% todo: use the \applied ones, less messy - {\ifcase\figurestatus - \def\@@efcurrentpath{#1}% - \sanitizefilename#1\to\@@efcurrentpath - \@@eftrace{checking path "\@@efcurrentpath"}% - \doiffileinsertionsupportedelse\@@efcurrenttype - {\assignfullfilename{\@@efcurrentpath}{\@@effilename.\figureextension{\@@efcurrenttype}}\to\@@efcurrentfile - \dodododoanalyzefigurefiles} - \donothing + \expandafter\writestatus\expandafter\m!figures + \else + \expandafter\gobbleoneargument \fi} -%D Here is our first method: we scan the file directly, parse -%D the utility file next, and finaly run \TEXUTIL. The latter -%D two of course only take place when the first scan fails. - -\def\doanalyzefigurefilesA - {\ifcase\figurestatus - \@@eftrace{locating \@@efcurrentfile\space as \@@efcurrenttype}% - \doiffileelse\@@efcurrentfile - {\getfiguredimensionsA - \getfiguredimensionsB - \getfiguredimensionsC} - \donothing +\def\doshowfiguremessage + {\iftraceexternalfigures + \expandafter\gobbletwoarguments + \else + \expandafter\showmessage\expandafter\m!figures \fi} -%D It is possible to let \TEX\ determine the dimensions itself. -%D The next macro shows how such a test is implemented. The -%D special driver \type {supp-tpd} shows some more. - -%D The check on extension prevents problems when drivers are -%D not loaded well, in which case the tex one comes first. -%D -%D Should be a special! - -% never change the vsize / hsize here, is taken from env +%D Another switch tells \CONTEXT\ to locate and calculate a +%D figure, but does not actually insert it. Especially when we +%D use \PDFTEX\ this saves a lot of time on trialruns. (Keep +%D in mind that \PDFTEX\ is both a \TEX\ pre|| and postprocessor.) -\def\dogetfiguresizetex#1#2#3#4#5#6% file pagina ... - {\doifinsetelse\@@effiletype{\c!tex,\c!tmp} - {\ifx\@@efcurrentpath\empty\executedfalse\else\executedtrue\fi} - \executedfalse - \ifexecuted - \global\setbox\foundexternalfigure\vbox - {\insidefloattrue - \forgetall - \blank[\v!disable]% niet meer weg ! - \startreadingfile - \readfile{#1}\donothing\donothing - \stopreadingfile - \endgraf - \removelastskip}% - \global\setbox\foundexternalfigure\hbox - {\raise\dp\foundexternalfigure\box\foundexternalfigure}% - #3\zeropoint - #4\zeropoint - #5\wd\foundexternalfigure - #6\ht\foundexternalfigure - \else - \@@eftrace{ignored}% - \fi} +\newif\ifskipexternalfigures % can be set elsewhere -\let\dogetfiguresizetmp\dogetfiguresizetex +% \newif\ifrunutilityfile +% \newif\ifconsultutilityfile +% +% Let's save two hash entries: -%D Here we start scanning the other types: +\let\runutilityfiletrue \relax \let\runutilityfilefalse \relax +\let\consultutilityfiletrue\relax \let\consultutilityfilefalse\relax -% TODO: svg, get figuresize from file, but when not supported by -% backend, don't use it yet (else backend will force replacement). +%D The basic setup. -\def\@@dogetfiguresize{dogetfiguresize} +\def\setupexternalfigures + {\dosingleempty\dosetupexternalfigures} -\def\getfiguredimensionsA - {\ifcase\figurestatus - \@@eftrace{analyzing \@@efcurrentfile\space on \@@efcurrentpath\space as \@@efcurrenttype}% - \!!widthb\zeropoint % ? - \doifdefinedelse{\@@dogetfiguresize\@@efcurrenttype} - {\executedtrue - \getvalue{\@@dogetfiguresize\@@efcurrenttype}% - \@@efcurrentfile\@@efpage - \!!widtha\!!heighta\!!widthb\!!heightb} - \executedfalse - \ifexecuted - \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 - \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\plusthree - \doifelse\@@efcurrenttype\c!eps - {\ifcase\EPScreator - \@@eftrace{found}% - \else - \let\@@efcurrenttype\c!mps - \@@eftrace{mps found}% - \fi} - {\@@eftrace{found}}% - \geteparameters % e ! - [\??ep] - [\c!x=\the\!!widtha,\c!y=\the\!!heighta, - \c!w=\the\!!widthb,\c!h=\the\!!heightb]% - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile - \else - \@@eftrace{not found}% - \fi - \fi} +\def\dosetupexternalfigures[#1]% + {\getparameters[\??ef][#1]% local settings + \getparameters[\??ex][#1]% global settings + \setfigurepathlist} % the path may be used elsewhere too (as in x-res-04) -\def\dogetfiguresizepdf#1#2#3#4#5#6% - {\dogetPDFmediabox{#1}{#3}{#4}{#5}{#6}} - -\def\dogetfiguresizeeps#1#2#3#4#5#6% - {\dogetEPSboundingbox{#1}{#3}{#4}{#5}{#6}} - -\def\dogetfiguresizemps - {\dogetfiguresizeeps} - -\def\dogetfiguresizesvg#1#2#3#4#5#6% - {\doifelse\@@effiletype\c!svg\executedtrue\executedfalse - \ifexecuted - #3\zeropoint - #4\zeropoint - \startnointerference - \startXMLignore - \defineXMLcommand[svg][width=100,height=75] -% {\global\dimen1=\XMLpar{svg}{width}{0}\onebasepoint -% \global\dimen3=\XMLpar{svg}{height}{0}\onebasepoint - {\doifdimensionelse{\XMLop{width}} - {\global\dimen1=\XMLop{width}} - {\global\dimen1=\XMLop{width}\onebasepoint}% - \doifdimensionelse{\XMLop{width}} - {\global\dimen3=\XMLop{height}} - {\global\dimen3=\XMLop{height}\onebasepoint}% - \endinput}% - \processXMLfilegrouped{#1}% - \stopXMLignore - \stopnointerference - #5=\dimen1\relax - #6=\dimen3\relax - \else - \@@eftrace{ignored}% - \fi} +%D Intermediate, private. -\def\getfiguredimensionsB - {\ifcase\figurestatus\ifcase\figurefilemode\else -\doifsomething\@@efcurrentpath -{% - \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname - \edef\@@effilenametype{\@@effilename.\@@efcurrenttype}% - \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilenametype}% - \pushendofline - \startreadingfile - \let\presetfigure\presetfigureA - \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing - \stopreadingfile - \popendofline - \@@eftrace{\ifcase\figurestatus not \fi found}% -}% - \fi\fi} - -\def\presetfigureA[#1][#2]% - {\ifcase\figurestatus - \@EA\DOIF\@EA{\@@effilenametype}{#1} % hm, tzt ook nog eens met pad/naam - {\getparameters[\??ep][#2]% - \ExpandBothAfter\doif\@@epe\@@efcurrenttype - {\chardef\figurestatus\plusfour - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile}}% - \else - \endinput - \fi} +\newdimen\determinedfigurewidth +\newdimen\determinedfigureheight -\def\getfiguredimensionsC - {\ifconsultutilityfile \ifrunutilityfile - \ifcase\figurestatus\ifcase\figurefilemode\else - \doifsomething\@@efcurrentpath - {\doifnotinset\@@effiletype{\c!tex,\c!tmp} - {\doiffileelse\@@efcurrentfile - {\edef\@@effilenametype{\@@effilename.\@@efcurrenttype}% - \@@eftrace{running texutil on \@@effilenametype}% - \def\@@efloadname{\f!utilityfilename.\f!temporaryextension}% - \executesystemcommand{texutil --fig --out=\@@efloadname\space\@@effilenametype}% - \@@eftrace{analyzing \@@efloadname\space on \@@effilenametype}% - \pushendofline - \startreadingfile - \let\presetfigure\presetfigureB - \readsetfile{.}\@@efloadname\donothing\donothing - \stopreadingfile - \popendofline - \@@eftrace{\ifcase\figurestatus not \fi found}} - {}}}% - \fi\fi - \fi\fi} - -\def\presetfigureB[#1][#2]% - {\getparameters[\??ep][#2]% - \chardef\figurestatus=6 % ?????????????????? - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile} - -%D The second pass over types and directories uses the -%D utilility files. - -\def\doanalyzefigurefilesB - {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else - \doifsomething\@@efcurrentpath - {\assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname - \edef\@@effilenametype{\@@effilename.\figureextension{\@@efcurrenttype}}% - \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilenametype}% - \pushendofline - \startreadingfile - \let\presetfigure\presetfigureC - \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing - \stopreadingfile - \popendofline - \@@eftrace{\ifcase\figurestatus not \fi found}}% - \fi\fi\fi} +\let\naturalfigureheight\!!zeropoint +\let\naturalfigurewidth \!!zeropoint -\def\presetfigureC[#1][#2]% - {\ifcase\figurestatus - \@EA\DOIF\@EA{\@@effilenametype}{#1} - {\getparameters[\??ep][#2]% - \doif\@@epe\@@efcurrenttype - {\chardef\figurestatus\plusfour - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile}}% - \else - \endinput - \fi} +\def\defaultfigurewidth {8\lineheight} +\def\defaultfigureheight{6\lineheight} -%D The last and third pass mainly differs from the second in -%D being more tolerant. +\def\defaultfigurepathsignal{(\v!default)} -\def\doanalyzefigurefilesC - {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else - \doifsomething\@@efcurrentpath - {\assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname - \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilename.* surrogate}% - \pushendofline - \startreadingfile - \let\presetfigure\presetfigureD - \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing - \stopreadingfile - \popendofline - \@@eftrace{\ifcase\figurestatus not \fi found}}% - \fi\fi\fi} +\def\checknaturalfiguredimensions + {\edef\naturalfigurewidth{\the\dimexpr\ifzeropt\determinedfigurewidth + \defaultfigurewidth \else\determinedfigurewidth \fi\relax}% + \edef\naturalfigureheight{\the\dimexpr\ifzeropt\determinedfigureheight + \defaultfigureheight\else\determinedfigureheight\fi\relax}} -\def\presetfigureD[#1][#2]% - {\ifcase\figurestatus - \@EA\DOIFINSTRINGELSE\@EA{\@@effilename.}{#1} - {\getparameters[\??ep][#2]% - \ExpandBothAfter\doifinsetelse\@@epe\@@efcurrenttype - {\chardef\figurestatus4 - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile}% - \donothing} - \donothing - \else - \endinput - \fi} +%D Locating figures. Dilemma: we do support eps and svg parsing but drivers +%D don't always support it. -%D While loading the utility file (often \type {texutil.tuf}) -%D the next command (when present) aborts reading when the -%D versions don't match. +\def\figuretypes{\c!mps,\c!pdf,\c!eps,\c!svg,\c!svg z,\c!png,\c!tif,jb2,\c!jpg} -\def\thisisfigureversion#1% - {\doifnot\figureversion{#1} - {\showmessage\m!figures7\@@efloadname - \endinput}} +\def\supportedfiguretypes{\figuretypes} -%D Some files, take for instance movies, cannot easilly be -%D parsed on dimensions, that is, not yet. Although the current -%D mechanism has no problems with this, as long as the user -%D specified width and height reflect the right aspect ratio. -%D Nevertheless, when one does not want any scanning done, one -%D can disable \type{preset}. When no preset is needed, we only -%D locate the file. +\def\checksupportedfiguretypes + {\begingroup + \global\let\supportedfiguretypes\empty + \def\docommand##1% + {\doiffileinsertionsupportedelse{##1} + {\doglobal\addtocommalist{##1}\supportedfiguretypes} + \donothing}% + \processcommacommand[\figuretypes]\docommand + \gdef\checksupportedfiguretypes{\let\figuretypes\supportedfiguretypes}% + \endgroup + \checksupportedfiguretypes} + +%D The next box is used to store the graphic. It's globally assigned. -\def\locatepresetfigurefiles - {\processcommacommand[\@@eftype]\dolocatepresetfigurefiles} +\newbox\foundexternalfigure -\def\dolocatepresetfigurefiles#1% - {\def\@@efcurrenttype{#1}% - \processcommacommand[\figurepathlist]\dodolocatepresetfigurefiles} +\chardef\figurestatus\zerocount % nothing found -\def\dodolocatepresetfigurefiles#1% - {\ifcase\figurestatus - \doiffileinsertionsupportedelse\@@efcurrenttype - {\assignfullfilename{#1}{\@@effilename.\figureextension{\@@efcurrenttype}}\to\@@efcurrentfile - \@@eftrace{only searching for \@@efcurrentfile}% - \doiffileelse\@@efcurrentfile - {\chardef\figurestatus\plusone - \let\@@eftype\@@efcurrenttype - \let\@@effullname\@@efcurrentfile}% - \donothing} - \donothing - \fi} +\def\noffigurepages{\nofinsertpages} -%D Here we locate the to-be converted images (if needed). +%D Variables. -\def\locatefigureconversionfile - {\processcommacommand[\figurepathlist]\dolocatefigureconversionfile} +\newtoks\everyexternalfigureresets -\def\dolocatefigureconversionfile#1% - {\ifcase\figurestatus - \sanitizefilename#1\to\@@efconversionpath - \assignfullfilename{\@@efconversionpath}{\@@efconversionfile.\@@efconversiontype}\to\@@efconversionfull - \@@eftrace{searching for original \@@efconversionfull}% - \doiffileelse\@@efconversionfull{\chardef\figurestatus\plusone}\donothing - \fi} +\def\resetfigurevariables + {\the\everyexternalfigureresets} -%D All these macros are in some way called by the macro \type -%D {\analyzefigurefiles}, which in turn is called by the next -%D macro. - -% bools gebruiken - -\def\setnaturalfiguresize - {\doifsomething\@@efwidth - {\global\figwid\@@efwidth}% - \doifsomething\@@efheight - {\global\fighei\@@efheight}% - \doifsomething\@@efscale - {\figxsca\@@efscale - \figysca\@@efscale}% - \doifsomething\@@efxscale - {\figxsca\@@efxscale}% - \doifsomething\@@efyscale - {\figxsca\@@efyscale}} - -\def\setfactorfiguresize - {\doifinsetelse\@@effactor{\v!max,\v!fit,\v!broad} - {\doapplyfiguresize - \ifdim\@@epw>\@@eph\relax - \docalculatefigurenorm\figwid\@@effactor\@@efmaxwidth\hsize\@@efhsize - \docalculatefigurescales\figwid\@@epw\fighei\@@eph - \else - \docalculatefigurenorm\fighei\@@effactor\@@efmaxheight\figurevsize\@@efvsize - \docalculatefigurescales\fighei\@@eph\figwid\@@epw - \fi - \!!doneatrue} - {\doifinsetelse\@@efhfactor{\v!max,\v!fit,\v!broad} - {\doapplyfiguresize - \docalculatefigurenorm\fighei\@@efhfactor\@@efmaxheight\figurevsize\@@efvsize - \docalculatefigurescales\fighei\@@eph\figwid\@@epw - \!!doneatrue} - {\doifinsetelse\@@efwfactor{\v!max,\v!fit,\v!broad} - {\doapplyfiguresize - \docalculatefigurenorm\figwid\@@efwfactor\@@efmaxwidth\hsize\@@efhsize - \docalculatefigurescales\figwid\@@epw\fighei\@@eph - \!!doneatrue} % max ??? - {\docalculatefigurenorm\fighei\@@effactor \@@efheight \textheight\@@efvsize - \docalculatefigurenorm\fighei\@@efhfactor\@@efheight \textheight\@@efvsize - \docalculatefigurenorm\figwid\@@efwfactor\@@efwidth\hsize\hsize - \!!doneafalse}}}% - \if!!donea - \ifdim\figwid>\@@efhsize\relax - \global\fighei\zeropoint - \global\figwid\@@efhsize - \else\ifdim\fighei>\@@efvsize\relax - \global\fighei\@@efvsize - \global\figwid\zeropoint - \fi\fi - \fi} +%D Example usage: -\def\setscalefiguresize - {\doifsomething{\@@efscale\@@efxscale\@@efxscale} - {\doapplyfigurescale\figwid\@@epw\figxsca\@@efxscale - \doapplyfigurescale\fighei\@@eph\figysca\@@efyscale - \global\figwid\zeropoint - \global\fighei\zeropoint - \doifelsenothing\@@efmaxwidth - {\doifsomething\@@efmaxheight - {\ifdim\@@eph>\@@efmaxheight - \global\fighei\@@efmaxheight - \fi}} - {\ifdim\@@epw>\@@efmaxwidth - \global\figwid\@@efmaxwidth - \fi}}} - -\let\@@efgrid\empty - -\def\dosetdimensionfiguresize#1#2#3% - {#1\relax - \doifsomething\@@efmaxwidth {\ifdim\figwid>\@@efmaxwidth \global\figwid\@@efmaxwidth #2\relax\fi}% - \doifsomething\@@efmaxheight{\ifdim\fighei>\@@efmaxheight\global\fighei\@@efmaxheight#3\relax\fi}} - -\def\setdimensionfiguresize - {\ifdim\figwid>\zeropoint\relax - \ifdim\fighei>\zeropoint\relax - \dosetdimensionfiguresize - {\docalculatefigurescale\fighei\@@eph\figysca - \docalculatefigurescale\figwid\@@epw\figxsca}% - {\docalculatefigurescale\fighei\@@eph\figysca - \docalculatefigurescale\figwid\@@epw\figxsca}% - {\docalculatefigurescale\fighei\@@eph\figysca - \docalculatefigurescale\figwid\@@epw\figxsca}% - \else - \dosetdimensionfiguresize - {\docalculatefigurescales\figwid\@@epw\fighei\@@eph}% - {\docalculatefigurescales\figwid\@@epw\fighei\@@eph}% - {\docalculatefigurescales\figwid\@@epw\fighei\@@eph}% - \fi - \else - \ifdim\fighei>\zeropoint\relax - \dosetdimensionfiguresize - {\docalculatefigurescales\fighei\@@eph\figwid\@@epw}% - {\docalculatefigurescales\fighei\@@eph\figwid\@@epw}% - {\docalculatefigurescales\fighei\@@eph\figwid\@@epw}% - \else - \dosetdimensionfiguresize - {\doapplyfigurescale\figwid\@@epw\figxsca\@@efxscale - \doapplyfigurescale\fighei\@@eph\figysca\@@efyscale}% - {\docalculatefigurescales\figwid\@@epw\fighei\@@eph}% - {\docalculatefigurescales\fighei\@@eph\figwid\@@epw}% - \fi +\appendtoks + \global\let\externalfigurelog\empty +\to\everyexternalfigureresets + +%D Intermediate, private + +\def\resetprivatefigurevariables + {\let \wantedfigurefull \empty + \let \wantedfigurepath \empty + \let \wantedfigurename \empty + \let \wantedfigurebase \empty + \let \wantedfiguretype \empty + \let \wantedfigurefullname \empty + \let \wantedfiguretypespec \empty + \let \wantedfiguremethod \empty + \let \wantedfigurepage \empty + \let \wantedfigureoptions \empty + \let \wantedfigureconversion\empty + \let \wantedfigureprefix \empty + \let \wantedfiguretypelist \figuretypes + \let \figurepathlist \empty + \chardef \figurestatus \zerocount + \let \expandedfigurename \empty + \global\let \analyzedfigurewidth \!!zeropoint % set by indentifying code + \global\let \analyzedfigureheight \!!zeropoint % set by indentifying code + \global\setbox\foundexternalfigure \emptybox + \def \frozenfigurestamp {\externalfigurestamp}} % no edef + +\resetprivatefigurevariables + +\appendtoks + \resetprivatefigurevariables +\to\everyexternalfigureresets + +%D Private/public. + +\def\resetpublicfigurevariables + {\let\figurewidth \!!zeropoint + \let\figureheight \!!zeropoint + \let\figurenaturalwidth \!!zeropoint + \let\figurenaturalheight \!!zeropoint + \let\figurelabel \empty + \let\figurefileoriginal \empty + \let\figurefileoptions \empty + \let\figurefilename \empty + \let\figurefiletype \empty + \let\figurefilepage \!!zerocount + \let\figurefileconversion\empty + \let\figurefileprefix \empty + \let\figurefilepath \empty + \let\figurefilecache \empty} + +\resetpublicfigurevariables + +\appendtoks + \resetpublicfigurevariables +\to\everyexternalfigureresets + +\newcounter\figurenestinglevel + +\def\pushpublicfigurevariables + {\ifcase\figurenestinglevel\else + \doshowfigurestate{variables : push}% + \globalpushmacro\figurewidth + \globalpushmacro\figureheight + \globalpushmacro\figurenaturalwidth + \globalpushmacro\figurenaturalheight + \globalpushmacro\figurelabel + \globalpushmacro\figurefileoriginal + \globalpushmacro\figurefileoptions + \globalpushmacro\figurefilename + \globalpushmacro\figurefiletype + \globalpushmacro\figurefilepage + \globalpushmacro\figurefileconversion + \globalpushmacro\figurefileprefix + \globalpushmacro\figurefilepath + \globalpushmacro\figurefilecache \fi} -\def\setupexternalfigures - {\dosingleempty\dosetupexternalfigures} - -\def\dosetupexternalfigures[#1]% needs a good clean up - {\getparameters[\??ex][#1]% - \getparameters[\??ef][#1]% dangerous for figs with backgrounds - \checkfiguresettings - \doifelsenothing\@@exlocation % fig file paths - {\scratchcounter\plusthree} - {\doifelsenothing\@@exfile % tuf file paths - {\scratchcounter\plusthree} - {\scratchcounter\zerocount - \ExpandBothAfter\doifinset\v!local\@@exlocation - {\advance\scratchcounter\plusone}% - \ExpandBothAfter\doifinset\v!global\@@exlocation - {\advance\scratchcounter\plustwo}}}% - \chardef\figurefilemode\scratchcounter\relax - \ifcase\figurefilemode - \let\figurepathlist\f!currentpath - \or % lokaal - \let\figurepathlist\f!currentpath - \or % globaal - \let\figurepathlist\@@exdirectory - \or % lokaal,globaal / non empty gebied - % was: - % \edef\figurepathlist{\f!currentpath\ifx\@@exdirectory\empty\else,\@@exdirectory\fi}% - % but test is to weak (can be empty \allinputpaths) - \doifelsenothing\@@exdirectory - {\edef\figurepathlist{\f!currentpath}}% - {\edef\figurepathlist{\f!currentpath,\@@exdirectory}}% - \fi - \ExpandBothAfter\doifinset\v!default\@@exlocation - {\edef\figurepathlist{\figurepathlist,}}% default tex path search - \ifx\@@exfile\empty - \chardef\figurefilemode\zerocount +\def\poppublicfigurevariables + {\ifcase\figurenestinglevel\else + \doshowfigurestate{variables : pop}% + \globalpopmacro\figurefilecache + \globalpopmacro\figurefilepath + \globalpopmacro\figurefileprefix + \globalpopmacro\figurefileconversion + \globalpopmacro\figurefilepage + \globalpopmacro\figurefiletype + \globalpopmacro\figurefilename + \globalpopmacro\figurefileoptions + \globalpopmacro\figurefileoriginal + \globalpopmacro\figurelabel + \globalpopmacro\figurenaturalheight + \globalpopmacro\figurenaturalwidth + \globalpopmacro\figureheight + \globalpopmacro\figurewidth + \fi} + +\def\setpublicfigurevariables % todo: type vs typespec + {\xdef\figurewidth {\the\wd\foundexternalfigure}% + \xdef\figureheight {\the\ht\foundexternalfigure}% + \xdef\figurenaturalwidth {\naturalfigurewidth}% + \xdef\figurenaturalheight {\naturalfigureheight}% + \xdef\figurelabel {\wantedfigurelabel}% + \xdef\figurefilepath {\wantedfigurepath}% + \xdef\figurefilename {\wantedfigurename}% + \xdef\figurefiletype {\wantedfiguretypespec}% + \xdef\figurefilepage {\wantedfigurepage}% + \xdef\figurefileoptions {\wantedfigureoptions}% + \xdef\figurefileconversion{\wantedfigureconversion}% + \xdef\figurefilecache {\wantedconversioncache}% + \xdef\figurefileprefix {\wantedconversionprefix}% + \xdef\figurefileoriginal {\wantedconversionname}% + \xdef\figurefullname {\wantedfigurepath/\wantedfigurename.\wantedfiguretypespec}% + \ifcase\figurestatus + \let\figurefiletype\empty % ? \fi} -%D The next one is for instance used in symbols: +\def\setpublicfigurescalevariables + {\edef\figurescalewidth {\finalscaleboxwidth }% + \edef\figurescaleheight {\finalscaleboxheight}% + \edef\figurescalexscale {\finalscaleboxxscale}% + \edef\figurescaleyscale {\finalscaleboxyscale}} -\def\resetexternalfigures - {\setupexternalfigures - [\c!option=,\c!maxwidth=,\c!maxheight=, - %\c!splitcolor=,% needed ? - \c!foregroundcolor=,\c!color=, - %\c!conversion=,\c!prefix=, - \c!frame=\v!off,\c!background=]} +\def\resetpublicfigurescalevariables + {\let\figurescalewidth \!!zeropoint + \let\figurescaleheight \!!zeropoint + \let\figurescalexscale \!!plusone + \let\figurescaleyscale \!!plusone} -%D Since we only need to reset some parameters, we can -%D better use a faster alternative: +\resetpublicfigurescalevariables -\def\resetexternalfigures - {\getparameters[\??ef] - [\c!option=,\c!maxwidth=,\c!maxheight=, - %\c!splitcolor=,% needed ? - \c!foregroundcolor=,\c!color=, - %\c!conversion=,\c!prefix=, - \c!frame=\v!off,\c!background=]} +\appendtoks + \resetpublicfigurescalevariables +\to \everyexternalfigureresets +%D The next one is for instance used in symbols. Since +%D we only need to reset some parameters, we can +%D better use the fast alternative: +%D +%D \starttyping +%D \def\resetexternalfigures +%D {\getparameters[\??ef] +%D [\c!option=,\c!maxwidth=,\c!maxheight=, +%D \c!foregroundcolor=,\c!color=, +%D %\c!conversion=,\c!prefix=,\c!splitcolor=, +%D \c!frame=\v!off,\c!background=]} +%D \stoptyping +%D %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\@@efoption \empty - \let\@@efmaxwidth \empty - \let\@@efmaxheight \empty + {\let\@@efoption \empty % \let\@@efprefix\empty + \let\@@efmaxwidth \empty % \let\@@efcache \empty + \let\@@efmaxheight \empty % \let\@@efframe \v!off \let\@@efforegroundcolor\empty \let\@@efcolor \empty \let\@@efconversion \empty - %\let\@@efprefix \empty - %\let\@@efcache \empty - %\let\@@efframe \v!off \let\@@efbackground \empty} -% The following code will move: +%D The following code will move: \appendtoks \resetexternalfigures \to \everyoverlay \appendtoks \resetexternalfigures \to \everybeforepagebody % not really needed - %appendtoks \resetexternalfigures \to \everysymbol -\def\docalculatefigurenorm#1#2#3#4#5% - {\processaction - [#2] - [ \v!max=>\global#1=#4\relax, - \v!fit=>\global#1=#5\relax, - \v!broad=>\global#1=#5\relax - \global\advance #1 -4\@@exbodyfont\relax, - \s!default=>\doifsomething{#3}{\global#1=#3\relax}, - \s!unknown=>\global#1=\@@exbodyfont\relax - \global\divide#1 \!!ten\relax - \global\multiply#1 #2\relax]} - -\beginTEX - - \def\docalculatefigurescales#1#2#3#4% - {\dimen0=#1\relax % #1 = new 1-value - \dimen2=#2\relax % #2 = old 1-value - \divide\dimen2 \plusthousand - \divide\dimen0 \dimen2 - \figxsca\dimen0 % x scale - \figysca\dimen0 % y scale - \dimen2=#4\relax % #4 = old 2-value - \divide\dimen2 \plusthousand - \multiply\dimen2 \dimen0 - #3=\dimen2 } % #3 = new 2-value - - \def\docalculatefigurescale#1#2#3% - {\dimen0=#1\relax % #1 = new value - \dimen2=#2\relax % #2 = old value - \divide\dimen2 \plusthousand - \divide\dimen0 \dimen2 - #3=\dimen0 } % #3 = schaal - -% \def\doapplyfigurescale#1#2#3% -% {\global#1=#2\relax -% \ifcase0\@@efscale\relax % beter: doifnum... -% #3=\plusthousand -% \else -% #3=\@@efscale -% \fi\relax % important ! -% \ifnum#3=\plusthousand\else -% \global\divide #1 \plusthousand -% \global\multiply#1 #3\relax -% \fi} - - \def\doapplyfigurescale#1#2#3#4% - {\global#1=#2\relax - \ifcase0#4\relax % @@ef.scale kan empty zijn - \ifcase0\@@efscale\relax % @@efscale kan empty zijn - #3=\plusthousand - \else - #3=\@@efscale - \fi - \else - #3=#4% - \fi - \ifnum#3=\plusthousand\else - \global\divide #1 \plusthousand - \global\multiply#1 #3\relax - \fi} - -\endTEX - -% test extensively, more precise since one pass double precission - -\beginETEX \dimexpr - - % todo: use \relax instead of () - - \def\docalculatefigurescales#1#2#3#4% - {\scratchdimen\dimexpr(#1/\dimexpr(#2/\plusthousand))% - \figxsca\scratchdimen - \figysca\figxsca - #3\dimexpr(\figxsca\dimexpr(#4/\plusthousand))} - - \def\docalculatefigurescale#1#2#3% - {#3\dimexpr(#1/\dimexpr(#2/\plusthousand))} - -% \def\doapplyfigurescale#1#2#3% -% {% #3=\ifnum0\number\@@efscale=\zerocount\plusthousand\else\@@efscale\fi -% \ifcase0\@@efscale\relax % @@efscale kan empty zijn -% #3=\plusthousand -% \else -% #3=\@@efscale -% \fi\relax % important ! -% \global#1\ifnum#3=\plusthousand#2\else\dimexpr(#3\dimexpr(#2/\plusthousand))\fi -% \relax} - - \def\doapplyfigurescale#1#2#3#4% todo: also #5 being sx/sy (\ifdim0#5=0pt ...) - {\ifcase0#4\relax % @@ef.scale kan empty zijn - \ifcase0\@@efscale\relax % @@efscale kan empty zijn - #3=\plusthousand - \else - #3=\@@efscale - \fi - \else - #3=#4% - \fi - \relax % important ! - \global#1\ifnum#3=\plusthousand#2\else\dimexpr#3\dimexpr#2/\plusthousand\relax\relax\fi - \relax} - -\endETEX - -\newdimen\figurevsize % we cannot manipulate any global vsize ! - -\def\doapplyfiguresize - {\doifelsenothing\@@efmaxheight - {\figurevsize\textheight - \ifinner - \figurevsize \vsize % \textheight =\vsize - \scratchdimen\vsize % \scratchdimen=\textheight - \else\ifinsidefloat - \figurevsize \vsize % \textheight =\vsize - \scratchdimen\vsize % \scratchdimen=\textheight - \else\ifinpagebody - \figurevsize \vsize % \textheight =\vsize - \scratchdimen\vsize % \scratchdimen=\textheight - \else % hm, there should be an option to force this - \ifdim\pagegoal<\maxdimen - \ifdim\pagetotal<\pagegoal - \scratchdimen\pagegoal - \advance\scratchdimen -\pagetotal - \else - \scratchdimen\figurevsize % \textheight - \fi - \else - \scratchdimen\figurevsize % \textheight - \fi - \fi\fi\fi} - {\figurevsize\@@efmaxheight}% - \doifelsenothing\@@efheight - {\edef\@@efvsize{\the\scratchdimen}} - {\let\@@efvsize\@@efheight}% - \doifelsenothing\@@efwidth - {\edef\@@efhsize{\the\hsize}} - {\let\@@efhsize\@@efwidth}} - -% \def\convertfigureinsertscale#1#2#3#4% -% {\scratchdimen#1\relax -% \ifnum#3=\plusthousand\else % better 1000 100 10 ranges, evt round 2sp -% \divide\scratchdimen \plusthousand -% \multiply\scratchdimen #3\relax -% \fi -% \scratchdimen-\scratchdimen % beter hier - dan in driver -% \edef#2{\the\scratchdimen}% oeps, \the vergeten -% \scratchdimen#3\points -% \divide\scratchdimen \!!ten -% \edef#4{\withoutpt\the\scratchdimen}} -% -% more obscure but better: - -\def\convertfigureinsertscale#1#2#3#4% - {\scratchdimen#1\relax - \ifnum#3=\plusthousand - % == scale 1 - \else - % better 1000 100 10 ranges, evt round 2sp - \divide\scratchdimen \plusthousand - \multiply\scratchdimen #3\relax - \fi - \scratchdimen-\scratchdimen % beter hier - dan in driver - \edef#2{\the\scratchdimen}% - \scratchcounter#3\relax - \ifnum\scratchcounter>\plustenthousand - \divide\scratchcounter \!!ten - \scratchdimen\the\scratchcounter\points - \else - \scratchdimen\the\scratchcounter\points - \divide\scratchdimen \!!ten - \fi - \edef#4{\withoutpt\the\scratchdimen}} - -\newbox\foundexternalfigure - -% \def\presetundefinedfigure#1% -% {\let\@@eftype #1% -% \let\@@effiletype #1% -% \let\@@efobject \v!no -% \let\@@efpreset \v!no -% \ifx\@@efwidth\empty -% \def\@@efwidth{8\lineheight}% 4cm -% \fi -% \ifx\@@efheight\empty -% \def\@@efheight{6\lineheight}% 3cm -% \fi} - -% \def\presetfiguremov{\presetundefinedfigure\c!mov} -% \def\presetfigureavi{\presetundefinedfigure\c!avi} - -\def\presetundefinedfigure#1#2% - {\let\@@eftype #2% - \let\@@effiletype#2% - \let\@@efobject \v!no - \ifcase#1\or - \let\@@efpreset\v!no - \ifx\@@efwidth\empty\def\@@efwidth{8\lineheight}\fi - \ifx\@@efwidth\empty\def\@@efwidth{6\lineheight}\fi - \fi} - -\def\presetfiguresvg{\presetundefinedfigure\zerocount\c!svg} -\def\presetfiguremov{\presetundefinedfigure\plusone \c!mov} -\def\presetfigureavi{\presetundefinedfigure\plusone \c!avi} - -% The page number (frame) is passed as first option. +%D We need this one for bookkeeping: \newcounter\forcedMPSobject % better something \every -%D We have arrived at one of the main macros, the one that -%D tries to analyze the figure, preloads it when possible, and -%D scales is according to the specifications. This macro is -%D quite unreadable, for which I appologize. The main -%D complication is that we have to catch all kind of border -%D cases, like \METAPOST\ graphics and buffers. +%D Features: + +% converted -> prefix, suffix +% alternative -> other suffix +% buffer -> prefix + +%D Still messy: + +\newtoks\everyfiguretypepresets + +\def\presetfiguretypeprocessing + {\the\everyfiguretypepresets} + +\def\presetspecialfigure#1% + {\doif\wantedfiguretype{#1}% + {\let\@@efobject\v!no + \let\@@efpreset\v!no + \ifx\@@efwidth \empty\def\@@efwidth {\defaultfigurewidth }\fi + \ifx\@@efheight\empty\def\@@efheight{\defaultfigureheight}\fi}} + +\appendtoks + \presetspecialfigure\c!mov + \presetspecialfigure\c!avi +\to \everyfiguretypepresets + +\def\checkformpsfigurefiles % to be checked + {\doif\wantedfigurename{mprun} + {\doshowfigurestate{type check : forcing mps (mprun)}% + \doifnotinstring{^\bufferprefix}{^\wantedfigurename} + {\edef\wantedfigurename{\bufferprefix\wantedfigurename}}% + \let\wantedfiguremethod \c!mps + \let\wantedfiguretypespec\c!mps}% + \doifnumberelse\wantedfiguretype + {\doshowfigurestate{type check : forcing mps (number)}% + \let\wantedfiguremethod \c!mps + \let\wantedfiguretypespec\c!mps} + \donothing + \doif\wantedfiguretypespec\c!mps + {\let\wantedfiguretypelist\wantedfiguretypespec + \ifcase\EPSspecial\else\ifinobject\else + \doglobal\increment\forcedMPSobject + \edef\externalfigurestamp{\c!mps::\forcedMPSobject}% + \let\@@efobject\v!yes + \fi\fi}} + +\appendtoks + \checkformpsfigurefiles +\to \everyfiguretypepresets + +\def\checkfortexfigurefiles % to be checked (brrr: c!) / brrr: eftype + {\doifinset\wantedfiguretype{\c!tex,\c!tmp} + {\let\wantedfiguretypespec \wantedfiguretype}% + \doifinset\wantedfiguretypespec{\c!tex,\c!tmp,\v!buffer} + {\doshowfigurestate{type check : forcing tex (\wantedfiguretypespec)}% + \let\wantedfiguretypelist\wantedfiguretypespec + \let\wantedfiguremethod \c!tex + \let\@@efobject\v!no + \doifnothing\wantedfiguretype{\let\wantedfiguretype\c!tmp}% + % there can be a non buffer \jobname.tmp (made by texexec) + \doifnotinstring{^\bufferprefix}{^\wantedfigurename} + {\edef\wantedfigurename{\bufferprefix\wantedfigurename}}}} + +\appendtoks + \checkfortexfigurefiles +\to \everyfiguretypepresets + +\def\checkforunknownfigurefiles + {\doifnothing\wantedfiguretype + {\dogetcommacommandelement\plusone\from\@@eftype\to\commalistelement + \edef\wantedfigurefullname{\wantedfigurename.\commalistelement}}} + +\appendtoks + \checkforunknownfigurefiles +\to \everyfiguretypepresets % note * : this is needed because reusable graphics % combined with funny page aspect aspect ratio's can lead to @@ -1033,509 +494,364 @@ % 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; for that I first -% need to patch texutil. - -\def\checkfiguresettings - {\doifsomething\@@eflines - {\scratchdimen\@@eflines\lineheight - \edef\@@efheight{\the\scratchdimen}}} +\chardef\splitexternalfigure\zerocount % 0 nosplit 1 split/yes 2 split/no -\chardef\splitexternalfigure=0 % 0 nosplit 1 split/yes 2 split/no - -\newif\ifgridfigure - -% the preset for mov/avi should move to the driver -% -% this whole mess needs a clean up anyway - -\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% - {\dontcomplain - \setupexternalfigures - \the\externalfigureresets % hook, see resource libraries - \global\figwid\zeropoint \figxsca\plusone % see note * - \global\fighei\zeropoint \figysca\plusone % see note * - \global\setbox\foundexternalfigure\box\voidb@x - % get rid of active / and : as well as expand for [\get...] cases - \sanitizefilename#3\to\expandedfigurename - % nil path search in case of path spec - \expanded{\checkfilename{\expandedfigurename}}% - \ifcase\kindoffile\else \let\figurepathlist\empty \fi -% \greedysplitstring\expandedfigurename\at.\to\@@effilename\and\@@effiletype -\splitfilename\expandedfigurename -\let\@@effilepath\splitoffpath -\let\@@effilename\splitoffname -\let\@@effiletype\splitofftype -\ifcase\splitoffkind\let\@@effilepath\empty\fi - \doifelse\@@effilename{mprun} - {\edef\@@effilepref{\bufferprefix}} - {\let \@@effilepref\empty}% - \edef\@@effilename{\@@effilepref\@@effilename}% -\ifx\@@effilepath\empty\else -% \addtocommalist\@@effilepath\figurepathlist - \edef\@@effilename{\@@effilepath/\@@effilename}% -\fi - \restorecatcodes % recently added; we presume local use - \def\@@eflabel{#2}% - \global\let\externalfigurelog\empty - \iftraceexternalfigures - \showmessage\m!figures{11}\expandedfigurename - \fi - \getparameters - [\??ep] - [\c!e=\s!unknown, - %\c!w=15\bodyfontsize,\c!h=10\bodyfontsize, - \c!w=8\lineheight,\c!h=6\lineheight, - \c!x=\!!zeropoint,\c!y=\!!zeropoint, - \c!t=,\c!s=,\c!a=,\c!f=\@@effilename]% - \getparameters - [\??ef] - [\c!type=\s!unknown,\c!method=\@@eftype,\c!symbol=\v!no, - \c!object=\@@exobject,\c!preset=\v!yes,\c!split=,\c!size=, - \c!page=0,\c!controls=\v!no,\c!preview=\v!no,\c!repeat=\v!no, - \c!maxwidth=\@@exmaxwidth,\c!maxheight=\@@exmaxheight, - \c!scale=,\c!xscale=,\c!yscale=,\c!width=,\c!height=,\c!display=,\c!lines=,\c!grid=, - %\c!foregroundcolor=, - \c!color=,\c!conversion=\@@exconversion,\c!prefix=\@@exprefix,\c!cache=\@@excache, - \c!factor=,\c!hfactor=,\c!wfactor=]% - % make into an installable list - \doifnothing\@@efconversion - {\doif\@@effiletype\c!mov\presetfiguremov - \doif\@@effiletype\c!avi\presetfigureavi - \doif\@@effiletype\c!svg\presetfiguresvg}% - #1[#4][#5][#6]% - % prefix in runs > 1 - \doifsomething\@@efconversion % added, forgotten - {\doifnotmode{\systemmodeprefix\v!first} - {\doifsomething\@@efprefix{\edef\@@effilename{\@@efprefix\@@effilename}}% - \let\@@effiletype\empty}}% beware, walks over the whole suffixlist - % new, somehow needed when \textwidth is used: - \doifsomething\@@efmaxwidth {\freezedimenmacro\@@efmaxwidth }% - \doifsomething\@@efmaxheight{\freezedimenmacro\@@efmaxheight}% - % lines -> height - \checkfiguresettings - % new - \doifinsetelse\@@efsize{mediabox,cropbox,artbox,bleedbox,trimbox} - {\let\@@DriverImageBox\@@efsize}% - {\let\@@DriverImageBox\empty}% - % new, color separation +\def\checkfigurecolorsettings + {% seperation, seldom used \doifseparatingcolorselse {\let\@@efforegroundcolor\empty \doifelsenothing\@@efsplit - {\chardef\splitexternalfigure0} + {\chardef\splitexternalfigure\zerocount} {\doifcolorchannelelse\@@efsplit - {\let\@@efobject\v!no % ? - \chardef\splitexternalfigure1} - {\chardef\splitexternalfigure2}}} - {\chardef\splitexternalfigure0}% - \relax % ends \chardef - % new, fake color in gray bitmaps + {\let\@@efobject\v!no % why? + \chardef\splitexternalfigure\plusone} + {\chardef\splitexternalfigure\plustwo}}} + {\chardef\splitexternalfigure\zerocount}% + % fake color in gray bitmaps, assumes that + % a transparent color is used \doifsomething\@@efforegroundcolor - {\getparameters[\??ef] - [\c!background={\v!foreground,\v!color}, - \c!backgroundcolor=\@@efforegroundcolor]}% + {\def\@@efbackground{\v!foreground,\v!color}% + \def\@@efbackgroundcolor{\@@efforegroundcolor}}% \doifsomething\@@efcolor {\doifcolorelse\@@efcolor {\checkpredefinedcolor[\@@efcolor]% \doregisterfigurecolor\@@efcolor}}% - \donothing - % - \doif\@@efreset\v!yes\resetexternalfigures - % todo: nop when conversion - \doif\@@eftype \c!mov\presetfiguremov - \doif\@@eftype \c!avi\presetfigureavi - \doif\@@eftype \c!svg\presetfiguresvg - % hack - \doif\@@efmethod\c!mov{\doifsomething\@@effiletype{\presetundefinedfigure1\@@effiletype}}% - \doif\@@efmethod\c!svg{\doifsomething\@@effiletype{\presetundefinedfigure0\@@effiletype}}% - % - \doif\@@eftype\v!buffer - {\ifx\@@effiletype\empty - \let\@@effiletype\c!tmp - \fi - \let\@@eftype\c!tex}% - \@EA\doifnumberelse\@EA{\@@effiletype}% new, test first - {\let\@@eftype\c!mps} - {\processaction - [\@@effiletype] - [ \c!tex=>\let\@@eftype\c!tex, % check - \c!tmp=>\let\@@eftype\c!tex % check - \edef\@@effilepref{\bufferprefix}% - \edef\@@effilename{\@@effilepref\@@effilename}, - % todo: nop when conversion - \c!avi=>\presetfigureavi, - \c!mov=>\presetfiguremov, - \c!svg=>\presetfiguresvg]}% - \edef\figuretypes{\figuretypes,\c!tex}% - \ifx\@@eftype\c!tex - % Since tex code can have positional stuff and worse, - % we want to avoid interference with how objects end - % up in files, therefore: - \let\@@efobject\v!no - \fi - \edef\@@efobjectname{\@@effilename-\@@eftype-\@@effiletype-\@@efpage}% will be configurable - \doifelse\@@efobject\v!no - \donefalse - {\doifspecialavailableelse\dostartscaling - {\doifobjectssupportedelse - {\doifobjectfoundelse{FIG}\@@efobjectname\donetrue\donefalse} - \donefalse} - \donefalse}% - % too strict: - % \doifparentfileelse\@@effilename - % {\@EA\removefromcommalist\@EA{\jobsuffix}\figuretypes - % \let\@@effiletype\empty - % \showmessage\m!figures9\@@effilename - % \donefalse} - % \donothing - % ok, but catcode problems with jobfilesuffix - \doifparentfileelse\@@effilename - {\@EA\removefromcommalist\@EA{\jobsuffix }\figuretypes - \@EA\removefromcommalist\@EA{\jobfilesuffix}\figuretypes}% - \donothing - % so we get: - \doifparentfileelse\@@effilename - {\removefromcommalist{pdf}\figuretypes - \removefromcommalist{tex}\figuretypes}% - \donothing - \ifdone - \getobjectdimensions{FIG}\@@efobjectname - \geteparameters % e ! - [\??ep] - [\c!x=\!!zeropoint,\c!y=\!!zeropoint, - \c!w=\objectwidth,\c!h=\objectheight]% - \chardef\figurestatus=5 - \edef\@@effullname{\@@effilepref\expandedfigurename}% - \else - \doifelse{#2}\s!figurepreset - {\def\figureextension##1{\@@effiletype}% - \edef\@@effullname{\@@effilepref\expandedfigurename}}% - {\ifx\@@effiletype\empty - \dogetcommacommandelement1\from\@@eftype\to\commalistelement - \edef\@@effullname{\@@effilename.\commalistelement}% - \def\figureextension##1{##1}% - \else - \@EA\doifnumberelse\@EA{\@@effiletype} - {\let\@@eftype\c!mps}\donothing - \edef\@@effullname{\@@effilename.\@@effiletype}% - \def\figureextension##1{\@@effiletype}% + \donothing} + +\def\setextrafiguredriveroptions + {\let\@@DriverImageOptions\empty + \doifsomething\@@efpage {\addtocommalist\@@efpage \@@DriverImageOptions}% + \doif \@@efpreview \v!yes{\addtocommalist\v!preview \@@DriverImageOptions}% + \doif \@@efcontrols\v!yes{\addtocommalist\v!controls\@@DriverImageOptions}% + \doif \@@efrepeat \v!yes{\addtocommalist\v!repeat \@@DriverImageOptions}% + \doifinsetelse\@@efsize{mediabox,cropbox,artbox,bleedbox,trimbox} + {\let \@@DriverImageBox \@@efsize}% + {\doifinsetelse\@@efsize{media,crop,art,bleed,trim} + {\edef\@@DriverImageBox{\@@efsize box}}% + {\let \@@DriverImageBox \empty}}% + \let\wantedfigureoptions\@@DriverImageOptions} + +\def\checkiffigureobjectpresent + {\doifnot\@@efobject\v!no + {\doifobjectssupportedelse + {\doifobjectfoundelse{FIG}\externalfigurestamp + {\doshowfigurestate{object found : \externalfigurestamp}% + \getobjectdimensions{FIG}\externalfigurestamp + \edef\frozenfigurestamp{\externalfigurestamp}% + \xdef\analyzedfigurewidth {\the\dimexpr\objectwidth \relax}% + \xdef\analyzedfigureheight{\the\dimexpr\objectheight\relax}% + \setanalyzedfiguredimensions\plusone} + {\doshowfigurestate{unknown object: \externalfigurestamp}}} + {}}} + +\def\checkifknownfigureobjectpresent + {\ifx\wantedfiguretype\empty + \let\savedwantedfiguretype\wantedfiguretype + \def\docommand##1% + {\ifcase\figurestatus + \edef\wantedfiguretype{##1}% + \checkiffigureobjectpresent \fi}% - % begin prelocate to be converted image - \let\@@efconversionpath\empty - \let\@@efconversionfile\@@effilename - \let\@@efconversiontype\@@effiletype - \doifmodeelse{\systemmodeprefix\v!first} - {\doifelsenothing\@@efconversion\donefalse\donetrue}% - {\donefalse}% - \ifdone - \chardef\figurestatus\zerocount - \locatefigureconversionfile - \chardef\figurestatus\zerocount + \processcommacommand[\figuretypes]\docommand + \ifcase\figurestatus + \let\wantedfiguretype\savedwantedfiguretype + \fi + \fi} + +\def\checkforfigurefile + {\ifcase\figurestatus + \ifconditional\externalfigureflush + \analyzefigurefiles + \fi + \fi} + +% \def\externalfigurestamp +% {\wantedfigurename +% -\ifx\wantedfiguretype\empty\wantedfiguretypespec\else\wantedfiguretype\fi +% -\wantedfiguretypespec +% -\wantedfigurepage} + +\def\externalfigurestamp % needs \edef'd macros! + {\wantedfigurename + \ifx\wantedfiguretype\empty\else + \ifx\wantedfiguretype\s!unknown\else + -\wantedfiguretype \fi - % end - \doifelse\@@efpreset\v!no - {\doifelse\@@eftype\s!unknown - {\chardef\figurestatus\zerocount - \let\@@eftype\figuretypes - \locatepresetfigurefiles} - {\chardef\figurestatus\plusone}} - {\doifelse\@@eftype\s!unknown - {\let\@@eftype\figuretypes} - {\@EA\removefromcommalist\@EA{\@@eftype}\figuretypes - \edef\@@eftype{\ifx\@@eftype\empty\else\@@eftype,\fi\figuretypes}}% - \ifx\@@effiletype\empty\else - \ExpandBothAfter\doifinsetelse\@@effiletype\@@eftype - {\@EA\removefromcommalist\@EA{\@@effiletype}\@@eftype - \edef\@@eftype{\@@effiletype,\@@eftype}}% - \donothing - \fi - \doifelse{#2}\s!figurepreset - {\chardef\figurestatus\plusfour - \assignfullfilename\f!currentpath\@@exfile\to\@@efloadname - \let\@@eftype\@@epe} - {\chardef\figurestatus\zerocount - \ifconditional\externalfigureflush - \analyzefigurefiles - \fi}}% - \let\@@epe\@@eftype - \edef\@@effiletype{\figureextension{\@@eftype}}% dirty trick - \global\figwid\zeropoint \figxsca\plusone - \global\fighei\zeropoint \figysca\plusone - \doif\v!frame\@@exoption - {\let\@@efframe\v!on}% \fi - \ifcase\figurestatus + \ifx\wantedfiguretypespec\empty\else + \ifx\wantedfiguretypespec\s!unknown\else + \ifx\wantedfiguretypespec\wantedfiguretype\else + -\wantedfiguretypespec + \fi + \fi + \fi + \ifnum\wantedfigurepage>\zeropoint + -\wantedfigurepage + \fi} + +\def\checkfigurerenderingoptions + {\ifcase\figurestatus \let\@@efframe\v!on - \let\@@efobject\v!no - \showmessage\m!figures1\@@effilename - \or - \showmessage\m!figures2\@@effullname - \or - \showmessage\m!figures3{\@@effullname,\@@eflenttype}% + \fi + \doif\@@exoption\v!frame + {\let\@@efframe\v!on}% + \doif\@@exoption\v!empty + {\skipexternalfigurestrue + \let\@@efframe\v!off}} + +\newtoks\externalfigurepostprocessors + +% \def\resetfigureusersettings +% {\getparameters % % % hm, can be faster, like the reset +% [\??ef] +% [\c!type=\s!unknown,\c!method=,\c!label=,\c!symbol=\v!no,%\c!foregroundcolor=, +% \c!object=\@@exobject,\c!preset=\v!yes,\c!split=,\c!size=, +% \c!page=0,\c!controls=\v!no,\c!preview=\v!no,\c!repeat=\v!no, +% \c!maxwidth=\@@exmaxwidth,\c!maxheight=\@@exmaxheight,\c!sx=1,\c!sy=1, +% \c!scale=,\c!xscale=,\c!yscale=,\c!width=,\c!height=,\c!display=,\c!lines=,\c!grid=, +% \c!color=,\c!conversion=\@@exconversion,\c!prefix=\@@exprefix,\c!cache=\@@excache, +% \c!factor=,\c!hfactor=,\c!wfactor=]} + +\def\resetfigureusersettings + {\let\@@eftype \s!unknown \let\@@efmethod \empty \let\@@efpreset\v!yes + \let\@@eflabel \empty \let\@@efsize \empty \let\@@efpage \!!zerocount + \let\@@efobject \@@exobject \let\@@efdisplay \empty + \let\@@efsplit \empty \let\@@efcolor \empty \let\@@efsymbol\v!no + \let\@@efcontrols \v!no \let\@@efpreview \v!no \let\@@efrepeat\v!no + \let\@@efhfactor \empty \let\@@efwfactor \empty \let\@@effactor\empty + \let\@@efmaxwidth \@@exmaxwidth \let\@@efmaxheight\@@exmaxheight + \let\@@efxscale \empty \let\@@efyscale \empty \let\@@efscale \empty + \let\@@efsx \!!plusone \let\@@efsy \!!plusone + \let\@@efwidth \empty \let\@@efheight \empty + \let\@@eflines \empty \let\@@efgrid \empty + \let\@@efconversion\@@exconversion \let\@@efprefix \@@exprefix \let\@@efcache \@@excache} + +%D Types and Methods are a bit history. Anyhow, user scan use the +%D type to force the handler. So, what to do with the method. We can +%D use that one to force a handler with a given suffix, so when no +%D type is given, but a suffix is part of the name, the method will +%D determine the handler. + +\def\checkfigureusersettings + {\doif\@@efreset\v!yes\resetexternalfigures + \doifelsenothing\@@eflabel + {\doifnothing\wantedfigurelabel{\let\wantedfigurelabel\wantedfigurename}}% + {\let\wantedfigurelabel\@@eflabel}% + \doifsomething\@@eftype + {\doifnot\@@eftype\s!unknown + {\edef\wantedfiguretypespec{\@@eftype} + \let\wantedfiguremethod\wantedfiguretypespec}}% + \doifnothing\wantedfigurepage % can be set by plug in + {\let\wantedfigurepage\@@efpage}% + \doif\wantedfigurepage\empty + {\let\wantedfigurepage\!!zerocount}% 0 is signal ! + \doifsomething\@@efmethod % rather untested misusage of the remapper + {\doifsomething\wantedfiguretype + {\definegraphictypesynonym[\wantedfiguretype][\@@method]}}} + +% #1 is now obsolete + +\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% \cmd label filename parent_id preset current + {\doshowfigurestate{begin}% + \dontcomplain + % let's limit the search, which means that e.g. svg has to be given explicitly + \checksupportedfiguretypes + % recently added; we presume local use + \restorecatcodes + % collected resets (token list) + \resetfigurevariables + % analyze filename and set wanted variables + \analyzefigurefilename{#3}{#2}% + \doanalyzefiguredimensionsfromfile + % handle user settings + \resetfigureusersettings + \dosetefparameters{#4}{#5}{#6}% + \checkfigureusersettings + \checkfigurecolorsettings + % adapt settings based on suffix and/or type + \presetfiguretypeprocessing + % now we really start + \checkiffigureobjectpresent % first guess, we may not yet know the typespec + \checkifknownfigureobjectpresent + \checkforconvertedfigure + \checkforfigurefile + \checkiffigureobjectpresent % to be sure, in case we now know the typespec + \checkfigurerenderingoptions % was later, moved here + \checknaturalfiguredimensions % inherit from global values and/or fallbacks + % by now we know what we're dealing with (put in box and scale) + \setextrafiguredriveroptions + \prepackageexternalfigureobject + % set public variables in case postprocessing needs them + \pushpublicfigurevariables + \setpublicfigurevariables + \setpublicfigureconversionvariables + \setpublicfigurescalevariables + % package final graphic, only now we can apply backgrounds and such + \doglobal\increment\figurenestinglevel + \finishexternalfigure + \doglobal\decrement\figurenestinglevel + % restore variables + \poppublicfigurevariables + \doshowfigurestate{end}} + +%D Figure objects. + +\def\setfigureobject + {\doshowfigurestate{object set : \externalfigurestamp}% + \setobject{FIG}\externalfigurestamp} + +% \def\getfigureobject +% {\doshowfigurestate{object used : \externalfigurestamp}% +% \getobject{FIG}\externalfigurestamp} + +\def\getfigureobject + {\doshowfigurestate{object used : \frozenfigurestamp}% + \getobject{FIG}\frozenfigurestamp} + +\def\prepackageexternalfigureobject + {\ifcase\figurestatus + \doshowfiguremessage1\expandedfigurename + \doshowfigurestate{state : figure not found (\expandedfigurename)}% + \global\setbox\foundexternalfigure\naturalvbox + {\doscalebox\??ef{\blackrule[\c!width=\naturalfigurewidth,\c!height=\naturalfigureheight]}}% \or - \showmessage\m!figures4\@@effullname + \doshowfiguremessage8\expandedfigurename + \doshowfigurestate{state : reusing existing figure}% + \global\setbox\foundexternalfigure\naturalvbox + {\doscalebox\??ef{\dowithfigure{\getfigureobject}}}% + \xdef\noffigurepages{\number\getvalue{\externalfigurestamp\c!n}}% \or - \showmessage\m!figures5{\@@effullname,\@@efloadname}% - \or % no message - \doifnot\@@efsymbol\v!yes{\showmessage\m!figures8\@@effullname}% - \fi - \ifdim\@@epw=\zeropoint \chardef\figurestatus\plusone \fi - \ifdim\@@eph=\zeropoint \chardef\figurestatus\plusone \fi - \global\gridfigurefalse - \ifnum\figurestatus=1 % unknown dimensions, take width or height or scale - \setnaturalfiguresize - \xdef\naturalfigurewidth {\the\figwid}% - \xdef\naturalfigureheight{\the\fighei}% - \let\@@efframe\v!off + \doshowfiguremessage2\expandedfigurename + \doshowfigurestate{state : using special figure}% + \setbox\scratchbox\naturalvbox % make a dummy + {\doscalebox\??ef{\blackrule[\c!width=\naturalfigurewidth,\c!height=\naturalfigureheight]}}% + \global\setbox\foundexternalfigure\naturalvbox to \finalscaleboxheight + {\vfill + \hsize\finalscaleboxwidth + \dowithfigure{\insertscaledfiguredriverdata}}% + \xdef\noffigurepages{\number\nofinsertpages}% \else - \global\let\naturalfigurewidth\@@epw - \global\let\naturalfigureheight\@@eph - \setfactorfiguresize - \setscalefiguresize - \setdimensionfiguresize - \processaction - [\@@efgrid] - [ \v!yes=>\getnoflines\fighei - \edef\@@efheight{\the\noflines\lineheight}% - \global\gridfiguretrue, - \v!height=>\getrawnoflines\fighei - \scratchdimen\noflines\lineheight - \advance\scratchdimen\strutdepth - \edef\@@efheight{\the\scratchdimen}% - \global\gridfiguretrue, - \v!depth=>\getrawnoflines\fighei - \scratchdimen\noflines\lineheight - \advance\scratchdimen-\strutdepth - \edef\@@efheight{\the\scratchdimen}% - \global\gridfiguretrue, - \v!halfline=>\getrawnoflines\fighei - \scratchdimen\noflines\lineheight - \advance\scratchdimen+.5\lineheight - \edef\@@efheight{\the\scratchdimen}% - \global\gridfiguretrue, - \v!fit=>\getrawnoflines\fighei - \edef\@@efheight{\the\noflines\lineheight}% - \global\gridfiguretrue]% - \ifgridfigure - \setfactorfiguresize - \setscalefiguresize - \setdimensionfiguresize + \ifdim\naturalfigurewidth>\zeropoint + \ifnum\figurestatus>9 + \doshowfiguremessage3\expandedfigurename + \else + \doshowfiguremessage4\expandedfigurename + \fi + \else + \doshowfiguremessage5\expandedfigurename + \fi + \doshowfigurestate{state : using found figure}% 3=self 4=rlx + \doifelse\@@efobject\v!no + {\donefalse} + {\doifobjectssupportedelse\donetrue\donefalse}% + \ifdone + % make an object and use it + \packageexternalfigureobject + \setfigureobject\vbox{\box\foundexternalfigure}% + \setxvalue{\externalfigurestamp\c!n}{\number\nofinsertpages}% + \global\setbox\foundexternalfigure\naturalvbox + {\doscalebox\??ef{\dowithfigure{\getfigureobject}}}% + \xdef\noffigurepages{\number\getvalue{\externalfigurestamp\c!n}}% + \else + % maybe a tex figure + \global\setbox\foundexternalfigure\naturalvbox + {\doscalebox\??ef{\dowithfigure{\box\foundexternalfigure}}}% + \xdef\noffigurepages{\number\nofinsertpages}% \fi \fi - \convertfigureinsertscale\@@epx\figx\figxsca\scax - \convertfigureinsertscale\@@epy\figy\figysca\scay - \iftraceexternalfigures - \message - {\externalfigurelog - [\@@effullname: - t={\@@eftype}\space m={\@@efmethod}\space l=\@@eflabel\space - w=\number\figwid\space h=\number\fighei\space - \c!sx=\scax\space\c!sy=\scay\space - ox=\figx\space oy=\figy]}% - \fi - \doif\v!empty\@@exoption - {\skipexternalfigurestrue - \let\@@efframe\v!off}% ? ? - \doifelsenothing\@@efpage % NIEUW ?? - {\let\@@efoptions\empty} - {\let\@@efoptions\@@efpage}% - \doif\@@efpreview \v!yes{\addtocommalist\v!preview \@@efoptions}% - \doif\@@efcontrols\v!yes{\addtocommalist\v!controls\@@efoptions}% - \doif\@@efrepeat \v!yes{\addtocommalist\v!repeat \@@efoptions}% - \doif\@@eftype\c!mps - {\ifcase\EPSspecial\else\ifinobject\else - \@@eftrace{special mps, object forced}% - \doglobal\increment\forcedMPSobject - \edef\@@efobjectname{\c!mps::\forcedMPSobject}% - \let\@@efobject\v!yes - \fi\fi}% - \global\let\lastfigureobjectname\@@efobjectname - \doifelse\@@efobject\v!no - \donefalse - {\doifobjectssupportedelse\donetrue\donefalse}% - % this (for the moment) conveniently maps onto pdf which saves mapping - \ifdone - \doifobjectfoundelse{FIG}\@@efobjectname - \donothing - {\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 - \doinsertfile - {\@@eftype,\@@efmethod}{\@@effullname,\@@eflabel} - {100}{100}\@@epx\@@epy\@@epw\@@eph\@@efoptions - \else\ifskipexternalfigures - \ruledhbox - {\backgroundline - [\@@efsplitcolor]{\fakebox\foundexternalfigure}}% - \else - \box\foundexternalfigure - \fi\fi}% - \wd0=\figwid - \setobject{FIG}\@@efobjectname\vbox{\box0}% - \setxvalue{\@@efobjectname\c!n}{\number\nofinsertpages}% - \egroup}% - \fi - \xdef\figurewidth {\the\figwid}% - \xdef\figureheight{\the\fighei}% - \global\setbox\foundexternalfigure\naturalvbox to \fighei + \global\wd\foundexternalfigure\finalscaleboxwidth + \global\ht\foundexternalfigure\finalscaleboxheight + \global\let\lastfigureobjectname\externalfigurestamp + \doresetobjects} % clean up driver left overs + +\def\packageexternalfigureobject + {\global\setbox\foundexternalfigure\vbox to \naturalfigureheight {\vfill - \hsize\figwid - \ifdone - \scratchdimen\scax\points\divide\scratchdimen \plushundred - \edef\scax{\withoutpt\the\scratchdimen}% - \scratchdimen\scay\points\divide\scratchdimen \plushundred - \edef\scay{\withoutpt\the\scratchdimen}% - %\scale[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% - \doscalenextbox\scax\scay\figwid\fighei{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% - \xdef\noffigurepages{\number\getvalue{\@@efobjectname\c!n}}% - \else\ifdim\wd\foundexternalfigure=\zeropoint - \dowithfigure - {\doinsertfile - {\@@eftype,\@@efmethod}{\@@effullname,\@@eflabel} - \scax\scay\figx\figy\figwid\fighei\@@efoptions}% - \xdef\noffigurepages{\number\nofinsertpages}% + \ifdim\wd\foundexternalfigure=\zeropoint + \setextrafiguredriveroptions + \insertunscaledfiguredriverdata + \else\ifskipexternalfigures + \ruledhbox{\backgroundline[\@@efsplitcolor]{\fakebox\foundexternalfigure}}% \else - \scratchdimen\scax\points\divide\scratchdimen \plushundred - \edef\scax{\withoutpt\the\scratchdimen}% - \scratchdimen\scay\points\divide\scratchdimen \plushundred - \edef\scay{\withoutpt\the\scratchdimen}% - %\scale[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\box\foundexternalfigure}}% - \doscalenextbox\scax\scay\figwid\fighei{\dowithfigure{\box\foundexternalfigure}}% - \xdef\noffigurepages{\number\nofinsertpages}% - \fi\fi - \global\let\appliedfigurexscale\scax - \global\let\appliedfigureyscale\scay}% -\doresetobjects % clean up driver left overs - \global\wd\foundexternalfigure\figwid - \finalizeexternalfigure{#2}{\expandedfigurename}} - -\def\doscalenextbox#1#2#3#4% for the moment here, faster - {\bgroup - \dowithnextbox - {\dontshowcomposition - \setbox\nextbox\hbox - {\smashbox\nextbox - \dostartscaling#1#2\flushnextbox\dostopscaling}% - \nextboxwd#3% - \nextboxht#4% - \nextboxdp\zeropoint - \flushnextbox - \egroup} - \hbox} - -\let\figurelabel \empty -\let\figurefilename\empty -\let\figurefiletype\empty -\let\figurefilepage\empty -\let\figurefilepath\empty - -\def\finalizeexternalfigure#1#2% - {\globalpushmacro\figurewidth - \globalpushmacro\figureheight - \globalpushmacro\figurelabel - \globalpushmacro\figurefilename - \globalpushmacro\figurefiletype - \globalpushmacro\figurefilepage - \globalpushmacro\figurefileconversion - \globalpushmacro\figurefileprefix - \globalpushmacro\figurefilepath - \globalpushmacro\figurefilecache - \xdef\figurewidth {\the\figwid}% - \xdef\figureheight {\the\fighei}% - \xdef\figurelabel {#1}% - \xdef\figurefilename {#2}% - \xdef\figurefiletype {\@@eftype}% - \xdef\figurefilepage {\@@efpage}% - \xdef\figurefileconversion{\@@efconversion}% - \xdef\figurefileprefix {\@@efprefix}% - \xdef\figurefilepath {\@@efcurrentpath}% - \xdef\figurefilecache {\@@efcache}% - \doifmodeelse{\systemmodeprefix\v!first} - {\let\figurefullname\figurefilename}% - {\def\figurefullname{\figurefileprefix\figurefilename}}% no \edef - \global\setbox\foundexternalfigure\vbox + \box\foundexternalfigure + \fi\fi}% + \wd\foundexternalfigure\naturalfigurewidth + \ht\foundexternalfigure\naturalfigureheight} + +\def\finishexternalfigure % here we use \figurevariables + {\global\setbox\foundexternalfigure\vbox {\forgetall \ifcase\figurestatus - \resetsystemmode\v!figure - \let\figurefiletype\empty + \resetsystemmode\v!figure % todo, also: \v!resource \else - \setsystemmode \v!figure % beter resource + \setsystemmode \v!figure % todo, also: \v!resource \fi -% begin force convertable image into file -\doifmode{\systemmodeprefix\v!first}{\doifsomething\@@efconversion - {% needs to be sorted out - \ifx\@@efconversionpath\undefined\else\let\figurefilepath\@@efconversionpath\fi % needed for welzorg etc - \ifx\@@efconversionfile\undefined\else\let\figurefilename\@@efconversionfile\fi - \ifx\@@efconversiontype\undefined\else\let\figurefiletype\@@efconversiontype\fi}}% -% end -\ifconditional\externalfigureflush - \ifconditional\externalfigurelevel % probably background - \ifskipexternalfigures - % nothing - \fakebox\foundexternalfigure - \else\ifcase\figurestatus - % nothing - \else\ifnum\splitexternalfigure=2\else - \the\externalfigurepostprocessors - \box\foundexternalfigure - \fi\fi\fi + \ifconditional\externalfigureflush + \ifconditional\externalfigurelevel % probably background + \ifskipexternalfigures + % nothing + \fakebox\foundexternalfigure + \else\ifcase\figurestatus + % nothing + \else\ifnum\splitexternalfigure=\plustwo\else + \the\externalfigurepostprocessors + \box\foundexternalfigure + \fi\fi\fi + \else + \iftrialtypesetting \else \feedbackexternalfigure \fi + \settrue\externalfigurelevel + \ifskipexternalfigures + \ifcase\figurestatus + \externalfigurereplacement\figurelabel\figurefilename{unknown}% + \else + \externalfigurereplacement\figurelabel\figurefullname{skipped}% + \fi + \else\ifcase\figurestatus + \externalfigurereplacement\figurelabel\figurefilename{unknown}% + \else\ifnum\splitexternalfigure=\plustwo + \backgroundline[\@@efsplitcolor]{\fakebox\foundexternalfigure}% + \else + \the\externalfigurepostprocessors + \doifelse\@@efreset\v!yes + {\wd\foundexternalfigure\figurewidth + \ht\foundexternalfigure\figureheight + \dp\foundexternalfigure\zeropoint + \box\foundexternalfigure} + {\localframed % should also be applied to high res ! + [\??ef] + [\c!offset=\v!overlay, + \c!width=\figurewidth, + \c!height=\figureheight] + {\vfilll + \ifnum\splitexternalfigure=\plusone + % hm, eigenlijk in dit geval achtergrondkleur + \hidesplitcolorfalse % really needed + \backgroundline[\@@efsplitcolor]{\box\foundexternalfigure}% + \else % = 0, no split mode + \box\foundexternalfigure + \fi}}% + \fi\fi\fi + \fi \else + % maybe also \the\externalfigurepostprocessors \iftrialtypesetting \else \feedbackexternalfigure \fi - \settrue\externalfigurelevel - \ifskipexternalfigures - \externalfigurereplacement\figurelabel\figurefullname{skipped}% - \else\ifcase\figurestatus - \externalfigurereplacement\figurelabel\figurefullname{unknown}% - \else\ifnum\splitexternalfigure=2 - \backgroundline[\@@efsplitcolor] - {\fakebox\foundexternalfigure}% - \else - \the\externalfigurepostprocessors - \doifelse\@@efreset\v!yes - {\ht\foundexternalfigure\figureheight - \dp\foundexternalfigure\zeropoint - \wd\foundexternalfigure\figurewidth - \box\foundexternalfigure} - {\localframed % should also be applied to high res ! - [\??ef] - [\c!offset=\v!overlay, - \c!width=\figurewidth, - \c!height=\figureheight] - {\vfilll - \ifnum\splitexternalfigure=1 - % hm, eigenlijk in dit geval achtergrondkleur - \hidesplitcolorfalse % really needed - \backgroundline[\@@efsplitcolor] - {\box\foundexternalfigure}% - \else % = 0, no split mode - \box\foundexternalfigure - \fi}}% - \fi\fi\fi - \fi -\else - % maybe also \the\externalfigurepostprocessors - \iftrialtypesetting \else \feedbackexternalfigure \fi -\fi}% - \globalpopmacro\figurefilecache - \globalpopmacro\figurefilepath - \globalpopmacro\figurefileprefix - \globalpopmacro\figurefileconversion - \globalpopmacro\figurefilepage - \globalpopmacro\figurefiletype - \globalpopmacro\figurefilename - \globalpopmacro\figurelabel - \globalpopmacro\figureheight - \globalpopmacro\figurewidth} + \fi}} + +\def\insertfiguredriverdata#1#2% + {\edef\@@DriverImageWidth {\the\dimexpr#1\relax}% + \edef\@@DriverImageHeight{\the\dimexpr#2\relax}% + \let \@@DriverImageFile \wantedfigurefullname + \let \@@DriverImageType \wantedfiguretypespec + \let \@@DriverImageMethod \wantedfiguremethod + \let \@@DriverImageLabel \wantedfigurelabel + \let \@@DriverImagePage \wantedfigurepage + \doinsertfile} + +\def\insertunscaledfiguredriverdata + {\insertfiguredriverdata\naturalfigurewidth\naturalfigureheight} + +\def\insertscaledfiguredriverdata + {\insertfiguredriverdata\finalscaleboxwidth\finalscaleboxheight} \def\externalfigurereplacement#1#2#3% {\setupcolors @@ -1546,8 +862,6 @@ \c!height=\figureheight, \c!background=\v!screen, \c!backgroundscreen=.8, - %\c!frame=\ifincolor\v!off\else\v!on\fi] - %\c!frame=\ifincolor\@@efframe\else\v!on\fi]}% \c!frame=\@@efframe]}% {\tt\tfxx \nohyphens name: \expanded{\verbatimstring{#1}}\\% @@ -1555,8 +869,11 @@ state: \expanded{\verbatimstring{#3}}}} \def\externalfigureplaceholder#1#2#3% - {\localframed[\??ef] - [\c!width=#2,\c!height=#3,\c!frame=\v!on]% + {\localframed + [\??ef] + [\c!width=#2, + \c!height=#3, + \c!frame=\v!on]% {\tt\tfxx \nohyphens name: \expanded{\verbatimstring{#1}}\\% state: \expanded{\verbatimstring{placeholder}}}} @@ -1570,23 +887,70 @@ \externalfigure[#1][#2][#3]% or \doexternalfigure \egroup} -\newtoks\externalfigureresets -\newtoks\externalfigurepostprocessors - \let\feedbackexternalfigure\relax % \gobblefourarguments +\let\dowithfigure \relax + +%D Conversion stuff: + +\newcount\nofconversionfigures + +\def\resetwantedconversionvariables + {\let\wantedconversionpath \empty % these point to the to be converted graphic + \let\wantedconversionname \empty + \let\wantedconversiontype \empty + \let\wantedconversioncache \empty + \let\wantedconversionprefix\empty} + +\resetwantedconversionvariables -\gdef\appliedfigurexscale{1} -\gdef\appliedfigureyscale{1} +\def\checkforconvertedfigure + {\ifcase\figurestatus + \resetwantedconversionvariables + \doifsomething\@@efconversion + {\global\advance\nofconversionfigures\plusone + \edef\wantedfigureconversion{\@@efconversion}% + \edef\wantedconversioncache {\@@efcache}% + \edef\wantedconversionprefix{\@@efprefix}% + \doshowfigurestate{checking paths : \figurepathlist}% + \processcommacommand[\figurepathlist]\dolocatefigureconversionfile + \ifcase\figurestatus + \doshowfigurestate{remark : no conversion file found}% + \else + \doshowfigurestate{remark : conversion file found}% + \chardef\figurestatus\zerocount + \fi + \let\wantedconversionname\wantedfigurename + \edef\wantedfigurename{\wantedconversionprefix\wantedfigurename}% + \ifx\wantedconversioncache\empty + \let \wantedfigurepath \wantedconversionpath + \else + \edef\wantedfigurepath{\wantedconversionpath/\@@efcache}% + \fi + \let\wantedfiguretype \empty + \let\wantedfiguretypelist\figuretypes % hm, why needed + \doshowfigurestate{conversion path : \wantedconversionpath}% + \doshowfigurestate{conversion name : \wantedconversionname}}% + \fi} -% will go internal +\def\dolocatefigureconversionfile#1% + {\ifcase\figurestatus + \setwantedfigurefullname{#1}\wantedfigurename\wantedfiguretype + \doshowfigurestate{locating original : \wantedfigurefullname}% + \doiffile\wantedfigurefullname + {\def\wantedconversionpath{#1}% + \let\wantedconversionname\wantedfigurename + \let\wantedconversiontype\wantedfiguretype + \chardef\figurestatus\plusfive}% + \fi} -\def\appliedfigurefilename {\@@effilename} -\def\appliedfigurefilepath {\@@efcurrentpath} -\def\appliedfigureshortname {\@@efcurrentpath/\@@effilename} -\def\appliedfigurefullname {\@@efcurrentfile} -\def\appliedfigureidentifier{\@@efobjectname} -\def\appliedfigureoptions {\@@efoption} -\def\appliedfigurefilesuffix{\figureextension{\@@efcurrenttype}} +\def\setpublicfigureconversionvariables % also prefix, cache + {\doifsomething\@@efconversion + {\doifmode{\systemmodeprefix\v!first} + {\let\figurefilepath\wantedconversionpath + \let\figurefilename\wantedconversionname + \let\figurefiletype\wantedconversiontype + \let\figurefileconversion\wantedfigureconversion + \def\figurefullname{\wantedconversionpath/\wantedconversionname.\wantedconversiontype}}}} %D In \PDF\ one can specify an alternative graphic. This means %D that for instance a low resolution graphic can be used for @@ -1609,25 +973,18 @@ \doifnot\@@efobject\v!no {\doifobjectssupportedelse {\doifspecialavailableelse\doregisterfigure - {\bgroup - #1[#4][#5][#6]% + {\doshowfigurestate{screen alternative : start}% + \bgroup + \dosetefparameters{#4}{#5}{#6}% \doregisterfigure{FIG}{\lastfigureobjectname}% \let\@@ef@@scherm\@@efdisplay \calculateexternalfigure[#1][\@@ef@@scherm][\@@ef@@scherm][#4,\c!display=][#5][#6]% + \doshowfigurestate{screen alternative : stop}% \egroup} {}} {}}% \fi} -\let\dowithfigure\relax - -\let\naturalfigureheight=\!!zeropoint -\let\naturalfigurewidth =\!!zeropoint -\let\figureheight =\!!zeropoint -\let\figurewidth =\!!zeropoint - -\def\noffigurepages{\nofinsertpages} - \def\getfiguredimensions {\dodoubleempty\dogetfiguredimensions} @@ -1646,6 +1003,304 @@ {\dogetfiguredimensions[#1][#2]% \doresetobjects} +%D Size determination. +%D +%D An analyzer must set the following dimensions (global macros): +%D +%D \starttyping +%D \analyzedfigurewidth +%D \analyzedfigureheight +%D \stoptyping +%D +%D And afterwards, when succeeded, call: +%D +%D \starttyping +%D \setanalyzedfiguredimensions{number>=10} +%D \stoptyping +%D +%D Numbers upto 9 are reserved for special purposes: +%D +%D \starttabulate +%D \NC 0 \NC not found \NC \NR +%D \NC 1 \NC object (will be reused) \NC \NR +%D \NC 2 \NC found but no dimensions (e.g. special annotation) \NC \NR +%D \stoptabulate + +\let\doanalyzefiguredimensionsfromfile\relax % hook for figuredatabase +\let\doanalyzefiguredimensionsinternal\relax +\let\doanalyzefiguredimensionsexternal\relax % hook for rli support (see later) +\let\doanalyzefiguredimensionsfallback\relax + +\def\doanalyzefiguredimensions + {\doiffileinsertionsupportedelse\wantedfiguretypespec + {\doiffileelse\wantedfigurefullname + {\doshowfigurestate{analyzing : \wantedfigurefullname}% + \doanalyzefiguredimensionsinternal + \doanalyzefiguredimensionsexternal + \doanalyzefiguredimensionsfallback} + {\doshowfigurestate{not found : \wantedfigurefullname}}} + {}} + +\def\setanalyzedfiguredimensions#1% + {\ifdim\analyzedfigurewidth>\zeropoint + \ifdim\analyzedfigureheight>\zeropoint + \determinedfigurewidth \analyzedfigurewidth + \determinedfigureheight\analyzedfigureheight + \chardef\figurestatus #1\relax + \doshowfigurestate{dimensions : + \the\dimexpr\analyzedfigurewidth\relax\space x\space + \the\dimexpr\analyzedfigureheight\relax}% + \else + \determinedfigurewidth \zeropoint + \determinedfigureheight\zeropoint + \chardef\figurestatus \zerocount + \fi + \else + \determinedfigurewidth \zeropoint + \determinedfigureheight\zeropoint + \chardef\figurestatus \zerocount + \fi} + +%D We can remap types. This is to be dealt with in the driver files. + +\def\definegraphictypesynonym + {\dodoubleargument\dodefinegraphictypesynonym} + +\def\dodefinegraphictypesynonym[#1][#2]% + {\setvalue{\??ef:\??ex:#1}{#2}} + +\def\truegraphictype#1% + {\ifcsname\??ef:\??ex:#1\endcsname + \expandafter\truegraphictype\csname\??ef:\??ex:#1\endcsname\else#1% + \fi} + +\definegraphictypesynonym[epdf] [pdf] +\definegraphictypesynonym[jpeg] [jpg] +\definegraphictypesynonym[jbig] [jb2] +\definegraphictypesynonym[jbig2][jb2] +\definegraphictypesynonym[jbg] [jb2] + +%D The self method (mostly used) uses the driver. + +% todo: when zero width mps, ok +% +% analyzer must set the analyzed dimensions + +\def\doanalyzefiguredimensionsinternal + {\ifcase\figurestatus + \let\@@DriverImageFile\wantedfigurefullname + \let\@@DriverImagePage\wantedfigurepage + \let\@@DriverImageType\wantedfiguretypespec + % use internal when available, otherwise try driver (\dogetfiguresize) + \executeifdefined{dogetfiguresize\wantedfiguretypespec}\dogetfiguresize + \setanalyzedfiguredimensions\!!ten + \fi} + +%D The tex method. + +\def\dogetfiguresizetex + {\ifcase\figurestatus + \global\setbox\foundexternalfigure\vbox + {\insidefloattrue + \forgetall + \blank[\v!disable]% niet meer weg ! + \startreadingfile + \readfile\wantedfigurefullname \donothing \donothing + \stopreadingfile + \endgraf + \removelastskip}% + \global\setbox\foundexternalfigure\hbox + {\raise\dp\foundexternalfigure\box\foundexternalfigure}% + \xdef\analyzedfigurewidth {\the\wd\foundexternalfigure}% + \xdef\analyzedfigureheight{\the\ht\foundexternalfigure}% + \fi} + +\let\dogetfiguresizetmp \dogetfiguresizetex +\let\dogetfiguresizebuffer\dogetfiguresizetex + +%D The eps, mps and svg files are read directly. + +\def\dogetfiguresizeeps + {\dogetEPSboundingbox\wantedfigurefullname\!!widtha\!!heighta\!!widthb\!!heightb + \xdef\analyzedfigurewidth {\the\!!widthb}% + \xdef\analyzedfigureheight{\the\!!heightb}} + +\let\dogetfiguresizemps\dogetfiguresizeeps + +\def\dogetfiguresizesvg + {\doifinset\wantedfiguretypespec{\c!svg} + {\startnointerference + \startXMLignore + \defineXMLcommand[svg][width=100,height=75] + {\doifdimensionelse{\XMLop{width}} + {\xdef\analyzedfigurewidth {\the\dimexpr\XMLop{width}\relax}} + {\xdef\analyzedfigurewidth {\the\dimexpr\XMLop{width}\onebasepoint\relax}}% + \doifdimensionelse{\XMLop{height}} + {\xdef\analyzedfigurewidth {\the\dimexpr\XMLop{height}\relax}} + {\xdef\analyzedfigurewidth {\the\dimexpr\XMLop{height}\onebasepoint\relax}}% + \endinput}% + \processXMLfilegrouped\wantedfigurefullname + \stopXMLignore + \stopnointerference}} + +%D Do some checking on the filename. + +\newconditional \figurefileisqualified + +\def\setfigurepathlist + {\let\figurepathlist\empty + \expanded{\doifinset{\v!global }{\@@exlocation}} + {\let\figurepathlist\@@exdirectory}% + \expanded{\doifinset{\v!local }{\@@exlocation}} + {\prependtocommalist\f!currentpath\figurepathlist}% + \expanded{\doifinset{\v!default}{\@@exlocation}} + {\appendtocommalist\defaultfigurepathsignal\figurepathlist}} + +\def\analyzefigurefilename#1#2% + {\sanitizefilename#1\to\expandedfigurename + \expanded{\checkfilename{\expandedfigurename}}% + \ifcase\kindoffile + \splitfigurefilename + \ifcase\splitoffkind + \let\wantedfigurepath\empty % no . either + \setfigurepathlist + \setfalse\figurefileisqualified + \else + \splitfigurefilename + \let\figurepathlist\wantedfigurepath + \let\wantedfigurepath\empty + \settrue\figurefileisqualified + \fi + \else % fully qualified + \splitfigurefilename + \let\figurepathlist\wantedfigurepath + \let\wantedfigurepath\empty + \settrue\figurefileisqualified + \fi + \ifx\figurepathlist\empty + \let\figurepathlist\defaultfigurepathsignal % will prepend no path + \fi + \doifelsenothing\wantedfiguretype + {\doifparentfileelse\wantedfigurename + {\@EA\removefromcommalist\@EA{\jobsuffix }\wantedfiguretypelist + \@EA\removefromcommalist\@EA{\jobfilesuffix}\wantedfiguretypelist} + {}} + {\let\wantedfiguretypelist\empty + \let\wantedfiguretypespec\wantedfiguretype}% + \edef\wantedfigurelabel{#2}% + \doshowfigurestate{type check : \ifx\wantedfiguretypelist\empty forced type \wantedfiguretypespec\else\wantedfiguretypelist\fi}% + \doshowfigurestate{file specs : \wantedfigurefull\space [\wantedfigurepath] [\wantedfigurename] [\wantedfiguretype]}% + \doshowfigurestate{file type : \ifconditional\figurefileisqualified qualified\else simple\fi}} + +% \def\setwantedfigurefullname#1#2#3% path name spec +% {\edef\wantedfiguretypespec{#3}% +% \doifelse{#1}\defaultfigurepathsignal % default is actually empty i.e. system lookup +% {\edef\wantedfigurefullname {#2.\wantedfiguretypespec}} +% {\edef\wantedfigurefullname{#1/#2.\wantedfiguretypespec}}% +% } + +\def\setwantedfigurefullname#1#2#3% path name spec + {\ifx\wantedfiguremethod\empty + % the either explicit or gambled typespec determines the method + \edef\wantedfiguretypespec{#3}% + \doifelse{#1}\defaultfigurepathsignal + {\edef\wantedfigurefullname {#2.\wantedfiguretypespec}} + {\edef\wantedfigurefullname{#1/#2.\wantedfiguretypespec}}% + \else\ifx\wantedfiguretype\empty % + % the typespec (probably the same as the method) determines the suffix + \doifelse{#1}\defaultfigurepathsignal + {\edef\wantedfigurefullname {#2.\wantedfiguretypespec}} + {\edef\wantedfigurefullname{#1/#2.\wantedfiguretypespec}}% + \let\wantedfiguretypespec\wantedfiguremethod + \else + % the given suffix is used + \let\wantedfiguretypespec\wantedfiguremethod + \doifelse{#1}\defaultfigurepathsignal + {\edef\wantedfigurefullname {#2.\wantedfiguretype}} + {\edef\wantedfigurefullname{#1/#2.\wantedfiguretype}}% + \fi\fi} + +\def\splitfigurefilename + {\splitfilename\expandedfigurename + \let\wantedfigurefull\splitofffull + \let\wantedfigurepath\splitoffpath + \let\wantedfigurename\splitoffname + \let\wantedfigurebase\splitoffbase + \let\wantedfiguretype\splitofftype} + +\def\analyzefigurefiles + {\ifconditional\figurefileisqualified + \ifx\wantedfiguretype\empty + \doshowfigurestate{locating : unknown type}% + \doanalyzeunknownfiguretype + \else + % this file or none + \doshowfigurestate{locating : known type}% + \doanalyzequalifiedfigure + \fi + \else + \ifx\wantedfiguretype\empty + % locate best fit / check support + \doshowfigurestate{locating : best fit}% + \doanalyzeunknownfiguretype + \else + % only check on paths + \doshowfigurestate{locating : known types}% + \doanalyzeknownfiguretype + \fi + \fi} + +\def\doanalyzequalifiedfigure + {\let\wantedfigurefullname\wantedfigurefull + \let\wantedfiguretypespec\wantedfiguretype + \doshowfigurestate{forced type : \wantedfiguretype}% + \doshowfigurestate{identifying : \wantedfigurefullname}% + \doanalyzefiguredimensions} + +\def\doanalyzeknownfiguretype + {\doshowfigurestate{using paths : \figurepathlist}% + \doshowfigurestate{known type : \wantedfiguretype}% + \doshowfigurestate{identifying : \wantedfigurename}% + \let\wantedfiguretypespec\wantedfiguretype + \processcommacommand[\figurepathlist]\dodoanalyzeknownfiguretype} + +\def\dodoanalyzeknownfiguretype#1% path + {\ifcase\figurestatus + \setwantedfigurefullname{#1}\wantedfigurename\wantedfiguretype + \doanalyzefiguredimensions + \fi} + +\def\doanalyzeunknownfiguretype + {\doshowfigurestate{using paths : \figurepathlist}% + \doshowfigurestate{using types : \wantedfiguretypelist}% + \doshowfigurestate{identifying : \wantedfigurename}% + \processcommacommand[\wantedfiguretypelist]\dodoanalyzeunknownfiguretype} + +\def\dodoanalyzeunknownfiguretype#1% + {\processcommacommand[\figurepathlist]{\dododoanalyzeunknownfiguretype{#1}}} + +\def\dododoanalyzeunknownfiguretype#1#2% type path + {\ifcase\figurestatus + \setwantedfigurefullname{#2}\wantedfigurename{#1}% path spec + \doanalyzefiguredimensions + \fi} + +%D Some files, take for instance movies, cannot easilly be +%D parsed on dimensions, that is, not yet. Although the current +%D mechanism has no problems with this, as long as the user +%D specified width and height reflect the right aspect ratio. +%D Nevertheless, when one does not want any scanning done, one +%D can disable \type{preset}. When no preset is needed, we only +%D locate the file. + +\def\doanalyzefiguredimensionsfallback + {\ifcase\figurestatus + \doshowfigurestate{warning : assuming adaptive figure}% + \xdef\analyzedfigurewidth {\the\dimexpr\@@efwidth +\zeropoint\relax}% + \xdef\analyzedfigureheight{\the\dimexpr\@@efheight+\zeropoint\relax}% + \setanalyzedfiguredimensions\plustwo + \fi} + \presetlocalframed[\??ef] \newconditional\externalfigurelevel % true=background false=normal @@ -1654,17 +1309,14 @@ \setfalse\externalfigurelevel \settrue \externalfigureflush -\def\doplaceexternalfigure % used direct and indirect - {\dosixtupleempty\dodoplaceexternalfigure} - -\def\dodoplaceexternalfigure[#1][#2][#3][#4][#5][#6]% - {\doifsomething{#3}% catches \defineexternalfigure dummies +\def\doplaceexternalfigure[#1][#2][#3][#4][#5]% + {\doifsomething{#2}% catches \defineexternalfigure dummies {\bgroup -\pushmacro\textunderscore + \pushmacro\textunderscore \edef\textunderscore{\string_}% brrr, temp hack, still needed? - \calculateexternalfigure[#1][#2][#3][#4][#5][#6]% - \calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]% -\popmacro\textunderscore + \calculateexternalfigure [][#1][#2][#3][#4][#5]% [] is dummy dwcomp + \calculateexternalscreenfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp + \popmacro\textunderscore \box\foundexternalfigure \egroup}} @@ -1680,25 +1332,14 @@ % % \defineexternalfigure[name][settings] -\def\dodefineexternalfigure[#1][#2]% - {\setvalue{\??ef\??ef#1}% - {\doplaceexternalfigure[\dopresetfigure][#1][][#2][]}} - \def\defineexternalfigure {\dodoubleargument\dodefineexternalfigure} -\def\getexternalfigure#1% - {\getvalue{\??ef\??ef#1}} - -\def\dopresetfigure[#1][#2][#3]% - {\getparameters[\??ef][#1,#3]% - \getparameters[\??ep][#2]} +\def\dodefineexternalfigure[#1][#2]% + {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][][][#2]}} -\def\doprecopfigure[#1][#2][#3]% - {\def\doplaceexternalfigure[##1][##2][##3][##4][##5]% - {\getparameters[\??ef][##4,#2,#3]% - \getparameters[\??ep][##5]}% - \getvalue{\??ef\??ef#1}} +\def\getexternalfigure#1% efef has 4 args already and take an 5th + {\wait} % OBSOLETE % \useexternalfigure[alpha][koe] % \useexternalfigure[beta] [koe] [breedte=1cm] @@ -1714,36 +1355,63 @@ % 4cm breed: \externalfigure[beta] [breedte=4cm] \par % 5cm breed: \externalfigure[gamma][breedte=5cm] \par -\def\dosetuseexternalfigure[#1][#2][#3][#4]% - {\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]}} - {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[\doprecopfigure][#1][#2][#3][#4]}}}% - \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} % upward compatible +% \defineexternalfigure[a][width=10cm] +% \defineexternalfigure[b][width=5cm] +% \externalfigure[cow][a] +% \externalfigure[cow][b][height=8cm] -\def\douseexternalfigure[#1][#2]%[#3][#4]% - {\doifelsenothing{#1} - {\doifsomething{#2} - {\dosetuseexternalfigure[#2][#2]}} %[#3][#4]}} - {\doifelsenothing{#2} - {\dosetuseexternalfigure[#1][#1]} %[#3][#4]} - {\dosetuseexternalfigure[#1][#2]}}} %[#3][#4]}}} +% \useexternalfigure[x][cow][width=10cm,height=1cm] +% \externalfigure[x] +% \externalfigure[x][width=3cm] + +\def\useexternalfigure + {\doquadrupleempty\douseexternalfigure} + +% [label] [filename] +% [label] [filename] [parent] +% [label] [filename] [parent] [settings] +% [label] [filename] [settings] \def\useexternalfigure {\doquadrupleempty\douseexternalfigure} +\def\douseexternalfigure[#1][#2][#3][#4]% + {\doifelsenothing{#1} + {\doifsomething{#2} + {\doifassignmentelse{#3} + {\setvalue{\??ef\??ef#2}{\doplaceexternalfigure[#2][#2][#3][#4]}} + {\setvalue{\??ef\??ef#2}{\doplaceexternalfigure[#2][#2][][#4]}}}} + {\doifelsenothing{#2} + {\doifassignmentelse{#3} + {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#1][][#3]}} + {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#1][#3][#4]}}} + {\doifassignmentelse{#3} + {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#2][][#3]}} + {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#2][#3][#4]}}}}} + +\def\dosetefparameters#1#2#3% parent_id use_settings current_settings + {\doifelsenothing{#1} % inherit from parent + {\getparameters[\??ef][#2,#3]} + {\doifdefinedelse{\??ef\??ef#1} + {\pushmacro\doplaceexternalfigure + \def\doplaceexternalfigure[##1][##2][##3][##4]{\getparameters[\??ef][##4,#2,#3]}% + \getvalue{\??ef\??ef#1}% + \popmacro\doplaceexternalfigure} + {\getparameters[\??ef][#2,#3]}}} + \unexpanded\def\externalfigure {\dotripleempty\doexternalfigure} -\def\doexternalfigure[#1][#2][#3]% +\def\doexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings] {\bgroup \doifelsenothing{#1} - {\framed[\c!width=8\lineheight,\c!height=6\lineheight]{external\\figure}} + {\framed[\c!width=\defaultfigurewidth,\c!height=\defaultfigureheight]{external\\figure}} {\doifundefinedelse{\??ef\??ef#1} {\useexternalfigure[\s!dummy][#1][#2][#3]% - \getexternalfigure{\s!dummy}[#3]} - {\getexternalfigure{#1}[#2]}}% + \getvalue{\??ef\??ef\s!dummy}[]} % [] is dummy arg 5 + {\doifassignmentelse{#2} + {\getvalue{\??ef\??ef#1}[#2]}% + {\getvalue{\??ef\??ef#1}[#3]}}}% \globallet\currentresourcecomment\empty \egroup} @@ -1754,127 +1422,10 @@ {\long\gdef\currentresourcecomment{#1}} \let\currentresourcecomment\empty - -%D Two alternatives, more settings needed. - -\def\showexternalfigurea - {\bgroup - \dontcomplain - \def\presetfigure[##1][##2]% - {\getvalue{\e!start\v!figure\e!text}[\v!left,\v!none][] - {} - {\hbox - {\externalfigure[##1][\c!frame=\v!on,\c!width=6cm,\c!size=\@@exsize][##2]% - \tfskip - \framed[\c!width=\figurewidth,\c!height=\figureheight]{}}}% - {\tt\tfa\expanded{\asciistr{##1}}}% - \blank - \tfx - \def\docommando####1% - {\beforesplitstring####1\at=\to\asciia - \aftersplitstring ####1\at=\to\asciib - \convertcommand\asciib\to\asciib - \doifsomething\asciib - {\hsmash{\hbox to .75em{\asciia\hss}: \asciib}\endgraf}}% - \processcommalist[##2]\docommando - \strut - \endgraf - \getvalue{\e!stop\v!figure\e!text}}% - \pushendofline - \readjobfile\@@exfile\donothing\donothing - \popendofline - \egroup} - -\def\showexternalfigureb % instelbaar maken - {\bgroup - \def\total{5}% - \globalletempty\allfigures - \doglobal\newcounter\figurecounter - \dontcomplain - \def\docommando##1{##1&}% - \def\figurecaptions% - {\crcr - \noalign{\nobreak\vskip.5em}% - \@EA\globalprocesscommalist\@EA[\allfigures]\docommando - \globalletempty\allfigures - \crcr - \noalign{\vskip1em\goodbreak}}% - \def\presetfigure[##1][##2]% - {\vbox - {\divide\hsize \total - \advance\hsize -1em - \externalfigure - [##1] - [\c!frame=\v!on,\c!factor=\v!max,\c!width=\hsize,\c!size=\@@exsize][##2]}% - \doglobal\addtocommalist{##1}\allfigures - %\getvalue{\s!figurepreset}% - \doglobal\increment\figurecounter - \ifnum\figurecounter=\total - \doglobal\newcounter\figurecounter - \def\next{\figurecaptions}% - \else - \def\next{&}% - \fi - \next}% - \pushendofline - \tabskip\zeropoint \!!plus 1fill - \halign to \hsize - {&\hss##\hss\cr\readjobfile\@@exfile\donothing\donothing\crcr - \figurecaptions} - \popendofline - \egroup} - -\def\showexternalfigurec - {\bgroup - \def\presetfigure[##1][##2]{\expanded{\pagefigure[##1][\c!size=\@@exsize]}}% else loop - \pushendofline - \readjobfile\@@exfile\donothing\donothing - \popendofline - \egroup} - -\def\showexternalfigured % to be documented; this one builds a dimension file for - {\bgroup % metapost/metafun - \immediate\openout\scratchwrite=mpfigs.mp - \def\presetfigure[##1][##2]% - {\getfiguredimensionsonly[##1]% \pagefigure[##1]% - \immediate\write\scratchwrite - {registerfigure("##1",\figurewidth,\figureheight);}} - \pushendofline - \readjobfile\@@exfile\donothing\donothing - \popendofline - \immediate\closeout\scratchwrite - \egroup} - -\def\startpagefigure - {\dodoubleempty\dostartpagefigure} - -\def\dostartpagefigure[#1][#2]% - {\bgroup - \getparameters[\??ex][\c!offset=\v!overlay,#2]% - \startTEXpage[\c!offset=\@@exoffset]% - \externalfigure[#1][#2]\ignorespaces} % so we can put some text below the graphic - -\def\stoppagefigure - {\stopTEXpage - \egroup} - -\def\pagefigure - {\dodoubleempty\dopagefigure} - -\def\dopagefigure[#1][#2]% - {\dostartpagefigure[#1][#2]\stoppagefigure} - -% \starttext \pagefigure[two.1] \stoptext - -\def\doshowexternalfigures[#1]% - {\bgroup - \setupcolors[\c!state=\v!start]% to prevent mps color conversion - \getparameters[\??ex][\c!alternative=a,\c!offset=\!!zeropoint,\c!size=,#1]% - \getvalue{\strippedcsname\showexternalfigure\@@exalternative}% - \egroup} - -\def\showexternalfigures - {\dosingleempty\doshowexternalfigures} + +\def\showexternalfigures % maybe run time command is better, but no core-run, unless figs-run ... + {%\writestatus\m!systems{for \string\showexternalfigures\space see \truefilename{x-res-20}.tex} + \usemodule[res-20]\showexternalfigures} % so for the moment we do it this way \def\overlayfigure#1% {\externalfigure[#1][\c!width=\overlaywidth,\c!height=\overlayheight]} @@ -1968,7 +1519,7 @@ \newbox\colorbarbox \def\makecolorbar[#1]% - {\def\docommando##1% + {\def\docommand##1% {\color[##1] {\blackrule [\c!width=2em, @@ -1977,7 +1528,7 @@ \endgraf}% \global\setbox\colorbarbox\vbox {\forgetall - \processcommalist[#1]\docommando}% + \processcommalist[#1]\docommand}% \global\setbox\colorbarbox\vbox {\hskip2em\box\colorbarbox}% \global\wd\colorbarbox\zeropoint} @@ -1990,15 +1541,11 @@ \calculateefsteps \startpositioning \def\referring(##1,##2)##3(##4,##5)##6[##7]% - {\position(##1,##2) - {\efgoto(##4,##5){\@@exframes}[##7]}}% + {\position(##1,##2){\efgoto(##4,##5){\@@exframes}[##7]}}% \def\marking(##1,##2)##3(##4,##5)##6[##7]% - {\position(##1,##2) - {\efthisis(##4,##5){\@@exframes}[##7]}}% - \def\remark% - {\efnocomment}% - \def\colorbar##1[##2]% - {}% + {\position(##1,##2){\efthisis(##4,##5){\@@exframes}[##7]}}% + \def\remark{\efnocomment}% + \def\colorbar##1[##2]{}% \position(0,0){\box0}% \linewidth\onepoint \setuppositioning @@ -2010,10 +1557,8 @@ \def\referring(##1,##2)##3(##4,##5)##6[##7]% {}% \let\marking\referring - \def\remark% - {\efcomment\v!no}% - \def\colorbar##1[##2]% - {\makecolorbar[##2]}% + \def\remark{\efcomment\v!no}% + \def\colorbar##1[##2]{\makecolorbar[##2]}% \ignorespaces#4% \stoppositioning \box\colorbarbox}} @@ -2025,7 +1570,7 @@ {\let\@@exframes\v!off}% \setvalue{\??ef\??ef#1}% {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}% - \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} + }% no longer \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} % De onderstaande macro mag niet zondermeer worden aangepast % en is afgestemd op gebruik in de handleiding. @@ -2035,14 +1580,10 @@ \setbox0\hbox {\useexternalfigure[\s!dummy][#2][\c!wfactor=\v!max]% \externalfigure[\s!dummy]}% - \def\referring - {\efmark}% - \def\marking - {\efmark}% - \def\remark - {\efcomment\v!yes}% - \def\colorbar##1[##2]% - {}% + \def\referring{\efmark}% + \def\marking{\efmark}% + \def\remark{\efcomment\v!yes}% + \def\colorbar##1[##2]{}% \efreference\zerocount \setbox0\vbox {\hsize240pt @@ -2071,14 +1612,10 @@ \stoppositioning \vfill}% \efreference\zerocount - \def\referring% - {\eftext{$\rightarrow$}}% - \def\marking% - {\eftext{$\leftarrow$}}% - \def\remark% - {\efnocomment}% - \def\colorbar##1[##2]% - {}% + \def\referring{\eftext{$\rightarrow$}}% + \def\marking{\eftext{$\leftarrow$}}% + \def\remark{\efnocomment}% + \def\colorbar##1[##2]{}% \setbox2\vbox {{\tfa\doifelsenothing{#1}{#2}{#1}} \blank @@ -2098,12 +1635,12 @@ \def\dodostartfigure[#1][#2][#3]#4\stopfigure {\doifelse\v!test\@@exoption {\teststartfigure[#1][#2][#3]#4\teststopfigure - \let\@@exframes\v!on} - {\let\@@exframes\v!off}% + \let\@@exframe\v!on} + {\let\@@exframe\v!off}% \setvalue{\??ef\??ef#1}% {\def\next{\placestartfigure[#1][#2][#3]#4\placestopfigure}% \dosingleempty\next}% - \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} + }% no longer: \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} \long\def\dostartfigure#1% {\dotripleargument\dodostartfigure#1\stopfigure} @@ -2111,118 +1648,6 @@ \def\startfigure {\grabuntil{\e!stop\v!figure}\dostartfigure} -%D \macros -%D {clip, setupclipping} -%D -%D Although related to figures, clipping can be applied to -%D arbitrary content. We can use \METAPOST\ to provide a non -%D rectangular clipping path. -%D -%D \starttyping -%D \startMPclip{fun} -%D clip currentpicture to fullcircle -%D shifted (.5,.5) xscaled \width yscaled \height ; -%D \stopMPclip -%D \stoptyping -%D -%D We get a rectangular piece of the figure when we say: -%D -%D \starttyping -%D \clip[x=2,y=1]{\externalfigure[photo]} -%D \stoptyping -%D -%D When we want to clip to the oval we defined a few lines ago, -%D we say: -%D -%D \starttyping -%D \clip[nx=1,ny=1,x=1,y=1,mp=fun]{\externalfigure[photo]} -%D \stoptyping -%D -%D The general characteristics of clipping can be set up with -%D -%D \showsetup{setupclipping} - -\def\doclip[#1]% nb top->bottom left->right - {\bgroup - \getparameters[\??cp][#1]% - \doifelse\@@cpstate\v!start\dodoclip{\egroup\hbox}} - -\def\dodoclip - {\dowithnextbox - {\ifdim\@@cpwidth>\zeropoint - \!!dimena\@@cpwidth - \!!dimenc\@@cphoffset - \else - \!!dimena\nextboxwd - \divide\!!dimena \@@cpnx - \!!dimenc\@@cpx\!!dimena - \advance\!!dimenc -\!!dimena - \!!dimena\@@cpsx\!!dimena - \fi - \relax % sure - \ifdim\@@cpheight>\zeropoint - \!!dimenb\@@cpheight - \!!dimend\nextboxht - \advance\!!dimend -\@@cpvoffset - \advance\!!dimend -\!!dimenb - \else - \!!dimenb\nextboxht - \divide\!!dimenb \@@cpny - \!!dimend-\@@cpy\!!dimenb - \advance\!!dimend -\@@cpsy\!!dimenb - \advance\!!dimend \!!dimenb - \!!dimenb\@@cpsy\!!dimenb - \advance\!!dimend \nextboxht - \fi - \setbox\nextbox\hbox % old - {\advance\!!dimenc -\@@cpleftoffset % new ! - \advance\!!dimend -\@@cpbottomoffset % new ! % - added - \hskip-\!!dimenc\lower\!!dimend\flushnextbox}% old - \nextboxwd\zeropoint - \nextboxht\zeropoint - \nextboxdp\zeropoint - \setbox\nextbox\hbox - {\advance\!!dimena \@@cpleftoffset % new ! - \advance\!!dimena \@@cprightoffset % new ! - \advance\!!dimenb \@@cpbottomoffset % new ! - \advance\!!dimenb \@@cptopoffset % new ! - \dostartclipping\@@cpmp\!!dimena\!!dimenb % old - \flushnextbox - \dostopclipping}% - \setbox\nextbox\hbox % new ! - {\!!dimena-\@@cpleftoffset % new ! - \!!dimenb \@@cpbottomoffset % new ! % - removed - \hskip\!!dimena\lower\!!dimenb\flushnextbox}% new ! - \nextboxwd\!!dimena - \nextboxht\!!dimenb - \nextboxdp\zeropoint - \flushnextbox - \egroup}% - \hbox} - -%D \startbuffer -%D \startuseMPgraphic{test} -%D path p ; p := fullcircle scaled 4cm ; -%D draw p withpen pencircle scaled 1cm ; -%D setbounds currentpicture to boundingbox p ; -%D \stopuseMPgraphic -%D -%D \hbox to \hsize \bgroup -%D \hss -%D \ruledhbox{\useMPgraphic{test}}% -%D \hss -%D \ruledhbox{\clip{\useMPgraphic{test}}}% -%D \hss -%D \egroup -%D \stopbuffer -%D -%D \typebuffer \getbuffer - -\def\clip{\dosingleempty\doclip} - -\def\setupclipping - {\dodoubleargument\getparameters[\??cp]} - %D defining sound tracks: %D %D \starttyping @@ -2320,7 +1745,7 @@ \setupexternalfigures [\c!option=, - \c!object=\v!yes, + \c!object=\v!yes, % we only check for no \c!reset=\v!no, \c!maxwidth=\@@efwidth, \c!maxheight=\@@efheight, @@ -2346,20 +1771,4 @@ \useexternalfigure [buffer] [\jobname] [\c!type=\v!buffer,\c!object=\v!no] -\setupclipping - [\c!state=\v!start, - \c!n=1, % was 2 - \c!nx=\@@cpn,\c!x=1,\c!sx=1, - \c!ny=\@@cpn,\c!y=1,\c!sy=1, - \c!width=\!!zeropoint, - \c!height=\!!zeropoint, - \c!hoffset=\!!zeropoint, - \c!voffset=\!!zeropoint, - \c!offset=\zeropoint, - \c!leftoffset=\@@cpoffset, % \zeropoint, - \c!rightoffset=\@@cpoffset, % \zeropoint, - \c!topoffset=\@@cpoffset, % \zeropoint, - \c!bottomoffset=\@@cpoffset, % \zeropoint, - \c!mp=] - \protect \endinput diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex index 4262bbdd2..595a9188f 100644 --- a/tex/context/base/core-fld.tex +++ b/tex/context/base/core-fld.tex @@ -373,8 +373,8 @@ %D \def\getmainfieldkids#1% %D {\let\@@DriverFieldKids\empty %D \ifdefinemainfield -%D \definerawpasslist{fld:#1}% runtime defined by system -%D \moverawpasslist{fld:#1}\@@DriverFieldKids +%D \definetwopasslist{fld:#1}% runtime defined by system +%D \getnamedtwopassdatalist{fld:#1}\@@DriverFieldKids %D \fi} %D \stoptyping %D @@ -385,11 +385,7 @@ %D %D \def\setmainfieldkid#1#2% %D {\doglobal\increment\nofmainfieldkids -%D \immediatewriteutilitycommand -%D {\twopassentry% -%D {fld:#1}% -%D {\nofmainfieldkids}% -%D {#2}}} +%D \savetwopassdata{fld:#1}{\nofmainfieldkids}{#2}} %D \stoptyping %D %D The trade of of this mechanism is that for each cloned or @@ -552,19 +548,19 @@ \setfield{#1}{#2}{}{}{#4,\@@DriverFieldKids}{#3}{\@@DriverFieldMode\@@DriverFieldFree\@@DriverFieldAuto}{}{\SavedFieldDefault}% \fi % - \def\docommando##1% + \def\docommand##1% {\doifelse{##1}\SavedFieldDefault {\def\@@DriverFieldDefault{##1}}% {\let\@@DriverFieldDefault\empty}% \setfield{##1}{#2}{#1}{}{}{#3}{\@@DriverFieldMode\@@DriverFieldFree\@@DriverFieldAuto}{}{\@@DriverFieldDefault}}% % when opt works -% \def\docommando##1% +% \def\docommand##1% % {\@EA\beforesplitstring##1\at=>\to\FieldValue % \doifelse\FieldValue\SavedFieldDefault % {\let\@@DriverFieldDefault\FieldValue}% % {\let\@@DriverFieldDefault\empty}% % \setfield\FieldValue{#2}{#1}{}{}{#3}{\@@DriverFieldMode\@@DriverFieldFree\@@DriverFieldAuto}{}{\@@DriverFieldDefault}}% - \processcommalist[#4]\docommando + \processcommalist[#4]\docommand \else \writestatus\m!fields{pass values too}% \fi} @@ -574,7 +570,7 @@ \def\dodefinesubfield[#1][#2][#3]% for the moment only radio ones {\ifsecondargument - \def\docommando##1% + \def\docommand##1% {\getfield{##1}% \ifx\@@DriverFieldType\empty \writestatus\m!fields{unknown field ##1}% to do @@ -587,7 +583,7 @@ {\def\@@DriverFieldValues{#3}}% \changefield{##1}% \fi}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \else \writestatus\m!fields{pass fieldname, setupgroup, values and default}% \fi} @@ -600,9 +596,9 @@ \writestatus\m!fields{unknown field #1}% \else \let\@@DriverFieldMode\fieldparentmode - %\def\docommando##1{\addtocommalist{##1}\@@DriverFieldKids}% - \def\docommando##1{\appendtocommalist{##1}\@@DriverFieldKids}% - \processcommalist[#2]\docommando + %\def\docommand##1{\addtocommalist{##1}\@@DriverFieldKids}% + \def\docommand##1{\appendtocommalist{##1}\@@DriverFieldKids}% + \processcommalist[#2]\docommand \changefield{#1}% \let\@@DriverFieldAutoParent\@@DriverFieldAuto \def\@@DriverFieldParent{#1}% @@ -613,12 +609,12 @@ \def\@@DriverFieldAuto{0}% \doifsomething{#3}{\edef\@@DriverFieldGroup{#3}}% \doifsomething{#4}{\edef\@@DriverFieldValues{#4}}% - \def\docommando##1% + \def\docommand##1% {\ifcase\@@DriverFieldAutoParent\else \setmainfieldkid{\@@DriverFieldParent}{##1}% \fi \changefield{##1}}% - \processcommalist[#2]\docommando + \processcommalist[#2]\docommand \fi \fi \else @@ -636,9 +632,9 @@ \writestatus\m!fields{unknown field #1}% \else \let\@@DriverFieldMode\fieldparentmode - %\def\docommando##1{\addtocommalist{##1}\@@DriverFieldKids}% - \def\docommando##1{\appendtocommalist{##1}\@@DriverFieldKids}% - \processcommalist[#2]\docommando + %\def\docommand##1{\addtocommalist{##1}\@@DriverFieldKids}% + \def\docommand##1{\appendtocommalist{##1}\@@DriverFieldKids}% + \processcommalist[#2]\docommand \changefield{#1}% \let\@@DriverFieldAutoParent\@@DriverFieldAuto \def\@@DriverFieldParent{#1}% @@ -647,12 +643,12 @@ \let\@@DriverFieldMode\fieldcopymode \def\@@DriverFieldFree{0}% \def\@@DriverFieldAuto{0}% - \def\docommando##1% + \def\docommand##1% {\ifcase\@@DriverFieldAutoParent\else \setmainfieldkid{\@@DriverFieldParent}{##1}% \fi \changefield{##1}}% - \processcommalist[#2]\docommando + \processcommalist[#2]\docommand \fi \fi \else @@ -753,19 +749,19 @@ \def\dosetupfield[#1][#2][#3][#4][#5]% {\iffifthargument - \def\docommando##1{\dodosetupfield[##1][#2][#3][#4][#5]}% - \processcommalist[#1]\docommando + \def\docommand##1{\dodosetupfield[##1][#2][#3][#4][#5]}% + \processcommalist[#1]\docommand \else\ifthirdargument - \def\docommando##1{\dodosetupfield[##1][#2][][][#3]}% - \processcommalist[#1]\docommando + \def\docommand##1{\dodosetupfield[##1][#2][][][#3]}% + \processcommalist[#1]\docommand \else\ifsecondargument \doifelse{#2}\v!reset - {\def\docommando##1{\donosetupfield[#1][][][][]}} - {\def\docommando##1{\dodosetupfield[##1][][][][#2]}}% - \processcommalist[#1]\docommando + {\def\docommand##1{\donosetupfield[#1][][][][]}} + {\def\docommand##1{\dodosetupfield[##1][][][][#2]}}% + \processcommalist[#1]\docommand \else\iffirstargument - \def\docommando##1{\dodosetupfield[##1][][][][]}% - \processcommalist[#1]\docommando + \def\docommand##1{\dodosetupfield[##1][][][][]}% + \processcommalist[#1]\docommand \else \writestatus\m!fields{provide either 1, 2, 3 or 5 arguments}% \fi\fi\fi\fi} diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex index dc6b8153d..dea5d3571 100644 --- a/tex/context/base/core-fnt.tex +++ b/tex/context/base/core-fnt.tex @@ -491,9 +491,9 @@ \def\betweenunderbarwords {\bgroup - \setbox0\hbox{\dodounderbar{\hskip\fontdimen2\font}}% + \setbox0\hbox{\dodounderbar{\hskip\interwordspace}}% \nobreak - \hskip\zeropoint\!!minus\fontdimen4\font + \hskip\zeropoint\!!minus\interwordshrink \discretionary{}{}{\box0}% \egroup} @@ -548,9 +548,9 @@ \def\betweenoverstrikewords {\bgroup - \setbox0\hbox{\dooverstrike{\hskip\fontdimen2\font}}% + \setbox0\hbox{\dooverstrike{\hskip\interwordspace}}% \nobreak - \hskip\zeropoint\!!minus\fontdimen4\font + \hskip\zeropoint\!!minus\interwordshrink \discretionary{}{}{\box0}% \egroup} @@ -613,10 +613,10 @@ \tx \fi} -\def\dohighlow#1#2#3#4#5% +\def\dohighlow#1#2#3#4#5% todo, named fontdimens {\dontleavehmode \bgroup - \scratchdimen\ifdim\fontdimen5\textfont2=1ex\fontdimen#2\textfont2\else#3ex\fi + \scratchdimen\ifdim\fontexheight\textfont2=1ex #2\textfont2\else #3ex\fi \advance\scratchdimen #4ex \kern.1ex \setbox\scratchbox\hbox{#1\scratchdimen\hbox{\dodohighlow#5}}% @@ -625,14 +625,14 @@ \box\scratchbox \egroup} -\unexpanded\def\high{\dohighlow\raise{14}{.86}{0}} -\unexpanded\def\low {\dohighlow\lower{16}{.48}{0}} +\unexpanded\def\high{\dohighlow\raise\mathsupnormal{.86}{0}} +\unexpanded\def\low {\dohighlow\lower\mathsubnormal{.48}{0}} % \unexpanded\def\lohi#1#2% % {\dontleavehmode % \hbox -% {\setbox4=\hbox{\dohighlow\lower{16}{.48}{.1}{#1}}% -% \setbox6=\hbox{\dohighlow\raise{14}{.86}{.1}{#2}}% +% {\setbox4=\hbox{\dohighlow\lower\mathsubnormal{.48}{.1}{#1}}% +% \setbox6=\hbox{\dohighlow\raise\mathsupnormal{.86}{.1}{#2}}% % \ifdim\wd4<\wd6 % \wd4=\zeropoint\box4\box6 % \else @@ -645,8 +645,8 @@ \def\dolohi[#1]#2#3% {\dontleavehmode \hbox - {\setbox4\hbox{\dohighlow\lower{16}{.48}{.1}{#2}}% - \setbox6\hbox{\dohighlow\raise{14}{.86}{.1}{#3}}% + {\setbox4\hbox{\dohighlow\lower\mathsubnormal{.48}{.1}{#2}}% + \setbox6\hbox{\dohighlow\raise\mathsupnormal{.86}{.1}{#3}}% \doif{#1}{\v!left} {\ifdim\wd4<\wd6 \setbox4\hbox to \wd6{\hss\box4}% diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex index ec196af1e..a1167cebc 100644 --- a/tex/context/base/core-grd.tex +++ b/tex/context/base/core-grd.tex @@ -625,11 +625,7 @@ \dowithnextbox {\blank[\v!line]\snaptogrid\vbox{\flushnextbox}\blank[\v!line]} \vbox\bgroup - \let\setdisplayskips\relax - \abovedisplayskip\zeropoint - \abovedisplayshortskip\zeropoint - \belowdisplayskip\zeropoint - \belowdisplayshortskip\zeropoint + \forgetdisplayskips \@EA\let\@EA\next \fi} @@ -763,15 +759,19 @@ \fi} \chardef\gridboxlinenomode\plusone +\chardef\gridboxlinemode \plusone % 0:nothing 1:all 2:lines 3:frame + +\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi} +\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth} \def\setgridbox#1#2#3% - {\setbox#1\ruledvbox to #3 % given size + {\setbox#1\gridboxvbox to #3 % given size {\forgetall \resetteststrut \offinterlineskip \hsize#2% \baselinerulefalse - \ruledvbox % calculated size + \gridboxvbox % calculated size {\getrawnoflines{#3}% \getnoflines{#3}% \vskip\topskip \vskip-\strutht @@ -789,9 +789,9 @@ \hskip.2\bodyfontsize}% \fi \vrule - \!!height .5\testrulewidth - \!!depth .5\testrulewidth - \!!width \scratchdimen + \!!height \gridboxwidth + \!!depth \gridboxwidth + \!!width \scratchdimen \par}} \vfill}} @@ -867,41 +867,15 @@ %D after={\blank[halfline]}] %D \stoptyping -\newif\iffuzzysnapdone -\newif\iffuzzysnapping -\newif\iffuzzysnapped - -\chardef\fuzzysnappedleft=0 % ==1 when fuzzybegin still open - +\newif \iffuzzyvskip +\newif \iffuzzysnapdone +\newif \iffuzzysnapping +\newif \iffuzzysnapped +\chardef \fuzzysnappedleft=0 % ==1 when fuzzybegin still open \newpersistentmark\fuzzymark % (!) -\newcount\fuzzymarker -\newbox\fuzzysnapbox -\newbox\fuzzysnapsplit - -%\def\dosyncfuzzyvskip -% {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint -% \bgroup -% \endgraf -% \forgetall -% \verticalstrut -% \kern-\struttotal -% \kern-\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} +\newcount \fuzzymarker +\newbox \fuzzysnapbox +\newbox \fuzzysnapsplit \def\dosyncfuzzyvskip {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint diff --git a/tex/context/base/core-hlp.tex b/tex/context/base/core-hlp.tex index a5653f88f..46b469b68 100644 --- a/tex/context/base/core-hlp.tex +++ b/tex/context/base/core-hlp.tex @@ -81,11 +81,7 @@ \def\dosetpagehelpdata#1% {\doglobal\increment\nofhelpdataentries - \writeutilitycommand - {\twopassentry% - {hlp:\realfolio}% - {\nofhelpdataentries}% - {#1}}} + \savetwopassdata{hlp:\realfolio}{\nofhelpdataentries}{#1}} \setvalue{\e!start\v!helptext}[#1]% {\iflocation diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex index b4bcd4c5f..428df8e08 100644 --- a/tex/context/base/core-int.tex +++ b/tex/context/base/core-int.tex @@ -202,13 +202,7 @@ \else \edef\nextlink {0\getvalue{\s!link:#1:l}}% \fi - \edef\writelink - {\writeutilitycommand - {\twopassentry - {\s!link:#1}% - {\numberoflinks}% - {\noexpand\realfolio}}}% - \writelink + \lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}% \ifnum\noflinks<2 \locationfalse \fi @@ -264,13 +258,7 @@ {0\iftwopassdatafound\twopassdata\else\lastlink\fi}% \setxvalue{\s!link:#1:}% {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}% - \edef\writelink - {\writeutilitycommand - {\twopassentry - {\s!link:#1}% - {\numberoflinks}% - {\noexpand\realfolio}}}% - \writelink + \lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}% \ifnum\noflinks<2 \locationfalse \fi @@ -421,8 +409,8 @@ \showmessage\m!interactions1{\withoutpt\the\!!widtha,\withoutpt\the\!!heighta}}% % needs to be split: dimensions for each page % and mode per document and only once ! - \dosetupscreen \rugoffset\kopoffset\!!widtha\!!heighta{\the\!!counte}% - \dosetupcropbox\rugoffset\kopoffset\!!widtha\!!heighta + \dosetupscreen \backoffset\topoffset\!!widtha\!!heighta{\the\!!counte}% + \dosetupcropbox\backoffset\topoffset\!!widtha\!!heighta \egroup} \def\dosetupinteractionscreen[#1]% @@ -528,12 +516,12 @@ \def\doprocessbookmarks[#1]#2% {\let\dolistelement#2\relax \scratchcounter\zerocount - \def\docommando##1% + \def\docommand##1% {\advance\scratchcounter \plusone \getlistlevel[##1]\listlevel{\the\scratchcounter}% \setxvalue{\@@bookcount\the\scratchcounter}{1}% \setxvalue{\@@booklevel##1}{\listlevel}}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \setxvalue{\@@bookcount0}{1}% \global\chardef\currentbookmarklevel\zerocount \global\chardef\previousbookmarklevel\zerocount @@ -572,9 +560,9 @@ \global\chardef\previousbookmarklevel\currentbookmarklevel} \def\getbookmarklevelcount - {\@EA\def\@EA\docommando\@EA[\@EA##\@EA1\@EA/\bookmarktag:##2/##3]% + {\@EA\def\@EA\docommand\@EA[\@EA##\@EA1\@EA/\bookmarktag:##2/##3]% {\def\bookmarklevelcount{##2}}% - \@EA\@EA\@EA\docommando\@EA\@EA\@EA[\@EA\bookmarklevellist\@EA/\bookmarktag:0/]} + \@EA\@EA\@EA\docommand\@EA\@EA\@EA[\@EA\bookmarklevellist\@EA/\bookmarktag:0/]} \def\dodoputbookmarkelement#1#2#3#4#5#6% {\doifelsenothing{#1} @@ -666,9 +654,8 @@ {\doifelse{#3}{} {\letvalue{\??am##1\c!obstruction}\empty} {\edef\interactieblokkade{\getvalue{\??am##1\c!obstruction}} - \def\docommando####1% - {#1{####1}{\interactieblokkade}}% #1 = \remove or \add - \processcommalist[#3]\docommando + \def\docommand####1{#1{####1}{\interactieblokkade}}% #1 = \remove or \add + \processcommalist[#3]\docommand \setevalue{\??am##1\c!obstruction}{\interactieblokkade}}}% \processcommalist[#2]\dododisableinteractionmenu} @@ -1004,7 +991,7 @@ {\ifdim#2>\zeropoint % new \dimen2\zeropoint \setbox0\hbox - {\def\docommando##1% + {\def\docommand##1% {\doifnotvalue{\??am##1\c!state}\v!none {\hskip\dimen2 \setbox2\hbox to #2 @@ -1015,7 +1002,7 @@ {\dimen2=\getvalue{\??am##1\c!distance}}% \box2}}% \startinteraction - \processcommacommand[\getvalue{\??am#1}]\docommando + \processcommacommand[\getvalue{\??am#1}]\docommand \stopinteraction}% \wd0=#2\relax \box0\relax @@ -1025,7 +1012,7 @@ {\ifdim#2>\zeropoint % new \dimen2\zeropoint \setbox0\vbox - {\def\docommando##1% + {\def\docommand##1% {\doifnotvalue{\??am##1\c!state}\v!none {\vskip\dimen2 \setbox2\vbox to #2 @@ -1038,7 +1025,7 @@ {\dimen2=\getvalue{\??am##1\c!distance}}% \box2}}% \startinteraction - \processcommacommand[\getvalue{\??am#1}]\docommando + \processcommacommand[\getvalue{\??am#1}]\docommand \stopinteraction}% \ht0=#2\relax \dp0\zeropoint @@ -1124,7 +1111,7 @@ \fi \egroup} -\unprotected\def\includemenu[#1]% +\def\includemenu[#1]% {\doifvalue{\??am#1\c!state}\v!local {\bgroup \letvalue{\??am#1\c!state}\v!start @@ -1194,8 +1181,8 @@ {\extendedmenufalse\dointeractionmenu{#1}{#2}}} \def\dodosetupinteractionmenu[#1][#2]% - {\def\docommando##1{\getparameters[\??am##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??am##1][#2]}% + \processcommalist[#1]\docommand} \setvalue{\??am\??am\v!yes }{0} \setvalue{\??am\??am\v!empty}{1} @@ -1866,14 +1853,10 @@ \def\dofollowprofile#1[#2]% {\iflocation \hbox - {\dostartgoto - \data - {\dolocationattributes\??ia\c!style\c!color{#1\presetgoto}}% - \start - \dostartgotoprofile\buttonwidth\buttonheight{#2}% - \stop - \dostopgotoprofile - \dostopgoto}% + {\dohandlegoto + {\dolocationattributes\??ia\c!style\c!color{#1\presetgoto}}% + {\dostartgotoprofile\buttonwidth\buttonheight{#2}}% + {\dostopgotoprofile}}% \else {#1}% \fi} @@ -1900,24 +1883,20 @@ % het begin (start) en een voor het eind (stop). Nu staat % alles in een lijst. -\definetwopasslist{\s!profile} +\definetwopasslist\s!profile \newcounter\currentprofile \def\dosetprofilepage% {\doglobal\increment\currentprofile - \edef\docommando% - {\writeutilitycommand% - {\twopassentry% - {\s!profile}% - {\currentprofile}% - {\noexpand\realfolio}}}% - \docommando} + \lazysavetwopassdata{\s!profile}{\currentprofile}{\noexpand\realfolio}} \def\dogetprofilepage% {\gettwopassdata{\s!profile}% \let\profilepage=\twopassdata} +% is this stuff used at all + \newcounter\versionlevel \newcounter\versionorder @@ -1930,37 +1909,24 @@ \def\dosetupversions[#1]% {\getparameters[\??ve][#1] - \stripcharacter.\from\@@venumber\to\minimumversion - \setversion} + \stripcharacter.\from\@@venumber\to\minimumversion} -\def\setupversions% +\def\setupversions {\dosingleargument\dosetupversions} -\definetwopasslist{\s!versionbegin} -\definetwopasslist{\s!versionend} +\definetwopasslist\s!versionbegin +\definetwopasslist\s!versionend -\def\actualprofile{} +\let\actualprofile\empty -\def\doresetpageversion% - {\edef\docommando% - {\writeutilitycommand% - {\twopassentry% - {\s!versionend}% - {\versionorder}% - {\noexpand\realfolio}}}% - \docommando} +\def\doresetpageversion + {\lazysavetwopassdata{\s!versionend}{\versionorder}{\noexpand\realfolio}} \def\dosetpageversion#1% {\recentversiontrue \doglobal\increment\versionorder\relax - \edef\docommando% - {\writeutilitycommand% - {\twopassentry% - {\s!versionbegin}% - {\versionorder}% - {\noexpand\realfolio}}}% - \docommando - \let\resetpageversion=\doresetpageversion} + \lazysavetwopassdata{\s!versionbegin}{\versionorder}{\noexpand\realfolio}% + \let\resetpageversion\doresetpageversion} \def\recentcontributions{} @@ -1972,18 +1938,10 @@ \iftwopassdatafound \!!countb\twopassdata\relax \doglobal\increment\versionorder\relax - \writeutilitycommand% - {\twopassentry% - {\s!versionbegin}% - {\versionorder}% - {\the\!!counta}}% - \writeutilitycommand% - {\twopassentry% - {\s!versionend}% - {\versionorder}% - {\the\!!countb}}% - \for\teller=\!!counta\to\!!countb\step1\do% - {\@EA\doglobal\@EA\addtocommalist\@EA{\teller}{\recentcontributions}}% + \savetwopassdata{\s!versionbegin}{\versionorder}{\the\!!counta}% + \savetwopassdata{\s!versionend }{\versionorder}{\the\!!countb}% + \dostepwiserecurse\!!counta\!!countb\plusone + {\@EA\doglobal\@EA\addtocommalist\@EA{\recurselevel}{\recentcontributions}}% \let\next\checkrecentcontributions \else \let\next\relax @@ -1993,14 +1951,14 @@ \fi \next} -\def\docheckpageversion% +\def\docheckpageversion {\ExpandBothAfter\doifinsetelse{\realfolio}{\recentcontributions} - {\geselecteerdtrue}% - {\geselecteerdfalse}} + {\pageselectedtrue}% + {\pageselectedfalse}} -\let\setpageversion = \gobbleoneargument -\let\resetpageversion = \relax -\let\checkpageversion = \relax +\let\setpageversion \gobbleoneargument +\let\resetpageversion \relax +\let\checkpageversion \relax \def\complexstartversion[#1]% {\bgroup @@ -2027,7 +1985,7 @@ \definecomplexorsimpleempty\startversion -\def\stopversion% +\def\stopversion {\stopprofile \doglobal\decrement\versionlevel \ifnum\versionlevel<\zerocount @@ -2037,20 +1995,6 @@ \egroup \fi} -\bgroup -\catcode`@=\active -\gdef\setversion% - {\catcode`@=\active % we can't use \@@active here - \long\def@##1##2 % - {\ifx##1+% - \startversion[##2]% - \else\ifx##1-% - \stopversion - \else - \oldatcharacter##1##2 % - \fi\fi}} -\egroup - \def\markversion {\showmessage\m!versions2\empty \let\setpageversion\dosetpageversion @@ -2062,8 +2006,7 @@ \showmessage\m!versions3\recentcontributions \let\setpageversio\gobbleoneargument \let\resetpageversion\relax - \let\checkpageversion\docheckpageversion - \setversion} + \let\checkpageversion\docheckpageversion} \def\dodefineversion[#1][#2]% {\setvalue{\c!versie!!#1}{#2}% @@ -2076,9 +2019,9 @@ {\followprofile} \def\followprofileversion#1[#2][#3]% - {\def\docommando##1% + {\def\docommand##1% {\defineprofile[#2#3][##1]}% - \processcommacommand[\getvalue{\c!versie!!#3}]\docommando + \processcommacommand[\getvalue{\c!versie!!#3}]\docommand \followprofile#1[#2#3]} \newcounter\currentpagetransition @@ -2239,16 +2182,16 @@ {\bgroup \doifelse\@@ccstate\v!start {\dopreparecommentaar{#1}{#2}% - \long\def\docommando##1% + \long\def\docommand##1% {\global\setbox\commentbox\frozenhbox {\hbox to \zeropoint {\struttedbox{\tbox{\dodocomment{##1}}}\hss}% \hskip\ifvoid\commentbox\@@ccmargin\else\@@ccdistance\fi \box\commentbox}% \egroup}}% - {\long\def\docommando##1% + {\long\def\docommand##1% {\egroup}}% - \grabuntil{\e!stop\v!comment}\docommando} + \grabuntil{\e!stop\v!comment}\docommand} \letvalue{\e!stop\v!comment}\relax % handy for \expanded{...} @@ -2411,16 +2354,16 @@ \ifsecondargument \setupinteractionmenu [#1][\c!unknownreference=\v!yes,\c!samepage=\v!yes]% - \def\docommando##1% + \def\docommand##1% {\registermenucommand{\menubutton[#1]{##1}[#2:##1]}}% \else - \def\docommando##1% + \def\docommand##1% {\registermenucommand {\button [\c!unknownreference=\v!yes,\c!samepage=\v!yes] {##1}[#1:##1]}}% \fi - \handletokens abcdefghijklmnopqrstuvwxyz\with\docommando % moet anders + \handletokens abcdefghijklmnopqrstuvwxyz\with\docommand % moet anders \egroup} \def\registermenubuttons diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index d495011f1..364501f23 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -108,11 +108,7 @@ \def\doitembreak#1{\ifconditional\optimizelistitem\ifconditional\textlistitem\else\dosomebreak#1\fi\fi} \def\dolistreference - {\immediatewriteutilitycommand - {\twopassentry - {\s!list}% - {\currentlist}% - {\currentlist:\noflistelements}}} + {\savetaggedtwopassdata{\s!list}{\currentlist}{\currentlist}{\noflistelements}} \def\initializeitemgroupslevel#1% {\ifundefined{\@@globalitemsymbol{#1}}% @@ -258,8 +254,8 @@ \popmacro\currentitemgroup} \def\dosetupitemgroup[#1][#2][#3][#4]% - {\def\docommando##1{\dodosetupitemgroup[##1][#2][#3][#4]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\dodosetupitemgroup[##1][#2][#3][#4]}% + \processcommalist[#1]\docommand} \def\setupitemgroup {\doquadrupleempty\dosetupitemgroup} @@ -289,13 +285,13 @@ \def\unknownitemsymbol{?} -\def\setitemmark#1% % en pas op: resets \docommando +\def\setitemmark#1% % en pas op: resets \docommand {\doifsymboldefinedelse{#1} {\edef\currentitemsymbol{#1}% \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}% \setgvalue{\@@localitemsymbol \itemlevel}{\unknownitemsymbol}% \def\listitem{\symbol[\currentitemsymbol]}% - \let\@@opsymbol\empty}% \let\docommando\gobbleoneargument} + \let\@@opsymbol\empty}% \let\docommand\gobbleoneargument} {\doifconversiondefinedelse{#1} {\edef\currentitemsymbol{#1}% \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}% @@ -311,7 +307,7 @@ \getvalue{\@@localitemsymbol\itemlevel}\tempsymbol \getitemparameter\itemlevel {\ifconditional\textlistitem\c!righttext\else\c!right\fi}}% - \let\@@opsymbol\empty}%\let\docommando\gobbleoneargument} + \let\@@opsymbol\empty}%\let\docommand\gobbleoneargument} {}}} \def\calculatelistwidth#1#2% distance deals with 'broad' @@ -366,6 +362,66 @@ \let\startcollectitems\relax \let\stopcollectitems \relax +%D A nice example of a plugin: +%D +%D \startbuffer +%D \startitemize[a,random,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D +%D \startitemize[a,random,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D +%D \startitemize[a,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +% better collectitems als conditional and a real plugin mechanism (some day) + +\@EA\long\@EA\def\@EA\collectitemgroupitem\@EA#\@EA1\csname\e!stop\v!item\endcsname + {\increment\itemcollectcounter + \long\setvalue{\v!item*\itemcollectcounter}{\item#1\par}} + +\def\flushcollecteditems + {\ifconditional\randomizeitems + \getrandomnumber\itemcollectcounternow\plusone\itemcollectcounter + \else + \increment\itemcollectcounternow + \fi + \doifdefined{\v!item*\itemcollectcounternow} + {\getvalue{\v!item*\itemcollectcounternow}% + \letbeundefined{\v!item*\itemcollectcounternow}% + \increment\itemcollectcounterdone}% + \ifnum\itemcollectcounterdone<\itemcollectcounter\relax + \expandafter\flushcollecteditems + \fi} + +\def\stopcollectitems + {\ifconditional\randomizeitems + \newcounter\itemcollectcounterdone + \ifnum\itemcollectcounter>\zerocount + \@EAEAEA\flushcollecteditems + \fi + \fi} + +\def\startcollectitems + {\ifconditional\randomizeitems + \newcounter\itemcollectcounter + \letvalue{\e!start\v!item}\collectitemgroupitem + \fi} + +%D End of plugin. + +\ifx\startcolumns\undefined \def\startcolumns[#1]{} \fi +\ifx\stopcolumns \undefined \let\stopcolumns\relax \fi + \def\redostartitemgroup[#1][#2]% {\setfalse\inlinelistitem % new, no indent (leftskip) \setfalse\concatnextitem % new, concat @@ -409,10 +465,10 @@ \global\setitemparameter\itemlevel\v!continue {\dosetupitemgroupconstant[\itemlevel][#1]% \dosetupitemgroupvariable[\itemlevel][#2]}}% - \def\docommando##1% \setitemmark resets \docommando + \def\docommand##1% \setitemmark resets \docommand {\doifnot{##1}{0}{\setitemmark{##1}}}% - % \processcommalist[#1,\@@opsymbol]\docommando - \processcommalist[#1]\docommando}% ** preset sequence or provided sequence + % \processcommalist[#1,\@@opsymbol]\docommand + \processcommalist[#1]\docommand}% ** preset sequence or provided sequence % moved to here, after settings \ifnum\itemlevel=\plusone % NIEUW \doadaptleftskip {\getitemparameter1\c!margin}% @@ -565,6 +621,7 @@ \itemgroupitem} \appendtoks \let\item \itemgroupitem \to \itemgroupcommands +%appendtoks \letvalue\v!item \itemgroupitem \to \itemgroupcommands \appendtoks \let\itm \itemgroupitem \to \itemgroupcommands \appendtoks \let\but \itemgroupbutton \to \itemgroupcommands \appendtoks \let\nop \itemgroupdummy \to \itemgroupcommands @@ -577,18 +634,14 @@ % todo : \startitem .. \stopitem -% quick hack ... - -\def\v!item{item} - \appendtoks - \letvalue{\e!start\v!item}\itemgroupitem - \letvalue{\e!stop \v!item}\endgraf + \letvalue{\e!start\v!item}\itemgroupitem + \letvalue{\e!stop \v!item}\endgraf \to \itemgroupcommands \appendtoks - \setvalue{\e!start\v!head}#1{\itemgrouphead#1\par}% - \letvalue{\e!stop \v!head}\endgraf + \setvalue{\e!start\v!head}#1{\itemgrouphead#1\par}% + \letvalue{\e!stop \v!head}\endgraf \to \itemgroupcommands % \startitemize @@ -659,9 +712,9 @@ % \ignorespaces \increment\noflistelements \ifnum\itemcolumndepth=\zerocount \ifconditional\optimizelistitem - \ifnum\noflistelements=\plusone % tgv bv kolommen/nesting - \findtwopassdata\s!list{\noflists:}% % wordt soms de volgorde - \fi % verstoord, vandaar \find + \ifnum\noflistelements=\plusone % tgv bv kolommen/nesting + \findtwopassdata\s!list{\noflists}% % wordt soms de volgorde + \fi % verstoord, vandaar \find \iftwopassdatafound \ifcase0\twopassdata\relax \twopassdatafoundfalse \fi \fi @@ -720,7 +773,7 @@ \calculatelistwidth\itemlevel{\dimen0}% \fi \ifconditional\textlistitem - \hbox{\ifconditional\sublistitem+\fi\box8\hskip\fontdimen2\font}\nobreak + \hbox{\ifconditional\sublistitem+\fi\box8\hskip\interwordspace}\nobreak \else\ifconditional\inlinelistitem \hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}% \else\ifconditional\txtlistitem @@ -828,7 +881,12 @@ \fi \fi \else +\ifconditional\inlinelistitem +% \removeunwantedspaces\hskip\interwordspace\!!plus\emwidth\relax % new per 2006/10/20 + \removeunwantedspaces\hskip\emwidth\!!plus\interwordstretch\!!minus\interwordshrink\relax % new per 2006/10/20 +\else \getitemparameter\itemlevel\c!inbetween +\fi \fi \ifconditional\concatnextitem % new, concat \vskip-\lastskip % new, concat @@ -852,6 +910,7 @@ \egroup}}% \strut % added 11-08-99 \setfalse\concatnextitem % new, concat + \nobreak % else problems with intext items \hskip\itemsignal % new, concat \getitemparameter\itemlevel\c!command} % \defaultitemcommand diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 03d91f5a4..d1b766392 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -60,12 +60,12 @@ \def\next{\processlocalfile\readlocfile}% \else \let\filepath\empty - \def\docommando##1% + \def\docommand##1% {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse \ifdone\expandafter\quitcommalist\fi}% \doifparentfileelse{#1} % new - {\processcommacommand [\allinputpaths]\docommando} - {\processcommacommand[.,\allinputpaths]\docommando}% + {\processcommacommand [\allinputpaths]\docommand} + {\processcommacommand[.,\allinputpaths]\docommand}% \ifx\filepath\empty \def\next{\processlocalfile\readlocfile}% fall back ../../.. \else @@ -79,10 +79,10 @@ \@EA\secondoftwoarguments \else \let\filepath\empty - \def\docommando##1% + \def\docommand##1% {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse \ifdone\expandafter\quitcommalist\fi}% - \processcommacommand[.,\allinputpaths]\docommando + \processcommacommand[.,\allinputpaths]\docommand \ifx\filepath\empty \@EAEAEA\secondoftwoarguments \else @@ -93,67 +93,53 @@ \let\allinputpaths\empty % \def\usepath[#1]% -% {\def\docommando##1% +% {\def\docommand##1% % {\doifelse{##1}\v!reset % {\let\allinputpaths\empty} % {\addtocommalist{##1}\allinputpaths}}% -% \processcommalist[#1]\docommando} +% \processcommalist[#1]\docommand} % % \def\usesubpath[#1]% new, see webschrift for usage % {\ifx\allinputpaths\empty % \edef\allinputpaths{#1}% % \else -% \def\docommando##1% -% {\def\dodocommando####1{\addtocommalist{##1/####1}\allinputpaths}% -% \processcommalist[#1]\dodocommando}% -% \processcommacommand[\allinputpaths]\docommando +% \def\docommand##1% +% {\def\dodocommand####1{\addtocommalist{##1/####1}\allinputpaths}% +% \processcommalist[#1]\dodocommand}% +% \processcommacommand[\allinputpaths]\docommand % \fi} % % the following alternatives permit ../{name} i.e. braces \def\usepath[#1]% - {\def\docommando##1% + {\def\docommand##1% {\doifelse{##1}\v!reset {\let\allinputpaths\empty} {\sanitizefilename#1\to\ascii \convertcommand\ascii\to\ascii \addtocommalist\ascii\allinputpaths}}% - \processcommalist[#1]\docommando} + \processcommalist[#1]\docommand} \def\usesubpath[#1]% test for a real long time, permits ../{name} i.e. braces {\ifx\allinputpaths\empty \sanitizefilename#1\to\allinputpaths \else - \def\docommando##1% - {\def\dodocommando####1% + \def\docommand##1% + {\def\dodocommand####1% {\sanitizefilename####1\to\ascii \convertcommand\ascii\to\ascii \addtocommalist{##1/\ascii}\allinputpaths}% - \processcommalist[#1]\dodocommando}% - \processcommacommand[\allinputpaths]\docommando + \processcommalist[#1]\dodocommand}% + \processcommacommand[\allinputpaths]\docommand \fi} \def\registerfileinfo[#1#2]#3% geen \showmessage ? {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}% - % \pdfliteral{\letterpercent #1#2 file #3 at line \the\inputlineno}% \immediatewriteutility{f #1 {#3}}} \ifx\preloadfonts \undefined \let\preloadfonts \relax \fi \ifx\preloadspecials\undefined \let\preloadspecials\relax \fi -% \def\loadsystemfiles -% {\reportprotectionstate -% \readsysfile\f!newfilename -% {\showmessage\m!systems2\f!newfilename}\donothing -% \readsysfile\f!oldfilename -% {\showmessage\m!systems2\f!oldfilename}\donothing -% \readsysfile\f!filfilename -% {\showmessage\m!systems2\f!filfilename}\donothing -% \readsysfile\f!sysfilename -% {\showmessage\m!systems2\f!sysfilename}\donothing} -% -% test \@@svgebied - \def\loadallsystemfiles#1#2% {\ifx\@@svdirectory\empty \readsysfile{#1}{\showmessage\m!systems2{#1}}{#2}% @@ -167,46 +153,28 @@ \def\loadsystemfiles {\reportprotectionstate - \readsysfile\f!newfilename - {\showmessage\m!systems2\f!newfilename}% - \donothing - \readsysfile\f!oldfilename - {\showmessage\m!systems2\f!oldfilename}% - \donothing + \readsysfile\f!newfilename{\showmessage\m!systems2\f!newfilename}\donothing + \readsysfile\f!oldfilename{\showmessage\m!systems2\f!oldfilename}\donothing \loadallsystemfiles\f!filfilename \donothing \loadallsystemfiles\f!sysfilename {\loadallsystemfiles{\f!sysfilename.rme}\donothing % new, fall back - \doglobal\appendtoks - \bgroup - \disableXML - \loadallsystemfiles\f!errfilename\donothing - \egroup + \doglobal\appendtoks % brrr better \setcatcodetable\ctxcatcodes % % test + \bgroup\disableXML\loadallsystemfiles\f!errfilename\donothing\egroup \to\everygoodbye}} - %\loadallsystemfiles\f!modfilename - % \donothing} - %D Loading of \type {cont-usr.tex} (edited by the user) %D and \type {cont-fmt.tex} (generated by texexec). \def\loaduserspecifications - {\readsysfile\f!usrfilename - {\showmessage\m!systems2\f!usrfilename}\donothing - \readjobfile\f!fmtfilename - {\showmessage\m!systems2\f!fmtfilename}\donothing} + {\readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing + \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing} %D We don't want multiple jobfiles to interfere. -\bgroup -\catcode`\%=\@@other -\xdef\texcommentsymbol{%} -\egroup - \def\loadoptionfile {\readjobfile{\jobname.\f!optionextension} {\showmessage\m!systems2{\jobname.\f!optionextension}}% - %{\showmessage\m!systems2{\jobname.\f!optionextension}}} {\writestatus\m!systems {no \jobname.\f!optionextension}}} % \newevery \everyjob \EveryJob @@ -273,8 +241,6 @@ \expandafter\finalend \fi} -\let\normalend\end - \def\finalend {\ifnum\textlevel>\zerocount \else \the\everybye @@ -312,19 +278,18 @@ {\doexecutefile{#1}} \def\useenvironment[#1]% maybe commalist - {\environment #1 } + {\environment #1 \relax} -\def\environment #1 % at outermost level only - {\def\startenvironment ##1 {}% +\def\environment #1 % at outermost level only (load only once) + {\pushmacro\startenvironment + \pushmacro\stopenvironment + \def\startenvironment ##1 {}% \let\stopenvironment\relax - % why not \doexecutefile ? - \registerfileinfo[begin]{#1}% - \dostarttextfile{#1}% \startreadingfile - \processfile{#1}% was : \readlocfile{#1}{}{} + \doexecutefileonce{#1} \stopreadingfile - \dostoptextfile - \registerfileinfo[end]{#1}} + \popmacro\stopenvironment + \popmacro\startenvironment} \def\component #1 % at outermost level only {\dostarttextfile{#1}% @@ -447,10 +412,10 @@ \setvalue{\e!start\v!localenvironment}[#1]% {\let\loadedlocalenvironments\empty - \def\docommando##1% + \def\docommand##1% {\beforesplitstring##1\at.\to\someevironment \fullexpandoneargafter\addtocommalist\someevironment\loadedlocalenvironments}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \fullexpandtwoargsafter\doifcommonelse % no longer next needed {\currentproject,\currentproduct,% \currentcomponent,\currentenvironment} @@ -460,10 +425,6 @@ \setvalue{\v!localenvironment}#1 {\doexecutefileonce{#1}} -% Het -karakter (FormFeed), wordt omgezet in \par - -\catcode`\^^L=\@@endofline - % NOT TOEVOEGEN: \the\everytrace \neverypar=\emptytoks @@ -478,10 +439,6 @@ % \appendtoks \flushnotes \to \everydisplay % \appendtoks \adjustsidefloatdisplaylines \to \everydisplay - -%D Better here than in supp-mps: - -\def\executesystemcommand{\immediate\write18} % soon, when pdftex 1.22 is out in the field: diff --git a/tex/context/base/core-lme.tex b/tex/context/base/core-lme.tex new file mode 100644 index 000000000..d8c99d8c7 --- /dev/null +++ b/tex/context/base/core-lme.tex @@ -0,0 +1,55 @@ +%D \module +%D [ file=core-lme, +%D version=2006.08.14, +%D title=\CONTEXT\ Core Macros, +%D subtitle=LAst Minute Extensions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{Context Core Macros / Last Minute Extensions} + +%D Things that depend on too much other things. + +\unprotect + +%D Probably obsolete, depends on \type {\checksidefloat}. May disappear. + +\def\checkframedtext + {\ifinsidefloat + \localhsize\hsize + \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 + \checksidefloat + \setlocalhsize + \else + \localhsize\hsize + \fi\fi} + +%D For my eyes only: + +\newcount\nofprofiled + +\def\profilemacro#1% + {\nofprofiled\zerocount + \letvalue{\string#1\string#1}#1% + \appendtoks + \normalwritestatus\m!systems{profile \string#1: \number\nofprofiled}% + \to \everystoptext + \unexpanded\def#1% + {\global\advance\nofprofiled\plusone + \csname\string#1\string#1\endcsname}} + +%D Some plain goodies, they may be moved to \type {m-plain.tex} some day. + +\ifx\hang \undefined \def\hang {\hangindent\parindent} \fi +\ifx\textindent\undefined \def\textindent#1{\indent\llap{#1\enspace}\ignorespaces} \fi +\ifx\narrower \undefined \def\narrower {\advance\leftskip \parindent\advance\rightskip\parindent} \fi + +\protect \endinput diff --git a/tex/context/base/core-lnt.tex b/tex/context/base/core-lnt.tex index b19019bb8..29e8a97f0 100644 --- a/tex/context/base/core-lnt.tex +++ b/tex/context/base/core-lnt.tex @@ -50,7 +50,7 @@ \hsize\zeropoint \hss \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% - {\blue\vl}% + {\color[blue]{\vl}}% \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% \hss}% \prewordbreak diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex index 8029d4fe1..359e9b8ce 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -1118,9 +1118,9 @@ \def\showremaininglistlength {\bgroup \ifnum\listlengthcounter>\plusone - \scratchdimen\pagetotal \setbox\scratchbox\vbox {\@@llbefore\par\horizontalstrut\par\horizontalstrut\par\@@llafter}% + \scratchdimen\pagetotal \advance\scratchdimen \ht\scratchbox \advance\scratchdimen \dp\scratchbox \ifdim\scratchdimen>\pagegoal diff --git a/tex/context/base/core-ltb.tex b/tex/context/base/core-ltb.tex index 209f5434e..74ae34210 100644 --- a/tex/context/base/core-ltb.tex +++ b/tex/context/base/core-ltb.tex @@ -472,11 +472,11 @@ \globallet\noflinetablecolumns\!!zerocount \globallet\noflinetableparts\!!zerocount \!!counta\zerocount - \def\docommando##1% + \def\docommand##1% {\doglobal\increment\noflinetableparts \advance\!!counta##1% \setxvalue{\??le::\noflinetableparts}{\the\!!counta}}% - \processcommacommand[\linetableparameter\c!n]\docommando + \processcommacommand[\linetableparameter\c!n]\docommand \initializetableboxes\noflinetableparts \ifcase\linetablerepeat \globallet\linetablepart\!!plusone diff --git a/tex/context/base/core-mar.tex b/tex/context/base/core-mar.tex index 257c3dc4c..2051102f2 100644 --- a/tex/context/base/core-mar.tex +++ b/tex/context/base/core-mar.tex @@ -71,8 +71,8 @@ {\dosingleargument\doresetmarking} \def\dosetupmarking[#1][#2]% - {\def\docommando##1{\getparameters[\??mk##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??mk##1][#2]}% + \processcommalist[#1]\docommand} \def\setupmarking {\dodoubleargument\dosetupmarking} diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index ec6708670..21498b0a2 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -131,19 +131,6 @@ \def\belowdisplayshortskipsize% obsolete {\displayskipsize\displayshortskipfactor\displayshortskipgluefactor} -\def\setdisplayskip#1#2#3% obsolete - {#1=#2\relax - \advance#1 -\parskip - \advance#1 -#3\relax} - -\def\setdisplayskips % obsolete - {\setdisplayskip\abovedisplayskip \abovedisplayskipsize \zeropoint - \setdisplayskip\belowdisplayskip \belowdisplayskipsize \zeropoint - \setdisplayskip\abovedisplayshortskip\abovedisplayshortskipsize\baselineskip - \setdisplayskip\belowdisplayshortskip\belowdisplayshortskipsize\baselineskip} - -% so far for unused stuff - \def\forgetdisplayskips % to do {\abovedisplayskip \zeropoint \belowdisplayskip \zeropoint @@ -192,7 +179,7 @@ {\dostartattributes\??fm\c!numberstyle\c!numbercolor \strut \@@fmleft - \preparethenumber\??fm\composedsectionnumber\preparednumber + \preparefullnumber\??fm\composedsectionnumber\preparednumber \labeltexts\v!formula {\ignorespaces\preparednumber\ignorespaces\hetsubnummer\unskip}% \@@fmright @@ -350,7 +337,6 @@ \freezedimenmacro\rightdisplaymargin \freezedimenmacro\predisplaysizethreshhold \forgetdisplayskips - \let\setdisplayskips\relax \ifoptimizedisplayspacing \ifdim\lastlinewidth>\zeropoint \abovedisplayshortskip-\strutht\relax @@ -380,55 +366,13 @@ \nonoindentation \dochecknextindentation{\??fm\currentformula}% \egroup + \hangafter\minusone % added for side floats + \hangindent\zeropoint % added for side floats \setfalse\handleformulanumber \dorechecknextindentation} % here ? \newif\ifinformula -% \def\startdisplaymath -% {\ifgridsnapping -% \beforedisplayspace -% \snapmathtogrid\vbox -% \bgroup -% \informulatrue -% %\forgetall % breaks side floats -% \else -% \bgroup -% \informulatrue -% %\forgetall % otherwise backgrounds fail -% \ifdim\lastskip<\zeropoint\else -% \par -% \ifvmode \ifdim\parskip>\zeropoint\relax -% \vskip-\parskip -% \fi \fi -% \fi -% \doif\displaygridcorrection{-\v!boven}{\kern-\strutht}% new, currently only option/default -% \beforedisplayspace -% \par -% \ifvmode -% \verticalstrut -% \vskip-\struttotal -% \vskip-\baselineskip -% \fi -% \fi -% $$\setdisplaydimensions -% \setpredisplaysize\lastlinewidth -% \startinnermath} - -% \def\stopdisplaymath -% {\stopinnermath -% $$% -% \ifgridsnapping -% \egroup -% \afterdisplayspace -% \else -% \par\ifvmode\ifdim\parskip>\zeropoint\vskip-\parskip\fi\fi -% \afterdisplayspace -% \egroup -% \fi -% \globallet\displaylinecorrection\empty -% \gdef\displaygridcorrection{\displaygridsnapping}} - \def\startdisplaymath {\ifgridsnapping \beforedisplayspace @@ -503,17 +447,6 @@ \def\moveformula {\dosingleempty\domoveformula} -% \def\domoveformula[#1]% brr gaat mogelijk fout -% {\ifgridsnapping -% \iffirstargument -% \xdef\displaygridcorrection{#1}% -% \else -% \gdef\displaygridcorrection{-\v!boven}% handy with short preline -% \fi -% \else -% \gdef\displaygridcorrection{\displaygridsnapping}% -% \fi} - \def\domoveformula[#1]% brr gaat mogelijk fout {\iffirstargument \xdef\displaygridcorrection{#1}% @@ -596,6 +529,85 @@ {\setfalse\incrementformulanumber \dodoubleempty\doplaceformula} +%D \macros +%D {setupsubformulas, startsubformulas} +%D +%D New code (by Aditya Mahajan / cleaned up by HH, please check): + +% \setupsubformulas[conversion=romannumerals] +% +% \placeformula +% \startsubformulas[Maxwell] +% \startformulas +% \startformula \startalign +% \NC \nabla\cdot\bf E \NC = \frac{\rho}{\varepsilon_0} \NR[Maxwell 1] +% \NC \nabla\times\bf E \NC = - \frac{\partial\bf B}{\partial t} \NR[Maxwell II] +% \stopalign \stopformula +% \startformula \startalign +% \NC \nabla\cdot \bf B \NC = 0 \NR[Maxwell III] +% \NC \nabla\times\bf B \NC = \mu_0{\bf j}+\varepsilon_0\mu_0\frac{\partial\bf E}{\partial t} \NR[Maxwell IV] +% \stopalign \stopformula +% \stopformulas +% \stopsubformulas +% +% Maxwell : \in [Maxwell] and II : \in [Maxwell II] + +\def\setupsubformulas + {\dodoubleargument\getparameters[\??fn]} + +\definenumber[\v!formula*] + +\def\subformulaconversion % #1 + {\getnumber[\v!formula*]\@@fnseparator\convertnumber\@@fnconversion} % #1 + +\defineconversion[\v!subformula][\subformulaconversion] + +\def\startsubformulas + {\dosingleempty\dostartsubformulas} + +\def\dostartsubformulas[#1]% + {\incrementnumber[\v!formula]% + \makesectionnumber[\v!formula]% + \doflushformulalistentry{\composedsectionnumber}% + \doifsomething{#1}{\rawreference\s!for{#1}\composedsectionnumber}% + \expanded{\setupnumber + [\v!formula*] + [\c!start={\rawnumber[\v!formula]}, + \c!way=\@@fmway, + \c!conversion=\@@fmconversion]}% + \bgroup + \savenumber[\v!formula]% + \setupformulas + [\c!conversion=\v!subformula, + \c!way=\v!by\v!text]% + \resetnumber + [\v!formula]} + +\def\stopsubformulas + {\restorenumber[\v!formula]% + \egroup + \resetlastlinewidth + \nonoindentation + \dochecknextindentation\??fn + \dorechecknextindentation} % here ? + +%D Named subformulas + +\def\startnamedsubformulas + {\dosingleempty\dostartnamedsubformulas} + +\def\dostartnamedsubformulas[#1]#2% + {\setformulalistentry{#2}% + \startsubformulas[#1]} + +\def\stopnamedsubformulas + {\stopsubformulas} + +\setupsubformulas + [\c!conversion=\v!character, + \c!separator=\@@fmseparator, + \c!indentnext=\@@fmindentnext] + %D Experimental goodie: %D %D \startbuffer @@ -630,32 +642,6 @@ %D The implementation of placement is a bit ugly: -% \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces -% {\def\redoplaceformula -% {\bgroup\def\dostartformula####1{\relax}% -% \ifx\next\bgroup -% \@EA\moreplaceformula % [ref]{} -% \else -% \expandafter\convertargument\e!start\to\asciiA % actually, \next's meaning is \dostartformula -% \expandafter\convertargument\next \to\asciiB -% \ExpandBothAfter\doifincsnameelse\asciiA\asciiB -% {\egroup \@EA\dodoplaceformula}% [ref]\start -% {\egroup \@EA\dispplaceformula}% [ref]$$ -% \fi[#1]{}}% -% \futurelet\next\redoplaceformula} -% -% \long\def\moreplaceformula[#1]#2#3#4% #2 dummy #4 gobbles spaces -% {\def\redoplaceformula -% {\expandafter\convertargument\e!start\to\asciiA -% \expandafter\convertargument\next \to\asciiB -% \ExpandBothAfter\doifincsnameelse\asciiA\asciiB -% {\egroup \dodoplaceformula}% [ref]\start -% {\egroup \dispplaceformula}% [ref]$$ -% [#1]{#3}}% -% \futurelet\next\redoplaceformula#4} -% -% BEGIN OF PATCH (CORE-MAT.TEX) - \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces {\def\redoplaceformula {\bgroup @@ -683,27 +669,30 @@ [#1]{#3}}% \futurelet\next\redoplaceformula#4} -% END OF PATCH - \def\startformulas#1\stopformulas % new / to be internationalized {\bgroup \forgetdisplayskips \startdisplaymath \setlocalhsize - \long\def\startformula##1\stopformula{\advance\scratchcounter\plusone}% - \scratchcounter\zerocount #1% preroll - \divide \hsize \scratchcounter + \long\def\startformula##1\stopformula + {\advance\scratchcounter\plusone}% + \scratchcounter\zerocount + #1% preroll + \ifcase\scratchcounter\else + \divide \hsize \scratchcounter + \fi \hbox to \localhsize \bgroup \hss \def\normalstartformula{\vskip-\strutdepth$$}% i hate this - \def\normalstartformula{\vskip-\strutdepth$$}% i hate this \def\normalstopformula {$$}% - \def\startformula{$\vcenter\bgroup\normalstartformula}% - \def\stopformula {\normalstopformula\egroup$\hss}% + \def\startformula {$\vcenter\bgroup\normalstartformula}% + \def\stopformula {\normalstopformula\egroup$\hss}% #1% \egroup \stopdisplaymath - \egroup} + \egroup + \hangafter\minusone % added for side floats + \hangindent\zeropoint} % added for side floats \def\dispplaceformula[#1]#2$$#3$$% {\dodoplaceformula[#1]{#2}\dostartformula{}#3\dostopformula} @@ -783,38 +772,6 @@ \def\mathhbox {\iftracemath\ruledhbox\else\hbox\fi} -% \def\startmathbox#1#2% -% {\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 -% $\displaystyle -% \ifx\@leqno\empty\else \ifcase#2 -% \rlap{\@leqno}% -% \else -% \@leqno\hskip\formulaparameter\c!distance -% \fi \fi -% #1} - -% \def\stopmathbox#1#2% -% {$#1% -% \ifx\@eqno\empty\else \ifcase#2 -% \llap{\@eqno}% -% \else -% \hskip\formulaparameter\c!distance\@eqno -% \fi \fi -% \egroup} - -% \defineinnermathhandler\v!right {\startmathbox\empty1}{\stopmathbox\hfill0} -% \defineinnermathhandler\v!left {\startmathbox\hfill0}{\stopmathbox\empty1} -% \defineinnermathhandler\v!middle{\startmathbox\hfill0}{\stopmathbox\hfill0} - \chardef\mathraggedstatus=0 % normal left center right \chardef\mathnumberstatus=0 % nothing normal shift_right \let\mathnumbercorrection\!!zeropoint @@ -896,9 +853,12 @@ \fi \egroup} -\defineinnermathhandler\v!left {\startmathbox\plusone }{\stopmathbox} -\defineinnermathhandler\v!middle{\startmathbox\plustwo }{\stopmathbox} -\defineinnermathhandler\v!right {\startmathbox\plusthree}{\stopmathbox} +\defineinnermathhandler\v!left {\startmathbox\plusone }{\stopmathbox} +\defineinnermathhandler\v!middle {\startmathbox\plustwo }{\stopmathbox} +\defineinnermathhandler\v!right {\startmathbox\plusthree}{\stopmathbox} +\defineinnermathhandler\v!flushleft {\startmathbox\plusthree}{\stopmathbox} +\defineinnermathhandler\v!center {\startmathbox\plustwo }{\stopmathbox} +\defineinnermathhandler\v!flushright{\startmathbox\plusone }{\stopmathbox} %D [The examples below are in english and don't process in the %D documentation style, which will be english some day.] @@ -1074,18 +1034,6 @@ \appendtoks \advance\supersubmode \plusone \to \everysupersub -% \def\dodosuper#1{\normalsuper{\the\everysupersub#1}} -% \def\dodosuber#1{\normalsuber{\the\everysupersub#1}} -% -% \def\dosuper{\ifx\next\bgroup\expandafter\dodosuper\else\normalsuper\fi} -% \def\dosuber{\ifx\next\bgroup\expandafter\dodosuber\else\normalsuber\fi} -% -% \def\super{\futurelet\next\dosuper} -% \def\suber{\futurelet\next\dosuber} -% -% \def\super#1{\normalsuper{\the\everysupersub#1}} -% \def\suber#1{\normalsuber{\the\everysupersub#1}} - \appendtoks \gridsupsubstyle \to \everysupersub @@ -1221,13 +1169,6 @@ \newconditional\halfcrazymathlines % \settrue\halfcrazymathlines \newconditional\crazymathsnapping % \settrue\crazymathsnapping -% \appendtoks -% \doifelse\@@mtgrid\v!ja -% {\settrue \crazymathsnapping }{\setfalse\crazymathsnapping}% -% \doifelse\@@mtstap\v!halveregel -% {\settrue \halfcrazymathlines}{\setfalse\halfcrazymathlines}% -% \to \everysetuptextformulas - \appendtoks \doifelse\@@mtgrid\v!yes \settrue\setfalse\crazymathsnapping \doifelse\@@mtstep\v!halfline\settrue\setfalse\halfcrazymathlines @@ -1313,13 +1254,13 @@ {\incolortrue\localcolortrue \backgroundline[gray]{\showstruts\strut\flushnextbox}}% \fi - \def\docommando##1% + \def\docommand##1% {\doif{##1}-{\settrue \halfcrazymathlines}% \doif{##1}+{\setfalse\halfcrazymathlines}% \doif{##1}={\!!doneatrue}% \doif{##1}<{\!!donedtrue}% \doif{##1}>{\!!doneetrue}}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \if!!doneb \if!!donec \else \setfalse\halfcrazymathlines @@ -1457,8 +1398,7 @@ \crazymathindent \iftracegridsnapping \setbox\scratchbox\hbox - {\incolortrue\localcolortrue\blue - \ruledhbox{\box\scratchbox}}% + {\incolortrue\localcolortrue\color[blue]{\ruledhbox{\box\scratchbox}}}% \fi \box\scratchbox \endgraf @@ -1678,17 +1618,6 @@ \def\mathineqalign#1{$\forgetalign\displaystyle{{}#1{}}$} \def\textineqalign#1{$\forgetalign#1$} -% \def\eqalign#1% why no halign here, probably because of displaywidth -% {\!!toksa{\strut\hfil$\displaystyle{##}$}% -% \!!toksb{&$\displaystyle{{}##{}}$\hfil}% -% \!!toksc\emptytoks -% \buildeqalign -% \null\,\vcenter -% {\openup.25\bodyfontsize% was: \openup\jot -% \mathsurround\zeropoint -% \expandafter \ialign \expandafter {\the\scratchtoks\crcr#1\crcr}% -% }\,} - \def\eqalign#1% why no halign here, probably because of displaywidth {\null\,\vcenter {\openup.25\bodyfontsize% was: \openup\jot @@ -1700,22 +1629,6 @@ \chardef\eqalignmode\plusone -% \def\preparereqalignno -% {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% -% \!!toksb{&\nextineqalign\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% -% \!!toksc{\hfil\tabskip\centering&\llap{\span\textineqalign{##}}\tabskip\zeropoint}% -% \buildeqalign -% \presetdisplaymath -% \tabskip\centering} - -% \def\prepareleqalignno -% {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% -% \!!toksb{&\nextineqalign\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% -% \!!toksc{\hfil\tabskip\centering&\kern-\displaywidth\rlap{\span\textineqalign{##}}\tabskip\displaywidth}% -% \buildeqalign -% \presetdisplaymath -% \tabskip\centering} - \def\preparereqalignno {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% \!!toksb{&\nextineqalign\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% @@ -1759,17 +1672,6 @@ \halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA {\the\scratchtoks\crcr#2\crcr}% \finishalignno} -% \def\dobothaligneqalignno#1% -% {\ifmmode -% \displ@y % \let\doplaceformulanumber\relax % strange hack -% \vcenter\bgroup -% \def\finishalignno{\crcr\egroup\egroup}% -% \else -% \def\finishalignno{\crcr\egroup}% -% \fi -% #1% -% \halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA \bgroup\the\scratchtoks\crcr} - \def\mrlap#1% {\setbox\scratchbox\hbox{#1}% \ifdim\wd\scratchbox>\mathnumbercorrection @@ -1852,13 +1754,6 @@ \def\dodoalignNC {\gdef\doalignNC##1{&##1}} -% \def\doalignNR[#1][#2]% -% {\doifsomething{#1} -% {\doifelse{#1}{+} -% {\doformulanumber[][#2][]{}} -% {\doformulanumber[#1][#2][]{}}}% -% \crcr} - \def\doalignNR[#1][#2]% {\donestedformulanumber{#1}{#2}\crcr} @@ -1909,13 +1804,6 @@ \definemathalignment[align] % default case (this is what amstex users expect) \definemathalignment[\v!mathalignment] % prefered case (this is cleaner, less clashing) -% \def\startsplit -% {\startalign[*]} % no number by default -% -% \def\stopsplit -% {&\doalignNR[+][]\crcr % for a number on last line -% \stopalign} - %D \startbuffer %D \placeformula \startformula \eqalignno { %D a &= b & \formulanumber \cr @@ -2283,22 +2171,86 @@ \def\dodomatrixNC {\gdef\domatrixNC{\endmath&}} +\def\installmathmatrixhandler#1#2% + {\setvalue{\??mx:#1}{#2}} + +% First alternative: +% +% \def\processlowhighmathmatrix#1% +% {\def\mathmatrixleft +% {\setbox\nextbox} +% \def\mathmatrixright +% {#1.5\dimexpr\nextboxdp-\nextboxht\relax +% \hbox{$\mathmatrixparameter\c!left +% \vcenter{\unvbox\nextbox}% +% \mathmatrixparameter\c!right$}}% +% \let\mathmatrixbox\vbox} +% +% \installmathmatrixhandler\v!high {\processlowhighmathmatrix\raise} +% \installmathmatrixhandler\v!low {\processlowhighmathmatrix\lower} +% +% \installmathmatrixhandler\v!top {\processlowhighmathmatrix\raise} +% \installmathmatrixhandler\v!bottom{\processlowhighmathmatrix\lower} +% +% \installmathmatrixhandler\v!lohi +% {\def\mathmatrixleft {\mathmatrixparameter\c!left}% +% \def\mathmatrixright{\mathmatrixparameter\c!right}% +% \let\mathmatrixbox\vcenter} +% +% An alternative +% +% \let\mathmatrixleft \empty +% \let\mathmatrixright\empty +% +% \def\processlowhighmathmatrix#1% +% {\dowithnextbox +% {#1.5\dimexpr\nextboxdp-\nextboxht\relax +% \hbox{$\mathmatrixparameter\c!left +% \vcenter{\unvbox\nextbox}% +% \mathmatrixparameter\c!right$}}% +% \vbox} +% +% \def\processlohimathmatrix +% {\dowithnextbox +% {\mathmatrixparameter\c!left +% \vcenter{\unvbox\nextbox}% +% \mathmatrixparameter\c!right}% +% \vbox} +% +% \installmathmatrixhandler\v!high {\def\mathmatrixbox{\processlowhighmathmatrix\raise}} +% \installmathmatrixhandler\v!low {\def\mathmatrixbox{\processlowhighmathmatrix\lower}} +% \installmathmatrixhandler\v!top {\def\mathmatrixbox{\processlowhighmathmatrix\raise}} +% \installmathmatrixhandler\v!bottom{\def\mathmatrixbox{\processlowhighmathmatrix\lower}} +% \installmathmatrixhandler\v!lohi {\let\mathmatrixbox \processlohimathmatrix} +% +% Final version + +\let\mathmatrixleft \empty % experimental hook +\let\mathmatrixright\empty % experimental hook + +\def\processlowhighmathmatrix#1#2% + {\dowithnextbox + {\scratchdimen\dimexpr(\nextboxdp-\nextboxht)/2 \ifcase#2\or+\mathaxisheight\textfont2\fi\relax + \ifcase#1\relax\or\lower\scratchdimen\or\or\raise\scratchdimen\fi + \hbox{$\mathmatrixparameter\c!left + \vcenter{\unvbox\nextbox}% + \mathmatrixparameter\c!right$}}% + \vbox} + +\installmathmatrixhandler\v!top {\def\mathmatrixbox{\processlowhighmathmatrix\plusthree\plusone }} +\installmathmatrixhandler\v!high {\def\mathmatrixbox{\processlowhighmathmatrix\plusthree\zerocount}} +\installmathmatrixhandler\v!lohi {\def\mathmatrixbox{\processlowhighmathmatrix\plustwo \zerocount}} +\installmathmatrixhandler\v!low {\def\mathmatrixbox{\processlowhighmathmatrix\plusone \zerocount}} +\installmathmatrixhandler\v!bottom{\def\mathmatrixbox{\processlowhighmathmatrix\plusone \plusone }} + \def\dostartmathmatrix[#1][#2]% {\begingroup \edef\currentmathmatrix{#1}% \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing \null - \mathmatrixparameter\c!left - \processaction - [\mathmatrixparameter\c!location] - [ \v!high=>\let\vchbox\vtop, - \v!low=>\let\vchbox\vbox, - \v!lohi=>\let\vchbox\vcenter, - \v!top=>\let\vchbox\vtop, - \v!bottom=>\let\vchbox\vbox, - \s!default=>\let\vchbox\vcenter, - \s!unknown=>\let\vchbox\vcenter]% - \vchbox\bgroup + \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}% + \mathmatrixleft + \mathmatrixbox\bgroup \pushmacro\domatrixNC \let\endmath\relax \def\NC{\domatrixNC}% @@ -2322,7 +2274,7 @@ \egroup \popmacro\domatrixNC \egroup - \mathmatrixparameter\c!right + \mathmatrixright \endgroup} %D \startbuffer @@ -2401,6 +2353,56 @@ %D %D \typebuffer \getbuffer +%D \macros +%D {startmatrices} +%D +%D Just a handy keystroke safer: + +\def\startmatrices + {\begingroup + \setupmathmatrix} + +\def\stopmatrices + {\endgroup} + +%D \startbuffer +%D \startformula +%D \startmatrix[left={\left(},right={\right)}] +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D = +%D \startmatrix[left={\left(},right={\right)},location=low] +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D = +%D \startmatrix[left={\left(},right={\right)},location=high] +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D \stopformula +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D \startbuffer +%D \startformula +%D \startmatrices[left={\left(},right={\right)}] +%D \startmatrix +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D = +%D \startmatrix[location=bottom] +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D = +%D \startmatrix[location=top] +%D \NC A \NC B \NR \NC C \NC D \NR +%D \stopmatrix +%D \stopmatrices +%D \stopformula +%D \stopbuffer +%D +%D \typebuffer \getbuffer + %D \macros %D {startintertext} %D @@ -2408,15 +2410,6 @@ %D %D {\em example code} -% \def\startintertext#1\stopintertext -% {\noalign{\dointertext{#1}}\NR} - -% \unexpanded\def\dointertext#1% -% {\penalty\postdisplaypenalty -% \afterdisplayspace % the matching \before... is not needed -% \vbox{\forgetall\noindent#1\par}% -% \penalty\postdisplaypenalty} - \def\startintertext#1\stopintertext {\noalign{\dointertext{#1}}} diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index 0b1032436..e47c69be1 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -84,6 +84,7 @@ \appendtoks \def\ { }\to\simplifiedcommands \appendtoks \def\type#1{\string\\\strippedcsname#1}\to\simplifiedcommands +\appendtoks \def\tex#1{\string\\#1}\to\simplifiedcommands \appendtoks \def\TeX{TeX}\to\simplifiedcommands \appendtoks \def\ConTeXt{ConTeXt}\to\simplifiedcommands \appendtoks \def\MetaPost{MetaPost}\to\simplifiedcommands @@ -109,7 +110,7 @@ {\scratchdimen#1% \divide\scratchdimen \nofitems \!!counta\zerocount - \def\docommando##1% + \def\docommand##1% {\advance\!!counta \plusone \processaction [\@@isalign] @@ -125,7 +126,7 @@ \def\veritems#1#2% #1=breedte #2=commandos {\scratchdimen#1% - \def\docommando##1% + \def\docommand##1% {\ifdim\scratchdimen<\zeropoint % the - was a signal \hbox to -\scratchdimen{\hss\strut##1}% \else\ifdim\scratchdimen>\zeropoint @@ -151,11 +152,11 @@ {\edef\nofitems{\@@isn}}% \setbox0\hbox {\doitems \@@iswidth - {\processcommalist[#1]\docommando}}% + {\processcommalist[#1]\docommand}}% \setbox2\hbox {\doitems \@@isbulletbreedte {\dorecurse\nofitems - {\docommando{\strut\doitembullet\recurselevel}}}}} + {\docommand{\strut\doitembullet\recurselevel}}}}} \def\dostartitems#1#2#3% {\let\doitems#2% @@ -298,9 +299,9 @@ % {\getparameters[\??al#1\recurselevel][#3]}} % {\ConvertToConstant\doifelse{#3}{} % {\getparameters[\??al#1][#2]} -% {\def\docommando##1% +% {\def\docommand##1% % {\getparameters[\??al#1##1][#3]}% -% \processcommalist[#2]\docommando}}} +% \processcommalist[#2]\docommand}}} % % \def\setupparagraphs % {\dotripleempty\dosetupparagraphs} @@ -689,16 +690,16 @@ \def\setsubscripts {\beginlatexmathmodehack \def\dosetsubscript##1##2##3% - {\dimen0=##3\fontdimen5##2% + {\dimen0=##3\fontexheight##2% \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}{\scriptscriptfont2}{##2}}% - %\dodosetsubscript{\fontdimen14}{?}% - \dodosetsubscript{\fontdimen16}{.7}% - \dodosetsubscript{\fontdimen17}{.7}% + %dodosetsubscript\mathsupnormal {?}% + \dodosetsubscript\mathsubnormal {.7}% + \dodosetsubscript\mathsubcombined{.7}% \global\loweredsubscriptstrue \endlatexmathmodehack} @@ -712,9 +713,9 @@ {\doresetsubscript{##1}{\textfont2}% \doresetsubscript{##1}{\scriptfont2}% \doresetsubscript{##1}{\scriptscriptfont2}}% - %\dodoresetsubscript{\fontdimen14}% - \dodoresetsubscript{\fontdimen16}% - \dodoresetsubscript{\fontdimen17}% + %dodoresetsubscript\mathsupnormal + \dodoresetsubscript\mathsubnormal + \dodoresetsubscript\mathsubcombined \global\loweredsubscriptsfalse \endlatexmathmodehack \fi} @@ -743,7 +744,7 @@ \unexpanded\def\bedrag#1% {\strut\hbox\bgroup - \let\normalfixedspace~% + \let\normalfixedspace\nonbreakablespace \doifelsenothing{#1} {\bedragempty} {\bedragprefix\digits{#1}\bedragsuffix}% @@ -839,11 +840,7 @@ \setuphyphenmark [\c!sign=\composedhyphen] -\installdiscretionaries || \@@kpsign - -% will become: -% -% \installdiscretionaries || \composedhyphen +\def\defaultdiscretionaryhyphen{\@@kpsign} \def\composedhyphen {\discretionary @@ -994,100 +991,6 @@ [\c!middlespeech] [\leftboundarycharacter\c!middlespeech{speech}] -% has been replaced by delimitedtext -% -% \def\leftquotationmark -% {\setbox\scratchbox\hbox{\symbol[\c!leftquotation]}% -% \doif\@@cilocation\v!margin{\hskip-\wd\scratchbox}% -% \box\scratchbox} -% -% \def\rightquotationmark -% {\hsmash{\symbol[\c!rightquotation]}} -% -% \newsignal\quotationsignal -% -% \def\setupquote -% {\dodoubleargument\getparameters[\??ci]} -% -% \def\startquotation -% {\bgroup\dosingleempty\dostartquotation} -% -% \def\dostartquotation[#1]% -% {\@@cibefore -% \doifelsenothing{#1} -% {\let\dostopquotation\relax} -% {\startnarrower[#1]% -% \let\dostopquotation\stopnarrower}% -% \dostartattributes\??ci\c!style\c!color\empty -% \leftquotationmark -% \ignorespaces} -% -% \def\stopquotation -% {\removeunwantedspaces -% \removelastskip -% \rightquotationmark -% \dostopattributes -% \dostopquotation -% \@@ciafter -% \egroup} -% -% \def\dohandlequotation#1#2% -% {\ifdim\lastskip=\quotationsignal -% \unskip\hskip\hspaceamount\currentlanguage{interquotation}% hardcoded -% \else -% #2% -% \fi -% \ifhmode % else funny pagebeaks -% \penalty\!!tenthousand\hskip\zeropoint % == \prewordbreak -% \fi -% \strut % new, needed below -% \symbol[#1]% -% \penalty\!!tenthousand\hskip\quotationsignal} % +- \prewordbreak -% -% \def\handlequotation#1% -% {\dohandlequotation{#1}\relax} -% -% \unexpanded\def\quotation -% {\groupedcommand -% {\dohandlequotation\c!leftquotation \relax} -% {\dohandlequotation\c!rightquotation\removelastskip}} -% -% \unexpanded\def\quote -% {\doifelse\@@cistyle\v!normal\doquotedcite\doattributedcite} -% -% \def\doquotedcite -% {\groupedcommand -% {\dohandlequotation\c!leftquote \relax} -% {\dohandlequotation\c!rightquote\removelastskip}} -% -% \def\doattributedcite -% {\groupedcommand -% {\dostartattributes\??ci\c!style\c!color} -% {\dostopattributes}} - -%D The previous one fails in \placefloat[left]{}{}, so instead -%D we use the next alternative, where the first one is handled -%D outside group. Watch the strut. - -% has been replaced by delimitedtext -% -% \unexpanded\def\quotation -% {\dohandlequotation\c!leftquotation\relax -% \groupedcommand \donothing -% {\dohandlequotation\c!rightquotation\removelastskip}} -% -% \def\doquotedcite -% {\dohandlequotation\c!leftquote\relax -% \groupedcommand \donothing -% {\dohandlequotation\c!rightquote\removelastskip}} -% -% \setupquote -% [\c!location=\v!margin, -% \c!style=\v!normal, -% \c!color=, -% \c!before=\startnarrower, -% \c!after=\stopnarrower] - \appendtoks\def\quotation#1{"#1"}\to\simplifiedcommands \appendtoks\def\quote #1{'#1'}\to\simplifiedcommands @@ -1098,50 +1001,17 @@ %D feature could be build on top of it. The speech opening and %D closing symbols are defined per language. Italian is an %D example of a language that has them set. - -% has been be replaced by delimitedtext -% -% \newcounter\speechlevel \newconditional\insidespeech -% -% \def\startspeech -% {\doglobal\increment\speechlevel\relax -% \dohandlequotation\c!leftspeech\relax -% \global\settrue\insidespeech -% \ignorespaces} -% -% \def\stopspeech -% {\dohandlequotation\c!rightspeech\removelastskip -% \doglobal\decrement\speechlevel\relax -% \ifcase\speechlevel\relax \global\setfalse\insidespeech \fi} -% -% \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} -% -% \unexpanded\def\speech -% {\doglobal\increment\speechlevel\relax -% \dohandlequotation\c!leftspeech\relax -% \groupedcommand \ignorespaces -% {\dohandlequotation\c!rightspeech\removelastskip -% \doglobal\decrement\speechlevel\relax}} - -% \appendtoks \dohandlespeech \to \everypar % this will replace the quotation and speed definitions \newsignal\delimitedtextsignal -\def\delimitedtextparameter#1% - {\csname\??ci - \ifundefined{\??ci\currentdelimitedtext#1}\else\currentdelimitedtext\fi - #1\endcsname} +\let\currentdelimitedtext\s!unknown + +\def\delimitedtextparameter#1% will be sped up + {\executeifdefined{\??ci\currentdelimitedtext:\csname\??ci\currentdelimitedtext\c!level\endcsname#1}% + {\executeifdefined{\??ci\currentdelimitedtext#1}% + {\executeifdefined{\??ci#1}\empty}}} \def\definedelimitedtext {\dodoubleempty\dodefinedelimitedtext} @@ -1174,17 +1044,19 @@ \doifsomething{#1} {\unexpanded\setvalue{#1}{\delimitedtext[#1]}% \setvalue{\e!start#1}{\startdelimitedtext[#1]}% - \setvalue{\e!stop#1}{\stopdelimitedtext}}} + \setvalue{\e!stop #1}{\stopdelimitedtext}}} \def\setupdelimitedtext - {\dodoubleargument\dosetupdelimitedtext} + {\dotripleargument\dosetupdelimitedtext} -\def\dosetupdelimitedtext[#1][#2]% - {\ifsecondargument +\def\dosetupdelimitedtext[#1][#2][#3]% #2 = optional level + {\ifthirdargument + \getparameters[\??ci#1:#2][#3]% + \else\ifsecondargument \getparameters[\??ci#1][#2]% \else \getparameters[\??ci][#1]% - \fi} + \fi\fi} \def\dorepeatdelimitedtext {\relax\ifcase\delimitedtextparameter\c!level\else @@ -1195,10 +1067,10 @@ \def\startdelimitedtext[#1]% {\bgroup - \def\currentdelimitedtext{#1}% + \pushdelimitedtext{#1}% \doifelse{\delimitedtextparameter\c!method}\s!font - {\doglobal\decrementvalue{\??ci\currentdelimitedtext\c!level}% - \def\dostopdelimitedtext{\removeunwantedspaces\ignoredelimitedtext\c!right}% + {\def\dostopdelimitedtext + {\removeunwantedspaces\ignoredelimitedtext\c!right}% \ignoredelimitedtext\c!left\ignorespaces} {\doifelse{\delimitedtextparameter\c!repeat}\v!yes {\let\dohandlerepeatdelimitedtext\dorepeatdelimitedtext}% @@ -1225,7 +1097,6 @@ \dochecknextindentation{\??ci\currentdelimitedtext}% \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty \leftdelimitedtextmark - \doglobal\incrementvalue{\??ci\currentdelimitedtext\c!level}% \ignorespaces} \def\dostopdelimitedtextpar @@ -1251,12 +1122,20 @@ \def\stopdelimitedtext {\dostopdelimitedtext - \doglobal\decrementvalue{\??ci\currentdelimitedtext\c!level}% + \popdelimitedtext \egroup} -\def\delimitedtext[#1]% +\def\pushdelimitedtext#1% {\pushmacro\currentdelimitedtext \def\currentdelimitedtext{#1}% + \doglobal\incrementvalue{\??ci\currentdelimitedtext\c!level}} + +\def\popdelimitedtext + {\doglobal\decrementvalue{\??ci\currentdelimitedtext\c!level}% + \popmacro\currentdelimitedtext} + +\def\delimitedtext[#1]% + {\pushdelimitedtext{#1}% \doifelse{\delimitedtextparameter\c!method}\s!font {\dofontdrivendelimited} {\doifinsetelse{\delimitedtextparameter\c!location}{\v!paragraph,\v!margin}% @@ -1305,7 +1184,8 @@ {\dohandledelimitedtext\c!left\relax \groupedcommand \donothing - {\dohandledelimitedtext\c!right\removelastskip}} + {\dohandledelimitedtext\c!right\removelastskip + \popdelimitedtext}} \unexpanded\def\dodelimitedtexttxt {\doifelse{\delimitedtextparameter\c!style}\v!normal @@ -1317,25 +1197,29 @@ \donothing {\dohandledelimitedtext\c!right \removelastskip - \popmacro\currentdelimitedtext}} + \popdelimitedtext}} \def\doattributeddelimited {\groupedcommand {\dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color} {\dostopattributes - \popmacro\currentdelimitedtext}} - -% \def\dofontdrivendelimited#1% thanks to Taco for sorting out the kerning interference -% {\languageparameter{\c!left\currentdelimitedtext}% -% #1% sorry, no verbatim support -% \languageparameter{\c!right\currentdelimitedtext}% -% \popmacro\currentdelimitedtext} + \popdelimitedtext}} \def\dofontdrivendelimited {\simplegroupedcommand {\languageparameter{\c!left\currentdelimitedtext}} {\languageparameter{\c!right\currentdelimitedtext}% - \popmacro\currentdelimitedtext}} + \popdelimitedtext}} + +% testcase for nesting: +% +% \quotation{... \quotation{...} ...} +% \startquotation ... \startquotation... \quotation{...} \stopquotation\space ...\stopquotation +% \setupdelimitedtext[quotation][1][left=(,right=)] +% \setupdelimitedtext[quotation][2][left={[},right={]}] +% \setupdelimitedtext[quotation][3][left=\{,right=\}] +% \quotation{... \quotation{...} ...} +% \startquotation ... \startquotation... \quotation{...} \stopquotation\space ...\stopquotation \definedelimitedtext [\v!quotation] @@ -1377,6 +1261,8 @@ % seldom used, move from kernel to run time module +\ifx\tfx\undefined \let\tfx\relax \fi + \def\basegrid {\dosingleempty\dobasegrid} @@ -2053,6 +1939,8 @@ \global\resetsystemmode{pairedbox}% \to \everyinsidefloat +% todo: \startcombination \startcomb \stopcomb ... + \newcount\horcombination % counter \newcount\totcombination @@ -2085,6 +1973,11 @@ {\bgroup % so we can grab a group \dodoubleempty\dostartcombination} +% \startcombination {alpha} {a} {beta} {b} \stopcombination +% \startcombination[2*1] {alpha} {a} {beta} {b} \stopcombination +% \startcombination[1*2] {alpha} {a} {beta} {b} \stopcombination +% \startcombination[2] {alpha} {a} {beta} {b} \stopcombination + \def\dostartcombination[#1][#2]% {\global\setsystemmode{combination}% \doifnothing{#1}\firstargumentfalse % to be sure (when called in macros) @@ -2092,12 +1985,15 @@ \ifsecondargument \def\currentcombination{#1}% \edef\currentcombinationspec{#2*1*}% - \else - \doifinstringelse{*}{#1} + \else % better : \doifcombinationelse ... \??co#1\c!location + \doifinstringelse{*}{#1} {\let\currentcombination\empty \edef\currentcombinationspec{#1*1*}} - {\def\currentcombination{#1}% - \edef\currentcombinationspec{2*1*}}% + {\doifnumberelse{#1} + {\let\currentcombination\empty + \edef\currentcombinationspec{#1*1*}} + {\def\currentcombination{#1}% + \edef\currentcombinationspec{2*1*}}}% \fi \forgetall \doifelse{\combinationparameter\c!height}\v!fit @@ -2118,9 +2014,9 @@ {\halign}{\halign to \combinationparameter\c!width}% \bgroup&% %\hfil##\hfil% now : location={left,top} - \ExpandBothAfter\doifnotinset\v!left{\combinationparameter\c!location}\hfil + \expanded{\doifnotinset{\v!left}{\combinationparameter\c!location}}\hfil ##% - \ExpandBothAfter\doifnotinset\v!right{\combinationparameter\c!location}\hfil + \expanded{\doifnotinset{\v!right}{\combinationparameter\c!location}}\hfil &\tabskip\zeropoint \!!plus 1fill##\cr \docombination} @@ -2246,8 +2142,7 @@ {\vbox {\forgetall % \setupwhitespace[\v!none]% \let\next\vbox - \ExpandFirstAfter\processallactionsinset - [\combinationparameter\c!location] + \expanded{\processallactionsinset[\combinationparameter\c!location]} [ \v!top=>\let\next\depthonlybox, % \tbox, \v!middle=>\let\next\halfwaybox]% \next{\copy0}% @@ -2383,23 +2278,7 @@ \resetlocalfloats \egroup}} -% does not work -% -% \def\plaatsondernaastelkaar#1#2% -% {\bgroup -% \def\doplaatsondernaastelkaar% -% {#2\cr\omit\bgroup#2% -% \aftergroup#2% -% \aftergroup\cr -% \aftergroup\egroup -% \aftergroup\egroup -% \let\next=}% -% #1\bgroup##\cr -% \omit\bgroup#2% -% \aftergroup\doplaatsondernaastelkaar -% \let\next=} - -\def\plaatsondernaastelkaar#1#2% +\def\placerelativetoeachother#1#2% {\bgroup \dowithnextbox {\bgroup @@ -2412,12 +2291,11 @@ \hbox} \hbox} -\def\placeontopofeachother - {\plaatsondernaastelkaar\halign\hss} - -\def\placesidebyside - {\plaatsondernaastelkaar\valign\vss} +\def\placeontopofeachother{\placerelativetoeachother\halign\hss} +\def\placesidebyside {\placerelativetoeachother\valign\vss} +% this will be replaced or go away, never used + \def\douseexternalfiles[#1][#2]% {\getparameters [\??fi#1] @@ -2479,83 +2357,6 @@ %D %D \typebuffer \getbuffer -% \presetlocalframed[\??ro] -% -% \def\setuprotate -% {\dodoubleargument\getparameters[\??ro]} -% -% \def\dorotatebox#1% {angle} \hbox/\vbox/\vtop -% {\bgroup -% \hbox\bgroup % compatibility hack -% \dowithnextbox -% {\edef\@@rorotation{#1}% -% \setbox\nextbox\vbox{\flushnextbox}% -% \dostoprotate -% \egroup}} -% -% \def\dodostoprotate#1#2#3#4#5#6% -% {\dontshowcomposition -% \scratchdimen\nextboxht\advance\scratchdimen\nextboxdp -% \doif\@@rolocation\v!high -% {\setbox\nextbox\vbox{\hbox{\raise\nextboxdp\flushnextbox}}}% -% \setbox\nextbox\vbox to #1 -% {#2\relax -% \hbox to #4 -% {#5\relax % \number removes leading spaces too -% \edef\@@rorotation{\number\@@rorotation}% -% \doifelsenothing\@@rorotation -% {\dostartrotation{90}} -% {\dostartrotation{\@@rorotation}}% -% \nextboxwd\zeropoint -% \nextboxht\zeropoint -% %\nextboxdp\zeropoint -% \flushnextbox -% \dostoprotation -% #6} -% #3}% -% \nextboxdp\zeropoint -% \flushnextbox -% \egroup} -% -% \def\dostoprotate -% {\!!counta\@@rorotation -% \divide\!!counta 90 -% \ifcase\!!counta -% \dodostoprotate\nextboxht\relax\vfill\nextboxwd\relax\hfill -% \or -% %\dodostoprotate\nextboxwd\vfill\relax\nextboxht\relax\hfill -% \dodostoprotate\nextboxwd\vfill\relax\scratchdimen\relax\hfill -% \or -% \dodostoprotate\nextboxht\vfill\relax\nextboxwd\hfill\relax -% \or -% %\dodostoprotate\nextboxwd\relax\vfill\nextboxht\hfill\relax -% \dodostoprotate\nextboxwd\relax\vfill\scratchdimen\hfill\relax -% \or -% \dodostoprotate\nextboxht\relax\vfill\nextboxwd\relax\hfill -% \else -% \def\@@rotation{90}% -% \dodostoprotate\nextboxht\relax\vfill\nextboxwd\relax\hfill -% \fi} -% -% \def\complexrotate[#1]% -% {\dowithnextbox -% {\getparameters[\??ro][#1]% -% \dostoprotate}% -% \vbox\localframed[\??ro][#1]} -% -% \unexpanded\def\rotate % \bgroup: \rotate kan argument zijn -% {\bgroup\complexorsimpleempty\rotate} -% -% \setuprotate -% [\c!rotation=90, -% \c!width=\v!fit, -% \c!height=\v!fit, -% \c!offset=\v!overlay, -% \c!frame=\v!off] - -% The previous implementation is replaced by one that supports -% rotation over arbitrary angles. -% % When we rotate over arbitrary angles, we need to relocate the % resulting box because rotation brings that box onto the negative % axis. The calculations (mostly sin and cosine) need to be tuned for @@ -2768,97 +2569,6 @@ % \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=high] {\ruledhbox{\bfb (high)}}}}} % \stoplinecorrection} -% scale - -\def\doscalelikeafigure % quite dirty and potential interference possible - {\doifsomething{\@@xyscale\@@xyxscale\@@xyyscale - \@@xyfactor\@@xyhfactor\@@xywfactor - \@@xywidth\@@xyheight\@@xylines} - {\let \@@efscale \@@xyscale - \let \@@efxscale \@@xyxscale - \let \@@efyscale \@@xyyscale - \let \@@effactor \@@xyfactor - \let \@@efwfactor\@@xywfactor - \let \@@efhfactor\@@xyhfactor - \let \@@efwidth \@@xywidth - \let \@@efheight \@@xyheight - \let \@@eflines \@@xylines - \let \@@efgrid \@@xygrid - \let \@@epx \!!zeropoint - \let \@@epy \!!zeropoint - \edef\@@epw {\the\nextboxwd}% - \edef\@@eph {\the\nextboxht}% - \figwid\zeropoint \figxsca\plusone % see note * (core-fig) - \fighei\zeropoint \figysca\plusone % see note * (core-fig) - \checkfiguresettings - \setfactorfiguresize - \setscalefiguresize - \setdimensionfiguresize - \convertfigureinsertscale\@@epx\figx\figxsca\scax - \convertfigureinsertscale\@@epy\figy\figysca\scay - \scratchdimen\scax\points \divide\scratchdimen \plushundred - \edef\@@xysx{\withoutpt\the\scratchdimen}% - \scratchdimen\scay\points \divide\scratchdimen \plushundred - \edef\@@xysy{\withoutpt\the\scratchdimen}}} - -\def\doscale[#1]% todo: xscale/yscale - {\bgroup - \forgetall - \getparameters - [\??xy] - [\c!scale=,\c!xscale=,\c!yscale=,\c!width=,\c!height=,\c!lines=, - \c!factor=,\c!hfactor=,\c!wfactor=,\c!grid=, - \c!sx=1,\c!sy=1,#1]% - \dowithnextbox - {\dontshowcomposition - \ifdim\nextboxht>\zeropoint \ifdim\nextboxwd>\zeropoint - \doscalelikeafigure - \dimen0=\@@xysy\nextboxht - \dimen2=\@@xysy\nextboxdp - \dimen4=\@@xysx\nextboxwd - \dimen6=\dimen0\advance\dimen6 \dimen2 -% \setbox\nextbox\vbox to \dimen6 -% {\nextboxht\zeropoint -% \nextboxdp\zeropoint -% \vfill % erbij -% \dostartscaling\@@xysx\@@xysy\flushnextbox\dostopscaling}% - \setbox\nextbox\hbox - {\smashbox\nextbox - \dostartscaling\@@xysx\@@xysy\flushnextbox\dostopscaling}% - \nextboxht\dimen0 - \nextboxdp\dimen2 - \nextboxwd\dimen4 - \fi \fi - \flushnextbox - \egroup} - \hbox} - -\def\scale - {\dosingleempty\doscale} - -% mirror - -\def\domirrorbox % \hbox/\vbox/\vtop - {\bgroup - \dowithnextbox - {\dontshowcomposition - \scratchdimen\nextboxwd - % better use an hbox (if no \forgetall, leftskip etc may creep in) - %\setbox\nextbox\vbox{\forgetall\dostartmirroring\hskip-\nextboxwd\flushnextbox\dostopmirroring}% - \setbox\nextbox\hbox{\dostartmirroring\hskip-\nextboxwd\flushnextbox\dostopmirroring}% - \nextboxwd\scratchdimen - \flushnextbox - \egroup}} - -\def\mirror - {\domirrorbox\hbox} - -%\setbox0=\hbox{gans} -% -%\ruledhbox{\copy0 \schaal[sx=2,sy=2]{\copy0}} -% -%\spiegel{\ruledhbox{\copy0 \schaal{\box0}}} - % to be used in some other places! todo! % % divides \hsize in fractions, will be made a bit more @@ -2995,7 +2705,7 @@ \else \let\serializedcommalist\empty \scratchcounter\zerocount - \def\docommando##1% + \def\docommand##1% {\advance\scratchcounter \plusone \ifnum\scratchcounter=\plusone \scratchtoks{\handlecommalistsentence{##1}}% @@ -3006,7 +2716,7 @@ \appendtoks\labeltext{and-1}\handlecommalistsentence{##1}\to\scratchtoks \fi \fi}% - \processcommacommand[#1]\docommando + \processcommacommand[#1]\docommand \edef\serializedcommalist{\the\scratchtoks}% \fi \serializedcommalist @@ -3018,4 +2728,45 @@ \setuplabeltext [\s!en] [and-1=\textcomma\ , and-2=\textcomma\ and ] \setuplabeltext [\s!de] [and-1=\textcomma\ , and-2= und ] +%D \macros +%D {\somekindoftab} +%D +%D This macro can be used to create tabs: +%D +%D \starttyping +%D \setupheadertexts[{\somekindoftab[alternative=horizontal]{\framed{\realfolio}}}] +%D \setuptexttexts [{\somekindoftab[alternative=vertical] {\framed{\realfolio}}}] +%D +%D \starttext +%D \showframe \dorecurse{10}{test\page} +%D \stoptext +%D \stoptyping + +\def\somekindoftab + {\dosingleempty\dosomekindoftab} + +\def\dosomekindoftab[#1]% + {\bgroup + \getparameters[xx] + [\c!alternative=\v!vertical, + \c!width=\textwidth,\c!height=\textheight, + \c!n=\lastpage,\c!m=\realpageno, + #1]% + \doifelse\xxalternative\v!vertical + {\dodosomekindoftab\vbox\vskip\xxheight} + {\dodosomekindoftab\hbox\hskip\xxwidth }} + +\def\dodosomekindoftab#1#2#3#4% + {#1 to #3 \bgroup + \forgetall + \ifnum\xxm>\plusone + #2\zeropoint \!!plus \the\numexpr\xxm -1\relax fill\relax + \fi + #4% + \ifnum\xxm<\xxn\relax + #2\zeropoint \!!plus \the\numexpr\xxn-\xxm\relax fill\relax + \fi + \egroup + \egroup} + \protect \endinput diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex index a55022d77..2457d735c 100644 --- a/tex/context/base/core-nav.tex +++ b/tex/context/base/core-nav.tex @@ -176,7 +176,7 @@ \def\flushdriverresources {\ifvoid\driverresources\else\box\driverresources\fi} -\def\dostartgoto\data#1\start#2\stop#3\dostopgoto +\def\dohandlegoto#1#2#3% {\ifsecondaryreference \bgroup\setbox0\hbox{#2#3}\egroup \else diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index d5de7d91a..35dfe4850 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -15,56 +15,13 @@ \unprotect -% \def\setups -% {\dosingleargument\dosetups} -% -% \def\dosetups[#1]% -% {\iffirstargument -% \def\next{\dodosetups{#1}}% -% \else -% \let\next\dodosetups -% \fi -% \next} -% -% \def\dodosetups#1% -% {\processcommalist[#1]\dododosetups} -% -% \def\dododosetups#1% -% {\getvalue{\??su#1}} -% -% \def\doifsetupselse#1% -% {\doifdefinedelse{\??su#1}} -% -% \long\@EA\def\csname\e!start\v!instellingen\endcsname#1 % -% {\bgroup -% \catcode`\^^M=\@@ignore -% \xdostartsetups{#1}} -% -% \expanded -% {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\v!instellingen\endcsname -% {\endgroup -% \long\noexpand\setvalue{\??su##1}{##2}}} -% -% \def\startsetups % for international purposes -% {\begingroup\doifnextcharelse[{\startsetupsA\stopsetups}{\startsetupsB\stopsetups}} -% -% \def\startlocalsetups % for nested purposes -% {\begingroup\doifnextcharelse[{\startsetupsA\stoplocalsetups}{\startsetupsB\stoplocalsetups}} -% -% \def\startsetupsA#1[#2]% -% {\catcode`\^^M=\@@ignore -% \dostartsetups#1{#2}} -% -% \def\startsetupsB#1#2 % space delimited -% {\startsetupsA#1[#2]}% -% -% \long\def\dostartsetups#1#2% watch out: not \grabuntil -% {\dograbuntil#1{\endgroup\long\setvalue{\??su#2}}} - % todo : \startsetups[name][XML] \setups[name][XML] % todo: \doglobal +\let\startsetups\relax % to please dep checker +\let\stopsetups \relax % to please dep checker + \expanded {\long\def\@EA\noexpand\csname\e!start\v!setups\endcsname {\begingroup\noexpand\doifnextcharelse[% @@ -86,8 +43,12 @@ \def\dosetupsB[#1]{\cleanuplabel{#1}\processcommacommand[\cleanlabel]\dosetups} % [..] \def\dosetupsC[#1]{\cleanuplabel{#1}\dosetups\cleanlabel} % [..] +% \def\dosetups#1% the grid option will be extended to other main modes +% {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1}{\csname\??su:#1\endcsname}\empty} + \def\dosetups#1% the grid option will be extended to other main modes - {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1}{\csname\??su:#1\endcsname}\empty} + {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1} + {\executeifdefined{\??su :#1}\empty}} \let\directsetup\dosetups @@ -144,22 +105,6 @@ % \ifundefined{\??su\ifgridsnapping\v!grid\fi:#1}#1\else\ifgridsnapping\v!grid\fi% % #1}} -% new -% -% \startnointerference -% all kind of code -% \stopnointerference - -\newbox\nointerferencebox - -\def\startnointerference - {\setbox\nointerferencebox\vbox - \bgroup} - -\def\stopnointerference - {\egroup - \setbox\nointerferencebox\box\voidb@x} - %D new and beta % \def\defineshortcut @@ -324,37 +269,5 @@ \def\doifnotenv {\doifnotvariable \s!environment} \def\env {\getvariable \s!environment} \def\envvar {\getvariabledefault\s!environment} - -\bgroup % some day this will go away - -% actually we should handle all discretionaries here - -\gdef\cleanedupcolon{:} \catcode`:=\@@active - -\gdef\cleanuplabel#1% - {\begingroup\let:\cleanedupcolon - \xdef\cleanlabel{#1}% - \endgroup} - -\gdef\cleanupprefixedlabel#1#2% - {\begingroup\let:\cleanedupcolon - \xdef\cleanprefix{#1}% - \xdef\cleanlabel {#2}% - \endgroup} - -\gdef\protectlabels - {\let:\cleanedupcolon} - -\global\def\blabelgroup {\begingroup \let:\cleanedupcolon} -\global\let\elabelgroup \endgroup - -\gdef\labelcsname - {\begingroup\let:\cleanedupcolon - \expandafter\endgroup\csname} - -\gdef\labelvalue#1% - {\labelcsname#1\endcsname} - -\egroup \protect \endinput diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex index 30f40012b..1d764e412 100644 --- a/tex/context/base/core-not.tex +++ b/tex/context/base/core-not.tex @@ -948,6 +948,11 @@ \fi \fi \fi \fi} +%D For old times sake: + +\def\flushfootnotes {\flushnotes} +\def\doflushfootnotes{\doflushnotes} + %D This is a nasty and new secondary footnote flusher. It %D can be hooked into \type {\everypar} like: %D diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index fae7c51d5..75c3b5540 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -110,7 +110,9 @@ \def\@@tblprefix{tbl:} \let\@@rawtblprefix\@@tblprefix -%D This should be done more efficient: +%D This should be done more efficient: soon + +% \let as well as \expandafter\edef's \def\settbltag#1#2#3{\setevalue{\@@tblprefix#1:#2:s}{#3}} % \number#3 \def\settblcol#1#2#3{\setevalue{\@@tblprefix#1:#2:c}{#3}} @@ -253,54 +255,85 @@ \let\setupTBLsection\relax +% \setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white] +% \setupTABLE [first][first][backgroundcorner=2,corner=10,frame=on] +% \setupTABLE [last] [first][backgroundcorner=4,corner=12,frame=on] + +% \setupTABLE [row] [each] [background=color,backgroundcolor=blue,frame=on,framecolor=white] +% \setupTABLE [first][2] [corner=8] +% \setupTABLE [last] [2] [corner=5] +% \setupTABLE [first][last] [corner=7] +% \setupTABLE [last] [last] [corner=6] + +% \startTEXpage +% \bTABLE[frame=off,align=middle] +% \bTR \bTD one \eTD \bTD two \eTD \bTD three \eTD \eTR +% \bTR \bTD first \eTD \bTD second \eTD \bTD third \eTD \eTR +% \bTR \bTD alpha \eTD \bTD beta \eTD \bTD gamma \eTD \eTR +% \eTABLE +% \stopTEXpage + \def\setupTBLcell#1#2% cell over col over row {\setupTBLsection % already forgotten \edef\positiverow{\number#1}% \edef\positivecol{\number#2}% - \scratchcounter-\maximumrow\advance\scratchcounter#1\advance\scratchcounter\minusone - \edef\negativerow{\number\scratchcounter}% - \scratchcounter-\maximumcol\advance\scratchcounter#2\advance\scratchcounter\minusone - \edef\negativecol{\number\scratchcounter}% - \getvalue{\@@tblprefix\v!each\v!each}% - \getvalue{\@@tblprefix\c!y\v!each}% - \getvalue{\@@tblprefix\c!x\v!each}% - \getvalue{\@@tblprefix\c!y\v!oddeven\positiverow}% - \getvalue{\@@tblprefix\c!x\v!oddeven\positivecol}% - \getvalue{\@@tblprefix\c!x\v!oddeven\positivecol\c!y\v!oddeven\positiverow}% + \edef\negativerow{\the\numexpr-\maximumrow+#1+\minusone\relax}% + \edef\negativecol{\the\numexpr-\maximumcol+#2+\minusone\relax}% + % each each + \csname\@@tblprefix\c!x\v!each\c!y\v!each\endcsname + \csname\@@tblprefix\c!y\v!each\endcsname + \csname\@@tblprefix\c!x\v!each\endcsname + % odd even + \csname\@@tblprefix\c!y\v!oddeven\positiverow\endcsname + \csname\@@tblprefix\c!x\v!oddeven\positivecol\endcsname + \csname\@@tblprefix\c!x\v!oddeven\positivecol\c!y\v!oddeven\positiverow\endcsname + % row/col number combinations + \executeifdefined{\@@tblprefix\c!y\positiverow}\donothing + \executeifdefined{\@@tblprefix\c!y\negativerow}\donothing + \csname\@@tbl\@@tbl\c!extras\endcsname + \letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo + \executeifdefined{\@@tblprefix\c!x\positivecol}\donothing + \executeifdefined{\@@tblprefix\c!x\negativecol}\donothing + \csname\@@tbl\@@tbl\c!extras\endcsname + \letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo + % first/last combinations \ifnum\positiverow=\plusone - \getvalue{\@@tblprefix\c!y\v!first}% + \csname\@@tblprefix\c!y\v!first\endcsname \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\v!first}\donothing \fi \ifnum\positivecol=\plusone - \getvalue{\@@tblprefix\c!x\v!first}% + \csname\@@tblprefix\c!x\v!first\endcsname \executeifdefined{\@@tblprefix\c!x\v!first\c!y\positiverow}\donothing \fi \ifnum\positiverow=\maximumrow\relax - \getvalue{\@@tblprefix\c!y\v!last}% + \csname\@@tblprefix\c!y\v!last\endcsname \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\v!last}\donothing \fi \ifnum\positivecol=\maximumcol\relax - \getvalue{\@@tblprefix\c!x\v!last}% + \csname\@@tblprefix\c!x\v!last\endcsname \executeifdefined{\@@tblprefix\c!x\v!last\c!y\positiverow}\donothing \fi - \ifnum\positiverow=\maximumrow\relax\ifnum\positivecol=\maximumcol\relax - \getvalue{\@@tblprefix\c!x\v!last\c!y\v!last}% + \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\maximumcol\relax + \csname\@@tblprefix\c!x\v!last\c!y\v!last\endcsname \fi\fi \ifnum\positiverow=\plusone \ifnum\positivecol=\plusone - \getvalue{\@@tblprefix\c!x\v!first\c!y\v!first}% + \csname\@@tblprefix\c!x\v!first\c!y\v!first\endcsname \fi\fi + \ifnum\positiverow=\plusone \ifnum\positivecol=\maximumcol\relax + \csname\@@tblprefix\c!x\v!last\c!y\v!first\endcsname + \fi\fi + \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\plusone + \csname\@@tblprefix\c!x\v!first\c!y\v!last\endcsname + \fi\fi + % header things \ifnum#1>\noftblhdnxlines\else - \executeifdefined{\@@tblprefix\v!header\v!each}\donothing + \executeifdefined{\@@tblprefix\v!header\v!each }\donothing \executeifdefined{\@@tblprefix\v!header\positivecol}\donothing \fi - \executeifdefined{\@@tblprefix\c!y\positiverow}\donothing - \executeifdefined{\@@tblprefix\c!y\negativerow}\donothing - \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo - \executeifdefined{\@@tblprefix\c!x\positivecol}\donothing - \executeifdefined{\@@tblprefix\c!x\negativecol}\donothing - \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo + % explicit cells \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\positiverow}\donothing \executeifdefined{\@@tblprefix\c!x\negativecol\c!y\negativerow}\donothing + % done \global\letcscsname\@@tblsplitafter\csname\@@tbl\@@tbl\c!after\endcsname \relax} @@ -1488,8 +1521,6 @@ \doglobal\increment\currenttbl\relax \fi \doglobal\increment\TBLlevel\relax - \pushcharacteralign - \resetcharacteralign \ifnum\TBLlevel>\plusone \resetallTABLEparameters \globalpushmacro\colTBL @@ -1505,7 +1536,6 @@ \else \global\intablefalse \fi - \popcharacteralign \doglobal\decrement\TBLlevel\relax} % \bgroup diff --git a/tex/context/base/core-num.tex b/tex/context/base/core-num.tex index 2747ea5e7..442333acf 100644 --- a/tex/context/base/core-num.tex +++ b/tex/context/base/core-num.tex @@ -26,7 +26,7 @@ % \convertednumber[name] % getnumber % \savenumber[name] % \restorenumber[name] -% \convertednumner[name] +% \convertednumber[name] % \rawnumber[name] % private (defined in core-sec.tex) diff --git a/tex/context/base/core-obj.mkii b/tex/context/base/core-obj.mkii new file mode 100644 index 000000000..efc166555 --- /dev/null +++ b/tex/context/base/core-obj.mkii @@ -0,0 +1,74 @@ +%D \module +%D [ file=core-obj, +%D version=1998.01.15, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Object Handling, +%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 + +\def\checkobjectreferences + {\startnointerference + \protectlabels + \doutilities{objectreferences}\jobname\empty\relax\relax + \global\let\checkobjectreferences\relax + \stopnointerference} + +\def\setobjectreferences + {\def\objectreference##1##2##3##4% + {\ifundefined{\r!driver##1::##2}% + \setxvalue{\r!driver##1::##2}{{##3}{##4}}% + \else + \showmessage\m!references{31}{[##1 ##2=>##3/##4]}% + \fi}} + +\def\resetobjectreferences + {\let\objectreference\gobblefourarguments} + +\resetobjectreferences + +\def\mkregisterobjectreference#1#2#3% + {\checkobjectreferences + \blabelgroup + \expanded{\writeutilitycommand{\noexpand\objectreference{#1}{#2}{#3}{\noexpand\realfolio}}}% + \setxvalue{\r!driver#1::#2}{{#3}{\noexpand\realfolio}}% + \elabelgroup} + +\def\mkoverloadobjectreference#1#2#3% + {\checkobjectreferences + \blabelgroup + \setxvalue{\r!driver#1::#2}{{#3}{\noexpand\realfolio}}% + \elabelgroup} + +\def\dodogetobjectreference#1#2#3#4#5% + {\checkobjectreferences + \blabelgroup + \ifundefined{\r!driver#3::#4}% + \showmessage\m!references{30}{[#3 #4=>#3/#4]}% + \xdef#5{#2{#3}{#4}}% + \else + \xdef#5{\@EAEAEA#1\csname\r!driver#3::#4\endcsname}% + \fi + \elabelgroup} + +\def\mkgetobjectreference + {\dodogetobjectreference\firstoftwoarguments\defaultobjectreference} + +\def\mkgetobjectreferencepage + {\dodogetobjectreference\secondoftwoarguments\defaultobjectpage} + +\def\mkifobjectreferencefoundelse#1#2% + {\checkobjectreferences + \blabelgroup \ifcsname\r!driver#1::#2\endcsname + \elabelgroup \expandafter\firstoftwoarguments + \else + \elabelgroup \expandafter\secondoftwoarguments + \fi} + +\protect \endinput diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex index d9e51911c..8741c3968 100644 --- a/tex/context/base/core-obj.tex +++ b/tex/context/base/core-obj.tex @@ -271,63 +271,24 @@ \objectreferenced -\def\checkobjectreferences - {\startnointerference - \protectlabels - \doutilities{objectreferences}\jobname\empty\relax\relax - \global\let\checkobjectreferences\relax - \stopnointerference} - -\def\setobjectreferences - {\def\objectreference##1##2##3##4% - {\ifundefined{\r!driver##1::##2}% - \setxvalue{\r!driver##1::##2}{{##3}{##4}}% - \else - \showmessage\m!references{31}{[##1 ##2=>##3/##4]}% - \fi}} - -\def\resetobjectreferences - {\let\objectreference\gobblefourarguments} - -\resetobjectreferences - -\def\dosetobjectreference#1#2#3% - {\checkobjectreferences - \blabelgroup - \ifcase\crossreferenceobject +% no undefined test ! ! ! ! (pdftex fails on undefined objects) + +\def\dosetobjectreference + {\ifcase\crossreferenceobject \objectreferenced + \expandafter\mkoverloadobjectreference \else - \edef\dowritereference - {\writeutilitycommand{\objectreference{#1}{#2}{#3}{\noexpand\realfolio}}}% - \dowritereference - \fi - %\ifundefined{\r!driver#1::#2}% could have been be replaced ! - \setxvalue{\r!driver#1::#2}{{#3}{\noexpand\realfolio}}% - %\fi % so no test ! ! ! ! (pdftex fails on undefined objects) - \elabelgroup} + \expandafter\mkregisterobjectreference + \fi} \def\dosetdriverreference {\driverreferenced\dosetobjectreference} -\def\defaultobjectreference#1#2{0} +\def\defaultobjectreference#1#2{0} % driver dependent \def\defaultobjectpage #1#2{\realfolio} -\def\dodogetobjectreference#1#2#3#4#5% - {\checkobjectreferences - \blabelgroup - \ifundefined{\r!driver#3::#4}% - \showmessage\m!references{30}{[#3 #4=>#3/#4]}% - \xdef#5{#2{#3}{#4}}% - \else - \xdef#5{\@EAEAEA#1\csname\r!driver#3::#4\endcsname}% - \fi - \elabelgroup} - -\def\dogetobjectreference - {\dodogetobjectreference\firstoftwoarguments\defaultobjectreference} - -\def\dogetobjectreferencepage - {\dodogetobjectreference\secondoftwoarguments\defaultobjectpage} +\def\dogetobjectreference {\mkgetobjectreference} +\def\dogetobjectreferencepage{\mkgetobjectreferencepage} \def\setobject {\driverreferenced\dosetobject1} \def\settightobject{\driverreferenced\dosetobject0} @@ -343,27 +304,6 @@ %D \doifobjectreferencefoundelse{class}{object}{do then}{do else} %D \stoptyping -\beginTEX - -\def\doifobjectfoundelse#1#2% - {\blabelgroup \@EA\ifx\csname\r!object#1::#2\endcsname\relax - \elabelgroup \expandafter\secondoftwoarguments - \else - \elabelgroup \expandafter\firstoftwoarguments - \fi} - -\def\doifobjectreferencefoundelse#1#2% - {\checkobjectreferences - \blabelgroup \@EA\ifx\csname\r!driver#1::#2\endcsname\relax - \elabelgroup \expandafter\secondoftwoarguments - \else - \elabelgroup \expandafter\firstoftwoarguments - \fi} - -\endTEX - -\beginETEX - \def\doifobjectfoundelse#1#2% {\blabelgroup \ifcsname\r!object#1::#2\endcsname \elabelgroup \expandafter\firstoftwoarguments @@ -371,15 +311,7 @@ \elabelgroup \expandafter\secondoftwoarguments \fi} -\def\doifobjectreferencefoundelse#1#2% - {\checkobjectreferences - \blabelgroup \ifcsname\r!driver#1::#2\endcsname - \elabelgroup \expandafter\firstoftwoarguments - \else - \elabelgroup \expandafter\secondoftwoarguments - \fi} - -\endETEX +\def\doifobjectreferencefoundelse{\mkifobjectreferencefoundelse} %D \macros %D {doifobjectssupportedelse} @@ -410,4 +342,8 @@ %D support objects while we still want to be able to use the %D \DVI\ output. +%D Plugin code: + +\loadmarkfile{core-obj} + \protect \endinput diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex index 66c3ad850..403aeca6f 100644 --- a/tex/context/base/core-par.tex +++ b/tex/context/base/core-par.tex @@ -103,7 +103,7 @@ \setgvalue{\paragraphprefix\totalnofparagraphs}{#1}% \else \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}% - \fi} + \fi} \long\def\directskipparagraph#1% {\doglobal\increment\totalnofparagraphs @@ -114,14 +114,14 @@ \ifx#1\undefined \let#1\relax \fi - \convertargument#1\to\asciiA - \convertargument{ }\to\asciiB % lege regel + \convertargument#1\to\asciia + \convertargument{ }\to\asciib % lege regel \def\dopushparagraph##1\par - {\convertargument##1\to\asciiC - \doifelse\asciiC\asciiA + {\convertargument##1\to\asciic + \doifelse\asciic\asciia {#1} - {\doifsomething\asciiC % lege paragraaf - {\doifnot\asciiC\asciiB + {\doifsomething\asciic % lege paragraaf + {\doifnot\asciic\asciib {\directpushparagraph{#1}}}% \dopushparagraph}}% \dopushparagraph} diff --git a/tex/context/base/core-pgr.tex b/tex/context/base/core-pgr.tex index ea47363a7..22015fb3e 100644 --- a/tex/context/base/core-pgr.tex +++ b/tex/context/base/core-pgr.tex @@ -21,55 +21,37 @@ % in the future, the depth of tail will reflect page depth -\def\textanchor{text:\realfolio} - \ifx\textheight\undefined \def\textheight{\vsize} \fi -\def\placepositionanchors % todo : depth pagebox - {\ifpositioning - \setbox\scratchbox\vbox to \textheight - {\simpletopskipcorrection - \hbox{\strut\dopositionaction\headanchor}% - \vfill - \hbox{\strut\dopositionaction\tailanchor}}% - \dp\scratchbox\zeropoint - \wd\scratchbox\makeupwidth % not \zeropoint, else wrong text backgrounds - \hpos\textanchor{\box\scratchbox}% - \else - \vskip\textheight - \fi} - -%D The first version of this module implemented head and tail -%D anchors. Currently we stick to just one anchor and derive -%D the head and tail anchors from this one. +%D The next macros so some housekeeping. +\def\pageanchor{page:0} +\def\textanchor{text:\realfolio} \def\headanchor{head:\realfolio} % virtual position \def\tailanchor{tail:\realfolio} % virtual position -\def\presetpositionanchors% compatibility hack (still needed?) - {\ifpositioning - \dopresetpositionanchors - \fi} +%D Anchors: -\def\dopresetpositionanchors +\def\dopresetpositionanchors % also mkii {\bgroup \!!dimena\ifdim\topskip>\strutht\topskip\else\strutht\fi - \!!dimenb\MPy\textanchor - \!!dimenc\!!dimenb - \advance\!!dimenb \MPh\textanchor % space is essential - \advance\!!dimenb -\!!dimena - \advance\!!dimenc \strutdp + \!!dimenb\dimexpr\MPy\textanchor+\MPh\textanchor-\!!dimena\relax + \!!dimenc\dimexpr\MPy\textanchor+\strutdp\relax \!!dimend\MPx\textanchor \!!dimene\MPw\textanchor - \setxvalue{\POSprefix\headanchor}% - {\realfolio,\withoutpt\the\!!dimend,\withoutpt\the\!!dimenb,% - \withoutpt\the\!!dimene,\withoutpt\the\!!dimena,\withoutpt\the\strutdp}% - \setxvalue{\POSprefix\tailanchor}% - {\realfolio,\withoutpt\the\!!dimend,\withoutpt\the\!!dimenc,% - \withoutpt\the\!!dimene,\withoutpt\the\strutht,\withoutpt\the\strutdp}% - %\showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait + \replacepospxywhd\headanchor\realfolio\!!dimend\!!dimenb\!!dimene\!!dimena\strutdp + \replacepospxywhd\tailanchor\realfolio\!!dimend\!!dimenc\!!dimene\strutht \strutdp \egroup} +\def\presetpositionanchors% compatibility hack (still needed?) + {\ifpositioning + \dopresetpositionanchors + \fi} + +%D The first version of this module implemented head and tail +%D anchors. Currently we stick to just one anchor and derive +%D the head and tail anchors from this one. + \def\showanchor#1% {\expanded{\writestatus{#1} {\MPp{#1}\string|\MPx{#1}\string|\MPy{#1}\string|% @@ -79,6 +61,31 @@ \appendtoks \presetpositionanchors \to \beforeeverypage \appendtoks \presetpositionanchors \to \aftereverypage + +% todo: change with each page size change + +\def\registerpageposition#1% this one is flushed first ! + {\ifpositioning\ifcase\realpageno\or + \ifdim\printpaperheight=\paperheight\else + \ifdim\printpaperwidth=\paperwidth\else + \setbox#1\hbox{\hpos\pageanchor{\box#1}}% + \fi + \fi + \fi\fi} + +\def\placepositionanchors % todo : depth pagebox + {\ifpositioning + \setbox\scratchbox\vbox to \textheight + {\simpletopskipcorrection + \hbox{\strut\dopositionaction\headanchor}% + \vfill + \hbox{\strut\dopositionaction\tailanchor}}% + \dp\scratchbox\zeropoint + \wd\scratchbox\makeupwidth % not \zeropoint, else wrong text backgrounds + \hpos\textanchor{\box\scratchbox}% + \else + \vskip\textheight + \fi} %D \macros %D {positionoverlay,startpositionoverlay} @@ -258,6 +265,8 @@ {\long\setgvalue{MPG:#1}% tag list mpcode {\useMPpositiongraphic{#1}{#2}{#3}}} +\let\stopMPpositiongraphic\relax + \def\prepareMPpositionvariables {\ifundefined{\@@meta self}\setvalue{\@@meta self}{\currentposition}\fi \ifundefined{\@@meta from}\setvalue{\@@meta from}{\currentposition}\fi} @@ -342,6 +351,8 @@ \long\def\startMPpositionmethod#1#2\stopMPpositionmethod {\long\setgvalue{MPM:#1}{#2}} % todo: var list here +\let\stopMPpositionmethod\relax + %D Simple one position graphics. \def\setMPpositiongraphic @@ -519,35 +530,6 @@ % snap_multi_par_tops := false ; \stopuseMPgraphic -% \startMPpositionmethod{mpos:par} -% \doifpositionelse{w:\MPvar{self}} -% {\startMPpositiongraphic{mpos:par}% -% {fillcolor,filloffset,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{mpos:par:extra} ; -% \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; -% anchor_par(\MPanchor{b:\MPvar{self}}) ; -% \stopMPpositiongraphic} -% {\startMPpositiongraphic{mpos:par}% -% {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius} -% initialize_par(\MPpos{b:\MPvar{self}}, -% \MPpos{e:\MPvar{self}}, -% \MPpos{text:\realfolio}, -% \MPpos{p:\MPparcounter}, -% \MPvv {p:\MPparcounter}{0,0,0,0,0,0}) ; -% \includeMPgraphic{mpos:par:setup} ; -% \includeMPgraphic{mpos:par:extra} ; -% \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; -% anchor_par(\MPanchor{b:\MPvar{self}}) ; -% \stopMPpositiongraphic}% -% \MPpositiongraphic{mpos:par}{}% -% \stopMPpositionmethod - -%D Less readable but shorter. - \ifx\MPparcounter\undefined \newcounter\MPparcounter \fi \def\MPself {\MPvar{self}} @@ -578,7 +560,7 @@ \MPpos\MPeself, \MPpos\textanchor, \MPpos\MPparanchor, - \MPvv \MPparanchor{0,0,0,0,0,0}) ; + \MPvv \MPparanchor{0pt,0pt,0pt,0pt,0,0pt}) ; \includeMPgraphic{mpos:par:setup} ; \includeMPgraphic{mpos:par:extra} ; \includeMPgraphic{\MPvar{mp}} ; @@ -603,7 +585,7 @@ \includeMPgraphic{mpos:par:setup} ; \includeMPgraphic{mpos:par:extra} ; prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself, - \MPpos\MPparanchor,\MPvv\MPparanchor{0,0,0,0,0,0}) ; + \MPpos\MPparanchor,\MPvv\MPparanchor{0pt,0pt,0pt,0pt,0,0pt}) ; relocate_multipars(-\MPxy\MPanchorid) ; % inside layerpos \includeMPgraphic{\MPvar{mp}} ; \stopMPpositiongraphic @@ -1264,7 +1246,7 @@ %D The next hack make sure that margin texts near faulty %D strutted lines are handled ok. -\newif\ifrepositionmarginbox % \repositionmarginboxtrue +\newif\ifrepositionmarginbox \repositionmarginboxtrue \newcounter\currentmarginpos @@ -1285,29 +1267,83 @@ % \vadjust{\box#1}% % \egroup} -\def\dopositionmarginbox#1% how about page boundaries ! +% \def\dopositionmarginbox#1% how about page boundaries ! +% {\bgroup +% \ifrepositionmarginbox +% \doglobal\increment\currentmarginpos +% \setposition{\s!margin:\currentmarginpos}% +% \scratchdimen\MPy{\s!margin:\currentmarginpos}% +% \doglobal\increment\currentmarginpos +% \advance\scratchdimen -\MPy{\s!margin:\currentmarginpos}% +% \advance\scratchdimen -\strutdp +% % new +% \setbox#1\hbox +% {\hskip-\MPx{\s!margin:\currentmarginpos}% +% \hskip\MPx{head:\realfolio}% +% \box#1}% +% % so far +% \setbox#1\hbox +% {\setposition{\s!margin:\currentmarginpos}% +% \raise\scratchdimen\box#1}% +% \dp#1\zeropoint +% \ht#1\zeropoint +% \fi +% \graphicvadjust{\box#1}% +% \egroup} + +\def\dopositionmarginbox#1% {\bgroup \ifrepositionmarginbox \doglobal\increment\currentmarginpos \setposition{\s!margin:\currentmarginpos}% - \scratchdimen\MPy{\s!margin:\currentmarginpos}% - \doglobal\increment\currentmarginpos - \advance\scratchdimen -\MPy{\s!margin:\currentmarginpos}% - \advance\scratchdimen -\strutdp - % new - \setbox#1\hbox - {\hskip-\MPx{\s!margin:\currentmarginpos}% - \hskip\MPx{head:\realfolio}% - \box#1}% - % so far - \setbox#1\hbox - {\setposition{\s!margin:\currentmarginpos}% - \raise\scratchdimen\box#1}% + \ifcase\marginrepositionmethod + % nothing + \or + % nothing + \or + % stack / page check yet untested +% \scratchcounter\MPp{\s!margin:\currentmarginpos}\relax + \scratchdimen\MPy{\s!margin:\currentmarginpos}% + \doglobal\increment\currentmarginpos + \advance\scratchdimen -\MPy{\s!margin:\currentmarginpos}% + \advance\scratchdimen -\strutdp +% \ifnum\scratchcounter=\MPp{\s!margin:\currentmarginpos}\relax + % new + \setbox#1\hbox + {\hskip-\MPx{\s!margin:\currentmarginpos}% + \hskip\MPx{head:\realfolio}% + \box#1}% + % so far + \setbox#1\hbox + {\setposition{\s!margin:\currentmarginpos}% + \raise\scratchdimen\box#1}% +% \fi + \or + % move up + \ifnum\MPp{p:\parposcounter}=\MPp{\s!margin:\currentmarginpos}\relax + \scratchdimen\dimexpr\MPy{p:\parposcounter}-\MPy{\s!margin:\currentmarginpos}\relax + \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% + \fi + \or + % move up, assume end of par + \ifnum\MPp{p:\parposcounter}=\MPp{\s!margin:\currentmarginpos}\relax + \getnoflines\margincontentheight + \advance\noflines\minusone + \scratchdimen\noflines\lineheight + \else + \scratchdimen\dimexpr\MPy{p:\parposcounter}-\MPy{\s!margin:\currentmarginpos}\relax + \fi + \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% + \fi \dp#1\zeropoint \ht#1\zeropoint \fi \graphicvadjust{\box#1}% \egroup} + +\chardef\marginrepositionmethod\plusone % sidemethod +\chardef\margincontentmethod \plusthree % textmethod % beware: 1 = old method +\chardef\marginpagecheckmethod \plusone % splitmethod %D For a right menu, a sequence of calls to \type %D {right_menu_button} is generated. @@ -1384,16 +1420,16 @@ {\doglobal\appendtoks\dodododoGSC[#1:#2]\to\posXCtoks\NC} \def\dodoGSC[#1]% - {\def\docommando##1{\dododoGSC[##1:##1]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\dododoGSC[##1:##1]}% + \processcommalist[#1]\docommand} \def\dodododoGFC[#1:#2:#3]% {\remappositionframed{#2}{\tbPOSprefix#1}% \bpos{\tbPOSprefix#1}} \def\dododoGFC[#1]% - {\def\docommando##1{\dodododoGFC[##1:##1]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\dodododoGFC[##1:##1]}% + \processcommalist[#1]\docommand} \def\dodoGFC[#1]% {\doglobal\appendtoks\dododoGFC[#1]\to\posXCtoks\NC} @@ -1402,8 +1438,8 @@ {\epos{\tbPOSprefix#1}} \def\dodododoGTC[#1]% - {\def\docommando##1{\dododododoGTC[##1:##1]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\dododododoGTC[##1:##1]}% + \processcommalist[#1]\docommand} \def\dododoGTC[#1]% {\doglobal\appendtoks\dodododoGTC[#1]\to\posXCtoks} diff --git a/tex/context/base/core-pos.mkii b/tex/context/base/core-pos.mkii new file mode 100644 index 000000000..754673cfa --- /dev/null +++ b/tex/context/base/core-pos.mkii @@ -0,0 +1,184 @@ +%D \module +%D [ file=core-pos, +%D version=1999.08.01, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Positioning 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 mreadme.pdf for +%C details. + +\unprotect + +%D A unique prefix used for storing data. + +\def\POSprefix{POS::} + +%D Reading form the utility file. + +\def\pxypos {\pospxy} % obsolete +\def\pxyposwhd {\pospxywhd} % obsolete +\def\pxyposplus{\pospxyplus} % obsolete + +\def\resetpositions + {\let\pospxy \gobblefourarguments + \let\pospxywhd \gobblesevenarguments + \let\pospxyplus\gobbleeightarguments} + +\def\setpositions + {\let\pospxy \setpospxy + \let\pospxywhd \setpospxywhd + \let\pospxyplus\setpospxyplus} + +%D We need to initialize. + +\resetpositions + +\addutilityreset{positions} + +%D Core set macros: + +\def\setpospxy#1#2#3#4% + {\@EA\xdef\csname\POSprefix#1\endcsname + {\number#2,% + \the\dimexpr#3\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax,% + \the\dimexpr#4\ifnum\positionanchormode=\plusone-\MPy\pageanchor\fi\relax}} + +\def\setpospxywhd#1#2#3#4#5#6#7% + {\@EA\xdef\csname\POSprefix#1\endcsname + {\number#2,% + \the\dimexpr#3\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax,% + \the\dimexpr#4\ifnum\positionanchormode=\plusone-\MPy\pageanchor\fi\relax,% + \the\dimexpr#5\relax,% + \the\dimexpr#6\relax,% + \the\dimexpr#7\relax}} + +\def\setpospxyplus#1#2#3#4#5#6#7#8% + {\@EA\xdef\csname\POSprefix#1\endcsname + {\number#2,% + \the\dimexpr#3\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax,% + \the\dimexpr#4\ifnum\positionanchormode=\plusone-\MPy\pageanchor\fi\relax,% + \the\dimexpr#5\relax,% + \the\dimexpr#6\relax,% + \the\dimexpr#7\relax,% + #8}} + +%D Sometimes we want to trick the position handler a bit: + +\def\replacepospxywhd#1#2#3#4#5#6#7% + {\@EA\xdef\csname\POSprefix#1\endcsname + {\number#2,% + \the\dimexpr#3\relax,% + \the\dimexpr#4\relax,% + \the\dimexpr#5\relax,% + \the\dimexpr#6\relax,% + \the\dimexpr#7\relax}} + +%D Writing to the utility file. + +\def\dolazysaveposition#1#2#3#4% tag page x y + {\expanded{\writeutilitycommand{\noexpand\pospxy + {#1}{#2}{#3}{#4}}}} + +\def\dolazysavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d + {\expanded{\writeutilitycommand{\noexpand\pospxywhd + {#1}{#2}{#3}{#4}{#5}{#6}{#7}}}} + +\def\dolazysavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list + {\expanded{\writeutilitycommand{\noexpand\pospxyplus + {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} + +\def\dosaveposition#1#2#3#4% tag page x y + {\expanded{\immediatewriteutilitycommand{\noexpand\pospxy + {#1}{#2}{#3}{#4}}}} + +\def\dosavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d + {\expanded{\immediatewriteutilitycommand{\noexpand\pospxywhd + {#1}{#2}{#3}{#4}{#5}{#6}{#7}}}} + +\def\dosavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list + {\expanded{\immediatewriteutilitycommand{\noexpand\pospxyplus + {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} + +\def\MPp {\doMPxyhdwlr\doMPp } +\def\MPx {\doMPxyhdwlr\doMPx } +\def\MPy {\doMPxyhdwlr\doMPy } +\def\MPw {\doMPxyhdwlr\doMPw } +\def\MPh {\doMPxyhdwlr\doMPh } +\def\MPd {\doMPxyhdwlr\doMPd } +\def\MPxy {\doMPxyhdwlr\doMPxy } +\def\MPll {\doMPxyhdwlr\doMPll } +\def\MPlr {\doMPxyhdwlr\doMPlr } +\def\MPur {\doMPxyhdwlr\doMPur } +\def\MPul {\doMPxyhdwlr\doMPul } +\def\MPpos{\doMPxyhdwlr\doMPpos} + +\def\doMPp #1,#2,#3,#4,#5,#6,#7\relax{#1} +\def\doMPx #1,#2,#3,#4,#5,#6,#7\relax{#2} +\def\doMPy #1,#2,#3,#4,#5,#6,#7\relax{#3} +\def\doMPw #1,#2,#3,#4,#5,#6,#7\relax{#4} +\def\doMPh #1,#2,#3,#4,#5,#6,#7\relax{#5} +\def\doMPd #1,#2,#3,#4,#5,#6,#7\relax{#6} +\def\doMPxy #1,#2,#3,#4,#5,#6,#7\relax{(#2,#3)} +\def\doMPll #1,#2,#3,#4,#5,#6,#7\relax{(#2,#3-#6)} +\def\doMPlr #1,#2,#3,#4,#5,#6,#7\relax{(#2+#4,#3-#6)} +\def\doMPur #1,#2,#3,#4,#5,#6,#7\relax{(#2+#4,#3+#5)} +\def\doMPul #1,#2,#3,#4,#5,#6,#7\relax{(#2,#3+#5)} +\def\doMPpos#1,#2,#3,#4,#5,#6,#7\relax{#1,#2,#3,#4,#5,#6} + +\def\doMPxyhdwlr#1#2% + {\ifcsname\POSprefix#2\endcsname + \@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,0pt,0pt,0pt,0pt\relax + \else + #10,0pt,0pt,0pt,0pt,0pt,0pt\relax + \fi} + +% \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 +% ,0pt,0pt,0pt,0pt\relax} +% +% \setvalue{\POSprefix\s!unknown}{0,0pt,0pt} + +\def\MPplus {\MPdoplus\doMPplus} +\def\MPrest#1{\MPdoplus\doMPrest{#1}{}} + +\def\MPdoplus#1#2#3#4% + {\ifcsname\POSprefix#2\endcsname + \@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,,,,,,,,,\relax{#3}% + \else + #4% + \fi} + +\def\doMPplus#1,#2,#3,#4,#5,#6,% + {\dodoMPplus} + +\def\dodoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9% + {\ifcase#9\or#1\or#2\or#3\or#4\or#5\or#6\or#7\else\dododoMPplus#8\relax{#9}\fi} + +\def\dododoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9% + {\ifcase#9\or\or\or\or\or\or\or\or#1\or#2\or#3\or#4\or#5\or#6\or#7\fi} + +\def\doMPrest#1,#2,#3,#4,#5,#6,#7,,#8\relax#9% + {#7} + +%D Testing: + +\def\doifpositionelse#1% + {\ifcsname\POSprefix#1\endcsname + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +%D Copying: + +\def\copyposition#1#2% + {\ifcsname\POSprefix#2\endcsname + \global\@EA\let\csname\POSprefix#1\@EA\endcsname\csname\POSprefix#2\endcsname + \fi} + +\protect \endinput diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index 0324e522c..6b0e103fd 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -86,37 +86,15 @@ %D \dosetpositionplus {identifier} {width} {height} {depth} {list} %D \dosetpositionpapersize {width} {height} %D \stoptyping -%D -%D Either directly, when using \PDFTEX, or by means of a -%D postprocessor, when using \DVI\ output, these end up in the -%D utility file as: -%D -%D \starttyping -%D \pospxy {identifier} {page} {x} {y} -%D \pospxywhd {identifier} {page} {x} {y} {w} {h} {d} -%D \pospxylist {identifier} {page} {x} {y} {w} {h} {d} {list} -%D \stoptyping -%D -%D This means that we have to provide both a utility set and -%D reset macro for positions. -\def\POSprefix{POS::} - -\def\pxypos {\pospxy} % obsolete -\def\pxyposwhd {\pospxywhd} % obsolete -\def\pxyposplus{\pospxyplus} % obsolete - -\def\resetpositions - {\let\pospxy \gobblefourarguments - \let\pospxywhd \gobblesevenarguments - \let\pospxyplus\gobbleeightarguments} +\newbox\positionbox +\newif \ifpositioning -\def\setpositions - {\let\pospxy \setpospxy - \let\pospxywhd \setpospxywhd - \let\pospxyplus\setpospxyplus} +\def\POSprefix{POS::} -\addutilityreset{positions} +\let\setpospx \gobblefourarguments % suppress errors with mkii tuo file +\let\setpospxywhd \gobblesevenarguments % suppress errors with mkii tuo file +\let\setpospxyplus\gobbleeightarguments % suppress errors with mkii tuo file %D This is real tricky! The page anchor is applied to the %D page box and therefore flushed first. So, when present, it @@ -125,69 +103,15 @@ \chardef\positionanchormode=0 % don't relocate page origin \chardef\positionanchormode=1 % relocate page origin once -\def\pageanchor{page:0} - -% todo: change with each page size change +%D The core set macros. -\def\registerpageposition#1% this one is flushed first ! - {\ifpositioning\ifcase\realpageno\or - \ifdim\printpaperheight=\paperheight\else - \ifdim\printpaperwidth=\paperwidth\else - \setbox#1\hbox{\hpos\pageanchor{\box#1}}% - \fi - \fi - \fi\fi} - -\def\setpospxy#1#2#3#4% - {\dosetpositionnm\@@posp{#2}% - \dosetpositionxy\@@posx{#3}\MPx - \dosetpositionxy\@@posy{#4}\MPy - \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy}} - -\def\setpospxywhd#1#2#3#4#5#6#7% - {\dosetpositionnm\@@posp{#2}% - \dosetpositionxy\@@posx{#3}\MPx - \dosetpositionxy\@@posy{#4}\MPy - \dosetpositionpt\@@posw{#5}% - \dosetpositionpt\@@posh{#6}% - \dosetpositionpt\@@posd{#7}% - \@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}% - \dosetpositionxy\@@posx{#3}\MPx - \dosetpositionxy\@@posy{#4}\MPy - \dosetpositionpt\@@posw{#5}% - \dosetpositionpt\@@posh{#6}% - \dosetpositionpt\@@posd{#7}% - \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}} +\let\pospxy \gobblefourarguments +\let\pospxywhd \gobblesevenarguments +\let\pospxyplus\gobbleeightarguments %D Sometimes we want to trick the position handler a bit: -\def\replacepospxywhd#1#2#3#4#5#6#7% - {\begingroup - \nosetpositionnm\@@posp{#2}% - \nosetpositionpt\@@posx{#3}% - \nosetpositionpt\@@posy{#4}% - \nosetpositionpt\@@posw{#5}% - \nosetpositionpt\@@posh{#6}% - \nosetpositionpt\@@posd{#7}% - \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}% - \endgroup} - -% slower, as many tokens, etc: -% -% \def\replacepospxywhd#1#2#3#4#5#6#7% -% {\begingroup -% \let\dosetpositionnm\nosetpositionnm -% \let\dosetpositionpt\nosetpositionpt -% \let\dosetpositionxy\nosetpositionpt -% \setpospxywhd{#1}{#2}{#3}{#4}{#5}{#6}{#7}% -% \endgroup} - -%D We need to initialize. - -\resetpositions +\let\replacepospxywhd\gobbleeightarguments %D For postprocessing purposes, we save the number of %D positions. @@ -221,35 +145,6 @@ \localpositioningfalse \to \everypagebody -%D We save positionional information without dimensions, which -%D saves some bytes. The conversion too saves some bytes, but -%D is primarily needed because we want to pass those values to -%D \METAPOST\ too. - -\def\dosetpositionpt#1#2% - {\scratchdimen\number#2\scaledpoint - \xdef#1{\withoutpt\the\scratchdimen}} - -\def\dosetpositionnm#1#2% - {\xdef#1{\number#2}} - -\def\dosetpositionxy#1#2#3% todo: scaled points - {\scratchdimen\number#2\scaledpoint - \ifcase\positionanchormode\or - \advance\scratchdimen-#3\pageanchor - \fi - \xdef#1{\withoutpt\the\scratchdimen}} - -\def\nosetpositionnm#1#2{\xdef#1{\number#2}} -\def\nosetpositionpt#1#2{\scratchdimen#2\xdef#1{\withoutpt\the\scratchdimen}} - -\beginETEX \dimexpr - - \def\dosetpositionpt#1#2{\xdef#1{\withoutpt\the\dimexpr(\number#2\scaledpoint)}} - \def\nosetpositionpt#1#2{\xdef#1{\withoutpt\the\dimexpr(#2)}} - -\endETEX - \def\checkpositions {\startnointerference \protectlabels @@ -268,29 +163,12 @@ %D method is implemented in a special driver. If needed, the %D driver can fall back on the following macros. -\def\dolazysaveposition#1#2#3#4% tag page x y - {\expanded{\writeutilitycommand{\noexpand\pospxy - {#1}{#2}{#3}{#4}}}} - -\def\dolazysavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d - {\expanded{\writeutilitycommand{\noexpand\pospxywhd - {#1}{#2}{#3}{#4}{#5}{#6}{#7}}}} - -\def\dolazysavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list - {\expanded{\writeutilitycommand{\noexpand\pospxyplus - {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} - -\def\dosaveposition#1#2#3#4% tag page x y - {\expanded{\immediatewriteutilitycommand{\noexpand\pospxy - {#1}{#2}{#3}{#4}}}} - -\def\dosavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d - {\expanded{\immediatewriteutilitycommand{\noexpand\pospxywhd - {#1}{#2}{#3}{#4}{#5}{#6}{#7}}}} - -\def\dosavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list - {\expanded{\immediatewriteutilitycommand{\noexpand\pospxyplus - {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} +\let\dolazysaveposition \gobblefourarguments % tag page x y +\let\dolazysavepositionwhd \gobblesevenarguments % tag page x y w h d +\let\dolazysavepositionplus\gobbleeightarguments % tag page x y w h d list +\let\dosaveposition \gobblefourarguments % tag page x y +\let\dosavepositionwhd \gobblesevenarguments % tag page x y w h d +\let\dosavepositionplus \gobbleeightarguments % tag page x y w h d list %D \macros %D {MPp, MPx, MPy, MPw, MPh, MPd, @@ -299,57 +177,18 @@ %D Access to the positional information is provided by macros %D with short names that are clearly meant for \METAPOST. -\def\MPp {\doMPxyhdwlr\doMPp } -\def\MPx {\doMPxyhdwlr\doMPx } -\def\MPy {\doMPxyhdwlr\doMPy } -\def\MPw {\doMPxyhdwlr\doMPw } -\def\MPh {\doMPxyhdwlr\doMPh } -\def\MPd {\doMPxyhdwlr\doMPd } -\def\MPxy {\doMPxyhdwlr\doMPxy } -\def\MPll {\doMPxyhdwlr\doMPll } -\def\MPlr {\doMPxyhdwlr\doMPlr } -\def\MPur {\doMPxyhdwlr\doMPur } -\def\MPul {\doMPxyhdwlr\doMPul } -\def\MPpos{\doMPxyhdwlr\doMPpos} - -%D So \type {\MPx{identifier}} returns a position, specified -%D in points. When unknown, \type {0pt} is returned. From the -%D next definitions, we can see that some positions are -%D expressions. - -\def\doMPp #1,#2,#3,#4,#5,#6,#7\relax{#1} -\def\doMPx #1,#2,#3,#4,#5,#6,#7\relax{#2\s!pt} -\def\doMPy #1,#2,#3,#4,#5,#6,#7\relax{#3\s!pt} -\def\doMPw #1,#2,#3,#4,#5,#6,#7\relax{#4\s!pt} -\def\doMPh #1,#2,#3,#4,#5,#6,#7\relax{#5\s!pt} -\def\doMPd #1,#2,#3,#4,#5,#6,#7\relax{#6\s!pt} -\def\doMPxy #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt)} -\def\doMPll #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt-#6\s!pt)} -\def\doMPlr #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt+#4\s!pt,#3\s!pt-#6\s!pt)} -\def\doMPur #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt+#4\s!pt,#3\s!pt+#5\s!pt)} -\def\doMPul #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt+#5\s!pt)} -\def\doMPpos#1,#2,#3,#4,#5,#6,#7\relax{#1,#2\s!pt,#3\s!pt,#4\s!pt,#5\s!pt,#6\s!pt} - -%D As said, we will default to zero (dimensions) when a -%D position is unknown. - -\def\doMPxyhdwlr#1#2% - {\ifundefined{\POSprefix#2}% - #10,0,0,0,0,0,0\relax - \else - \@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 +\let\MPp \!!zerocount +\def\MPx \!!zeropoint +\def\MPy \!!zeropoint +\def\MPw \!!zeropoint +\def\MPh \!!zeropoint +\def\MPd \!!zeropoint +\def\MPxy \!!zeropoint +\def\MPll \!!zeropoint +\def\MPlr \!!zeropoint +\def\MPur \!!zeropoint +\def\MPul \!!zeropoint +\def\MPpos{\!!zerocount,\!!zeropoint,\!!zeropoint,\!!zeropoint,\!!zeropoint,\!!zeropoint} %D \macros %D {MPplus, MPrest, MPv, MPvv} @@ -371,57 +210,23 @@ %D %D The extra parameters are not treated. -\def\MPplus {\MPdoplus\doMPplus} \let\MPv \MPplus -\def\MPrest#1{\MPdoplus\doMPrest{#1}{}} \let\MPvv\MPrest - -\def\MPdoplus#1#2#3#4% - {\ifundefined{\POSprefix#2}#4\else - \@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} - -\def\dodoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9% - {\ifcase#9\or#1\or#2\or#3\or#4\or#5\or#6\or#7\else - \dododoMPplus#8\relax{#9}\fi} - -\def\dododoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9% - {\ifcase#9\or \or \or \or \or \or \or \or - #1\or#2\or#3\or#4\or#5\or#6\or#7\fi} - -\def\doMPrest#1,#2,#3,#4,#5,#6,#7,,#8\relax#9% - {#7} - -% We can now remap the normal whd onto this. +\def\MPplus#1#2{\!!zerocount} \def\MPv {\MPplus} +\def\MPrest#1#2{#2} \def\MPvv{\MPrest} %D \macros %D {MPanchor} %D %D For readability we define a few synonyms: -\let\MPanchor\MPpos +\def\MPanchor{\MPpos} %D \macros %D {POSp, POSx, POSy, POSh, POSd, POSw} %D %D and: -\let\POSp\MPp \let\POSx\MPx \let\POSy\MPy -\let\POSh\MPh \let\POSd\MPd \let\POSw\MPw - -\newbox\positionbox \newif\ifpositioning +\def\POSp{\MPp} \def\POSx{\MPx} \def\POSy{\MPy} +\def\POSh{\MPh} \def\POSd{\MPd} \def\POSw{\MPw} %D There are two low level positioning macros. Both store the %D position as well as execute an action associated with that @@ -431,47 +236,11 @@ {\ifpositioning \else \global\positioningtrue \dosetpositionpapersize - {\number\printpaperwidth}% - {\number\printpaperheight }% + {\printpaperwidth }% + {\printpaperheight}% \fi \doglobal\increment\currentpositions} -% \def\setposition#1% -% {\initializenextposition -% \dosetposition{#1}% -% \dopositionaction{#1}} -% -% \def\setpositionbox#1% -% {\dowithnextbox -% {\hbox to \nextboxwd -% {\initializenextposition -% \def\currentposition{#1}% -% \dosetpositionwhd \currentposition -% {\number\nextboxwd}% -% {\number\nextboxht}% -% {\number\nextboxdp}% -% \traceposstring\llap\green{\currentposition>}% -% \setbox\positionbox\flushnextbox -% \dopositionaction\currentposition -% \box\positionbox -% \hss}}} -% -% \def\setpositionplus#1#2% -% {\dowithnextbox -% {\hbox to \nextboxwd -% {\initializenextposition -% \def\currentposition{#1}% -% \dosetpositionplus \currentposition -% {\number\nextboxwd}% -% {\number\nextboxht}% -% {\number\nextboxdp}% -% {#2}% -% \traceposstring\rlap\magenta{<\currentposition}% -% \setbox\positionbox\flushnextbox -% \dopositionaction\currentposition -% \box\positionbox -% \hss}}} - \def\setpositiononly#1% {\iftrialtypesetting % nothing @@ -498,9 +267,9 @@ \hbox {\def\currentposition{#1}% \dosetpositionwhd\currentposition - {\number#2}% - {\number#3}% - {\number#4}% + {\the\dimexpr#2\relax}% + {\the\dimexpr#3\relax}% + {\the\dimexpr#4\relax}% \traceposstring\llap\green{\currentposition>}% \dopositionaction\currentposition \hss}% @@ -515,9 +284,9 @@ \hbox to \nextboxwd {\edef\currentposition{#1}% \dosetpositionwhd\currentposition - {\number\nextboxwd}% - {\number\nextboxht}% - {\number\nextboxdp}% + {\the\nextboxwd}% + {\the\nextboxht}% + {\the\nextboxdp}% \traceposstring\llap\green{\currentposition>}% \setbox\positionbox\flushnextbox \dopositionaction\currentposition @@ -531,9 +300,9 @@ \hbox to \nextboxwd {\edef\currentposition{#1}% \dosetpositionplus\currentposition - {\number#2}% - {\number#3}% - {\number#4}% + {\the\dimexpr#2\relax}% + {\the\dimexpr#3\relax}% + {\the\dimexpr#4\relax}% {#5}% \traceposstring\rlap\magenta{<\currentposition}% \dopositionaction\currentposition @@ -549,9 +318,9 @@ \hbox to \nextboxwd {\edef\currentposition{#1}% \dosetpositionplus\currentposition - {\number\nextboxwd}% - {\number\nextboxht}% - {\number\nextboxdp}% + {\the\nextboxwd}% + {\the\nextboxht}% + {\the\nextboxdp}% {#2}% \traceposstring\rlap\magenta{<\currentposition}% \setbox\positionbox\flushnextbox @@ -637,15 +406,7 @@ %D %D Again, this is a global action. -\def\copyposition#1#2% - {\bgroup - %\edef\to {\POSprefix#1}% - \edef\from{\POSprefix#2}% - \ifundefined\from\else - % \global\@EA\@EA\@EA\let\@EA\csname\@EA\to\@EA\endcsname\csname\from\endcsname - \global\@EA\let\csname\POSprefix#1\@EA\endcsname\csname\from\endcsname - \fi - \egroup} +\let\copyposition\gobbletwoarguments %D The fact that handling positions is a two pass operation, is %D one of the reasons why we need to be able to test for @@ -655,15 +416,7 @@ %D \doifpositionelse {identifier} {found action} {not found action} %D \stoptyping -% \def\doifpositionelse#1% -% {\doifdefinedelse{\POSprefix#1}} - -\def\doifpositionelse#1% - {\ifundefined{\POSprefix#1}% - \expandafter\secondoftwoarguments - \else - \expandafter\firstoftwoarguments - \fi} +\let\doifpositionelse\thirdofthreearguments %D We have now arrived at a few macros that would make sense as %D support macros, but ended up in the core. @@ -754,9 +507,6 @@ \newif\ifpositioningpar -\def\efficientdimen#1% - {\the#1} % \ifdim#1=\zeropoint\string\!!zeropoint\else\the#1\fi} - % we can check for used entries, and if not, then not add one \def\registerparoptions @@ -779,15 +529,15 @@ \rightskip1\rightskip \setpositiondataplus {p:\parposcounter}% % identifier - {\zeropoint}% - {\strutht}% - {\strutdp}% - {\efficientdimen\hsize ,% 1 - \efficientdimen\leftskip ,% 2 - \efficientdimen\rightskip ,% 3 - \efficientdimen\hangindent,% 4 - \the\hangafter ,% 5 - \efficientdimen\parindent }% 6 + {\the\zeropoint}% + {\the\strutht}% + {\the\strutdp}% + {\the\hsize ,% 1 + \the\leftskip ,% 2 + \the\rightskip ,% 3 + \the\hangindent,% 4 + \the\hangafter ,% 5 (num) + \the\parindent }% 6 %\normalhbox{\registerparsymbol}% \registerparsymbol \endgroup} @@ -801,13 +551,14 @@ {\iftracepositions \smashedhbox to \zeropoint {\hss - \blue + \startcolor[blue]% \llap{\infofont\number\parposcounter}% \scratchdimen\onepoint \vrule \!!width 4\scratchdimen \!!height2\scratchdimen \!!depth 2\scratchdimen + \stopcolor \hss}% \fi} @@ -819,17 +570,24 @@ \def\@@nodeo{node:o:} \def\@@nodep{node:p:} +\def\doifelsenodelocation#1% + {\ifcsname\@@noden#1\endcsname + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + \def\nextnodelocation#1% - {\pluscounter{\@@noden#1}} + {\ifcsname\@@noden#1\endcsname\pluscounter{\@@noden#1}\fi} \def\newnodelocation#1% - {\ifundefined{\@@noden#1}% + {\ifcsname\@@noden#1\endcsname \setcounter{\@@noden#1}\zerocount \letgvalue {\@@nodeo#1}\!!zerocount \fi} \def\tagnodelocation#1% - {\xypos{\@@nodep#1:\countervalue{\@@noden#1}}} + {\ifcsname\@@noden#1\endcsname\xypos{\@@nodep#1:\countervalue{\@@noden#1}}\fi} \def\getnodelocationp#1{\MPp{\@@nodep#1:\countervalue{\@@noden#1}}} \def\getnodelocationx#1{\MPx{\@@nodep#1:\countervalue{\@@noden#1}}} @@ -845,7 +603,9 @@ \chardef\nodelocationmode\plusone \def\analyzenodelocation#1% - {\doanalyzenodelocation{#1}{\getnodelocationn{#1}}\zerocount} + {\ifcsname\@@noden#1\endcsname + \doanalyzenodelocation{#1}{\getnodelocationn{#1}}\zerocount + \fi} \def\doanalyzenodelocation#1#2#3% class n default {\begingroup @@ -906,13 +666,15 @@ \endgroup} \unexpanded\def\shownodelocation#1% - {\analyzenodelocation{#1}% - (#1,% - n:\getnodelocationn{#1},% - p:\getnodelocationp{#1},% - x:\getnodelocationx{#1},% - y:\getnodelocationy{#1},% - o:\getnodelocationo{#1})} + {\ifcsname\@@noden#1\endcsname + \analyzenodelocation{#1}% + (#1,% + n:\getnodelocationn{#1},% + p:\getnodelocationp{#1},% + x:\getnodelocationx{#1},% + y:\getnodelocationy{#1},% + o:\getnodelocationo{#1})% + \fi} %D \macros %D {doifoverlappingelse} @@ -934,13 +696,13 @@ \edef\!!stringa{#1}\edef\!!stringb{#2}% \ifnum\MPp\!!stringa=\MPp\!!stringb\relax \!!dimena\MPx\!!stringa - \!!dimenb\MPx\!!stringa\advance\!!dimenb \MPw\!!stringa - \!!dimenc\MPy\!!stringa\advance\!!dimenc-\MPd\!!stringa - \!!dimend\MPy\!!stringa\advance\!!dimend \MPh\!!stringa + \!!dimenb\dimexpr\MPx\!!stringa+\MPw\!!stringa\relax + \!!dimenc\dimexpr\MPy\!!stringa-\MPd\!!stringa\relax + \!!dimend\dimexpr\MPy\!!stringa+\MPh\!!stringa\relax \!!dimene\MPx\!!stringb - \!!dimenf\MPx\!!stringb\advance\!!dimenf \MPw\!!stringb - \!!dimeng\MPy\!!stringb\advance\!!dimeng-\MPd\!!stringb - \!!dimenh\MPy\!!stringb\advance\!!dimenh \MPh\!!stringb + \!!dimenf\dimexpr\MPx\!!stringb+\MPw\!!stringb\relax + \!!dimeng\dimexpr\MPy\!!stringb-\MPd\!!stringb\relax + \!!dimenh\dimexpr\MPy\!!stringb+\MPh\!!stringb\relax \ifdim\overlappingmargin=\zeropoint\else \advance\!!dimena-\overlappingmargin \advance\!!dimenb+\overlappingmargin @@ -998,13 +760,13 @@ \def\dodoifpositionsonsamepageelse#1#2#3#4% {\bgroup \scratchcounter#1\donefalse - \def\docommando##1% + \def\docommand##1% {\ifcase\scratchcounter \scratchcounter\MPp{##1}\donetrue \else \ifnum\scratchcounter=\MPp{##1}\relax\else\donefalse\fi \fi}% - \rawprocesscommalist[#2]\docommando + \rawprocesscommalist[#2]\docommand \ifdone\egroup#3\else\egroup#4\fi} \def\doifpositionsonsamepageelse @@ -1013,4 +775,16 @@ \def\doifpositionsonthispageelse#1#2#3% {\dodoifpositionsonsamepageelse\realfolio} +%D Plugins: + +\loadmarkfile{core-pos} + +\let\MPv \MPplus +\let\MPvv \MPrest + +\let\MPanchor\MPpos + +\let\POSp\MPp \let\POSx\MPx \let\POSy\MPy +\let\POSh\MPh \let\POSd\MPd \let\POSw\MPw + \protect \endinput diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 4a0c1a3ce..9c6ad0f9c 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -222,7 +222,6 @@ {#3}% \egroup} - %D As we can see, these macros depend on three other ones, %D \type {\makesectionformat}, that generated \type %D {\sectionformat}, \type {\pagenumber}. The not yet used @@ -313,11 +312,12 @@ \ifx\lastreference\empty \else \doiffirstreferenceoccurance\lastreference {\thisisdestination{\referenceprefix\lastreference}}% - \referentieinfo>\lastreference - \edef\dododowritereference - {\writeutilitycommand - {\mainreference{\referenceprefix}{\lastreference}{#4}{#5}{#6}}}% - \dododowritereference + \referenceinfo>\lastreference +% \edef\dododowritereference +% {\writeutilitycommand +% {\mainreference{\referenceprefix}{\lastreference}{#4}{#5}{#6}}}% +% \dododowritereference + \expanded{\writeutilitycommand{\noexpand\mainreference{\referenceprefix}{\lastreference}{#4}{#5}{#6}}}% \fi \egroup} @@ -329,19 +329,6 @@ %D In practice this comes to giving \type {\mainreference} a %D appropriate meaning and loading the utility file. -% \def\setreferences -% {\def\mainreference##1##2##3##4##5% -% {\doifundefinedelse{\r!cross\fileprefix##1##2} -% {\setglobalcrossreference{##1##2}{##3}{##4}{##5}} -% {\showmessage\m!references{2}{[##1][##2],##4}}}} - -% \def\setreferences -% {\the\everyreference % we're grouped anyway -% \def\mainreference##1##2##3##4##5% -% {\doifundefinedelse{\r!cross\fileprefix##1##2} -% {\setglobalcrossreference{##1##2}{##3}{##4}{##5}} -% {\ifcase0##4\else\showmessage\m!references{2}{[##1][##2],##4}\fi}}} - %D For a long time the only way to access an external file was %D to use the file prefix (\type {somefile::}. However, when %D you split up a document, redefining the references may be @@ -359,48 +346,31 @@ \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!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} -% {\ifcase0##4\else -% \showmessage\m!references2{[##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% can be made faster by indirect calls - {\ifundefined{\r!cross\fileprefix##1##2}% \ifcsname\r!cross\fileprefix##1##2\endcsname + {\ifcsname\r!cross\fileprefix##1##2\endcsname + \ifcase0##4\else + \showmessage\m!references2{[##1][##2],##4 (\currentutilityfilename)}% + \fi + \else \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)}}% + \ifcsname\r!cross##1##2\endcsname + \showmessage\m!references2{[##1][##2],##4 (auto \currentutilityfilename)}% + \else + \expanded{\definereference[##1##2][\fileprefix##1##2]}% + \fi \or - \doifundefinedelse{\r!cross##1##2} - {\expanded{\definereference[##1##2][\noexpand\v!page(\fileprefix##4)]}} - {\showmessage\m!references2{[##1][##2],##4 (auto \currentutilityfilename)}}% + \ifcsname\r!cross##1##2\endcsname + \showmessage\m!references2{[##1][##2],##4 (auto \currentutilityfilename)}% + \else + \expanded{\definereference[##1##2][\noexpand\v!page(\fileprefix##4)]}% + \fi \fi - \else\ifcase0##4\else - \showmessage\m!references2{[##1][##2],##4 (\currentutilityfilename)}% - \fi\fi}} + \fi}} \def\resetreferences {\let\mainreference\gobblefivearguments} @@ -506,7 +476,7 @@ \def\setglobalcrossreference#1#2#3#4% {\scratchtoks{#4}% - \global\advance\crossreferenceorder 1 + \global\advance\crossreferenceorder \plusone \@EA\xdef\csname\r!cross\fileprefix#1\endcsname {\rt!cross{#2}{#3}{\the\scratchtoks}{\the\crossreferenceorder}}} @@ -516,17 +486,6 @@ \def\setglobalsystemreference#1#2#3% {\@EA\xdef\csname\r!cross\fileprefix#2\endcsname{#1{#3}}} -% Maybe I need this some day. - -% \def\copycrossreference#1#2#3% file from to -% {\bgroup -% \def\fileprefix{#1::}% -% \def\rt!cross##1##2##3##4% -% {\setxvalue{\r!cross\fileprefix#3}% -% {\noexpand\rt!cross{##1}{##2}{##3}{##4}}}% -% \getvalue{\r!cross\fileprefix#2}% -% \egroup} - \def\copycrossreference#1#2#3% file from to / slow {\bgroup \doifelse{#1}{} @@ -580,13 +539,6 @@ %D with four arguments and one with only two, we need a two %D step filter. -%\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\empty\empty\empty\empty} @@ -746,33 +698,8 @@ %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}% -% \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\dohandleduplicatereference#1% {\bgroup \let\rt!cross\rt!crossdone @@ -780,17 +707,6 @@ {\csname\r!cross\referenceprefix#1\endcsname}% \egroup} -% \def\checkfirstreferenceoccurance#1#2% etex -% {\ifcsname\r!cross\referenceprefix#1\endcsname -% \getreferenceelements{#1}% -% \ifnum\currentreferencetype=\rt!cross -% \dohandleduplicatereference{#1}% -% #2% -% \fi -% \else -% #2% -% \fi} - \def\checkfirstreferenceoccurance#1#2% etex {\@EA\ifx\csname\r!cross\referenceprefix#1\endcsname\relax % no ifcsname needed here \predefinereference{#1}% @@ -1274,7 +1190,7 @@ \fi} \def\docheckglobalfilereference#1% - {\ifundefined{\r!cross#1::\currentinnerreference}\else + {\ifcsname\r!cross#1::\currentinnerreference\endcsname \def\currentouterreference{#1}% \edef\currentfullreference% {\currentouterreference::\currentinnerreference}% @@ -1315,101 +1231,6 @@ % lijst, dan de chain doorlopen. Momenteel mag alleen laatste % laatste undefined zijn, eigenlijk moet dat overal kunnen met % '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 -% \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 \def\doifreferencefoundelse#1#2#3% REF \cs / never more than one group (else \aftergroup usage problems) {\checkreferences @@ -1439,7 +1260,7 @@ \global\nofsecondaryreferences \plusone #2% \else - \dostartnoto#3\dostopnoto + \dohandlenoto{#3}% \fi \egroup \fi \fi @@ -1459,7 +1280,7 @@ \global\advance\nofsecondaryreferences \plusone #2% \else - \dostartnoto#3\dostopnoto + \dohandlenoto{#3}% \fi \egroup \ifnum\scratchcounter<\nofexpandedreferences\relax @@ -1494,20 +1315,20 @@ {\dodoifreferencefoundelse{#1}% \ifreferencefound\@EA\firstoftwoarguments\else\@EA\secondoftwoarguments\fi} -%D Somewhere else we will properly define \type {\dostartgoto}; +%D Somewhere else we will properly define \type {\dohandlegoto}; %D the noto alternative takes care of undefined references in %D a sequence -\ifx\dostartnoto\undefined +\ifx\dohandlenoto\undefined - \def\dostartnoto#1\dostopnoto + \def\dohandlenoto#1% {\ifsecondaryreference\else{#1}\fi} \fi -\ifx\dostartgoto\undefined +\ifx\dohandlegoto\undefined - \def\dostartgoto\data#1\start#2\stop#3\dostopgoto + \def\dohandlegoto#1#2#3% {\ifsecondaryreference\else{#1}\fi} \fi @@ -1523,10 +1344,11 @@ {\checkreferences \bgroup \edef\currentfullreference{#1}% - \ifundefined{\r!cross\currentfullreference}% - \global\referencefoundfalse #3% - \else\getreferenceelements\currentfullreference - \global\referencefoundtrue #2% + \ifcsname\r!cross\currentfullreference\endcsname + \getreferenceelements\currentfullreference + \global\referencefoundtrue#2% + \else + \global\referencefoundfalse#3% \fi \egroup} @@ -1538,25 +1360,6 @@ %D \goto{some text}[prefix:reference] %D \stoptyping -%\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 @@ -1580,35 +1383,6 @@ \fi \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing} -\endETEX - -\beginTEX - -\def\docheckinnerreference - {\global\let\predefinedreference\currentinnerreference - \ifx\currentreferencearguments\empty - \@EA\ifx\csname\r!cross\referenceprefix\currentfullreference\endcsname\relax - \let\referenceprefix\empty - \@EA\ifx\csname\r!cross\currentfullreference\endcsname\relax - \global\referencefoundfalse - \else - \global\referencefoundtrue - \fi - \else - \global\referencefoundtrue - \fi - \else % [SomeThing{with,me}] - \let\referenceprefix\empty - \@EA\ifx\csname\r!cross\currentinnerreference\endcsname\relax - \global\referencefoundfalse - \else - \global\referencefoundtrue - \fi - \fi - \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing} - -\endTEX - %D References to other files however are treated strict or %D tolerant, depending on their loading and availability: %D @@ -1624,67 +1398,8 @@ %D \type{\setouterreference} as a signal that indeed references %D are defined for the outer file. -% \def\docheckouterreference% -% {\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} -% {\global\referencefoundfalse}} -% {\global\referencefoundtrue}% no checking done -% \fi -% \doifpredefinedreferenceelse{\global\referencefoundfalse}{}} - \newif\ifstrictouterreferences \strictouterreferencesfalse -\beginTEX - -\def\dodocheckouterreference - {\@EA\ifx\csname\specialREFidentifier\currentfullreference\endcsname\relax - \ifstrictouterreferences - \global\referencefoundfalse - \else - % already \global\referencefoundtrue % no checking done - \fi - \else - \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level - {\csname\specialREFidentifier\currentfullreference\endcsname}% - \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 - \def\dodocheckouterreference {\ifcsname\specialREFidentifier\currentfullreference\endcsname \@EA\@EA\@EA\splitofffullreference\@EA\@EA\@EA % 1 level @@ -1720,8 +1435,6 @@ \fi \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing} -\endETEX - %D Special references are only tested when some test routine is %D defined. @@ -1738,24 +1451,6 @@ %D An unknown reference is reported on the screen, in the log %D file and, when enabled, in the left margin of the text. -% \def\reportreferenceerror#1#2% -% {\bgroup -% \the\everyreference % cleanup : etc in french -% \ifinpagebody\else -% \doifconcepttracing -% {\doifsomething{#2} -% {\inleft -% {\infofont -% \scratchdimen\leftmarginwidth -% \advance\scratchdimen -2em -% \doboundtext{#2}\scratchdimen{..}->}}}% -% \fi -% \doifpredefinedreferenceelse -% \donothing -% {\predefinereference -% \showmessage\m!references{#1}{[\unharmedreferenceprefix][#2]}}% -% \egroup} - \def\reportreferenceerror#1#2% {\bgroup \the\everyreference % cleanup : etc in french @@ -1794,16 +1489,6 @@ \let\predefinedreference\s!unknown -% \def\predefinereference -% {\setgvalue{\r!cross\predefinedreference}{\rt!cross{}{}{}{}}% -% \setgvalue{\r!cross\unharmedreferenceprefix\predefinedreference}{\rt!cross{}{}{}{}}} - -% \def\dummypredefinedreference{\r!cross{}{}{}{}} -% -% \def\predefinereference -% {\global\@EA\let\csname\r!cross\predefinedreference \endcsname\dummypredefinedreference -% \global\@EA\let\csname\r!cross\unharmedreferenceprefix\endcsname\dummypredefinedreference} % bug! -% % we need to predefine in order to make dup checking possible (when no ref % is defined yet) @@ -1815,15 +1500,6 @@ %D Testing on existance then becomes: -% \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 % \referenceprefix added {\@EA\ifx\csname\r!cross\referenceprefix\predefinedreference\endcsname\dummypredefinedreference \expandafter\firstoftwoarguments @@ -1840,23 +1516,6 @@ %D %D The second argument can be a comma seperated list. -% this will be replaced by a more general mechanis - -% \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 @@ -1930,11 +1589,7 @@ %D counterparts. A common component in these is: %D %D \starttyping -%D \dostartgoto -%D \data {..} -%D \start {..} -%D \stop {..} -%D \dostopgoto +%D \dohandlegoto{..}{..}{..} %D \stoptyping %D %D Here data can be whatever needs highlighting, e.g. {\em @@ -1951,15 +1606,10 @@ \ifusepagedestinations \gotorealpage{#1}{#2}{#4}{#5}% \else - \dostartgoto - \data - {#5}% - \start - \the\everyreference % we are (have to be) grouped ! - \dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{#4}% - \stop - \dostopgotolocation - \dostopgoto + \dohandlegoto + {#5}% + {\the\everyreference\dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{#4}}% + {\dostopgotolocation}% \fi \else {#5}% @@ -1967,14 +1617,10 @@ \def\gotorealpage#1#2#3#4% url file page data {\iflocation - \dostartgoto - \data - {#4}% - \start - \dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{#3}% - \stop - \dostopgotorealpage - \dostopgoto + \dohandlegoto + {#4}% + {\dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{#3}}% + {\dostopgotorealpage}% \else {#4}% \fi} @@ -2062,6 +1708,16 @@ \thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}% \fi} +% beter: +% +% \def\thisisnextinternal#1% +% {\iftrialtypesetting\else +% \global\advance\locationcount \plusone +% \ifinternalnamedreferences +% \thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}% +% \fi +% \fi} + \def\gotonextinternal#1#2#3#4% {\ifinternalnamedreferences \gotodestination\empty\empty{\s!aut\iftraceinternalreferences:#1\fi:#2}{#3}{#4}% @@ -2283,14 +1939,10 @@ \def\executecommand#1#2#3% {\iflocation - \dostartgoto - \data - {#3}% - \start - \dostartexecutecommand\buttonwidth\buttonheight{#1}{#2}% - \stop - \dostopexecutecommand - \dostopgoto + \dohandlegoto + {#3}% + {\dostartexecutecommand\buttonwidth\buttonheight{#1}{#2}}% + {\dostopexecutecommand}% \else {#3}% \fi} @@ -2445,7 +2097,7 @@ \def\doref[#1][#2]% {\ifsecondargument \doifreferencefoundelse{#2} - {\doifundefinedelse{reftype#1}{\reftypep}{\getvalue{reftype#1}}} + {\executeifdefined{reftype#1}\reftypep} {\unknownreference{#2}\dummyreference}% \else \dummyreference @@ -2494,7 +2146,7 @@ \dogotospace{\thecurrentsubtextreference}[#1]} {\unknownreference{#1}\dummyreference}% \@@rfright - \referentieinfo{<}{#1}% + \referenceinfo{<}{#1}% \egroup} %D Typesetting the reference is a bit more complicated than one @@ -2571,7 +2223,7 @@ % {\egroup\dosymbolreference{#1}{#2}[#3]} % {\egroup\dowantedreference{#1}{#2}[#3]}} % {\dounknownreference{#1}{#2}[#3]}% -% \referentieinfo{<}{#3}% +% \referenceinfo{<}{#3}% % \egroup} %D The previously discussed setup macro lets us specify the @@ -2750,7 +2402,7 @@ % {#1}{#2}[#3]% % \fi} % {\dounknownreference{#1}{#2}[#3]}% -% \referentieinfo<{#3}% +% \referenceinfo<{#3}% % \global\let\leftofreference \empty % \global\let\rightofreference\empty % \global\let\textofreference \empty @@ -2786,7 +2438,7 @@ {#1}{#2}[#3]% \fi} {\dounknownreference{#1}{#2}[#3]}% - \referentieinfo<{#3}% + \referenceinfo<{#3}% \global\let\leftofreference \empty \global\let\rightofreference\empty \global\let\textofreference \empty @@ -2816,7 +2468,7 @@ % {\dosymbolreference{}{}[#2]} % {\dogotospace{#1}[#2]}} % {\unknownreference{#2}#1}% -% \referentieinfo{<}{#2}} +% \referenceinfo{<}{#2}} \def\dogoto#1[#2]% {\dontleavehmode @@ -2829,7 +2481,7 @@ {\dogotospace{#1}[#2]}} {\unknownreference{#2}#1\relax}% \relax catches lookahead \egroup - \referentieinfo{<}{#2}} + \referenceinfo{<}{#2}} \unexpanded\def\goto#1#2% {\dogoto{#1}#2} @@ -2883,7 +2535,7 @@ \doifreferencefoundelse{#2} {\dogotofixed{#1}[#2]} {\hbox{\unknownreference{#2}#1}}% - \referentieinfo{<}{#2}% + \referenceinfo{<}{#2}% \egroup} %D An reference to another document can be specified as a file @@ -3087,7 +2739,11 @@ \edef\otherfile{#2}}% \def\setouterlocation#1% - {\ifundefined{\v!file:::#1}% + {\ifcsname\v!file:::#1\endcsname + \let\doexternaldocument\setouterfilelocation % will change + \let\doexternalurl \setouterfilelocation % will change + \csname\v!file:::#1\endcsname + \else \ifconditional\forceURLlocation \edef\otherURL{#1}% \let\otherfile\empty @@ -3095,10 +2751,6 @@ \let\otherURL\empty \edef\otherfile{#1}% \fi - \else - \let\doexternaldocument\setouterfilelocation % will change - \let\doexternalurl \setouterfilelocation % will change - \csname\v!file:::#1\endcsname \fi \setfalse\forceURLlocation \doifparentfileelse\otherfile @@ -3144,19 +2796,19 @@ \egroup} \def\redospecialfrom[#1::#2]% - {\ifundefined{\v!file:::#1}% - \tttf[#1]% - \else + {\ifcsname\v!file:::#1\endcsname \def\doexternaldocument##1##2##3{\goto{##3}[#1::#2]}% \csname\v!file:::#1\endcsname + \else + \tttf[#1]% \fi} \def\nodospecialfrom[#1]% - {\ifundefined{\v!file:::#1}% - \tttf[#1]% - \else + {\ifcsname\v!file:::#1\endcsname \def\doexternaldocument##1##2##3{##3}% different than ^ \csname\v!file:::#1\endcsname + \else + \tttf[#1]% \fi} %D We also support: @@ -3248,12 +2900,11 @@ \def\program#1[#2]% {\bgroup - \ifundefined{\v!program:::#2}% - {\tttf[#2]}% - \else - \def\doprogram##1##2% - {\goto{\doifelsenothing{#1}{##2}{#1}}[\v!program(#2)]}% + \ifcsname\v!program:::#2\endcsname + \def\doprogram##1##2{\goto{\doifelsenothing{#1}{##2}{#1}}[\v!program(#2)]}% \csname\v!program:::#2\endcsname + \else + {\tttf[#2]}% \fi \egroup} @@ -3262,20 +2913,17 @@ \definespeciallocation\v!program#1#2% {\bgroup \iflocation - \doifdefinedelse{\v!program:::\currentreferenceoperation} - {\def\doprogram##1##2{\def\@@programfile{##1}}% - \getvalue{\v!program:::\currentreferenceoperation}} - {\let\@@programfile\currentreferenceoperation}% + \ifcsname\v!program:::\currentreferenceoperation\endcsname + \def\doprogram##1##2{\def\@@programfile{##1}}% + \getvalue{\v!program:::\currentreferenceoperation}% + \else + \let\@@programfile\currentreferenceoperation + \fi \convertcommand\@@programfile\to\ascii - \dostartgoto - \data - {#2}% - \start - \dostartrunprogram\buttonwidth\buttonheight - {\@@prdirectory\ascii}\currentreferencearguments - \stop - \dostoprunprogram - \dostopgoto + \dohandlegoto + {#2}% + {\dostartrunprogram\buttonwidth\buttonheight{\@@prdirectory\ascii}\currentreferencearguments}% + {\dostoprunprogram}% \else {#2}% \fi @@ -3340,65 +2988,6 @@ %D Because we combine both methods, we have to take care of %D the \type{file::page(n)} as well as \type{page(file::n)}. -% \definespeciallocation\v!pagina#1#2% -% {\iflocation -% \ifx\currentouterreference\empty -% \splitoffreference\currentreferenceoperation -% \else -% \let\currentinnerreference=\currentreferenceoperation -% \fi -% \ifx\currentouterreference\empty -% \doifnonzeropositiveelse{\currentinnerreference} -% {} -% {\edef\currentinnerreference{1}}% -% \gotorealpage\empty\empty\currentinnerreference{#2}% -% \else -% \setouterlocation\currentouterreference -% \doifnonzeropositiveelse{\currentinnerreference} -% {} -% {\doifdefinedelse{\v!pagina:::\currentinnerreference} -% {\edef\currentinnerreference{\getvalue{\v!pagina:::\currentinnerreference}}} -% {\edef\currentinnerreference{1}}}% -% \gotorealpage\otherURL\otherfile\currentinnerreference{#2}% -% \fi -% \else -% {#2}% -% \fi} - -% \definespeciallocation\v!pagina#1#2% page(n) page(+n) page(-n) -% {\iflocation -% \ifx\currentouterreference\empty -% \splitoffreference\currentreferenceoperation -% \else -% \let\currentinnerreference\currentreferenceoperation -% \fi -% \ifx\currentouterreference\empty -% \doifinstringelse+\currentinnerreference -% {\scratchcounter\realpageno -% \advance\scratchcounter \currentinnerreference -% \edef\currentinnerreference{\the\scratchcounter}} -% {\doifinstringelse-\currentinnerreference -% {\scratchcounter\realpageno -% \advance\scratchcounter \currentinnerreference -% \edef\currentinnerreference{\the\scratchcounter}} -% \donothing}% -% \doifnonzeropositiveelse\currentinnerreference -% \donothing -% {\edef\currentinnerreference{1}}% -% \gotorealpage\empty\empty\currentinnerreference{#2}% -% \else -% \setouterlocation\currentouterreference -% \doifnonzeropositiveelse\currentinnerreference -% \donothing -% {\doifdefinedelse{\v!pagina:::\currentinnerreference} -% {\edef\currentinnerreference{\getvalue{\v!pagina:::\currentinnerreference}}} -% {\edef\currentinnerreference{1}}}% -% \gotorealpage\otherURL\otherfile\currentinnerreference{#2}% -% \fi -% \else -% {#2}% -% \fi} - \definespeciallocation\v!page#1#2% page(n) page(+n) page(-n) {\iflocation \ifx\currentouterreference\empty @@ -3407,6 +2996,7 @@ \let\currentinnerreference\currentreferenceoperation \fi \ifx\currentouterreference\empty +% numexpr \doifinstringelse+\currentinnerreference {\scratchcounter\realpageno \advance\scratchcounter \currentinnerreference @@ -3426,9 +3016,11 @@ \setouterlocation\currentouterreference \doifnonzeropositiveelse\currentinnerreference \donothing - {\doifdefinedelse{\v!page:::\currentinnerreference} - {\edef\currentinnerreference{\getvalue{\v!page:::\currentinnerreference}}} - {\edef\currentinnerreference{1}}}% + {\ifcsname\v!page:::\currentinnerreference\endcsname + \edef\currentinnerreference{\getvalue{\v!page:::\currentinnerreference}}% + \else + \edef\currentinnerreference{1}% + \fi}% \gotorealpage\otherURL\otherfile\currentinnerreference{#2}% \fi \else @@ -3464,7 +3056,7 @@ {\dogotospace{#2}[#4]}% \fi} {\unknownreference{#4}#1/#2}% - \referentieinfo{<}{#4}} + \referenceinfo{<}{#4}} \unexpanded\def\atpage[#1]% {\dontleavehmode @@ -3481,7 +3073,7 @@ \fi} {\unknownreference{#1}% \labeltexts\v!page\dummyreference}% - \referentieinfo{<}{#1}} + \referenceinfo{<}{#1}} %D We can cross link documents by using: %D @@ -3522,10 +3114,10 @@ \stopnointerference}% \douseexternaldocument[#1][#2][#4]% \doglobal\addtocommalist{#1}\crossdocumentreferences - \def\docommando##1% + \def\docommand##1% {\letgvalue{\??rf##1\c!state}\v!start % for fast checking \doglobal\addtocommalist{##1}\crossdocumentelements}% - \processcommalist[#3]\docommando + \processcommalist[#3]\docommand \ifutilitydone \global\autocrossdocumenttrue \fi @@ -3539,8 +3131,7 @@ \def\checkcontrastreference#1% {\ifnum\currentreferencetype=\rt!page\ifnum\currentdatareference=\realpageno - \doifdefined{#1\c!contrastcolor} - {\setevalue{#1\c!color}{\getvalue{#1\c!contrastcolor}}}% + \doifdefined{#1\c!contrastcolor}{\setevalue{#1\c!color}{\getvalue{#1\c!contrastcolor}}}% \fi\fi} \def\checkcontrastreference#1% @@ -3777,8 +3368,6 @@ \c!expansion=\v!no, \c!separator=\nonbreakablespace] -\let\nonbreakablespace=~ - \setupurl [\c!alternative=\v!both, \c!space=\v!no, diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex index 309aee2f9..bd64bd6ad 100644 --- a/tex/context/base/core-reg.tex +++ b/tex/context/base/core-reg.tex @@ -69,9 +69,8 @@ {\dotripleempty\dosetupregister} \def\getlastregisterentry#1% - {\def\docommando##1% - {\def\!!stringa{##1}}% - \processseparatedlist[#1][+]\docommando + {\def\docommand##1{\def\!!stringa{##1}}% + \processseparatedlist[#1][+]\docommand \!!stringa} \def\registerparameter#1{\csname\??id\currentregister#1\endcsname} @@ -80,61 +79,37 @@ % % \index[Ätsch]{Ätsch} test \index{QÄtsch} test \index[ratsch]{RÄtsch} test -% \def\doprocesspageregister[#1]#2#3% key altnum entry -% {\begingroup -% \thisisnextinternal\s!ind -% \ifduplicate\getlastregisterentry{#3}\fi -% \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA -% \convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryB -% \doifsomething{\registerparameter\c!keyexpansion} -% {\ifx\asciiregisterentryA\empty -% \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA -% \fi}% -% \makesectionformat -% \doifelse{\registerparameter\c!ownnumber}\v!yes -% \donetrue\donefalse -% % the spaces between } { are essential for texutil's split -% \expanded -% {\writeutility% -% {r \ifcase\registerpagestatus\space\or e \or f \or t \fi -% {\currentregister} % -% {\nextinternalreference} % -% {\asciiregisterentryA} % -% {\asciiregisterentryB} % -% {\sectionformat\sectionseparator\sectionseparator -% \ifdone#2\else\noexpand\pagenumber\fi} % -% {\noexpand\realfolio}}}% -% \getfirstcharacter\currentregister -% \registerinfo{> \firstcharacter}{#3}% -% \endgroup} +\newif\ifwritetoregister \writetoregistertrue \def\doprocesspageregister[#1]#2#3% key altnum entry - {\begingroup - \thisisnextinternal\s!ind - \ifduplicate\getlastregisterentry{#3}\fi - \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA - \convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryB - \doifsomething{\registerparameter\c!keyexpansion} - {\ifx\asciiregisterentryA\empty - \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA - \fi}% - \makesectionformat - \doifelse{\registerparameter\c!ownnumber}\v!yes - \donetrue\donefalse - % the spaces between } { are essential for texutil's split - \expanded - {\writeutility% - {r \ifcase\registerpagestatus\space\or e \or f \or t \fi - {\currentregister} % - {\nextinternalreference} % - {\asciiregisterentryA} % - {\asciiregisterentryB} % - {\sectionformat\sectionseparator\sectionseparator - \ifdone#2\else\noexpand\pagenumber\fi} % - {\noexpand\realfolio}}}% - \getfirstcharacter\currentregister - \registerinfo{> \firstcharacter}{#3}% - \endgroup} + {\ifwritetoregister + \begingroup + \thisisnextinternal\s!ind + \ifduplicate\getlastregisterentry{#3}\fi + \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA + \convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryB + \doifsomething{\registerparameter\c!keyexpansion} + {\ifx\asciiregisterentryA\empty + \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA + \fi}% + \makesectionformat + \doifelse{\registerparameter\c!ownnumber}\v!yes + \donetrue\donefalse + % the spaces between } { are essential for texutil's split + \expanded + {\writeutility% + {r \ifcase\registerpagestatus\space\or e \or f \or t \fi + {\currentregister} % + {\nextinternalreference} % + {\asciiregisterentryA} % + {\asciiregisterentryB} % + {\sectionformat\sectionseparator\sectionseparator + \ifdone#2\else\noexpand\pagenumber\fi} % + {\noexpand\realfolio}}}% + \getfirstcharacter\currentregister + \registerinfo{> \firstcharacter}{#3}% + \endgroup + \fi} \def\doregister#1% {\chardef\registerpagestatus\plusone @@ -146,11 +121,6 @@ \def\donoregister[#1]% {\dodoregister[#1]{}} -% \def\dodoregister[#1]#2#3% -% {\doprocesspageregister[#1]{#2}{#3}% -% \ifvmode\nobreak\fi -% \GotoPar} - % \long\def\doflushatpar#1% % %{\dogotopar{#1}} % %{\dogotopar{\dontleavehmode#1}} % this one can introduce empty lines @@ -193,7 +163,8 @@ \dodoregister[#2]{}{#3}} % key altnum entry \def\doprocessseeregister[#1]#2#3% - {\begingroup + {\ifwritetoregister + \begingroup \thisisnextinternal\s!ind \ifduplicate\getlastregisterentry{#2}\fi \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA @@ -213,8 +184,9 @@ {\asciiregisterentryB} % {\asciiregisterentryC} % {\sectionformat}}}% - \endgroup - \registerinfo{> see}{#2}} + \endgroup + \registerinfo{> see}{#2}% + \fi} \def\complexdoseeregister[#1]#2#3% {\doflushatpar{\doprocessseeregister[#1]{#2}{#3}}} @@ -249,7 +221,9 @@ {\nextregisterpage \hbox to 1em{\hss\doregisterpagehowto{#1}{#2}\hss}} -\def\setregisterpage#1% +% todo: \installregisterpagehandler + +\def\setregisterpage#1% todo: currentregister gebruiken {\let\registerpageseparator\empty \processaction [\getvalue{\??id#1\c!symbol}] @@ -260,18 +234,37 @@ 1=>{\def\doregisterpage##1[##2]% {\doregisterpagelocation{#1}{$\bullet$}}}, 2=>{\def\doregisterpage##1[##2]% - {\doregisterpagelocation{#1}{\vrule\!!width1em\!!height1ex\!!depth\!!zeropoint}}}, + {\doregisterpagelocation{#1}{\vrule\!!width1em\!!height1ex\!!depth\zeropoint}}}, \v!none=>{\def\doregisterpage##1[##2]{}},% \s!unknown=>{\def\registerpagesymbol{\getvalue{\??id#1\c!symbol}}% \def\doregisterpage##1[##2]% {\doregisterpagelocation{#1}{\registerpagesymbol}}}, - \s!default=>{\def\registerpageseparator% - {,}% - \def\doregisterpage##1[##2]% - {\doregisterpagehowto{##1} - {\strut - \pageprefix{\??id##1}[##2]% - \translatednumber[##2]}}}]} + \s!default=>{\def\registerpageseparator{,}% + \let\doregisterpage\doregisterpagedefault}]} + +\def\doregisterpagedefault#1[#2]% + {\doregisterpagehowto{#1}{\strut\pageprefix{\??id#1}[#2]\translatednumber[#2]}} + +% test case +% +% \starttext +% \placelist[section][criterium=all] \blank[2*big] +% \placeregister[index][compress=no] \blank[2*big] +% \placeregister[index][compress=no,sectionnumber=yes] \blank[2*big] +% \placeregister[index][compress=yes] \page +% test text \index{test index} +% \section{heading} +% more test text \index{test index} +% \section{heading} +% more test text \index{test index} +% \page +% \section{heading text \index{test index}} +% more test text \index{test index} +% \page +% test text \index{test index} +% \section{heading text \index{test index}} +% more test text \index{test index} +% \stoptext \let\registerpagehowto\empty \let\registertexthowto\empty @@ -320,8 +313,6 @@ \let\c!entryb =\relax \let\c!entryc =\relax -\chardef\lastregisterpagestatus=0 - \def\limitedregisterentry#1#2% {\getvalue{\??id#1\c!textcommand}% {\doifelsenothing{\??id#1\c!maxwidth} @@ -331,74 +322,6 @@ \def\dosetpageregisterpage#1#2#3#4#5#6% {\doifreglevelelse[#5]{\dodosetpageregisterpage{#1}{#2}{#3}{#4}{#5}{#6}}{}} -% \def\dodosetpageregisterpage#1#2#3#4#5#6% -% {\global\utilitydonetrue -% \c!entryletter -% \setregisterhowto[#3]% -% \def\dohandleregisterentry##1% -% {\bgroup -% \if!!donea % \strut nieuw -% %\setbox0\hbox{\showlocation{\doregistertexthowto{#2} -% % {\strut\limitedregisterentry{#2}{##1}}}}% -% % \gotonextinternal\s!ind{#4}{#6}{\box0}% -% % -% \hhboxindent\hangindent % maybe also left and right skip -% \setbox0\hbox{\doregistertexthowto{#2}{\strut\limitedregisterentry{#2}{##1}}}% -% \unhhbox0\with{\gotonextinternal\s!ind{#4}{#6}{\box\hhbox}}% -% % -% \else -% \doregistertexthowto{#2}{##1}% -% \fi -% \egroup -% \!!doneafalse}% -% \!!doneafalse -% \doifelsevalue{\??id#2\c!interaction}\v!text -% {\ifcase\currententrylevel \or -% \!!doneatrue\c!entrya\c!entryb\c!entryc \or -% \c!entrya\!!doneatrue\c!entryb\c!entryc \or -% \c!entrya\c!entryb\!!doneatrue\c!entryc \fi} -% {\c!entrya\c!entryb\c!entryc}% -% \global\let\c!entrya\relax -% \global\let\c!entryb\relax -% \global\let\c!entryc\relax -% \global\let\c!entryletter\relax -% \global\let\c!entryreference\relax -% % \global\firstregisterentrytrue -% \iffirstregisterpage -% \global\chardef\lastregisterpagestatus\zerocount -% \expandafter\hskip\getvalue{\??id#2\c!distance}\relax -% \donetrue -% \else\ifnum#1=3 -% |--|\relax % -- ! -% \donetrue -% \else\ifnum\lastregisterpagestatus=2 -% \donefalse % waiting for "to" pagenumber -% \else -% \registerpageseparator -% |\space|\relax % \relax needed because | looks ahead -% \donetrue -% \fi\fi\fi -% \ifdone -% \begingroup -% % -% \doifelsevalue{\??id#2\c!prefix}\v!none % default v!both -% {\chardef\pageprefixmode\zerocount}% -% {\doifvalue{\??id#2\c!prefix}\v!first % only first in range (1.2-4) -% {\ifnum#1=3 \chardef\pageprefixmode\zerocount \fi}}% -% % -% \doifelsevalue{\??id#2\c!interaction}\v!pagenumber -% {\bgroup -% \setbox0\hbox -% {\showlocation{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% -% \gotonextinternal{\s!ind}{#4}{#6}{\box0}%{\copy0}% -% \egroup} -% {\hbox{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% -% \endgroup -% \ignorespaces -% \global\chardef\lastregisterpagestatus#1\relax -% \fi -% \global\firstregisterpagefalse} - \def\dodosetpageregisterpageA#1#2#3#4#5#6% {\global\utilitydonetrue \c!entryletter @@ -428,41 +351,33 @@ \global\let\c!entryreference\relax} \def\dodosetpageregisterpageB#1#2#3#4#5#6% - {% \global\firstregisterentrytrue - \iffirstregisterpage - \global\chardef\lastregisterpagestatus\zerocount - \expandafter\hskip\getvalue{\??id#2\c!distance}\relax - \donetrue - \else\ifnum#1=3 - |--|\relax % -- ! - \donetrue - \else\ifnum\lastregisterpagestatus=2 - \donefalse % waiting for "to" pagenumber - \else - \registerpageseparator - |\space|\relax % \relax needed because | looks ahead - \donetrue - \fi\fi\fi - \ifdone - \begingroup - % - \doifelsevalue{\??id#2\c!prefix}\v!none % default v!both - {\chardef\pageprefixmode\zerocount}% - {\doifvalue{\??id#2\c!prefix}\v!first % only first in range (1.2-4) - {\ifnum#1=3 \chardef\pageprefixmode\zerocount \fi}}% - % - \doifelsevalue{\??id#2\c!interaction}\v!pagenumber - {\bgroup - \setbox0\hbox - {\showlocation{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% - \gotonextinternal{\s!ind}{#4}{#6}{\box0}%{\copy0}% - \egroup} - {\hbox{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% - \endgroup - \ignorespaces - \global\chardef\lastregisterpagestatus#1\relax - \fi - \global\firstregisterpagefalse} + {\iffirstregisterpage + \expandafter\hskip\getvalue{\??id#2\c!distance}\relax + \else\ifnum#1=3 + \strut|--|\relax % -- ! + \else + % \relax after space needed because | looks ahead + \strut\registerpageseparator|\space|\relax + \fi\fi + \iftrue % \iftrue ...\fi to preserve indentation, can be folded out + \begingroup + % + \doifelsevalue{\??id#2\c!prefix}\v!none % default v!both + {\chardef\pageprefixmode\zerocount}% + {\doifvalue{\??id#2\c!prefix}\v!first % only first in range (1.2-4) + {\ifnum#1=3 \chardef\pageprefixmode\zerocount \fi}}% + % + \doifelsevalue{\??id#2\c!interaction}\v!pagenumber + {\bgroup + \setbox0\hbox{\showlocation{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% + \gotonextinternal{\s!ind}{#4}{#6}{\box0}%{\copy0}% + \egroup} + {\hbox{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}% + \endgroup + \ignorespaces + \relax + \fi + \global\firstregisterpagefalse} \def\resetseenregisterpage {\global\let\firstseenregisterreal \relax @@ -477,27 +392,61 @@ \def\dodosetpageregisterpageC#1#2#3#4#5#6% {\xdef\currentseenregisterpage{#5}% \xdef\currentseenregisterreal{#6}% - \gdef\flushseenregisterpage{\doflushseenregisterpage{#1}{#2}{#3}{#4}}% \ifx\firstseenregisterreal\relax + % no range yet \global\let\firstseenregisterreal\currentseenregisterreal \global\let\firstseenregisterpage\currentseenregisterpage \global\let\lastseenregisterreal \currentseenregisterreal \global\let\lastseenregisterpage \currentseenregisterpage + \else\ifnum\lastseenregisterreal=\currentseenregisterreal\relax + % same page (catch error) \else\ifnum\numexpr\lastseenregisterreal+\plusone\relax=\currentseenregisterreal\relax \global\let\lastseenregisterreal \currentseenregisterreal \global\let\lastseenregisterpage \currentseenregisterpage \else - \ifx\firstseenregisterreal\lastseenregisterreal - \expanded{\dodosetpageregisterpageB{1}{#2}{#3}{#4}{\lastseenregisterpage}{\lastseenregisterreal}}% - \else - \expanded{\dodosetpageregisterpageB{2}{#2}{#3}{#4}{\firstseenregisterpage}{\firstseenregisterreal}}% - \expanded{\dodosetpageregisterpageB{3}{#2}{#3}{#4}{\lastseenregisterpage }{\lastseenregisterreal }}% - \fi - \global\let\firstseenregisterreal\currentseenregisterreal - \global\let\firstseenregisterpage\currentseenregisterpage - \global\let\lastseenregisterreal \currentseenregisterreal - \global\let\lastseenregisterpage \currentseenregisterpage - \fi\fi} + \global\let\savedcurrentseenregisterreal\currentseenregisterreal + \global\let\savedcurrentseenregisterpage\currentseenregisterpage + \flushseenregisterpage + \global\let\firstseenregisterreal\savedcurrentseenregisterreal + \global\let\firstseenregisterpage\savedcurrentseenregisterpage + \global\let\lastseenregisterreal \savedcurrentseenregisterreal + \global\let\lastseenregisterpage \savedcurrentseenregisterpage + \fi\fi\fi + \gdef\flushseenregisterpage{\doflushseenregisterpage{#1}{#2}{#3}{#4}}} + +% \def\dodosetpageregisterpageC#1#2#3#4#5#6% +% {\xdef\currentseenregisterpage{#5}% +% \xdef\currentseenregisterreal{#6}% +% \firstregisterpagefalse +% \gdef\flushseenregisterpage{\doflushseenregisterpage{#1}{#2}{#3}{#4}}% +% \ifx\firstseenregisterreal\relax +% % no range yet +% \global\let\firstseenregisterreal\currentseenregisterreal +% \global\let\firstseenregisterpage\currentseenregisterpage +% \global\let\lastseenregisterreal \currentseenregisterreal +% \global\let\lastseenregisterpage \currentseenregisterpage +% \else\ifnum\firstseenregisterreal=\currentseenregisterreal\relax +% \global\let\firstseenregisterreal\currentseenregisterreal +% \global\let\firstseenregisterpage\currentseenregisterpage +% \global\let\lastseenregisterreal \currentseenregisterreal +% \global\let\lastseenregisterpage \currentseenregisterpage +% \else\ifnum\lastseenregisterreal=\currentseenregisterreal\relax +% \global\let\lastseenregisterpage \currentseenregisterpage +% \else\ifnum\numexpr\lastseenregisterreal+\plusone\relax=\currentseenregisterreal\relax +% \global\let\lastseenregisterreal \currentseenregisterreal +% \global\let\lastseenregisterpage \currentseenregisterpage +% \else +% % back up, flush, go on +% \global\let\savedcurrentseenregisterreal\currentseenregisterreal +% \global\let\savedcurrentseenregisterpage\currentseenregisterpage +% \let\currentseenregisterpage\lastseenregisterpage +% \let\currentseenregisterreal\lastseenregisterreal +% \flushseenregisterpage +% \global\let\firstseenregisterreal\savedcurrentseenregisterreal +% \global\let\firstseenregisterpage\savedcurrentseenregisterpage +% \global\let\lastseenregisterreal \savedcurrentseenregisterreal +% \global\let\lastseenregisterpage \savedcurrentseenregisterpage +% \fi\fi\fi\fi} \def\doflushseenregisterpage#1#2#3#4% {\global\let\flushseenregisterpage\relax @@ -526,8 +475,13 @@ {\dodosetpageregisterpageA{#1}{#2}{#3}{#4}{#5}{#6}% \dodosetpageregisterpageB{#1}{#2}{#3}{#4}{#5}{#6}} +% \def\dodosetpageregisterpagecollapsed#1#2#3#4#5#6% +% {\dodosetpageregisterpageA{#1}{#2}{#3}{#4}{#5}{#6}% +% \dodosetpageregisterpageC{#1}{#2}{#3}{#4}{#5}{#6}} + \def\dodosetpageregisterpagecollapsed#1#2#3#4#5#6% - {\dodosetpageregisterpageA{#1}{#2}{#3}{#4}{#5}{#6}% + {\ifx\firstseenregisterreal\relax\flushseenregisterpage\fi + \dodosetpageregisterpageA{#1}{#2}{#3}{#4}{#5}{#6}% \dodosetpageregisterpageC{#1}{#2}{#3}{#4}{#5}{#6}} % test case for collapsing (experimental, for Steffen Wolfrum) @@ -564,9 +518,8 @@ \global\let\c!entryc\relax \global\let\c!entryletter\relax \global\let\c!entryreference\relax - \global\chardef\lastregisterpagestatus\zerocount % \global\firstregisterentrytrue - \global\firstregisterpagefalse}} + \global\firstregisterpagetrue}} {}} %D Extended with variant: @@ -699,7 +652,6 @@ \global\firstsubentrytrue \global\firstsubsubentrytrue \setregisterpage{#1}% - \chardef\lastregisterpagestatus\zerocount \setvalue{#1\s!entrya}{\dosetpageregisterentrya {#1}}% \setvalue{#1\s!entryb}{\dosetpageregisterentryb {#1}}% \setvalue{#1\s!entryc}{\dosetpageregisterentryc {#1}}% @@ -763,7 +715,7 @@ \fi \fi % aangepast - \def\dodocommando[##1-##2]% + \def\dodocommand[##1-##2]% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}% \doifelsevalue{\??id#1\c!interaction}\v!pagenumber {\limitedregisterentry{#1}{#2}} % paginanummer @@ -772,25 +724,25 @@ \ifx\midlistreference\empty \box0 \else - \expandafter\dodocommando\expandafter[\midlistreference]% + \expandafter\dodocommand\expandafter[\midlistreference]% \fi \else - \expandafter\dodocommando\expandafter[\firstlistreference]% + \expandafter\dodocommand\expandafter[\firstlistreference]% \fi}}% \doifvalue{\??id#1\c!number}\v!yes {\hskip\getvalue{\??id#1\c!distance}(\commalistsize)}% \doifnotvalue{\??id#1\c!interaction}\v!text % paginanummer,alles - {\def\docommando##1##2% + {\def\docommand##1##2% {{\setbox0\hbox{\showlocation{\hbox to 1em{\hss\symbol[##2]\hss}}}% \ifx##1\empty % \hskip\wd0 % (optioneel maken) \else - \expandafter\dodocommando\expandafter[##1]% + \expandafter\dodocommand\expandafter[##1]% \fi}}% \hskip\getvalue{\??id#1\c!distance}% - \docommando\firstlistreference\v!previous - \docommando\midlistreference\v!somewhere - \docommando\lastlistreference\v!next}% + \docommand\firstlistreference\v!previous + \docommand\midlistreference\v!somewhere + \docommand\lastlistreference\v!next}% % tot hier \else % no \endgraf @@ -857,8 +809,9 @@ \ifcase0\countervalue{autolink:#1}\relax % only once \begingroup \let\dosetregister\doloadregisterlinks + \def\currentregister{#1}% \setupregister[#1][#2]% - \doutilities{#1}\jobname{#1}\relax\relax + \doutilities{#1}{\registerparameter\c!file}{#1}\relax\relax \endgroup \ifautoregisterhack \doinitializeautoregister{#1}% @@ -871,10 +824,10 @@ \def\coupleregister {\dodoubleempty\docoupleregister} -\def\dodocommandoprolinrefAA[#1-#2]% +\def\dodocommandprolinrefAA[#1-#2]% {\def\lastlistreference{#1-#2}} -\def\dodocommandoprolinrefA[#1-#2]% +\def\dodocommandprolinrefA[#1-#2]% {\def\lastlistreference{#1-#2}% \ifx\firstlistreference\empty \let\firstlistreference\lastlistreference @@ -883,24 +836,24 @@ \let\prevlistreference\lastlistreference \else\ifnum#1>\nextinternalreference\relax \let\nextlistreference\lastlistreference - \let\dodocommandoprolinrefA\dodocommandoprolinrefAA + \let\dodocommandprolinrefA\dodocommandprolinrefAA \else \let\selflistreference\lastlistreference \fi\fi} -\def\docommandoprolinrefA#1% - {\dodocommandoprolinrefA[#1]} +\def\docommandprolinrefA#1% + {\dodocommandprolinrefA[#1]} -\def\dodocommandoprolinrefB[#1-#2]% +\def\dodocommandprolinrefB[#1-#2]% {\gotonextinternal{\s!ind}{#1}{#2}{\box0}} -\def\docommandoprolinrefB#1#2#3% +\def\docommandprolinrefB#1#2#3% {\bgroup \ifx#2\empty \doifvalue{\??id#1\c!unknownreference}\v!empty{\hskip1em}% \else \setbox0\hbox to 1em{\hss\showlocation{\symbol[#3]}\hss}% - \expandafter\dodocommandoprolinrefB\expandafter[#2]% + \expandafter\dodocommandprolinrefB\expandafter[#2]% \fi \egroup} @@ -914,7 +867,7 @@ \let\nextlistreference\empty \getalllistreferences{#1}{#3}% \ifx\alllistreferences\empty \else - \expanded{\rawprocesscommalist[\alllistreferences]}\docommandoprolinrefA + \expanded{\rawprocesscommalist[\alllistreferences]}\docommandprolinrefA \fi \ifx\prevlistreference\empty \let\prevlistreference\lastlistreference @@ -929,11 +882,11 @@ \setalignmentswitch{\getvalue{\??id#1\c!location}}% \ifcase\alignmentswitch % links - \docommandoprolinrefB{#1}\prevlistreference\v!previous - \docommandoprolinrefB{#1}\nextlistreference\v!next + \docommandprolinrefB{#1}\prevlistreference\v!previous + \docommandprolinrefB{#1}\nextlistreference\v!next \or % midden - \docommandoprolinrefB{#1}\prevlistreference\v!previous + \docommandprolinrefB{#1}\prevlistreference\v!previous \or % rechts \fi @@ -946,31 +899,13 @@ % links \or % midden - \docommandoprolinrefB{#1}\nextlistreference\v!next + \docommandprolinrefB{#1}\nextlistreference\v!next \or % rechts - \docommandoprolinrefB{#1}\prevlistreference\v!previous - \docommandoprolinrefB{#1}\nextlistreference\v!next + \docommandprolinrefB{#1}\prevlistreference\v!previous + \docommandprolinrefB{#1}\nextlistreference\v!next \fi}} -% \def\dodolinkedregister[#1][#2]#3% page auto link -% {\bgroup -% \chardef\registerpagestatus\plusone -% \def\currentregister{#1}% -% \iflocation -% \ifautoregisterhack -% \def\next{\doprocessautoregister[#1][#2]}% -% \else -% \def\next{\doprocesslinkregister[#1][#2]}% -% \fi -% \else -% \def\next{\doprocesspageregister[#2]{}}% -% \fi -% \next{#3}% -% \egroup -% \ifvmode\nobreak\fi -% \GotoPar} - \def\doprocesslinkedregister[#1][#2]#3% page auto link {\bgroup \chardef\registerpagestatus\plusone @@ -1092,7 +1027,7 @@ \c!align=\registerparameter\c!align]% \dontcomplain \startpacked[\v!blank]% - \doutilities\currentregister\jobname\currentregister\dobeforeplaceregister\doafterplaceregister + \doutilities\currentregister{\registerparameter\c!file}\currentregister\dobeforeplaceregister\doafterplaceregister \stoppacked \stopcolumns \endgroup @@ -1151,6 +1086,7 @@ \c!prefix=\v!both, \c!expansion=, \c!keyexpansion=, + \c!file=\jobname, %\c!deeptextcommand=, % undefined by default ! \s!language=\currentmainlanguage]% \doglobal\appendtoksonce @@ -1176,6 +1112,7 @@ \def\dodetermineregistercharacteristics[#1][#2]% {\begingroup + \def\currentregister{#1}% \setupregister[#1][#2]% \dosetreglevel{#1}% \setvalue{#1\s!from}% @@ -1186,8 +1123,7 @@ \global\utilitydonetrue} {}}% \doglobal\newcounter\utilityregisterlength - \setbox0\vbox - {\doutilities{#1}\jobname{#1}\relax\relax}% + \setbox0\vbox{\doutilities{#1}{\registerparameter\c!file}{#1}\relax\relax}% \endgroup \ifregistergeplaatst \setsystemmode \v!register diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index 30b06403c..1ac7edc28 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -13,8 +13,13 @@ \writestatus{loading}{Context Core Macros / Ruled Content Handling} +%D This module is now etex dependent. + \unprotect +%D We have removed the rather old and out dated raster methods. They +%D have not been used for ages. + %D \macros %D {linewidth, setuplinewidth} %D @@ -36,13 +41,6 @@ \def\setuplinewidth {\dosingleargument\dosetuplinewidth} -% \def\dosetuprules[#1]% -% {\getparameters[\??ln][#1]% -% \setuplinewidth[\@@lndikte]} -% -% \def\setuprules -% {\dosingleargument\dosetuprules} - %D \macros %D {ruledlinewidth, inheritruledlinewidth} %D @@ -52,85 +50,80 @@ \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 -%D method looks like: -%D -%D \starttyping -%D \def\methodegraybox -%D \width#1\height#2\depth#3\raster#4\corner#5\radius#6\\% -%D { ... } -%D \stoptyping -%D -%D The string \type{graybox} is a common element in the name, -%D so we can have for instance \type {\postscriptgraybox} or -%D \type {\texgraybox}. The first three arguments take a -%D dimension, the fourth one takes a number between~0 and~1, -%D and the last argument specifies a radius of the box when -%D rounded corners are used, so: -%D -%D \startbuffer -%D \dotgraybox -%D \width.5\hsize\height1cm\depth0cm\raster.85\corner\v!no\radius0pt\\ -%D \stopbuffer -%D -%D \typebuffer -%D -%D becomes: -%D -%D %\startlinecorrection -%D % \vbox to 1cm{\getbuffer} -%D %\stoplinecorrection -%D -%D \startlinecorrection -%D \unprotect -%D \vbox to 1cm -%D {\dotgraybox -%D \width.5\hsize\height1cm\depth0cm\raster.85\corner\v!no\radius0pt\\} -%D \protect -%D \stoplinecorrection -%D -%D There are two predefined methodes, one uses periods and the -%D other uses small rules. The second method is less -%D efficient, but sometimes give better results. The dimensions -%D of the resullting box are set to zero. - -\setvalue{\v!dot graybox}{\processraster\symbol\rasterdot} -\setvalue{\v!rule graybox}{\processraster\symbol\rasterbox} - -\def\rasterdot{\rasterfont.} -\def\rasterbox{\hss\vrule\!!width.4pt\!!height.4pt\!!depth\zeropoint} - -%D Now of course we need: - -\ifx\rasterfont\undefined \def\rasterfont{\fivepoint} \fi - -%D We implement two pure \TEX\ based generators, that use -%D \type{\leaders} to quickly gerenate the gray pattern. One -%D should beware of \DIMENSION\ conflicts, so we use some -%D registers above~8. These macros are memory hungry and byte -%D spoiling. - -\def\processraster - \symbol#1\width#2\height#3\depth#4\raster#5\corner#6\radius#7\\% - {\bgroup - \forgetall - \dontcomplain - \dimen10=\onepoint - \dimen10=\@@rsfactor\dimen10 - \dimen10=#5\dimen10 - \setbox2\hbox to #2 - {\cleaders\hbox to 2\dimen10{#1\hss}\hss}% - \dimen12=#3% - \advance\dimen12 #4% - \setbox0\vbox to \dimen12 - {\cleaders\vbox to 2\dimen10{\box2\vss}\vss}% - \setbox0\hbox - {\hskip-.5\dimen10\lower0.5\dimen10\copy0 - \hskip-\wd0\hskip\dimen10\lower1.5\dimen10\box0}% - \box0 - \egroup} +% %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 +% %D method looks like: +% %D +% %D \starttyping +% %D \def\methodegraybox#1#2#3#4#5#6% +% %D { ... } +% %D \stoptyping +% %D +% %D The string \type{graybox} is a common element in the name, +% %D so we can have for instance \type {\postscriptgraybox} or +% %D \type {\texgraybox}. The first three arguments take a +% %D dimension, the fourth one takes a number between~0 and~1, +% %D and the last argument specifies a radius of the box when +% %D rounded corners are used, so: +% %D +% %D \startbuffer +% %D \dotgraybox{.5\hsize}{1cm}{0cm}{.85}{\v!no}{0pt} +% %D \stopbuffer +% %D +% %D \typebuffer +% %D +% %D becomes: +% %D +% %D %\startlinecorrection +% %D % \vbox to 1cm{\getbuffer} +% %D %\stoplinecorrection +% %D +% %D \startlinecorrection +% %D \unprotect +% %D \vbox to 1cm{\dotgraybox{.5\hsize}{1cm}{0cm}{.85}{\v!no}{0pt}} +% %D \protect +% %D \stoplinecorrection +% %D +% %D There are two predefined methodes, one uses periods and the +% %D other uses small rules. The second method is less +% %D efficient, but sometimes give better results. The dimensions +% %D of the resullting box are set to zero. +% +% \setvalue{\v!dot graybox}{\processraster\symbol\rasterdot} +% \setvalue{\v!rule graybox}{\processraster\symbol\rasterbox} +% +% \def\rasterdot{\rasterfont.} +% \def\rasterbox{\hss\vrule\!!width.4pt\!!height.4pt\!!depth\zeropoint} +% +% %D Now of course we need: +% +% \ifx\rasterfont\undefined \def\rasterfont{\fivepoint} \fi +% +% %D We implement two pure \TEX\ based generators, that use +% %D \type{\leaders} to quickly gerenate the gray pattern. One +% %D should beware of \DIMENSION\ conflicts, so we use some +% %D registers above~8. These macros are memory hungry and byte +% %D spoiling. +% +% \def\processraster#1#2#3#4#5#6#7% +% {\bgroup +% \forgetall +% \dontcomplain +% \dimen10=\onepoint +% \dimen10=\@@rsfactor\dimen10 +% \dimen10=#5\dimen10 +% \setbox2\hbox to #2 +% {\cleaders\hbox to 2\dimen10{#1\hss}\hss}% +% \dimen12=#3% +% \advance\dimen12 #4% +% % \setbox0\vbox to \dimen12 +% {\cleaders\vbox to 2\dimen10{\box2\vss}\vss}% +% \setbox0\hbox +% {\hskip-.5\dimen10\lower0.5\dimen10\copy0 +% \hskip-\wd0\hskip\dimen10\lower1.5\dimen10\box0}% +% \box0 +% \egroup} %D \macros %D {setupscreens} @@ -143,108 +136,141 @@ \def\setupscreens {\dodoubleargument\getparameters[\??rs]} -%D The most appropriate way to call for this feature is -%D using \type{\graybox}, which is defined as: - -\def\graybox{\getvalue{\@@rsmethod graybox}} - -%D This macro takes the five arguments mentioned earlier and -%D obey the user's settings. - -%D We just introduced two pure \TEX\ methods for generating -%D rasters. However, it's far more efficient and comfortable in -%D terms of speed, memory usage and file size, to use a driver -%D supported method. - -\setvalue{\v!external graybox}\width#1\height#2\depth#3\raster#4\corner#5\radius#6\\% - {\setgraybox\width#1\height#2\depth#3\raster#4\corner#5\radius#6\\} - -%D For compatibility reasons we also define the original one: - -\setvalue{\v!postscript graybox}% - {\getvalue{\v!external graybox}} - -%D A quite valid way of letting drivers do the job, is giving -%D a solid rule a gray texture. - -\def\raster[#1]% - {\groupedcommand{\startraster[#1]}{\stopraster}} - -\def\setgraybox\width#1\height#2\depth#3\raster#4\corner#5\radius#6\\% - {\doifelsenothing{#4} % avoid black rules when no gray - {\dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\} - {\raster[#4]% - {\dofilledbox \width#1\height#2\depth#3\corner#5\radius#6\\}}} +% %D The most appropriate way to call for this feature is +% %D using \type{\graybox}, which is defined as: +% +% \def\graybox{\getvalue{\@@rsmethod graybox}} +% +% %D We just introduced two pure \TEX\ methods for generating +% %D rasters. However, it's far more efficient and comfortable in +% %D terms of speed, memory usage and file size, to use a driver +% %D supported method. +% +% \setvalue{\v!external graybox}{\setgraybox} +% +% %D For compatibility reasons we also define the original one: +% +% \setvalue{\v!postscript graybox}{\getvalue{\v!external graybox}} +% +% %D A quite valid way of letting drivers do the job, is giving +% %D a solid rule a gray texture. -%D The auxiliary macro is defined as: +%D We will communicate through module specific variables, current +%D framed parameters and some reserved dimension registers. -\def\dophantombox#1\\{\hphantom{\dofilledbox#1\\}} +\newdimen \frameddimenwd +\newdimen \frameddimenht +\newdimen \frameddimendp %D We don't have to stick to a \TEX\ drawn rule, but %D also can use rounded or even fancier shapes, as we will %D see later on. -\def\dofilledbox\width#1\height#2\depth#3\corner#4\radius#5\\% +\def\dofilledbox {\bgroup - \doifelse{#4}\v!round - {\dimen0=#5\relax % just in case of .x\bodyfontsize - \ifzeropt\dimen0 - \dofilledlinedbox\width#1\height#2\depth#3\\% + \doifelse{\framedparameter\c!backgroundcorner}\v!rectangular + {\dofilledlinedbox} + {\scratchdimen\framedparameter\c!backgroundradius\relax % just in case of .x\bodyfontsize + \ifzeropt\scratchdimen + \dofilledlinedbox \else - \dofilledroundbox\width#1\height#2\depth#3\radius#5\\% - \fi} - {\dofilledlinedbox\width#1\height#2\depth#3\\}% + \dofilledroundbox + \fi}% \egroup} -\def\dofilledlinedbox\width#1\height#2\depth#3\\% - {\vrule\!!width#1\!!height#2\!!depth#3}% -\def\dofilledroundbox\width#1\height#2\depth#3\radius#4\\% - {\ovalbox{#1}{#2}{#3}\ruledlinewidth{#4}\v!off\v!on} +\def\dophantombox + {\hphantom{\dofilledbox}} + +\def\dofilledlinedbox + {\vrule\!!width\frameddimenwd\!!height\frameddimenht\!!depth\frameddimendp\relax}% -\def\ovalbox#1#2#3#4#5#6#7% direct #1 etc passeren +\def\dofilledroundbox + {\doroundedbox\v!off\v!on{\framedparameter\c!backgroundcorner}} + +\def\doroundedbox#1#2#3% {\bgroup - \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!on % will be a macro that handles + \doifelse{#3}\v!round{\let\ovalmod\!!zerocount}{\edef\ovalmod{\number#3}}% + \edef\ovalwid{\the\frameddimenwd}% + \edef\ovalhei{\the\frameddimenht}% + \edef\ovaldep{\the\frameddimendp}% + \scratchdimen\ruledlinewidth\edef\ovallin{\the\scratchdimen}% + \scratchdimen\framedparameter\c!frameradius\edef\ovalrad{\the\scratchdimen}% + \doifelse{#1}\v!on % will be a macro that handles {\let\ovalstr\!!plusone} % start, stop, ja, nee, aan, uit {\let\ovalstr\!!zerocount}% % and something \doif - \doifelse{#7}\v!on + \doifelse{#2}\v!on {\let\ovalfil\!!plusone} {\let\ovalfil\!!zerocount}% - \doovalbox\ovalwid\ovalhei\ovaldep\ovallin\ovalrad\ovalstr\ovalfil + \doovalbox\ovalwid\ovalhei\ovaldep\ovallin\ovalrad\ovalstr\ovalfil\ovalmod \egroup} +% a lot of weird corners +% +% \startTEXpage +% \dontleavehmode\framed +% [corner=0,frame=on,framecolor=green, +% background=color,backgroundcolor=yellow]{\tttf TEST \twodigits\recurselevel}% +% \vskip1em +% \dontleavehmode\dostepwiserecurse {1} {4}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green, +% background=color,backgroundcolor=yellow]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse {5} {8}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green, +% background=color,backgroundcolor=yellow]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse {1} {4}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse {5} {8}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse {9}{12}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse{13}{16}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse{17}{20}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse{21}{24}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \vskip1em +% \dontleavehmode\dostepwiserecurse{25}{28}{1}{\framed +% [corner=\recurselevel,frame=on,framecolor=green]{\tttf TEST \twodigits\recurselevel}% +% \quad} +% \stopTEXpage + %D The oval box is drawn using a special macro, depending on %D the driver in use. +\def\dograybox % avoid black rules when no gray + {\doifelsenothing{\framedparameter\c!backgroundscreen} + {\dophantombox} + {\raster[\framedparameter\c!backgroundscreen]{\dofilledbox}}} + %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\\% +\def\docolorbox {\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\\}% + \doifcolorelse{\framedparameter\c!backgroundcolor} + {\localcolortrue\color[\framedparameter\c!backgroundcolor]{\dofilledbox}} + {\dophantombox}% \else - \dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\% + \dophantombox \fi}} -\def\colorbox - {\setcolorbox} - %D \macros %D {defineoverlay, doifoverlayelse, overlayoffset, %D overlaywidth, overlayheight, overlaydepth, @@ -325,63 +351,34 @@ {\dodoubleargument\dodefineoverlay} \def\dodefineoverlay[#1][#2]% - {\def\docommando##1% - {\setvalue{\??ov##1}{\executedefinedoverlay##1\\#2\\}}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\setvalue{\??ov##1}{\executedefinedoverlay{##1}{#2}}}% + \processcommalist[#1]\docommand} \prependtoks \hsize\overlaywidth \vsize\overlayheight \to\everyoverlay -% \long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9% -% {\bgroup -% \scratchdimen#3% -% \edef\overlaywidth{\the\scratchdimen\space}% -% \scratchdimen#4% -% \advance\scratchdimen#5% -% \edef\overlayheight{\the\scratchdimen\space}% -% \scratchdimen#5% -% \edef\overlaydepth{\the\scratchdimen\space}% -% \edef\overlaycolor{#6}% -% \let\overlayoffset\backgroundoffset % we steal this one -% %\writestatus -% % {overlay} -% % {#1\space w=\overlaywidth/h+d=\overlayheight/d=\overlaydepth]}% -% \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} - -\long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9% +\long\def\executedefinedoverlay#1#2% {\bgroup - \scratchdimen#3% - \edef\overlaywidth{\the\scratchdimen\space}% - \scratchdimen#4% - \advance\scratchdimen#5% - \edef\overlayheight{\the\scratchdimen\space}% - \scratchdimen#5% - \edef\overlaydepth{\the\scratchdimen\space}% - \edef\overlaycolor{#6}% + \edef\overlaywidth {\the\frameddimenwd\space}% + \edef\overlayheight{\the\dimexpr\frameddimenht+\frameddimendp\relax\space}% + \edef\overlaydepth {\the\frameddimendp\space}% + \edef\overlaycolor {\framedparameter\c!backgroundcolor}% + %\edef\overlaycorner{\framedparameter\c!backgroundcorner}% + %\edef\overlayradius{\framedparameter\c!backgroundradius}% \let\overlayoffset\backgroundoffset % we steal this one %\writestatus % {overlay} % {#1\space w=\overlaywidth/h+d=\overlayheight/d=\overlaydepth]}% \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}% +% \dimen0=\dimexpr\wd\scratchbox-\overlaywidth \relax +% \dimen2=\dimexpr\ht\scratchbox-\frameddimenht\relax % not overlayheight ! +% \setbox\scratchbox\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box\scratchbox}% + \setbox\scratchbox\hbox + {\hskip-.5\dimexpr\wd\scratchbox-\overlaywidth \relax + \raise-.5\dimexpr\ht\scratchbox-\frameddimenht\relax % not overlayheight ! + \box\scratchbox}% \wd\scratchbox\overlaywidth \ht\scratchbox\overlayheight \dp\scratchbox\overlaydepth @@ -401,27 +398,24 @@ %D We predefine two already familiar backgrounds: -\setvalue{\??ov\v!screen}#1#2#3#4#5#6#7% - {\graybox\width#1\height#2\depth#3\raster#5\corner#6\radius#7\\} - -\setvalue{\??ov\v!color}#1#2#3#4#5#6#7% - {\colorbox\width#1\height#2\depth#3\color#4\corner#6\radius#7\\} - -%D After all these preparations, the background macro does no -%D bring to many surprises. One has to keep in mind that this -%D macro starts up a call chain, depending on the background -%D one needs: -%D -%D \startitemize[packed] -%D \item a raster, color or user defined shape -%D \item square or round corners -%D \item a \TEX\ or driver based method -%D \stopitemize -%D -%D The macro can be extended by adding commands to the token -%D list register \type {\everybackgroundbox}. For this -%D purpose, the name of the current background is available in -%D \type {\currentbackgound}. +\setvalue{\??ov\v!screen}{\dograybox } +\setvalue{\??ov\v!color }{\docolorbox} + +% %D After all these preparations, the background macro does no +% %D bring to many surprises. One has to keep in mind that this +% %D macro starts up a call chain, depending on the background +% %D one needs: +% %D +% %D \startitemize[packed] +% %D \item a raster, color or user defined shape +% %D \item square or round corners +% %D \item a \TEX\ or driver based method +% %D \stopitemize +% %D +% %D The macro can be extended by adding commands to the token +% %D list register \type {\everybackgroundbox}. For this +% %D purpose, the name of the current background is available in +% %D \type {\currentbackgound}. \newbox\extraframebox @@ -429,14 +423,12 @@ \let\currentbackground\empty -\def\dodobackgroundbox#1#2#3#4#5#6% +\def\dodobackgroundbox#1% also less passing, we can get rid of the old method {\bgroup \def\currentbackground{#1}% \the\everybackgroundbox \setbox\extraframebox\hbox - {\vbox{\moveleft\dimen0\hbox - {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments - {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}}}% + {\vbox{\moveleft\backgroundoffset\hbox{\executeifdefined{\??ov\currentbackground}\donothing}}}% \wd\extraframebox\zeropoint % \backgroundwidth \ht\extraframebox\backgroundheight \dp\extraframebox\backgrounddepth @@ -450,34 +442,31 @@ % todo: also \def\theforegroundbox{#1} -\def\dobackgroundbox#1\background#2\color#3\raster#4\offset#5\corner - #6\radius#7\depth#8\component#9\\% - {\vbox - {\forgetall\boxmaxdepth\maxdimen - \dimen0 #5\relax % space needed - \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}% +\def\dobackgroundbox#1% + {\setbox\framebox\vbox + {\forgetall + \boxmaxdepth\maxdimen + \scratchdimen \framedparameter{#1}\relax + \frameddimenwd\dimexpr\wd\framebox+2\scratchdimen\relax + \frameddimenht\dimexpr\ht\framebox+ \scratchdimen\relax + \frameddimendp\dimexpr\dp\framebox+ \scratchdimen+\framedparameter\c!backgrounddepth\relax + \edef\backgroundoffset{\the\scratchdimen}% + \edef\backgroundwidth {\the\wd\framebox}% + \edef\backgroundheight{\the\ht\framebox}% + \edef\backgrounddepth {\the\dp\framebox}% %\edef\foregroundbox{\box#1}% \def\foregroundbox% fuzzy but needed hack, this \vss, otherwise - {\vbox to \backgroundheight{\vss\box#1\vss}}% vertical shift - \def\docommando##1% - {\dodobackgroundbox{##1}{#1}{#3}{#4}{#6}{#7}}% - \edef\component{#9}% + {\vbox to \backgroundheight{\vss\box\framebox\vss}}% vertical shift + \edef\component{\framedparameter\c!component}% \hbox to \backgroundwidth % in case 'foreground' is used as overlay {\ifx\component\empty - \expanded{\rawprocesscommalist[#2]}\docommando + \expanded{\rawprocesscommalist[\framedparameter\c!background]}\dodobackgroundbox \else \startlayoutcomponent{b:\component}{background \component}% - \expanded{\rawprocesscommalist[#2]}\docommando + \expanded{\rawprocesscommalist[\framedparameter\c!background]}\dodobackgroundbox \stoplayoutcomponent \fi - \box#1\hss}}} + \box\framebox\hss}}} %D One can explictly insert the foreground box. For that %D purpose we introduce the overlay \type {foreground}. @@ -493,66 +482,60 @@ %D by \TEX\ itself, the latter one depends on the driver. This %D macro also support a negative offset. -\def\dooutlinebox#1\color#2\offset#3\corner#4\radius#5\depth#6\toggle#7\\% - {\vbox % rules on top of box - {\dimen0 #3\relax % space needed - \dimen2\wd#1\advance\dimen2 2\dimen0 - \dimen4\ht#1\advance\dimen4 \dimen0 - \dimen6\dp#1\advance\dimen6 \dimen0\advance\dimen6 #6\relax - \ifdim\dimen6<\zeropoint - \advance\dimen4 \dimen6 - \dimen8-\dimen6 - \dimen6\zeropoint +\def\dooutlinebox + {\setbox\framebox\vbox % rules on top of box + {\scratchdimen \framedparameter\c!frameoffset\relax + \frameddimenwd\dimexpr\wd\framebox+2\scratchdimen\relax + \frameddimenht\dimexpr\ht\framebox+ \scratchdimen\relax + \frameddimendp\dimexpr\dp\framebox+ \scratchdimen+\framedparameter\c!framedepth\relax + \ifdim\frameddimendp<\zeropoint + \advance\frameddimenht \frameddimendp + \scratchdimen-\frameddimendp + \frameddimendp\zeropoint \else - \dimen8\zeropoint + \scratchdimen\zeropoint \fi \setbox\extraframebox\hbox - {\dostrokedbox\width\dimen2\height\dimen4\depth\dimen6% - \corner#4\radius#5\toggle#7\\}% + {\dostrokedbox}% \setbox\extraframebox\hbox - {\raise\dimen8\vbox{\moveleft#3\box\extraframebox}}% - \wd\extraframebox\wd#1% - \ht\extraframebox\ht#1% - \dp\extraframebox\dp#1% + {\raise\scratchdimen\vbox + {\moveleft\framedparameter\c!frameoffset\box\extraframebox}}% + \wd\extraframebox\wd\framebox + \ht\extraframebox\ht\framebox + \dp\extraframebox\dp\framebox \hbox - {%\copy#1\hskip-\wd#1% - \box#1\hskip-\wd\extraframebox % faster - \doifelsenothing{#2} % speeds up a little - {\box\extraframebox} - {\color[#2]{\box\extraframebox}}}}} - -\def\dostrokedbox\width#1\height#2\depth#3\corner#4\radius#5\toggle#6\\% - {\bgroup - \doifelse{#4}\v!round - {\dimen0=#5\relax % just in case of .x\bodyfontsize - \ifzeropt\dimen0 - \dostrokedlinedbox\width#1\height#2\depth#3\toggle#6\\% + {\box\framebox\hskip-\wd\extraframebox + \doifsomething{\framedparameter\c!framecolor}% no else needed, + {\color[\framedparameter\c!framecolor]}% % + {\box\extraframebox}}}} % but {} here + +\def\dostrokedbox + {\doifelse{\framedparameter\c!framecorner}\v!rectangular + {\dostrokedlinedbox} + {\ifzeropt\dimexpr\framedparameter\c!frameradius\relax % just in case of .x\bodyfontsize + \dostrokedlinedbox \else - \dostrokedroundbox\width#1\height#2\depth#3\radius#5\toggle#6\\% - \fi} - {\dostrokedlinedbox\width#1\height#2\depth#3\toggle#6\\}% - \egroup} - -%D The toggle argument in these calls concern the individual -%D rules: left, right, top and bottom. Each can be turned on, -%D depending on the general state (\type{#4}) or the individual -%D ones (\type{#5}, \type{#6}, \type{#7} and \type{#8}). - -\def\dostrokedlinedbox\width#1\height#2\depth#3\toggle - #4\left#5\right#6\top#7\bottom#8\\% - {\bgroup - \setbox0\null - \wd0=#1\ht0=#2\dp0=#3% - \setbox2\vbox - {\getvalue{t\@@frame@@#4#7}% - \hbox - {\getvalue{l\@@frame@@#4#5}% - \box0% - \getvalue{r\@@frame@@#4#6}} - \getvalue{b\@@frame@@#4#8}}% - \wd2=#1\ht2=#2\dp2=#3% - \box2 - \egroup} + \dostrokedroundbox + \fi}} + +\def\dostrokedlinedbox + {\setbox\scratchbox\null + \wd\scratchbox\frameddimenwd + \ht\scratchbox\frameddimenht + \dp\scratchbox\frameddimendp + \setbox\scratchbox\vbox \bgroup + \csname t\@@frame@@\framedparameter\c!frame\framedparameter\c!topframe \endcsname + \hbox \bgroup + \csname l\@@frame@@\framedparameter\c!frame\framedparameter\c!leftframe \endcsname + \box\scratchbox + \csname r\@@frame@@\framedparameter\c!frame\framedparameter\c!rightframe \endcsname + \egroup + \csname b\@@frame@@\framedparameter\c!frame\framedparameter\c!bottomframe\endcsname + \egroup + \wd\scratchbox\frameddimenwd + \ht\scratchbox\frameddimenht + \dp\scratchbox\frameddimendp + \box\scratchbox} \def\@@frame@@{@@frame@@} @@ -576,10 +559,10 @@ %D Before we come to using these macros we yet have to define %D the rounded corner alternative, which after all is not that %D hard because it uses the previously defined macro \type -%D {\ovalbox}. +%D {\doroundedbox}. -\def\dostrokedroundbox\width#1\height#2\depth#3\radius#4\toggle#5\left#6\\% - {\doif{#5}\v!on{\ovalbox{#1}{#2}{#3}{\ruledlinewidth}{#4}\v!on\v!off}} +\def\dostrokedroundbox + {\doif{\framedparameter\c!frame}\v!on{\doroundedbox\v!on\v!off{\framedparameter\c!framecorner}}} %D The next few macros are probably the most misused ones in %D \CONTEXT. They deal with putting rules around boxes, provide @@ -653,8 +636,45 @@ \copyparameters[#1\c!frame][#1]% [\c!radius,\c!corner,\c!depth]} +% \def\setupframed +% {\dodoubleargument\getparameters[\??oi]} + \def\setupframed - {\dodoubleargument\getparameters[\??oi]} + {\dodoubleempty\dosetupframed} + +\def\dosetupframed + {\ifsecondargument + \@EA\dodoublesetupframed + \else + \@EA\dosinglesetupframed + \fi} + +\def\dosinglesetupframed[#1][#2]% + {\getparameters[\??oi][#1]} + +\def\dodoublesetupframed[#1][#2]% + {\bgroup + \let\dodoubleempty\empty + \def\doframed[##1]{\gdef\globalredefinedframed{\dodoubleempty\doframed[##1,#2]}}% + \getvalue{#1}% + \egroup + \letvalue{#1}\globalredefinedframed} + +%D \startbuffer +%D \setupframed [framecolor=yellow] \framed{A} +%D \defineframed[myframed] [framecolor=blue] \myframed{B} +%D \setupframed [myframed] [framecolor=red] \myframed{C} +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D \startbuffer +%D \presetlocalframed[myframed] +%D \setuplocalframed[myframed][width=4cm,height=2cm] +%D \localframed[myframed][framecolor=green]{oeps} +%D \stopbuffer +%D +%D \typebuffer \getbuffer %D \macros %D {ifinframed} @@ -674,7 +694,47 @@ {\bgroup \dodoubleempty\startlocalframed} -\let\fastlocalframed\localframed +%D The next one is faster on multiple backgrounds per page. No +%D dimensions can be set, only frames and backgrounds. + +\def\fastlocalframed[#1]#2[#3]#4% 3-4 + {\bgroup + \inframedtrue + \edef\@@framed{#1}% + % more bytes + % \scratchdimen\framedparameter\c!frameoffset + % \setevalue{\@@framed\c!frameoffset}{\the\scratchdimen}% + % \doifnotvalue{\@@framed\c!backgroundoffset}\v!frame + % {\scratchdimen\framedparameter\c!backgroundoffset + % \setevalue{\@@framed\c!backgroundoffset}{\the\scratchdimen}}% + % less bytes + \@EA\freezedimenmacro\csname\@@framed\c!frameoffset\endcsname + \doifnotvalue{\@@framed\c!backgroundoffset}\v!frame + {\@EA\freezedimenmacro\csname\@@framed\c!backgroundoffset\endcsname}% + % so far + \setbox\framebox\hbox{#4}% + \getparameters[\@@framed][#3]% no \expanded ! + % no, better in calling macro + % + % \edef\doframedsetups{\framedparameter\c!setups}% + % \ifx\doframedsetups\empty\else + % \edef\doframedsetups{\noexpand\setups[\doframedsetups]}% + % \fi + \removeframedboxdepth + \docolorframebox + \edef\overlaylinecolor{\framedparameter\c!framecolor}% + \edef\overlaylinewidth{\the\ruledlinewidth}% + \edef\@@localframing {\framedparameter\c!frame}% + \ifx\@@localframing\v!overlay \else \ifx\@@localframing\v!none \else + \doifvaluesomething{\@@framed\c!rulethickness} + {\ruledlinewidth\framedparameter\c!rulethickness\relax + \ifinheritruledlinewidth\linewidth\ruledlinewidth\fi}% + \dooutlinebox % real or invisible frame + \fi \fi + \doifvaluesomething{\@@framed\c!background}\dobackedbox + \restoreframedboxdepth + \box\framebox + \egroup} %D Before we go into details, we present (and implement) the %D main framing routine. I saw no real reason for splitting the @@ -710,11 +770,9 @@ % \doifvaluesomething{\@@framed\c!rulethickness} % obsolete % {\ruledlinewidth\getvalue{\@@framed\c!rulethickness}}% obsolete % this piece of pre expansion is needed (sometimes used circular) - \scratchdimen\framedparameter\c!frameoffset - \setevalue{\@@framed\c!frameoffset}{\the\scratchdimen}% + \setevalue{\@@framed\c!frameoffset}{\the\dimexpr\framedparameter\c!frameoffset\relax}% \doifnotvalue{\@@framed\c!backgroundoffset}\v!frame - {\scratchdimen\framedparameter\c!backgroundoffset - \setevalue{\@@framed\c!backgroundoffset}{\the\scratchdimen}}% + {\setevalue{\@@framed\c!backgroundoffset}{\the\dimexpr\framedparameter\c!backgroundoffset\relax}}% % to prevent deadlock in case of self refering \ifsecondargument % faster \getparameters[\@@framed][#2]% here ! @@ -790,8 +848,7 @@ \else \let\defaultframeoffset\localoffset \fi - \@@localoffset\localoffset - \advance\@@localoffset \ruledlinewidth + \@@localoffset\dimexpr\localoffset+\ruledlinewidth\relax \fi\fi \!!framedheight\zeropoint \!!framedwidth \zeropoint @@ -981,7 +1038,8 @@ \def\stoplocalframed {\dontshowcomposition - \@@stopframedorientation + \@@stopframedorientation % hm, wrong place ! should rotatethe result (after reshape) + \handleframedlocator\c!before\@@locallocation \ifboxhasformat \ifx\@@localautowidth\v!force \ifreshapeframebox\doreshapeframedbox\fi @@ -1029,28 +1087,27 @@ \edef\overlaylinecolor{\framedparameter\c!framecolor}% \edef\overlaylinewidth{\the\ruledlinewidth}% \@@... \ifboxhasframe % real or invisible frame - \doframedbox + \dooutlinebox \fi \doifvaluesomething{\@@framed\c!background}\dobackedbox - \handleframedlocator\@@locallocation + \handleframedlocator\c!after\@@locallocation \box\framebox \egroup \egroup} -\def\installframedlocator#1#2% - {\setvalue{\??ol:\c!location:#1}{#2}} +\def\installframedlocator#1#2#3% + {\setvalue{\??ol:\c!location:\c!before:#1}{#2}% + \setvalue{\??ol:\c!location:\c!after :#1}{#3}} -\def\handleframedlocator#1% - {\getvalue{\??ol:\c!location:#1}} +\def\handleframedlocator#1#2% + {\getvalue{\??ol:\c!location:#1:#2}} \def\doprelocframedbox#1% - {\scratchdimen#1\relax - \advance\scratchdimen \ruledlinewidth + {\scratchdimen\dimexpr#1+\ruledlinewidth\relax \ifboxhasoffset \advance\scratchdimen \framedparameter\c!offset \fi - \scratchskip\ht\framebox - \advance\scratchskip-\scratchdimen} + \scratchskip\dimexpr\ht\framebox-\scratchdimen\relax} % \ruledhbox % {A @@ -1075,24 +1132,24 @@ % B} \installframedlocator \v!hanging % best with strut=no + {} {\dp\framebox\ht\framebox \ht\framebox\zeropoint} \installframedlocator \v!depth - {\scratchdimen\ht\framebox - \advance\scratchdimen -\strutdp - \ht\framebox\scratchdimen + {} + {\ht\framebox\dimexpr\ht\framebox-\strutdp\relax \dp\framebox\strutdp \box\framebox} \installframedlocator \v!height - {\scratchdimen\ht\framebox - \advance\scratchdimen -\strutht + {} + {\dp\framebox\dimexpr\ht\framebox-\strutht\relax \ht\framebox\strutht - \dp\framebox\scratchdimen \box\framebox} \installframedlocator \v!high + {} {\doprelocframedbox\strutht \setbox\framebox\hbox{\lower\scratchskip\box\framebox}% \ht\framebox\strutht @@ -1100,12 +1157,14 @@ \hbox{\box\framebox}} \installframedlocator \v!line + {} {\setbox\framebox\hbox{\lower.5\ht\framebox\box\framebox}% \ht\framebox.5\lineheight \dp\framebox.5\lineheight \hbox{\box\framebox}} \installframedlocator \v!low + {} {\doprelocframedbox\strutdp \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\strutht @@ -1113,6 +1172,7 @@ \box\framebox} \installframedlocator \v!top + {} {\doprelocframedbox\strutht \setbox\framebox\hbox{\lower\scratchskip\box\framebox}% \ht\framebox\scratchdimen @@ -1120,6 +1180,7 @@ \hbox{\box\framebox}} \installframedlocator \v!middle + {} {\scratchdimen.5\ht\framebox \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\scratchdimen @@ -1127,15 +1188,42 @@ \hbox{\box\framebox}} \installframedlocator \v!lohi - {\handleframedlocator\v!middle} + {\handleframedlocator\c!before\v!middle} + {\handleframedlocator\c!after \v!middle} \installframedlocator \v!bottom + {} {\doprelocframedbox\strutdp \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\scratchskip \dp\framebox\scratchdimen \hbox{\box\framebox}} +\installframedlocator \v!keep % retains height/depth + {\removeframedboxdepth} + {\restoreframedboxdepth} + +% also used in fastlocalframed + +\newdimen\originalframedwd +\newdimen\originalframedht +\newdimen\originalframeddp + +\def\removeframedboxdepth + {\originalframedwd\wd\framebox + \originalframedht\ht\framebox + \originalframeddp\dp\framebox + \ifzeropt\originalframeddp\else\setbox\framebox\hbox{\raise\originalframeddp\box\framebox}\fi + \wd\framebox\originalframedwd + \ht\framebox\dimexpr\originalframedht+\originalframeddp\relax + \dp\framebox\zeropoint} + +\def\restoreframedboxdepth + {\ifzeropt\originalframeddp\else\setbox\framebox\hbox{\lower\originalframeddp\box\framebox}\fi + \wd\framebox\originalframedwd + \ht\framebox\originalframedht + \dp\framebox\originalframeddp} + % \let\@@startframedorientation\relax % \let\@@stopframedorientation \relax @@ -1407,39 +1495,13 @@ %D additional offset capabilities. The lot of calls to other %D macros makes this mechanism not that easy to comprehend. -\def\doframedbox - {\setbox\framebox\vbox - {\dooutlinebox\framebox - \color \framedparameter\c!framecolor - \offset \framedparameter\c!frameoffset - \corner \framedparameter\c!framecorner - \radius \framedparameter\c!frameradius - \depth \framedparameter\c!framedepth - \toggle \framedparameter\c!frame - \left \framedparameter\c!leftframe - \right \framedparameter\c!rightframe - \top \framedparameter\c!topframe - \bottom \framedparameter\c!bottomframe\\}} - %D Getting the backgrounds right takes less code. Again we %D have to take care of additional offsets. \def\dobackedbox {\doifelsevalue{\@@framed\c!backgroundoffset}\v!frame % new - {\dodobackedbox\c!frameoffset} - {\dodobackedbox\c!backgroundoffset}} - -\def\dodobackedbox#1% - {\setbox\framebox\vbox - {\dobackgroundbox\framebox - \background \framedparameter\c!background - \color \framedparameter\c!backgroundcolor - \raster \framedparameter\c!backgroundscreen - \offset \framedparameter{#1}% - \corner \framedparameter\c!backgroundcorner - \radius \framedparameter\c!backgroundradius - \depth \framedparameter\c!backgrounddepth - \component \framedparameter\c!component\\}} + {\dobackgroundbox\c!frameoffset} + {\dobackgroundbox\c!backgroundoffset}} %D We handle left, right or middle alignment as well as fixed %D or free widths and heights. Each combination gets its own @@ -1651,10 +1713,55 @@ % otherwise we get problems with framed display math and auto % width. +% \def\doreshapeframedbox % frozen +% {\beginofshapebox +% \unvcopy\framebox +% \endofshapebox +% \global\@@globalwidth\zeropoint +% \resetshapeframebox +% \reshapebox +% {\setbox0\hbox +% {\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}% +% \global\advance\framednoflines \plusone +% \ifdim\framedlastlength>\zeropoint\else +% \global\framedlastlength\wd0 +% \fi +% \ifdim\wd0>\@@globalwidth +% \global\@@globalwidth\wd0 +% \fi}% +% \dosetraggedcommand\localformat +% \raggedcommand +% \ifboxhasheight +% \setbox\framebox\vbox to \localheight +% {\hsize\@@globalwidth +% \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% +% \dobeforeframedbox +% \innerflushshapebox +% \doafterframedbox}% +% \else +% \scratchdimen\dp\framebox +% \setbox\framebox\vbox to \ht\framebox +% {\hsize\@@globalwidth +% \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% +% \innerflushshapebox}% +% \dp\framebox\scratchdimen % \strutdp otherwise problem with math +% \fi +% \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi +% \ifcase\framednoflines\global\framednoflines\plusone\fi} + +\chardef\reshapeframeboxmethod\plusone % 0=no flush, 1=old method 2=no depth messing + +\let\framedboxwidth \!!zeropoint +\let\framedboxheight\!!zeropoint +\let\framedboxdepth \!!zeropoint + \def\doreshapeframedbox % frozen {\beginofshapebox \unvcopy\framebox \endofshapebox + \edef\framedboxwidth {\the\wd\framebox}% + \edef\framedboxheight{\the\ht\framebox}% + \edef\framedboxdepth {\the\dp\framebox}% \global\@@globalwidth\zeropoint \resetshapeframebox \reshapebox @@ -1667,30 +1774,49 @@ \ifdim\wd0>\@@globalwidth \global\@@globalwidth\wd0 \fi}% - \dosetraggedcommand\localformat - \raggedcommand - \ifboxhasheight - \setbox\framebox\vbox to \localheight - {\hsize\@@globalwidth - \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% - \dobeforeframedbox - \innerflushshapebox - \doafterframedbox}% + \ifreshapingfailed + % no need for anothr pass or finalizer \else - \scratchdimen\dp\framebox - \setbox\framebox\vbox to \ht\framebox - {\hsize\@@globalwidth - \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% - \innerflushshapebox}% - \dp\framebox\scratchdimen % \strutdp otherwise problem with math - \fi - \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi - \ifcase\framednoflines\global\framednoflines\plusone\fi} + \dosetraggedcommand\localformat + \raggedcommand + \ifboxhasheight + \setbox\framebox\vbox to \localheight + {\hsize\@@globalwidth + \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% + \dobeforeframedbox + \innerflushshapebox + \doafterframedbox}% + \else + \setbox\framebox\vbox to \ht\framebox + {\hsize\@@globalwidth + \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% + \ifcase\reshapeframeboxmethod + \or \innerflushshapebox \or \innerflushshapebox + \fi}% + \ifcase\reshapeframeboxmethod \or + \dp\framebox\framedboxdepth % \strutdp otherwise problem with math + \fi + \fi + \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi + \ifcase\framednoflines\global\framednoflines\plusone\fi + \fi} %D The two variables \type {\framednoflines} and \type %D {\framedlastlength} can be used in a second pass to %D optimized framed material. +% torture test / strange case (much depth) / method 2 needed +% +% \startTEXpage[frame=on] +% \startformula \startalign \NC A \NC B \NR \intertext{test} \NC C \NC D \NR \stopalign \stopformula +% test outside formula +% \startformula \startalign \NC A \NC B \NR \intertext{test} \NC C \NC D \NR \stopalign \stopformula +% \blank[big] +% \startformula \startalign \NC \int_01 \NC B \NR \intertext{test} \NC \int_01 \NC D \NR \stopalign \stopformula +% test outside formula +% \startformula \startalign \NC \int_01 \NC B \NR \intertext{test} \NC \int_01 \NC D \NR \stopalign \stopformula +% \stopTEXpage + %D The examples on the next page show how one can give the %D frame as well as the background an additional offset and %D even a bit more depth. The blue outline is the frame, the @@ -1751,8 +1877,7 @@ %D baseline intact outside as well as inside the framed box. \def\doinlineframedbox - {\scratchdimen\strutdp - \advance\scratchdimen \ruledlinewidth + {\scratchdimen\dimexpr\strutdp+\ruledlinewidth\relax \ifboxhasoffset \advance\scratchdimen \framedparameter\c!offset \fi @@ -1765,9 +1890,7 @@ %D line. \def\doloweredframedbox - {\getboxheight\scratchdimen\of\box\framebox - \advance\scratchdimen -\strutdp - \ht\framebox\scratchdimen + {\ht\framebox\dimexpr\ht\framebox+\dp\framebox-\strutdp\relax \dp\framebox\strutdp \box\framebox} @@ -1781,7 +1904,7 @@ %D \stoptyping \def\dohangingframedbox % best with strut=no - {\getboxheight\scratchdimen\of\box\framebox + {\scratchdimen\dimexpr\ht\framebox+\dp\framebox\relax \ht\framebox\zeropoint \dp\framebox\scratchdimen} @@ -1808,8 +1931,7 @@ \def\vboxedhairline {\bgroup \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi - \dimen4=\dimen2 - \advance\dimen4 \ruledlinewidth + \dimen4=\dimexpr\dimen2+\ruledlinewidth\relax \setbox0\vbox {\advance\hsize 2\dimen4 \vskip\dimen2 @@ -1826,33 +1948,24 @@ \endgraf\nointerlineskip\localbegstrut \egroup} -\def\hboxedhairline +\def\hboxedhairline % use framed dimen {\bgroup \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi \ifboxhasheight - \dimen4=\localheight \divide\dimen4 2 - \dimen6=\dimen4 - \advance\dimen4 \strutdp - \advance\dimen6 -\strutdp - \advance\dimen4 -2\ruledlinewidth - \advance\dimen6 2\ruledlinewidth + \dimen4\dimexpr\localheight/2+\strutdp-2\ruledlinewidth\relax + \dimen6\dimexpr\localheight/2-\strutdp+2\ruledlinewidth\relax \else - \dimen4\strutht - \advance\dimen4 \dimen2 - \dimen6\strutdp - \advance\dimen6 \dimen2 + \dimen4\dimexpr\strutht+\dimen2\relax + \dimen6\dimexpr\strutdp+\dimen2\relax \fi \unskip - \setbox0\hbox + \setbox\scratchbox\hbox {\hskip\dimen2 - \vrule - \!!height\dimen4 - \!!depth\dimen6 - \!!width\ruledlinewidth + \vrule\!!height\dimen4\!!depth\dimen6\!!width\ruledlinewidth \hskip\dimen2}% - \ht0\strutht - \dp0\strutdp - \box0 + \ht\scratchbox\strutht + \dp\scratchbox\strutdp + \box\scratchbox \ignorespaces \egroup} @@ -1935,9 +2048,9 @@ {\hbox\bgroup \getparameters[\??bj][#1]% \setstrut - \doif\@@bjwidth\v!max{\def\@@bjwidth{1em}}% - \doif\@@bjheight \v!max{\def\@@bjheight{\strutht}}% - \doif\@@bjdepth \v!max{\def\@@bjdepth{\strutdp}}% + \doif\@@bjwidth \v!max{\def\@@bjwidth {1em}}% + \doif\@@bjheight\v!max{\def\@@bjheight{\strutht}}% + \doif\@@bjdepth \v!max{\def\@@bjdepth {\strutdp}}% \localstartcolor[\@@bjcolor]% \vrule \!!width \@@bjwidth @@ -2224,27 +2337,33 @@ \ifdim\linewidth=\zeropoint \chardef\ruletype\zerocount \else - \doifnot\@@dlframe\v!on{\chardef\ruletype=0\relax}% + \doifnot\@@dlframe\v!on{\chardef\ruletype\zerocount}% \fi \ifnum\ruletype=\plusone \doif\@@dlheight\v!max{\let\@@dlheight\!!plusone}% - \doif\@@dldepth\v!max{\let\@@dldepth\!!plusone}% + \doif\@@dldepth \v!max{\let\@@dldepth \!!plusone}% \else \let\@@dlheight\!!plusone \let\@@dldepth\!!plusone \fi \freezedimensionwithunit\@@dlheight\strutht \freezedimensionwithunit\@@dldepth\strutdp - \divide\linewidth 2 + \divide\linewidth \plustwo \doifelse\@@dlbackground\v!color {\startcolor[\@@dlbackgroundcolor]% - \dimen0=\@@dlheight - \dimen2=\@@dldepth - \ifnum\ruletype=2 % prevent overshoot due to rounding - \advance\dimen0 -.5\linewidth - \advance\dimen2 -.5\linewidth + \ifnum\ruletype=\plustwo % prevent overshoot due to rounding + \leaders + \hrule + \!!height\dimexpr\@@dlheight-.5\linewidth\relax + \!!depth \dimexpr\@@dldepth -.5\linewidth\relax + \hfill + \else + \leaders + \hrule + \!!height\@@dlheight + \!!depth \@@dldepth + \hfill \fi - \leaders\hrule\!!height\dimen0\!!depth\dimen2\hfill \stopcolor \ifcase\ruletype % no rule @@ -2255,10 +2374,8 @@ \stopcolor \or \startcolor[\@@dlcolor]% - \dimen2=\@@dldepth\dimen0=-\dimen2 \advance\dimen0 \linewidth - \hfillneg\leaders\hrule\!!height\dimen0\!!depth\dimen2\hfill - \dimen2=\@@dlheight\dimen0=-\dimen2 \advance\dimen0 \linewidth - \hfillneg\leaders\hrule\!!height\dimen2\!!depth\dimen0\hfill + \hfillneg\leaders\hrule\!!height\dimexpr-\@@dldepth+\linewidth\relax\!!depth\@@dldepth\hfill + \hfillneg\leaders\hrule\!!height\@@dlheight\!!depth\dimexpr-\@@dlheight+\linewidth\relax\hfill \stopcolor \fi} {\ifcase\ruletype \else @@ -2518,8 +2635,8 @@ \def\dosetupframedtexts[#1][#2]% {\ifsecondargument - \def\docommando##1{\getparameters[\??kd##1][#2]}% - \processcommacommand[#1]\docommando % new, #1 may be macro + \def\docommand##1{\getparameters[\??kd##1][#2]}% + \processcommacommand[#1]\docommand % new, #1 may be macro \else \getparameters[\??kd\v!framedtext][#1]% \fi} @@ -2535,22 +2652,8 @@ {\dododostartframedtext[#1][][#2]} {\dododostartframedtext[#1][#2][#3]}} -\def\checkframedtext - {\ifinsidefloat - \localhsize\hsize - \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 - \checksidefloat - \setlocalhsize - \else - \localhsize\hsize - \fi\fi} - \setfalse\framedtextlocationnone - \def\dododostartframedtext[#1][#2][#3]% #3 only passed to framed, not to framedtext {\doifsomething{#2}{\setvalue{\??kd#1\c!location}{#2}}% does not listen to #3 \setfalse\framedtextlocationnone @@ -2734,13 +2837,13 @@ \def\setuptextrules {\dodoubleargument\getparameters[\??tl]} -\def\complextextrule[#1]% - {\processaction +\def\complextextrule[#1]% if needed we can make it installable + {\let\next\dobottomtextrule + \processaction [#1] - [ \v!top=>\let\next\dotoptextrule, - \v!bottom=>\let\next\dobottomtextrule, - \s!default=>\let\next\dobottomtextrule, - \s!unknown=>\let\next\dobottomtextrule]% + [ \v!top=>\let\next\dotoptextrule, + \v!middle=>\let\next\domiddletextrule, + \v!bottom=>\let\next\dobottomtextrule]% \dosinglegroupempty\next} \definecomplexorsimple\textrule @@ -2750,21 +2853,17 @@ \def\docomplextextrule#1% {\bgroup - \advance\hsize -\rightskip - \advance\hsize -\leftskip + \advance\hsize\dimexpr-\rightskip-\leftskip\relax \setbox\scratchbox\hbox to \hsize - {\dimen4=.5ex - \dimen6=-.5ex - \advance\dimen4 .5\linewidth - \advance\dimen6 .5\linewidth - \dimen8=\@@tldistance + {\dimen4\dimexpr .5ex+.5\linewidth\relax + \dimen6\dimexpr-.5ex+.5\linewidth\relax \doifnothing{#1}\firstargumentfalse \iffirstargument \doifelse\@@tllocation\v!inmargin {\llap{\doattributes\??tl\c!style\c!color{#1}\hskip\leftmargindistance}} {\color[\@@tlrulecolor] {\vrule\!!height\dimen4\!!depth\dimen6\!!width\@@tlwidth}% - \hbox spread 2\dimen8 + \hbox spread 2\dimexpr\@@tldistance\relax {\hss\doattributes\??tl\c!style\c!color{\strut#1}\hss}}% \fi \color[\@@tlrulecolor] @@ -2798,11 +2897,14 @@ \fi \advance\dimen0 .5ex \vskip\dimen0 +% == +% \vskip\dimexpr \strutdp + .5ex +% \ifdim\prevdepth>\strutdp\else\ifdim\prevdepth>\zeropoint-\prevdepth\fi\fi\relax +% \@@tlinbetween \doifelsenothing{#2} {\bgroup - \advance\hsize -\rightskip - \advance\hsize -\leftskip + \advance\hsize\dimexpr-\rightskip-\leftskip\relax \nointerlineskip \moveleft-\leftskip\vbox {\color[\@@tlrulecolor] @@ -2961,12 +3063,11 @@ \def\par % very dangerous {\let\par\endgraf % -) \unskip\hfill - \dimen0=\@@ivwidth - \advance\dimen0 -\@@ivdistance - \ifdim\dimen0>\@@ivmargin\else\expandafter\rlap\fi + \scratchdimen\dimexpr\@@ivwidth-\@@ivdistance\relax + \ifdim\scratchdimen>\@@ivmargin\else\expandafter\rlap\fi {\kern\@@ivdistance \vrule - \!!width \dimen0 + \!!width \scratchdimen \!!height.5\linewidth \!!depth .5\linewidth}% \endgraf % ! @@ -3086,14 +3187,11 @@ \scratchdimen\textheight \chardef\backgroundsplit\plusone % split to max height \else - \scratchdimen\pagegoal \setbox\scratchbox\vbox{\@@agbefore}% - \advance\scratchdimen -\ht\scratchbox - \advance\scratchdimen -\pagetotal + \scratchdimen\dimexpr\pagegoal-\ht\scratchbox-\pagetotal\relax \chardef\backgroundsplit\plustwo % split to partial height \fi - \advance\scratchdimen -\@@agtopoffset - \advance\scratchdimen -\@@agbottomoffset \relax + \advance\scratchdimen\dimexpr-\@@agtopoffset-\@@agbottomoffset\relax \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable \ifdim\ht0>\scratchdimen % larger than page \setbox2\vsplit0 to \scratchdimen @@ -3206,8 +3304,8 @@ {\dodoubleempty\dosetupframedcontent} \def\dosetupframedcontent[#1][#2]% - {\def\docommando##1{\getparameters[\??fc##1][#2]}% - \processcommacommand[#1]\docommando} + {\def\docommand##1{\getparameters[\??fc##1][#2]}% + \processcommacommand[#1]\docommand} \def\startframedcontent[#1]% {\bgroup @@ -3221,10 +3319,8 @@ {\setbox\framebox\hbox\bgroup \setlocalhsize \hsize\localhsize - \advance\hsize-\getvalue{\??fc#1\c!leftoffset}% - \advance\hsize-\getvalue{\??fc#1\c!rightoffset}% - \advance\vsize-\getvalue{\??fc#1\c!topoffset}% - \advance\vsize-\getvalue{\??fc#1\c!bottomoffset}% + \advance\hsize\dimexpr-\getvalue{\??fc#1\c!leftoffset}-\getvalue{\??fc#1\c!rightoffset} \relax + \advance\vsize\dimexpr-\getvalue{\??fc#1\c!topoffset} -\getvalue{\??fc#1\c!bottomoffset}\relax \hskip\getvalue{\??fc#1\c!leftoffset}% \vbox\bgroup \vskip\getvalue{\??fc#1\c!topoffset}% @@ -3288,12 +3384,6 @@ \let\omcirkeld\encircled -% \def\copyright {\encircled{C}} -% \def\registered{\encircled{R}} - -% \setuprules -% [\c!lijndikte=\v!middel] - \setuplinewidth [\v!medium] @@ -3332,8 +3422,8 @@ \c!setups=] \setupscreens - [\c!factor=1.0, - \c!method=\v!external, % \c!method=\v!dot + [%\c!factor=1.0, % obsolete + %\c!method=\v!external, % obsolete \c!screen=0.95] \setupblackrules diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index c5fc5db8a..1e8188ea0 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -75,6 +75,32 @@ \unprotect +% new and to be tested + +\unexpanded\def\separatorlist#1% + {\ifx\sepnumber\undefined\def\sepnumber{0}\fi + \increment\sepnumber + \getfromcommacommand[#1][\sepnumber]% + \ifx\commalistelement\empty + \getcommalistsize[#1]% + \def\sepnumber{\number\commalistsize}% + \getfromcommacommand[#1][\sepnumber]% + \fi + \commalistelement} + +% \setuphead[section] [separator=\separatorlist{?,!,*}] +% \setuphead[subsection][separator=\separatorlist{??,!!,**}] +% +% \let\spr\separatorlist % this will enable this feature +% +% \setuphead[section] [separator={?,!,*}] +% \setuphead[subsection][separator={??,!!,**}] +% +% \setupheads[separator={A,B,C,D,E,F}] +% \chapter{test} +% \section{test} \subsection{test} \subsection{test} +% \section{test} \subsection{test} \subsection{test} + % from now on, internaly numbers are separated by a period % and postprocessed on demand @@ -179,7 +205,7 @@ \def\domakeprecedingsectionnumber[#1]% will become ugly after speed up {\bgroup % added \globallet\precedingsectionnumber\empty - \ifsectienummer + \ifsectionnumber \doifvalue{\??sb\@@sectionblock\c!number}\v!yes % added {\doifelsevalue{\@@thenumber{#1}\c!sectionnumber}\v!yes \donetrue\donefalse @@ -190,7 +216,7 @@ {\getvalue{\??by\getvalue{\@@thenumber{#1}\c!way\c!local}}}% \doifnot\currentsection\zerosection {\doifnot{\@@sectionvalue\currentsection}{0} - {\xdef\precedingsectionnumber% + {\xdef\precedingsectionnumber {\getvalue{\currentsection\c!number}% \spr{\precedingseparator}}}}% \fi}% @@ -572,6 +598,8 @@ % \def\ignoresectionconversion % brrr % {\let\@@sectionconversion\secondoftwoarguments} +% todo: criterium=appendix|frontmatter|.... + \def\dosetfilterlevel#1#2% beware: this one is \let {\bgroup \let\@@shortsectionnumber\@@sectionvalue @@ -1050,12 +1078,9 @@ \expandafter\newif\csname if#2\endcsname % better a mode \doglobal\increment\currentsectionblock \setsectionblockenvironment{#1}{}% - \setevalue{\??sb#1}% - {\noexpand\dosetlocalsectionblock{\currentsectionblock}{#1}{#2}}% - \setvalue{\e!start#2}% - {\dostartsectionblock{#1}{#2}}% - \setvalue{\e!stop#2}% - {\dostopsectionblock}} + \setevalue{\??sb #1}{\noexpand\dosetlocalsectionblock{\currentsectionblock}{#1}{#2}}% + \setvalue {\e!start#2}{\dostartsectionblock{#1}{#2}}% + \setvalue {\e!stop #2}{\dostopsectionblock}} \def\definesectionblock {\dotripleargument\dodefinesectionblock} @@ -1077,7 +1102,7 @@ \edef\!!stringa{#1}% \@EA\writestatus\@EA {\!!stringa} - {\ifsectienummer#2\else(#2)\fi\normalspace\asciititle}% + {\ifsectionnumber#2\else(#2)\fi\normalspace\asciititle}% \egroup} \def\@@kolevel{1} \def\headlevel{\@@kolevel} @@ -1175,7 +1200,7 @@ \newif\ifincrementnumber \newif\ifreversesectionnumbers % todo: key/val -\newif\ifsectienummer \sectienummertrue +\newif\ifsectionnumber \sectionnumbertrue \newif\ifdisplaysectionhead \displaysectionheadtrue \newif\ifplacehead \newif\ifemptyhead @@ -1395,17 +1420,17 @@ \v!list=>\incrementnumberfalse % beware, since no numbers are used, no nested lists are % possible here - \writetolisttrue, - \s!unknown=>{\ifx\currentproduct\empty - \findsectionnumber{#1}\commalistelement{#4}% - \fi - \incrementnumbertrue}]% + \writetolisttrue, + \s!unknown=>{\ifx\currentproduct\empty + \findsectionnumber{#1}\commalistelement{#4}% + \fi + \incrementnumbertrue}]% \edef\numberheaddistance {\getvalue{\??ko#1\c!distance}}% \edef\numberheadalternative{\getvalue{\??ko#1\c!alternative}}% \doifelsevalue{\??ko:\numberheadalternative}\v!horizontal \displaysectionheadfalse \displaysectionheadtrue - \ifsectienummer + \ifsectionnumber \doifelsevalue{\??sb\@@sectionblock\c!number}\v!yes {\doifelsevalue{\??ko#1\c!number}\v!yes \headnumbertrue @@ -1620,12 +1645,8 @@ \doifelse{\currentsectionformat}{} {\setglobalcrossreference {\e!previous#1}{}{\realfolio}{}} -% {\setglobalsystemreference\rt!list {\e!previous#1}{\getvalue{\e!previouslocal#1}}}% -% -% {\definereference[\e!previous#1][\getvalue{\e!previouslocal#1}]% -% \def\stoplistreferences{\dostoplistreferences}} \def\dostoplistreferences#1% @@ -1633,21 +1654,21 @@ \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal) \globallet\updatedlistreferences\updatedlistreferences % een noodverbandje \gdef\updatelistreferences% - {\def\docommando####1% -% + {\def\docommand####1% {\setglobalsystemreference\rt!list {\e!previous####1}{\getvalue{\e!currentlocal####1}}}% -% -% {\definereference[\e!previous####1][\getvalue{\e!currentlocal####1}]% -% - \processcommacommand[\updatedlistreferences]\docommando + \processcommacommand[\updatedlistreferences]\docommand \globallet\updatelistreferences\relax \globallet\updatedlistreferences\empty}% \fi} -\def\stoplistreferences% +\def\stoplistreferences {\gobbleoneargument} +\appendtoks + \updatelistreferences +\to\aftereverypage + % \prevdepth\strutdp % is belangrijk, vergelijk naast elkaar: % % \subject{test} \input tufte @@ -2263,7 +2284,7 @@ \def\dosetupheads[#1]% {\getparameters[\??ko][#1]% - \doifelse{\@@kosectionnumber}\v!yes\sectienummertrue\sectienummerfalse} + \doifelse{\@@kosectionnumber}\v!yes\sectionnumbertrue\sectionnumberfalse} \def\setupheads {\dosingleargument\dosetupheads} diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index 189d98396..dd24b3097 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -17,31 +17,35 @@ \unprotect -\newevery \everybodyfont \EveryBodyFont % just to be sure -\newevery \everyfontswitch \EveryFontSwitch % just to be sure -\newevery \everydefinedfont \relax % just to be sure - -\appendtoks \spacing 1\to \everybodyfont -\appendtoks \presetnormallineheight \to \everybodyfont -\appendtoks \setnormalbaselines \to \everybodyfont % check if redundant -\appendtoks \setstrut \to \everybodyfont % check if redundant -\appendtoks \settopskip \to \everybodyfont -\appendtoks \setmaxdepth \to \everybodyfont -%appendtoks \spacing 1\to \everybodyfont -\appendtoks \simplesetupindenting \to \everybodyfont -\appendtoks \simplesetupblank \to \everybodyfont -\appendtoks \simplesetupwhitespace \to \everybodyfont -%appendtoks \checknotes \to \everybodyfont % not -\appendtoks \simplesetupspacing \to \everybodyfont % nieuw -\appendtoks \setdisplayskips \to \everybodyfont % nieuw - +% some will move to core-var + +\newif \ifgridsnapping +\newif \iffuzzyvskip +\let \fuzzyvskip \gobbleoneargument +\let \removelastfuzzyvskip \relax + +\let \startbaselinecorrection \relax +\let \stopbaselinecorrection \relax +\let \baselinecorrection \relax +\let \offbaselinecorrection \relax + +\appendtoks \spacing 1\to \everybodyfont +\appendtoks \presetnormallineheight \to \everybodyfont +\appendtoks \setnormalbaselines \to \everybodyfont % check if redundant +\appendtoks \setstrut \to \everybodyfont % check if redundant +\appendtoks \settopskip \to \everybodyfont +\appendtoks \setmaxdepth \to \everybodyfont +%appendtoks \spacing 1\to \everybodyfont +\appendtoks \simplesetupindenting \to \everybodyfont +\appendtoks \simplesetupblank \to \everybodyfont +\appendtoks \simplesetupwhitespace \to \everybodyfont +%appendtoks \checknotes \to \everybodyfont % not +\appendtoks \simplesetupspacing \to \everybodyfont % nieuw \appendtoks \setrelativeinterlinespace \to \everybodyfont -\appendtoks \updateraggedskips \to \everyfontswitch % under test - -\prependtoks \let\par\endgraf \to \everypagebody % see \fillinline - -\appendtoks \simplesetupspacing \to \everydefinedfont +\appendtoks \updateraggedskips \to \everyfontswitch % under test +\prependtoks \let\par\endgraf \to \everypagebody % see \fillinline +\appendtoks \simplesetupspacing \to \everydefinedfont % if you want to hyphenate the first word of a paragraph ... \appendtoks\hskip0pt\to\everypar @@ -270,7 +274,6 @@ \newif\iflocalblankfixed \newif\iflocalblankflexible -\newif\iffuzzyvskip \def\geenblanko{\removelastskip} % will become obsolete @@ -493,7 +496,7 @@ \defineblankmethod [\v!fixed] {\global\localblankfixedtrue} \defineblankmethod [\v!back] {\global\blankgobacktrue} % {\geenblanko} \defineblankmethod [\v!halfline] {\ifgridsnapping\global\fuzzyvskiptrue\fi - \global\advance\blankskip .5\lineheight} + \global\advance\blankskip .5\lineheight} \defineblankmethod [\v!none] {\global\blankresettrue} \defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi} @@ -1105,8 +1108,8 @@ }%\let\deblanko\v!big} \def\dodefineblank[#1][#2]% - {\def\docommando##1{\setvalue{\??bo##1}{#2}}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\setvalue{\??bo##1}{#2}}% + \processcommalist[#1]\docommand} \def\defineblank {\dodoubleargument\dodefineblank} @@ -1509,18 +1512,9 @@ % \frenchspacing leidt soms tot afbreken tussen -, vandaar % de variant \newfrenchspacing. -\def\dofrenchspacing#1% - {\sfcode`\.#1 \sfcode`\,#1\relax - \sfcode`\?#1 \sfcode`\!#1\relax - \sfcode`\:#1 \sfcode`\;#1\relax} - -\def\frenchspacing {\dofrenchspacing{1000}} -\def\newfrenchspacing{\dofrenchspacing{1050}} - -\def\nonfrenchspacing - {\sfcode`\.3000 \sfcode`\,1250 - \sfcode`\?3000 \sfcode`\!3000 - \sfcode`\:2000 \sfcode`\;1500 } +\def\frenchspacing {\setfrenchspacing{1000}} +\def\newfrenchspacing{\setfrenchspacing{1050}} +\def\nonfrenchspacing{\resetfrenchspacing} \def\definespacingmethod[#1]#2{\setvalue{\??sg\??sg#1}{#2}} @@ -1536,9 +1530,9 @@ \definecomplexorsimple\setupspacing -\catcode`\~=\@@active % to be sure +\unexpanded\def\nonbreakablespace{\penalty\plustenthousand\ } -\unexpanded\def~{\nonbreakablespace} +\letcatcodecommand \ctxcatcodes `\~ \nonbreakablespace \def\space { } \def\removelastspace{\ifhmode\unskip\fi} @@ -1550,31 +1544,32 @@ % % but, since not all fonts have .5em digits: -\def\fixedspace - {\setbox\scratchbox\normalhbox\ifmmode{$0$}\else{0}\fi +\unexpanded\def\fixedspace + {\setbox\scratchbox\normalhbox{\mathortext{0}{0}}% \hskip\wd\scratchbox\relax} \def\fixedspaces - {\catcode`\~=\@@active - \def~{\fixedspace}} - -% \def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\unskip\fi} + {\letcatcodecommand \ctxcatcodes `\~ \fixedspace} \def\removeunwantedspaces - {\ifhmode - \doloop{\ifdim\lastskip>\zeropoint\unskip\else\exitloop\fi}% + {\ifhmode % we also need to unskip 0pt skips + \unskip\unskip\unskip\unskip\unskip + \unskip\unskip\unskip\unskip\unskip \fi} -% better, but not done: +% still not fixed in aleph / luatex +% +% \beginETEX \lastnodetype % -% \def\removelastspace -% {\ifhmode \ifdim\lastskip=\spaceamount\relax -% \unskip +% \def\removeunwantedspaces +% {\ifhmode \ifnum\lastnodetype=\@@gluenode +% \unskip \@EAEAEA\removeunwantedspaces % \fi \fi} % -% due to backward compability +% \endETEX + +%D For old time sake, will disappear soon. -\let\space \space \let\hardespatie\fixedspace \let\geenspatie \nospace @@ -2287,7 +2282,7 @@ % \edef\strutdepth{\the\strutdimen}% % \dosetstrut} -% interesting, strudepth is 4.05064pt vs 4.05066pt depending on grid +% interesting, strutdepth is 4.05064pt vs 4.05066pt depending on grid % nasty rounding problem \def\setstrut @@ -2753,7 +2748,7 @@ \s!unknown=>{\dorepeatwithcommand[#1]\dosinglenarrower}]} \def\complexstartnarrower[#1]% - {\par + {\@@slbefore % was hard coded \par \bgroup \global\ctxleftskip \zeropoint \global\ctxrightskip\zeropoint @@ -2765,13 +2760,15 @@ \advance\rightskip \ctxmidskip \seteffectivehsize} +% todo: definenarrower + \def\simplestartnarrower {\startnarrower[\v!middle]} \definecomplexorsimple\startnarrower \def\stopnarrower - {\par % else skips forgotten + {\@@slafter % was hard coded \par / needed, else skips forgotten \egroup} \def\setupnarrower @@ -2810,7 +2807,8 @@ \def\ibox{\iobox\raggedright\raggedleft} % innerbox \def\dosetraggedvbox#1% - {\processaction + {\let\raggedbox\vbox + \processfirstactioninset [#1] [ \v!left=>\let\raggedbox\lbox, \v!right=>\let\raggedbox\rbox, @@ -2820,12 +2818,11 @@ \v!flushleft=>\let\raggedbox\rbox, \v!flushright=>\let\raggedbox\lbox, \v!center=>\let\raggedbox\cbox, - \v!no=>\def\raggedbox{\vbox\bgroup\raggedright\let\next=}, - \s!default=>\let\raggedbox\vbox, - \s!unknown=>\let\raggedbox\vbox]} + \v!no=>\def\raggedbox{\vbox\bgroup\raggedright\let\next=}]} \def\dosetraggedhbox#1% - {\processaction % slow + {\let\raggedbox\hbox + \processaction % slow [#1] [ \v!left=>\def\raggedbox{\doalignedline\v!left }, \v!right=>\def\raggedbox{\doalignedline\v!right }, @@ -2834,10 +2831,7 @@ \v!outer=>\def\raggedbox{\doalignedline\v!outer }, \v!flushleft=>\def\raggedbox{\doalignedline\v!right }, \v!flushright=>\def\raggedbox{\doalignedline\v!left }, - \v!center=>\def\raggedbox{\doalignedline\v!middle}, - \v!normal=>\let\raggedbox\hbox, - \s!default=>\let\raggedbox\hbox, - \s!unknown=>\let\raggedbox\hbox]} + \v!center=>\def\raggedbox{\doalignedline\v!middle}]} \def\dosetraggedcommand#1% {\expanded{\dodosetraggedcommand{#1}}} @@ -2853,7 +2847,9 @@ % \!!donectrue % \rawprocesscommalist[#1]\dododosetraggedcommand}} -\newtoks\everyraggedcommand \def\raggedcommand{\the\everyraggedcommand} +\newtoks\everyraggedcommand + +\def\raggedcommand{\the\everyraggedcommand} \def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! {\everyraggedcommand \emptytoks @@ -3077,9 +3073,6 @@ \def\forgetspacing {\emergencystretch\zeropoint} -\def\forgetall - {\the\everyforgetall} - \newif\ifforgotten % rather good signal for inner \appendtoks \forgottentrue \to \everyforgetall @@ -3371,82 +3364,6 @@ \endETEX -% \definetwopasslist\s!paragraph -% -% \newcounter\nofraggedparagraphs -% -% \def\doparagraphreference% looks very much like domarginreference -% {\doglobal\increment\nofraggedparagraphs -% \edef\writeparref% -% {\writeutilitycommand% -% {\twopassentry% -% {\s!paragraph}% -% {\nofraggedparagraphs}% -% {\noexpand\realfolio}}}% -% \writeparref} -% -% \def\setraggedparagraphmode#1#2% combineren met \ifrightpage -% {\ifinpagebody -% \ifdoublesided -% \ifodd\realpageno\relax#1\else#2\fi -% \else -% #2\relax -% \fi -% \else\ifinner -% \ifdoublesided -% \gettwopassdata\s!paragraph -% \iftwopassdatafound -% \ifodd\twopassdata\relax#1\else#2\fi -% \else -% \ifodd\realpageno\relax#1\else#2\fi -% \fi -% \doparagraphreference -% \else -% #2\relax -% \fi -% \else -% #2\relax -% \fi\fi} -% -% \def\doifrightpageelse % watch out: other default ! ! ! -% {\ifinpagebody -% % optimalisation ? -% \ifdoublesided -% \ifodd\realpageno\relax -% \twopassdatafoundtrue \else \twopassdatafoundfalse -% \fi -% \else -% \twopassdatafoundtrue -% \fi -% \else -% \ifdoublesided -% \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 -% {\ifdoublesided \ifinpagebody \else -% \doparagraphreference -% \fi \fi} - -% slightly adapted implementation - \newcounter \noftrackedpagestates \newif \ifpagestatemismatch \let \realpagestateno \realfolio @@ -3459,13 +3376,10 @@ \def\doforcedtrackpagestate#1#2% {\ifcase\frozenpagestate - \doglobal\increment\noftrackedpagestates - \doglobal\increment#2% - \edef\dodotrackpagestate - {\writeutilitycommand - {\twopassentry{#1}{\noftrackedpagestates}{#2:\noexpand\realfolio}}}% + \doglobal\increment\noftrackedpagestates\relax + \doglobal\increment#2\relax + \lazysavetaggedtwopassdata{#1}{\noftrackedpagestates}{#2}{\noexpand\realfolio}% %\llap{\infofont\noftrackedpagestates/#2}% tracing - \dodotrackpagestate \fi} \def\doifrightpagestateelse#1#2% @@ -3481,7 +3395,7 @@ \twopassdatafoundtrue \fi \else\ifdoublesided - \findtwopassdata{#1}{#2:}% + \findtwopassdata{#1}{#2}% \iftwopassdatafound \let\realpagestateno\twopassdata \ifnum\twopassdata=\realpageno \else @@ -3513,7 +3427,7 @@ {\ifcase\frozenpagestate \pagestatemismatchfalse \let\realpagestateno\realfolio - \findtwopassdata{#1}{#2:}% + \findtwopassdata{#1}{#2}% \iftwopassdatafound \let\realpagestateno\twopassdata \ifnum\twopassdata=\realpageno \else @@ -3563,7 +3477,10 @@ {\ifcase\pagesignallevel\or\postsignalrightpage\fi \decrement\pagesignallevel} -\def\setraggedparagraphmode{\signalrightpage\doifrightpageelse} % move it there +\def\setraggedparagraphmode + {\signalrightpage\doifrightpageelse} % move it there + +\ifx\swapmargins\undefined \let\swapmargins\undefined \fi % todo \def\doifswappedrightpageelse#1#2% alleen in box construction ! {\doifrightpageelse @@ -3599,7 +3516,7 @@ \def\docheckpagestatechange#1#2#3% {\pagechangedfalse \doforcedtrackpagestate{#2}{#3}% - \findtwopassdata{#2}{#3:}% + \findtwopassdata{#2}{#3}% \iftwopassdatafound \ifnum\twopassdata>0\getvalue{#2:p:#1}\relax \pagechangedtrue @@ -3705,6 +3622,10 @@ \def\middleraggedness {.5\hsize} % was: 6\bodyfontsize, fails on: \placefigure{x $x=x$ x}{} +% oeps, hsize can be 0pt in which case we get a strange division + +\def\middleraggedness {\ifdim\hsize=\zeropoint6\bodyfontsize\else.5\hsize\fi} % was: 6\bodyfontsize, fails on: \placefigure{x $x=x$ x}{} + %D More hyphenation control, will be combined with align %D setup. @@ -3766,19 +3687,65 @@ % \def\notragged% % {\setraggedskips{0}{0em}{0em}{0em}{0em}{1fil}{\parindent}} -% todo +% older (context) names: + +\let\spaceamount \interwordspace +\let\emspaceamount\emwidth + +% tracing: + +\def\doshowpardata#1% + {\ifx#1\relax\else + \hbox{\string#1: \the#1}\endgraf + \expandafter\doshowpardata + \fi} + +\def\showpardata + {\edef\thepardata + {\hbox{font: \fontname\font}\endgraf + \doshowpardata + \interwordspace \interwordstretch \interwordshrink \emwidth \exheight \extraspace + \hsize \vsize + \leftskip \rightskip + \spaceskip \xspaceskip + \parindent \parfillskip + \hyphenpenalty \exhyphenpenalty + \displaywidowpenalty \widowpenalty \clubpenalty \brokenpenalty + \doublehyphendemerits \finalhyphendemerits \adjdemerits + \relax}% + \begingroup + \dontshowcomposition + \inleftmargin{\vsmash + {\switchtobodyfont[7pt,tt]% + \framed[\c!align=\v!right]{\thepardata}}}% + \endgroup} + +\def\startshowpardata + {\begingroup + \showcomposition + \showstruts\tracepositionstrue \tracingparagraphs\maxdimen + \appendtoksonce\showpardata\let\showpardata\relax\to\everypar} + +\def\stopshowpardata + {\endgraf + \endgroup} + +% \defineXMLenvironment[showpardata] \startshowpardata \stopshowpardata +% \defineXMLsingular [showpardata] \showpardata + +% defaults \def\raggedfillamount {1fil} \def\raggedhalffillamount{.5fil} -\def\raggedspaceamount {.3333em} +\def\raggedspaceamount {\interwordspace} % {.3333em} \def\raggedxspaceamount {.5em} \def\notragged {\chardef\raggedstatus\zerocount - \leftskip1\leftskip - \rightskip1\rightskip - \spaceskip\zeropoint - \xspaceskip\zeropoint + \leftskip 1\leftskip + \rightskip 1\rightskip + \spaceskip \zeropoint + \xspaceskip \zeropoint \parfillskip\zeropoint\!!plus\raggedfillamount\relax \let\updateraggedskips\relax} % new @@ -3851,44 +3818,16 @@ % test \vfill test \endgraf \strut \endgraf \vskip-\lineheight \removedepth \pagina test % \stoptext -% Keep this one: -% -% \def\setupalign -% {\dosingleargument\dosetupalign} -% -% \def\dosetupalign[#1]% -% {\expanded{\dodosetupalign[#1]}} -% -% \def\dodosetupalign[#1]% -% {\doifinsetelse\v!broad {#1}\!!doneatrue\!!doneafalse -% \doifinsetelse\v!wide{#1}\!!donebtrue\!!donebfalse -% \ExpandFirstAfter\processallactionsinset % expansion redundant -% [#1] -% [ \v!line=>\baselinebottom, -% \v!bottom=>\raggedbottom, -% \v!height=>\normalbottom, -% \v!width=>\notragged, -% \v!normal=>\notragged, -% \v!yes=>\notragged, -% \v!no=>\raggedright, -% \if@@asragged\v!inner\else\v!outer\fi=>\setraggedparagraphmode\raggedleft\raggedright, -% \if@@asragged\v!outer\else\v!inner\fi=>\setraggedparagraphmode\raggedright\raggedleft, -% \if@@asragged\v!left \else\v!right\fi=>\if!!donea\veryraggedleft \else\raggedleft \fi, -% \if@@asragged\v!right\else\v!left \fi=>\if!!donea\veryraggedright \else\raggedright \fi, -% \v!middle=>\if!!doneb\raggedwidecenter\else\if!!donea\veryraggedcenter\else\raggedcenter\fi\fi, -% \v!flushleft=>\if!!donea\veryraggedright \else\raggedright \fi, -% \v!flushright=>\if!!donea\veryraggedleft \else\raggedleft \fi, -% \v!center=>\if!!doneb\raggedwidecenter\else\if!!donea\veryraggedcenter\else\raggedcenter\fi\fi, -% \v!hanging=>\enableprotruding, -% \v!nothanging=>\disableprotruding, -% \v!hz=>\enableadjusting, -% \v!nohz=>\disableadjusting, -% \v!hyphenated=>\dohyphens, -% \v!nothyphenated=>\nohyphens, -% \v!new=>\@@asraggedfalse, % so new will give you consistency -% \v!reset=>\notragged\normalbottom]} -% -% The next one is more than three times faster: +% \setupalign[reset,new,right,old] + + +\def\@@align@@rl{\if!!donea\veryraggedleft \else\raggedleft \fi} +\def\@@align@@rr{\if!!donea\veryraggedright \else\raggedright \fi} +\def\@@align@@rc{\if!!donea\veryraggedcenter\else\raggedcenter\fi} + +\setvalue{@@align@@\v!new }{\@@asraggedfalse} +\setvalue{@@align@@\v!old }{\@@asraggedtrue} +\setvalue{@@align@@ }{} \setvalue{@@align@@\v!line }{\baselinebottom} \setvalue{@@align@@\v!bottom }{\raggedbottom} @@ -3897,30 +3836,18 @@ \setvalue{@@align@@\v!normal }{\notragged} \setvalue{@@align@@\v!yes }{\notragged} \setvalue{@@align@@\v!no }{\raggedright} -\setvalue{@@align@@\v!inner }{\if@@asragged - \setraggedparagraphmode\raggedleft\raggedright - \else - \setraggedparagraphmode\raggedright\raggedleft - \fi} -\setvalue{@@align@@\v!outer }{\if@@asragged - \setraggedparagraphmode\raggedright\raggedleft - \else - \setraggedparagraphmode\raggedleft\raggedright - \fi} -\setvalue{@@align@@\v!left }{\if@@asragged - \if!!donea\veryraggedleft\else\raggedleft\fi - \else - \if!!donea\veryraggedright\else\raggedright\fi - \fi} -\setvalue{@@align@@\v!right }{\if@@asragged - \if!!donea\veryraggedright\else\raggedright\fi - \else - \if!!donea\veryraggedleft\else\raggedleft\fi - \fi} -\setvalue{@@align@@\v!middle }{\if!!doneb\raggedwidecenter\else\if!!donea\veryraggedcenter\else\raggedcenter\fi\fi} -\setvalue{@@align@@\v!flushleft }{\if!!donea\veryraggedright \else\raggedright \fi} -\setvalue{@@align@@\v!flushright }{\if!!donea\veryraggedleft \else\raggedleft \fi} -\setvalue{@@align@@\v!center }{\if!!doneb\raggedwidecenter\else\if!!donea\veryraggedcenter\else\raggedcenter\fi\fi} +\setvalue{@@align@@\v!inner }{\if@@asragged \setraggedparagraphmode\@@align@@rl\@@align@@rr \else + \setraggedparagraphmode\@@align@@rr\@@align@@rl \fi} +\setvalue{@@align@@\v!outer }{\if@@asragged \setraggedparagraphmode\@@align@@rr\@@align@@rl \else + \setraggedparagraphmode\@@align@@rl\@@align@@rr \fi} +\setvalue{@@align@@\v!left }{\if@@asragged\@@align@@rl\else\@@align@@rr\fi} +\setvalue{@@align@@\v!right }{\if@@asragged\@@align@@rr\else\@@align@@rl\fi} +\setvalue{@@align@@\v!middle }{\if!!doneb\raggedwidecenter\else\@@align@@rc\fi} +\setvalue{@@align@@\v!flushleft }{\if!!donea\veryraggedright \else\raggedright\fi} +\setvalue{@@align@@\v!flushright }{\if!!donea\veryraggedleft \else\raggedleft \fi} +\setvalue{@@align@@\v!flushouter }{\setraggedparagraphmode\raggedleft\raggedright} +\setvalue{@@align@@\v!flushinner }{\setraggedparagraphmode\raggedright\raggedleft} +\setvalue{@@align@@\v!center }{\if!!doneb\raggedwidecenter\else\@@align@@rc\fi} \setvalue{@@align@@\v!hanging }{\enableprotruding} \setvalue{@@align@@\v!nothanging }{\disableprotruding} \setvalue{@@align@@\v!hz }{\enableadjusting} @@ -3939,8 +3866,8 @@ \setvalue{@@ngila@@\v!broad }{\!!doneatrue} \setvalue{@@ngila@@\v!wide }{\!!donebtrue} -\def\dodosetupalign#1{\getvalue{@@align@@#1}} -\def\dodosetupngila#1{\getvalue{@@ngila@@#1}} +\def\dodosetupalign#1{\csname @@align@@#1\endcsname} +\def\dodosetupngila#1{\csname @@ngila@@#1\endcsname} \def\setupalign {\dosingleargument\dosetupalign} @@ -3972,16 +3899,23 @@ % see later for the real definition, which in the simple case is: +\newtoks \everyleftofalignedline +\newtoks \everyrightofalignedline + \def\doalignline#1#2% \\ == newline - {\begingroup - \setlocalhsize % new - \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% - \dowithnextbox - {\noindentation % was \ noindent - \hbox to \localhsize - {\ifcase\alignstrutmode\or\strut\fi - #1\unhbox\nextbox#2}\endgroup} - \hbox} + {\begingroup + \setlocalhsize % new + \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% + \dowithnextbox + {\noindentation % was \ noindent + \dontleavehmode % added in marrakesch at TUG 2006 + \hbox to \localhsize + {\ifcase\alignstrutmode\or\strut\fi + \the\everyleftofalignedline + #1\unhbox\nextbox#2\relax + \the\everyrightofalignedline}% + \endgroup} + \hbox} % directe commando's @@ -3993,10 +3927,9 @@ % indirecte commando's -\letvalue{\s!do\v!line\v!left }\leftaligned -\letvalue{\s!do\v!line\v!right }\rightaligned -\letvalue{\s!do\v!line\v!middle}\midaligned - +\letvalue{\s!do\v!line\v!left }\leftaligned +\letvalue{\s!do\v!line\v!right }\rightaligned +\letvalue{\s!do\v!line\v!middle }\midaligned \letvalue{\s!do\v!line\v!flushleft }\rightaligned \letvalue{\s!do\v!line\v!flushright}\leftaligned \letvalue{\s!do\v!line\v!center }\midaligned @@ -4033,8 +3966,10 @@ \hbox to \localhsize {#1\hskip\ifdone#2\else#3\fi#4% \hbox to \localhsize - {\ifcase\alignstrutmode\or\strut\fi - \ifdone#5\unhbox\nextbox#6\else#6\unhbox\nextbox#5\fi}% + {\the\everyleftofalignedline + \ifcase\alignstrutmode\or\strut\fi + \ifdone#5\unhbox\nextbox#6\else#6\unhbox\nextbox#5\fi + \the\everyrightofalignedline}% \hss}% \egroup} \hbox} @@ -4064,14 +3999,14 @@ \def\doalignedline#1{\csname\s!do\v!line#1\endcsname} -\def\alignedline#1#2% setting default - {\csname - \s!do\v!line - \ifundefined{\s!do\v!line#1}#2\else#1\fi - \endcsname} +% \def\alignedline#1#2% setting default +% {\csname +% \s!do\v!line +% \ifundefined{\s!do\v!line#1}#2\else#1\fi +% \endcsname} -% \def\doalignedline#1% -% {\alignedline{#1}\v!links} +\def\alignedline#1#2% setting default + {\csname\s!do\v!line\ifcsname\s!do\v!line#1\endcsname#1\else#2\fi\endcsname} %D ... @@ -4306,9 +4241,6 @@ \def\hspaceamount#1#2% {\executeifdefined{\??hs#1:#2}{\executeifdefined{\??hs:#2}\zeropoint}} -\def\emspaceamount{\fontdimen6\font} -\def\spaceamount {\fontdimen2\font} - \definehspace [\v!small] [.25\emspaceamount] \definehspace [\v!medium] [.5\emspaceamount] \definehspace [\v!big] [1\emspaceamount] @@ -4658,12 +4590,12 @@ \vtop} \def\flexiblespaceamount#1#2#3% - {#1\fontdimen2\font - \!!plus#2\fontdimen3\font - \!!minus#3\fontdimen4\font} + {#1\interwordspace + \!!plus#2\interwordstretch + \!!minus#3\interwordshrink} \def\fixedspaceamount#1% - {#1\fontdimen2\font} + {#1\interwordspace} %D This is a dangerous feature because it makes the \TEX\ source %D less portable, i.e. any parser now needs to apply exactly the @@ -4725,7 +4657,9 @@ \c!stretch=0] \setupnarrower - [\c!left=1.5em, + [\c!before=\endgraf, + \c!after=\endgraf, + \c!left=1.5em, \c!right=1.5em, \c!middle=1.5em] diff --git a/tex/context/base/core-stg.tex b/tex/context/base/core-stg.tex new file mode 100644 index 000000000..94e5250e5 --- /dev/null +++ b/tex/context/base/core-stg.tex @@ -0,0 +1,72 @@ +%D \module +%D [ file=core-stg, +%D version=2006.08.16, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Strategies, +%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 prelude to strategies. It is rather old code +%D used in a project may years ago. Use with care since I +%D will pick up this thread. (moved from cont-new) + +\unprotect + +\def\s!strategy{strategy} + +\def\currentstrategypass {1} +\def\currentstrategyvariable{0} +\def\maximumstrategypass {8} + +\newconditional\strategypassneeded +\newconditional\strategypassforced + +\definetwopasslist{\s!strategy} + +\def\registerstrategypass% + {\ifnum\currentstrategypass>\maximumstrategypass \else + \ifconditional\strategypassforced + \doglobal\increment\currentstrategypass + \else%\ifconditional\strategypassneeded + %\doglobal\increment\currentstrategypass + \fi%\fi + \fi + \savecurrentvalue\currentstrategypass{\currentstrategypass}} + +\appendtoks \registerstrategypass \to \everybye % \everylastshipout + +\def\setstrategyvariable#1#2% key value + {%\doifnotstrategyvariable{#1}{\global\settrue\strategypassneeded}% + \doglobal\increment\currentstrategyvariable + \savetaggedtwopassdata{\s!strategy}{\currentstrategyvariable}{#1}{#2}} + +\def\doifstrategyvariableelse#1#2#3% + {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi} + +\def\getstrategyvariable#1% key + {\findtwopassdata{\s!strategy}{#1}% + \setxvalue{\s!strategy:#1}{\twopassdata}} + +\def\retainstrategyvariable#1% key + {\expanded{\setstrategyvariable{#1}{\strategyvariable{#1}}}} + +\def\strategyvariable#1% key + {\csname\s!strategy:#1\endcsname} + +\let\stratvar\strategyvariable + +\def\forcestrategy{\global\settrue \strategypassforced} +\def\abortstrategy{\global\setfalse\strategypassforced} + +\def\doifstrategyvariableelse#1#2#3% + {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi} + +\def\doifstrategyvariable #1#2{\doifstrategyvariableelse{#1}{#2}{}} +\def\doifnotstrategyvariable#1#2{\doifstrategyvariableelse{#1}{}{#2}} + +\protect \endinput diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex index 7e7974d3b..3f26b973d 100644 --- a/tex/context/base/core-syn.tex +++ b/tex/context/base/core-syn.tex @@ -63,16 +63,26 @@ \def\currentsynonym{#1}% \definedescription % nog eens een class van maken, net als framed [syndef] - [\c!location=\getvalue{\??sm#1\c!location}, - \c!width=\getvalue{\??sm#1\c!width}, - \c!distance=\getvalue{\??sm#1\c!distance}, - \c!sample=\getvalue{\??sm#1\c!sample}, - \c!hang=\getvalue{\??sm#1\c!hang}, - \c!align=\getvalue{\??sm#1\c!align}, - \c!before=\getvalue{\??sm#1\c!before}, - \c!inbetween=\getvalue{\??sm#1\c!inbetween}, - \c!after=\getvalue{\??sm#1\c!after}, - \c!indentnext=\getvalue{\??sm#1\c!indentnext}, +% [\c!location=\getvalue{\??sm#1\c!location}, % todo \synonymparameter +% \c!width=\getvalue{\??sm#1\c!width}, +% \c!distance=\getvalue{\??sm#1\c!distance}, +% \c!sample=\getvalue{\??sm#1\c!sample}, +% \c!hang=\getvalue{\??sm#1\c!hang}, +% \c!align=\getvalue{\??sm#1\c!align}, +% \c!before=\getvalue{\??sm#1\c!before}, +% \c!inbetween=\getvalue{\??sm#1\c!inbetween}, +% \c!after=\getvalue{\??sm#1\c!after}, +% \c!indentnext=\getvalue{\??sm#1\c!indentnext}, + [\c!location=\synonymparameter\c!location, + \c!width=\synonymparameter\c!width, + \c!distance=\synonymparameter\c!distance, + \c!sample=\synonymparameter\c!sample, + \c!hang=\synonymparameter\c!hang, + \c!align=\synonymparameter\c!align, + \c!before=\synonymparameter\c!before, + \c!inbetween=\synonymparameter\c!inbetween, + \c!after=\synonymparameter\c!after, + \c!indentnext=\synonymparameter\c!indentnext, \c!headstyle=, \c!style=]% \setupwhitespace[\v!none]% diff --git a/tex/context/base/core-sys.mkii b/tex/context/base/core-sys.mkii new file mode 100644 index 000000000..6816364de --- /dev/null +++ b/tex/context/base/core-sys.mkii @@ -0,0 +1,14 @@ +%D \module +%D [ file=core-sys, % moved from main-001 +%D version=1997.03.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=System, +%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 For the moment this file is empty. diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex index 1bbe97d01..92d2b650c 100644 --- a/tex/context/base/core-sys.tex +++ b/tex/context/base/core-sys.tex @@ -21,22 +21,35 @@ {\doifelse{#1}\contextversion {\let\newcontextversion\gobbleoneargument} {\writeline - \writestatus{Fatal Error}{Your format does not match the base files!}% + \writestatus{Fatal Error}{Your format does not match the base files!}% \writeline - \writestatus{Format Version}{\contextversion}% - \writestatus{Files Version}{#1}% + \writestatus{Format Version}{\contextversion\space\contextmark}% + \writestatus{Files Version}{#1}% \batchmode \normalend}} +%D End of lines to the output. \TEX\ will map this onto the platform specific +%D line ending. I hate this mess. + +%newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} +\newlinechar=10 \edef\outputnewlinechar{^^J} + +% in case formats are shared: + +\appendtoks + \bgroup\newlinechar=10\xdef\outputnewlinechar{^^J}\egroup +\to \everyjob + %D Job names. \def\outputfilename {\@@svfile} \def\inputfilename {\@@svinputfile} \def\operatingsystem{\@@svtype} +\let\jobfilename \jobname \let\jobfilesuffix\c!tex -\def\splitjobfilename +\def\splitjobfilename % todo: mkiv {\resetsystemmode{suffix-\jobfilesuffix}% \edef\ascii{\inputfilename}\convertcommand\ascii\to\ascii \splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix @@ -78,17 +91,17 @@ \or \setsystemmode\v!last % 4 : (extra) last run \fi - \processaction - [\@@svtype] - %[ mswin=>\edef\@@svline{\rawcharacter{13}\rawcharacter{10}}, % crlf - [ mswin=>\edef\@@svline{\rawcharacter{13}}, % cr % crlf - darwin=>\edef\@@svline{\rawcharacter{13}}, % cr - \s!unknown=>\edef\@@svline{\rawcharacter{10}}]% % lf +% \processaction +% [\@@svtype] +% %[ mswin=>\edef\@@svline{\rawcharacter{13}\rawcharacter{10}}, % crlf +% [ mswin=>\edef\@@svline{\rawcharacter{13}}, % cr % crlf +% darwin=>\edef\@@svline{\rawcharacter{13}}, % cr +% \s!unknown=>\edef\@@svline{\rawcharacter{10}}]% % lf \splitjobfilename} -\edef\@@svline{\rawcharacter{10}} % unix is the most critical/sensitive system +% \edef\@@svline{\rawcharacter{10}} % unix is the most critical/sensitive system -\def\systemendofline{\@@svline} +\let\systemendofline\outputnewlinechar % will become obsolete \def\setupsystem {\dosingleargument\dosetupsystem} @@ -108,22 +121,6 @@ %D \stoptext %D \stoptyping -% \def\setuprandomize[#1]% -% {\doifsomething{#1} -% {\bgroup -% \setrandomseed\minusone % signals thrd-ran to reseed -% % tex's time is in minutes -% \processaction -% [#1] -% [ \v!small=>\divide\normaltime 15, % 900, -% \v!medium=>\divide\normaltime 30, % 1800, -% \v!big=>\divide\normaltime 60, % 3600, -% \v!normal=>, -% \s!default=>, -% \s!unknown=>\normaltime=#1]% -% \nextrandom -% \egroup}} - \def\setuprandomize[#1]% {\doifsomething{#1} {\bgroup @@ -154,8 +151,6 @@ %D is more picky, so we default to the \type {cr}. I never understood why %D \type {crlf} was not used in all systems, since it makes most sense. -%D - \def\dostartglobaldefs#1#2% {\edef\!!stringa{\the\globaldefs}% \ifnum\globaldefs#10 @@ -209,20 +204,20 @@ \getvalue{\??be#1\c!after}}} \def\dodefinestartstop[#1][#2]% - {\def\docommando##1{\dododefinestartstop[##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\dododefinestartstop[##1][#2]}% + \processcommalist[#1]\docommand} \def\definestartstop {\dodoubleargument\dodefinestartstop} \def\dosetupstartstop[#1][#2]% - {\def\docommando##1{\getparameters[\??be##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??be##1][#2]}% + \processcommalist[#1]\docommand} \def\setupstartstop {\dodoubleargument\dosetupstartstop} -% \docommando kan niet worden gebruikt omdat deze macro +% \docommand kan niet worden gebruikt omdat deze macro % soms lokaal wordt gebruikt % te zijner tijd: @@ -278,8 +273,8 @@ \def\usecommands#1% {\bgroup - \def\docommando##1{\setbox0\hbox{\getvalue{\string##1}##1}}% - \processcommalist[#1]\docommando + \def\docommand##1{\setbox0\hbox{\getvalue{\string##1}##1}}% + \processcommalist[#1]\docommand \egroup} \newif\ifforcefileexpansion % handy for document level overload @@ -367,5 +362,9 @@ % % \def\herhaler {\repeater} % \def\herhaalmetcommando {\dorepeatwithcommand} + +%D Plugins + +\loadmarkfile{core-sys} \protect \endinput diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index 0bdc95814..5828e85f7 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -368,16 +368,10 @@ \gdef\pushouterbarandquote {\ifForgetTableBarAndQuote - \ifnum\catcode`\|=\@@active - \let\outertablebar|% - \else - \let\outertablebar\relax - \fi - \ifnum\catcode`\"=\@@active - \let\outertablequote"% - \else - \let\outertablequote\relax - \fi + \let|\letterbar + \let"\letterdoublequote + \ifnum\catcode`\|=\@@active \let\outertablebar |\else\let\outertablebar \relax\fi + \ifnum\catcode`\"=\@@active \let\outertablequote"\else\let\outertablequote\relax\fi \fi} \gdef\popouterbarandquote @@ -470,7 +464,7 @@ \def\EndTableParBox {\removelastskip % itemize or so - \par + \endgraf \ifnum\prevgraf>\zerocount % we want at least \verticalstrut \nowhitespace \vskip-\struttotal% one line of text \egroup @@ -546,6 +540,11 @@ \!ttInitializeTable \fi} +%D The next redefinition is more robust than the original: + +\def\SetTableToWidth#1% + {\doifelsenothing{#1}{\!taTableSpread\emptytoks}{\!taTableSpread{to #1}}} + % (*) Try this one with \type {direction} and {girection}; % the \PPCHTEX\ manual is a nice testcase. % @@ -969,21 +968,14 @@ {\bgroup \doif\@@tisplit\v!auto {\ifinsidesplitfloat\let\@@tisplit\v!yes\fi}% - \doifelse\@@tisplit\v!yes - {\def\stoptable{\stoptables}% - \setfalse\tablerepeathead - \setfalse\tablerepeattail + \doifinsetelse\@@tisplit{\v!yes,\v!repeat} + {\def\stoptable{\stoptables\egroup}% \starttables} - {\doifelse\@@tisplit\v!repeat - {\def\stoptable{\stoptables}% - \settrue\tablerepeathead - \settrue\tablerepeattail - \starttables} - {\doifelsenothing\@@tiframe - {\ifinsidefloat\else\startbaselinecorrection\fi} - {\startframedcontent[\@@tiframe]}% - \postponefootnotes - \firststagestartTABLE}}} + {\doifelsenothing\@@tiframe + {\ifinsidefloat\else\startbaselinecorrection\fi} + {\startframedcontent[\@@tiframe]}% + \postponefootnotes + \firststagestartTABLE}} \def\stoptable {\chuckTABLEautorow % before the tail, else noalign problem @@ -1081,22 +1073,37 @@ \TABLEtail \TABLEnoalign{\global\setfalse\preventTABLEbreak}} +% \def\dorestartTABLE#1% +% {\gdef\restartTABLE{#1}% +% \restartTABLE +% \insertTABLEhead +% \ifsplittables \ifconditional \tablerepeattail +% \TABLEnoalign{\goodbreak}% +% \insertTABLEtail +% \TABLEnoalign{\goodbreak}% +% \fi \fi} + +\def\verysimpleTableHL + {\TABLEnoalign{\expandafter\normalTABLEfullrule\@@tiHLheight}} + \def\dorestartTABLE#1% {\gdef\restartTABLE{#1}% \restartTABLE + \TABLEnoalign{\globalpushmacro\simpleTableHL\global\let\simpleTableHL\verysimpleTableHL}% \insertTABLEhead \ifsplittables \ifconditional \tablerepeattail \TABLEnoalign{\goodbreak}% \insertTABLEtail \TABLEnoalign{\goodbreak}% - \fi \fi} + \fi \fi + \TABLEnoalign{\globalpopmacro\simpleTableHL}} \def\complexsecondstagestartTABLE#1[#2]% - {\convertargument|\to\asciiA - \convertargument#2\to\asciiB + {\convertargument|\to\asciia + \convertargument#2\to\asciib \global\setfalse\someTABLEhead \global\setfalse\someTABLEtail - \doifinstringelse\asciiA\asciiB + \doifinstringelse\asciia\asciib {\gdef\restartTABLE{\dorestartTABLE{\thirdstagestartTABLE{#2}}}} {\doifdefinedelse{\c!Table#2} {\gdef\restartTABLE{\getvalue{\c!Table#2}}} @@ -1181,6 +1188,9 @@ \def\starttables {\bgroup \splittablestrue + \doifelse\@@tisplit\v!repeat + {\settrue \tablerepeathead\settrue \tablerepeattail} + {\setfalse\tablerepeathead\setfalse\tablerepeattail}% \flushnotes \setbox\tablecontentbox\vbox\bgroup \forgetall @@ -1400,13 +1410,13 @@ \def\checkTABLErow#1% pure for message purposes {\unskip % added \ifTABLEgraydone - \convertargument #1\to\asciiA - \convertcommand\TABLEendBCL\to\asciiB - \ifx\asciiA\asciiB \else - \writestatus\m!TABLE{confusing \asciiA\space and \asciiB}% + \convertargument #1\to\asciia + \convertcommand\TABLEendBCL\to\asciib + \ifx\asciia\asciib \else + \writestatus\m!TABLE{confusing \asciia\space and \asciib}% \gdef\TABLEgraylineerror% {\globalletempty\TABLEgraylineerror - [\asciiA\unskip<->\asciiB\unskip]}% + [\asciia\unskip<->\asciib\unskip]}% \fi \global\TABLEgraydonefalse \fi} diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index edead8e07..902b578b9 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -439,7 +439,7 @@ \edef\pretabskip{\the\scratchdimen}% \let\postabskip\pretabskip \let\gettabulateexit\settabulatepreamble - \@EA\settabulatepreamble\next} + \@EA\settabulatepreamble\next} \def\gettabulatesetups#1% {\setvalue{\@@tabsetups@@\the\tabulatecolumns}{\setups[#1]}% @@ -508,10 +508,10 @@ \def\dogettabulatewidth(#1)% {\processallactionsinset [#1]% - [\v!fit=>\chardef\tabulatemodus\plusthree, - \v!fixed=>\chardef\tabulatemodus\plusthree - \tabulatenopbreaktrue, - \s!unknown=>\tabulatewidth#1\relax]% + [ \v!fit=>\chardef\tabulatemodus\plusthree, + \v!fixed=>\chardef\tabulatemodus\plusthree + \tabulatenopbreaktrue, + \s!unknown=>\tabulatewidth#1\relax]% \ifnum\tabulatedimen=\plusone \global\advance\tabulatepwidth\tabulatewidth \fi @@ -865,12 +865,12 @@ [\tabulateparameter\c!distance] [ \v!blank=>\scratchskip\bigskipamount, \v!depth=>\scratchskip\strutdp, - \v!small=>\def\factor{.25}, - \v!medium=>\def\factor{.5}, - \v!big=>, - \v!none=>\scratchskip\zeropoint\def\factor{0}, - \v!grid=>\scratchskip\zeropoint\def\factor{0}, - \s!unknown=>\scratchskip\commalistelement]% + \v!small=>\def\factor{.25}, + \v!medium=>\def\factor{.5}, + \v!big=>, + \v!none=>\scratchskip\zeropoint\def\factor{0}, + \v!grid=>\scratchskip\zeropoint\def\factor{0}, + \s!unknown=>\scratchskip\commalistelement]% \scratchdimen\factor\scratchskip \ifconditional\tabulatesomeamble\kern\else\vskip\fi\scratchdimen % new \egroup} diff --git a/tex/context/base/core-trf.tex b/tex/context/base/core-trf.tex new file mode 100644 index 000000000..cabafb303 --- /dev/null +++ b/tex/context/base/core-trf.tex @@ -0,0 +1,543 @@ +%D \module +%D [ file=core-fig, +%D version=2006.08.26, % overhaul/split of 1997.03.31 core-fig +%D title=\CONTEXT\ Core Macros, +%D subtitle=Transformations, +%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 It may be that some functionality got lost. If it concerns +%D defined features, let me know and it will be sorted out. + +\writestatus{loading}{Context Core Macros / Transformations} + +\unprotect + +%D Scaling: + +\def\scale{\dodoubleempty\doscalenextbox[\??xy]} + +% probably too many dimens / the width calculations can go +% since we may assume scaling is available (was not true +% long ago which is why we also calculate the width) + +\newdimen\scaleboxwidth +\newdimen\scaleboxheight +\newdimen\scaleboxdepth + +\newdimen\scaleboxsizex +\newdimen\scaleboxsizey +\newdimen\scaleboxoffsetx +\newdimen\scaleboxoffsety + +\newdimen\scaleboxhsize +\newdimen\scaleboxvsize + +% global + +\newdimen\scaleboxdimx \let\figwid \scaleboxdimx +\newdimen\scaleboxdimy \let\fighei \scaleboxdimy +\newcount\scaleboxscax \let\figxsca\scaleboxscax +\newcount\scaleboxscay \let\figysca\scaleboxscay + +\newdimen\scaleboxoutervsize % we cannot manipulate any global vsize ! + +\let\finalscaleboxxscale \!!plusone +\let\finalscaleboxyscale \!!plusone +\let\finalscaleboxwidth \!!zeropoint +\let\finalscaleboxheight \!!zeropoint +\let\finalscaleboxxfactor\!!hundred +\let\finalscaleboxyfactor\!!hundred + +\newconditional\scaleboxdone + +\def\doscalenextbox[#1][#2]% + {\bgroup + \getparameters + [#1] + [\c!scale=,\c!xscale=,\c!yscale=,\c!width=,\c!height=,\c!lines=, + \c!factor=,\c!hfactor=,\c!wfactor=,\c!grid=,\c!sx=1,\c!sy=1, + \c!maxwidth=\scaleparameter\c!width,\c!maxheight=\scaleparameter\c!height, + #2]% + \dowithnextbox{\dodoscalenextbox{#1}\egroup}\hbox} + +\def\doscalebox#1% + {\bgroup\dowithnextbox{\dodoscalenextbox{#1}\egroup}\hbox} + +\let\currentscaletag\??xy + +\def\scaleparameter#1% + {\csname\currentscaletag#1\endcsname} + +\def\dodoscalenextbox#1% + {\edef\currentscaletag{#1}% + \forgetall + \dontshowcomposition + \dontcomplain + \doscaleboxcalculations + \doscaleboxindeed + \flushnextbox} + +\def\doscaleboxindeed + {\ifconditional\scaleboxdone + \scaleboxwidth \finalscaleboxxscale\nextboxwd + \scaleboxheight\finalscaleboxyscale\nextboxht + \scaleboxdepth \finalscaleboxyscale\nextboxdp + \setbox\nextbox\hbox + {\dostartscaling \finalscaleboxxscale \finalscaleboxyscale + \smashedbox\nextbox + \dostopscaling}% + \nextboxwd\scaleboxwidth + \nextboxht\scaleboxheight + \nextboxdp\scaleboxdepth + \fi} + +\def\doscaleboxcalculations + {\setfalse\scaleboxdone + % initial final value + \global\let\finalscaleboxxscale \!!plusone + \global\let\finalscaleboxyscale \!!plusone + \xdef \finalscaleboxwidth {\the\nextboxwd}% + \xdef \finalscaleboxheight{\the\nextboxht}% + \global\let\finalscaleboxxfactor\!!hundred + \global\let\finalscaleboxyfactor\!!hundred + \ifdim\nextboxht>\zeropoint \ifdim\nextboxwd>\zeropoint + \edef\scaleboxstampa % slow way [can be combined] + {\scaleparameter\c!scale \scaleparameter\c!xscale \scaleparameter\c!yscale + \scaleparameter\c!factor\scaleparameter\c!wfactor\scaleparameter\c!hfactor + \scaleparameter\c!lines \scaleparameter\c!width \scaleparameter\c!height}% + \edef\scaleboxstampb % fast way [just sx/sy] + {\scaleparameter\c!sx + \scaleparameter\c!sy}% + \ifx\scaleboxstampa\empty + \ifx\scaleboxstampb\empty + % no scaling + \else + \dosetscalboxsxsy + \nodoscaleboxcalculations + \fi + \else + \ifx\scaleboxstampb\empty + % no need to check further + \else + \dosetscalboxsxsy + \fi + \dodoscaleboxcalculations + \fi + \fi \fi} + +\def\dosetscalboxsxsy + {\ifdim\scaleparameter\c!sx\onepoint=\onepoint\else + \setevalue{\currentscaletag\c!width }{\the\dimexpr\scaleparameter\c!sx\wd\nextbox\relax}% + \fi + \ifdim\scaleparameter\c!sy\onepoint=\onepoint\else + \setevalue{\currentscaletag\c!height}{\the\dimexpr\scaleparameter\c!sy\ht\nextbox\relax}% + \fi} + +\def\doscaleboxrounding#1.#2\relax{#1} + +\def\scaleboxrounding#1% + {\@EA\@EA\@EA\doscaleboxrounding\@EA\WITHOUTPT\the\dimexpr#1\points*100+32768sp\relax.\relax} + +\def\nodoscaleboxcalculations + {\settrue\scaleboxdone + \xdef\finalscaleboxwidth {\the\dimexpr\scaleparameter\c!sx\wd\nextbox\relax}% + \xdef\finalscaleboxheight {\the\dimexpr\scaleparameter\c!sy\ht\nextbox\relax}% + \xdef\finalscaleboxxscale {\scaleparameter\c!sx}% + \xdef\finalscaleboxyscale {\scaleparameter\c!sy}% + \ifx\finalscaleboxxscale\empty\let\finalscaleboxxscale\!!plusone\fi + \ifx\finalscaleboxyscale\empty\let\finalscaleboxyscale\!!plusone\fi + \xdef\finalscaleboxxfactor{\scaleboxrounding\finalscaleboxxscale}% + \xdef\finalscaleboxyfactor{\scaleboxrounding\finalscaleboxyscale}} + +\def\dodoscaleboxcalculations + {\settrue\scaleboxdone + % initial values + \scaleboxoffsetx\zeropoint + \scaleboxoffsety\zeropoint + \scaleboxsizex \nextboxwd + \scaleboxsizey \nextboxht % alleen ht wordt geschaald! + % final values + \global\scaleboxdimx \zeropoint % see note * (core-fig) + \global\scaleboxdimy \zeropoint % see note * (core-fig) + \scaleboxscax \plusone % see note * (core-fig) + \scaleboxscay \plusone % see note * (core-fig) + % preparations + \checkscaleboxsettings + % calculators + %setscaleboxbynature % when? needed? + \setscaleboxbyfactor + \setscaleboxbyscale + \setscaleboxbydimension + % finalizers / to be done (no longer needed this way, clean up) + \convertscaleboxinsertscale\scaleboxhsize\figx\scaleboxscax\scax + \convertscaleboxinsertscale\scaleboxvsize\figy\scaleboxscay\scay + % used in actual scaling + \xdef\finalscaleboxwidth {\the\scaleboxdimx}% + \xdef\finalscaleboxheight {\the\scaleboxdimy}% + \xdef\finalscaleboxxfactor{\the\scaleboxscax}% + \xdef\finalscaleboxyfactor{\the\scaleboxscay}% + \xdef\finalscaleboxxscale {\withoutpt\the\dimexpr\scax\points/\plushundred\relax}% + \xdef\finalscaleboxyscale {\withoutpt\the\dimexpr\scay\points/\plushundred\relax}} + +\def\checkscaleboxsettings + {\doifsomething{\scaleparameter\c!maxwidth }% can be defined in itself + {\setevalue{\currentscaletag\c!maxwidth }{\the\dimexpr\scaleparameter\c!maxwidth \relax}}% + \doifsomething{\scaleparameter\c!maxheight}% can be defined in itself + {\setevalue{\currentscaletag\c!maxheight}{\the\dimexpr\scaleparameter\c!maxheight\relax}}% + \doifsomething{\scaleparameter\c!lines} + {\setevalue{\currentscaletag\c!height}{\the\dimexpr\scaleparameter\c!lines\lineheight\relax}}% + \doifsomething{\scaleparameter\c!grid} + {\processaction + [\scaleparameter\c!grid] + [ \v!yes=>\getnoflines\fighei + \setevalue{\currentscaletag\c!height}{\the\noflines\lineheight}, + \v!height=>\getrawnoflines\fighei + \setevalue{\currentscaletag\c!height}{\the\dimexpr\noflines\lineheight+\strutdepth\relax}, + \v!depth=>\getrawnoflines\fighei + \setevalue{\currentscaletag\c!height}{\the\dimexpr\noflines\lineheight-\strutdepth\relax}, + \v!halfline=>\getrawnoflines\fighei + \setevalue{\currentscaletag\c!height}{\the\dimexpr\noflines\lineheight+.5\lineheight\relax}, + \v!fit=>\getrawnoflines\fighei + \setevalue{\currentscaletag\c!height}{\the\noflines\lineheight}]}} + +\def\setscaleboxbynature % where ! ! ! ! ! + {\doifsomething{\scaleparameter\c!width }{\global\scaleboxdimx\scaleparameter\c!width }% + \doifsomething{\scaleparameter\c!height}{\global\scaleboxdimy\scaleparameter\c!height}% + \doifsomething{\scaleparameter\c!scale } {\scaleboxscax\scaleparameter\c!scale + \scaleboxscay\scaleparameter\c!scale }% + \doifsomething{\scaleparameter\c!xscale} {\scaleboxscax\scaleparameter\c!xscale}% + \doifsomething{\scaleparameter\c!yscale} {\scaleboxscay\scaleparameter\c!yscale}} % oeps, was x + +\def\setscaleboxbyfactor + {\doifinsetelse{\scaleparameter\c!factor}{\v!max,\v!fit,\v!broad} + {\doapplyscaleboxsize + \ifdim\scaleboxsizex>\scaleboxsizey + \docalculatescaleboxnorm \scaleboxdimx\c!factor\c!maxwidth\hsize\scaleboxhsize + \docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey + \else + \docalculatescaleboxnorm \scaleboxdimy\c!factor\c!maxheight\scaleboxoutervsize\scaleboxvsize + \docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex + \fi + \donetrue} + {\doifinsetelse{\scaleparameter\c!hfactor}{\v!max,\v!fit,\v!broad} + {\doapplyscaleboxsize + \docalculatescaleboxnorm \scaleboxdimy\c!hfactor\c!maxheight\scaleboxoutervsize\scaleboxvsize + \docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex + \donetrue} + {\doifinsetelse{\scaleparameter\c!wfactor}{\v!max,\v!fit,\v!broad} + {\doapplyscaleboxsize + \docalculatescaleboxnorm \scaleboxdimx\c!wfactor\c!maxwidth\hsize\scaleboxhsize + \docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey + \donetrue} + {\docalculatescaleboxnorm\scaleboxdimy\c!factor \c!height \textheight\scaleboxvsize + \docalculatescaleboxnorm\scaleboxdimy\c!hfactor\c!height \textheight\scaleboxvsize + \docalculatescaleboxnorm\scaleboxdimx\c!wfactor\c!width \hsize \hsize + \donefalse}}}% + \ifdone + \ifdim\scaleboxdimx>\scaleboxhsize + \global\scaleboxdimy\zeropoint \global\scaleboxdimx\scaleboxhsize + \else\ifdim\scaleboxdimy>\scaleboxvsize + \global\scaleboxdimx\zeropoint \global\scaleboxdimy\scaleboxvsize + \fi\fi + \fi} + +\def\setscaleboxbyscale + {\doifsomething{\scaleparameter\c!scale\scaleparameter\c!xscale\scaleparameter\c!yscale} + {\doapplyscaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax\c!xscale + \doapplyscaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay\c!yscale + \global\scaleboxdimx\zeropoint + \global\scaleboxdimy\zeropoint + \doifelsenothing{\scaleparameter\c!maxwidth} + {\doifsomething{\scaleparameter\c!maxheight} + {\ifdim\scaleboxsizey>\scaleparameter\c!maxheight\relax + \global\scaleboxdimy\scaleparameter\c!maxheight + \fi}} + {\ifdim\scaleboxsizex>\scaleparameter\c!maxwidth\relax + \global\scaleboxdimx\scaleparameter\c!maxwidth + \fi}}} + +\def\setscaleboxbydimension + {\ifdim\scaleboxdimx>\zeropoint + \ifdim\scaleboxdimy>\zeropoint + \dosetdimensionscaleboxsize + {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay + \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}% + {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay + \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}% + {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay + \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}% + \else + \dosetdimensionscaleboxsize + {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}% + {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}% + {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}% + \fi + \else + \ifdim\scaleboxdimy>\zeropoint + \dosetdimensionscaleboxsize + {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}% + {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}% + {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}% + \else + \dosetdimensionscaleboxsize + {\doapplyscaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax\c!xscale + \doapplyscaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay\c!yscale}% + {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}% + {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}% + \fi + \fi} + +\def\dosetdimensionscaleboxsize#1#2#3% + {#1\relax + \doifsomething{\scaleparameter\c!maxwidth} + {\ifdim\scaleboxdimx>\scaleparameter\c!maxwidth\relax + \global\scaleboxdimx\scaleparameter\c!maxwidth + #2\relax + \fi}% + \doifsomething{\scaleparameter\c!maxheight} + {\ifdim\scaleboxdimy>\scaleparameter\c!maxheight\relax + \global\scaleboxdimy\scaleparameter\c!maxheight + #3\relax + \fi}} + +\def\docalculatescaleboxnorm#1#2#3#4#5% 2 3 parameters + {\processaction + [\scaleparameter#2] + [ \v!max=>\global#1\dimexpr#4\relax, + \v!fit=>\global#1\dimexpr#5\relax, + \v!broad=>\global#1\dimexpr#5-4\@@exbodyfont\relax, + \s!default=>\doifsomething{\scaleparameter#3}{\global#1\dimexpr\scaleparameter#3\relax}, + \s!unknown=>\global#1\dimexpr\scaleparameter#2\dimexpr\@@exbodyfont/10\relax\relax]} + +\def\docalculatescaleboxscales#1#2#3#4% + {\scratchdimen\dimexpr#1/\dimexpr#2/\plusthousand\relax\relax + \scaleboxscax\scratchdimen + \scaleboxscay\scratchdimen + #3\dimexpr\scaleboxscax\dimexpr#4/\plusthousand\relax\relax} + +\def\docalculatescaleboxscale#1#2#3% + {#3\dimexpr#1/\dimexpr#2/\plusthousand\relax\relax} + +\def\doapplyscaleboxscale#1#2#3#4% $4 = parameter / scale can be empty + {\ifcase0\scaleparameter#4\relax + \ifcase0\scaleparameter\c!scale\relax + #3=\plusthousand + \else + #3=\scaleparameter\c!scale + \fi + \else + #3=\scaleparameter#4% + \fi + \relax % important ! still ? + \global#1\ifnum#3=\plusthousand#2\else\dimexpr#3\dimexpr#2/\plusthousand\relax\relax\fi + \relax} + +\def\doapplyscaleboxsize + {\doifelsenothing{\scaleparameter\c!maxheight} + {\scaleboxoutervsize\textheight + \ifinner + \scaleboxoutervsize \vsize % \textheight =\vsize + \scratchdimen\vsize % \scratchdimen=\textheight + \else\ifinsidefloat + \scaleboxoutervsize \vsize % \textheight =\vsize + \scratchdimen\vsize % \scratchdimen=\textheight + \else\ifinpagebody + \scaleboxoutervsize \vsize % \textheight =\vsize + \scratchdimen\vsize % \scratchdimen=\textheight + \else % hm, there should be an option to force this + \ifdim\pagegoal<\maxdimen + \ifdim\pagetotal<\pagegoal + \scratchdimen\pagegoal + \advance\scratchdimen -\pagetotal + \else + \scratchdimen\scaleboxoutervsize % \textheight + \fi + \else + \scratchdimen\scaleboxoutervsize % \textheight + \fi + \fi\fi\fi} + {\scaleboxoutervsize\scaleparameter\c!maxheight}% + \doifelsenothing{\scaleparameter\c!height} + {\scaleboxvsize\scratchdimen} + {\scaleboxvsize\scaleparameter\c!height}% + \doifelsenothing{\scaleparameter\c!width} + {\scaleboxhsize\hsize} + {\scaleboxhsize\scaleparameter\c!width}} + +\def\convertscaleboxinsertscale#1#2#3#4% + {\scratchdimen#1\relax + \ifnum#3=\plusthousand + % == scale 1 + \else + % better 1000 100 10 ranges, evt round 2sp + \divide\scratchdimen \plusthousand + \multiply\scratchdimen #3\relax + \fi + \scratchdimen-\scratchdimen % beter hier - dan in driver + \edef#2{\the\scratchdimen}% + \scratchcounter#3\relax + \ifnum\scratchcounter>\plustenthousand + \divide\scratchcounter\!!ten \scratchdimen\the\scratchcounter\points + \else + \scratchdimen\the\scratchcounter\points \divide\scratchdimen\!!ten + \fi + \edef#4{\withoutpt\the\scratchdimen}} + + +%D \macros +%D {clip, setupclipping} +%D +%D Although related to figures, clipping can be applied to +%D arbitrary content. We can use \METAPOST\ to provide a non +%D rectangular clipping path. +%D +%D \starttyping +%D \startMPclip{fun} +%D clip currentpicture to fullcircle +%D shifted (.5,.5) xscaled \width yscaled \height ; +%D \stopMPclip +%D \stoptyping +%D +%D We get a rectangular piece of the figure when we say: +%D +%D \starttyping +%D \clip[x=2,y=1]{\externalfigure[photo]} +%D \stoptyping +%D +%D When we want to clip to the oval we defined a few lines ago, +%D we say: +%D +%D \starttyping +%D \clip[nx=1,ny=1,x=1,y=1,mp=fun]{\externalfigure[photo]} +%D \stoptyping +%D +%D The general characteristics of clipping can be set up with +%D +%D \showsetup{setupclipping} + +\def\setupclipping + {\dodoubleargument\getparameters[\??cp]} + +\def\clip + {\dosingleempty\doclip} + +\def\doclip[#1]% nb top->bottom left->right + {\bgroup + \getparameters[\??cp][#1]% + \doifelse\@@cpstate\v!start\dodoclip{\egroup\hbox}} + +\def\dodoclip + {\dowithnextbox + {\ifdim\@@cpwidth>\zeropoint + \!!dimena\@@cpwidth + \!!dimenc\@@cphoffset + \else + \!!dimena\nextboxwd + \divide\!!dimena \@@cpnx + \!!dimenc\@@cpx\!!dimena + \advance\!!dimenc -\!!dimena + \!!dimena\@@cpsx\!!dimena + \fi + \relax % sure + \ifdim\@@cpheight>\zeropoint + \!!dimenb\@@cpheight + \!!dimend\nextboxht + \advance\!!dimend -\@@cpvoffset + \advance\!!dimend -\!!dimenb + \else + \!!dimenb\nextboxht + \divide\!!dimenb \@@cpny + \!!dimend-\@@cpy\!!dimenb + \advance\!!dimend -\@@cpsy\!!dimenb + \advance\!!dimend \!!dimenb + \!!dimenb\@@cpsy\!!dimenb + \advance\!!dimend \nextboxht % dimend ! + \fi + \setbox\nextbox\hbox % old + {\advance\!!dimenc -\@@cpleftoffset % new ! + \advance\!!dimend -\@@cpbottomoffset % new ! % - added + \hskip-\!!dimenc\lower\!!dimend\flushnextbox}% old + \nextboxwd\zeropoint + \nextboxht\zeropoint + \nextboxdp\zeropoint + \setbox\nextbox\hbox + {\advance\!!dimena \@@cpleftoffset % new ! + \advance\!!dimena \@@cprightoffset % new ! + \advance\!!dimenb \@@cpbottomoffset % new ! + \advance\!!dimenb \@@cptopoffset % new ! + \dostartclipping\@@cpmp\!!dimena\!!dimenb % old + \flushnextbox + \dostopclipping}% + \setbox\nextbox\hbox % new ! + {\!!dimena-\@@cpleftoffset % new ! + \!!dimenb \@@cpbottomoffset % new ! % - removed + \hskip\!!dimena\lower\!!dimenb\flushnextbox}% new ! + \nextboxwd\!!dimena + \nextboxht\!!dimenb + \nextboxdp\zeropoint + \flushnextbox + \egroup}% + \hbox} + +\setupclipping + [\c!state=\v!start, + \c!n=1, % was 2 + \c!nx=\@@cpn,\c!x=1,\c!sx=1, + \c!ny=\@@cpn,\c!y=1,\c!sy=1, + \c!width=\!!zeropoint, + \c!height=\!!zeropoint, + \c!hoffset=\!!zeropoint, + \c!voffset=\!!zeropoint, + \c!offset=\zeropoint, + \c!leftoffset=\@@cpoffset, % \zeropoint, + \c!rightoffset=\@@cpoffset, % \zeropoint, + \c!topoffset=\@@cpoffset, % \zeropoint, + \c!bottomoffset=\@@cpoffset,% \zeropoint, + \c!mp=] + +%D \startbuffer +%D \startuseMPgraphic{test} +%D path p ; p := fullcircle scaled 4cm ; +%D draw p withpen pencircle scaled 1cm ; +%D setbounds currentpicture to boundingbox p ; +%D \stopuseMPgraphic +%D +%D \hbox to \hsize \bgroup +%D \hss +%D \ruledhbox{\useMPgraphic{test}}% +%D \hss +%D \ruledhbox{\clip{\useMPgraphic{test}}}% +%D \hss +%D \egroup +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +%D Mirroring. + +\def\domirrorbox % \hbox/\vbox/\vtop + {\bgroup + \dowithnextbox + {\dontshowcomposition + \scratchdimen\nextboxwd + % better use an hbox (if no \forgetall, leftskip etc may creep in) + %\setbox\nextbox\vbox{\forgetall\dostartmirroring\hskip-\nextboxwd\flushnextbox\dostopmirroring}% + \setbox\nextbox\hbox{\dostartmirroring\hskip-\nextboxwd\flushnextbox\dostopmirroring}% + \nextboxwd\scratchdimen + \flushnextbox + \egroup}} + +\def\mirror + {\domirrorbox\hbox} + +% \setbox0=\hbox{gans} +% \ruledhbox{\copy0 \schaal[sx=2,sy=2]{\copy0}} +% \mirror{\ruledhbox{\copy0 \schaal{\box0}}} + +\protect \endinput diff --git a/tex/context/base/core-tsp.tex b/tex/context/base/core-tsp.tex index dd2b42f61..5523c2ccd 100644 --- a/tex/context/base/core-tsp.tex +++ b/tex/context/base/core-tsp.tex @@ -23,9 +23,7 @@ % only to be used with single tokens (will be prim) -\ifx\htdp\undefined - \def\htdp#1{\dimexpr\ht#1+\dp#1\relax} -\fi +\ifx\htdp\undefined \def\htdp#1{\dimexpr\ht#1+\dp#1\relax} \fi %D Although the name resembles floats, and therefore this should be %D a page module, we decided to make it core functionality because the @@ -50,52 +48,6 @@ \def\splitfloat {\dosingleempty\dosplitfloat} -% \def\dosplitfloat[#1]#2% nog dubbele refs -% {\ifinsidecolumns % tzt ook nog figuren splitten -% % not yet supported -% \else -% \bgroup -% \insidefloattrue -% \insidesplitfloattrue -% \getparameters[\??si][#1]% -% \resetnumber[\??si]% -% \def\floatcaptionsuffix{\convertednumber[\??si]}% -% % \TABLEcaptionheight\@@silines\lineheight% brrr -% % todo: auto == \getnoflines\captionheight -% \let\extrasplitfloatlines\@@silines -% \the\everysplitfloatsetup -% \simplifypagebreak % \page becomes \goodbreak, no fails misserably -% % todo: a preceding float does not count yet -% % so we need a better predictor -% \dowithnextbox -% {\forgetall -% \dontcomplain -% \chardef\nodelocationmode\zerocount -% \doloop -% {\setbox2\vsplit\nextbox to \lineheight -% \setbox2\vbox{\unvbox2} -% \ifdim\ht2>\lineheight -% \incrementnumber[\??si]% -% \ifcase\rawnumber[\??si]\or \ifdim\nextboxht=\zeropoint -% \let\floatcaptionsuffix\empty -% \fi \fi -% \bgroup -% #2{\unvbox2} -% \egroup -% \ifdim\nextboxht>\zeropoint -% \page -% \decrementnumber[\floatcaptionnumber]% -% \fi -% \fi -% \ifdim\nextboxht>\zeropoint -% \page -% \else -% \expandafter\exitloop -% \fi}% -% \egroup} -% \vbox -% \fi} - \ifx\floatcaptionsuffix\undefined \else \let\floatcaptionsuffix\empty % will become \splitfloatcaptionsuffix \fi @@ -207,7 +159,7 @@ \fi \fi} -\def\analyzesplitfloatcaption#1% depend son page-flt +\def\analyzesplitfloatcaption#1% depends on page-flt {\doif\extrasplitfloatlines\v!auto {\bgroup \settrue\retainfloatnumber @@ -251,8 +203,8 @@ \newbox\tsplitnext \newbox\tsplittail -\def\resettsplit - {\def\tsplitminimumfreelines{0}% +\def\resettsplit{% only \def's starting a a new line are seen by the dep checker + \def\tsplitminimumfreelines{0}% \def\tsplitminimumfreespace{0pt}% \setbox\tsplitcontent \vbox{}% \setbox\tsplitresult \vbox{}% @@ -264,7 +216,8 @@ \let\tsplitinbetween \donothing \let\tsplitbefore \donothing \let\tsplitafter \donothing - \let\postprocesstsplit \donothing} + \let\postprocesstsplit \donothing +} \resettsplit @@ -317,11 +270,15 @@ \else \!!donedfalse % no tablehead \fi + \splittopskip\zeropoint \doloop {\setbox\scratchbox\vsplit\tsplitcontent to \onepoint % \lineheight \setbox\scratchbox\vbox{\unvbox\scratchbox}% \ifdim\dimexpr\scratchdimen-\htdp\scratchbox-\htdp\tsplitresult\relax>\zeropoint - \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}% + \setbox\tsplitresult\vbox + {\unvbox\tsplitresult + \tsplitinbetween + \unvbox\scratchbox}% \ifvoid\tsplitcontent \exitloop \fi \else\if!!doned % we only have a tablehead so far @@ -330,11 +287,15 @@ \else\if!!donec % we have text height available, but the (one) cell is too % large to fit, so, in order to avoid loops/deadcycles we do: - \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}% + \setbox\tsplitresult\vbox + {\unvbox\tsplitresult + \tsplitinbetween + \unvbox\scratchbox}% \exitloop \else \setbox\tsplitcontent\vbox {\unvbox\scratchbox + \tsplitinbetween \ifvoid\tsplitcontent\else\unvbox\tsplitcontent\fi}% \exitloop \fi\fi\fi @@ -343,7 +304,10 @@ \postprocesstsplit \dochecksplitofffloat\tsplitcontent \ifvoid\tsplitcontent - \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvcopy\tsplittail}% + \setbox\tsplitresult\vbox + {\unvbox\tsplitresult + \tsplitinbetween + \unvcopy\tsplittail}% \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}% \doifnotinsidesplitfloat\tsplitafter \endgraf @@ -355,7 +319,10 @@ \fi % brrr \ifdim\ht\tsplitresult>\zeropoint - \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvcopy\tsplittail}% + \setbox\tsplitresult\vbox + {\unvbox\tsplitresult + \tsplitinbetween + \unvcopy\tsplittail}% \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}% \doifnotinsidesplitfloat\tsplitafter \endgraf diff --git a/tex/context/base/core-two.mkii b/tex/context/base/core-two.mkii new file mode 100644 index 000000000..38bf1b8d4 --- /dev/null +++ b/tex/context/base/core-two.mkii @@ -0,0 +1,149 @@ +%D \module +%D [ file=core-two, % moved from core-uti +%D version=1997.03.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Two Pass Data, +%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 We save two pass information in the utility file. + +\def\resettwopassentries + {\let\twopassentry\gobblethreearguments} + +\addutilityreset{twopassentries} + +\resettwopassentries + +\def\settwopassentries + {\def\twopassentry##1{\executeifdefined{@@##1\s!pass}\gobbletwoarguments}} + +\def\savetwopassdata#1#2#3% + {\immediatewriteutilitycommand{\twopassentry{#1}{#2}{#3}}} + +\def\lazysavetwopassdata#1#2#3% expanded ! + {\expanded{\writeutilitycommand{\noexpand\twopassentry{#1}{#2}{#3}}}} + +\def\savetaggedtwopassdata#1#2#3#4% + {\immediatewriteutilitycommand{\twopassentry{#1}{#2}{#3::#4}}} + +\def\lazysavetaggedtwopassdata#1#2#3#4% expanded ! + {\expanded{\writeutilitycommand{\noexpand\twopassentry{#1}{#2}{#3::#4}}}} + +\def\appendtwopasselement#1#2#3% can sometimes become a large list + {%\debuggerinfo{\m!systems}{twopass data #1 - #2 = #3}% + \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}{\dosettwopasslist {#1}}% + \setgvalue{\s!reset#1\s!pass}{\doresettwopasslist{#1}}% + \getvalue {\s!reset#1\s!pass}}} + +\def\definetwopasslist#1% + {\expanded{\dodefinetwopasslist{#1}}% + \doglobal\addtocommalist{#1}\alltwopasslists} + +\def\dosettwopasslist#1% + {\letgvalue{\s!set#1\s!pass}\gobbletwoarguments + \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}} + +\def\doresettwopasslist#1% + {\letgvalue{@@#1\s!pass}\gobbletwoarguments} + +\def\doloadtwopassdata#1% + {\doifundefined{#1:\s!list} + {\startnointerference + \letgvalueempty{#1:\s!list}% + \protectlabels + \doutilities{twopassentries,#1\s!pass}\jobname\empty\relax\relax + \stopnointerference}} + +\def\loadtwopassdata + {\ifx\alltwopasslists\empty\else + \processcommacommand[\alltwopasslists]\doloadtwopassdata + \globallet\alltwopassdata\empty + \fi} + +\def\dogettwopassdata[#1,#2]#3#4% + {\edef\twopassdata{#1}% + \ifx\twopassdata\empty + \twopassdatafoundfalse + \let\twopassdata\empty + \else + \twopassdatafoundtrue + \ifcase#4\or\setxvalue{#3:\s!list}{#2}\fi + \fi} + +\def\gettwopassdata#1% + {\loadtwopassdata \@EAEAEA\dogettwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname,]{#1}\plusone} + +\def\checktwopassdata#1% + {\loadtwopassdata \@EAEAEA\dogettwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname,]{#1}\zerocount} + +\def\findtwopassdata#1#2% + {\loadtwopassdata \expanded{\dofindtwopassdata{#1}{#2}}} + +\def\dofindtwopassdata#1#2% + {\def\dodofindtwopassdata[##1,##2#2::##3,##4]{\edef\twopassdata{##3}}% + \@EAEAEA\dodofindtwopassdata\@EA\@EA\@EA[\@EA\@EA\@EA,\csname#1:\s!list\endcsname,#2,#2::,]% + \ifx\twopassdata\empty + \twopassdatafoundfalse + \else + \twopassdatafoundtrue + \fi} + +\let\getfirsttwopassdata\checktwopassdata + +\def\getlasttwopassdata#1% + {\loadtwopassdata + \scratchcounter\zerocount + \@EAEAEA\rawprocesscommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname]\dogetlasttwopassdata + \edef\noftwopassitems{\the\scratchcounter}% + \iftwopassdatafound\else + \let\twopassdata\empty + \fi} + +\def\dogetlasttwopassdata#1% + {\edef\nexttwopassdata{#1}% + \ifx\nexttwopassdata\empty \else + \let\twopassdata\nexttwopassdata + \advance\scratchcounter \plusone + \twopassdatafoundtrue + \fi} + +\def\getfromtwopassdata#1#2% + {\loadtwopassdata + \@EAEAEA\getfromcommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname][#2]% + \ifx\commalistelement\empty + \twopassdatafoundfalse + \let\twopassdata\empty + \else + \twopassdatafoundtrue + \let\twopassdata\commalistelement + \fi} + +\def\gettwopassdatalist#1% + {\loadtwopassdata + \letcscsname\twopassdatalist\csname#1:\s!list\endcsname + \ifx\twopassdatalist\relax\let\twopassdatalist\empty\fi} + +\def\gettwopassdatalist + {\getnamedtwopassdatalist\twopassdatalist} + +\def\doifelseintwopassdata#1#2% tag dat + {\gettwopassdatalist{#1}% + \expanded{\doifinsetelse{#2}{\twopassdatalist}}} + +\protect \endinput diff --git a/tex/context/base/core-two.tex b/tex/context/base/core-two.tex new file mode 100644 index 000000000..ebe601f19 --- /dev/null +++ b/tex/context/base/core-two.tex @@ -0,0 +1,102 @@ +%D \module +%D [ file=core-two, % moved from core-uti +%D version=1997.03.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Two Pass Data, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{Context Core Macros / Two Pass Data} + +%D This is a rather old mechanism which has not changed much over +%D time, apart from adding a few more selectors. This code used +%D to be part of \type {core-uti}. The following examples demonstrate +%D the interface. +%D +%D \startbuffer +%D \definetwopasslist{test-1} +%D +%D \gettwopassdatalist{test-1} [\twopassdatalist=] +%D \checktwopassdata {test-1} [\twopassdata=] +%D \checktwopassdata {test-1} [\twopassdata=] +%D \gettwopassdata {test-1} [\twopassdata=] +%D \gettwopassdata {test-1} [\twopassdata=] +%D +%D \definetwopasslist{test-2} +%D +%D \lazysavetwopassdata{test-2}{1}{x} +%D \lazysavetwopassdata{test-2}{2}{y} +%D \lazysavetwopassdata{test-2}{3}{z} +%D +%D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z] +%D \checktwopassdata {test-2} [\twopassdata=x] +%D \checktwopassdata {test-2} [\twopassdata=x] +%D \gettwopassdata {test-2} [\twopassdata=x] +%D \gettwopassdata {test-2} [\twopassdata=y] +%D \gettwopassdata {test-2} [\twopassdata=z] +%D \gettwopassdata {test-2} [\twopassdata=] +%D +%D \definetwopasslist{test-3} +%D +%D \lazysavetaggedtwopassdata{test-3}{1}{x}{a} +%D \lazysavetaggedtwopassdata{test-3}{2}{y}{b} +%D \lazysavetaggedtwopassdata{test-3}{3}{z}{c} +%D +%D \findtwopassdata{test-3}{x} [\twopassdata=a] +%D \findtwopassdata{test-3}{y} [\twopassdata=b] +%D \findtwopassdata{test-3}{z} [\twopassdata=c] +%D \findtwopassdata{test-3}{w} [\twopassdata=] +%D +%D \definetwopasslist{test-4} +%D +%D \lazysavetwopassdata{test-4}{1}{A} +%D \lazysavetwopassdata{test-4}{2}{B} +%D \lazysavetwopassdata{test-4}{3}{C} +%D +%D \getfirsttwopassdata{test-4} [\twopassdata=A] +%D \getlasttwopassdata {test-4} [\twopassdata=C] +%D \getfirsttwopassdata{test-4} [\twopassdata=A] +%D \getlasttwopassdata {test-4} [\twopassdata=C] +%D \getfromtwopassdata {test-4}{1} [\twopassdata=A] +%D \getfromtwopassdata {test-4}{3} [\twopassdata=C] +%D \getfromtwopassdata {test-4}{2} [\twopassdata=B] +%D \stopbuffer +%D +%D \getbuffer \typebuffer + +\unprotect + +\let\alltwopasslists\empty +\let\twopassentry \empty +\let\twopassdata \empty +\let\twopassdatalist\empty + +\newif\iftwopassdatafound + +\let\savetwopassdata \gobblethreearguments +\let\lazysavetwopassdata \gobblethreearguments +\let\savetaggedtwopassdata \gobblefourarguments +\let\lazysavetaggedtwopassdata\gobblefourarguments + +\let\twopassentry \gobblethreearguments % permits loading a MK II file +\let\loadtwopassdata\relax % permits loading a MK II file + +\let\definetwopasslist\gobbleoneargument + +\def\gettwopassdata #1{\let\twopassdata \empty \twopassdatafoundfalse} +\def\checktwopassdata #1{\let\twopassdata \empty \twopassdatafoundfalse} +\def\findtwopassdata #1#2{\let\twopassdata \empty \twopassdatafoundfalse} +\def\getlasttwopassdata #1{\let\twopassdata \empty \twopassdatafoundfalse} +\def\getfromtwopassdata #1#2{\let\twopassdata \empty \twopassdatafoundfalse} +\def\gettwopassdatalist #1{\let\twopassdatalist\empty \twopassdatafoundfalse} +\def\getnamedtwopassdatalist#1#2{\let#1 \empty \twopassdatafoundfalse} +\def\doifelseintwopassdata #1#2{\secondoftwoarguments} + +\loadmarkfile{core-two} + +\protect \endinput diff --git a/tex/context/base/core-uti.mkii b/tex/context/base/core-uti.mkii new file mode 100644 index 000000000..decb5ceb1 --- /dev/null +++ b/tex/context/base/core-uti.mkii @@ -0,0 +1,47 @@ +%D \module +%D [ file=core-uti, +%D version=1997.03.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Utility File Handling, +%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. + +\def\savecurrentvalue#1#2% + {\immediatewriteutilitycommand{\initializevariable\string#1{#2}}} + +\let\initializevariable\gdef + +\appendtoks + \globallet\initializevariable\gobbletwoarguments +\to \everyafterutilityread + +\edef\testbytesequence + {\rawcharacter{7}% + \rawcharacter{27}% + %rawcharacter{227}% invalid in xetex, which expects utf + \rawcharacter{195}\rawcharacter{128}} % valid utf code + +\def\thisisbytesequence#1% + {\ifx\testbytesequence\empty\else + \convertcommand\testbytesequence\to\testbytesequence + \convertargument#1\to\ascii + \ifx\testbytesequence\ascii \else + \writestatus\m!systems{possible problem with 8 bit output}% + \fi + \fi + \global\let\thisisbytesequence\gobbleoneargument} + +\beginXETEX + \let\testbytesequence\empty +\endXETEX + +\appendtoks + \immediatewriteutilitycommand{\thisisbytesequence{\testbytesequence}}% +\to \everyopenutilities + +\endinput diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex index f1f499a75..b630a1350 100644 --- a/tex/context/base/core-uti.tex +++ b/tex/context/base/core-uti.tex @@ -32,6 +32,7 @@ \edef\utilityversion{1998.12.20} % was: 1998.07.07 % index attributes \edef\utilityversion{2003.07.19} % was: 1998.12.20 % object pages \edef\utilityversion{2006.06.23} % was: 2003.07.19 % -- instead of : +\edef\utilityversion{2006.09.21} % pt in pos % Bepaalde commando's worden als string weggeschreven. Deze % zijn aan het eind van deze file gedefinieerd. @@ -45,7 +46,7 @@ % % \catcode`\^^M=5 (end of line) -\newwrite\uti +\newwrite\utility@tui \newif\ifutilitydone \def\@@utilityerrormessage @@ -65,11 +66,11 @@ \def\thisissectionseparator#1% {\bgroup \globallet\checksectionseparator\relax - \convertcommand \sectionseparator\to\asciiA - \convertargument #1\to\asciiB + \convertcommand \sectionseparator\to\asciia + \convertargument #1\to\asciib \expanded{\gdef\noexpand\dosplitofffoliopart[####1\sectionseparator \sectionseparator####2\sectionseparator\sectionseparator####3]{####3}}% - \ifx\asciiA\asciiB + \ifx\asciia\asciib \egroup \else \egroup @@ -78,8 +79,8 @@ \endinput \fi} -\def\writeutility {\write\uti} -\def\writeutilitycommand#1{\write\uti{c \string#1}} +\def\writeutility {\write\utility@tui} +\def\writeutilitycommand#1{\write\utility@tui{c \string#1}} % less tokens % @@ -88,16 +89,16 @@ % % more flexible (for overloading) -\def\immediatewriteutility {\immediate\write\uti} -\def\immediatewriteutilitycommand#1{\immediate\write\uti{c \string#1}} +\def\immediatewriteutility {\immediate\write\utility@tui} +\def\immediatewriteutilitycommand#1{\immediate\write\utility@tui{c \string#1}} % as in: \def\cwriteutility#1% - {\write\uti{\noexpand\checkedutility{\number\nofshipouts}{#1}}} + {\write\utility@tui{\noexpand\checkedutility{\number\nofshipouts}{#1}}} \def\cwriteutilitycommand#1% - {\write\uti{\noexpand\checkedutility{\number\nofshipouts}{c \string#1}}} + {\write\utility@tui{\noexpand\checkedutility{\number\nofshipouts}{c \string#1}}} \let\checkedutility\secondoftwoarguments @@ -107,55 +108,43 @@ \let\checkedutility\docheckedutility \to \everybeforeshipout -\edef\testbytesequence - {\rawcharacter{7}% - \rawcharacter{27}% - %rawcharacter{227}% invalid in xetex, which expects utf - \rawcharacter{195}\rawcharacter{128}} % valid utf code - -\def\thisisbytesequence#1% - {\ifx\testbytesequence\empty\else - \convertcommand\testbytesequence\to\testbytesequence - \convertargument#1\to\ascii - \ifx\testbytesequence\ascii \else - \writestatus\m!systems{possible problem with 8 bit output}% - \fi - \fi - \global\let\thisisbytesequence\gobbleoneargument} - -\beginXETEX - \let\testbytesequence\empty -\endXETEX - % Better use marks. -\def\checkutilities - {\let\writeutility \cwriteutility - \let\writeutilitycommand \cwriteutilitycommand - %\let\immediatewriteutility \cimmediatewriteutility - %\let\immediatewriteutilitycommand\cimmediatewriteutilitycommand - \let\checkutilities \relax} - -% this trickery is used in s-pre-50 - -\def\openutilities - {\immediate\openout\uti\jobname.\f!inputextension - \immediatewriteutilitycommand{\thisissectionseparator{\sectionseparator}}% for the moment - \immediatewriteutilitycommand{\thisisutilityversion {\utilityversion }}% in this order - \immediatewriteutilitycommand{\thisisbytesequence {\testbytesequence}}} - -\def\closeutilities - {\immediate\closeout\uti % niet echt nodig - \reportutilityproblems - % should be a message : - \let\writeutilitycommand \gobbleoneargument - \let\writeutility \gobbleoneargument - \let\immediatewriteutilitycommand\gobbleoneargument - \let\immediatewriteutility \gobbleoneargument} - -\def\reopenutilities - {\immediate\closeout\uti - \openutilities} +\newtoks \everyopenutilities +\newtoks \everycloseutilities +\newtoks \everycheckutilities + +\def\openutilities {\the\everyopenutilities } +\def\closeutilities{\the\everycloseutilities} +\def\checkutilities{\the\everycheckutilities} + +\appendtoks + \let\writeutility \cwriteutility + \let\writeutilitycommand \cwriteutilitycommand + %\let\immediatewriteutility \cimmediatewriteutility + %\let\immediatewriteutilitycommand\cimmediatewriteutilitycommand + \let\checkutilities \relax +\to \everycheckutilities + +\appendtoks + \immediate\openout\utility@tui\jobname.\f!inputextension + \immediatewriteutilitycommand{\thisissectionseparator{\sectionseparator}}% for the moment + \immediatewriteutilitycommand{\thisisutilityversion {\utilityversion }}% in this order +\to \everyopenutilities + +\appendtoks + \immediate\closeout\utility@tui % niet echt nodig + \reportutilityproblems + % should be a message : + \let\writeutilitycommand \gobbleoneargument + \let\writeutility \gobbleoneargument + \let\immediatewriteutilitycommand\gobbleoneargument + \let\immediatewriteutility \gobbleoneargument +\to \everycloseutilities + +% \def\reopenutilities +% {\immediate\closeout\utility@tui +% \openutilities} \def\abortutilitygeneration {\immediatewriteutilitycommand\utilitygenerationaborted @@ -167,39 +156,15 @@ \gdef\reportutilityproblems{\showmessage\m!systems{22}\empty}% \endinput} -\def\savecurrentvalue#1#2% - {\immediatewriteutilitycommand{\initializevariable\string#1{#2}}} - -\let\initializevariable\gdef +\let\savecurrentvalue \gobbletwoarguments % mkii/mkiv +\let\initializevariable\gobbletwoarguments % mkii/mkiv -\def\disableinitializevariables - {\globallet\initializevariable\gobbletwoarguments} +\appendtoks + \globallet\initializevariable\gobbletwoarguments +\to \everyafterutilityread -\let\reportutilityproblems=\relax - -\let\utilityresetlist=\empty - -% the original -% -% \def\addutilityreset#1% -% {\addtocommalist{\s!reset#1}\utilityresetlist} -% -% \def\resetutilities% -% {\processcommacommand[\utilityresetlist]\getvalue} -% -% the more efficient -% -% \def\addutilityreset#1% -% {\addtocommalist{#1}\utilityresetlist} -% -% \def\doresetutility#1% -% {\getvalue{\s!reset#1}} -% -% \def\resetutilities% -% {\processcommacommand[\utilityresetlist]\doresetutility} -% -% the fastest, about two times, but who cares, since this -% can be neglected +\let\reportutilityproblems\relax +\let\utilityresetlist \empty \newtoks\utilityresetlist @@ -307,287 +272,49 @@ \type{[\currentmessagetext]}% \blank}}% \fi - \disableinitializevariables \endgroup} % Saving the sort vector: -\def\savesortkeys - {\startnointerference - \def\flushsortkey##1##2##3##4% - {\convertargument{##1}{##2}{##3}{##4}\to\ascii - \immediatewriteutility{k {\currentlanguage}{\currentencoding}\ascii}}% - \let\definesortkey\flushsortkey - \flushsortkeys - \globallet\savesortkeys\relax - \stopnointerference} - -\prependtoks \savesortkeys \to \everystarttext +% \def\savesortkeys +% {\startnointerference +% \def\flushsortkey##1##2##3##4% +% {\convertargument{##1}{##2}{##3}{##4}\to\ascii +% \immediatewriteutility{k {\currentlanguage}{\currentencoding}\ascii}}% +% \let\definesortkey\flushsortkey +% \flushsortkeys +% \globallet\savesortkeys\relax +% \stopnointerference} +% +% \prependtoks \savesortkeys \to \everystarttext -% Commando's ten behoeve van two-pass lists. In principe -% kan alles in een keer worden ingelezen. Omdat de macro's -% groeien is de kans groot dat het (main) geheugen door -% (de)allocatie volloopt. Vandaar dat we het toch maar niet -% doen. -% -% \definetwopasslist{\s!xxx} -% -% \gettwopassdata{\s!xxx} -% \getfrompassdata{\s!xxx}{n} n=index (getal) -% \findtwopassdata{\s!xxx}{tag} bijvoorbeeld {label:} -% \iftwopassdatafound -% \twopassdata -% -% \twopassentry{\s!xxx}{nr}{data} nr alleen voor testdoeleinden -% -% also: -% -% \definerawpasslist{\s!xxx} -% \moverawpasslist\s!xxx\to\somemacro - -\let\alltwopasslists\empty % with 0,0 -> stepwise commalist -\let\allrawpasslists\empty % without 0,0 -> raw commalist - -\newif\iftwopassdatafound - -\def\settwopassentries - {\def\twopassentry##1{\executeifdefined{@@##1\s!pass}\gobbletwoarguments}} - -\def\resettwopassentries - {\let\twopassentry\gobblethreearguments} - -\addutilityreset{twopassentries} - -\resettwopassentries - -% \def\twopassentry#1% -% {\executeifdefined{@@#1\s!pass}\gobbletwoarguments} - -%\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}% - \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}{\dosettwopasslist {#1}}% - \setgvalue{\s!reset#1\s!pass}{\doresettwopasslist{#1}}% - \getvalue {\s!reset#1\s!pass}}} - -\def\dosettwopasslist#1% - {\letgvalue{\s!set#1\s!pass}\gobbletwoarguments - \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}} - -\def\doresettwopasslist#1% - {\letgvalue{@@#1\s!pass}\gobbletwoarguments} - -\def\definetwopasslist#1% - {\expanded{\dodefinetwopasslist{#1}}% - \doglobal\addtocommalist{#1}\alltwopasslists} - -\def\definerawpasslist#1% - {\expanded{\dodefinetwopasslist{#1}}% - \doglobal\addtocommalist{#1}\allrawpasslists} - -\def\doloadtwopassdata#1% - {\doifundefined{#1:\s!list} - {\startnointerference - \letgvalueempty{#1:\s!list}% - \protectlabels - \doutilities{twopassentries,#1\s!pass}\jobname\empty\relax\relax - \ifx\twopassdata\empty\else - \appendtwopasselement{#1}{0}\twopassdata - \fi - \stopnointerference}} - -\def\loadtwopassdata - {\ifx\alltwopasslists\empty\else - \def\twopassdata{0,0}% end condition - \processcommacommand[\alltwopasslists]\doloadtwopassdata - \globallet\alltwopassdata\empty - \fi - \ifx\allrawpasslists\empty\else - \let\twopassdata\empty - \processcommacommand[\allrawpasslists]\doloadtwopassdata - \globallet\allrawpassdata\empty - \fi} - -\def\moverawpasslist#1#2% erases the old one, like the others do - {\loadtwopassdata - \@EA\let\@EA#2\csname#1:\s!list\endcsname - \@EA\let\csname#1:\s!list\endcsname\empty} - -\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% -% {\edef\twopassdata{#1}% -% \ifx\twopassdata\notwopassdata -% \twopassdatafoundfalse -% \let\twopassdata\empty -% \else -% \twopassdatafoundtrue -% \setxvalue{#3:\s!list}{#2}% -% \fi} -% -% \def\gettwopassdata#1% -% {\loadtwopassdata -% %\edef\!!stringa{\csname#1:\s!list\endcsname}% -% %\debuggerinfo{\m!systems}{twopass get #1 - \!!stringa}% -% %\expandafter\dogettwopassdata\expandafter[\!!stringa]{#1}} -% \expanded{\dogettwopassdata[\csname#1:\s!list\endcsname]}{#1}} -% -% \def\findtwopassdata#1#2% -% {\loadtwopassdata -% \expanded{\dofindtwopassdata{#1}{#2}}} -% -% \def\dofindtwopassdata#1#2% -% {\edef\!!stringa{,\csname#1:\s!list\endcsname}% -% %\debuggerinfo{\m!systems}{twopass find #2 - \!!stringa}% -% \def\dodofindtwopassdata[##1,##2#2##3,##4]% -% {\edef\twopassdata{##3}% -% \ifx\twopassdata\empty -% \twopassdatafoundfalse -% \else -% \twopassdatafoundtrue -% \fi}% -% \@EA\dodofindtwopassdata\@EA[\!!stringa,#2,#2,]} -% -% \def\getfirsttwopassdata#1% -% {\loadtwopassdata -% \edef\!!stringa{\getvalue{#1:\s!list}}% -% \expandafter\dogetfirsttwopassdata\expandafter[\!!stringa]{#1}} -% -% \def\dogetfirsttwopassdata[#1,#2]#3% -% {\doifelse{#1}{0} -% {\twopassdatafoundfalse -% \let\twopassdata\empty} -% {\twopassdatafoundtrue -% \edef\twopassdata{#1}}} -% -% \def\getlasttwopassdata#1% -% {\loadtwopassdata -% \edef\twopassdata{0}\twopassdatafoundfalse -% \newcounter\noftwopassitems -% \def\docommando##1% -% {\doifnot{##1}{0} -% {\increment\noftwopassitems -% \edef\twopassdata{##1}\twopassdatafoundtrue}}% -% \processcommacommand[\getvalue{#1:\s!list}]\docommando} -% -% \def\getfromtwopassdata#1#2% -% {\loadtwopassdata -% \getfromcommacommand[\csname#1:\s!list\endcsname][#2]% -% \doifelsenothing{\commalistelement} -% {\twopassdatafoundfalse -% \let\twopassdata\empty} -% {\twopassdatafoundtrue -% \let\twopassdata\commalistelement}} - -% todo: store each entry in hash, an load all uti commands at once - -% todo: use \expanded - -\def\dogettwopassdata[#1,#2]#3#4% - {\edef\twopassdata{#1}% - \ifx\twopassdata\notwopassdata - \twopassdatafoundfalse - \let\twopassdata\empty - \else - \twopassdatafoundtrue - \ifcase#4\or\setxvalue{#3:\s!list}{#2}\fi - \fi} - -\def\gettwopassdata#1% - {\loadtwopassdata \@EAEAEA\dogettwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname]{#1}\plusone} - -\def\checktwopassdata#1% - {\loadtwopassdata \@EAEAEA\dogettwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname]{#1}\zerocount} - -\def\findtwopassdata#1#2% - {\loadtwopassdata \expanded{\dofindtwopassdata{#1}{#2}}} - -\def\dofindtwopassdata#1#2% - {\def\dodofindtwopassdata[##1,##2#2##3,##4]{\edef\twopassdata{##3}}% - \@EAEAEA\dodofindtwopassdata\@EA\@EA\@EA[\@EA\@EA\@EA,\csname#1:\s!list\endcsname,#2,#2,]% - \ifx\twopassdata\empty - \twopassdatafoundfalse - \else - \twopassdatafoundtrue - \fi} - -\def\getfirsttwopassdata#1% - {\loadtwopassdata - \@EAEAEA\dogetfirsttwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname]{#1}} - -\def\dogetfirsttwopassdata[#1,#2]#3% - {\edef\twopassdata{#1}% - \ifx\twopassdata\notwopassdata - \twopassdatafoundfalse - \let\twopassdata\empty - \else - \twopassdatafoundtrue - \fi} - -\def\dogetlasttwopassdata#1% - {\edef\nexttwopassdata{#1}% - \ifx\nexttwopassdata\notwopassdata \else - \let\twopassdata\nexttwopassdata - \advance\scratchcounter \plusone - \twopassdatafoundtrue - \fi} - -\def\getlasttwopassdata#1% - {\loadtwopassdata - \scratchcounter\zerocount - \@EAEAEA\rawprocesscommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname]\dogetlasttwopassdata - \edef\noftwopassitems{\the\scratchcounter}% - \iftwopassdatafound\else - \let\twopassdata\empty - \fi} - -\def\getfromtwopassdata#1#2% - {\loadtwopassdata - \@EAEAEA\getfromcommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname][#2]% - \ifx\commalistelement\empty - \twopassdatafoundfalse - \let\twopassdata\empty - \else - \twopassdatafoundtrue - \let\twopassdata\commalistelement - \fi} - % Default-instellingen (verborgen) \prependtoks \resetutilities \to \everyjob % Experiment % -%\installprogram{Hello World} +% \installprogram{Hello World} +% \installprogram[hw]{Hello World} +% \installedprogram[hw] -\def\installprogram#1% +\def\installprogram + {\dosingleempty\doinstallprogram} + +\def\doinstallprogram[#1]#2% + {\doifelsenothing{#1} + {\dodoinstallprogram{#2}} + {\setvalue{\??up#1}{\dodoinstallprogram{#2}}}} + +% \def\doinstallprogram[#1][#2]% less code +% {\doifsomething{#1}{\setvalue{\??up#1}}{\dodoinstallprogram{#2}}} + +\def\dodoinstallprogram#1% {\immediatewriteutility{e p {#1}}} +\def\installedprogram[#1]% + {\getvalue{\??up#1}} + % \writeplugindata{texutil}{{alpha}} % \writeplugindata{texutil}{{beta}} % \writeplugindata{texutil}{{gamma}} @@ -641,4 +368,8 @@ \long\setvalue{\s!reset#1}{#2}% \long\setvalue{\s!set #1}{#3}} +% plugins + +\loadmarkfile{core-uti} + \protect \endinput diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex index 54c9c52df..eba38fdc5 100644 --- a/tex/context/base/core-var.tex +++ b/tex/context/base/core-var.tex @@ -160,26 +160,13 @@ \def\dodocheckformode#1% {\ifcase0\csname\@mode@#1\endcsname\or\checkedmodetrue\fi} -% \def\docheckformode#1#2#3% will be sped up with a quit -% {\protect\checkedmodefalse\rawprocesscommalist[#3]\dodocheckformode -% \ifcheckedmode\@EA#1\else\@EA#2\fi} -% -% better: - \def\docheckformode#1#2#3% will be sped up with a quit {\cleanuplabel{#3}% \protect\checkedmodefalse\rawprocesscommacommand[\cleanlabel]\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} -% -% better: + {\ifcase0\csname\@mode@#1\endcsname\relax\checkedmodefalse\or\or\checkedmodefalse\fi} \def\docheckforallmodes#1#2#3% will be sped up with a quit {\cleanuplabel{#3}% @@ -221,13 +208,13 @@ \def\startallmodes {\unprotect\dostartallmodes} \def\startnotallmodes{\unprotect\dostartnotallmodes} -\def\doifallmodeselse +\def\dodoifallmodeselse {\docheckforallmodes\firstoftwoarguments\secondoftwoarguments} -\def\doifallmodes +\def\dodoifallmodes {\docheckforallmodes\firstofoneargument\gobbleoneargument} -\def\doifnotallmodes +\def\dodoifnotallmodes {\docheckforallmodes\gobbleoneargument\firstofoneargument} \long\def\dostartallmodes[#1]% @@ -258,13 +245,15 @@ \newevery \everystoptext \relax \newevery \everyforgetall \relax \newevery \everybeforepagebody \relax -\newevery \everyafterpagebody \relax \let \everypagebody \everybeforepagebody % backward compatible +\newevery \everyafterpagebody \relax \newevery \everybeforeutilityread \relax \newevery \everyafterutilityread \relax +\let \everypagebody \everybeforepagebody % backward compatible + %newevery \everybeforeutilitywrite \relax -\newevery \everycleanupfeatures \relax \def\cleanupfeatures{\the\everycleanupfeatures} +\newevery \everycleanupfeatures \relax \newevery \everyinsidefloat \relax \newevery \everyheadstart \relax \newevery \everyendoftextbody \relax @@ -274,6 +263,14 @@ \newevery \everymarking \relax \newevery \everysavesortkeys \relax +\newevery \everyfont \relax +\newevery \everybodyfont \EveryBodyFont +\newevery \everyfontswitch \EveryFontSwitch +\newevery \everydefinedfont \relax + +\def\cleanupfeatures{\the\everycleanupfeatures} +\def\forgetall {\the\everyforgetall} + %D For shared \type {\everymath} and \type {\everydisplay}: \newevery \everymathematics \relax @@ -304,6 +301,12 @@ \def\starttextproperties{\the\everystarttextproperties} \def\stoptextproperties {\the\everystoptextproperties} +%D This is pretty important (esp since we now ignore shipouts). +%D Actually we should nil all writes, marks, specials. + +\appendtoks \globallet\popproperties \relax \to \everylastshipout +\appendtoks \globallet\popsplitproperties\relax \to \everylastshipout + %D \macros %D {defineinputmode,setinputmode} %D @@ -324,25 +327,20 @@ %D We disable trial typesetting in the output routine, %D just to be sure. +% defined in syst-ext + \prependtoks \trialtypesettingfalse \to \everybeforepagebody %D \macros -%D {starttextdata} -%D -%D This is a user macro (appending to every last shipout is not -%D really user friendly. - -\newtoks \collectedtextdata - -\long\def\starttextdata#1\stoptextdata - {\doglobal\appendtoks#1\to\collectedtextdata} - -\def\flushtextdata - {\vsmashed{\the\collectedtextdata}% all dimensions zero - \global\collectedtextdata\emptytoks - \globallet\flushtextdata\donothing} +%D {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided} -\prependtoks \flushtextdata \to \everylastshipout +\newif \ifinpagebody +\newif \ifinsidecolumns +\newif \ifdoublesided \doublesidedfalse +\newif \ifsinglesided \singlesidedtrue +\newif \ifinsidefloat +\newif \ifdoingblocks +\newif \ifgridsnapping %D \macros %D {ifprocessingXML} @@ -382,8 +380,6 @@ %D The command \type {\fastmode} disables some time consuming %D typesetting. -\let\normalwritestatus\writestatus - \newevery \everyfastmode \relax \newif\iffastmode @@ -561,4 +557,71 @@ \let\startlayoutcomponent\gobbletwoarguments \let\stoplayoutcomponent \relax +%D Label cleanup: + +\bgroup % some day this will go away / we could use detokenize as well + +% actually we should handle all discretionaries here + +\catcode`:=\@@active + +\gdef\cleanuplabel#1% + {\begingroup + \let:\lettercolon + \xdef\cleanlabel{#1}% + \endgroup} + +\gdef\cleanupprefixedlabel#1#2% + {\begingroup + \let:\lettercolon + \xdef\cleanprefix{#1}% + \xdef\cleanlabel {#2}% + \endgroup} + +\gdef\protectlabels + {\let:\lettercolon} + +\global\def\blabelgroup {\begingroup \let:\lettercolon} +\global\let\elabelgroup \endgroup + +\gdef\labelcsname + {\begingroup\let:\lettercolon + \expandafter\endgroup\csname} + +\gdef\labelvalue#1% + {\labelcsname#1\endcsname} + +\egroup + +%D TO BE TESTED FIRST (needs changes in usage too) + +% \def\cleanuplabel#1% +% {\edef\cleanlabel{\detokenize{#1}}} +% +% \def\cleanupprefixedlabel#1#2% +% {\edef\cleanprefix{\detokenize{#1}}% +% \edef\cleanlabel {\detokenize{#2}}} +% +% \def\labelvalue#1% +% {\csname\detokenize{#1}\endcsname} +% +% \let\protectlabels\donothing +% +% \def\blabelgroup {\begingroup} % why no \let ? +% \let\elabelgroup \endgroup + + + + +%D Concepts: + +\chardef\conceptmode\zerocount + +\def\doifconcepttracing + {\ifnum\conceptmode>\plustwo + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + \protect \endinput diff --git a/tex/context/base/core-ver.mkii b/tex/context/base/core-ver.mkii new file mode 100644 index 000000000..374b9a063 --- /dev/null +++ b/tex/context/base/core-ver.mkii @@ -0,0 +1,298 @@ +%D \module +%D [ file=core-ver, +%D version=2000.05.09, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Verbatim, +%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 + +% uses \prettyidentifier and sets \setupprettytype + +\def\mksetupprettiesintype + {\doifundefined{setuppretty\prettyidentifier type}% + {\startnointerference + \restorecatcodes % also needed when loading during \newpretty + \startreadingfile % restore < and > if needed + \lowercasestring verb-\prettyidentifier.tex\to\filename + \readsysfile\filename\donothing\donothing + \stopreadingfile + \stopnointerference}% + \doifdefinedelse{setuppretty\prettyidentifier type}% + {\let\uncatcodecharacters\uncatcodeallcharacters % ugly, should be switch / todo + \def\mksetupprettytype{\getvalue{setuppretty\prettyidentifier type}}} + {\let\mksetupprettytype\relax}} + +% not that fast but catches \type{\command} % nothing more after \command +% +% \setupcolors[state=start] +% \setuptype[option=TEX] +% \setupcolors[textcolor=red] +% +% The options \type{before=\startsolutionbackground } and +% \type{after=\stopsolutionbackground} take care of putting a frame, +% which can +% +% {\blue The options \type{before=\startsolutionbackground } and +% \type{after=\stopsolutionbackground} take care of putting a frame, +% which} can + +\def\resumecoloraftergroup + {\localstartcolor[\s!black]% + \localstartcolor[\maintextcolor]% + \aftergroup\localstopcolor + \aftergroup\localstopcolor} + +% the rather messy \type command + +\def\mktype#1% was \dotype + {\bgroup + \resumecoloraftergroup % a problem is that we can still be in color mode, tricky hack + \strut % new, enables leading space in \type { abc } at par start + \let\currenttypingclass\??ty + \edef\currenttyping{#1}% + \catcode`\<=\@@other + \catcode`\>=\@@other + \futurelet\next\dodotype} + +\def\dodotypeA + {\initializetype + \initializetypegrouping + \verbatimfont + \verbatimcolor + \afterassignment\protectfirsttype\let\next=} + +\def\dodotypeB + {\initializetype + \setupnotypegrouping + \verbatimfont + \verbatimcolor + \let\next=} + +\def\dodotypeC<#1% + {\initializetype + \verbatimfont + \verbatimcolor + \if#1<% + \@EA\setupalternativetypegrouping + \else + \@EA#1% + \fi} + +\def\dodotypeD#1% + {\initializetype + \verbatimfont + \verbatimcolor + \catcode`#1=\@@endgroup} + +\def\dodotype + {\ifx\next\bgroup + \@EA\dodotypeA + \else\if\next<% + \doifelse{\typingparameter\c!option}\v!none + {\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}% + \else + \@EAEAEA\dodotypeD + \fi\fi} + +% Verbatim does not work when passed as an argument, so here is a +% workaround. Beware, spaces are introduced after a \type {\csname}. + +\chardef\recodeverbatimmode\zerocount % 0=nothing 1=rescan 2=autorescan + +% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytabulate +% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable + +\def\dodotypeA + {\initializetype + \initializetypegrouping + \verbatimfont + \verbatimcolor + \ifcase\recodeverbatimmode + \@EA\dodotypeAA + \or + \@EA\dodotypeAB + \or + \ifnum\catcode`\{=\@@active + \@EAEAEA\dodotypeAB + \else + \@EAEAEA\dodotypeAA + \fi + \else + \@EA\dodotypeAA + \fi} + +\def\dodotypeAA + {\afterassignment\protectfirsttype\let\next=} + +\def\dodotypeAB + {\bgroup + \catcode`\}=\@@endgroup + \catcode`\{=\@@begingroup + \afterassignment\redotypeAB\global\globalscratchtoks} + +\def\redotypeAB + {\egroup + \expandafter\convertargument\the\globalscratchtoks\to\ascii + \ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi + \egroup} + +\bgroup +\catcode`\[=\@@begingroup +\catcode`\]=\@@endgroup +\catcode`\{=\@@active +\catcode`\}=\@@active +\gdef\initializetypegrouping + [\ifnum\catcode`\{=\@@active + \let\normalactivebgroup{% + \let\normalactiveegroup}% + \else + \catcode`\{=\@@active + \catcode`\}=\@@active + \let\normalactivebgroup\leftargument + \let\normalactiveegroup\rightargument + \fi + \def\activeleftargument + [\bgroup + \catcode`\}=\@@active + \let}\activerightargument + \normalactivebgroup]% + \def\activerightargument + [\normalactiveegroup + \egroup]% + \let{=\activeleftargument + % not \let}=\egroup, otherwise things go wrong in alignments (???) + \catcode`\}=\@@endgroup] +\egroup + +\bgroup +\catcode`\<=\@@active +\catcode`\>=\@@active +\gdef\setupalternativetypegrouping + {\catcode`\<=\@@active + \catcode`\>=\@@active + \def\doless + {\ifx<\next + \def\next + {\bgroup\switchslantedtype + \let\next=}% + \else + \let\next\lesscharacter + \fi + \next}% + \def\domore + {\ifx>\next + \def\next + {\egroup + \let\next=}% + \else + \let\next\morecharacter + \fi + \next}% + \def<{\futurelet\next\doless}% + \def>{\futurelet\next\domore}} +\egroup + +\def\setupnotypegrouping + {\catcode`\<=\@@begingroup + \catcode`\>=\@@endgroup} + +\def\doenterdoublelesstype + {\ifx\next\egroup + \lesscharacter\null\lesscharacter + \else + \bgroup\switchslantedtype + \let\doenterdoublemoretype\egroup + \fi} + +\def\doenterdoublemoretype + {\def\doenterdoubletype + {\ifx\next\egroup + \morecharacter\null\morecharacter + \fi}} + +\bgroup +\catcode`\<=\@@active +\catcode`\>=\@@active +\gdef\setupgroupedtype + {\catcode`\<=\@@active + \catcode`\>=\@@active + \def\doless + {\ifx<\next + \def\next + {\def\enterdoubletype{\futurelet\next\doenterdoublelesstype}% + \afterassignment\enterdoubletype + \let\next=}% + \else + \let\next\lesscharacter + \fi + \next}% + \def\domore + {\ifx>\next + \def\next + {\def\enterdoubletype{\futurelet\next\doenterdoublemoretype}% + \afterassignment\enterdoubletype + \let\next=}% + \else + \let\next\morecharacter + \fi + \next}% + \def<{\futurelet\next\doless}% + \def>{\futurelet\next\domore}} +\egroup + +\def\mksetupcommandsintype% can also be \string\ + {\setupgroupedtype + \edef\\{\typingparameter\c!escape}% + \letvalue{\\}=\\% for instance \/=/ + \@EA\catcode\@EA`\\=\@@escape + \def\BTEX##1\ETEX##2% ##2 gobbles active space + {\naturaltextext##1\unskip\relax}} + +\def\mksetupslantedtype + {\setupgroupedtype} + +\let\protectedfirsttype\string % \relax for special cases + +% The next one is safe for: \def\xx#1{\type{#1}} \xx{\ifx} + +\bgroup +\catcode`\<=\active +\catcode`\>=\active +\gdef\doprotectfirsttype + {\normalifx\next<% + \endrobusttest \let\next\relax + \normalelse\normalifx\next\bgroup + \endrobusttest \let\next\relax + \normalelse\normalifx\next\egroup % takes care of \type{} + \endrobusttest \let\next\relax + \normalelse\normalifx\next\activeleftargument + \endrobusttest \let\next\relax + \normalelse + \endrobusttest \let\next\protectedfirsttype + \normalfi\normalfi\normalfi\normalfi + \next} +\egroup + +\def\protectfirsttype + {\beginrobusttest + \futurelet\next\doprotectfirsttype} + +% typing: + +\def\mktypeblockverbatim#1#2% + {\processdisplayverbatim{#2}} % needs to be fixed + +% typefile: + +\def\mktypefileverbatim {\processfileverbatim \readfilename} % #1 +\def\mktypefilelinesverbatim{\processfilelinesverbatim\readfilename} % #1 / #2#3 + +\protect \endinput + diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index 5713e0cb3..8623dffef 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -55,6 +55,10 @@ \unprotect +\ifx\startlinenumbering\undefined \let\startlinenumbering\relax \fi +\ifx\stoplinenumbering \undefined \let\stoplinenumbering\relax \fi +\ifx\setuplinenumbering\undefined \def\setuplinenumbering[#1]{} \fi + % \type{ char} geeft bagger %D We are going to embed the general verbatim support macros in @@ -63,6 +67,18 @@ %D are hooked into the support macros via the \type{\obey} %D macros. +\newif\ifslantedtypeactivated +\newif\ifslantedtypepermitted + +\def\switchslantedtype + {\ifslantedtypepermitted + \ifslantedtypeactivated + \slantedtypeactivatedfalse\tttf + \else + \slantedtypeactivatedtrue\ttsl + \fi + \fi} + \newprettytrue % movet to here from cont-sys.tex \def\prettyidentifier {TEX} @@ -72,71 +88,19 @@ {\dodoubleargument\doinstallprettytype} \def\doinstallprettytype[#1][#2]% map #1 onto #2 - {\uppercasestring#1\to\asciiA - \uppercasestring#2\to\asciiB - \setevalue{\??ty\??ty\asciiA}{\asciiB}} + {\uppercasestring#1\to\asciia + \uppercasestring#2\to\asciib + \setevalue{\??ty\??ty\asciia}{\asciib}} \def\setupprettiesintype#1% {\uppercasestring#1\to\ascii - \edef\prettyidentifier - {\ifundefined{\??ty\??ty\ascii}TEX% - \else\getvalue{\??ty\??ty\ascii}\fi}% - \doifundefined{setuppretty\prettyidentifier type}% - {\bgroup - \setbox0\hbox % get rid of spaces when in-line \newpretty loading - {\restorecatcodes % also needed when loading during \newpretty - \startreadingfile % restore < and > if needed - \lowercasestring verb-\prettyidentifier.tex\to\filename - \readsysfile\filename\donothing\donothing - \stopreadingfile}% - \egroup}% - \doifdefinedelse{setuppretty\prettyidentifier type}% - {\let\uncatcodecharacters\uncatcodeallcharacters % ugly, should be switch - \def\setupprettytype{\getvalue{setuppretty\prettyidentifier type}}} - {\let\setupprettytype\relax}} - -\installprettytype [RAW] [RAW] - -\installprettytype [TEX] [TEX] - -\installprettytype [PERL] [PL] -\installprettytype [PL] [PL] -\installprettytype [PM] [PL] - -\installprettytype [METAPOST] [MP] -\installprettytype [METAFONT] [MP] -\installprettytype [MP] [MP] -\installprettytype [MF] [MP] - -\installprettytype [JAVASCRIPT] [JS] -\installprettytype [JAVA] [JV] -\installprettytype [JS] [JS] -\installprettytype [JV] [JV] + \edef\prettyidentifier{\executeifdefined{\??ty\??ty\ascii}{TEX}}% + \mksetupprettiesintype} -\installprettytype [SQL] [SQL] - -\installprettytype [PASCAL] [PAS] -\installprettytype [PAS] [PAS] -\installprettytype [MODULA] [PAS] -\installprettytype [MOD] [PAS] - -\installprettytype [EIFFEL] [EIF] -\installprettytype [EIF] [EIF] -\installprettytype [E] [EIF] - -\installprettytype [XML] [XML] - -\installnewpretty M {\setupprettiesintype {MP}\setupprettytype} -\installnewpretty P {\setupprettiesintype {PL}\setupprettytype} -\installnewpretty T {\setupprettiesintype{TEX}\setupprettytype} -\installnewpretty J {\setupprettiesintype {JV}\setupprettytype} -\installnewpretty S {\setupprettiesintype{SQL}\setupprettytype} -\installnewpretty W {\setupprettiesintype{PAS}\setupprettytype} % Wirth -\installnewpretty I {\setupprettiesintype{EIF}\setupprettytype} % E taken -\installnewpretty X {\setupprettiesintype{XML}\setupprettytype} +\def\setupprettytype{\mksetupprettytype} \def\setupcommonverbatim - {\eightbitcharactersfalse % obey regime / encoding + {\recatcodeuppercharactersfalse % obey regime / encoding % \def\prettyidentifier{TEX}% % @@ -190,6 +154,22 @@ \def\verbatimfont{\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style\normalnoligatures\font}% \setupverbatimcolor} +% BEWARE: the noligatures will globally change the verbatim font's behaviour + +% test case: +% +% \definetype[typeTEX][option=tex] +% +% \typeTEX|\example---oeps|. this---ligates---again. +% \typeTEX{\example---oeps}. this---ligates---again. +% \type {\example---oeps}. this---ligates---again. + +\def\setupcommandsintype{\mksetupcommandsintype} +\def\setupslantedtype {\slantedtypepermittedtrue\mksetupslantedtype} + +\ifx\setupprettytype \undefined \let\setupprettytype \relax \fi +\ifx\setupslantedtype \undefined \let\setupslantedtype \relax \fi +\ifx\setupgroupedtype \undefined \let\setupgroupedtype \relax \fi \ifx\normalnoligatures\undefined \let\normalnoligatures\gobbleoneargument \fi %D The verbatim commands have a rather long and turbulent @@ -232,9 +212,9 @@ %D \macros %D {type} %D -%D We define \type{\type} as a protected command. First we -%D set the catcodes of \type{<} and \type{>} and then we start -%D looking ahead. +%D We define \type{\type} as a protected command. This command +%D has several invocations: grouped, wirt boundary characters, +%D and with font switches. % \starttyping % normal: \par \type{xx<<..xx..<> >>..>>xx} \par \type<<....>> \par \type<<..<>..>> \par @@ -246,261 +226,14 @@ % none: \par \type{xx<<..xx..<> >>..>>xx} \par \type<<....>> \par \type<<..<>..>> \par % \stoptyping -\unexpanded\def\type - {\dotype\empty} - -\def\dotype#1% - {\bgroup - \strut % new, enables leading space in \type { abc } at par start - \let\currenttypingclass\??ty - \edef\currenttyping{#1}% - \catcode`\<=\@@other - \catcode`\>=\@@other - \futurelet\next\dodotype} - -%D Next we distinguish between the three alternatives and call -%D for the appropriate macros. - -\def\dodotypeA - {\initializetype - \initializetypegrouping - \verbatimcolor - \afterassignment\protectfirsttype\let\next=} - -\def\dodotypeB - {\initializetype - \setupnotypegrouping - \verbatimcolor - \let\next=} - -\def\dodotypeC<#1% - {\initializetype - \verbatimcolor - \if#1<% - \@EA\setupalternativetypegrouping - \else - \@EA#1% - \fi} - -\def\dodotypeD#1% - {\initializetype - \verbatimcolor - \catcode`#1=\@@endgroup} - -\def\dodotype% - {\ifx\next\bgroup - \@EA\dodotypeA - \else\if\next<% - \doifelse{\typingparameter\c!option}\v!none - {\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}% - \else - \@EAEAEA\dodotypeD - \fi\fi} - -% Verbatim does not work when passed as an argument, so here is a -% workaround. Beware, spaces are introduced after a \type {\csname}. - -\chardef\recodeverbatimmode\zerocount % 0=nothing 1=rescan 2=autorescan - -% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytabulate -% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable - -\def\dodotypeA - {\initializetype - \initializetypegrouping - \verbatimcolor - \ifcase\recodeverbatimmode - \@EA\dodotypeAA - \or - \@EA\dodotypeAB - \or - \ifnum\catcode`\{=\@@active - \@EAEAEA\dodotypeAB - \else - \@EAEAEA\dodotypeAA - \fi - \else - \@EA\dodotypeAA - \fi} - -\def\dodotypeAA - {\afterassignment\protectfirsttype\let\next=} - -\def\dodotypeAB - {\bgroup - \catcode`\}=\@@endgroup - \catcode`\{=\@@begingroup - \afterassignment\redotypeAB\global\globalscratchtoks} - -\def\redotypeAB - {\egroup - \expandafter\convertargument\the\globalscratchtoks\to\ascii - \ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi - \egroup} - -\bgroup -\catcode`\[=\@@begingroup -\catcode`\]=\@@endgroup -\catcode`\{=\@@active -\catcode`\}=\@@active -\gdef\initializetypegrouping - [\ifnum\catcode`\{=\@@active - \let\normalactivebgroup{% - \let\normalactiveegroup}% - \else - \catcode`\{=\@@active - \catcode`\}=\@@active - \let\normalactivebgroup\leftargument - \let\normalactiveegroup\rightargument - \fi - \def\activeleftargument - [\bgroup - \catcode`\}=\@@active - \let}\activerightargument - \normalactivebgroup]% - \def\activerightargument - [\normalactiveegroup - \egroup]% - \let{=\activeleftargument - % not \let}=\egroup, otherwise things go wrong in alignments (???) - \catcode`\}=\@@endgroup] -\egroup - -\bgroup -\catcode`\<=\@@active -\catcode`\>=\@@active -\gdef\setupalternativetypegrouping - {\catcode`\<=\@@active - \catcode`\>=\@@active - \def\doless - {\ifx<\next - \def\next - {\bgroup\switchslantedtype - \let\next=}% - \else - \let\next\lesscharacter - \fi - \next}% - \def\domore - {\ifx>\next - \def\next - {\egroup - \let\next=}% - \else - \let\next\morecharacter - \fi - \next}% - \def<{\futurelet\next\doless}% - \def>{\futurelet\next\domore}} -\egroup - -\def\setupnotypegrouping - {\catcode`\<=\@@begingroup - \catcode`\>=\@@endgroup} - %D When writing the manual to \CONTEXT\ and documenting this %D source we needed to typeset \type{<<} and \type{>>}. Because %D we wanted to do this in the natural way, we've adapted the -%D original definition a bit. We still show the original -%D because we think it's shows a bit better what we are -%D doing. -%D -%D \starttyping -%D \bgroup -%D \catcode`\<=\@@active -%D \catcode`\>=\@@active -%D \gdef\setupgroupedtype% -%D {\catcode`\<=\@@active -%D \catcode`\>=\@@active -%D \def<% -%D {\def\do% -%D {\ifx\next<% -%D \def\next{\bgroup\switchslantedtype\let\next=}% -%D \else -%D \let\next\lesscharacter -%D \fi -%D \next}% -%D \futurelet\next\do}% -%D \def>% -%D {\def\do% -%D {\ifx\next>% -%D \def\next{\egroup\let\next=}% -%D \else -%D \let\next\morecharacter -%D \fi -%D \next}% -%D \futurelet\next\do}} -%D \egroup -%D \stoptyping -%D -%D The final implementation looks a bit further and treats the -%D lone \type{<<} and \type{>>} a bit different. The \type -%D {\null} prevents ligatures, which unfortunately turn up -%D in Lucida fonts. - -\def\doenterdoublelesstype - {\ifx\next\egroup - \lesscharacter\null\lesscharacter - \else - \bgroup\switchslantedtype - \let\doenterdoublemoretype\egroup - \fi} - -\def\doenterdoublemoretype - {\def\doenterdoubletype - {\ifx\next\egroup - \morecharacter\null\morecharacter - \fi}} - -\bgroup -\catcode`\<=\@@active -\catcode`\>=\@@active -\gdef\setupgroupedtype - {\catcode`\<=\@@active - \catcode`\>=\@@active - \def\doless - {\ifx<\next - \def\next - {\def\enterdoubletype{\futurelet\next\doenterdoublelesstype}% - \afterassignment\enterdoubletype - \let\next=}% - \else - \let\next\lesscharacter - \fi - \next}% - \def\domore - {\ifx>\next - \def\next - {\def\enterdoubletype{\futurelet\next\doenterdoublemoretype}% - \afterassignment\enterdoubletype - \let\next=}% - \else - \let\next\morecharacter - \fi - \next}% - \def<{\futurelet\next\doless}% - \def>{\futurelet\next\domore}} -\egroup - -\newif\ifslantedtypeactivated -\newif\ifslantedtypepermitted - -\def\switchslantedtype - {\ifslantedtypepermitted - \ifslantedtypeactivated - \slantedtypeactivatedfalse\tttf - \else - \slantedtypeactivatedtrue\ttsl - \fi - \fi} - -\def\setupcommandsintype% can also be \string\ - {\setupgroupedtype - \edef\\{\typingparameter\c!escape}% - \letvalue{\\}=\\% for instance \/=/ - \@EA\catcode\@EA`\\=\@@escape - \def\BTEX##1\ETEX##2% ##2 gobbles active space - {\naturaltextext##1\unskip\relax}} +%D original definition a bit. This implementation went through +%D several live cycles. The final implementation looks a bit +%D further and treats the lone \type{<<} and \type{>>} a bit +%D different. The \type {\null} prevents ligatures, which +%D unfortunately turn up in Lucida fonts. %D The following lines show what happens when we set %D \type {option=commands}. @@ -520,58 +253,9 @@ %D %D \typebuffer -\def\setupslantedtype - {\setupgroupedtype - \slantedtypepermittedtrue} - -\let\protectedfirsttype\string % \relax for special cases - -% \bgroup -% \catcode`\<=\active -% \catcode`\>=\active -% \gdef\doprotectfirsttype -% {\ifx\next<% -% \let\next\relax -% \else\ifx\next\bgroup -% \let\next\relax -% \else\ifx\next\egroup % takes care of \type{} -% \let\next\relax -% \else\ifx\next\activeleftargument -% \let\next\relax -% \else -% \let\next\protectedfirsttype -% \fi\fi\fi\fi -% \next} -% \egroup -% -% \def\protectfirsttype -% {\futurelet\next\doprotectfirsttype} -% -% The next one is safe for: -% -% \def\xx#1{\type{#1}} \xx{\ifx} - -\bgroup -\catcode`\<=\active -\catcode`\>=\active -\gdef\doprotectfirsttype - {\normalifx\next<% - \endrobusttest \let\next\relax - \normalelse\normalifx\next\bgroup - \endrobusttest \let\next\relax - \normalelse\normalifx\next\egroup % takes care of \type{} - \endrobusttest \let\next\relax - \normalelse\normalifx\next\activeleftargument - \endrobusttest \let\next\relax - \normalelse - \endrobusttest \let\next\protectedfirsttype - \normalfi\normalfi\normalfi\normalfi - \next} -\egroup - -\def\protectfirsttype - {\beginrobusttest - \futurelet\next\doprotectfirsttype} +\unexpanded\def\type{\mktype\empty} + +\let\mktype\gobbleoneargument %D The neccessary initializations are done by calling %D \type{\initializetype} which in return calls for the support @@ -597,17 +281,6 @@ \getparameters[\??ty][#1]% \fi} -%D The setups for inline verbatim default to: - -\setuptype - [ \c!space=\v!off, - \c!color=, - \c!style=\tt\tf, % \tttf gives problems with {\tx \type...} - \c!page=\v!no, - \c!tab=\v!yes, - \c!palet=colorpretty, - \c!option=\v!normal] - %D \macros %D {typ,obeyhyphens,obeybreakpoints} %D @@ -618,43 +291,20 @@ %D works all right, but a decent hyphenation support of %D \type{\tt} text will be implemented soon. -% \def\obeyhyphens -% {\def\obeyedspace{\hskip\spaceskip}% -% \edef\savedfont{\the\font}% -% \ttsl\hyphenchar\font45 -% \tttf\hyphenchar\font45 -% \savedfont -% \spaceskip.5em\!!plus.25em\!!minus.25em\relax} -% -% \def\obeybreakpoints -% {\def\obeyedspace{\hskip\spaceskip}% -% \spaceskip.5em -% \veryraggedright} - \def\obeyhyphens - {\def\obeyedspace {\hskip\spaceskip}% + {\def\obeyedspace {\hskip\interwordspace}% better than spaceskip \def\controlspace{\hskip\zeropoint\hbox{\char32}\hskip\zeropoint}% - \spaceskip.25em\!!plus.5em\!!minus.25em\relax} + \spaceskip.25em\relax} % hm a bit of stretch ! \def\obeybreakpoints {\ignorehyphens \veryraggedright} \def\ignorehyphens - {\def\obeyedspace {\null\hskip\spaceskip\null}% + {\def\obeyedspace {\null\hskip\interwordspace\null}% better than spaceskip \def\controlspace{\null\hskip\zeropoint\hbox{\char32}\hskip\zeropoint\null}% \spaceskip.5em\relax} -%\unexpanded\def\typ -% {\bgroup -% \obeyhyphens -% \futurelet\next\dotype} - -%\unexpanded\def\typ -% {\bgroup -% \obeyhyphens -% \futurelet\next\dodotype} - \unexpanded\def\typ {\bgroup \let\@@tylines\v!hyphenated @@ -693,36 +343,6 @@ %D \unexpanded\def\mat{\dospecialtype\$\$} %D \unexpanded\def\dis{\dospecialtype{\$\$}{\$\$}} %D \stoptyping -%D -% %D For sometime we used the better but less readable is -% %D alternative -% %D -% %D \starttyping -% %D \def\doprocessgroup#1#2#3% -% %D {\bgroup -% %D #1% -% %D \def\doprocessgroup% -% %D {\def\doprocessgroup{#3\egroup}% -% %D \bgroup -% %D \aftergroup\doprocessgroup -% %D #2}% -% %D \afterassignment\doprocessgroup -% %D \let\next=} -% %D -% %D \def\setgroupedtype% -% %D {\initializetype -% %D \catcode`\{=\@@begingroup -% %D \catcode`\}=\@@endgroup} -% %D -% %D \unexpanded\def\tex{\doprocessgroup\setgroupedtype\texescape\relax} -% %D \unexpanded\def\arg{\doprocessgroup\setgroupedtype\leftargument\rightargument} -% %D \unexpanded\def\mat{\doprocessgroup\setgroupedtype\$\$} -% %D \unexpanded\def\dis{\doprocessgroup\setgroupedtype{\$\$}{\$\$}} -% %D \stoptyping -% %D -%D -%D But since \type{\groupedcommand} became available, we use -%D however \def\setgroupedtype {\let\currenttypingclass\??ty @@ -804,18 +424,6 @@ %D indirect way. As we will see, they are a specific case of a %D more general mechanism. -% formal version -% -% \def\dostarttyping#1% -% {\let\currenttypingclass\??tp -% \edef\currenttyping{#1}% -% \typingparameter\c!before -% \startpacked % includes \bgroup -% \dosetuptypelinenumbering{}% -% \initializetyping -% \startverbatimcolor -% \expandafter\processdisplayverbatim\expandafter{\s!stop#1}} - % we need this hack because otherwise verbatim skips % the first line (everything after the initial command) @@ -842,9 +450,9 @@ \dosetuptypelinenumbering{#1}% \initializetyping \startverbatimcolor - \expanded{\processdisplayverbatim{\s!stop\currenttyping}}} + \expanded{\mktypeblockverbatim{\s!start\currenttyping}{\s!stop\currenttyping}}} -\def\dostoptyping#1% +\def\dostoptyping#1% hm, currenttyping {\stopverbatimcolor \stoppacked % includes \egroup \typingparameter\c!after @@ -884,20 +492,6 @@ %D argument is given, the values apply to both the standard %D command \type{\starttyping} and \type{\typefile}. -%\indirect\def\setuptyping\dodoubleempty[#1][#2]% -% {\iffirstargument -% \getparameters[\??tp#1][#2]% -% \else -% \getparameters[\??tp][#1]% -% \fi} -% -%\doubleemptied\def\setuptyping[#1][#2]% -% {\iffirstargument -% \getparameters[\??tp#1][#2]% -% \else -% \getparameters[\??tp][#1]% -% \fi} - \def\dosetuptyping[#1][#2]% {\ifsecondargument \getparameters[\??tp#1][#2]% @@ -908,36 +502,6 @@ \def\setuptyping {\dodoubleempty\dosetuptyping} -%D The setups for display verbatim and file verbatim are -%D shared. One can adapt the extra defined typing environments, -%D but they also default to the values below. Watch the -%D alternative escape character. - -\setuptyping - [ \c!before=\blank, - \c!after=\blank, - \c!bodyfont=, - \c!color=, - \c!space=\v!off, - \c!page=\v!no, - \c!tab=\s!ascii, - \c!option=\v!none, - \c!palet=colorpretty, - \c!text=\v!no, - \c!style=\tttf, - \c!icommand=\ttsl, - \c!vcommand=, - \c!ccommand=\tttf, - \c!indentnext=\v!yes, - \c!margin=\!!zeropoint, - \c!evenmargin=\!!zeropoint, - \c!oddmargin=\!!zeropoint, - \c!blank=\v!line, - \c!escape=/, % beware \string\ , should also be accepted - \c!numbering=\v!no, - \c!lines=, - \c!empty=] - %D \macros %D {definetype} %D @@ -948,10 +512,7 @@ {\dodoubleempty\dodefinetype} \def\dodefinetype[#1][#2]% - {\unexpanded\setvalue{#1}{\dotype{#1}}% -% \copyparameters % maybe no longer needed, implicit inheritance now -% [\??ty#1][\??ty] -% [\c!space,\c!palet,\c!color,\c!style,\c!page,\c!tab,\c!option]% + {\unexpanded\setvalue{#1}{\mktype{#1}}% \getparameters[\??ty#1][#2]} %D \macros @@ -972,12 +533,8 @@ %D The definitions default to the standard typing values. \def\presettyping[#1][#2]% - {\copyparameters - [\??tp#1][\??tp] - [\c!color,\c!style]% - \getparameters - [\??tp#1] - [#2]} + {\copyparameters[\??tp#1][\??tp][\c!color,\c!style]% + \getparameters [\??tp#1][#2]} \def\dodefinetyping[#1][#2]% {\setvalue{\e!start#1}{\dostarttyping{#1}}% @@ -987,76 +544,6 @@ \def\definetyping {\dodoubleempty\dodefinetyping} -\definetyping[\v!typing] - -\definetyping[RAW] [\c!option=RAW] -\definetyping[MP] [\c!option=MP] -\definetyping[PL] [\c!option=PL] -\definetyping[PM] [\c!option=PL] -\definetyping[JS] [\c!option=JS] -\definetyping[JV] [\c!option=JV] -\definetyping[SQL] [\c!option=SQL] -\definetyping[TEX] [\c!option=TEX] -\definetyping[PAS] [\c!option=PAS] -\definetyping[PASCAL][\c!option=PAS] -\definetyping[MOD] [\c!option=PAS] -\definetyping[MODULA][\c!option=PAS] -\definetyping[DELPHI][\c!option=PAS] -\definetyping[EIFFEL][\c!option=EIF] -\definetyping[XML] [\c!option=XML] - -%D We use the \CONTEXT\ color system for switching to and from -%D color mode. We can always redefine these colors afterwards. - -\definecolor [colorprettyone] [r=.9, g=.0, b=.0] % red -\definecolor [colorprettytwo] [r=.0, g=.8, b=.0] % green -\definecolor [colorprettythree] [r=.0, g=.0, b=.9] % blue -\definecolor [colorprettyfour] [r=.8, g=.8, b=.6] % yellow - -\definecolor [grayprettyone] [s=.30] -\definecolor [grayprettytwo] [s=.45] -\definecolor [grayprettythree] [s=.60] -\definecolor [grayprettyfour] [s=.75] - -\definepalet - [colorpretty] - [ prettyone=colorprettyone, - prettytwo=colorprettytwo, - prettythree=colorprettythree, - prettyfour=colorprettyfour] - -\definepalet - [graypretty] - [ prettyone=grayprettyone, - prettytwo=grayprettytwo, - prettythree=grayprettythree, - prettyfour=grayprettyfour] - -% ---> naar verb-* ? of predefine als undefined? - -\definepalet [TEXcolorpretty] [colorpretty] -\definepalet [TEXgraypretty] [graypretty] -\definepalet [PLcolorpretty] [colorpretty] -\definepalet [PLgraypretty] [graypretty] -\definepalet [PMcolorpretty] [colorpretty] -\definepalet [PMgraypretty] [graypretty] -\definepalet [MPcolorpretty] [colorpretty] -\definepalet [MPgraypretty] [graypretty] -\definepalet [JVcolorpretty] [colorpretty] -\definepalet [JVgraypretty] [graypretty] -\definepalet [JScolorpretty] [colorpretty] -\definepalet [JSgraypretty] [graypretty] -\definepalet [SQLcolorpretty] [colorpretty] -\definepalet [SQLgraypretty] [graypretty] -\definepalet [PAScolorpretty] [colorpretty] -\definepalet [PASgraypretty] [graypretty] -\definepalet [EIFcolorpretty] [colorpretty] -\definepalet [EIFgraypretty] [graypretty] -\definepalet [XMLcolorpretty] [colorpretty] -\definepalet [XMLgraypretty] [graypretty] - -% Some real in-depth knowlegde of palets: `palet:color' it is! - %D We can use some core color commands. These are faster than %D the standard color switching ones and work ok on a line by %D line basis. @@ -1214,8 +701,6 @@ % \typefile[start=4,step=3]{zapf} % \typefile{zapf} -\presettyping[\v!file][] - \def\typefile {\dodoubleempty\dotypefile} @@ -1230,31 +715,6 @@ \dodotypefile[\v!file][]{#3}% \fi\fi} -% \def\dosetuptypelinenumbering#1% fuzzy -% {\doifundefined{\currenttypingclass\currenttyping\c!start} -% {\setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!nlines=,#1]}% -% \doifelse{\typingparameter\c!numbering}\v!file -% {\setuplinenumbering[\c!method=\v!file]% -% \donetrue} -% {\doifelse{\typingparameter\c!numbering}\v!line -% {% \setuplinenumbering defaults start/step to 1/1, so we need -% \doifnothing{\typingparameter\c!start }{\settypingparameter\c!start {1}}% -% \doifnothing{\typingparameter\c!step }{\settypingparameter\c!step {1}}% -% \doifnothing{\typingparameter\c!continue}{\settypingparameter\c!continue{}}% -% \setuplinenumbering -% [\c!method=\v!type, -% \c!continue=\typingparameter\c!continue, -% \c!start=\typingparameter\c!start, -% \c!step=\typingparameter\c!step]% -% \donetrue} -% {\donefalse}}% -% \ifdone -% \ifx\startlinenumbering\undefined \let\startlinenumbering\relax \fi -% \ifx\stoplinenumbering \undefined \let\stoplinenumbering \relax \fi -% \def\beginofverbatimlines{\startlinenumbering}% -% \def\endofverbatimlines {\stoplinenumbering }% -% \fi} - \def\dosetuptypelinenumbering#1% fuzzy {\doifundefined{\currenttypingclass\currenttyping\c!start} {\setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!nlines=]}% @@ -1284,78 +744,63 @@ \def\endofverbatimlines {\stoplinenumbering\setxtypingparameter\c!n{\number\linenumber}}% \fi} -% \setuptyping % not needed -% [\v!file] -% [\c!start=1, -% \c!stop=, -% \c!step=1, -% \c!continue=, -% \c!nlines=] - -\setuptyping - [\c!start=1, - \c!stop=, - \c!step=1, - \c!continue=, - \c!nlines=] +\def\reporttypingerror#1% temp hack + {\blank + \dontleavehmode\hbox\bgroup + \expanded{\convertargument#1}\to\ascii + \tttf[\makemessage\m!verbatims1\ascii]% + \showmessage\m!verbatims1\ascii + \egroup + \blank} -\def\dodotypefile[#1][#2]#3% +\def\dosometyping#1#2#3#4#5% {\bgroup \let\currenttypingclass\??tp \edef\currenttyping{#1}% \typingparameter\c!before - \doiflocfileelse{#3} - \donetrue % sets \readfilename - {\doifinputfileelse{#3} - {\donetrue - \def\readfilename{\pathplusfile\filepath{#3}}} - \donefalse}% - \ifdone - \startpacked % includes \bgroup - \dosetuptypelinenumbering{#2}% - \doifinset{\typingparameter\c!option}{\v!commands,\v!slanted,\v!normal} - {\setuptyping[#1][\c!option=\v!none]}% - \doif{\typingparameter\c!option}\v!color - {\expandafter\aftersplitstring#3\at.\to\prettyidentifier - \settypingparameter\c!option{\prettyidentifier}}% - \initializetyping - \startverbatimcolor - \doifundefinedelse{\currenttypingclass#3\v!global\c!start} - {\scratchcounter\zerocount} - {\scratchcounter\getvalue{\currenttypingclass#3\v!global\c!start}}% - \advance\scratchcounter\plusone - \setxvalue{\currenttypingclass#3\v!global\c!start}{\the\scratchcounter}% - \doifelsenothing{\typingparameter\c!start} - {\processfileverbatim\readfilename} - {\doif{\typingparameter\c!start}\v!continue - {\setevalue{\currenttypingclass#1\c!start}% - {\getvalue{\currenttypingclass#3\v!global\c!start}}}% - \doifelsenothing{\typingparameter\c!stop} - {\doifelsenothing{\typingparameter\c!nlines} - {\processfileverbatim\readfilename} - {\scratchcounter\typingparameter\c!start - \advance\scratchcounter\typingparameter\c!nlines - \advance\scratchcounter\minusone - \setxvalue{\currenttypingclass#3\v!global\c!start}% - {\the\scratchcounter}% - \processfilelinesverbatim\readfilename - {\typingparameter\c!start} - {\getvalue{\currenttypingclass#3\v!global\c!start}}}}% - {\processfilelinesverbatim\readfilename - {\typingparameter\c!start} - {\typingparameter\c!stop }}}% - \stopverbatimcolor - \stoppacked % includes \egroup - \else - \ifmmode\hbox\fi\bgroup - \expanded{\convertargument#3}\to\ascii - \tttf[\makemessage\m!verbatims1\ascii]% - \showmessage\m!verbatims1\ascii - \egroup - \fi + \startpacked % includes \bgroup + \dosetuptypelinenumbering{#2}% + \doifinset{\typingparameter\c!option}{\v!commands,\v!slanted,\v!normal} + {\setuptyping[#1][\c!option=\v!none]}% + \doif{\typingparameter\c!option}\v!color + {\expandafter\aftersplitstring#3\at.\to\prettyidentifier + \settypingparameter\c!option{\prettyidentifier}}% + \initializetyping + \startverbatimcolor + \doifundefinedelse{\currenttypingclass#3\v!global\c!start} + {\scratchcounter\zerocount} + {\scratchcounter\getvalue{\currenttypingclass#3\v!global\c!start}}% + \advance\scratchcounter\plusone + \setxvalue{\currenttypingclass#3\v!global\c!start}{\the\scratchcounter}% + \doifelsenothing{\typingparameter\c!start} + {#4} + {\doif{\typingparameter\c!start}\v!continue + {\setevalue{\currenttypingclass#1\c!start}% + {\getvalue{\currenttypingclass#3\v!global\c!start}}}% + \doifelsenothing{\typingparameter\c!stop} + {\doifelsenothing{\typingparameter\c!nlines} + {#4} + {\setxvalue{\currenttypingclass#3\v!global\c!start}% + {\the\numexpr\typingparameter\c!start+\typingparameter\c!nlines+\minusone\relax}% + #5{\typingparameter\c!start}{\getvalue{\currenttypingclass#3\v!global\c!start}}}}% + {#5{\typingparameter\c!start}{\typingparameter\c!stop}}}% + \stopverbatimcolor + \stoppacked \typingparameter\c!after \egroup} +\def\doifelsetypingfile#1% sets \readfilename + {\doiflocfileelse{#1} + {\firstoftwoarguments} + {\doifinputfileelse{#1} + {\def\readfilename{\pathplusfile\filepath{#1}}\firstoftwoarguments} + {\secondoftwoarguments}}} + +\def\dodotypefile[#1][#2]#3% + {\doifelsetypingfile{#3} + {\dosometyping{#1}{#2}{#3}\mktypefileverbatim\mktypefilelinesverbatim} + {\reporttypingerror{#3}}} + %D \macros %D {filename} %D @@ -1378,4 +823,175 @@ \def\verbatim#1{\convertargument#1\to\ascii\ascii} +%D Plugins + +\loadmarkfile{core-ver} + +%D The setups for display verbatim and file verbatim are +%D shared. One can adapt the extra defined typing environments, +%D but they also default to the values below. Watch the +%D alternative escape character. + +\setuptyping + [ \c!before=\blank, + \c!after=\blank, + \c!bodyfont=, + \c!color=, + \c!space=\v!off, + \c!page=\v!no, + \c!tab=\s!ascii, + \c!option=\v!none, + \c!palet=colorpretty, + \c!text=\v!no, + \c!style=\tttf, + \c!icommand=\ttsl, + \c!vcommand=, + \c!ccommand=\tttf, + \c!indentnext=\v!yes, + \c!margin=\!!zeropoint, + \c!evenmargin=\!!zeropoint, + \c!oddmargin=\!!zeropoint, + \c!blank=\v!line, + \c!escape=/, % beware \string\ , should also be accepted + \c!numbering=\v!no, + \c!lines=, + \c!empty=, + \c!start=1, + \c!stop=, + \c!step=1, + \c!continue=, + \c!nlines=] + +\definetyping[\v!typing] + +\presettyping[\v!file][] + +% \setuptyping % not needed +% [\v!file] +% [\c!start=1, +% \c!stop=, +% \c!step=1, +% \c!continue=, +% \c!nlines=] + +%D The setups for inline verbatim default to: + +\setuptype + [ \c!space=\v!off, + \c!color=, + \c!style=\tt\tf, % \tttf gives problems with {\tx \type...} + \c!page=\v!no, + \c!tab=\v!yes, + \c!palet=colorpretty, + \c!option=\v!normal] + +\definetyping[RAW] [\c!option=RAW] +\definetyping[MP] [\c!option=MP] +\definetyping[PL] [\c!option=PL] +\definetyping[PM] [\c!option=PL] +\definetyping[JS] [\c!option=JS] +\definetyping[JV] [\c!option=JV] +\definetyping[SQL] [\c!option=SQL] +\definetyping[TEX] [\c!option=TEX] +\definetyping[PAS] [\c!option=PAS] +\definetyping[PASCAL][\c!option=PAS] +\definetyping[MOD] [\c!option=PAS] +\definetyping[MODULA][\c!option=PAS] +\definetyping[DELPHI][\c!option=PAS] +\definetyping[EIFFEL][\c!option=EIF] +\definetyping[XML] [\c!option=XML] +\definetyping[LUA] [\c!option=LUA] + +\installprettytype [RAW] [RAW] + +\installprettytype [TEX] [TEX] + +\installprettytype [PERL] [PL] +\installprettytype [PL] [PL] +\installprettytype [PM] [PL] + +\installprettytype [METAPOST] [MP] +\installprettytype [METAFONT] [MP] +\installprettytype [MP] [MP] +\installprettytype [MF] [MP] + +\installprettytype [JAVASCRIPT] [JS] +\installprettytype [JAVA] [JV] +\installprettytype [JS] [JS] +\installprettytype [JV] [JV] + +\installprettytype [SQL] [SQL] + +\installprettytype [PASCAL] [PAS] +\installprettytype [PAS] [PAS] +\installprettytype [MODULA] [PAS] +\installprettytype [MOD] [PAS] + +\installprettytype [EIFFEL] [EIF] +\installprettytype [EIF] [EIF] +\installprettytype [E] [EIF] + +\installprettytype [XML] [XML] + +\installprettytype [LUA] [LUA] + +\installnewpretty M {\setupprettiesintype {MP}\setupprettytype} +\installnewpretty P {\setupprettiesintype {PL}\setupprettytype} +\installnewpretty T {\setupprettiesintype{TEX}\setupprettytype} +\installnewpretty J {\setupprettiesintype {JV}\setupprettytype} +\installnewpretty S {\setupprettiesintype{SQL}\setupprettytype} +\installnewpretty W {\setupprettiesintype{PAS}\setupprettytype} % Wirth +\installnewpretty I {\setupprettiesintype{EIF}\setupprettytype} % E taken +\installnewpretty X {\setupprettiesintype{XML}\setupprettytype} + +%D We use the \CONTEXT\ color system for switching to and from +%D color mode. We can always redefine these colors afterwards. + +\definecolor [colorprettyone] [r=.9, g=.0, b=.0] % red +\definecolor [colorprettytwo] [r=.0, g=.8, b=.0] % green +\definecolor [colorprettythree] [r=.0, g=.0, b=.9] % blue +\definecolor [colorprettyfour] [r=.8, g=.8, b=.6] % yellow + +\definecolor [grayprettyone] [s=.30] +\definecolor [grayprettytwo] [s=.45] +\definecolor [grayprettythree] [s=.60] +\definecolor [grayprettyfour] [s=.75] + +\definepalet + [colorpretty] + [ prettyone=colorprettyone, + prettytwo=colorprettytwo, + prettythree=colorprettythree, + prettyfour=colorprettyfour] + +\definepalet + [graypretty] + [ prettyone=grayprettyone, + prettytwo=grayprettytwo, + prettythree=grayprettythree, + prettyfour=grayprettyfour] + +\definepalet [TEXcolorpretty] [colorpretty] +\definepalet [TEXgraypretty] [graypretty] +\definepalet [PLcolorpretty] [colorpretty] +\definepalet [PLgraypretty] [graypretty] +\definepalet [PMcolorpretty] [colorpretty] +\definepalet [PMgraypretty] [graypretty] +\definepalet [MPcolorpretty] [colorpretty] +\definepalet [MPgraypretty] [graypretty] +\definepalet [JVcolorpretty] [colorpretty] +\definepalet [JVgraypretty] [graypretty] +\definepalet [JScolorpretty] [colorpretty] +\definepalet [JSgraypretty] [graypretty] +\definepalet [SQLcolorpretty] [colorpretty] +\definepalet [SQLgraypretty] [graypretty] +\definepalet [PAScolorpretty] [colorpretty] +\definepalet [PASgraypretty] [graypretty] +\definepalet [EIFcolorpretty] [colorpretty] +\definepalet [EIFgraypretty] [graypretty] +\definepalet [XMLcolorpretty] [colorpretty] +\definepalet [XMLgraypretty] [graypretty] +\definepalet [LUAcolorpretty] [colorpretty] +\definepalet [LUAgraypretty] [graypretty] + \protect \endinput diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex index 44a3eb37a..ed469e2e0 100644 --- a/tex/context/base/core-vis.tex +++ b/tex/context/base/core-vis.tex @@ -241,10 +241,12 @@ {\EveryPar{\doshowpagebuilder}} \def\doshowpagebuilder - {\strut\llap{\blue \vl - \high{\infofont v:\the\vsize }\vl - \high{\infofont g:\the\pagegoal }\vl - \high{\infofont t:\the\pagetotal}\vl}} + {\strut\llap + {\startcolor[blue]\vl + \high{\infofont v:\the\vsize }\vl + \high{\infofont g:\the\pagegoal }\vl + \high{\infofont t:\the\pagetotal}\vl + \stopcolor}} %D \macros %D {makecutbox, cuthbox, cutvbox, cutvtop} @@ -493,7 +495,7 @@ \advance\scratchdimen \ruledheight \advance\scratchdimen \ruleddepth \divide\scratchdimen 21 - \def\docommando##1% + \def\docommand##1% {\vbox {\hsize3em % \scratchdimen \definecolor @@ -521,7 +523,7 @@ \vss}% \fi}}% \offinterlineskip - \processcommalist[1.00,0.95,0.75,0.50,0.25,0.05,0.00]\docommando}} + \processcommalist[1.00,0.95,0.75,0.50,0.25,0.05,0.00]\docommand}} \def\colorrangeB {\hbox @@ -529,7 +531,7 @@ \multiply\scratchdimen \plustwo \advance\scratchdimen \ruledwidth \divide\scratchdimen 11 - \def\docommando ##1 ##2 ##3##4##5##6% + \def\docommand ##1 ##2 ##3##4##5##6% {\definecolor [\s!dummy] [\c!c=##3##2\else0\fi, @@ -554,17 +556,17 @@ \hss} \vss}% \fi}% - \docommando C .5 \iftrue \iffalse\iffalse\iffalse - \docommando M .5 \iffalse\iftrue \iffalse\iffalse - \docommando Y .5 \iffalse\iffalse\iftrue \iffalse - \docommando K .5 \iffalse\iffalse\iffalse\iftrue - \docommando C 1 \iftrue \iffalse\iffalse\iffalse - \docommando G 1 \iftrue \iffalse\iftrue \iffalse - \docommando Y 1 \iffalse\iffalse\iftrue \iffalse - \docommando R 1 \iffalse\iftrue \iftrue \iffalse - \docommando M 1 \iffalse\iftrue \iffalse\iffalse - \docommando B 1 \iftrue \iftrue \iffalse\iffalse - \docommando K 1 \iffalse\iffalse\iffalse\iftrue}} + \docommand C .5 \iftrue \iffalse\iffalse\iffalse + \docommand M .5 \iffalse\iftrue \iffalse\iffalse + \docommand Y .5 \iffalse\iffalse\iftrue \iffalse + \docommand K .5 \iffalse\iffalse\iffalse\iftrue + \docommand C 1 \iftrue \iffalse\iffalse\iffalse + \docommand G 1 \iftrue \iffalse\iftrue \iffalse + \docommand Y 1 \iffalse\iffalse\iftrue \iffalse + \docommand R 1 \iffalse\iftrue \iftrue \iffalse + \docommand M 1 \iffalse\iftrue \iffalse\iffalse + \docommand B 1 \iftrue \iftrue \iffalse\iffalse + \docommand K 1 \iffalse\iffalse\iffalse\iftrue}} \def\colorrangeC {\hbox @@ -573,7 +575,7 @@ \multiply\scratchdimen 2 \advance\scratchdimen \ruledwidth \divide\scratchdimen 14 - \def\docommando##1% + \def\docommand##1% {\definecolor[\s!dummy][\c!s=##1]% \localstartcolor[\s!dummy]% \vrule @@ -590,7 +592,7 @@ \localstopcolor \vss}% \fi}% - \processcommalist[1,.95,.9,.85,.8,.75,.7,.6,.5,.4,.3,.2,.1,0]\docommando}} + \processcommalist[1,.95,.9,.85,.8,.75,.7,.6,.5,.4,.3,.2,.1,0]\docommand}} \def\docolormarkbox#1#2% {\edef\ruledheight{\the\ht#2}% @@ -676,8 +678,8 @@ \else - \let\supernormalmark \normalmark % mark may already superseded - \let\supernormalmarks \normalmarks % mark may already superseded + \let\supernormalmark \normalmark % mark may already been superseded + \let\supernormalmarks \normalmarks % mark may already been superseded \def\showwhatsits {\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }% diff --git a/tex/context/base/enco-fde.tex b/tex/context/base/enco-fde.tex index bbefb51bf..da104b802 100644 --- a/tex/context/base/enco-fde.tex +++ b/tex/context/base/enco-fde.tex @@ -13,9 +13,9 @@ \unprotect -\startlanguagespecifics[\s!de] +\installactivecharacter " - \appendtoks \makecharacteractive " \to \everynormalcatcodes +\startlanguagespecifics[\s!de] \installcompoundcharacter "a {\aumlaut\midworddiscretionary} \installcompoundcharacter "e {\eumlaut\midworddiscretionary} @@ -87,11 +87,11 @@ % no {\simplifiedcompoundcharacter"} -\startencoding[pdfdoc] - \startlanguagespecifics[\s!de]% hm, a % is needed - \defineactivecharacter " {\"} - \stoplanguagespecifics -\stopencoding +% \startencoding[pdfdoc] +% \startlanguagespecifics[\s!de]% hm, a % is needed +% \defineactivecharacter " {\"} +% \stoplanguagespecifics +% \stopencoding \startencoding[ec] \startlanguagespecifics[\s!de]% diff --git a/tex/context/base/enco-ffr.tex b/tex/context/base/enco-ffr.tex index 1ddd226ee..abe362750 100644 --- a/tex/context/base/enco-ffr.tex +++ b/tex/context/base/enco-ffr.tex @@ -18,6 +18,11 @@ \enablemode[activecolon] \usemodule[tryout] % for the moment +\installactivecharacter : +\installactivecharacter ; +\installactivecharacter ? +\installactivecharacter ! + \unprotect \startlanguagespecifics[\s!fr] @@ -28,10 +33,10 @@ \stoplanguagespecifics \startlanguagespecifics[\s!fr] - \defineactivecharacter : {\mathortext{:}{\directdiscretionary{:}}} - \defineactivecharacter ; {\mathortext{;}{\directdiscretionary{;}}} - \defineactivecharacter ! {\mathortext{!}{\directdiscretionary{!}}} - \defineactivecharacter ? {\mathortext{?}{\directdiscretionary{?}}} + \defineactivecharacter : {\mathortext{:}{\directdiscretionary{:}}} + \defineactivecharacter ; {\mathortext{;}{\directdiscretionary{;}}} + \defineactivecharacter ! {\mathortext{!}{\directdiscretionary{!}}} + \defineactivecharacter ? {\mathortext{?}{\directdiscretionary{?}}} \stoplanguagespecifics % maybe tricky due to possible name clashes: diff --git a/tex/context/base/enco-fpl.tex b/tex/context/base/enco-fpl.tex index 2f90ad9c7..ee9d98dc8 100644 --- a/tex/context/base/enco-fpl.tex +++ b/tex/context/base/enco-fpl.tex @@ -17,6 +17,8 @@ % todo : named glyphs +\installactivecharacter / + \startlanguagespecifics[\s!pl] \appendtoks \makecharacteractive / \to \everynormalcatcodes diff --git a/tex/context/base/enco-fro.tex b/tex/context/base/enco-fro.tex index f6644402b..e5f5e1257 100644 --- a/tex/context/base/enco-fro.tex +++ b/tex/context/base/enco-fro.tex @@ -15,6 +15,8 @@ \unprotect +\installactivecharacter " + \startlanguagespecifics[\s!ro] \installcompoundcharacter "a {\acircumflex} diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex index 9b78ae18d..da14b509b 100644 --- a/tex/context/base/enco-ini.tex +++ b/tex/context/base/enco-ini.tex @@ -18,17 +18,6 @@ %D well as moving plain handling of accents to this module %D instead of overloading plain \TEX\ commands. -% \everyuppercase -% \dotlessi -% single/double quotes -% hyphens -% characterencoding => encoding -% charactermapping => mapping - -%D Most of this module used to be part of the font and language -%D modules. While implementing Czech support, I decided to -%D isolate this code. - %D Patterns are kind of mixed with font encodings and %D mappings. Alas. @@ -111,7 +100,7 @@ \startmessages romanian library: encodings title: codificari 1: codificarea -- - 2: codificarea -- este Œncarcata + 2: codificarea -- este Encarcata 3: codificarea -- este necunoscuta \stopmessages @@ -125,248 +114,11 @@ %D First we define a few local or not yet initialized constants. \def\@map@{@m@ap@} % mapping prefix -\def\@reg@{@r@eg@} % regime prefix \def\@fha@{@f@ha@} % font prefix \def\@cas@{@c@as@} % casecom prefix \ifx\currentlanguage\undefined \let\currentlanguage\s!en \fi -%D \macros -%D {protectregime} -%D -%D The next boolean is used later on to prevent unwanted -%D catcode changes. Use it with care. - -\newif\ifprotectregime \protectregimetrue - -\def\setregimecode#1#2% - {\ifprotectregime\ifnum\catcode#1=\active\else - \catcode#1=#2%\relax - \fi\else - \catcode#1=#2%\relax - \fi - \relax} - -%D \macros -%D {startregime, enableregime} -%D -%D Sometimes it makes sense to activate the characters in the -%D upper half of the character table. Such a bundle of -%D characters can be packages in a regime. Later we will see -%D encodings (that links characters slots to glyphs) and -%D mappings (that take care of hyphenation and case changes). -%D -%D When character~231 is of category code letter, it -%D directly maps to glyph~231 (unless of course some virtual -%D font is used). By making character~231 active, we can map -%D it onto for instance the glyph in slot 233. This mapping -%D can in itself be indirect, in the sense that it is for -%D instance handled by an accent command. -%D -%D Regimes are implemented roughly the same as mappings, but -%D enabled under different circumstances. In the future, the -%D low level implementation may change. - -\def\startregime[#1]% - {\pushmacro\characterregime - \edef\characterregime{@#1@}% - \checkregimetoks} - -\def\checkregimetoks - {\doifundefined{\@reg@\characterregime} - {\@EA\newtoks\csname\@reg@\characterregime\endcsname}} - -\def\stopregime - {\popmacro\characterregime} - -%\long\def\startregime[#1]#2\stopregime{} - -\def\setregimetoks - {\checkregimetoks - \@EA\let\@EA\regimetoks\csname\@reg@\characterregime\endcsname} - -\let\enabledregime\empty - -% \def\enableregime[#1]% -% {\edef\characterregime{@#1@}% -% \ifx\enabledregime\characterregime \else -% \doifdefined{\@reg@\characterregime} -% {\the\csname\@reg@\characterregime\endcsname}% -% \let\enabledregime\characterregime -% \fi} - -% \def\enableregime[#1]% -% {\edef\characterregime{@#1@}% -% \ifx\enabledregime\characterregime \else -% \the\executeifdefined{\@reg@\characterregime}\emptytoks -% \fi} - -\def\defineregimesynonym - {\dodoubleargument\dodefineregimesynonym} - -\def\dodefineregimesynonym[#1][#2]% - {\setevalue{\@reg@::#1}{#2}} - -\def\trueregimename#1% - {\executeifdefined{\@reg@::#1}{#1}} - -% \def\enableregime[#1]% -% {\edef\characterregime{@\trueregimename{#1}@}% -% \ifx\enabledregime\characterregime \else -% \the\executeifdefined{\@reg@\characterregime}\emptytoks -% \fi} - -\def\enableregime[#1]% - {\edef\characterregime{@\trueregimename{#1}@}% - \ifx\enabledregime\characterregime \else - \doifundefined{\@reg@\characterregime} - {\expanded{\useregime[\pureencodingname\characterregime]}}% auto load - \the\executeifdefined{\@reg@\characterregime}\emptytoks - \fi} - -%D \macros -%D {defineactivedecimal, defineactivedecimals, defineactivetoken} -%D -%D The following commands are rather ugly ones. It makes a -%D character active and assigns it a value. When expanded, -%D the decimal number of the character is passed as first -%D argument. -%D -%D \starttyping -%D \def\decimalcharacter#1{\message{#1 is now active}} -%D -%D \defineactivedecimal 122 {\decimalcharacter} -%D -%D \defineactivedecimals 128 to 255 as {\decimalcharacter} -%D \stoptyping -%D -%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 - \scratchcounter\uccode\activehackcode - \uccode\activehackcode#1\relax - \uppercase{\unexpanded\edef~{\noexpand#2{\number#1}}}% - \uccode\activehackcode\scratchcounter} - -% \long\def\defineactivedecimal#1 #2 % -% {\setregimetoks -% \appendtoks\dodefineactivedecimal{#1}{#2}\to\regimetoks} -% -% \long\def\defineactivedecimals#1 to #2 as #3 % -% {\setregimetoks -% \dostepwiserecurse{#1}{#2}\plusone -% {\@EA\appendtoks\@EA\dodefineactivedecimal\@EA{\recurselevel}{#3}\to\regimetoks}} -% -% \long\def\defineactivetoken #1 #2% no {} after #2, else no kern -% {\setregimetoks -% \appendtoks\defineactivecharacter#1 {#2}\to\regimetoks} -% -% \long\def\defineactiveinspector #1 #2% watch the missing {} -% {\setregimetoks -% \appendtoks\defineactivecharacter#1 {#2}\to\regimetoks} -% -% faster: - -\long\def\defineactivedecimal#1 #2 % - {\setregimetoks - \regimetoks\expandafter{\the\regimetoks\dodefineactivedecimal{#1}{#2}}} - -\long\def\defineactivedecimals#1 to #2 as #3 % - {\setregimetoks - \dostepwiserecurse{#1}{#2}\plusone - {\regimetoks\@EA\@EA\@EA{\@EA\the\@EA\regimetoks\@EA\dodefineactivedecimal\@EA{\recurselevel}{#3}}}} - -\beginETEX - - % much faster, prelude to run time loading - - % \def\doexpandactivedecimal#1#2#3% - % {\ifnum#1>#2 % - % \expandafter\gobblefourarguments - % \else - % \noexpand\dodefineactivedecimal{#1}{#3}% - % \expandafter\expandafter\expandafter\doexpandactivedecimal\expandafter - % \fi\expandafter{\the\numexpr#1+1\relax}{#2}{#3}} - % - % \long\def\defineactivedecimals#1 to #2 as #3 % - % {\setregimetoks - % \scratchcounter#2\relax - % \scratchtoks{#3}% - % \expanded{\regimetoks{\the\regimetoks\doexpandactivedecimal{#1}{#2}{\the\scratchtoks}}}% - % \ignorespaces} - - \def\doexpandactivedecimal#1% - {\ifnum#1>\scratchcounter - \expandafter\gobbletwoarguments - \else - \noexpand\dodefineactivedecimal{#1}{\the\scratchtoks}% - \expandafter\expandafter\expandafter\doexpandactivedecimal\expandafter - \fi\expandafter{\the\numexpr#1+\plusone\relax}} - - \long\def\defineactivedecimals#1 to #2 as #3 % - {\setregimetoks - \scratchcounter#2\relax - \scratchtoks{#3}% - \expanded{\regimetoks{\the\regimetoks\doexpandactivedecimal{#1}}}% - \ignorespaces} - -\endETEX - -\long\def\defineactivetoken #1 #2% no {} after #2, else no kern - {\setregimetoks - \regimetoks\expandafter{\the\regimetoks\defineactivecharacter#1 {#2}}} - -\long\def\defineactiveinspector #1 #2% watch the missing {} - {\setregimetoks - \regimetoks\expandafter{\the\regimetoks\defineactivecharacter#1 {#2}}} - -%D .... - -\edef\nocharacterregime{@\s!default @} - -\def\definetoken #1 % #1 = rawtoken or number - {\doifnumberelse{\string#1} - {\expanded{\dodefinetoken{\rawcharacter{#1}}}} - {\expanded{\dodefinetoken{\string#1}}}} - -\def\dodefinetoken#1#2% - {\defineactivecharacter#1 {\dohandletoken{#1}} % - \setvalue{\characterregime#1}{#2}} - -\beginTEX - -\def\dohandletoken#1% - {\csname\expandafter\ifx\csname\characterregime#1\endcsname\relax - \nocharacterregime\else\characterregime\fi#1\endcsname} - -\endTEX - -\beginETEX \ifcsname - -\def\dohandletoken#1% - {\csname\ifcsname\characterregime#1\endcsname - \characterregime\else\nocharacterregime\fi#1\endcsname} - -\endETEX - -%D .... - -\def\doautosetregime#1#2% - {\ifnum#2>127 - % \def\!!stringa{#2 }% - % \@EA\@EA\@EA\defineactivetoken\@EA\!!stringa\@EA{\csname#1\endcsname}% - \expanded{\defineactivetoken #2 \@EA\noexpand\csname#1\endcsname}% - \fi} - %D \macros %D {setupencoding} %D @@ -425,19 +177,6 @@ %D So, character 165 becomes 181 in uppercase and 165 in %D lowercase. A mapping is activated with \type {\enablemapping}. -% quite slow, esp when done at runtime - -% \def\startmapping[#1]% -% {\pushmacro\charactermapping -% \edef\charactermapping{@#1@}% -% \ifundefined{\@map@\charactermapping}% -% \expandafter\newtoks\csname\@map@\charactermapping\endcsname -% \fi} - -% \def\stopmapping -% {%\setmappingtoks\showthe\mappingtoks -% \popmacro\charactermapping} - \def\startsavingmappingtoks#1% {\bgroup \edef\charactermapping{@#1@}% @@ -451,7 +190,7 @@ {\edef\@@expanded {\the\mappingtoks \ifnum\recurselevel>127 - \noexpand\checkregimecode\recurselevel\space + \noexpand\settoletterunlessactive{\recurselevel}% \fi \lccode\recurselevel\ifnum\lccode\recurselevel=\zerocount\zerocount\else\space\the\lccode\recurselevel\space\fi \uccode\recurselevel\ifnum\uccode\recurselevel=\zerocount\zerocount\else\space\the\uccode\recurselevel\space\fi @@ -488,30 +227,6 @@ \expandafter\newtoks\csname\@cas@\charactermapping\endcsname \fi} -\def\checkregimecode#1 % - {\ifprotectregime\ifnum\catcode#1=\active\else - \catcode#1\@@letter - \fi\else - \catcode#1\@@letter - \fi - \relax} - -% \def\definecasemap #1 #2 #3 % code lower upper -% {\setmappingtoks -% \doifelse{#2}{to} -% {\appendtoks\presetcaserange{#1}{#3}\to\mappingtoks} -% {\appendtoks\setcasemap #1 #2 #3 \to\mappingtoks}% -% \ignorespaces} -% -% faster - -% \def\definecasemap #1 #2 #3 % code lower upper -% {\setmappingtoks -% \doifelse{#2}{to} -% {\mappingtoks\@EA{\the\mappingtoks\presetcaserange{#1}{#3}}} -% {\mappingtoks\@EA{\the\mappingtoks\setcasemap #1 #2 #3 }}% -% \ignorespaces} - \def\definecasemap #1 #2 #3 % code lower upper {\doifelse{#2}{to} {\presetcaserange{#1}{#3}} @@ -521,11 +236,6 @@ %D Saves a few tokens -% \def\definecaseswap #1 #2 % lower upper -% {\setmappingtoks -% \mappingtoks\@EA{\the\mappingtoks\setcaseswap #1 #2 }% -% \ignorespaces} - \def\definecaseswap #1 #2 % lower upper {\lccode#1=#1\relax \uccode#2=#2\relax @@ -533,62 +243,14 @@ \uccode#1=#2\relax \ignorespaces} -% \def\definecaseself #1 % lower=upper=self -% {\setmappingtoks -% \mappingtoks\@EA{\the\mappingtoks\setcaseself #1 }% -% \ignorespaces} - \def\definecaseself #1 % lower=upper=self - {\lccode #1=#1\relax - \uccode #1=#1\relax + {\lccode#1=#1\relax + \uccode#1=#1\relax \ignorespaces} %D Watch the \type {\definecasemap 127 to 255} option! %D Dedicated to Taco there is also: -% \def\definecasemaps #1 to #2 lc #3 uc #4 % from to lc+ uc+ -% {\dostepwiserecurse{#1}{#2}\plusone -% {\!!counta\recurselevel\advance\!!counta #3\relax -% \!!countb\recurselevel\advance\!!countb #4\relax -% \expanded{\definecasemap -% \recurselevel\space\the\!!counta\space\the\!!countb\space}}% -% \ignorespaces} - -% \beginETEX - -% % much faster, prelude to run time loading - -% % \def\doexpandcasemaps#1#2#3#4% -% % {\ifnum#1>#2 % -% % \expandafter\gobblefivearguments -% % \else -% % \noexpand\setcasemap#1\space\the\numexpr#1+#3\relax\space\the\numexpr#1+#4\relax\space -% % \expandafter\expandafter\expandafter\doexpandcasemaps\expandafter -% % \fi\expandafter{\the\numexpr#1+1\relax}{#2}{#3}{#4}} -% % -% % \def\definecasemaps #1 to #2 lc #3 uc #4 % from to lc+ uc+ -% % {\setmappingtoks -% % \expanded{\mappingtoks{\the\mappingtoks\doexpandcasemaps{#1}{#2}{#3}{#4}}}% -% % \ignorespaces} - -% \def\doexpandcasemaps#1% -% {\ifnum#1>\scratchcounter -% \expandafter\gobbletwoarguments -% \else -% \noexpand\setcasemap#1\space\the\numexpr#1+\!!counta\relax\space\the\numexpr#1+\!!countb\relax\space -% \expandafter\expandafter\expandafter\doexpandcasemaps\expandafter -% \fi\expandafter{\the\numexpr#1+\plusone\relax}} - -% \def\definecasemaps #1 to #2 lc #3 uc #4 % from to lc+ uc+ -% {\setmappingtoks -% \scratchcounter#2\relax -% \!!counta#3\relax -% \!!countb#4\relax -% \expanded{\mappingtoks{\the\mappingtoks\doexpandcasemaps{#1}}}% -% \ignorespaces} - -% \endETEX - \def\definecasemaps #1 to #2 lc #3 uc #4 % from to lc+ uc+ {\dostepwiserecurse{#1}{#2}\plusone {\scratchcounter\recurselevel\advance\scratchcounter#3\lccode\recurselevel=\scratchcounter @@ -606,71 +268,12 @@ %D %D and saves a lot of typing (copying). -% \def\resetcaserange #1 to #2 -% {\dostepwiserecurse{#1}{#2}{1} -% {\expanded{\definecasemap\recurselevel\space0\space0\space}}} - -% \def\resetcaserange #1 to #2 -% {\setmappingtoks -% \dostepwiserecurse{#1}{#2}\plusone -% {\edef\@@expanded{\recurselevel\space}% -% \@EA\appendtoks\@EA\setcasemap\@@expanded 0 0 \to\mappingtoks}% -% \ignorespaces} -% -% faster: - -% \def\resetcaserange #1 to #2 -% {\setmappingtoks -% \dostepwiserecurse{#1}{#2}\plusone -% {\edef\@@expanded{\recurselevel\space}% -% \mappingtoks\@EA\@EA\@EA{\@EA\the\@EA\mappingtoks\@EA\setcasemap\@@expanded 0 0 }}% -% \ignorespaces} - -% \beginETEX - -% % much faster, prelude to run time loading - -% % \def\doexpandcaserange#1#2% -% % {\ifnum#1>#2 % -% % \expandafter\gobblethreearguments -% % \else -% % \noexpand\setcasemap #1 0 0 % -% % \expandafter\expandafter\expandafter\doexpandcaserange\expandafter -% % \fi\expandafter{\the\numexpr#1+1\relax}{#2}} -% % -% % \def\resetcaserange #1 to #2 -% % {\setmappingtoks -% % \expanded{\mappingtoks{\the\mappingtoks\doexpandcaserange{#1}{#2}}}% -% % \ignorespaces} - -% \def\doexpandcaserange#1% -% {\ifnum#1>\scratchcounter -% \expandafter\gobbletwoarguments -% \else -% \noexpand\setcasemap #1 0 0 % -% \expandafter\expandafter\expandafter\doexpandcaserange\expandafter -% \fi\expandafter{\the\numexpr#1+\plusone\relax}} - -% \def\resetcaserange #1 to #2 -% {\setmappingtoks -% \scratchcounter#2\relax -% \expanded{\mappingtoks{\the\mappingtoks\doexpandcaserange{#1}}}% -% \ignorespaces} - -% \endETEX - \def\resetcaserange #1 to #2 {\dostepwiserecurse{#1}{#2}\plusone {\lccode\recurselevel\zerocount \uccode\recurselevel\zerocount}% \ignorespaces} -% \def\presetcaserange#1#2% could be pre-expanded -% {\dostepwiserecurse{#1}{#2}\plusone -% {\setregimecode\recurselevel\@@letter -% \lccode \recurselevel=\recurselevel -% \uccode \recurselevel=\recurselevel}} - \def\presetcaserange#1#2% could be pre-expanded {\dostepwiserecurse{#1}{#2}\plusone {\lccode\recurselevel=\recurselevel @@ -678,77 +281,33 @@ \ignorespaces} \def\setcasemap #1 #2 #3 % - {\setregimecode{#1}\@@letter + {\settoletterunlessactive{#1}% \lccode #1=#2 \uccode #1=#3 } \def\setcaseswap #1 #2 % - {\setregimecode{#1}\@@letter - \setregimecode{#2}\@@letter + {\settoletterunlessactive{#1}% + \settoletterunlessactive{#2}% \lccode #1=#1 \uccode #2=#2 \lccode #2=#1 \uccode #1=#2 } \def\setcaseself #1 % - {\setregimecode{#1}\@@letter + {\settoletterunlessactive{#1}% \lccode #1=#1 \uccode #1=#1 } -% \def\definespacemap #1 #2 % code sfcode -% {\setmappingtoks -% \appendtoks\setspacemap #1 #2 \to\mappingtoks -% \ignorespaces} - -% faster: - -% \def\definespacemap #1 #2 % code sfcode -% {\setmappingtoks -% \mappingtoks\expandafter{\the\mappingtoks\setspacemap #1 #2 }% -% \ignorespaces} - \def\definespacemap #1 #2 % code sfcode {\sfcode#1=#2% \ignorespaces} \def\setspacemap #1 #2 % - {\setregimecode{#1}\@@other + {\settootherunlessactive{#1}% %\lccode #1=\zerocount %\uccode #1=\zerocount \sfcode #1=#2 } -% \def\defineuppercasecom#1#2% -% {\setmappingtoks -% \appendtoks\setuppercasecom#1{#2}\to\mappingtoks -% \ignorespaces} -% -% \def\definelowercasecom#1#2% -% {\setmappingtoks -% \appendtoks\setlowercasecom#1{#2}\to\mappingtoks -% \ignorespaces} -% -% faster - -% \def\defineuppercasecom#1#2% -% {\setmappingtoks -% \mappingtoks\expandafter{\the\mappingtoks\setuppercasecom#1{#2}}% -% \ignorespaces} - -% \def\definelowercasecom#1#2% -% {\setmappingtoks -% \mappingtoks\expandafter{\the\mappingtoks\setlowercasecom#1{#2}}% -% \ignorespaces} - -% \def\defineuppercasecom#1#2% -% {\setmappingtoks -% \mappingtoks\expandafter{\the\mappingtoks\setuppercasecom#1{#2}}% -% \ignorespaces} - -% \def\definelowercasecom#1#2% -% {\setmappingtoks -% \mappingtoks\expandafter{\the\mappingtoks\setlowercasecom#1{#2}}% -% \ignorespaces} - \def\defineuppercasecom#1#2% {\global\casecomtoks\expandafter{\the\casecomtoks\setuppercasecom#1{#2}}% \ignorespaces} @@ -889,7 +448,6 @@ \edef\characterencoding {@\s!default @} \edef\nocharacterencoding {@\s!default @} \edef\charactermapping {@\s!default @} -\edef\characterregime {@\s!default @} % todo, else \d j == \dj, print file and check @@ -932,12 +490,6 @@ \edef\nocharacterencoding{@\ifsecondargument#2\else\s!default\fi @}% \synchronizepatterns} -%\def\enablesimpleencoding#1% e.g. \enableencoding{raw} -% {\edef\characterencoding{@#1@}% handy for XML key=val's -% \edef\nocharacterencoding{@\s!default @}} % evt noppes - -% in font switch and xml simple k/v remapping - \edef\xnocharacterencoding{@\s!default @} \def\fastenableencoding#1% @@ -950,10 +502,9 @@ \def\dostartencoding[#1][#2]% encoding regime {%\showmessage\m!encodings1{#1}% \pushmacro\characterencoding - \pushmacro\characterregime + \pushmacro\currentregime \pushmacro\dohandleaccent % still needed? \pushmacro\dohandlecommand % still needed? - %pushmacro\definesortkey \pushmacro\doautosetregime \let\dohandleaccent\donthandleaccent % still needed? \let\dohandlecommand\donthandlecommand % still needed? @@ -961,14 +512,13 @@ \edef\characterencoding{@#1@}% \doifelsenothing{#2}% {\let\doautosetregime\gobbletwoarguments} - {\def\characterregime{@#2@}}} + {\def\currentregime{#2}}} \def\stopencoding {\popmacro\doautosetregime - %popmacro\definesortkey \popmacro\dohandlecommand % still needed? \popmacro\dohandleaccent % still needed? - \popmacro\characterregime + \popmacro\currentregime \popmacro\characterencoding} % probably obsolete (hm, not yet) @@ -1008,31 +558,7 @@ %D {\flushsortkey}, a macro taking 4~arguments. %D %D This mechanism is currently being tested and subjected to -%D changes! - -%D THS CODE IS OBSOLETE - -% \def\savesortkey#1#2#3#4% -% {\let\flushsortkey\relax % important -% \edef\!!stringa{sort:\characterencoding}% -% \ifundefined\!!stringa -% \let\!!stringb\empty -% \else -% \@EA\def\@EA\!!stringb\@EA{\csname\!!stringa\endcsname}% -% \fi -% \convertargument#1\to\asciiA \convertargument#2\to\asciiB -% \convertargument#3\to\asciiC \convertargument#4\to\asciiD -% \setevalue{\!!stringa}% -% {\!!stringb\flushsortkey{\asciiA}{\asciiB}{\asciiC}{\asciiD}}} -% -% \def\definesortkey#1#2#3#4% -% {} -% -% \def\flushsortkeys -% {\enablelanguagespecifics[\currentlanguage]% -% \getvalue{sort:\characterencoding}} -% -% \let\flushsortkey \relax +%D changes! Obsolete: \let\definesortkey\gobblefourarguments \let\savesortkey \gobblefourarguments @@ -1059,31 +585,6 @@ {\setvalue{\accentprefix\characterencoding#1\string#2}{\char#3 }} % space added {\setvalue{\accentprefix\characterencoding#1\string#2}{#3}}} -\beginTEX - -\def\dohandleaccent#1#2% - {\@EA\ifx\csname\accentprefix\characterencoding#1\string#2\empty\endcsname\relax - \@EA\ifx\csname\accentprefix\nocharacterencoding#1\string#2\empty\endcsname\relax - \@EA\ifx\csname\accentprefix\characterencoding#1\endcsname\relax -% \@EA\ifx\csname\accentprefix\nocharacterencoding#1\endcsname\relax -% \donormaltextaccent{#1}{#2}% -% \else - \csname\accentprefix\nocharacterencoding#1\endcsname{#2}% -% \fi - \else - \csname\accentprefix\characterencoding#1\endcsname{#2}% - \fi - \else - \csname\accentprefix\nocharacterencoding#1\string#2\empty\endcsname - \fi - \else - \csname\accentprefix\characterencoding#1\string#2\empty\endcsname - \fi} - -\endTEX - -\beginETEX \ifcsname - \def\dohandleaccent#1#2% {\ifcsname\accentprefix\characterencoding#1\string#2\empty\endcsname \csname\accentprefix\characterencoding#1\string#2\empty\endcsname @@ -1097,8 +598,6 @@ % \donormaltextaccent{#1}{#2}% \fi\fi\fi}%\fi} -\endETEX - %D In patterns, characters have to be bytes. These will be %D mapped onto the compact pattern arrays. @@ -1107,17 +606,13 @@ \def\patternchar#1 {\rawcharacter{#1}} % space is part of character definition ! -\ifx \enablepatterntokens\undefined - \def\handlepatterntoken#1]{\csname#1\endcsname} -\fi +% \ifx \enablepatterntokens\undefined +% \def\handlepatterntoken#1]{\csname#1\endcsname} +% \fi % we need to postpone catcode changes, e.g. hr patterns % have \catcode" -> which fails when " is letter -% new patterns, some day -% -% \enableregime[utf]% - \def\pathypsettings {\ifx \enablepatterntokens\undefined \defineactivecharacter [ {\handlepatterntoken}% @@ -1165,16 +660,6 @@ {\egroup \stopreadingfile} -% \def\definecharacter#1 #2 % -% {\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi -% \doifnumberelse{\string#2} -% {\setvalue{\characterprefix\characterencoding\string#1}{\char#2 }% watch the space -% \doautosetregime{#1}{#2}} -% {\setvalue{\characterprefix\characterencoding\string#1}{#2}}} - -% \def\numcharacter#1{\char#1 } -% \let\dochar\numcharacter - \def\thechr#1{\char#1 } % just in case \relax interferes \unexpanded\def\numchr#1{\char#1\relax} \unexpanded\def\strchr#1{\csname#1\endcsname} @@ -1186,48 +671,15 @@ \def\definecharacter#1 #2 % {\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi -% \doifnumberelse{\string#2} \doifnumberelse{\string#2} {\setvalue{\characterprefix\characterencoding\string#1}{\dochar{#2}}% \doautosetregime{#1}{#2}} {\setvalue{\characterprefix\characterencoding\string#1}{#2}}} -% better -% -% \def\definecharacter#1 #2 % -% {\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi -% \doifnumberelse{\string#2} -% {\setevalue{\characterprefix\characterencoding\string#1}{\noexpand\charofnum{\number#2}}% watch the space -% \doautosetregime{#1}{#2}} -% {\setvalue{\characterprefix\characterencoding\string#1}{#2}}} -% -% \def\charofnum#1{\char#1 } -% \def\byteofnum#1{\rawcharacter{#1}} - -\beginTEX - -\def\dohandlecharacter#1% - {\csname\characterprefix\expandafter\ifx\csname\characterprefix\characterencoding#1\endcsname\relax - \nocharacterencoding\else\characterencoding\fi#1\endcsname} - -% \def\dopatterncharacter#1% -% {\csname\expandafter\ifx\csname\characterprefix\characterencoding#1\endcsname\relax -% \strippedcsname\fallbackpatternchar\else\characterprefix\characterencoding#1\fi\endcsname} - -\endTEX - -\beginETEX \ifcsname - \def\dohandlecharacter#1% {\csname\characterprefix\ifcsname\characterprefix\characterencoding#1\endcsname \characterencoding\else\nocharacterencoding\fi#1\endcsname} -% \def\dopatterncharacter#1% -% {\csname\ifcsname\characterprefix\characterencoding#1\endcsname -% \characterprefix\characterencoding#1\else\strippedcsname\fallbackpatternchar\fi\endcsname} - -\endETEX - % \def\fallbackpatternchar{x} % makes no sense, duplicate patterns \def\defaultcharacter#1% @@ -1240,20 +692,6 @@ %\redefinecommand #1 % just to be sure \setvalue{\commandprefix\characterencoding\string#1}{#2}} -% %D This one is needed in order to prevent problems with math (see \type -% %D {\over} in dutch interface). This became a problem one when going -% %D low level english. - -% \def\doifdefinedascommandelse#1% -% {\bgroup -% \convertargument\dohandlecommand{#1}\to\asciiA -% \@EAEAEA\convertargument\csname#1\endcsname\to\asciiB -% \ifx\asciiA\asciiB -% \egroup\expandafter\firstoftwoarguments -% \else -% \egroup\expandafter\secondoftwoarguments -% \fi} - %D Here we see that redefining accents is characters is more %D or less the same as redefining commands. We also could have %D said: @@ -1263,48 +701,6 @@ %D \def\definecharacter#1 {\definecommand#1 \char} %D \stoptyping -% obsolete -% -% %D \macros -% %D {redefineaccent} -% %D -% %D Telling \CONTEXT\ how to treat accents and special -% %D characters is a two stage process. First we signal the -% %D system which commands are to be adapted, after which we can -% %D redefine their behavior when needed. We showed this in the -% %D previous paragraphs. These redefinitions are grouped at the -% %D end of this file, but we show some examples here. -% %D -% %D Accents or accent generating commands are redefined by: -% %D -% %D \starttyping -% %D \redefineaccent ' % grave -% %D \redefineaccent " % diaeresis -% %D \redefineaccent ^ % circumflex -% %D \redefineaccent v % caron -% %D \stoptyping -% %D -% %D The original \PLAIN\ \TEX\ meaning of each accent generating -% %D command is saved first. Next these commands are redefined to -% %D do an indirect call to a macro that acts according to the -% %D encoding vector in use. -% -% \def\redefineaccent% -% {\protectfontcharacters -% \doredefineaccent} -% -% \def\doredefineaccent#1 % -% {\def\!!stringa{\nocharacterencoding\string#1}% -% \doifundefined{\!!stringa} -% {\@EA\letvalue\@EA\!!stringa\@EA=\csname\string#1\endcsname}% -% % no \unexpanded, else pdfdoc fails -% \setvalue{\string#1}{\dohandleaccent#1}% -% \unprotectfontcharacters} -% -% \def\doredefineaccent#1 % -% {\setvalue{#1}{\dohandleaccent{#1}}% -% \unprotectfontcharacters} - %D \macros %D {defineaccentcommand} %D @@ -1348,53 +744,6 @@ \let\normalchar =\char \let\normalaccent=\accent -% \beginETEX \ifcsname -% -% \unexpanded\def\dohandleaccent#1#2% -% {\def\glyph{#2}% -% \ifx\glyph\empty -% \dohandleaccent#1\relax -% \else\ifx\glyph\space -% \dohandleaccent#1\relax -% \else\ifcsname\characterencoding#1\string#2\empty\endcsname -% \csname\characterencoding#1\string#2\endcsname -% \else\ifcsname\characterencoding#1\endcsname -% \csname\characterencoding#1\endcsname#2% -% \else -% \csname\nocharacterencoding#1\endcsname#2% -% \fi\fi\fi\fi -% \relax} % prevents further reading -% -% \endETEX -% -% \beginTEX -% -% \unexpanded\def\dohandleaccent#1#2% -% {\def\glyph{#2}% -% \ifx\glyph\empty -% \dohandleaccent#1\relax -% \else\ifx\glyph\space -% \dohandleaccent#1\relax -% \else\expandafter\ifx\csname\characterencoding#1\string#2\empty\endcsname\relax -% \expandafter\ifx\csname\characterencoding#1\endcsname\relax -% \csname\nocharacterencoding#1\endcsname#2% -% \else -% \csname\characterencoding#1\endcsname#2% -% \fi -% \else -% \csname\characterencoding#1\string#2\endcsname -% \fi\fi\fi -% \relax} % prevents further reading -% -% \endTEX -% -% %D The trick with \type{\\} is needed to prevent spaces from -% %D being gobbled after the accented character, should we have -% %D used \type{\next}, we should have ended up with gobbled -% %D spaces. The \type {\empty} after \type {#2} takes care of -% %D empty arguments, so that we can savely say~\type{\"{}} -% %D and alike. - %D \macros %D {redefinecommand} %D @@ -1420,8 +769,6 @@ {% no \unexpanded, else pdfdoc fails \setvalue{\string#1}{\dohandlecommand{#1}}}% -\beginETEX \ifcsname - \def\dohandlecommand#1% {\csname\commandprefix \ifcsname\commandprefix\characterencoding#1\endcsname @@ -1431,45 +778,13 @@ \fi #1\endcsname} -\endETEX - -\beginTEX - -\def\dohandlecommand#1% - {\csname\commandprefix - \expandafter\ifx\csname\commandprefix\characterencoding#1\endcsname\relax - \nocharacterencoding - \else - \characterencoding - \fi - #1\endcsname} - -\endTEX - -% %D \macros -% %D {redefinecharacter} -% %D -% %D Special characters, which differ from accented characters -% %D in that they are to be presented as they are, are redefined -% %D by -% %D -% %D \starttyping -% %D \redefinecharacter ae % ae -% %D \redefinecharacter cc % ccedilla -% %D \stoptyping -% %D -% %D To keep things simple, we just copy this command: -% -% \let\redefinecharacter=\redefinecommand - %D \macros -%D {currentencoding, currentregime, currentmapping} +%D {currentencoding, currentmapping} %D %D When we show 'm, we don't want to see the protection %D measures. \def\currentencoding{\@EA\dopureencodingname\characterencoding} -\def\currentregime {\@EA\dopureencodingname\characterregime } \def\currentmapping {\@EA\dopureencodingname\charactermapping } \def\dopureencodingname @#1@{#1} @@ -1622,55 +937,14 @@ \newevery \everysanitize \EverySanitize -%D \macros -%D {retainlccodes} -%D -%D One way of manipulating characters is changing the their -%D \type{\lccode} and applying \type{\lowcase}. An example of -%D this can be found in \type{spec-mis}. - -\ifx\retainlccodes\undefined - - \def\retainlccodes{\dostepwiserecurse{0}{255}{1}{\lccode\recurselevel=\recurselevel}\relax} - -\fi - -% %D \macros -% %D {cc,CC} -% %D -% %D Hm, not in plain at all, those \cc's and \CC's. -% -% \def\CC{\c{C}} -% \def\cc{\c{c}} -% -% %D \macros -% %D {dotlessi,dotlessj} -% %D -% %D We also save both dotless~\dotlessi\ and~\dotlessj. This -% %D way we still have them were we expect them, even when -% %D macros of font providers redefine them. -% -% \let\dotlessi=\i -% \let\dotlessj=\j - %D \macros %D {defineuclass,defineudigit,udigit} %D %D The next few macros are experimental and needed for unicoded %D chinese characters. -\beginETEX - \def\defineuclass #1 #2 #3 % - {\setvalue{uc\the\numexpr#2*256+#3\relax}{#1}} -\endETEX - -\beginTEX - \def\defineuclass #1 #2 #3 % - {\scratchcounter256\relax - \multiply\scratchcounter#2\relax - \advance\scratchcounter#3\relax - \setvalue{uc\the\scratchcounter}{#1}} -\endTEX +\def\defineuclass #1 #2 #3 % + {\setvalue{uc\the\numexpr#2*256+#3\relax}{#1}} \def\defineudigit #1 #2 #3 {\setvalue{\characterencoding uc#1}{\uchar{#2}{#3}}} @@ -1687,92 +961,6 @@ \def\octuchar#1#2{\uchar{`#1}{`#2}} \def\hexuchar#1#2{\uchar{"#1}{"#2}} -% %D Just to be sure, we save the original values of \type {\ss}. -% -% \ifx\undefined\SS \let\SS=\ss \fi -% \ifx\undefined\sz \let\sz=\ss \fi -% -% %D Here come the definitions. -% -% \redefineaccent ' % grave -% \redefineaccent ` % acute -% \redefineaccent " % diaeresis -% \redefineaccent ^ % circumflex -% \redefineaccent ~ % tilde -% \redefineaccent v % caron -% \redefineaccent u % breve -% \redefineaccent . % dotaccent -% \redefineaccent H % hungarumlaut -% \redefineaccent t % ........ -% \redefineaccent r % ........ -% \redefineaccent = -% \redefineaccent b -% \redefineaccent c -% \redefineaccent d -% \redefineaccent k - -% obsolete (moved) -% -% \redefinecharacter ae % ae -% \redefinecharacter AE % AE -% \redefinecharacter oe % oe -% \redefinecharacter OE % OE -% \redefinecharacter o % ostroke -% \redefinecharacter O % Ostroke -% \redefinecharacter sz % germandbls -% \redefinecharacter SS % germandbls -% \redefinecharacter aa % aring -% \redefinecharacter AA % Aring - -% \redefinecharacter th -% \redefinecharacter TH -% \redefinecharacter ng -% \redefinecharacter NG -% \redefinecharacter ij -% \redefinecharacter IJ -% -% \redefinecharacter i \redefinecharacter dotlessi -% \redefinecharacter j \redefinecharacter dotlessj -% -% \redefinecharacter l -% \redefinecharacter L - -% replaced -% -% \defineaccent " i {\"\i} \defineaccent " j {\"\j} -% \defineaccent ^ i {\^\i} \defineaccent ^ j {\^\j} -% \defineaccent ` i {\`\i} \defineaccent ` j {\`\j} -% \defineaccent ' i {\'\i} \defineaccent ' j {\'\j} -% \defineaccent ~ i {\~\i} \defineaccent ~ j {\~\j} - -% \redefinecharacter leftguillemot -% \redefinecharacter rightguillemot -% \redefinecharacter leftsubguillemot -% \redefinecharacter rightsubguillemot - -% obsolete -% -% %D Some more: -% -% \startmapping[\s!default] -% -% \defineuppercasecom \i {I} -% \defineuppercasecom \j {J} -% \defineuppercasecom \sz {SS} -% \defineuppercasecom \SS {SS} -% \defineuppercasecom \l \L -% \defineuppercasecom \ae \AE -% \defineuppercasecom \aa \AA -% \defineuppercasecom \o \O -% \defineuppercasecom \oe \OE -% \definelowercasecom \L \l -% \definelowercasecom \AE \ae -% \definelowercasecom \AA \aa -% \definelowercasecom \O \o -% \definelowercasecom \OE \oe -% -% \stopmapping - %D Basics and fallbacks. \newif\ifignoreaccent @@ -1807,24 +995,6 @@ % will be overloaded later -%\def\definetextaccent#1 #2% -% {\setvalue{\string#1}{#2}% will be overloaded -% \setvalue{normaltextaccent\string#1}{#2}} -% -%\def\donormaltextaccent#1% -% {\getvalue{normaltextaccent\string#1}} -% -%\definetextaccent ` {\buildtextaccent\textgrave} -%\definetextaccent ' {\buildtextaccent\textacute} -%\definetextaccent v {\buildtextaccent\textcaron} -%\definetextaccent u {\buildtextaccent\textbreve} -%\definetextaccent = {\buildtextaccent\textmacron} -%\definetextaccent ^ {\buildtextaccent\textcircumflex} -%\definetextaccent . {\buildtextaccent\textdotaccent} -%\definetextaccent H {\buildtextaccent\texthungarumlaut} -%\definetextaccent ~ {\buildtextaccent\texttilde} -%\definetextaccent " {\buildtextaccent\textdiaeresis} - \definecommand ` {\buildtextaccent\textgrave} \definecommand ' {\buildtextaccent\textacute} \definecommand r {\buildtextaccent\textring} @@ -1853,7 +1023,7 @@ {##\crcr\hbox{#5}\crcr \hidewidth \hskip#2\wd0 - \hskip-#3\fontdimen1\font % in plain 1ex * dimenless value + \hskip-#3\slantperpoint % in plain 1ex * dimenless value \vbox to .2ex{\box0\vss}\hidewidth \crcr}}} @@ -1862,11 +1032,6 @@ \def\buildtextcedilla {\bottomaccent{0ex}{0}{5}{\textcedilla}} \def\buildtextogonek {\bottomaccent{-.1ex}{.5}{0}{\textogonek}} -%\definetextaccent c {\buildtextcedilla} -%\definetextaccent b {\buildtextmacron} -%\definetextaccent d {\buildtextbottomdot} -%\definetextaccent k {\buildtextogonek} - \definecommand c {\buildtextcedilla} \definecommand b {\buildtextmacron} \definecommand d {\buildtextbottomdot} @@ -1886,7 +1051,7 @@ \hbox to \wd2 \bgroup \hss\copy2\hss \hskip-\wd2 - \hss\hskip#2\wd0\hskip-#3\fontdimen1\font\raise#1\hbox{#4}\hss + \hss\hskip#2\wd0\hskip-#3\slantperpoint\raise#1\hbox{#4}\hss \egroup \egroup} @@ -1923,32 +1088,6 @@ \def\usepdffontresource #1 {} % this will be defined elsewhere \fi -%D Some day \unknown\ - -% \def\useencodingvector #1 % file tag -% {\pushmacro\definecharacter -% \pushmacro\startencoding -% \pushmacro\stopencoding -% \def\definecharacter ##1 ##2 % -% {\doifnumberelse{##2} -% {\ifnum##2>127 -% \def\!!stringa{##2 }% -% \@EA\@EA\@EA\defineactivetoken\@EA\!!stringa\@EA{\csname##1\endcsname}% -% \fi} -% {}}% -% \def\startencoding[##1]{} -% \def\stopencoding{\endinput} -% \readfile{xxxx-#1}\donothing\donothing -% \popmacro\stopencoding -% \popmacro\startencoding -% \popmacro\definecharacter} -% -% \startregime[ec] -% \useencodingvector ec -% \stopregime - -% new, to be documented (oeps, conflicts with existing code) - \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} @@ -1994,7 +1133,40 @@ \def\dohandlecommand {\uhandlecommand}% \def\dohandlecharacter{\uhandlecharacter}} -\def\convertencodedtokens{\dontexpandencoding} +% no longer: \def\convertencodedtokens{\dontexpandencoding} but: + +\def\convertencodedtokens{\stringifyencodedtokens} + +% test case: +% +% \enableregime[cp1250] +% \mainlanguage[cz] +% +% \starttext +% +% \title{Žluouècí konì úpí} +% \placelist[chapter][criterium=all] +% +% \startbuffer +% +% Žluouècí konì úpí +% +% \stopbuffer +% +% \defineXMLenvironment +% [chapter] +% {\defineXMLsave[title]} +% {\expanded{\chapter{\XMLflush{title}}}} +% \processXMLbuffer +% +% \setuphead[chapter][expansion=yes] +% \defineXMLenvironment +% [chapter] +% {\defineXMLsave[title]} +% {\chapter{\XMLflush{title}}} +% \processXMLbuffer +% +% \stoptext %D Still valid? To be checked: diff --git a/tex/context/base/enco-mis.tex b/tex/context/base/enco-mis.tex index d3e5b7883..b04d4ab7d 100644 --- a/tex/context/base/enco-mis.tex +++ b/tex/context/base/enco-mis.tex @@ -42,7 +42,7 @@ % \dimen0=\ht0 % \advance\dimen0 1ex % \dimen0=.45\dimen0 -% \dimen2=\withoutpt\the\fontdimen1\font\dimen0 +% \dimen2=\withoutpt\the\slantperpoint\dimen0 % \advance\dimen2 .5ex % \rlap{\raise\dimen0\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.3em}}}% % \box0 @@ -53,9 +53,9 @@ % \hbox\bgroup % \setbox0\hbox{D}% % \dimen0=.55\ht0 -% \dimen2=\withoutpt\the\fontdimen1\font\dimen0 +% \dimen2=\withoutpt\the\slantperpoint\dimen0 % \advance\dimen2 .15ex -% \advance\dimen2 -.15\fontdimen7\font +% \advance\dimen2 -.15\extraspace % \rlap{\raise\dimen0\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.33em}}}% % \box0 % \egroup} @@ -66,7 +66,7 @@ \scratchdimen\ht\scratchbox \advance\scratchdimen 1ex \scratchdimen.45\scratchdimen - \dimen2=\withoutpt\the\fontdimen1\font\dimen0 + \dimen2=\withoutpt\the\slantperpoint\dimen0 \advance\dimen2 .5ex \hbox to \wd\scratchbox {\box\scratchbox\hss @@ -78,9 +78,9 @@ % \hbox\bgroup % \setbox\scratchbox\hbox{D}% % \scratchdimen.55\ht\scratchbox -% \dimen2=\withoutpt\the\fontdimen1\font\scratchdimen +% \dimen2=\withoutpt\the\slantperpoint\scratchdimen % \advance\dimen2 .15ex -% \advance\dimen2 -.15\fontdimen7\font +% \advance\dimen2 -.15\extraspace % \hbox to \wd\scratchbox % {\box\scratchbox\hss % \raise\scratchdimen\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.3em}}}% @@ -91,7 +91,7 @@ \hbox\bgroup \setbox\scratchbox\hbox{D}% \dimen2=1.1ex - \dimen2=\withoutpt\the\fontdimen1\font\dimen2 + \dimen2=\withoutpt\the\slantperpoint\dimen2 \hbox to \wd\scratchbox {\rlap {\raise.52\ht\scratchbox diff --git a/tex/context/base/enco-pfr.tex b/tex/context/base/enco-pfr.tex index a74a8c6a7..52069bfe9 100644 --- a/tex/context/base/enco-pfr.tex +++ b/tex/context/base/enco-pfr.tex @@ -139,9 +139,39 @@ % alternatively we can use object references +% fails when we switch back and forward between dvi/pdf mode +% +% \long\def\startpdffontresource[#1]#2\stoppdffontresource +% {\doif{#1}\currentencoding{\doifdefined\pdffontresource +% {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}} + \long\def\startpdffontresource[#1]#2\stoppdffontresource {\doif{#1}\currentencoding{\doifdefined\pdffontresource - {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}} + {\expanded{\doshipoutpdffontresource{\getvalue{\pdffontresource}}{#2}}}}} + +\def\doshipoutpdffontresource#1#2% + {\ifnum\realpageno<\plustwo + \doglobal\appendtoks + \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi + \to\everyfirstshipout + \else + \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi + \fi} + +% cleaner but not better: +% +% \newtoks \collectedpdffontresources +% +% \def\doshipoutpdffontresource#1#2% +% {\doglobal\appendtoks +% \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi +% \to \collectedpdffontresources} +% +% \def\dofluspdffontresources +% {\the\collectedpdffontresources +% \global\collectedpdffontresources\emptytoks} +% +% \appendtoks \dofluspdffontresources \to \everybeforeshipout %D The reference to such a vector is to be handled at font %D definition time, which is why we hook it into the font diff --git a/tex/context/base/enco-xtx.tex b/tex/context/base/enco-xtx.tex new file mode 100644 index 000000000..26fd97dfb --- /dev/null +++ b/tex/context/base/enco-xtx.tex @@ -0,0 +1,1986 @@ +% filename : enco-xtx.tex +% comment : poor man's alternative for a proper enco file +% author : Hans Hagen, PRAGMA-ADE, Hasselt NL +% copyright: PRAGMA ADE / ConTeXt Development Team +% license : see context related readme files + +\ifx\setcclcuc\undefined + + \def\setcclcuc #1 #2 #3 % + {\global\catcode"#1=11 + \global\lccode "#1="#2 + \global\uccode "#1="#3 } + +\fi + +\setcclcuc 0041 0061 0041 % LATIN CAPITAL LETTER A +\setcclcuc 0042 0062 0042 % LATIN CAPITAL LETTER B +\setcclcuc 0043 0063 0043 % LATIN CAPITAL LETTER C +\setcclcuc 0044 0064 0044 % LATIN CAPITAL LETTER D +\setcclcuc 0045 0065 0045 % LATIN CAPITAL LETTER E +\setcclcuc 0046 0066 0046 % LATIN CAPITAL LETTER F +\setcclcuc 0047 0067 0047 % LATIN CAPITAL LETTER G +\setcclcuc 0048 0068 0048 % LATIN CAPITAL LETTER H +\setcclcuc 0049 0069 0049 % LATIN CAPITAL LETTER I +\setcclcuc 004A 006A 004A % LATIN CAPITAL LETTER J +\setcclcuc 004B 006B 004B % LATIN CAPITAL LETTER K +\setcclcuc 004C 006C 004C % LATIN CAPITAL LETTER L +\setcclcuc 004D 006D 004D % LATIN CAPITAL LETTER M +\setcclcuc 004E 006E 004E % LATIN CAPITAL LETTER N +\setcclcuc 004F 006F 004F % LATIN CAPITAL LETTER O +\setcclcuc 0050 0070 0050 % LATIN CAPITAL LETTER P +\setcclcuc 0051 0071 0051 % LATIN CAPITAL LETTER Q +\setcclcuc 0052 0072 0052 % LATIN CAPITAL LETTER R +\setcclcuc 0053 0073 0053 % LATIN CAPITAL LETTER S +\setcclcuc 0054 0074 0054 % LATIN CAPITAL LETTER T +\setcclcuc 0055 0075 0055 % LATIN CAPITAL LETTER U +\setcclcuc 0056 0076 0056 % LATIN CAPITAL LETTER V +\setcclcuc 0057 0077 0057 % LATIN CAPITAL LETTER W +\setcclcuc 0058 0078 0058 % LATIN CAPITAL LETTER X +\setcclcuc 0059 0079 0059 % LATIN CAPITAL LETTER Y +\setcclcuc 005A 007A 005A % LATIN CAPITAL LETTER Z +\setcclcuc 0061 0061 0041 % LATIN SMALL LETTER A +\setcclcuc 0062 0062 0042 % LATIN SMALL LETTER B +\setcclcuc 0063 0063 0043 % LATIN SMALL LETTER C +\setcclcuc 0064 0064 0044 % LATIN SMALL LETTER D +\setcclcuc 0065 0065 0045 % LATIN SMALL LETTER E +\setcclcuc 0066 0066 0046 % LATIN SMALL LETTER F +\setcclcuc 0067 0067 0047 % LATIN SMALL LETTER G +\setcclcuc 0068 0068 0048 % LATIN SMALL LETTER H +\setcclcuc 0069 0069 0049 % LATIN SMALL LETTER I +\setcclcuc 006A 006A 004A % LATIN SMALL LETTER J +\setcclcuc 006B 006B 004B % LATIN SMALL LETTER K +\setcclcuc 006C 006C 004C % LATIN SMALL LETTER L +\setcclcuc 006D 006D 004D % LATIN SMALL LETTER M +\setcclcuc 006E 006E 004E % LATIN SMALL LETTER N +\setcclcuc 006F 006F 004F % LATIN SMALL LETTER O +\setcclcuc 0070 0070 0050 % LATIN SMALL LETTER P +\setcclcuc 0071 0071 0051 % LATIN SMALL LETTER Q +\setcclcuc 0072 0072 0052 % LATIN SMALL LETTER R +\setcclcuc 0073 0073 0053 % LATIN SMALL LETTER S +\setcclcuc 0074 0074 0054 % LATIN SMALL LETTER T +\setcclcuc 0075 0075 0055 % LATIN SMALL LETTER U +\setcclcuc 0076 0076 0056 % LATIN SMALL LETTER V +\setcclcuc 0077 0077 0057 % LATIN SMALL LETTER W +\setcclcuc 0078 0078 0058 % LATIN SMALL LETTER X +\setcclcuc 0079 0079 0059 % LATIN SMALL LETTER Y +\setcclcuc 007A 007A 005A % LATIN SMALL LETTER Z +\setcclcuc 00AA 00AA 00AA % FEMININE ORDINAL INDICATOR +\setcclcuc 00B5 00B5 039C % MICRO SIGN +\setcclcuc 00BA 00BA 00BA % MASCULINE ORDINAL INDICATOR +\setcclcuc 00C0 00E0 00C0 % LATIN CAPITAL LETTER A WITH GRAVE +\setcclcuc 00C1 00E1 00C1 % LATIN CAPITAL LETTER A WITH ACUTE +\setcclcuc 00C2 00E2 00C2 % LATIN CAPITAL LETTER A WITH CIRCUMFLEX +\setcclcuc 00C3 00E3 00C3 % LATIN CAPITAL LETTER A WITH TILDE +\setcclcuc 00C4 00E4 00C4 % LATIN CAPITAL LETTER A WITH DIAERESIS +\setcclcuc 00C5 00E5 00C5 % LATIN CAPITAL LETTER A WITH RING ABOVE +\setcclcuc 00C6 00E6 00C6 % LATIN CAPITAL LETTER AE +\setcclcuc 00C7 00E7 00C7 % LATIN CAPITAL LETTER C WITH CEDILLA +\setcclcuc 00C8 00E8 00C8 % LATIN CAPITAL LETTER E WITH GRAVE +\setcclcuc 00C9 00E9 00C9 % LATIN CAPITAL LETTER E WITH ACUTE +\setcclcuc 00CA 00EA 00CA % LATIN CAPITAL LETTER E WITH CIRCUMFLEX +\setcclcuc 00CB 00EB 00CB % LATIN CAPITAL LETTER E WITH DIAERESIS +\setcclcuc 00CC 00EC 00CC % LATIN CAPITAL LETTER I WITH GRAVE +\setcclcuc 00CD 00ED 00CD % LATIN CAPITAL LETTER I WITH ACUTE +\setcclcuc 00CE 00EE 00CE % LATIN CAPITAL LETTER I WITH CIRCUMFLEX +\setcclcuc 00CF 00EF 00CF % LATIN CAPITAL LETTER I WITH DIAERESIS +\setcclcuc 00D0 00F0 00D0 % LATIN CAPITAL LETTER ETH +\setcclcuc 00D1 00F1 00D1 % LATIN CAPITAL LETTER N WITH TILDE +\setcclcuc 00D2 00F2 00D2 % LATIN CAPITAL LETTER O WITH GRAVE +\setcclcuc 00D3 00F3 00D3 % LATIN CAPITAL LETTER O WITH ACUTE +\setcclcuc 00D4 00F4 00D4 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX +\setcclcuc 00D5 00F5 00D5 % LATIN CAPITAL LETTER O WITH TILDE +\setcclcuc 00D6 00F6 00D6 % LATIN CAPITAL LETTER O WITH DIAERESIS +\setcclcuc 00D8 00F8 00D8 % LATIN CAPITAL LETTER O WITH STROKE +\setcclcuc 00D9 00F9 00D9 % LATIN CAPITAL LETTER U WITH GRAVE +\setcclcuc 00DA 00FA 00DA % LATIN CAPITAL LETTER U WITH ACUTE +\setcclcuc 00DB 00FB 00DB % LATIN CAPITAL LETTER U WITH CIRCUMFLEX +\setcclcuc 00DC 00FC 00DC % LATIN CAPITAL LETTER U WITH DIAERESIS +\setcclcuc 00DD 00FD 00DD % LATIN CAPITAL LETTER Y WITH ACUTE +\setcclcuc 00DE 00FE 00DE % LATIN CAPITAL LETTER THORN +\setcclcuc 00DF 00DF 00DF % LATIN SMALL LETTER SHARP S +\setcclcuc 00E0 00E0 00C0 % LATIN SMALL LETTER A WITH GRAVE +\setcclcuc 00E1 00E1 00C1 % LATIN SMALL LETTER A WITH ACUTE +\setcclcuc 00E2 00E2 00C2 % LATIN SMALL LETTER A WITH CIRCUMFLEX +\setcclcuc 00E3 00E3 00C3 % LATIN SMALL LETTER A WITH TILDE +\setcclcuc 00E4 00E4 00C4 % LATIN SMALL LETTER A WITH DIAERESIS +\setcclcuc 00E5 00E5 00C5 % LATIN SMALL LETTER A WITH RING ABOVE +\setcclcuc 00E6 00E6 00C6 % LATIN SMALL LETTER AE +\setcclcuc 00E7 00E7 00C7 % LATIN SMALL LETTER C WITH CEDILLA +\setcclcuc 00E8 00E8 00C8 % LATIN SMALL LETTER E WITH GRAVE +\setcclcuc 00E9 00E9 00C9 % LATIN SMALL LETTER E WITH ACUTE +\setcclcuc 00EA 00EA 00CA % LATIN SMALL LETTER E WITH CIRCUMFLEX +\setcclcuc 00EB 00EB 00CB % LATIN SMALL LETTER E WITH DIAERESIS +\setcclcuc 00EC 00EC 00CC % LATIN SMALL LETTER I WITH GRAVE +\setcclcuc 00ED 00ED 00CD % LATIN SMALL LETTER I WITH ACUTE +\setcclcuc 00EE 00EE 00CE % LATIN SMALL LETTER I WITH CIRCUMFLEX +\setcclcuc 00EF 00EF 00CF % LATIN SMALL LETTER I WITH DIAERESIS +\setcclcuc 00F0 00F0 00D0 % LATIN SMALL LETTER ETH +\setcclcuc 00F1 00F1 00D1 % LATIN SMALL LETTER N WITH TILDE +\setcclcuc 00F2 00F2 00D2 % LATIN SMALL LETTER O WITH GRAVE +\setcclcuc 00F3 00F3 00D3 % LATIN SMALL LETTER O WITH ACUTE +\setcclcuc 00F4 00F4 00D4 % LATIN SMALL LETTER O WITH CIRCUMFLEX +\setcclcuc 00F5 00F5 00D5 % LATIN SMALL LETTER O WITH TILDE +\setcclcuc 00F6 00F6 00D6 % LATIN SMALL LETTER O WITH DIAERESIS +\setcclcuc 00F8 00F8 00D8 % LATIN SMALL LETTER O WITH STROKE +\setcclcuc 00F9 00F9 00D9 % LATIN SMALL LETTER U WITH GRAVE +\setcclcuc 00FA 00FA 00DA % LATIN SMALL LETTER U WITH ACUTE +\setcclcuc 00FB 00FB 00DB % LATIN SMALL LETTER U WITH CIRCUMFLEX +\setcclcuc 00FC 00FC 00DC % LATIN SMALL LETTER U WITH DIAERESIS +\setcclcuc 00FD 00FD 00DD % LATIN SMALL LETTER Y WITH ACUTE +\setcclcuc 00FE 00FE 00DE % LATIN SMALL LETTER THORN +\setcclcuc 00FF 00FF 0178 % LATIN SMALL LETTER Y WITH DIAERESIS +\setcclcuc 0100 0101 0100 % LATIN CAPITAL LETTER A WITH MACRON +\setcclcuc 0101 0101 0100 % LATIN SMALL LETTER A WITH MACRON +\setcclcuc 0102 0103 0102 % LATIN CAPITAL LETTER A WITH BREVE +\setcclcuc 0103 0103 0102 % LATIN SMALL LETTER A WITH BREVE +\setcclcuc 0104 0105 0104 % LATIN CAPITAL LETTER A WITH OGONEK +\setcclcuc 0105 0105 0104 % LATIN SMALL LETTER A WITH OGONEK +\setcclcuc 0106 0107 0106 % LATIN CAPITAL LETTER C WITH ACUTE +\setcclcuc 0107 0107 0106 % LATIN SMALL LETTER C WITH ACUTE +\setcclcuc 0108 0109 0108 % LATIN CAPITAL LETTER C WITH CIRCUMFLEX +\setcclcuc 0109 0109 0108 % LATIN SMALL LETTER C WITH CIRCUMFLEX +\setcclcuc 010A 010B 010A % LATIN CAPITAL LETTER C WITH DOT ABOVE +\setcclcuc 010B 010B 010A % LATIN SMALL LETTER C WITH DOT ABOVE +\setcclcuc 010C 010D 010C % LATIN CAPITAL LETTER C WITH CARON +\setcclcuc 010D 010D 010C % LATIN SMALL LETTER C WITH CARON +\setcclcuc 010E 010F 010E % LATIN CAPITAL LETTER D WITH CARON +\setcclcuc 010F 010F 010E % LATIN SMALL LETTER D WITH CARON +\setcclcuc 0110 0111 0110 % LATIN CAPITAL LETTER D WITH STROKE +\setcclcuc 0111 0111 0110 % LATIN SMALL LETTER D WITH STROKE +\setcclcuc 0112 0113 0112 % LATIN CAPITAL LETTER E WITH MACRON +\setcclcuc 0113 0113 0112 % LATIN SMALL LETTER E WITH MACRON +\setcclcuc 0114 0115 0114 % LATIN CAPITAL LETTER E WITH BREVE +\setcclcuc 0115 0115 0114 % LATIN SMALL LETTER E WITH BREVE +\setcclcuc 0116 0117 0116 % LATIN CAPITAL LETTER E WITH DOT ABOVE +\setcclcuc 0117 0117 0116 % LATIN SMALL LETTER E WITH DOT ABOVE +\setcclcuc 0118 0119 0118 % LATIN CAPITAL LETTER E WITH OGONEK +\setcclcuc 0119 0119 0118 % LATIN SMALL LETTER E WITH OGONEK +\setcclcuc 011A 011B 011A % LATIN CAPITAL LETTER E WITH CARON +\setcclcuc 011B 011B 011A % LATIN SMALL LETTER E WITH CARON +\setcclcuc 011C 011D 011C % LATIN CAPITAL LETTER G WITH CIRCUMFLEX +\setcclcuc 011D 011D 011C % LATIN SMALL LETTER G WITH CIRCUMFLEX +\setcclcuc 011E 011F 011E % LATIN CAPITAL LETTER G WITH BREVE +\setcclcuc 011F 011F 011E % LATIN SMALL LETTER G WITH BREVE +\setcclcuc 0120 0121 0120 % LATIN CAPITAL LETTER G WITH DOT ABOVE +\setcclcuc 0121 0121 0120 % LATIN SMALL LETTER G WITH DOT ABOVE +\setcclcuc 0122 0123 0122 % LATIN CAPITAL LETTER G WITH CEDILLA +\setcclcuc 0123 0123 0122 % LATIN SMALL LETTER G WITH CEDILLA +\setcclcuc 0124 0125 0124 % LATIN CAPITAL LETTER H WITH CIRCUMFLEX +\setcclcuc 0125 0125 0124 % LATIN SMALL LETTER H WITH CIRCUMFLEX +\setcclcuc 0126 0127 0126 % LATIN CAPITAL LETTER H WITH STROKE +\setcclcuc 0127 0127 0126 % LATIN SMALL LETTER H WITH STROKE +\setcclcuc 0128 0129 0128 % LATIN CAPITAL LETTER I WITH TILDE +\setcclcuc 0129 0129 0128 % LATIN SMALL LETTER I WITH TILDE +\setcclcuc 012A 012B 012A % LATIN CAPITAL LETTER I WITH MACRON +\setcclcuc 012B 012B 012A % LATIN SMALL LETTER I WITH MACRON +\setcclcuc 012C 012D 012C % LATIN CAPITAL LETTER I WITH BREVE +\setcclcuc 012D 012D 012C % LATIN SMALL LETTER I WITH BREVE +\setcclcuc 012E 012F 012E % LATIN CAPITAL LETTER I WITH OGONEK +\setcclcuc 012F 012F 012E % LATIN SMALL LETTER I WITH OGONEK +\setcclcuc 0130 0069 0130 % LATIN CAPITAL LETTER I WITH DOT ABOVE +\setcclcuc 0131 0131 0049 % LATIN SMALL LETTER DOTLESS I +\setcclcuc 0132 0133 0132 % LATIN CAPITAL LIGATURE IJ +\setcclcuc 0133 0133 0132 % LATIN SMALL LIGATURE IJ +\setcclcuc 0134 0135 0134 % LATIN CAPITAL LETTER J WITH CIRCUMFLEX +\setcclcuc 0135 0135 0134 % LATIN SMALL LETTER J WITH CIRCUMFLEX +\setcclcuc 0136 0137 0136 % LATIN CAPITAL LETTER K WITH CEDILLA +\setcclcuc 0137 0137 0136 % LATIN SMALL LETTER K WITH CEDILLA +\setcclcuc 0138 0138 0138 % LATIN SMALL LETTER KRA +\setcclcuc 0139 013A 0139 % LATIN CAPITAL LETTER L WITH ACUTE +\setcclcuc 013A 013A 0139 % LATIN SMALL LETTER L WITH ACUTE +\setcclcuc 013B 013C 013B % LATIN CAPITAL LETTER L WITH CEDILLA +\setcclcuc 013C 013C 013B % LATIN SMALL LETTER L WITH CEDILLA +\setcclcuc 013D 013E 013D % LATIN CAPITAL LETTER L WITH CARON +\setcclcuc 013E 013E 013D % LATIN SMALL LETTER L WITH CARON +\setcclcuc 013F 0140 013F % LATIN CAPITAL LETTER L WITH MIDDLE DOT +\setcclcuc 0140 0140 013F % LATIN SMALL LETTER L WITH MIDDLE DOT +\setcclcuc 0141 0142 0141 % LATIN CAPITAL LETTER L WITH STROKE +\setcclcuc 0142 0142 0141 % LATIN SMALL LETTER L WITH STROKE +\setcclcuc 0143 0144 0143 % LATIN CAPITAL LETTER N WITH ACUTE +\setcclcuc 0144 0144 0143 % LATIN SMALL LETTER N WITH ACUTE +\setcclcuc 0145 0146 0145 % LATIN CAPITAL LETTER N WITH CEDILLA +\setcclcuc 0146 0146 0145 % LATIN SMALL LETTER N WITH CEDILLA +\setcclcuc 0147 0148 0147 % LATIN CAPITAL LETTER N WITH CARON +\setcclcuc 0148 0148 0147 % LATIN SMALL LETTER N WITH CARON +\setcclcuc 0149 0149 0149 % LATIN SMALL LETTER N PRECEDED BY APOSTROPHE +\setcclcuc 014A 014B 014A % LATIN CAPITAL LETTER ENG +\setcclcuc 014B 014B 014A % LATIN SMALL LETTER ENG +\setcclcuc 014C 014D 014C % LATIN CAPITAL LETTER O WITH MACRON +\setcclcuc 014D 014D 014C % LATIN SMALL LETTER O WITH MACRON +\setcclcuc 014E 014F 014E % LATIN CAPITAL LETTER O WITH BREVE +\setcclcuc 014F 014F 014E % LATIN SMALL LETTER O WITH BREVE +\setcclcuc 0150 0151 0150 % LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +\setcclcuc 0151 0151 0150 % LATIN SMALL LETTER O WITH DOUBLE ACUTE +\setcclcuc 0152 0153 0152 % LATIN CAPITAL LIGATURE OE +\setcclcuc 0153 0153 0152 % LATIN SMALL LIGATURE OE +\setcclcuc 0154 0155 0154 % LATIN CAPITAL LETTER R WITH ACUTE +\setcclcuc 0155 0155 0154 % LATIN SMALL LETTER R WITH ACUTE +\setcclcuc 0156 0157 0156 % LATIN CAPITAL LETTER R WITH CEDILLA +\setcclcuc 0157 0157 0156 % LATIN SMALL LETTER R WITH CEDILLA +\setcclcuc 0158 0159 0158 % LATIN CAPITAL LETTER R WITH CARON +\setcclcuc 0159 0159 0158 % LATIN SMALL LETTER R WITH CARON +\setcclcuc 015A 015B 015A % LATIN CAPITAL LETTER S WITH ACUTE +\setcclcuc 015B 015B 015A % LATIN SMALL LETTER S WITH ACUTE +\setcclcuc 015C 015D 015C % LATIN CAPITAL LETTER S WITH CIRCUMFLEX +\setcclcuc 015D 015D 015C % LATIN SMALL LETTER S WITH CIRCUMFLEX +\setcclcuc 015E 015F 015E % LATIN CAPITAL LETTER S WITH CEDILLA +\setcclcuc 015F 015F 015E % LATIN SMALL LETTER S WITH CEDILLA +\setcclcuc 0160 0161 0160 % LATIN CAPITAL LETTER S WITH CARON +\setcclcuc 0161 0161 0160 % LATIN SMALL LETTER S WITH CARON +\setcclcuc 0162 0163 0162 % LATIN CAPITAL LETTER T WITH CEDILLA +\setcclcuc 0163 0163 0162 % LATIN SMALL LETTER T WITH CEDILLA +\setcclcuc 0164 0165 0164 % LATIN CAPITAL LETTER T WITH CARON +\setcclcuc 0165 0165 0164 % LATIN SMALL LETTER T WITH CARON +\setcclcuc 0166 0167 0166 % LATIN CAPITAL LETTER T WITH STROKE +\setcclcuc 0167 0167 0166 % LATIN SMALL LETTER T WITH STROKE +\setcclcuc 0168 0169 0168 % LATIN CAPITAL LETTER U WITH TILDE +\setcclcuc 0169 0169 0168 % LATIN SMALL LETTER U WITH TILDE +\setcclcuc 016A 016B 016A % LATIN CAPITAL LETTER U WITH MACRON +\setcclcuc 016B 016B 016A % LATIN SMALL LETTER U WITH MACRON +\setcclcuc 016C 016D 016C % LATIN CAPITAL LETTER U WITH BREVE +\setcclcuc 016D 016D 016C % LATIN SMALL LETTER U WITH BREVE +\setcclcuc 016E 016F 016E % LATIN CAPITAL LETTER U WITH RING ABOVE +\setcclcuc 016F 016F 016E % LATIN SMALL LETTER U WITH RING ABOVE +\setcclcuc 0170 0171 0170 % LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +\setcclcuc 0171 0171 0170 % LATIN SMALL LETTER U WITH DOUBLE ACUTE +\setcclcuc 0172 0173 0172 % LATIN CAPITAL LETTER U WITH OGONEK +\setcclcuc 0173 0173 0172 % LATIN SMALL LETTER U WITH OGONEK +\setcclcuc 0174 0175 0174 % LATIN CAPITAL LETTER W WITH CIRCUMFLEX +\setcclcuc 0175 0175 0174 % LATIN SMALL LETTER W WITH CIRCUMFLEX +\setcclcuc 0176 0177 0176 % LATIN CAPITAL LETTER Y WITH CIRCUMFLEX +\setcclcuc 0177 0177 0176 % LATIN SMALL LETTER Y WITH CIRCUMFLEX +\setcclcuc 0178 00FF 0178 % LATIN CAPITAL LETTER Y WITH DIAERESIS +\setcclcuc 0179 017A 0179 % LATIN CAPITAL LETTER Z WITH ACUTE +\setcclcuc 017A 017A 0179 % LATIN SMALL LETTER Z WITH ACUTE +\setcclcuc 017B 017C 017B % LATIN CAPITAL LETTER Z WITH DOT ABOVE +\setcclcuc 017C 017C 017B % LATIN SMALL LETTER Z WITH DOT ABOVE +\setcclcuc 017D 017E 017D % LATIN CAPITAL LETTER Z WITH CARON +\setcclcuc 017E 017E 017D % LATIN SMALL LETTER Z WITH CARON +\setcclcuc 017F 017F 0053 % LATIN SMALL LETTER LONG S +\setcclcuc 0180 0180 0243 % LATIN SMALL LETTER B WITH STROKE +\setcclcuc 0181 0253 0181 % LATIN CAPITAL LETTER B WITH HOOK +\setcclcuc 0182 0183 0182 % LATIN CAPITAL LETTER B WITH TOPBAR +\setcclcuc 0183 0183 0182 % LATIN SMALL LETTER B WITH TOPBAR +\setcclcuc 0184 0185 0184 % LATIN CAPITAL LETTER TONE SIX +\setcclcuc 0185 0185 0184 % LATIN SMALL LETTER TONE SIX +\setcclcuc 0186 0254 0186 % LATIN CAPITAL LETTER OPEN O +\setcclcuc 0187 0188 0187 % LATIN CAPITAL LETTER C WITH HOOK +\setcclcuc 0188 0188 0187 % LATIN SMALL LETTER C WITH HOOK +\setcclcuc 0189 0256 0189 % LATIN CAPITAL LETTER AFRICAN D +\setcclcuc 018A 0257 018A % LATIN CAPITAL LETTER D WITH HOOK +\setcclcuc 018B 018C 018B % LATIN CAPITAL LETTER D WITH TOPBAR +\setcclcuc 018C 018C 018B % LATIN SMALL LETTER D WITH TOPBAR +\setcclcuc 018D 018D 018D % LATIN SMALL LETTER TURNED DELTA +\setcclcuc 018E 01DD 018E % LATIN CAPITAL LETTER REVERSED E +\setcclcuc 018F 0259 018F % LATIN CAPITAL LETTER SCHWA +\setcclcuc 0190 025B 0190 % LATIN CAPITAL LETTER OPEN E +\setcclcuc 0191 0192 0191 % LATIN CAPITAL LETTER F WITH HOOK +\setcclcuc 0192 0192 0191 % LATIN SMALL LETTER F WITH HOOK +\setcclcuc 0193 0260 0193 % LATIN CAPITAL LETTER G WITH HOOK +\setcclcuc 0194 0263 0194 % LATIN CAPITAL LETTER GAMMA +\setcclcuc 0195 0195 01F6 % LATIN SMALL LETTER HV +\setcclcuc 0196 0269 0196 % LATIN CAPITAL LETTER IOTA +\setcclcuc 0197 0268 0197 % LATIN CAPITAL LETTER I WITH STROKE +\setcclcuc 0198 0199 0198 % LATIN CAPITAL LETTER K WITH HOOK +\setcclcuc 0199 0199 0198 % LATIN SMALL LETTER K WITH HOOK +\setcclcuc 019A 019A 023D % LATIN SMALL LETTER L WITH BAR +\setcclcuc 019B 019B 019B % LATIN SMALL LETTER LAMBDA WITH STROKE +\setcclcuc 019C 026F 019C % LATIN CAPITAL LETTER TURNED M +\setcclcuc 019D 0272 019D % LATIN CAPITAL LETTER N WITH LEFT HOOK +\setcclcuc 019E 019E 0220 % LATIN SMALL LETTER N WITH LONG RIGHT LEG +\setcclcuc 019F 0275 019F % LATIN CAPITAL LETTER O WITH MIDDLE TILDE +\setcclcuc 01A0 01A1 01A0 % LATIN CAPITAL LETTER O WITH HORN +\setcclcuc 01A1 01A1 01A0 % LATIN SMALL LETTER O WITH HORN +\setcclcuc 01A2 01A3 01A2 % LATIN CAPITAL LETTER OI +\setcclcuc 01A3 01A3 01A2 % LATIN SMALL LETTER OI +\setcclcuc 01A4 01A5 01A4 % LATIN CAPITAL LETTER P WITH HOOK +\setcclcuc 01A5 01A5 01A4 % LATIN SMALL LETTER P WITH HOOK +\setcclcuc 01A6 0280 01A6 % LATIN LETTER YR +\setcclcuc 01A7 01A8 01A7 % LATIN CAPITAL LETTER TONE TWO +\setcclcuc 01A8 01A8 01A7 % LATIN SMALL LETTER TONE TWO +\setcclcuc 01A9 0283 01A9 % LATIN CAPITAL LETTER ESH +\setcclcuc 01AA 01AA 01AA % LATIN LETTER REVERSED ESH LOOP +\setcclcuc 01AB 01AB 01AB % LATIN SMALL LETTER T WITH PALATAL HOOK +\setcclcuc 01AC 01AD 01AC % LATIN CAPITAL LETTER T WITH HOOK +\setcclcuc 01AD 01AD 01AC % LATIN SMALL LETTER T WITH HOOK +\setcclcuc 01AE 0288 01AE % LATIN CAPITAL LETTER T WITH RETROFLEX HOOK +\setcclcuc 01AF 01B0 01AF % LATIN CAPITAL LETTER U WITH HORN +\setcclcuc 01B0 01B0 01AF % LATIN SMALL LETTER U WITH HORN +\setcclcuc 01B1 028A 01B1 % LATIN CAPITAL LETTER UPSILON +\setcclcuc 01B2 028B 01B2 % LATIN CAPITAL LETTER V WITH HOOK +\setcclcuc 01B3 01B4 01B3 % LATIN CAPITAL LETTER Y WITH HOOK +\setcclcuc 01B4 01B4 01B3 % LATIN SMALL LETTER Y WITH HOOK +\setcclcuc 01B5 01B6 01B5 % LATIN CAPITAL LETTER Z WITH STROKE +\setcclcuc 01B6 01B6 01B5 % LATIN SMALL LETTER Z WITH STROKE +\setcclcuc 01B7 0292 01B7 % LATIN CAPITAL LETTER EZH +\setcclcuc 01B8 01B9 01B8 % LATIN CAPITAL LETTER EZH REVERSED +\setcclcuc 01B9 01B9 01B8 % LATIN SMALL LETTER EZH REVERSED +\setcclcuc 01BA 01BA 01BA % LATIN SMALL LETTER EZH WITH TAIL +\setcclcuc 01BC 01BD 01BC % LATIN CAPITAL LETTER TONE FIVE +\setcclcuc 01BD 01BD 01BC % LATIN SMALL LETTER TONE FIVE +\setcclcuc 01BE 01BE 01BE % LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE +\setcclcuc 01BF 01BF 01F7 % LATIN LETTER WYNN +\setcclcuc 01C4 01C6 01C5 % LATIN CAPITAL LETTER DZ WITH CARON +\setcclcuc 01C5 01C6 01C4 % LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON +\setcclcuc 01C6 01C6 01C4 % LATIN SMALL LETTER DZ WITH CARON +\setcclcuc 01C7 01C9 01C8 % LATIN CAPITAL LETTER LJ +\setcclcuc 01C8 01C9 01C7 % LATIN CAPITAL LETTER L WITH SMALL LETTER J +\setcclcuc 01C9 01C9 01C7 % LATIN SMALL LETTER LJ +\setcclcuc 01CA 01CC 01CB % LATIN CAPITAL LETTER NJ +\setcclcuc 01CB 01CC 01CA % LATIN CAPITAL LETTER N WITH SMALL LETTER J +\setcclcuc 01CC 01CC 01CA % LATIN SMALL LETTER NJ +\setcclcuc 01CD 01CE 01CD % LATIN CAPITAL LETTER A WITH CARON +\setcclcuc 01CE 01CE 01CD % LATIN SMALL LETTER A WITH CARON +\setcclcuc 01CF 01D0 01CF % LATIN CAPITAL LETTER I WITH CARON +\setcclcuc 01D0 01D0 01CF % LATIN SMALL LETTER I WITH CARON +\setcclcuc 01D1 01D2 01D1 % LATIN CAPITAL LETTER O WITH CARON +\setcclcuc 01D2 01D2 01D1 % LATIN SMALL LETTER O WITH CARON +\setcclcuc 01D3 01D4 01D3 % LATIN CAPITAL LETTER U WITH CARON +\setcclcuc 01D4 01D4 01D3 % LATIN SMALL LETTER U WITH CARON +\setcclcuc 01D5 01D6 01D5 % LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON +\setcclcuc 01D6 01D6 01D5 % LATIN SMALL LETTER U WITH DIAERESIS AND MACRON +\setcclcuc 01D7 01D8 01D7 % LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE +\setcclcuc 01D8 01D8 01D7 % LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE +\setcclcuc 01D9 01DA 01D9 % LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON +\setcclcuc 01DA 01DA 01D9 % LATIN SMALL LETTER U WITH DIAERESIS AND CARON +\setcclcuc 01DB 01DC 01DB % LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE +\setcclcuc 01DC 01DC 01DB % LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE +\setcclcuc 01DD 01DD 018E % LATIN SMALL LETTER TURNED E +\setcclcuc 01DE 01DF 01DE % LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON +\setcclcuc 01DF 01DF 01DE % LATIN SMALL LETTER A WITH DIAERESIS AND MACRON +\setcclcuc 01E0 01E1 01E0 % LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON +\setcclcuc 01E1 01E1 01E0 % LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON +\setcclcuc 01E2 01E3 01E2 % LATIN CAPITAL LETTER AE WITH MACRON +\setcclcuc 01E3 01E3 01E2 % LATIN SMALL LETTER AE WITH MACRON +\setcclcuc 01E4 01E5 01E4 % LATIN CAPITAL LETTER G WITH STROKE +\setcclcuc 01E5 01E5 01E4 % LATIN SMALL LETTER G WITH STROKE +\setcclcuc 01E6 01E7 01E6 % LATIN CAPITAL LETTER G WITH CARON +\setcclcuc 01E7 01E7 01E6 % LATIN SMALL LETTER G WITH CARON +\setcclcuc 01E8 01E9 01E8 % LATIN CAPITAL LETTER K WITH CARON +\setcclcuc 01E9 01E9 01E8 % LATIN SMALL LETTER K WITH CARON +\setcclcuc 01EA 01EB 01EA % LATIN CAPITAL LETTER O WITH OGONEK +\setcclcuc 01EB 01EB 01EA % LATIN SMALL LETTER O WITH OGONEK +\setcclcuc 01EC 01ED 01EC % LATIN CAPITAL LETTER O WITH OGONEK AND MACRON +\setcclcuc 01ED 01ED 01EC % LATIN SMALL LETTER O WITH OGONEK AND MACRON +\setcclcuc 01EE 01EF 01EE % LATIN CAPITAL LETTER EZH WITH CARON +\setcclcuc 01EF 01EF 01EE % LATIN SMALL LETTER EZH WITH CARON +\setcclcuc 01F0 01F0 01F0 % LATIN SMALL LETTER J WITH CARON +\setcclcuc 01F1 01F3 01F2 % LATIN CAPITAL LETTER DZ +\setcclcuc 01F2 01F3 01F1 % LATIN CAPITAL LETTER D WITH SMALL LETTER Z +\setcclcuc 01F3 01F3 01F1 % LATIN SMALL LETTER DZ +\setcclcuc 01F4 01F5 01F4 % LATIN CAPITAL LETTER G WITH ACUTE +\setcclcuc 01F5 01F5 01F4 % LATIN SMALL LETTER G WITH ACUTE +\setcclcuc 01F6 0195 01F6 % LATIN CAPITAL LETTER HWAIR +\setcclcuc 01F7 01BF 01F7 % LATIN CAPITAL LETTER WYNN +\setcclcuc 01F8 01F9 01F8 % LATIN CAPITAL LETTER N WITH GRAVE +\setcclcuc 01F9 01F9 01F8 % LATIN SMALL LETTER N WITH GRAVE +\setcclcuc 01FA 01FB 01FA % LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE +\setcclcuc 01FB 01FB 01FA % LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE +\setcclcuc 01FC 01FD 01FC % LATIN CAPITAL LETTER AE WITH ACUTE +\setcclcuc 01FD 01FD 01FC % LATIN SMALL LETTER AE WITH ACUTE +\setcclcuc 01FE 01FF 01FE % LATIN CAPITAL LETTER O WITH STROKE AND ACUTE +\setcclcuc 01FF 01FF 01FE % LATIN SMALL LETTER O WITH STROKE AND ACUTE +\setcclcuc 0200 0201 0200 % LATIN CAPITAL LETTER A WITH DOUBLE GRAVE +\setcclcuc 0201 0201 0200 % LATIN SMALL LETTER A WITH DOUBLE GRAVE +\setcclcuc 0202 0203 0202 % LATIN CAPITAL LETTER A WITH INVERTED BREVE +\setcclcuc 0203 0203 0202 % LATIN SMALL LETTER A WITH INVERTED BREVE +\setcclcuc 0204 0205 0204 % LATIN CAPITAL LETTER E WITH DOUBLE GRAVE +\setcclcuc 0205 0205 0204 % LATIN SMALL LETTER E WITH DOUBLE GRAVE +\setcclcuc 0206 0207 0206 % LATIN CAPITAL LETTER E WITH INVERTED BREVE +\setcclcuc 0207 0207 0206 % LATIN SMALL LETTER E WITH INVERTED BREVE +\setcclcuc 0208 0209 0208 % LATIN CAPITAL LETTER I WITH DOUBLE GRAVE +\setcclcuc 0209 0209 0208 % LATIN SMALL LETTER I WITH DOUBLE GRAVE +\setcclcuc 020A 020B 020A % LATIN CAPITAL LETTER I WITH INVERTED BREVE +\setcclcuc 020B 020B 020A % LATIN SMALL LETTER I WITH INVERTED BREVE +\setcclcuc 020C 020D 020C % LATIN CAPITAL LETTER O WITH DOUBLE GRAVE +\setcclcuc 020D 020D 020C % LATIN SMALL LETTER O WITH DOUBLE GRAVE +\setcclcuc 020E 020F 020E % LATIN CAPITAL LETTER O WITH INVERTED BREVE +\setcclcuc 020F 020F 020E % LATIN SMALL LETTER O WITH INVERTED BREVE +\setcclcuc 0210 0211 0210 % LATIN CAPITAL LETTER R WITH DOUBLE GRAVE +\setcclcuc 0211 0211 0210 % LATIN SMALL LETTER R WITH DOUBLE GRAVE +\setcclcuc 0212 0213 0212 % LATIN CAPITAL LETTER R WITH INVERTED BREVE +\setcclcuc 0213 0213 0212 % LATIN SMALL LETTER R WITH INVERTED BREVE +\setcclcuc 0214 0215 0214 % LATIN CAPITAL LETTER U WITH DOUBLE GRAVE +\setcclcuc 0215 0215 0214 % LATIN SMALL LETTER U WITH DOUBLE GRAVE +\setcclcuc 0216 0217 0216 % LATIN CAPITAL LETTER U WITH INVERTED BREVE +\setcclcuc 0217 0217 0216 % LATIN SMALL LETTER U WITH INVERTED BREVE +\setcclcuc 0218 0219 0218 % LATIN CAPITAL LETTER S WITH COMMA BELOW +\setcclcuc 0219 0219 0218 % LATIN SMALL LETTER S WITH COMMA BELOW +\setcclcuc 021A 021B 021A % LATIN CAPITAL LETTER T WITH COMMA BELOW +\setcclcuc 021B 021B 021A % LATIN SMALL LETTER T WITH COMMA BELOW +\setcclcuc 021C 021D 021C % LATIN CAPITAL LETTER YOGH +\setcclcuc 021D 021D 021C % LATIN SMALL LETTER YOGH +\setcclcuc 021E 021F 021E % LATIN CAPITAL LETTER H WITH CARON +\setcclcuc 021F 021F 021E % LATIN SMALL LETTER H WITH CARON +\setcclcuc 0220 019E 0220 % LATIN CAPITAL LETTER N WITH LONG RIGHT LEG +\setcclcuc 0221 0221 0221 % LATIN SMALL LETTER D WITH CURL +\setcclcuc 0222 0223 0222 % LATIN CAPITAL LETTER OU +\setcclcuc 0223 0223 0222 % LATIN SMALL LETTER OU +\setcclcuc 0224 0225 0224 % LATIN CAPITAL LETTER Z WITH HOOK +\setcclcuc 0225 0225 0224 % LATIN SMALL LETTER Z WITH HOOK +\setcclcuc 0226 0227 0226 % LATIN CAPITAL LETTER A WITH DOT ABOVE +\setcclcuc 0227 0227 0226 % LATIN SMALL LETTER A WITH DOT ABOVE +\setcclcuc 0228 0229 0228 % LATIN CAPITAL LETTER E WITH CEDILLA +\setcclcuc 0229 0229 0228 % LATIN SMALL LETTER E WITH CEDILLA +\setcclcuc 022A 022B 022A % LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON +\setcclcuc 022B 022B 022A % LATIN SMALL LETTER O WITH DIAERESIS AND MACRON +\setcclcuc 022C 022D 022C % LATIN CAPITAL LETTER O WITH TILDE AND MACRON +\setcclcuc 022D 022D 022C % LATIN SMALL LETTER O WITH TILDE AND MACRON +\setcclcuc 022E 022F 022E % LATIN CAPITAL LETTER O WITH DOT ABOVE +\setcclcuc 022F 022F 022E % LATIN SMALL LETTER O WITH DOT ABOVE +\setcclcuc 0230 0231 0230 % LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON +\setcclcuc 0231 0231 0230 % LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON +\setcclcuc 0232 0233 0232 % LATIN CAPITAL LETTER Y WITH MACRON +\setcclcuc 0233 0233 0232 % LATIN SMALL LETTER Y WITH MACRON +\setcclcuc 0234 0234 0234 % LATIN SMALL LETTER L WITH CURL +\setcclcuc 0235 0235 0235 % LATIN SMALL LETTER N WITH CURL +\setcclcuc 0236 0236 0236 % LATIN SMALL LETTER T WITH CURL +\setcclcuc 0237 0237 0237 % LATIN SMALL LETTER DOTLESS J +\setcclcuc 0238 0238 0238 % LATIN SMALL LETTER DB DIGRAPH +\setcclcuc 0239 0239 0239 % LATIN SMALL LETTER QP DIGRAPH +\setcclcuc 023A 2C65 023A % LATIN CAPITAL LETTER A WITH STROKE +\setcclcuc 023B 023C 023B % LATIN CAPITAL LETTER C WITH STROKE +\setcclcuc 023C 023C 023B % LATIN SMALL LETTER C WITH STROKE +\setcclcuc 023D 019A 023D % LATIN CAPITAL LETTER L WITH BAR +\setcclcuc 023E 2C66 023E % LATIN CAPITAL LETTER T WITH DIAGONAL STROKE +\setcclcuc 023F 023F 023F % LATIN SMALL LETTER S WITH SWASH TAIL +\setcclcuc 0240 0240 0240 % LATIN SMALL LETTER Z WITH SWASH TAIL +\setcclcuc 0241 0242 0241 % LATIN CAPITAL LETTER GLOTTAL STOP +\setcclcuc 0242 0242 0241 % LATIN SMALL LETTER GLOTTAL STOP +\setcclcuc 0243 0180 0243 % LATIN CAPITAL LETTER B WITH STROKE +\setcclcuc 0244 0289 0244 % LATIN CAPITAL LETTER U BAR +\setcclcuc 0245 028C 0245 % LATIN CAPITAL LETTER TURNED V +\setcclcuc 0246 0247 0246 % LATIN CAPITAL LETTER E WITH STROKE +\setcclcuc 0247 0247 0246 % LATIN SMALL LETTER E WITH STROKE +\setcclcuc 0248 0249 0248 % LATIN CAPITAL LETTER J WITH STROKE +\setcclcuc 0249 0249 0248 % LATIN SMALL LETTER J WITH STROKE +\setcclcuc 024A 024B 024A % LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL +\setcclcuc 024B 024B 024A % LATIN SMALL LETTER Q WITH HOOK TAIL +\setcclcuc 024C 024D 024C % LATIN CAPITAL LETTER R WITH STROKE +\setcclcuc 024D 024D 024C % LATIN SMALL LETTER R WITH STROKE +\setcclcuc 024E 024F 024E % LATIN CAPITAL LETTER Y WITH STROKE +\setcclcuc 024F 024F 024E % LATIN SMALL LETTER Y WITH STROKE +\setcclcuc 0250 0250 0250 % LATIN SMALL LETTER TURNED A +\setcclcuc 0251 0251 0251 % LATIN SMALL LETTER ALPHA +\setcclcuc 0252 0252 0252 % LATIN SMALL LETTER TURNED ALPHA +\setcclcuc 0253 0253 0181 % LATIN SMALL LETTER B WITH HOOK +\setcclcuc 0254 0254 0186 % LATIN SMALL LETTER OPEN O +\setcclcuc 0255 0255 0255 % LATIN SMALL LETTER C WITH CURL +\setcclcuc 0256 0256 0189 % LATIN SMALL LETTER D WITH TAIL +\setcclcuc 0257 0257 018A % LATIN SMALL LETTER D WITH HOOK +\setcclcuc 0258 0258 0258 % LATIN SMALL LETTER REVERSED E +\setcclcuc 0259 0259 018F % LATIN SMALL LETTER SCHWA +\setcclcuc 025A 025A 025A % LATIN SMALL LETTER SCHWA WITH HOOK +\setcclcuc 025B 025B 0190 % LATIN SMALL LETTER OPEN E +\setcclcuc 025C 025C 025C % LATIN SMALL LETTER REVERSED OPEN E +\setcclcuc 025D 025D 025D % LATIN SMALL LETTER REVERSED OPEN E WITH HOOK +\setcclcuc 025E 025E 025E % LATIN SMALL LETTER CLOSED REVERSED OPEN E +\setcclcuc 025F 025F 025F % LATIN SMALL LETTER DOTLESS J WITH STROKE +\setcclcuc 0260 0260 0193 % LATIN SMALL LETTER G WITH HOOK +\setcclcuc 0261 0261 0261 % LATIN SMALL LETTER SCRIPT G +\setcclcuc 0262 0262 0262 % LATIN LETTER SMALL CAPITAL G +\setcclcuc 0263 0263 0194 % LATIN SMALL LETTER GAMMA +\setcclcuc 0264 0264 0264 % LATIN SMALL LETTER RAMS HORN +\setcclcuc 0265 0265 0265 % LATIN SMALL LETTER TURNED H +\setcclcuc 0266 0266 0266 % LATIN SMALL LETTER H WITH HOOK +\setcclcuc 0267 0267 0267 % LATIN SMALL LETTER HENG WITH HOOK +\setcclcuc 0268 0268 0197 % LATIN SMALL LETTER I WITH STROKE +\setcclcuc 0269 0269 0196 % LATIN SMALL LETTER IOTA +\setcclcuc 026A 026A 026A % LATIN LETTER SMALL CAPITAL I +\setcclcuc 026B 026B 2C62 % LATIN SMALL LETTER L WITH MIDDLE TILDE +\setcclcuc 026C 026C 026C % LATIN SMALL LETTER L WITH BELT +\setcclcuc 026D 026D 026D % LATIN SMALL LETTER L WITH RETROFLEX HOOK +\setcclcuc 026E 026E 026E % LATIN SMALL LETTER LEZH +\setcclcuc 026F 026F 019C % LATIN SMALL LETTER TURNED M +\setcclcuc 0270 0270 0270 % LATIN SMALL LETTER TURNED M WITH LONG LEG +\setcclcuc 0271 0271 0271 % LATIN SMALL LETTER M WITH HOOK +\setcclcuc 0272 0272 019D % LATIN SMALL LETTER N WITH LEFT HOOK +\setcclcuc 0273 0273 0273 % LATIN SMALL LETTER N WITH RETROFLEX HOOK +\setcclcuc 0274 0274 0274 % LATIN LETTER SMALL CAPITAL N +\setcclcuc 0275 0275 019F % LATIN SMALL LETTER BARRED O +\setcclcuc 0276 0276 0276 % LATIN LETTER SMALL CAPITAL OE +\setcclcuc 0277 0277 0277 % LATIN SMALL LETTER CLOSED OMEGA +\setcclcuc 0278 0278 0278 % LATIN SMALL LETTER PHI +\setcclcuc 0279 0279 0279 % LATIN SMALL LETTER TURNED R +\setcclcuc 027A 027A 027A % LATIN SMALL LETTER TURNED R WITH LONG LEG +\setcclcuc 027B 027B 027B % LATIN SMALL LETTER TURNED R WITH HOOK +\setcclcuc 027C 027C 027C % LATIN SMALL LETTER R WITH LONG LEG +\setcclcuc 027D 027D 2C64 % LATIN SMALL LETTER R WITH TAIL +\setcclcuc 027E 027E 027E % LATIN SMALL LETTER R WITH FISHHOOK +\setcclcuc 027F 027F 027F % LATIN SMALL LETTER REVERSED R WITH FISHHOOK +\setcclcuc 0280 0280 01A6 % LATIN LETTER SMALL CAPITAL R +\setcclcuc 0281 0281 0281 % LATIN LETTER SMALL CAPITAL INVERTED R +\setcclcuc 0282 0282 0282 % LATIN SMALL LETTER S WITH HOOK +\setcclcuc 0283 0283 01A9 % LATIN SMALL LETTER ESH +\setcclcuc 0284 0284 0284 % LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK +\setcclcuc 0285 0285 0285 % LATIN SMALL LETTER SQUAT REVERSED ESH +\setcclcuc 0286 0286 0286 % LATIN SMALL LETTER ESH WITH CURL +\setcclcuc 0287 0287 0287 % LATIN SMALL LETTER TURNED T +\setcclcuc 0288 0288 01AE % LATIN SMALL LETTER T WITH RETROFLEX HOOK +\setcclcuc 0289 0289 0244 % LATIN SMALL LETTER U BAR +\setcclcuc 028A 028A 01B1 % LATIN SMALL LETTER UPSILON +\setcclcuc 028B 028B 01B2 % LATIN SMALL LETTER V WITH HOOK +\setcclcuc 028C 028C 0245 % LATIN SMALL LETTER TURNED V +\setcclcuc 028D 028D 028D % LATIN SMALL LETTER TURNED W +\setcclcuc 028E 028E 028E % LATIN SMALL LETTER TURNED Y +\setcclcuc 028F 028F 028F % LATIN LETTER SMALL CAPITAL Y +\setcclcuc 0290 0290 0290 % LATIN SMALL LETTER Z WITH RETROFLEX HOOK +\setcclcuc 0291 0291 0291 % LATIN SMALL LETTER Z WITH CURL +\setcclcuc 0292 0292 01B7 % LATIN SMALL LETTER EZH +\setcclcuc 0293 0293 0293 % LATIN SMALL LETTER EZH WITH CURL +\setcclcuc 0295 0295 0295 % LATIN LETTER PHARYNGEAL VOICED FRICATIVE +\setcclcuc 0296 0296 0296 % LATIN LETTER INVERTED GLOTTAL STOP +\setcclcuc 0297 0297 0297 % LATIN LETTER STRETCHED C +\setcclcuc 0298 0298 0298 % LATIN LETTER BILABIAL CLICK +\setcclcuc 0299 0299 0299 % LATIN LETTER SMALL CAPITAL B +\setcclcuc 029A 029A 029A % LATIN SMALL LETTER CLOSED OPEN E +\setcclcuc 029B 029B 029B % LATIN LETTER SMALL CAPITAL G WITH HOOK +\setcclcuc 029C 029C 029C % LATIN LETTER SMALL CAPITAL H +\setcclcuc 029D 029D 029D % LATIN SMALL LETTER J WITH CROSSED-TAIL +\setcclcuc 029E 029E 029E % LATIN SMALL LETTER TURNED K +\setcclcuc 029F 029F 029F % LATIN LETTER SMALL CAPITAL L +\setcclcuc 02A0 02A0 02A0 % LATIN SMALL LETTER Q WITH HOOK +\setcclcuc 02A1 02A1 02A1 % LATIN LETTER GLOTTAL STOP WITH STROKE +\setcclcuc 02A2 02A2 02A2 % LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE +\setcclcuc 02A3 02A3 02A3 % LATIN SMALL LETTER DZ DIGRAPH +\setcclcuc 02A4 02A4 02A4 % LATIN SMALL LETTER DEZH DIGRAPH +\setcclcuc 02A5 02A5 02A5 % LATIN SMALL LETTER DZ DIGRAPH WITH CURL +\setcclcuc 02A6 02A6 02A6 % LATIN SMALL LETTER TS DIGRAPH +\setcclcuc 02A7 02A7 02A7 % LATIN SMALL LETTER TESH DIGRAPH +\setcclcuc 02A8 02A8 02A8 % LATIN SMALL LETTER TC DIGRAPH WITH CURL +\setcclcuc 02A9 02A9 02A9 % LATIN SMALL LETTER FENG DIGRAPH +\setcclcuc 02AA 02AA 02AA % LATIN SMALL LETTER LS DIGRAPH +\setcclcuc 02AB 02AB 02AB % LATIN SMALL LETTER LZ DIGRAPH +\setcclcuc 02AC 02AC 02AC % LATIN LETTER BILABIAL PERCUSSIVE +\setcclcuc 02AD 02AD 02AD % LATIN LETTER BIDENTAL PERCUSSIVE +\setcclcuc 02AE 02AE 02AE % LATIN SMALL LETTER TURNED H WITH FISHHOOK +\setcclcuc 02AF 02AF 02AF % LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL +\setcclcuc 037B 037B 03FD % GREEK SMALL REVERSED LUNATE SIGMA SYMBOL +\setcclcuc 037C 037C 03FE % GREEK SMALL DOTTED LUNATE SIGMA SYMBOL +\setcclcuc 037D 037D 03FF % GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL +\setcclcuc 0386 03AC 0386 % GREEK CAPITAL LETTER ALPHA WITH TONOS +\setcclcuc 0388 03AD 0388 % GREEK CAPITAL LETTER EPSILON WITH TONOS +\setcclcuc 0389 03AE 0389 % GREEK CAPITAL LETTER ETA WITH TONOS +\setcclcuc 038A 03AF 038A % GREEK CAPITAL LETTER IOTA WITH TONOS +\setcclcuc 038C 03CC 038C % GREEK CAPITAL LETTER OMICRON WITH TONOS +\setcclcuc 038E 03CD 038E % GREEK CAPITAL LETTER UPSILON WITH TONOS +\setcclcuc 038F 03CE 038F % GREEK CAPITAL LETTER OMEGA WITH TONOS +\setcclcuc 0390 0390 0390 % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +\setcclcuc 0391 03B1 0391 % GREEK CAPITAL LETTER ALPHA +\setcclcuc 0392 03B2 0392 % GREEK CAPITAL LETTER BETA +\setcclcuc 0393 03B3 0393 % GREEK CAPITAL LETTER GAMMA +\setcclcuc 0394 03B4 0394 % GREEK CAPITAL LETTER DELTA +\setcclcuc 0395 03B5 0395 % GREEK CAPITAL LETTER EPSILON +\setcclcuc 0396 03B6 0396 % GREEK CAPITAL LETTER ZETA +\setcclcuc 0397 03B7 0397 % GREEK CAPITAL LETTER ETA +\setcclcuc 0398 03B8 0398 % GREEK CAPITAL LETTER THETA +\setcclcuc 0399 03B9 0399 % GREEK CAPITAL LETTER IOTA +\setcclcuc 039A 03BA 039A % GREEK CAPITAL LETTER KAPPA +\setcclcuc 039B 03BB 039B % GREEK CAPITAL LETTER LAMDA +\setcclcuc 039C 03BC 039C % GREEK CAPITAL LETTER MU +\setcclcuc 039D 03BD 039D % GREEK CAPITAL LETTER NU +\setcclcuc 039E 03BE 039E % GREEK CAPITAL LETTER XI +\setcclcuc 039F 03BF 039F % GREEK CAPITAL LETTER OMICRON +\setcclcuc 03A0 03C0 03A0 % GREEK CAPITAL LETTER PI +\setcclcuc 03A1 03C1 03A1 % GREEK CAPITAL LETTER RHO +\setcclcuc 03A3 03C3 03A3 % GREEK CAPITAL LETTER SIGMA +\setcclcuc 03A4 03C4 03A4 % GREEK CAPITAL LETTER TAU +\setcclcuc 03A5 03C5 03A5 % GREEK CAPITAL LETTER UPSILON +\setcclcuc 03A6 03C6 03A6 % GREEK CAPITAL LETTER PHI +\setcclcuc 03A7 03C7 03A7 % GREEK CAPITAL LETTER CHI +\setcclcuc 03A8 03C8 03A8 % GREEK CAPITAL LETTER PSI +\setcclcuc 03A9 03C9 03A9 % GREEK CAPITAL LETTER OMEGA +\setcclcuc 03AA 03CA 03AA % GREEK CAPITAL LETTER IOTA WITH DIALYTIKA +\setcclcuc 03AB 03CB 03AB % GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA +\setcclcuc 03AC 03AC 0386 % GREEK SMALL LETTER ALPHA WITH TONOS +\setcclcuc 03AD 03AD 0388 % GREEK SMALL LETTER EPSILON WITH TONOS +\setcclcuc 03AE 03AE 0389 % GREEK SMALL LETTER ETA WITH TONOS +\setcclcuc 03AF 03AF 038A % GREEK SMALL LETTER IOTA WITH TONOS +\setcclcuc 03B0 03B0 03B0 % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +\setcclcuc 03B1 03B1 0391 % GREEK SMALL LETTER ALPHA +\setcclcuc 03B2 03B2 0392 % GREEK SMALL LETTER BETA +\setcclcuc 03B3 03B3 0393 % GREEK SMALL LETTER GAMMA +\setcclcuc 03B4 03B4 0394 % GREEK SMALL LETTER DELTA +\setcclcuc 03B5 03B5 0395 % GREEK SMALL LETTER EPSILON +\setcclcuc 03B6 03B6 0396 % GREEK SMALL LETTER ZETA +\setcclcuc 03B7 03B7 0397 % GREEK SMALL LETTER ETA +\setcclcuc 03B8 03B8 0398 % GREEK SMALL LETTER THETA +\setcclcuc 03B9 03B9 0399 % GREEK SMALL LETTER IOTA +\setcclcuc 03BA 03BA 039A % GREEK SMALL LETTER KAPPA +\setcclcuc 03BB 03BB 039B % GREEK SMALL LETTER LAMDA +\setcclcuc 03BC 03BC 039C % GREEK SMALL LETTER MU +\setcclcuc 03BD 03BD 039D % GREEK SMALL LETTER NU +\setcclcuc 03BE 03BE 039E % GREEK SMALL LETTER XI +\setcclcuc 03BF 03BF 039F % GREEK SMALL LETTER OMICRON +\setcclcuc 03C0 03C0 03A0 % GREEK SMALL LETTER PI +\setcclcuc 03C1 03C1 03A1 % GREEK SMALL LETTER RHO +\setcclcuc 03C2 03C2 03A3 % GREEK SMALL LETTER FINAL SIGMA +\setcclcuc 03C3 03C3 03A3 % GREEK SMALL LETTER SIGMA +\setcclcuc 03C4 03C4 03A4 % GREEK SMALL LETTER TAU +\setcclcuc 03C5 03C5 03A5 % GREEK SMALL LETTER UPSILON +\setcclcuc 03C6 03C6 03A6 % GREEK SMALL LETTER PHI +\setcclcuc 03C7 03C7 03A7 % GREEK SMALL LETTER CHI +\setcclcuc 03C8 03C8 03A8 % GREEK SMALL LETTER PSI +\setcclcuc 03C9 03C9 03A9 % GREEK SMALL LETTER OMEGA +\setcclcuc 03CA 03CA 03AA % GREEK SMALL LETTER IOTA WITH DIALYTIKA +\setcclcuc 03CB 03CB 03AB % GREEK SMALL LETTER UPSILON WITH DIALYTIKA +\setcclcuc 03CC 03CC 038C % GREEK SMALL LETTER OMICRON WITH TONOS +\setcclcuc 03CD 03CD 038E % GREEK SMALL LETTER UPSILON WITH TONOS +\setcclcuc 03CE 03CE 038F % GREEK SMALL LETTER OMEGA WITH TONOS +\setcclcuc 03D0 03D0 0392 % GREEK BETA SYMBOL +\setcclcuc 03D1 03D1 0398 % GREEK THETA SYMBOL +\setcclcuc 03D2 03D2 03D2 % GREEK UPSILON WITH HOOK SYMBOL +\setcclcuc 03D3 03D3 03D3 % GREEK UPSILON WITH ACUTE AND HOOK SYMBOL +\setcclcuc 03D4 03D4 03D4 % GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL +\setcclcuc 03D5 03D5 03A6 % GREEK PHI SYMBOL +\setcclcuc 03D6 03D6 03A0 % GREEK PI SYMBOL +\setcclcuc 03D7 03D7 03D7 % GREEK KAI SYMBOL +\setcclcuc 03D8 03D9 03D8 % GREEK LETTER ARCHAIC KOPPA +\setcclcuc 03D9 03D9 03D8 % GREEK SMALL LETTER ARCHAIC KOPPA +\setcclcuc 03DA 03DB 03DA % GREEK LETTER STIGMA +\setcclcuc 03DB 03DB 03DA % GREEK SMALL LETTER STIGMA +\setcclcuc 03DC 03DD 03DC % GREEK LETTER DIGAMMA +\setcclcuc 03DD 03DD 03DC % GREEK SMALL LETTER DIGAMMA +\setcclcuc 03DE 03DF 03DE % GREEK LETTER KOPPA +\setcclcuc 03DF 03DF 03DE % GREEK SMALL LETTER KOPPA +\setcclcuc 03E0 03E1 03E0 % GREEK LETTER SAMPI +\setcclcuc 03E1 03E1 03E0 % GREEK SMALL LETTER SAMPI +\setcclcuc 03E2 03E3 03E2 % COPTIC CAPITAL LETTER SHEI +\setcclcuc 03E3 03E3 03E2 % COPTIC SMALL LETTER SHEI +\setcclcuc 03E4 03E5 03E4 % COPTIC CAPITAL LETTER FEI +\setcclcuc 03E5 03E5 03E4 % COPTIC SMALL LETTER FEI +\setcclcuc 03E6 03E7 03E6 % COPTIC CAPITAL LETTER KHEI +\setcclcuc 03E7 03E7 03E6 % COPTIC SMALL LETTER KHEI +\setcclcuc 03E8 03E9 03E8 % COPTIC CAPITAL LETTER HORI +\setcclcuc 03E9 03E9 03E8 % COPTIC SMALL LETTER HORI +\setcclcuc 03EA 03EB 03EA % COPTIC CAPITAL LETTER GANGIA +\setcclcuc 03EB 03EB 03EA % COPTIC SMALL LETTER GANGIA +\setcclcuc 03EC 03ED 03EC % COPTIC CAPITAL LETTER SHIMA +\setcclcuc 03ED 03ED 03EC % COPTIC SMALL LETTER SHIMA +\setcclcuc 03EE 03EF 03EE % COPTIC CAPITAL LETTER DEI +\setcclcuc 03EF 03EF 03EE % COPTIC SMALL LETTER DEI +\setcclcuc 03F0 03F0 039A % GREEK KAPPA SYMBOL +\setcclcuc 03F1 03F1 03A1 % GREEK RHO SYMBOL +\setcclcuc 03F2 03F2 03F9 % GREEK LUNATE SIGMA SYMBOL +\setcclcuc 03F3 03F3 03F3 % GREEK LETTER YOT +\setcclcuc 03F4 03B8 03F4 % GREEK CAPITAL THETA SYMBOL +\setcclcuc 03F5 03F5 0395 % GREEK LUNATE EPSILON SYMBOL +\setcclcuc 03F7 03F8 03F7 % GREEK CAPITAL LETTER SHO +\setcclcuc 03F8 03F8 03F7 % GREEK SMALL LETTER SHO +\setcclcuc 03F9 03F2 03F9 % GREEK CAPITAL LUNATE SIGMA SYMBOL +\setcclcuc 03FA 03FB 03FA % GREEK CAPITAL LETTER SAN +\setcclcuc 03FB 03FB 03FA % GREEK SMALL LETTER SAN +\setcclcuc 03FC 03FC 03FC % GREEK RHO WITH STROKE SYMBOL +\setcclcuc 03FD 037B 03FD % GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL +\setcclcuc 03FE 037C 03FE % GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL +\setcclcuc 03FF 037D 03FF % GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL +\setcclcuc 0400 0450 0400 % CYRILLIC CAPITAL LETTER IE WITH GRAVE +\setcclcuc 0401 0451 0401 % CYRILLIC CAPITAL LETTER IO +\setcclcuc 0402 0452 0402 % CYRILLIC CAPITAL LETTER DJE +\setcclcuc 0403 0453 0403 % CYRILLIC CAPITAL LETTER GJE +\setcclcuc 0404 0454 0404 % CYRILLIC CAPITAL LETTER UKRAINIAN IE +\setcclcuc 0405 0455 0405 % CYRILLIC CAPITAL LETTER DZE +\setcclcuc 0406 0456 0406 % CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +\setcclcuc 0407 0457 0407 % CYRILLIC CAPITAL LETTER YI +\setcclcuc 0408 0458 0408 % CYRILLIC CAPITAL LETTER JE +\setcclcuc 0409 0459 0409 % CYRILLIC CAPITAL LETTER LJE +\setcclcuc 040A 045A 040A % CYRILLIC CAPITAL LETTER NJE +\setcclcuc 040B 045B 040B % CYRILLIC CAPITAL LETTER TSHE +\setcclcuc 040C 045C 040C % CYRILLIC CAPITAL LETTER KJE +\setcclcuc 040D 045D 040D % CYRILLIC CAPITAL LETTER I WITH GRAVE +\setcclcuc 040E 045E 040E % CYRILLIC CAPITAL LETTER SHORT U +\setcclcuc 040F 045F 040F % CYRILLIC CAPITAL LETTER DZHE +\setcclcuc 0410 0430 0410 % CYRILLIC CAPITAL LETTER A +\setcclcuc 0411 0431 0411 % CYRILLIC CAPITAL LETTER BE +\setcclcuc 0412 0432 0412 % CYRILLIC CAPITAL LETTER VE +\setcclcuc 0413 0433 0413 % CYRILLIC CAPITAL LETTER GHE +\setcclcuc 0414 0434 0414 % CYRILLIC CAPITAL LETTER DE +\setcclcuc 0415 0435 0415 % CYRILLIC CAPITAL LETTER IE +\setcclcuc 0416 0436 0416 % CYRILLIC CAPITAL LETTER ZHE +\setcclcuc 0417 0437 0417 % CYRILLIC CAPITAL LETTER ZE +\setcclcuc 0418 0438 0418 % CYRILLIC CAPITAL LETTER I +\setcclcuc 0419 0439 0419 % CYRILLIC CAPITAL LETTER SHORT I +\setcclcuc 041A 043A 041A % CYRILLIC CAPITAL LETTER KA +\setcclcuc 041B 043B 041B % CYRILLIC CAPITAL LETTER EL +\setcclcuc 041C 043C 041C % CYRILLIC CAPITAL LETTER EM +\setcclcuc 041D 043D 041D % CYRILLIC CAPITAL LETTER EN +\setcclcuc 041E 043E 041E % CYRILLIC CAPITAL LETTER O +\setcclcuc 041F 043F 041F % CYRILLIC CAPITAL LETTER PE +\setcclcuc 0420 0440 0420 % CYRILLIC CAPITAL LETTER ER +\setcclcuc 0421 0441 0421 % CYRILLIC CAPITAL LETTER ES +\setcclcuc 0422 0442 0422 % CYRILLIC CAPITAL LETTER TE +\setcclcuc 0423 0443 0423 % CYRILLIC CAPITAL LETTER U +\setcclcuc 0424 0444 0424 % CYRILLIC CAPITAL LETTER EF +\setcclcuc 0425 0445 0425 % CYRILLIC CAPITAL LETTER HA +\setcclcuc 0426 0446 0426 % CYRILLIC CAPITAL LETTER TSE +\setcclcuc 0427 0447 0427 % CYRILLIC CAPITAL LETTER CHE +\setcclcuc 0428 0448 0428 % CYRILLIC CAPITAL LETTER SHA +\setcclcuc 0429 0449 0429 % CYRILLIC CAPITAL LETTER SHCHA +\setcclcuc 042A 044A 042A % CYRILLIC CAPITAL LETTER HARD SIGN +\setcclcuc 042B 044B 042B % CYRILLIC CAPITAL LETTER YERU +\setcclcuc 042C 044C 042C % CYRILLIC CAPITAL LETTER SOFT SIGN +\setcclcuc 042D 044D 042D % CYRILLIC CAPITAL LETTER E +\setcclcuc 042E 044E 042E % CYRILLIC CAPITAL LETTER YU +\setcclcuc 042F 044F 042F % CYRILLIC CAPITAL LETTER YA +\setcclcuc 0430 0430 0410 % CYRILLIC SMALL LETTER A +\setcclcuc 0431 0431 0411 % CYRILLIC SMALL LETTER BE +\setcclcuc 0432 0432 0412 % CYRILLIC SMALL LETTER VE +\setcclcuc 0433 0433 0413 % CYRILLIC SMALL LETTER GHE +\setcclcuc 0434 0434 0414 % CYRILLIC SMALL LETTER DE +\setcclcuc 0435 0435 0415 % CYRILLIC SMALL LETTER IE +\setcclcuc 0436 0436 0416 % CYRILLIC SMALL LETTER ZHE +\setcclcuc 0437 0437 0417 % CYRILLIC SMALL LETTER ZE +\setcclcuc 0438 0438 0418 % CYRILLIC SMALL LETTER I +\setcclcuc 0439 0439 0419 % CYRILLIC SMALL LETTER SHORT I +\setcclcuc 043A 043A 041A % CYRILLIC SMALL LETTER KA +\setcclcuc 043B 043B 041B % CYRILLIC SMALL LETTER EL +\setcclcuc 043C 043C 041C % CYRILLIC SMALL LETTER EM +\setcclcuc 043D 043D 041D % CYRILLIC SMALL LETTER EN +\setcclcuc 043E 043E 041E % CYRILLIC SMALL LETTER O +\setcclcuc 043F 043F 041F % CYRILLIC SMALL LETTER PE +\setcclcuc 0440 0440 0420 % CYRILLIC SMALL LETTER ER +\setcclcuc 0441 0441 0421 % CYRILLIC SMALL LETTER ES +\setcclcuc 0442 0442 0422 % CYRILLIC SMALL LETTER TE +\setcclcuc 0443 0443 0423 % CYRILLIC SMALL LETTER U +\setcclcuc 0444 0444 0424 % CYRILLIC SMALL LETTER EF +\setcclcuc 0445 0445 0425 % CYRILLIC SMALL LETTER HA +\setcclcuc 0446 0446 0426 % CYRILLIC SMALL LETTER TSE +\setcclcuc 0447 0447 0427 % CYRILLIC SMALL LETTER CHE +\setcclcuc 0448 0448 0428 % CYRILLIC SMALL LETTER SHA +\setcclcuc 0449 0449 0429 % CYRILLIC SMALL LETTER SHCHA +\setcclcuc 044A 044A 042A % CYRILLIC SMALL LETTER HARD SIGN +\setcclcuc 044B 044B 042B % CYRILLIC SMALL LETTER YERU +\setcclcuc 044C 044C 042C % CYRILLIC SMALL LETTER SOFT SIGN +\setcclcuc 044D 044D 042D % CYRILLIC SMALL LETTER E +\setcclcuc 044E 044E 042E % CYRILLIC SMALL LETTER YU +\setcclcuc 044F 044F 042F % CYRILLIC SMALL LETTER YA +\setcclcuc 0450 0450 0400 % CYRILLIC SMALL LETTER IE WITH GRAVE +\setcclcuc 0451 0451 0401 % CYRILLIC SMALL LETTER IO +\setcclcuc 0452 0452 0402 % CYRILLIC SMALL LETTER DJE +\setcclcuc 0453 0453 0403 % CYRILLIC SMALL LETTER GJE +\setcclcuc 0454 0454 0404 % CYRILLIC SMALL LETTER UKRAINIAN IE +\setcclcuc 0455 0455 0405 % CYRILLIC SMALL LETTER DZE +\setcclcuc 0456 0456 0406 % CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +\setcclcuc 0457 0457 0407 % CYRILLIC SMALL LETTER YI +\setcclcuc 0458 0458 0408 % CYRILLIC SMALL LETTER JE +\setcclcuc 0459 0459 0409 % CYRILLIC SMALL LETTER LJE +\setcclcuc 045A 045A 040A % CYRILLIC SMALL LETTER NJE +\setcclcuc 045B 045B 040B % CYRILLIC SMALL LETTER TSHE +\setcclcuc 045C 045C 040C % CYRILLIC SMALL LETTER KJE +\setcclcuc 045D 045D 040D % CYRILLIC SMALL LETTER I WITH GRAVE +\setcclcuc 045E 045E 040E % CYRILLIC SMALL LETTER SHORT U +\setcclcuc 045F 045F 040F % CYRILLIC SMALL LETTER DZHE +\setcclcuc 0460 0461 0460 % CYRILLIC CAPITAL LETTER OMEGA +\setcclcuc 0461 0461 0460 % CYRILLIC SMALL LETTER OMEGA +\setcclcuc 0462 0463 0462 % CYRILLIC CAPITAL LETTER YAT +\setcclcuc 0463 0463 0462 % CYRILLIC SMALL LETTER YAT +\setcclcuc 0464 0465 0464 % CYRILLIC CAPITAL LETTER IOTIFIED E +\setcclcuc 0465 0465 0464 % CYRILLIC SMALL LETTER IOTIFIED E +\setcclcuc 0466 0467 0466 % CYRILLIC CAPITAL LETTER LITTLE YUS +\setcclcuc 0467 0467 0466 % CYRILLIC SMALL LETTER LITTLE YUS +\setcclcuc 0468 0469 0468 % CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS +\setcclcuc 0469 0469 0468 % CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS +\setcclcuc 046A 046B 046A % CYRILLIC CAPITAL LETTER BIG YUS +\setcclcuc 046B 046B 046A % CYRILLIC SMALL LETTER BIG YUS +\setcclcuc 046C 046D 046C % CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS +\setcclcuc 046D 046D 046C % CYRILLIC SMALL LETTER IOTIFIED BIG YUS +\setcclcuc 046E 046F 046E % CYRILLIC CAPITAL LETTER KSI +\setcclcuc 046F 046F 046E % CYRILLIC SMALL LETTER KSI +\setcclcuc 0470 0471 0470 % CYRILLIC CAPITAL LETTER PSI +\setcclcuc 0471 0471 0470 % CYRILLIC SMALL LETTER PSI +\setcclcuc 0472 0473 0472 % CYRILLIC CAPITAL LETTER FITA +\setcclcuc 0473 0473 0472 % CYRILLIC SMALL LETTER FITA +\setcclcuc 0474 0475 0474 % CYRILLIC CAPITAL LETTER IZHITSA +\setcclcuc 0475 0475 0474 % CYRILLIC SMALL LETTER IZHITSA +\setcclcuc 0476 0477 0476 % CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT +\setcclcuc 0477 0477 0476 % CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT +\setcclcuc 0478 0479 0478 % CYRILLIC CAPITAL LETTER UK +\setcclcuc 0479 0479 0478 % CYRILLIC SMALL LETTER UK +\setcclcuc 047A 047B 047A % CYRILLIC CAPITAL LETTER ROUND OMEGA +\setcclcuc 047B 047B 047A % CYRILLIC SMALL LETTER ROUND OMEGA +\setcclcuc 047C 047D 047C % CYRILLIC CAPITAL LETTER OMEGA WITH TITLO +\setcclcuc 047D 047D 047C % CYRILLIC SMALL LETTER OMEGA WITH TITLO +\setcclcuc 047E 047F 047E % CYRILLIC CAPITAL LETTER OT +\setcclcuc 047F 047F 047E % CYRILLIC SMALL LETTER OT +\setcclcuc 0480 0481 0480 % CYRILLIC CAPITAL LETTER KOPPA +\setcclcuc 0481 0481 0480 % CYRILLIC SMALL LETTER KOPPA +\setcclcuc 048A 048B 048A % CYRILLIC CAPITAL LETTER SHORT I WITH TAIL +\setcclcuc 048B 048B 048A % CYRILLIC SMALL LETTER SHORT I WITH TAIL +\setcclcuc 048C 048D 048C % CYRILLIC CAPITAL LETTER SEMISOFT SIGN +\setcclcuc 048D 048D 048C % CYRILLIC SMALL LETTER SEMISOFT SIGN +\setcclcuc 048E 048F 048E % CYRILLIC CAPITAL LETTER ER WITH TICK +\setcclcuc 048F 048F 048E % CYRILLIC SMALL LETTER ER WITH TICK +\setcclcuc 0490 0491 0490 % CYRILLIC CAPITAL LETTER GHE WITH UPTURN +\setcclcuc 0491 0491 0490 % CYRILLIC SMALL LETTER GHE WITH UPTURN +\setcclcuc 0492 0493 0492 % CYRILLIC CAPITAL LETTER GHE WITH STROKE +\setcclcuc 0493 0493 0492 % CYRILLIC SMALL LETTER GHE WITH STROKE +\setcclcuc 0494 0495 0494 % CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK +\setcclcuc 0495 0495 0494 % CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK +\setcclcuc 0496 0497 0496 % CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER +\setcclcuc 0497 0497 0496 % CYRILLIC SMALL LETTER ZHE WITH DESCENDER +\setcclcuc 0498 0499 0498 % CYRILLIC CAPITAL LETTER ZE WITH DESCENDER +\setcclcuc 0499 0499 0498 % CYRILLIC SMALL LETTER ZE WITH DESCENDER +\setcclcuc 049A 049B 049A % CYRILLIC CAPITAL LETTER KA WITH DESCENDER +\setcclcuc 049B 049B 049A % CYRILLIC SMALL LETTER KA WITH DESCENDER +\setcclcuc 049C 049D 049C % CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE +\setcclcuc 049D 049D 049C % CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE +\setcclcuc 049E 049F 049E % CYRILLIC CAPITAL LETTER KA WITH STROKE +\setcclcuc 049F 049F 049E % CYRILLIC SMALL LETTER KA WITH STROKE +\setcclcuc 04A0 04A1 04A0 % CYRILLIC CAPITAL LETTER BASHKIR KA +\setcclcuc 04A1 04A1 04A0 % CYRILLIC SMALL LETTER BASHKIR KA +\setcclcuc 04A2 04A3 04A2 % CYRILLIC CAPITAL LETTER EN WITH DESCENDER +\setcclcuc 04A3 04A3 04A2 % CYRILLIC SMALL LETTER EN WITH DESCENDER +\setcclcuc 04A4 04A5 04A4 % CYRILLIC CAPITAL LIGATURE EN GHE +\setcclcuc 04A5 04A5 04A4 % CYRILLIC SMALL LIGATURE EN GHE +\setcclcuc 04A6 04A7 04A6 % CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK +\setcclcuc 04A7 04A7 04A6 % CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK +\setcclcuc 04A8 04A9 04A8 % CYRILLIC CAPITAL LETTER ABKHASIAN HA +\setcclcuc 04A9 04A9 04A8 % CYRILLIC SMALL LETTER ABKHASIAN HA +\setcclcuc 04AA 04AB 04AA % CYRILLIC CAPITAL LETTER ES WITH DESCENDER +\setcclcuc 04AB 04AB 04AA % CYRILLIC SMALL LETTER ES WITH DESCENDER +\setcclcuc 04AC 04AD 04AC % CYRILLIC CAPITAL LETTER TE WITH DESCENDER +\setcclcuc 04AD 04AD 04AC % CYRILLIC SMALL LETTER TE WITH DESCENDER +\setcclcuc 04AE 04AF 04AE % CYRILLIC CAPITAL LETTER STRAIGHT U +\setcclcuc 04AF 04AF 04AE % CYRILLIC SMALL LETTER STRAIGHT U +\setcclcuc 04B0 04B1 04B0 % CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE +\setcclcuc 04B1 04B1 04B0 % CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE +\setcclcuc 04B2 04B3 04B2 % CYRILLIC CAPITAL LETTER HA WITH DESCENDER +\setcclcuc 04B3 04B3 04B2 % CYRILLIC SMALL LETTER HA WITH DESCENDER +\setcclcuc 04B4 04B5 04B4 % CYRILLIC CAPITAL LIGATURE TE TSE +\setcclcuc 04B5 04B5 04B4 % CYRILLIC SMALL LIGATURE TE TSE +\setcclcuc 04B6 04B7 04B6 % CYRILLIC CAPITAL LETTER CHE WITH DESCENDER +\setcclcuc 04B7 04B7 04B6 % CYRILLIC SMALL LETTER CHE WITH DESCENDER +\setcclcuc 04B8 04B9 04B8 % CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE +\setcclcuc 04B9 04B9 04B8 % CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE +\setcclcuc 04BA 04BB 04BA % CYRILLIC CAPITAL LETTER SHHA +\setcclcuc 04BB 04BB 04BA % CYRILLIC SMALL LETTER SHHA +\setcclcuc 04BC 04BD 04BC % CYRILLIC CAPITAL LETTER ABKHASIAN CHE +\setcclcuc 04BD 04BD 04BC % CYRILLIC SMALL LETTER ABKHASIAN CHE +\setcclcuc 04BE 04BF 04BE % CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER +\setcclcuc 04BF 04BF 04BE % CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER +\setcclcuc 04C0 04CF 04C0 % CYRILLIC LETTER PALOCHKA +\setcclcuc 04C1 04C2 04C1 % CYRILLIC CAPITAL LETTER ZHE WITH BREVE +\setcclcuc 04C2 04C2 04C1 % CYRILLIC SMALL LETTER ZHE WITH BREVE +\setcclcuc 04C3 04C4 04C3 % CYRILLIC CAPITAL LETTER KA WITH HOOK +\setcclcuc 04C4 04C4 04C3 % CYRILLIC SMALL LETTER KA WITH HOOK +\setcclcuc 04C5 04C6 04C5 % CYRILLIC CAPITAL LETTER EL WITH TAIL +\setcclcuc 04C6 04C6 04C5 % CYRILLIC SMALL LETTER EL WITH TAIL +\setcclcuc 04C7 04C8 04C7 % CYRILLIC CAPITAL LETTER EN WITH HOOK +\setcclcuc 04C8 04C8 04C7 % CYRILLIC SMALL LETTER EN WITH HOOK +\setcclcuc 04C9 04CA 04C9 % CYRILLIC CAPITAL LETTER EN WITH TAIL +\setcclcuc 04CA 04CA 04C9 % CYRILLIC SMALL LETTER EN WITH TAIL +\setcclcuc 04CB 04CC 04CB % CYRILLIC CAPITAL LETTER KHAKASSIAN CHE +\setcclcuc 04CC 04CC 04CB % CYRILLIC SMALL LETTER KHAKASSIAN CHE +\setcclcuc 04CD 04CE 04CD % CYRILLIC CAPITAL LETTER EM WITH TAIL +\setcclcuc 04CE 04CE 04CD % CYRILLIC SMALL LETTER EM WITH TAIL +\setcclcuc 04CF 04CF 04C0 % CYRILLIC SMALL LETTER PALOCHKA +\setcclcuc 04D0 04D1 04D0 % CYRILLIC CAPITAL LETTER A WITH BREVE +\setcclcuc 04D1 04D1 04D0 % CYRILLIC SMALL LETTER A WITH BREVE +\setcclcuc 04D2 04D3 04D2 % CYRILLIC CAPITAL LETTER A WITH DIAERESIS +\setcclcuc 04D3 04D3 04D2 % CYRILLIC SMALL LETTER A WITH DIAERESIS +\setcclcuc 04D4 04D5 04D4 % CYRILLIC CAPITAL LIGATURE A IE +\setcclcuc 04D5 04D5 04D4 % CYRILLIC SMALL LIGATURE A IE +\setcclcuc 04D6 04D7 04D6 % CYRILLIC CAPITAL LETTER IE WITH BREVE +\setcclcuc 04D7 04D7 04D6 % CYRILLIC SMALL LETTER IE WITH BREVE +\setcclcuc 04D8 04D9 04D8 % CYRILLIC CAPITAL LETTER SCHWA +\setcclcuc 04D9 04D9 04D8 % CYRILLIC SMALL LETTER SCHWA +\setcclcuc 04DA 04DB 04DA % CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS +\setcclcuc 04DB 04DB 04DA % CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS +\setcclcuc 04DC 04DD 04DC % CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS +\setcclcuc 04DD 04DD 04DC % CYRILLIC SMALL LETTER ZHE WITH DIAERESIS +\setcclcuc 04DE 04DF 04DE % CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS +\setcclcuc 04DF 04DF 04DE % CYRILLIC SMALL LETTER ZE WITH DIAERESIS +\setcclcuc 04E0 04E1 04E0 % CYRILLIC CAPITAL LETTER ABKHASIAN DZE +\setcclcuc 04E1 04E1 04E0 % CYRILLIC SMALL LETTER ABKHASIAN DZE +\setcclcuc 04E2 04E3 04E2 % CYRILLIC CAPITAL LETTER I WITH MACRON +\setcclcuc 04E3 04E3 04E2 % CYRILLIC SMALL LETTER I WITH MACRON +\setcclcuc 04E4 04E5 04E4 % CYRILLIC CAPITAL LETTER I WITH DIAERESIS +\setcclcuc 04E5 04E5 04E4 % CYRILLIC SMALL LETTER I WITH DIAERESIS +\setcclcuc 04E6 04E7 04E6 % CYRILLIC CAPITAL LETTER O WITH DIAERESIS +\setcclcuc 04E7 04E7 04E6 % CYRILLIC SMALL LETTER O WITH DIAERESIS +\setcclcuc 04E8 04E9 04E8 % CYRILLIC CAPITAL LETTER BARRED O +\setcclcuc 04E9 04E9 04E8 % CYRILLIC SMALL LETTER BARRED O +\setcclcuc 04EA 04EB 04EA % CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS +\setcclcuc 04EB 04EB 04EA % CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS +\setcclcuc 04EC 04ED 04EC % CYRILLIC CAPITAL LETTER E WITH DIAERESIS +\setcclcuc 04ED 04ED 04EC % CYRILLIC SMALL LETTER E WITH DIAERESIS +\setcclcuc 04EE 04EF 04EE % CYRILLIC CAPITAL LETTER U WITH MACRON +\setcclcuc 04EF 04EF 04EE % CYRILLIC SMALL LETTER U WITH MACRON +\setcclcuc 04F0 04F1 04F0 % CYRILLIC CAPITAL LETTER U WITH DIAERESIS +\setcclcuc 04F1 04F1 04F0 % CYRILLIC SMALL LETTER U WITH DIAERESIS +\setcclcuc 04F2 04F3 04F2 % CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE +\setcclcuc 04F3 04F3 04F2 % CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE +\setcclcuc 04F4 04F5 04F4 % CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS +\setcclcuc 04F5 04F5 04F4 % CYRILLIC SMALL LETTER CHE WITH DIAERESIS +\setcclcuc 04F6 04F7 04F6 % CYRILLIC CAPITAL LETTER GHE WITH DESCENDER +\setcclcuc 04F7 04F7 04F6 % CYRILLIC SMALL LETTER GHE WITH DESCENDER +\setcclcuc 04F8 04F9 04F8 % CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS +\setcclcuc 04F9 04F9 04F8 % CYRILLIC SMALL LETTER YERU WITH DIAERESIS +\setcclcuc 04FA 04FB 04FA % CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK +\setcclcuc 04FB 04FB 04FA % CYRILLIC SMALL LETTER GHE WITH STROKE AND HOOK +\setcclcuc 04FC 04FD 04FC % CYRILLIC CAPITAL LETTER HA WITH HOOK +\setcclcuc 04FD 04FD 04FC % CYRILLIC SMALL LETTER HA WITH HOOK +\setcclcuc 04FE 04FF 04FE % CYRILLIC CAPITAL LETTER HA WITH STROKE +\setcclcuc 04FF 04FF 04FE % CYRILLIC SMALL LETTER HA WITH STROKE +\setcclcuc 0500 0501 0500 % CYRILLIC CAPITAL LETTER KOMI DE +\setcclcuc 0501 0501 0500 % CYRILLIC SMALL LETTER KOMI DE +\setcclcuc 0502 0503 0502 % CYRILLIC CAPITAL LETTER KOMI DJE +\setcclcuc 0503 0503 0502 % CYRILLIC SMALL LETTER KOMI DJE +\setcclcuc 0504 0505 0504 % CYRILLIC CAPITAL LETTER KOMI ZJE +\setcclcuc 0505 0505 0504 % CYRILLIC SMALL LETTER KOMI ZJE +\setcclcuc 0506 0507 0506 % CYRILLIC CAPITAL LETTER KOMI DZJE +\setcclcuc 0507 0507 0506 % CYRILLIC SMALL LETTER KOMI DZJE +\setcclcuc 0508 0509 0508 % CYRILLIC CAPITAL LETTER KOMI LJE +\setcclcuc 0509 0509 0508 % CYRILLIC SMALL LETTER KOMI LJE +\setcclcuc 050A 050B 050A % CYRILLIC CAPITAL LETTER KOMI NJE +\setcclcuc 050B 050B 050A % CYRILLIC SMALL LETTER KOMI NJE +\setcclcuc 050C 050D 050C % CYRILLIC CAPITAL LETTER KOMI SJE +\setcclcuc 050D 050D 050C % CYRILLIC SMALL LETTER KOMI SJE +\setcclcuc 050E 050F 050E % CYRILLIC CAPITAL LETTER KOMI TJE +\setcclcuc 050F 050F 050E % CYRILLIC SMALL LETTER KOMI TJE +\setcclcuc 0510 0511 0510 % CYRILLIC CAPITAL LETTER REVERSED ZE +\setcclcuc 0511 0511 0510 % CYRILLIC SMALL LETTER REVERSED ZE +\setcclcuc 0512 0513 0512 % CYRILLIC CAPITAL LETTER EL WITH HOOK +\setcclcuc 0513 0513 0512 % CYRILLIC SMALL LETTER EL WITH HOOK +\setcclcuc 0531 0561 0531 % ARMENIAN CAPITAL LETTER AYB +\setcclcuc 0532 0562 0532 % ARMENIAN CAPITAL LETTER BEN +\setcclcuc 0533 0563 0533 % ARMENIAN CAPITAL LETTER GIM +\setcclcuc 0534 0564 0534 % ARMENIAN CAPITAL LETTER DA +\setcclcuc 0535 0565 0535 % ARMENIAN CAPITAL LETTER ECH +\setcclcuc 0536 0566 0536 % ARMENIAN CAPITAL LETTER ZA +\setcclcuc 0537 0567 0537 % ARMENIAN CAPITAL LETTER EH +\setcclcuc 0538 0568 0538 % ARMENIAN CAPITAL LETTER ET +\setcclcuc 0539 0569 0539 % ARMENIAN CAPITAL LETTER TO +\setcclcuc 053A 056A 053A % ARMENIAN CAPITAL LETTER ZHE +\setcclcuc 053B 056B 053B % ARMENIAN CAPITAL LETTER INI +\setcclcuc 053C 056C 053C % ARMENIAN CAPITAL LETTER LIWN +\setcclcuc 053D 056D 053D % ARMENIAN CAPITAL LETTER XEH +\setcclcuc 053E 056E 053E % ARMENIAN CAPITAL LETTER CA +\setcclcuc 053F 056F 053F % ARMENIAN CAPITAL LETTER KEN +\setcclcuc 0540 0570 0540 % ARMENIAN CAPITAL LETTER HO +\setcclcuc 0541 0571 0541 % ARMENIAN CAPITAL LETTER JA +\setcclcuc 0542 0572 0542 % ARMENIAN CAPITAL LETTER GHAD +\setcclcuc 0543 0573 0543 % ARMENIAN CAPITAL LETTER CHEH +\setcclcuc 0544 0574 0544 % ARMENIAN CAPITAL LETTER MEN +\setcclcuc 0545 0575 0545 % ARMENIAN CAPITAL LETTER YI +\setcclcuc 0546 0576 0546 % ARMENIAN CAPITAL LETTER NOW +\setcclcuc 0547 0577 0547 % ARMENIAN CAPITAL LETTER SHA +\setcclcuc 0548 0578 0548 % ARMENIAN CAPITAL LETTER VO +\setcclcuc 0549 0579 0549 % ARMENIAN CAPITAL LETTER CHA +\setcclcuc 054A 057A 054A % ARMENIAN CAPITAL LETTER PEH +\setcclcuc 054B 057B 054B % ARMENIAN CAPITAL LETTER JHEH +\setcclcuc 054C 057C 054C % ARMENIAN CAPITAL LETTER RA +\setcclcuc 054D 057D 054D % ARMENIAN CAPITAL LETTER SEH +\setcclcuc 054E 057E 054E % ARMENIAN CAPITAL LETTER VEW +\setcclcuc 054F 057F 054F % ARMENIAN CAPITAL LETTER TIWN +\setcclcuc 0550 0580 0550 % ARMENIAN CAPITAL LETTER REH +\setcclcuc 0551 0581 0551 % ARMENIAN CAPITAL LETTER CO +\setcclcuc 0552 0582 0552 % ARMENIAN CAPITAL LETTER YIWN +\setcclcuc 0553 0583 0553 % ARMENIAN CAPITAL LETTER PIWR +\setcclcuc 0554 0584 0554 % ARMENIAN CAPITAL LETTER KEH +\setcclcuc 0555 0585 0555 % ARMENIAN CAPITAL LETTER OH +\setcclcuc 0556 0586 0556 % ARMENIAN CAPITAL LETTER FEH +\setcclcuc 0561 0561 0531 % ARMENIAN SMALL LETTER AYB +\setcclcuc 0562 0562 0532 % ARMENIAN SMALL LETTER BEN +\setcclcuc 0563 0563 0533 % ARMENIAN SMALL LETTER GIM +\setcclcuc 0564 0564 0534 % ARMENIAN SMALL LETTER DA +\setcclcuc 0565 0565 0535 % ARMENIAN SMALL LETTER ECH +\setcclcuc 0566 0566 0536 % ARMENIAN SMALL LETTER ZA +\setcclcuc 0567 0567 0537 % ARMENIAN SMALL LETTER EH +\setcclcuc 0568 0568 0538 % ARMENIAN SMALL LETTER ET +\setcclcuc 0569 0569 0539 % ARMENIAN SMALL LETTER TO +\setcclcuc 056A 056A 053A % ARMENIAN SMALL LETTER ZHE +\setcclcuc 056B 056B 053B % ARMENIAN SMALL LETTER INI +\setcclcuc 056C 056C 053C % ARMENIAN SMALL LETTER LIWN +\setcclcuc 056D 056D 053D % ARMENIAN SMALL LETTER XEH +\setcclcuc 056E 056E 053E % ARMENIAN SMALL LETTER CA +\setcclcuc 056F 056F 053F % ARMENIAN SMALL LETTER KEN +\setcclcuc 0570 0570 0540 % ARMENIAN SMALL LETTER HO +\setcclcuc 0571 0571 0541 % ARMENIAN SMALL LETTER JA +\setcclcuc 0572 0572 0542 % ARMENIAN SMALL LETTER GHAD +\setcclcuc 0573 0573 0543 % ARMENIAN SMALL LETTER CHEH +\setcclcuc 0574 0574 0544 % ARMENIAN SMALL LETTER MEN +\setcclcuc 0575 0575 0545 % ARMENIAN SMALL LETTER YI +\setcclcuc 0576 0576 0546 % ARMENIAN SMALL LETTER NOW +\setcclcuc 0577 0577 0547 % ARMENIAN SMALL LETTER SHA +\setcclcuc 0578 0578 0548 % ARMENIAN SMALL LETTER VO +\setcclcuc 0579 0579 0549 % ARMENIAN SMALL LETTER CHA +\setcclcuc 057A 057A 054A % ARMENIAN SMALL LETTER PEH +\setcclcuc 057B 057B 054B % ARMENIAN SMALL LETTER JHEH +\setcclcuc 057C 057C 054C % ARMENIAN SMALL LETTER RA +\setcclcuc 057D 057D 054D % ARMENIAN SMALL LETTER SEH +\setcclcuc 057E 057E 054E % ARMENIAN SMALL LETTER VEW +\setcclcuc 057F 057F 054F % ARMENIAN SMALL LETTER TIWN +\setcclcuc 0580 0580 0550 % ARMENIAN SMALL LETTER REH +\setcclcuc 0581 0581 0551 % ARMENIAN SMALL LETTER CO +\setcclcuc 0582 0582 0552 % ARMENIAN SMALL LETTER YIWN +\setcclcuc 0583 0583 0553 % ARMENIAN SMALL LETTER PIWR +\setcclcuc 0584 0584 0554 % ARMENIAN SMALL LETTER KEH +\setcclcuc 0585 0585 0555 % ARMENIAN SMALL LETTER OH +\setcclcuc 0586 0586 0556 % ARMENIAN SMALL LETTER FEH +\setcclcuc 0587 0587 0587 % ARMENIAN SMALL LIGATURE ECH YIWN +\setcclcuc 10A0 2D00 10A0 % GEORGIAN CAPITAL LETTER AN +\setcclcuc 10A1 2D01 10A1 % GEORGIAN CAPITAL LETTER BAN +\setcclcuc 10A2 2D02 10A2 % GEORGIAN CAPITAL LETTER GAN +\setcclcuc 10A3 2D03 10A3 % GEORGIAN CAPITAL LETTER DON +\setcclcuc 10A4 2D04 10A4 % GEORGIAN CAPITAL LETTER EN +\setcclcuc 10A5 2D05 10A5 % GEORGIAN CAPITAL LETTER VIN +\setcclcuc 10A6 2D06 10A6 % GEORGIAN CAPITAL LETTER ZEN +\setcclcuc 10A7 2D07 10A7 % GEORGIAN CAPITAL LETTER TAN +\setcclcuc 10A8 2D08 10A8 % GEORGIAN CAPITAL LETTER IN +\setcclcuc 10A9 2D09 10A9 % GEORGIAN CAPITAL LETTER KAN +\setcclcuc 10AA 2D0A 10AA % GEORGIAN CAPITAL LETTER LAS +\setcclcuc 10AB 2D0B 10AB % GEORGIAN CAPITAL LETTER MAN +\setcclcuc 10AC 2D0C 10AC % GEORGIAN CAPITAL LETTER NAR +\setcclcuc 10AD 2D0D 10AD % GEORGIAN CAPITAL LETTER ON +\setcclcuc 10AE 2D0E 10AE % GEORGIAN CAPITAL LETTER PAR +\setcclcuc 10AF 2D0F 10AF % GEORGIAN CAPITAL LETTER ZHAR +\setcclcuc 10B0 2D10 10B0 % GEORGIAN CAPITAL LETTER RAE +\setcclcuc 10B1 2D11 10B1 % GEORGIAN CAPITAL LETTER SAN +\setcclcuc 10B2 2D12 10B2 % GEORGIAN CAPITAL LETTER TAR +\setcclcuc 10B3 2D13 10B3 % GEORGIAN CAPITAL LETTER UN +\setcclcuc 10B4 2D14 10B4 % GEORGIAN CAPITAL LETTER PHAR +\setcclcuc 10B5 2D15 10B5 % GEORGIAN CAPITAL LETTER KHAR +\setcclcuc 10B6 2D16 10B6 % GEORGIAN CAPITAL LETTER GHAN +\setcclcuc 10B7 2D17 10B7 % GEORGIAN CAPITAL LETTER QAR +\setcclcuc 10B8 2D18 10B8 % GEORGIAN CAPITAL LETTER SHIN +\setcclcuc 10B9 2D19 10B9 % GEORGIAN CAPITAL LETTER CHIN +\setcclcuc 10BA 2D1A 10BA % GEORGIAN CAPITAL LETTER CAN +\setcclcuc 10BB 2D1B 10BB % GEORGIAN CAPITAL LETTER JIL +\setcclcuc 10BC 2D1C 10BC % GEORGIAN CAPITAL LETTER CIL +\setcclcuc 10BD 2D1D 10BD % GEORGIAN CAPITAL LETTER CHAR +\setcclcuc 10BE 2D1E 10BE % GEORGIAN CAPITAL LETTER XAN +\setcclcuc 10BF 2D1F 10BF % GEORGIAN CAPITAL LETTER JHAN +\setcclcuc 10C0 2D20 10C0 % GEORGIAN CAPITAL LETTER HAE +\setcclcuc 10C1 2D21 10C1 % GEORGIAN CAPITAL LETTER HE +\setcclcuc 10C2 2D22 10C2 % GEORGIAN CAPITAL LETTER HIE +\setcclcuc 10C3 2D23 10C3 % GEORGIAN CAPITAL LETTER WE +\setcclcuc 10C4 2D24 10C4 % GEORGIAN CAPITAL LETTER HAR +\setcclcuc 10C5 2D25 10C5 % GEORGIAN CAPITAL LETTER HOE +\setcclcuc 1D00 1D00 1D00 % LATIN LETTER SMALL CAPITAL A +\setcclcuc 1D01 1D01 1D01 % LATIN LETTER SMALL CAPITAL AE +\setcclcuc 1D02 1D02 1D02 % LATIN SMALL LETTER TURNED AE +\setcclcuc 1D03 1D03 1D03 % LATIN LETTER SMALL CAPITAL BARRED B +\setcclcuc 1D04 1D04 1D04 % LATIN LETTER SMALL CAPITAL C +\setcclcuc 1D05 1D05 1D05 % LATIN LETTER SMALL CAPITAL D +\setcclcuc 1D06 1D06 1D06 % LATIN LETTER SMALL CAPITAL ETH +\setcclcuc 1D07 1D07 1D07 % LATIN LETTER SMALL CAPITAL E +\setcclcuc 1D08 1D08 1D08 % LATIN SMALL LETTER TURNED OPEN E +\setcclcuc 1D09 1D09 1D09 % LATIN SMALL LETTER TURNED I +\setcclcuc 1D0A 1D0A 1D0A % LATIN LETTER SMALL CAPITAL J +\setcclcuc 1D0B 1D0B 1D0B % LATIN LETTER SMALL CAPITAL K +\setcclcuc 1D0C 1D0C 1D0C % LATIN LETTER SMALL CAPITAL L WITH STROKE +\setcclcuc 1D0D 1D0D 1D0D % LATIN LETTER SMALL CAPITAL M +\setcclcuc 1D0E 1D0E 1D0E % LATIN LETTER SMALL CAPITAL REVERSED N +\setcclcuc 1D0F 1D0F 1D0F % LATIN LETTER SMALL CAPITAL O +\setcclcuc 1D10 1D10 1D10 % LATIN LETTER SMALL CAPITAL OPEN O +\setcclcuc 1D11 1D11 1D11 % LATIN SMALL LETTER SIDEWAYS O +\setcclcuc 1D12 1D12 1D12 % LATIN SMALL LETTER SIDEWAYS OPEN O +\setcclcuc 1D13 1D13 1D13 % LATIN SMALL LETTER SIDEWAYS O WITH STROKE +\setcclcuc 1D14 1D14 1D14 % LATIN SMALL LETTER TURNED OE +\setcclcuc 1D15 1D15 1D15 % LATIN LETTER SMALL CAPITAL OU +\setcclcuc 1D16 1D16 1D16 % LATIN SMALL LETTER TOP HALF O +\setcclcuc 1D17 1D17 1D17 % LATIN SMALL LETTER BOTTOM HALF O +\setcclcuc 1D18 1D18 1D18 % LATIN LETTER SMALL CAPITAL P +\setcclcuc 1D19 1D19 1D19 % LATIN LETTER SMALL CAPITAL REVERSED R +\setcclcuc 1D1A 1D1A 1D1A % LATIN LETTER SMALL CAPITAL TURNED R +\setcclcuc 1D1B 1D1B 1D1B % LATIN LETTER SMALL CAPITAL T +\setcclcuc 1D1C 1D1C 1D1C % LATIN LETTER SMALL CAPITAL U +\setcclcuc 1D1D 1D1D 1D1D % LATIN SMALL LETTER SIDEWAYS U +\setcclcuc 1D1E 1D1E 1D1E % LATIN SMALL LETTER SIDEWAYS DIAERESIZED U +\setcclcuc 1D1F 1D1F 1D1F % LATIN SMALL LETTER SIDEWAYS TURNED M +\setcclcuc 1D20 1D20 1D20 % LATIN LETTER SMALL CAPITAL V +\setcclcuc 1D21 1D21 1D21 % LATIN LETTER SMALL CAPITAL W +\setcclcuc 1D22 1D22 1D22 % LATIN LETTER SMALL CAPITAL Z +\setcclcuc 1D23 1D23 1D23 % LATIN LETTER SMALL CAPITAL EZH +\setcclcuc 1D24 1D24 1D24 % LATIN LETTER VOICED LARYNGEAL SPIRANT +\setcclcuc 1D25 1D25 1D25 % LATIN LETTER AIN +\setcclcuc 1D26 1D26 1D26 % GREEK LETTER SMALL CAPITAL GAMMA +\setcclcuc 1D27 1D27 1D27 % GREEK LETTER SMALL CAPITAL LAMDA +\setcclcuc 1D28 1D28 1D28 % GREEK LETTER SMALL CAPITAL PI +\setcclcuc 1D29 1D29 1D29 % GREEK LETTER SMALL CAPITAL RHO +\setcclcuc 1D2A 1D2A 1D2A % GREEK LETTER SMALL CAPITAL PSI +\setcclcuc 1D2B 1D2B 1D2B % CYRILLIC LETTER SMALL CAPITAL EL +\setcclcuc 1D62 1D62 1D62 % LATIN SUBSCRIPT SMALL LETTER I +\setcclcuc 1D63 1D63 1D63 % LATIN SUBSCRIPT SMALL LETTER R +\setcclcuc 1D64 1D64 1D64 % LATIN SUBSCRIPT SMALL LETTER U +\setcclcuc 1D65 1D65 1D65 % LATIN SUBSCRIPT SMALL LETTER V +\setcclcuc 1D66 1D66 1D66 % GREEK SUBSCRIPT SMALL LETTER BETA +\setcclcuc 1D67 1D67 1D67 % GREEK SUBSCRIPT SMALL LETTER GAMMA +\setcclcuc 1D68 1D68 1D68 % GREEK SUBSCRIPT SMALL LETTER RHO +\setcclcuc 1D69 1D69 1D69 % GREEK SUBSCRIPT SMALL LETTER PHI +\setcclcuc 1D6A 1D6A 1D6A % GREEK SUBSCRIPT SMALL LETTER CHI +\setcclcuc 1D6B 1D6B 1D6B % LATIN SMALL LETTER UE +\setcclcuc 1D6C 1D6C 1D6C % LATIN SMALL LETTER B WITH MIDDLE TILDE +\setcclcuc 1D6D 1D6D 1D6D % LATIN SMALL LETTER D WITH MIDDLE TILDE +\setcclcuc 1D6E 1D6E 1D6E % LATIN SMALL LETTER F WITH MIDDLE TILDE +\setcclcuc 1D6F 1D6F 1D6F % LATIN SMALL LETTER M WITH MIDDLE TILDE +\setcclcuc 1D70 1D70 1D70 % LATIN SMALL LETTER N WITH MIDDLE TILDE +\setcclcuc 1D71 1D71 1D71 % LATIN SMALL LETTER P WITH MIDDLE TILDE +\setcclcuc 1D72 1D72 1D72 % LATIN SMALL LETTER R WITH MIDDLE TILDE +\setcclcuc 1D73 1D73 1D73 % LATIN SMALL LETTER R WITH FISHHOOK AND MIDDLE TILDE +\setcclcuc 1D74 1D74 1D74 % LATIN SMALL LETTER S WITH MIDDLE TILDE +\setcclcuc 1D75 1D75 1D75 % LATIN SMALL LETTER T WITH MIDDLE TILDE +\setcclcuc 1D76 1D76 1D76 % LATIN SMALL LETTER Z WITH MIDDLE TILDE +\setcclcuc 1D77 1D77 1D77 % LATIN SMALL LETTER TURNED G +\setcclcuc 1D79 1D79 1D79 % LATIN SMALL LETTER INSULAR G +\setcclcuc 1D7A 1D7A 1D7A % LATIN SMALL LETTER TH WITH STRIKETHROUGH +\setcclcuc 1D7B 1D7B 1D7B % LATIN SMALL CAPITAL LETTER I WITH STROKE +\setcclcuc 1D7C 1D7C 1D7C % LATIN SMALL LETTER IOTA WITH STROKE +\setcclcuc 1D7D 1D7D 2C63 % LATIN SMALL LETTER P WITH STROKE +\setcclcuc 1D7E 1D7E 1D7E % LATIN SMALL CAPITAL LETTER U WITH STROKE +\setcclcuc 1D7F 1D7F 1D7F % LATIN SMALL LETTER UPSILON WITH STROKE +\setcclcuc 1D80 1D80 1D80 % LATIN SMALL LETTER B WITH PALATAL HOOK +\setcclcuc 1D81 1D81 1D81 % LATIN SMALL LETTER D WITH PALATAL HOOK +\setcclcuc 1D82 1D82 1D82 % LATIN SMALL LETTER F WITH PALATAL HOOK +\setcclcuc 1D83 1D83 1D83 % LATIN SMALL LETTER G WITH PALATAL HOOK +\setcclcuc 1D84 1D84 1D84 % LATIN SMALL LETTER K WITH PALATAL HOOK +\setcclcuc 1D85 1D85 1D85 % LATIN SMALL LETTER L WITH PALATAL HOOK +\setcclcuc 1D86 1D86 1D86 % LATIN SMALL LETTER M WITH PALATAL HOOK +\setcclcuc 1D87 1D87 1D87 % LATIN SMALL LETTER N WITH PALATAL HOOK +\setcclcuc 1D88 1D88 1D88 % LATIN SMALL LETTER P WITH PALATAL HOOK +\setcclcuc 1D89 1D89 1D89 % LATIN SMALL LETTER R WITH PALATAL HOOK +\setcclcuc 1D8A 1D8A 1D8A % LATIN SMALL LETTER S WITH PALATAL HOOK +\setcclcuc 1D8B 1D8B 1D8B % LATIN SMALL LETTER ESH WITH PALATAL HOOK +\setcclcuc 1D8C 1D8C 1D8C % LATIN SMALL LETTER V WITH PALATAL HOOK +\setcclcuc 1D8D 1D8D 1D8D % LATIN SMALL LETTER X WITH PALATAL HOOK +\setcclcuc 1D8E 1D8E 1D8E % LATIN SMALL LETTER Z WITH PALATAL HOOK +\setcclcuc 1D8F 1D8F 1D8F % LATIN SMALL LETTER A WITH RETROFLEX HOOK +\setcclcuc 1D90 1D90 1D90 % LATIN SMALL LETTER ALPHA WITH RETROFLEX HOOK +\setcclcuc 1D91 1D91 1D91 % LATIN SMALL LETTER D WITH HOOK AND TAIL +\setcclcuc 1D92 1D92 1D92 % LATIN SMALL LETTER E WITH RETROFLEX HOOK +\setcclcuc 1D93 1D93 1D93 % LATIN SMALL LETTER OPEN E WITH RETROFLEX HOOK +\setcclcuc 1D94 1D94 1D94 % LATIN SMALL LETTER REVERSED OPEN E WITH RETROFLEX HOOK +\setcclcuc 1D95 1D95 1D95 % LATIN SMALL LETTER SCHWA WITH RETROFLEX HOOK +\setcclcuc 1D96 1D96 1D96 % LATIN SMALL LETTER I WITH RETROFLEX HOOK +\setcclcuc 1D97 1D97 1D97 % LATIN SMALL LETTER OPEN O WITH RETROFLEX HOOK +\setcclcuc 1D98 1D98 1D98 % LATIN SMALL LETTER ESH WITH RETROFLEX HOOK +\setcclcuc 1D99 1D99 1D99 % LATIN SMALL LETTER U WITH RETROFLEX HOOK +\setcclcuc 1D9A 1D9A 1D9A % LATIN SMALL LETTER EZH WITH RETROFLEX HOOK +\setcclcuc 1E00 1E01 1E00 % LATIN CAPITAL LETTER A WITH RING BELOW +\setcclcuc 1E01 1E01 1E00 % LATIN SMALL LETTER A WITH RING BELOW +\setcclcuc 1E02 1E03 1E02 % LATIN CAPITAL LETTER B WITH DOT ABOVE +\setcclcuc 1E03 1E03 1E02 % LATIN SMALL LETTER B WITH DOT ABOVE +\setcclcuc 1E04 1E05 1E04 % LATIN CAPITAL LETTER B WITH DOT BELOW +\setcclcuc 1E05 1E05 1E04 % LATIN SMALL LETTER B WITH DOT BELOW +\setcclcuc 1E06 1E07 1E06 % LATIN CAPITAL LETTER B WITH LINE BELOW +\setcclcuc 1E07 1E07 1E06 % LATIN SMALL LETTER B WITH LINE BELOW +\setcclcuc 1E08 1E09 1E08 % LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE +\setcclcuc 1E09 1E09 1E08 % LATIN SMALL LETTER C WITH CEDILLA AND ACUTE +\setcclcuc 1E0A 1E0B 1E0A % LATIN CAPITAL LETTER D WITH DOT ABOVE +\setcclcuc 1E0B 1E0B 1E0A % LATIN SMALL LETTER D WITH DOT ABOVE +\setcclcuc 1E0C 1E0D 1E0C % LATIN CAPITAL LETTER D WITH DOT BELOW +\setcclcuc 1E0D 1E0D 1E0C % LATIN SMALL LETTER D WITH DOT BELOW +\setcclcuc 1E0E 1E0F 1E0E % LATIN CAPITAL LETTER D WITH LINE BELOW +\setcclcuc 1E0F 1E0F 1E0E % LATIN SMALL LETTER D WITH LINE BELOW +\setcclcuc 1E10 1E11 1E10 % LATIN CAPITAL LETTER D WITH CEDILLA +\setcclcuc 1E11 1E11 1E10 % LATIN SMALL LETTER D WITH CEDILLA +\setcclcuc 1E12 1E13 1E12 % LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW +\setcclcuc 1E13 1E13 1E12 % LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW +\setcclcuc 1E14 1E15 1E14 % LATIN CAPITAL LETTER E WITH MACRON AND GRAVE +\setcclcuc 1E15 1E15 1E14 % LATIN SMALL LETTER E WITH MACRON AND GRAVE +\setcclcuc 1E16 1E17 1E16 % LATIN CAPITAL LETTER E WITH MACRON AND ACUTE +\setcclcuc 1E17 1E17 1E16 % LATIN SMALL LETTER E WITH MACRON AND ACUTE +\setcclcuc 1E18 1E19 1E18 % LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW +\setcclcuc 1E19 1E19 1E18 % LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW +\setcclcuc 1E1A 1E1B 1E1A % LATIN CAPITAL LETTER E WITH TILDE BELOW +\setcclcuc 1E1B 1E1B 1E1A % LATIN SMALL LETTER E WITH TILDE BELOW +\setcclcuc 1E1C 1E1D 1E1C % LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE +\setcclcuc 1E1D 1E1D 1E1C % LATIN SMALL LETTER E WITH CEDILLA AND BREVE +\setcclcuc 1E1E 1E1F 1E1E % LATIN CAPITAL LETTER F WITH DOT ABOVE +\setcclcuc 1E1F 1E1F 1E1E % LATIN SMALL LETTER F WITH DOT ABOVE +\setcclcuc 1E20 1E21 1E20 % LATIN CAPITAL LETTER G WITH MACRON +\setcclcuc 1E21 1E21 1E20 % LATIN SMALL LETTER G WITH MACRON +\setcclcuc 1E22 1E23 1E22 % LATIN CAPITAL LETTER H WITH DOT ABOVE +\setcclcuc 1E23 1E23 1E22 % LATIN SMALL LETTER H WITH DOT ABOVE +\setcclcuc 1E24 1E25 1E24 % LATIN CAPITAL LETTER H WITH DOT BELOW +\setcclcuc 1E25 1E25 1E24 % LATIN SMALL LETTER H WITH DOT BELOW +\setcclcuc 1E26 1E27 1E26 % LATIN CAPITAL LETTER H WITH DIAERESIS +\setcclcuc 1E27 1E27 1E26 % LATIN SMALL LETTER H WITH DIAERESIS +\setcclcuc 1E28 1E29 1E28 % LATIN CAPITAL LETTER H WITH CEDILLA +\setcclcuc 1E29 1E29 1E28 % LATIN SMALL LETTER H WITH CEDILLA +\setcclcuc 1E2A 1E2B 1E2A % LATIN CAPITAL LETTER H WITH BREVE BELOW +\setcclcuc 1E2B 1E2B 1E2A % LATIN SMALL LETTER H WITH BREVE BELOW +\setcclcuc 1E2C 1E2D 1E2C % LATIN CAPITAL LETTER I WITH TILDE BELOW +\setcclcuc 1E2D 1E2D 1E2C % LATIN SMALL LETTER I WITH TILDE BELOW +\setcclcuc 1E2E 1E2F 1E2E % LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE +\setcclcuc 1E2F 1E2F 1E2E % LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE +\setcclcuc 1E30 1E31 1E30 % LATIN CAPITAL LETTER K WITH ACUTE +\setcclcuc 1E31 1E31 1E30 % LATIN SMALL LETTER K WITH ACUTE +\setcclcuc 1E32 1E33 1E32 % LATIN CAPITAL LETTER K WITH DOT BELOW +\setcclcuc 1E33 1E33 1E32 % LATIN SMALL LETTER K WITH DOT BELOW +\setcclcuc 1E34 1E35 1E34 % LATIN CAPITAL LETTER K WITH LINE BELOW +\setcclcuc 1E35 1E35 1E34 % LATIN SMALL LETTER K WITH LINE BELOW +\setcclcuc 1E36 1E37 1E36 % LATIN CAPITAL LETTER L WITH DOT BELOW +\setcclcuc 1E37 1E37 1E36 % LATIN SMALL LETTER L WITH DOT BELOW +\setcclcuc 1E38 1E39 1E38 % LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON +\setcclcuc 1E39 1E39 1E38 % LATIN SMALL LETTER L WITH DOT BELOW AND MACRON +\setcclcuc 1E3A 1E3B 1E3A % LATIN CAPITAL LETTER L WITH LINE BELOW +\setcclcuc 1E3B 1E3B 1E3A % LATIN SMALL LETTER L WITH LINE BELOW +\setcclcuc 1E3C 1E3D 1E3C % LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW +\setcclcuc 1E3D 1E3D 1E3C % LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW +\setcclcuc 1E3E 1E3F 1E3E % LATIN CAPITAL LETTER M WITH ACUTE +\setcclcuc 1E3F 1E3F 1E3E % LATIN SMALL LETTER M WITH ACUTE +\setcclcuc 1E40 1E41 1E40 % LATIN CAPITAL LETTER M WITH DOT ABOVE +\setcclcuc 1E41 1E41 1E40 % LATIN SMALL LETTER M WITH DOT ABOVE +\setcclcuc 1E42 1E43 1E42 % LATIN CAPITAL LETTER M WITH DOT BELOW +\setcclcuc 1E43 1E43 1E42 % LATIN SMALL LETTER M WITH DOT BELOW +\setcclcuc 1E44 1E45 1E44 % LATIN CAPITAL LETTER N WITH DOT ABOVE +\setcclcuc 1E45 1E45 1E44 % LATIN SMALL LETTER N WITH DOT ABOVE +\setcclcuc 1E46 1E47 1E46 % LATIN CAPITAL LETTER N WITH DOT BELOW +\setcclcuc 1E47 1E47 1E46 % LATIN SMALL LETTER N WITH DOT BELOW +\setcclcuc 1E48 1E49 1E48 % LATIN CAPITAL LETTER N WITH LINE BELOW +\setcclcuc 1E49 1E49 1E48 % LATIN SMALL LETTER N WITH LINE BELOW +\setcclcuc 1E4A 1E4B 1E4A % LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW +\setcclcuc 1E4B 1E4B 1E4A % LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW +\setcclcuc 1E4C 1E4D 1E4C % LATIN CAPITAL LETTER O WITH TILDE AND ACUTE +\setcclcuc 1E4D 1E4D 1E4C % LATIN SMALL LETTER O WITH TILDE AND ACUTE +\setcclcuc 1E4E 1E4F 1E4E % LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS +\setcclcuc 1E4F 1E4F 1E4E % LATIN SMALL LETTER O WITH TILDE AND DIAERESIS +\setcclcuc 1E50 1E51 1E50 % LATIN CAPITAL LETTER O WITH MACRON AND GRAVE +\setcclcuc 1E51 1E51 1E50 % LATIN SMALL LETTER O WITH MACRON AND GRAVE +\setcclcuc 1E52 1E53 1E52 % LATIN CAPITAL LETTER O WITH MACRON AND ACUTE +\setcclcuc 1E53 1E53 1E52 % LATIN SMALL LETTER O WITH MACRON AND ACUTE +\setcclcuc 1E54 1E55 1E54 % LATIN CAPITAL LETTER P WITH ACUTE +\setcclcuc 1E55 1E55 1E54 % LATIN SMALL LETTER P WITH ACUTE +\setcclcuc 1E56 1E57 1E56 % LATIN CAPITAL LETTER P WITH DOT ABOVE +\setcclcuc 1E57 1E57 1E56 % LATIN SMALL LETTER P WITH DOT ABOVE +\setcclcuc 1E58 1E59 1E58 % LATIN CAPITAL LETTER R WITH DOT ABOVE +\setcclcuc 1E59 1E59 1E58 % LATIN SMALL LETTER R WITH DOT ABOVE +\setcclcuc 1E5A 1E5B 1E5A % LATIN CAPITAL LETTER R WITH DOT BELOW +\setcclcuc 1E5B 1E5B 1E5A % LATIN SMALL LETTER R WITH DOT BELOW +\setcclcuc 1E5C 1E5D 1E5C % LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON +\setcclcuc 1E5D 1E5D 1E5C % LATIN SMALL LETTER R WITH DOT BELOW AND MACRON +\setcclcuc 1E5E 1E5F 1E5E % LATIN CAPITAL LETTER R WITH LINE BELOW +\setcclcuc 1E5F 1E5F 1E5E % LATIN SMALL LETTER R WITH LINE BELOW +\setcclcuc 1E60 1E61 1E60 % LATIN CAPITAL LETTER S WITH DOT ABOVE +\setcclcuc 1E61 1E61 1E60 % LATIN SMALL LETTER S WITH DOT ABOVE +\setcclcuc 1E62 1E63 1E62 % LATIN CAPITAL LETTER S WITH DOT BELOW +\setcclcuc 1E63 1E63 1E62 % LATIN SMALL LETTER S WITH DOT BELOW +\setcclcuc 1E64 1E65 1E64 % LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE +\setcclcuc 1E65 1E65 1E64 % LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE +\setcclcuc 1E66 1E67 1E66 % LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE +\setcclcuc 1E67 1E67 1E66 % LATIN SMALL LETTER S WITH CARON AND DOT ABOVE +\setcclcuc 1E68 1E69 1E68 % LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE +\setcclcuc 1E69 1E69 1E68 % LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE +\setcclcuc 1E6A 1E6B 1E6A % LATIN CAPITAL LETTER T WITH DOT ABOVE +\setcclcuc 1E6B 1E6B 1E6A % LATIN SMALL LETTER T WITH DOT ABOVE +\setcclcuc 1E6C 1E6D 1E6C % LATIN CAPITAL LETTER T WITH DOT BELOW +\setcclcuc 1E6D 1E6D 1E6C % LATIN SMALL LETTER T WITH DOT BELOW +\setcclcuc 1E6E 1E6F 1E6E % LATIN CAPITAL LETTER T WITH LINE BELOW +\setcclcuc 1E6F 1E6F 1E6E % LATIN SMALL LETTER T WITH LINE BELOW +\setcclcuc 1E70 1E71 1E70 % LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW +\setcclcuc 1E71 1E71 1E70 % LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW +\setcclcuc 1E72 1E73 1E72 % LATIN CAPITAL LETTER U WITH DIAERESIS BELOW +\setcclcuc 1E73 1E73 1E72 % LATIN SMALL LETTER U WITH DIAERESIS BELOW +\setcclcuc 1E74 1E75 1E74 % LATIN CAPITAL LETTER U WITH TILDE BELOW +\setcclcuc 1E75 1E75 1E74 % LATIN SMALL LETTER U WITH TILDE BELOW +\setcclcuc 1E76 1E77 1E76 % LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW +\setcclcuc 1E77 1E77 1E76 % LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW +\setcclcuc 1E78 1E79 1E78 % LATIN CAPITAL LETTER U WITH TILDE AND ACUTE +\setcclcuc 1E79 1E79 1E78 % LATIN SMALL LETTER U WITH TILDE AND ACUTE +\setcclcuc 1E7A 1E7B 1E7A % LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS +\setcclcuc 1E7B 1E7B 1E7A % LATIN SMALL LETTER U WITH MACRON AND DIAERESIS +\setcclcuc 1E7C 1E7D 1E7C % LATIN CAPITAL LETTER V WITH TILDE +\setcclcuc 1E7D 1E7D 1E7C % LATIN SMALL LETTER V WITH TILDE +\setcclcuc 1E7E 1E7F 1E7E % LATIN CAPITAL LETTER V WITH DOT BELOW +\setcclcuc 1E7F 1E7F 1E7E % LATIN SMALL LETTER V WITH DOT BELOW +\setcclcuc 1E80 1E81 1E80 % LATIN CAPITAL LETTER W WITH GRAVE +\setcclcuc 1E81 1E81 1E80 % LATIN SMALL LETTER W WITH GRAVE +\setcclcuc 1E82 1E83 1E82 % LATIN CAPITAL LETTER W WITH ACUTE +\setcclcuc 1E83 1E83 1E82 % LATIN SMALL LETTER W WITH ACUTE +\setcclcuc 1E84 1E85 1E84 % LATIN CAPITAL LETTER W WITH DIAERESIS +\setcclcuc 1E85 1E85 1E84 % LATIN SMALL LETTER W WITH DIAERESIS +\setcclcuc 1E86 1E87 1E86 % LATIN CAPITAL LETTER W WITH DOT ABOVE +\setcclcuc 1E87 1E87 1E86 % LATIN SMALL LETTER W WITH DOT ABOVE +\setcclcuc 1E88 1E89 1E88 % LATIN CAPITAL LETTER W WITH DOT BELOW +\setcclcuc 1E89 1E89 1E88 % LATIN SMALL LETTER W WITH DOT BELOW +\setcclcuc 1E8A 1E8B 1E8A % LATIN CAPITAL LETTER X WITH DOT ABOVE +\setcclcuc 1E8B 1E8B 1E8A % LATIN SMALL LETTER X WITH DOT ABOVE +\setcclcuc 1E8C 1E8D 1E8C % LATIN CAPITAL LETTER X WITH DIAERESIS +\setcclcuc 1E8D 1E8D 1E8C % LATIN SMALL LETTER X WITH DIAERESIS +\setcclcuc 1E8E 1E8F 1E8E % LATIN CAPITAL LETTER Y WITH DOT ABOVE +\setcclcuc 1E8F 1E8F 1E8E % LATIN SMALL LETTER Y WITH DOT ABOVE +\setcclcuc 1E90 1E91 1E90 % LATIN CAPITAL LETTER Z WITH CIRCUMFLEX +\setcclcuc 1E91 1E91 1E90 % LATIN SMALL LETTER Z WITH CIRCUMFLEX +\setcclcuc 1E92 1E93 1E92 % LATIN CAPITAL LETTER Z WITH DOT BELOW +\setcclcuc 1E93 1E93 1E92 % LATIN SMALL LETTER Z WITH DOT BELOW +\setcclcuc 1E94 1E95 1E94 % LATIN CAPITAL LETTER Z WITH LINE BELOW +\setcclcuc 1E95 1E95 1E94 % LATIN SMALL LETTER Z WITH LINE BELOW +\setcclcuc 1E96 1E96 1E96 % LATIN SMALL LETTER H WITH LINE BELOW +\setcclcuc 1E97 1E97 1E97 % LATIN SMALL LETTER T WITH DIAERESIS +\setcclcuc 1E98 1E98 1E98 % LATIN SMALL LETTER W WITH RING ABOVE +\setcclcuc 1E99 1E99 1E99 % LATIN SMALL LETTER Y WITH RING ABOVE +\setcclcuc 1E9A 1E9A 1E9A % LATIN SMALL LETTER A WITH RIGHT HALF RING +\setcclcuc 1E9B 1E9B 1E60 % LATIN SMALL LETTER LONG S WITH DOT ABOVE +\setcclcuc 1EA0 1EA1 1EA0 % LATIN CAPITAL LETTER A WITH DOT BELOW +\setcclcuc 1EA1 1EA1 1EA0 % LATIN SMALL LETTER A WITH DOT BELOW +\setcclcuc 1EA2 1EA3 1EA2 % LATIN CAPITAL LETTER A WITH HOOK ABOVE +\setcclcuc 1EA3 1EA3 1EA2 % LATIN SMALL LETTER A WITH HOOK ABOVE +\setcclcuc 1EA4 1EA5 1EA4 % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1EA5 1EA5 1EA4 % LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1EA6 1EA7 1EA6 % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1EA7 1EA7 1EA6 % LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1EA8 1EA9 1EA8 % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1EA9 1EA9 1EA8 % LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1EAA 1EAB 1EAA % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE +\setcclcuc 1EAB 1EAB 1EAA % LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE +\setcclcuc 1EAC 1EAD 1EAC % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1EAD 1EAD 1EAC % LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1EAE 1EAF 1EAE % LATIN CAPITAL LETTER A WITH BREVE AND ACUTE +\setcclcuc 1EAF 1EAF 1EAE % LATIN SMALL LETTER A WITH BREVE AND ACUTE +\setcclcuc 1EB0 1EB1 1EB0 % LATIN CAPITAL LETTER A WITH BREVE AND GRAVE +\setcclcuc 1EB1 1EB1 1EB0 % LATIN SMALL LETTER A WITH BREVE AND GRAVE +\setcclcuc 1EB2 1EB3 1EB2 % LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE +\setcclcuc 1EB3 1EB3 1EB2 % LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE +\setcclcuc 1EB4 1EB5 1EB4 % LATIN CAPITAL LETTER A WITH BREVE AND TILDE +\setcclcuc 1EB5 1EB5 1EB4 % LATIN SMALL LETTER A WITH BREVE AND TILDE +\setcclcuc 1EB6 1EB7 1EB6 % LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW +\setcclcuc 1EB7 1EB7 1EB6 % LATIN SMALL LETTER A WITH BREVE AND DOT BELOW +\setcclcuc 1EB8 1EB9 1EB8 % LATIN CAPITAL LETTER E WITH DOT BELOW +\setcclcuc 1EB9 1EB9 1EB8 % LATIN SMALL LETTER E WITH DOT BELOW +\setcclcuc 1EBA 1EBB 1EBA % LATIN CAPITAL LETTER E WITH HOOK ABOVE +\setcclcuc 1EBB 1EBB 1EBA % LATIN SMALL LETTER E WITH HOOK ABOVE +\setcclcuc 1EBC 1EBD 1EBC % LATIN CAPITAL LETTER E WITH TILDE +\setcclcuc 1EBD 1EBD 1EBC % LATIN SMALL LETTER E WITH TILDE +\setcclcuc 1EBE 1EBF 1EBE % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1EBF 1EBF 1EBE % LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1EC0 1EC1 1EC0 % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1EC1 1EC1 1EC0 % LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1EC2 1EC3 1EC2 % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1EC3 1EC3 1EC2 % LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1EC4 1EC5 1EC4 % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE +\setcclcuc 1EC5 1EC5 1EC4 % LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE +\setcclcuc 1EC6 1EC7 1EC6 % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1EC7 1EC7 1EC6 % LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1EC8 1EC9 1EC8 % LATIN CAPITAL LETTER I WITH HOOK ABOVE +\setcclcuc 1EC9 1EC9 1EC8 % LATIN SMALL LETTER I WITH HOOK ABOVE +\setcclcuc 1ECA 1ECB 1ECA % LATIN CAPITAL LETTER I WITH DOT BELOW +\setcclcuc 1ECB 1ECB 1ECA % LATIN SMALL LETTER I WITH DOT BELOW +\setcclcuc 1ECC 1ECD 1ECC % LATIN CAPITAL LETTER O WITH DOT BELOW +\setcclcuc 1ECD 1ECD 1ECC % LATIN SMALL LETTER O WITH DOT BELOW +\setcclcuc 1ECE 1ECF 1ECE % LATIN CAPITAL LETTER O WITH HOOK ABOVE +\setcclcuc 1ECF 1ECF 1ECE % LATIN SMALL LETTER O WITH HOOK ABOVE +\setcclcuc 1ED0 1ED1 1ED0 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1ED1 1ED1 1ED0 % LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE +\setcclcuc 1ED2 1ED3 1ED2 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1ED3 1ED3 1ED2 % LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE +\setcclcuc 1ED4 1ED5 1ED4 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1ED5 1ED5 1ED4 % LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE +\setcclcuc 1ED6 1ED7 1ED6 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE +\setcclcuc 1ED7 1ED7 1ED6 % LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE +\setcclcuc 1ED8 1ED9 1ED8 % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1ED9 1ED9 1ED8 % LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW +\setcclcuc 1EDA 1EDB 1EDA % LATIN CAPITAL LETTER O WITH HORN AND ACUTE +\setcclcuc 1EDB 1EDB 1EDA % LATIN SMALL LETTER O WITH HORN AND ACUTE +\setcclcuc 1EDC 1EDD 1EDC % LATIN CAPITAL LETTER O WITH HORN AND GRAVE +\setcclcuc 1EDD 1EDD 1EDC % LATIN SMALL LETTER O WITH HORN AND GRAVE +\setcclcuc 1EDE 1EDF 1EDE % LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE +\setcclcuc 1EDF 1EDF 1EDE % LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE +\setcclcuc 1EE0 1EE1 1EE0 % LATIN CAPITAL LETTER O WITH HORN AND TILDE +\setcclcuc 1EE1 1EE1 1EE0 % LATIN SMALL LETTER O WITH HORN AND TILDE +\setcclcuc 1EE2 1EE3 1EE2 % LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW +\setcclcuc 1EE3 1EE3 1EE2 % LATIN SMALL LETTER O WITH HORN AND DOT BELOW +\setcclcuc 1EE4 1EE5 1EE4 % LATIN CAPITAL LETTER U WITH DOT BELOW +\setcclcuc 1EE5 1EE5 1EE4 % LATIN SMALL LETTER U WITH DOT BELOW +\setcclcuc 1EE6 1EE7 1EE6 % LATIN CAPITAL LETTER U WITH HOOK ABOVE +\setcclcuc 1EE7 1EE7 1EE6 % LATIN SMALL LETTER U WITH HOOK ABOVE +\setcclcuc 1EE8 1EE9 1EE8 % LATIN CAPITAL LETTER U WITH HORN AND ACUTE +\setcclcuc 1EE9 1EE9 1EE8 % LATIN SMALL LETTER U WITH HORN AND ACUTE +\setcclcuc 1EEA 1EEB 1EEA % LATIN CAPITAL LETTER U WITH HORN AND GRAVE +\setcclcuc 1EEB 1EEB 1EEA % LATIN SMALL LETTER U WITH HORN AND GRAVE +\setcclcuc 1EEC 1EED 1EEC % LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE +\setcclcuc 1EED 1EED 1EEC % LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE +\setcclcuc 1EEE 1EEF 1EEE % LATIN CAPITAL LETTER U WITH HORN AND TILDE +\setcclcuc 1EEF 1EEF 1EEE % LATIN SMALL LETTER U WITH HORN AND TILDE +\setcclcuc 1EF0 1EF1 1EF0 % LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW +\setcclcuc 1EF1 1EF1 1EF0 % LATIN SMALL LETTER U WITH HORN AND DOT BELOW +\setcclcuc 1EF2 1EF3 1EF2 % LATIN CAPITAL LETTER Y WITH GRAVE +\setcclcuc 1EF3 1EF3 1EF2 % LATIN SMALL LETTER Y WITH GRAVE +\setcclcuc 1EF4 1EF5 1EF4 % LATIN CAPITAL LETTER Y WITH DOT BELOW +\setcclcuc 1EF5 1EF5 1EF4 % LATIN SMALL LETTER Y WITH DOT BELOW +\setcclcuc 1EF6 1EF7 1EF6 % LATIN CAPITAL LETTER Y WITH HOOK ABOVE +\setcclcuc 1EF7 1EF7 1EF6 % LATIN SMALL LETTER Y WITH HOOK ABOVE +\setcclcuc 1EF8 1EF9 1EF8 % LATIN CAPITAL LETTER Y WITH TILDE +\setcclcuc 1EF9 1EF9 1EF8 % LATIN SMALL LETTER Y WITH TILDE +\setcclcuc 1F00 1F00 1F08 % GREEK SMALL LETTER ALPHA WITH PSILI +\setcclcuc 1F01 1F01 1F09 % GREEK SMALL LETTER ALPHA WITH DASIA +\setcclcuc 1F02 1F02 1F0A % GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA +\setcclcuc 1F03 1F03 1F0B % GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA +\setcclcuc 1F04 1F04 1F0C % GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA +\setcclcuc 1F05 1F05 1F0D % GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA +\setcclcuc 1F06 1F06 1F0E % GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI +\setcclcuc 1F07 1F07 1F0F % GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI +\setcclcuc 1F08 1F00 1F08 % GREEK CAPITAL LETTER ALPHA WITH PSILI +\setcclcuc 1F09 1F01 1F09 % GREEK CAPITAL LETTER ALPHA WITH DASIA +\setcclcuc 1F0A 1F02 1F0A % GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA +\setcclcuc 1F0B 1F03 1F0B % GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA +\setcclcuc 1F0C 1F04 1F0C % GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA +\setcclcuc 1F0D 1F05 1F0D % GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA +\setcclcuc 1F0E 1F06 1F0E % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI +\setcclcuc 1F0F 1F07 1F0F % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI +\setcclcuc 1F10 1F10 1F18 % GREEK SMALL LETTER EPSILON WITH PSILI +\setcclcuc 1F11 1F11 1F19 % GREEK SMALL LETTER EPSILON WITH DASIA +\setcclcuc 1F12 1F12 1F1A % GREEK SMALL LETTER EPSILON WITH PSILI AND VARIA +\setcclcuc 1F13 1F13 1F1B % GREEK SMALL LETTER EPSILON WITH DASIA AND VARIA +\setcclcuc 1F14 1F14 1F1C % GREEK SMALL LETTER EPSILON WITH PSILI AND OXIA +\setcclcuc 1F15 1F15 1F1D % GREEK SMALL LETTER EPSILON WITH DASIA AND OXIA +\setcclcuc 1F18 1F10 1F18 % GREEK CAPITAL LETTER EPSILON WITH PSILI +\setcclcuc 1F19 1F11 1F19 % GREEK CAPITAL LETTER EPSILON WITH DASIA +\setcclcuc 1F1A 1F12 1F1A % GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA +\setcclcuc 1F1B 1F13 1F1B % GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA +\setcclcuc 1F1C 1F14 1F1C % GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA +\setcclcuc 1F1D 1F15 1F1D % GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA +\setcclcuc 1F20 1F20 1F28 % GREEK SMALL LETTER ETA WITH PSILI +\setcclcuc 1F21 1F21 1F29 % GREEK SMALL LETTER ETA WITH DASIA +\setcclcuc 1F22 1F22 1F2A % GREEK SMALL LETTER ETA WITH PSILI AND VARIA +\setcclcuc 1F23 1F23 1F2B % GREEK SMALL LETTER ETA WITH DASIA AND VARIA +\setcclcuc 1F24 1F24 1F2C % GREEK SMALL LETTER ETA WITH PSILI AND OXIA +\setcclcuc 1F25 1F25 1F2D % GREEK SMALL LETTER ETA WITH DASIA AND OXIA +\setcclcuc 1F26 1F26 1F2E % GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI +\setcclcuc 1F27 1F27 1F2F % GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI +\setcclcuc 1F28 1F20 1F28 % GREEK CAPITAL LETTER ETA WITH PSILI +\setcclcuc 1F29 1F21 1F29 % GREEK CAPITAL LETTER ETA WITH DASIA +\setcclcuc 1F2A 1F22 1F2A % GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA +\setcclcuc 1F2B 1F23 1F2B % GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA +\setcclcuc 1F2C 1F24 1F2C % GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA +\setcclcuc 1F2D 1F25 1F2D % GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA +\setcclcuc 1F2E 1F26 1F2E % GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI +\setcclcuc 1F2F 1F27 1F2F % GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI +\setcclcuc 1F30 1F30 1F38 % GREEK SMALL LETTER IOTA WITH PSILI +\setcclcuc 1F31 1F31 1F39 % GREEK SMALL LETTER IOTA WITH DASIA +\setcclcuc 1F32 1F32 1F3A % GREEK SMALL LETTER IOTA WITH PSILI AND VARIA +\setcclcuc 1F33 1F33 1F3B % GREEK SMALL LETTER IOTA WITH DASIA AND VARIA +\setcclcuc 1F34 1F34 1F3C % GREEK SMALL LETTER IOTA WITH PSILI AND OXIA +\setcclcuc 1F35 1F35 1F3D % GREEK SMALL LETTER IOTA WITH DASIA AND OXIA +\setcclcuc 1F36 1F36 1F3E % GREEK SMALL LETTER IOTA WITH PSILI AND PERISPOMENI +\setcclcuc 1F37 1F37 1F3F % GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENI +\setcclcuc 1F38 1F30 1F38 % GREEK CAPITAL LETTER IOTA WITH PSILI +\setcclcuc 1F39 1F31 1F39 % GREEK CAPITAL LETTER IOTA WITH DASIA +\setcclcuc 1F3A 1F32 1F3A % GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA +\setcclcuc 1F3B 1F33 1F3B % GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA +\setcclcuc 1F3C 1F34 1F3C % GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA +\setcclcuc 1F3D 1F35 1F3D % GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA +\setcclcuc 1F3E 1F36 1F3E % GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI +\setcclcuc 1F3F 1F37 1F3F % GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI +\setcclcuc 1F40 1F40 1F48 % GREEK SMALL LETTER OMICRON WITH PSILI +\setcclcuc 1F41 1F41 1F49 % GREEK SMALL LETTER OMICRON WITH DASIA +\setcclcuc 1F42 1F42 1F4A % GREEK SMALL LETTER OMICRON WITH PSILI AND VARIA +\setcclcuc 1F43 1F43 1F4B % GREEK SMALL LETTER OMICRON WITH DASIA AND VARIA +\setcclcuc 1F44 1F44 1F4C % GREEK SMALL LETTER OMICRON WITH PSILI AND OXIA +\setcclcuc 1F45 1F45 1F4D % GREEK SMALL LETTER OMICRON WITH DASIA AND OXIA +\setcclcuc 1F48 1F40 1F48 % GREEK CAPITAL LETTER OMICRON WITH PSILI +\setcclcuc 1F49 1F41 1F49 % GREEK CAPITAL LETTER OMICRON WITH DASIA +\setcclcuc 1F4A 1F42 1F4A % GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA +\setcclcuc 1F4B 1F43 1F4B % GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA +\setcclcuc 1F4C 1F44 1F4C % GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA +\setcclcuc 1F4D 1F45 1F4D % GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA +\setcclcuc 1F50 1F50 1F50 % GREEK SMALL LETTER UPSILON WITH PSILI +\setcclcuc 1F51 1F51 1F59 % GREEK SMALL LETTER UPSILON WITH DASIA +\setcclcuc 1F52 1F52 1F52 % GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA +\setcclcuc 1F53 1F53 1F5B % GREEK SMALL LETTER UPSILON WITH DASIA AND VARIA +\setcclcuc 1F54 1F54 1F54 % GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA +\setcclcuc 1F55 1F55 1F5D % GREEK SMALL LETTER UPSILON WITH DASIA AND OXIA +\setcclcuc 1F56 1F56 1F56 % GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI +\setcclcuc 1F57 1F57 1F5F % GREEK SMALL LETTER UPSILON WITH DASIA AND PERISPOMENI +\setcclcuc 1F59 1F51 1F59 % GREEK CAPITAL LETTER UPSILON WITH DASIA +\setcclcuc 1F5B 1F53 1F5B % GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA +\setcclcuc 1F5D 1F55 1F5D % GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA +\setcclcuc 1F5F 1F57 1F5F % GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI +\setcclcuc 1F60 1F60 1F68 % GREEK SMALL LETTER OMEGA WITH PSILI +\setcclcuc 1F61 1F61 1F69 % GREEK SMALL LETTER OMEGA WITH DASIA +\setcclcuc 1F62 1F62 1F6A % GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA +\setcclcuc 1F63 1F63 1F6B % GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA +\setcclcuc 1F64 1F64 1F6C % GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA +\setcclcuc 1F65 1F65 1F6D % GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA +\setcclcuc 1F66 1F66 1F6E % GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI +\setcclcuc 1F67 1F67 1F6F % GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI +\setcclcuc 1F68 1F60 1F68 % GREEK CAPITAL LETTER OMEGA WITH PSILI +\setcclcuc 1F69 1F61 1F69 % GREEK CAPITAL LETTER OMEGA WITH DASIA +\setcclcuc 1F6A 1F62 1F6A % GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA +\setcclcuc 1F6B 1F63 1F6B % GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA +\setcclcuc 1F6C 1F64 1F6C % GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA +\setcclcuc 1F6D 1F65 1F6D % GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA +\setcclcuc 1F6E 1F66 1F6E % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI +\setcclcuc 1F6F 1F67 1F6F % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI +\setcclcuc 1F70 1F70 1FBA % GREEK SMALL LETTER ALPHA WITH VARIA +\setcclcuc 1F71 1F71 1FBB % GREEK SMALL LETTER ALPHA WITH OXIA +\setcclcuc 1F72 1F72 1FC8 % GREEK SMALL LETTER EPSILON WITH VARIA +\setcclcuc 1F73 1F73 1FC9 % GREEK SMALL LETTER EPSILON WITH OXIA +\setcclcuc 1F74 1F74 1FCA % GREEK SMALL LETTER ETA WITH VARIA +\setcclcuc 1F75 1F75 1FCB % GREEK SMALL LETTER ETA WITH OXIA +\setcclcuc 1F76 1F76 1FDA % GREEK SMALL LETTER IOTA WITH VARIA +\setcclcuc 1F77 1F77 1FDB % GREEK SMALL LETTER IOTA WITH OXIA +\setcclcuc 1F78 1F78 1FF8 % GREEK SMALL LETTER OMICRON WITH VARIA +\setcclcuc 1F79 1F79 1FF9 % GREEK SMALL LETTER OMICRON WITH OXIA +\setcclcuc 1F7A 1F7A 1FEA % GREEK SMALL LETTER UPSILON WITH VARIA +\setcclcuc 1F7B 1F7B 1FEB % GREEK SMALL LETTER UPSILON WITH OXIA +\setcclcuc 1F7C 1F7C 1FFA % GREEK SMALL LETTER OMEGA WITH VARIA +\setcclcuc 1F7D 1F7D 1FFB % GREEK SMALL LETTER OMEGA WITH OXIA +\setcclcuc 1F80 1F80 1F88 % GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI +\setcclcuc 1F81 1F81 1F89 % GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI +\setcclcuc 1F82 1F82 1F8A % GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1F83 1F83 1F8B % GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1F84 1F84 1F8C % GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1F85 1F85 1F8D % GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1F86 1F86 1F8E % GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1F87 1F87 1F8F % GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1F88 1F80 1F88 % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI +\setcclcuc 1F89 1F81 1F89 % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI +\setcclcuc 1F8A 1F82 1F8A % GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1F8B 1F83 1F8B % GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1F8C 1F84 1F8C % GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1F8D 1F85 1F8D % GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1F8E 1F86 1F8E % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1F8F 1F87 1F8F % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1F90 1F90 1F98 % GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI +\setcclcuc 1F91 1F91 1F99 % GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI +\setcclcuc 1F92 1F92 1F9A % GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1F93 1F93 1F9B % GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1F94 1F94 1F9C % GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1F95 1F95 1F9D % GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1F96 1F96 1F9E % GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1F97 1F97 1F9F % GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1F98 1F90 1F98 % GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI +\setcclcuc 1F99 1F91 1F99 % GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI +\setcclcuc 1F9A 1F92 1F9A % GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1F9B 1F93 1F9B % GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1F9C 1F94 1F9C % GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1F9D 1F95 1F9D % GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1F9E 1F96 1F9E % GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1F9F 1F97 1F9F % GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1FA0 1FA0 1FA8 % GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI +\setcclcuc 1FA1 1FA1 1FA9 % GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI +\setcclcuc 1FA2 1FA2 1FAA % GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1FA3 1FA3 1FAB % GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI +\setcclcuc 1FA4 1FA4 1FAC % GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1FA5 1FA5 1FAD % GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI +\setcclcuc 1FA6 1FA6 1FAE % GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1FA7 1FA7 1FAF % GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1FA8 1FA0 1FA8 % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI +\setcclcuc 1FA9 1FA1 1FA9 % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI +\setcclcuc 1FAA 1FA2 1FAA % GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1FAB 1FA3 1FAB % GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI +\setcclcuc 1FAC 1FA4 1FAC % GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1FAD 1FA5 1FAD % GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI +\setcclcuc 1FAE 1FA6 1FAE % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1FAF 1FA7 1FAF % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +\setcclcuc 1FB0 1FB0 1FB8 % GREEK SMALL LETTER ALPHA WITH VRACHY +\setcclcuc 1FB1 1FB1 1FB9 % GREEK SMALL LETTER ALPHA WITH MACRON +\setcclcuc 1FB2 1FB2 1FB2 % GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI +\setcclcuc 1FB3 1FB3 1FBC % GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI +\setcclcuc 1FB4 1FB4 1FB4 % GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI +\setcclcuc 1FB6 1FB6 1FB6 % GREEK SMALL LETTER ALPHA WITH PERISPOMENI +\setcclcuc 1FB7 1FB7 1FB7 % GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1FB8 1FB0 1FB8 % GREEK CAPITAL LETTER ALPHA WITH VRACHY +\setcclcuc 1FB9 1FB1 1FB9 % GREEK CAPITAL LETTER ALPHA WITH MACRON +\setcclcuc 1FBA 1F70 1FBA % GREEK CAPITAL LETTER ALPHA WITH VARIA +\setcclcuc 1FBB 1F71 1FBB % GREEK CAPITAL LETTER ALPHA WITH OXIA +\setcclcuc 1FBC 1FB3 1FBC % GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI +\setcclcuc 1FBE 1FBE 0399 % GREEK PROSGEGRAMMENI +\setcclcuc 1FC2 1FC2 1FC2 % GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI +\setcclcuc 1FC3 1FC3 1FCC % GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI +\setcclcuc 1FC4 1FC4 1FC4 % GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI +\setcclcuc 1FC6 1FC6 1FC6 % GREEK SMALL LETTER ETA WITH PERISPOMENI +\setcclcuc 1FC7 1FC7 1FC7 % GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1FC8 1F72 1FC8 % GREEK CAPITAL LETTER EPSILON WITH VARIA +\setcclcuc 1FC9 1F73 1FC9 % GREEK CAPITAL LETTER EPSILON WITH OXIA +\setcclcuc 1FCA 1F74 1FCA % GREEK CAPITAL LETTER ETA WITH VARIA +\setcclcuc 1FCB 1F75 1FCB % GREEK CAPITAL LETTER ETA WITH OXIA +\setcclcuc 1FCC 1FC3 1FCC % GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI +\setcclcuc 1FD0 1FD0 1FD8 % GREEK SMALL LETTER IOTA WITH VRACHY +\setcclcuc 1FD1 1FD1 1FD9 % GREEK SMALL LETTER IOTA WITH MACRON +\setcclcuc 1FD2 1FD2 1FD2 % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA +\setcclcuc 1FD3 1FD3 1FD3 % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +\setcclcuc 1FD6 1FD6 1FD6 % GREEK SMALL LETTER IOTA WITH PERISPOMENI +\setcclcuc 1FD7 1FD7 1FD7 % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI +\setcclcuc 1FD8 1FD0 1FD8 % GREEK CAPITAL LETTER IOTA WITH VRACHY +\setcclcuc 1FD9 1FD1 1FD9 % GREEK CAPITAL LETTER IOTA WITH MACRON +\setcclcuc 1FDA 1F76 1FDA % GREEK CAPITAL LETTER IOTA WITH VARIA +\setcclcuc 1FDB 1F77 1FDB % GREEK CAPITAL LETTER IOTA WITH OXIA +\setcclcuc 1FE0 1FE0 1FE8 % GREEK SMALL LETTER UPSILON WITH VRACHY +\setcclcuc 1FE1 1FE1 1FE9 % GREEK SMALL LETTER UPSILON WITH MACRON +\setcclcuc 1FE2 1FE2 1FE2 % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA +\setcclcuc 1FE3 1FE3 1FE3 % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +\setcclcuc 1FE4 1FE4 1FE4 % GREEK SMALL LETTER RHO WITH PSILI +\setcclcuc 1FE5 1FE5 1FEC % GREEK SMALL LETTER RHO WITH DASIA +\setcclcuc 1FE6 1FE6 1FE6 % GREEK SMALL LETTER UPSILON WITH PERISPOMENI +\setcclcuc 1FE7 1FE7 1FE7 % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI +\setcclcuc 1FE8 1FE0 1FE8 % GREEK CAPITAL LETTER UPSILON WITH VRACHY +\setcclcuc 1FE9 1FE1 1FE9 % GREEK CAPITAL LETTER UPSILON WITH MACRON +\setcclcuc 1FEA 1F7A 1FEA % GREEK CAPITAL LETTER UPSILON WITH VARIA +\setcclcuc 1FEB 1F7B 1FEB % GREEK CAPITAL LETTER UPSILON WITH OXIA +\setcclcuc 1FEC 1FE5 1FEC % GREEK CAPITAL LETTER RHO WITH DASIA +\setcclcuc 1FF2 1FF2 1FF2 % GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI +\setcclcuc 1FF3 1FF3 1FFC % GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI +\setcclcuc 1FF4 1FF4 1FF4 % GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI +\setcclcuc 1FF6 1FF6 1FF6 % GREEK SMALL LETTER OMEGA WITH PERISPOMENI +\setcclcuc 1FF7 1FF7 1FF7 % GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI +\setcclcuc 1FF8 1F78 1FF8 % GREEK CAPITAL LETTER OMICRON WITH VARIA +\setcclcuc 1FF9 1F79 1FF9 % GREEK CAPITAL LETTER OMICRON WITH OXIA +\setcclcuc 1FFA 1F7C 1FFA % GREEK CAPITAL LETTER OMEGA WITH VARIA +\setcclcuc 1FFB 1F7D 1FFB % GREEK CAPITAL LETTER OMEGA WITH OXIA +\setcclcuc 1FFC 1FF3 1FFC % GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI +\setcclcuc 2071 2071 2071 % SUPERSCRIPT LATIN SMALL LETTER I +\setcclcuc 207F 207F 207F % SUPERSCRIPT LATIN SMALL LETTER N +\setcclcuc 2102 2102 2102 % DOUBLE-STRUCK CAPITAL C +\setcclcuc 2107 2107 2107 % EULER CONSTANT +\setcclcuc 210A 210A 210A % SCRIPT SMALL G +\setcclcuc 210B 210B 210B % SCRIPT CAPITAL H +\setcclcuc 210C 210C 210C % BLACK-LETTER CAPITAL H +\setcclcuc 210D 210D 210D % DOUBLE-STRUCK CAPITAL H +\setcclcuc 210E 210E 210E % PLANCK CONSTANT +\setcclcuc 210F 210F 210F % PLANCK CONSTANT OVER TWO PI +\setcclcuc 2110 2110 2110 % SCRIPT CAPITAL I +\setcclcuc 2111 2111 2111 % BLACK-LETTER CAPITAL I +\setcclcuc 2112 2112 2112 % SCRIPT CAPITAL L +\setcclcuc 2113 2113 2113 % SCRIPT SMALL L +\setcclcuc 2115 2115 2115 % DOUBLE-STRUCK CAPITAL N +\setcclcuc 2119 2119 2119 % DOUBLE-STRUCK CAPITAL P +\setcclcuc 211A 211A 211A % DOUBLE-STRUCK CAPITAL Q +\setcclcuc 211B 211B 211B % SCRIPT CAPITAL R +\setcclcuc 211C 211C 211C % BLACK-LETTER CAPITAL R +\setcclcuc 211D 211D 211D % DOUBLE-STRUCK CAPITAL R +\setcclcuc 2124 2124 2124 % DOUBLE-STRUCK CAPITAL Z +\setcclcuc 2126 03C9 2126 % OHM SIGN +\setcclcuc 2128 2128 2128 % BLACK-LETTER CAPITAL Z +\setcclcuc 212A 006B 212A % KELVIN SIGN +\setcclcuc 212B 00E5 212B % ANGSTROM SIGN +\setcclcuc 212C 212C 212C % SCRIPT CAPITAL B +\setcclcuc 212D 212D 212D % BLACK-LETTER CAPITAL C +\setcclcuc 212F 212F 212F % SCRIPT SMALL E +\setcclcuc 2130 2130 2130 % SCRIPT CAPITAL E +\setcclcuc 2131 2131 2131 % SCRIPT CAPITAL F +\setcclcuc 2132 214E 2132 % TURNED CAPITAL F +\setcclcuc 2133 2133 2133 % SCRIPT CAPITAL M +\setcclcuc 2134 2134 2134 % SCRIPT SMALL O +\setcclcuc 2139 2139 2139 % INFORMATION SOURCE +\setcclcuc 213C 213C 213C % DOUBLE-STRUCK SMALL PI +\setcclcuc 213D 213D 213D % DOUBLE-STRUCK SMALL GAMMA +\setcclcuc 213E 213E 213E % DOUBLE-STRUCK CAPITAL GAMMA +\setcclcuc 213F 213F 213F % DOUBLE-STRUCK CAPITAL PI +\setcclcuc 2145 2145 2145 % DOUBLE-STRUCK ITALIC CAPITAL D +\setcclcuc 2146 2146 2146 % DOUBLE-STRUCK ITALIC SMALL D +\setcclcuc 2147 2147 2147 % DOUBLE-STRUCK ITALIC SMALL E +\setcclcuc 2148 2148 2148 % DOUBLE-STRUCK ITALIC SMALL I +\setcclcuc 2149 2149 2149 % DOUBLE-STRUCK ITALIC SMALL J +\setcclcuc 214E 214E 2132 % TURNED SMALL F +\setcclcuc 2183 2184 2183 % ROMAN NUMERAL REVERSED ONE HUNDRED +\setcclcuc 2184 2184 2183 % LATIN SMALL LETTER REVERSED C +\setcclcuc 2C00 2C30 2C00 % GLAGOLITIC CAPITAL LETTER AZU +\setcclcuc 2C01 2C31 2C01 % GLAGOLITIC CAPITAL LETTER BUKY +\setcclcuc 2C02 2C32 2C02 % GLAGOLITIC CAPITAL LETTER VEDE +\setcclcuc 2C03 2C33 2C03 % GLAGOLITIC CAPITAL LETTER GLAGOLI +\setcclcuc 2C04 2C34 2C04 % GLAGOLITIC CAPITAL LETTER DOBRO +\setcclcuc 2C05 2C35 2C05 % GLAGOLITIC CAPITAL LETTER YESTU +\setcclcuc 2C06 2C36 2C06 % GLAGOLITIC CAPITAL LETTER ZHIVETE +\setcclcuc 2C07 2C37 2C07 % GLAGOLITIC CAPITAL LETTER DZELO +\setcclcuc 2C08 2C38 2C08 % GLAGOLITIC CAPITAL LETTER ZEMLJA +\setcclcuc 2C09 2C39 2C09 % GLAGOLITIC CAPITAL LETTER IZHE +\setcclcuc 2C0A 2C3A 2C0A % GLAGOLITIC CAPITAL LETTER INITIAL IZHE +\setcclcuc 2C0B 2C3B 2C0B % GLAGOLITIC CAPITAL LETTER I +\setcclcuc 2C0C 2C3C 2C0C % GLAGOLITIC CAPITAL LETTER DJERVI +\setcclcuc 2C0D 2C3D 2C0D % GLAGOLITIC CAPITAL LETTER KAKO +\setcclcuc 2C0E 2C3E 2C0E % GLAGOLITIC CAPITAL LETTER LJUDIJE +\setcclcuc 2C0F 2C3F 2C0F % GLAGOLITIC CAPITAL LETTER MYSLITE +\setcclcuc 2C10 2C40 2C10 % GLAGOLITIC CAPITAL LETTER NASHI +\setcclcuc 2C11 2C41 2C11 % GLAGOLITIC CAPITAL LETTER ONU +\setcclcuc 2C12 2C42 2C12 % GLAGOLITIC CAPITAL LETTER POKOJI +\setcclcuc 2C13 2C43 2C13 % GLAGOLITIC CAPITAL LETTER RITSI +\setcclcuc 2C14 2C44 2C14 % GLAGOLITIC CAPITAL LETTER SLOVO +\setcclcuc 2C15 2C45 2C15 % GLAGOLITIC CAPITAL LETTER TVRIDO +\setcclcuc 2C16 2C46 2C16 % GLAGOLITIC CAPITAL LETTER UKU +\setcclcuc 2C17 2C47 2C17 % GLAGOLITIC CAPITAL LETTER FRITU +\setcclcuc 2C18 2C48 2C18 % GLAGOLITIC CAPITAL LETTER HERU +\setcclcuc 2C19 2C49 2C19 % GLAGOLITIC CAPITAL LETTER OTU +\setcclcuc 2C1A 2C4A 2C1A % GLAGOLITIC CAPITAL LETTER PE +\setcclcuc 2C1B 2C4B 2C1B % GLAGOLITIC CAPITAL LETTER SHTA +\setcclcuc 2C1C 2C4C 2C1C % GLAGOLITIC CAPITAL LETTER TSI +\setcclcuc 2C1D 2C4D 2C1D % GLAGOLITIC CAPITAL LETTER CHRIVI +\setcclcuc 2C1E 2C4E 2C1E % GLAGOLITIC CAPITAL LETTER SHA +\setcclcuc 2C1F 2C4F 2C1F % GLAGOLITIC CAPITAL LETTER YERU +\setcclcuc 2C20 2C50 2C20 % GLAGOLITIC CAPITAL LETTER YERI +\setcclcuc 2C21 2C51 2C21 % GLAGOLITIC CAPITAL LETTER YATI +\setcclcuc 2C22 2C52 2C22 % GLAGOLITIC CAPITAL LETTER SPIDERY HA +\setcclcuc 2C23 2C53 2C23 % GLAGOLITIC CAPITAL LETTER YU +\setcclcuc 2C24 2C54 2C24 % GLAGOLITIC CAPITAL LETTER SMALL YUS +\setcclcuc 2C25 2C55 2C25 % GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL +\setcclcuc 2C26 2C56 2C26 % GLAGOLITIC CAPITAL LETTER YO +\setcclcuc 2C27 2C57 2C27 % GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS +\setcclcuc 2C28 2C58 2C28 % GLAGOLITIC CAPITAL LETTER BIG YUS +\setcclcuc 2C29 2C59 2C29 % GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS +\setcclcuc 2C2A 2C5A 2C2A % GLAGOLITIC CAPITAL LETTER FITA +\setcclcuc 2C2B 2C5B 2C2B % GLAGOLITIC CAPITAL LETTER IZHITSA +\setcclcuc 2C2C 2C5C 2C2C % GLAGOLITIC CAPITAL LETTER SHTAPIC +\setcclcuc 2C2D 2C5D 2C2D % GLAGOLITIC CAPITAL LETTER TROKUTASTI A +\setcclcuc 2C2E 2C5E 2C2E % GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE +\setcclcuc 2C30 2C30 2C00 % GLAGOLITIC SMALL LETTER AZU +\setcclcuc 2C31 2C31 2C01 % GLAGOLITIC SMALL LETTER BUKY +\setcclcuc 2C32 2C32 2C02 % GLAGOLITIC SMALL LETTER VEDE +\setcclcuc 2C33 2C33 2C03 % GLAGOLITIC SMALL LETTER GLAGOLI +\setcclcuc 2C34 2C34 2C04 % GLAGOLITIC SMALL LETTER DOBRO +\setcclcuc 2C35 2C35 2C05 % GLAGOLITIC SMALL LETTER YESTU +\setcclcuc 2C36 2C36 2C06 % GLAGOLITIC SMALL LETTER ZHIVETE +\setcclcuc 2C37 2C37 2C07 % GLAGOLITIC SMALL LETTER DZELO +\setcclcuc 2C38 2C38 2C08 % GLAGOLITIC SMALL LETTER ZEMLJA +\setcclcuc 2C39 2C39 2C09 % GLAGOLITIC SMALL LETTER IZHE +\setcclcuc 2C3A 2C3A 2C0A % GLAGOLITIC SMALL LETTER INITIAL IZHE +\setcclcuc 2C3B 2C3B 2C0B % GLAGOLITIC SMALL LETTER I +\setcclcuc 2C3C 2C3C 2C0C % GLAGOLITIC SMALL LETTER DJERVI +\setcclcuc 2C3D 2C3D 2C0D % GLAGOLITIC SMALL LETTER KAKO +\setcclcuc 2C3E 2C3E 2C0E % GLAGOLITIC SMALL LETTER LJUDIJE +\setcclcuc 2C3F 2C3F 2C0F % GLAGOLITIC SMALL LETTER MYSLITE +\setcclcuc 2C40 2C40 2C10 % GLAGOLITIC SMALL LETTER NASHI +\setcclcuc 2C41 2C41 2C11 % GLAGOLITIC SMALL LETTER ONU +\setcclcuc 2C42 2C42 2C12 % GLAGOLITIC SMALL LETTER POKOJI +\setcclcuc 2C43 2C43 2C13 % GLAGOLITIC SMALL LETTER RITSI +\setcclcuc 2C44 2C44 2C14 % GLAGOLITIC SMALL LETTER SLOVO +\setcclcuc 2C45 2C45 2C15 % GLAGOLITIC SMALL LETTER TVRIDO +\setcclcuc 2C46 2C46 2C16 % GLAGOLITIC SMALL LETTER UKU +\setcclcuc 2C47 2C47 2C17 % GLAGOLITIC SMALL LETTER FRITU +\setcclcuc 2C48 2C48 2C18 % GLAGOLITIC SMALL LETTER HERU +\setcclcuc 2C49 2C49 2C19 % GLAGOLITIC SMALL LETTER OTU +\setcclcuc 2C4A 2C4A 2C1A % GLAGOLITIC SMALL LETTER PE +\setcclcuc 2C4B 2C4B 2C1B % GLAGOLITIC SMALL LETTER SHTA +\setcclcuc 2C4C 2C4C 2C1C % GLAGOLITIC SMALL LETTER TSI +\setcclcuc 2C4D 2C4D 2C1D % GLAGOLITIC SMALL LETTER CHRIVI +\setcclcuc 2C4E 2C4E 2C1E % GLAGOLITIC SMALL LETTER SHA +\setcclcuc 2C4F 2C4F 2C1F % GLAGOLITIC SMALL LETTER YERU +\setcclcuc 2C50 2C50 2C20 % GLAGOLITIC SMALL LETTER YERI +\setcclcuc 2C51 2C51 2C21 % GLAGOLITIC SMALL LETTER YATI +\setcclcuc 2C52 2C52 2C22 % GLAGOLITIC SMALL LETTER SPIDERY HA +\setcclcuc 2C53 2C53 2C23 % GLAGOLITIC SMALL LETTER YU +\setcclcuc 2C54 2C54 2C24 % GLAGOLITIC SMALL LETTER SMALL YUS +\setcclcuc 2C55 2C55 2C25 % GLAGOLITIC SMALL LETTER SMALL YUS WITH TAIL +\setcclcuc 2C56 2C56 2C26 % GLAGOLITIC SMALL LETTER YO +\setcclcuc 2C57 2C57 2C27 % GLAGOLITIC SMALL LETTER IOTATED SMALL YUS +\setcclcuc 2C58 2C58 2C28 % GLAGOLITIC SMALL LETTER BIG YUS +\setcclcuc 2C59 2C59 2C29 % GLAGOLITIC SMALL LETTER IOTATED BIG YUS +\setcclcuc 2C5A 2C5A 2C2A % GLAGOLITIC SMALL LETTER FITA +\setcclcuc 2C5B 2C5B 2C2B % GLAGOLITIC SMALL LETTER IZHITSA +\setcclcuc 2C5C 2C5C 2C2C % GLAGOLITIC SMALL LETTER SHTAPIC +\setcclcuc 2C5D 2C5D 2C2D % GLAGOLITIC SMALL LETTER TROKUTASTI A +\setcclcuc 2C5E 2C5E 2C2E % GLAGOLITIC SMALL LETTER LATINATE MYSLITE +\setcclcuc 2C60 2C61 2C60 % LATIN CAPITAL LETTER L WITH DOUBLE BAR +\setcclcuc 2C61 2C61 2C60 % LATIN SMALL LETTER L WITH DOUBLE BAR +\setcclcuc 2C62 026B 2C62 % LATIN CAPITAL LETTER L WITH MIDDLE TILDE +\setcclcuc 2C63 1D7D 2C63 % LATIN CAPITAL LETTER P WITH STROKE +\setcclcuc 2C64 027D 2C64 % LATIN CAPITAL LETTER R WITH TAIL +\setcclcuc 2C65 2C65 023A % LATIN SMALL LETTER A WITH STROKE +\setcclcuc 2C66 2C66 023E % LATIN SMALL LETTER T WITH DIAGONAL STROKE +\setcclcuc 2C67 2C68 2C67 % LATIN CAPITAL LETTER H WITH DESCENDER +\setcclcuc 2C68 2C68 2C67 % LATIN SMALL LETTER H WITH DESCENDER +\setcclcuc 2C69 2C6A 2C69 % LATIN CAPITAL LETTER K WITH DESCENDER +\setcclcuc 2C6A 2C6A 2C69 % LATIN SMALL LETTER K WITH DESCENDER +\setcclcuc 2C6B 2C6C 2C6B % LATIN CAPITAL LETTER Z WITH DESCENDER +\setcclcuc 2C6C 2C6C 2C6B % LATIN SMALL LETTER Z WITH DESCENDER +\setcclcuc 2C74 2C74 2C74 % LATIN SMALL LETTER V WITH CURL +\setcclcuc 2C75 2C76 2C75 % LATIN CAPITAL LETTER HALF H +\setcclcuc 2C76 2C76 2C75 % LATIN SMALL LETTER HALF H +\setcclcuc 2C77 2C77 2C77 % LATIN SMALL LETTER TAILLESS PHI +\setcclcuc 2C80 2C81 2C80 % COPTIC CAPITAL LETTER ALFA +\setcclcuc 2C81 2C81 2C80 % COPTIC SMALL LETTER ALFA +\setcclcuc 2C82 2C83 2C82 % COPTIC CAPITAL LETTER VIDA +\setcclcuc 2C83 2C83 2C82 % COPTIC SMALL LETTER VIDA +\setcclcuc 2C84 2C85 2C84 % COPTIC CAPITAL LETTER GAMMA +\setcclcuc 2C85 2C85 2C84 % COPTIC SMALL LETTER GAMMA +\setcclcuc 2C86 2C87 2C86 % COPTIC CAPITAL LETTER DALDA +\setcclcuc 2C87 2C87 2C86 % COPTIC SMALL LETTER DALDA +\setcclcuc 2C88 2C89 2C88 % COPTIC CAPITAL LETTER EIE +\setcclcuc 2C89 2C89 2C88 % COPTIC SMALL LETTER EIE +\setcclcuc 2C8A 2C8B 2C8A % COPTIC CAPITAL LETTER SOU +\setcclcuc 2C8B 2C8B 2C8A % COPTIC SMALL LETTER SOU +\setcclcuc 2C8C 2C8D 2C8C % COPTIC CAPITAL LETTER ZATA +\setcclcuc 2C8D 2C8D 2C8C % COPTIC SMALL LETTER ZATA +\setcclcuc 2C8E 2C8F 2C8E % COPTIC CAPITAL LETTER HATE +\setcclcuc 2C8F 2C8F 2C8E % COPTIC SMALL LETTER HATE +\setcclcuc 2C90 2C91 2C90 % COPTIC CAPITAL LETTER THETHE +\setcclcuc 2C91 2C91 2C90 % COPTIC SMALL LETTER THETHE +\setcclcuc 2C92 2C93 2C92 % COPTIC CAPITAL LETTER IAUDA +\setcclcuc 2C93 2C93 2C92 % COPTIC SMALL LETTER IAUDA +\setcclcuc 2C94 2C95 2C94 % COPTIC CAPITAL LETTER KAPA +\setcclcuc 2C95 2C95 2C94 % COPTIC SMALL LETTER KAPA +\setcclcuc 2C96 2C97 2C96 % COPTIC CAPITAL LETTER LAULA +\setcclcuc 2C97 2C97 2C96 % COPTIC SMALL LETTER LAULA +\setcclcuc 2C98 2C99 2C98 % COPTIC CAPITAL LETTER MI +\setcclcuc 2C99 2C99 2C98 % COPTIC SMALL LETTER MI +\setcclcuc 2C9A 2C9B 2C9A % COPTIC CAPITAL LETTER NI +\setcclcuc 2C9B 2C9B 2C9A % COPTIC SMALL LETTER NI +\setcclcuc 2C9C 2C9D 2C9C % COPTIC CAPITAL LETTER KSI +\setcclcuc 2C9D 2C9D 2C9C % COPTIC SMALL LETTER KSI +\setcclcuc 2C9E 2C9F 2C9E % COPTIC CAPITAL LETTER O +\setcclcuc 2C9F 2C9F 2C9E % COPTIC SMALL LETTER O +\setcclcuc 2CA0 2CA1 2CA0 % COPTIC CAPITAL LETTER PI +\setcclcuc 2CA1 2CA1 2CA0 % COPTIC SMALL LETTER PI +\setcclcuc 2CA2 2CA3 2CA2 % COPTIC CAPITAL LETTER RO +\setcclcuc 2CA3 2CA3 2CA2 % COPTIC SMALL LETTER RO +\setcclcuc 2CA4 2CA5 2CA4 % COPTIC CAPITAL LETTER SIMA +\setcclcuc 2CA5 2CA5 2CA4 % COPTIC SMALL LETTER SIMA +\setcclcuc 2CA6 2CA7 2CA6 % COPTIC CAPITAL LETTER TAU +\setcclcuc 2CA7 2CA7 2CA6 % COPTIC SMALL LETTER TAU +\setcclcuc 2CA8 2CA9 2CA8 % COPTIC CAPITAL LETTER UA +\setcclcuc 2CA9 2CA9 2CA8 % COPTIC SMALL LETTER UA +\setcclcuc 2CAA 2CAB 2CAA % COPTIC CAPITAL LETTER FI +\setcclcuc 2CAB 2CAB 2CAA % COPTIC SMALL LETTER FI +\setcclcuc 2CAC 2CAD 2CAC % COPTIC CAPITAL LETTER KHI +\setcclcuc 2CAD 2CAD 2CAC % COPTIC SMALL LETTER KHI +\setcclcuc 2CAE 2CAF 2CAE % COPTIC CAPITAL LETTER PSI +\setcclcuc 2CAF 2CAF 2CAE % COPTIC SMALL LETTER PSI +\setcclcuc 2CB0 2CB1 2CB0 % COPTIC CAPITAL LETTER OOU +\setcclcuc 2CB1 2CB1 2CB0 % COPTIC SMALL LETTER OOU +\setcclcuc 2CB2 2CB3 2CB2 % COPTIC CAPITAL LETTER DIALECT-P ALEF +\setcclcuc 2CB3 2CB3 2CB2 % COPTIC SMALL LETTER DIALECT-P ALEF +\setcclcuc 2CB4 2CB5 2CB4 % COPTIC CAPITAL LETTER OLD COPTIC AIN +\setcclcuc 2CB5 2CB5 2CB4 % COPTIC SMALL LETTER OLD COPTIC AIN +\setcclcuc 2CB6 2CB7 2CB6 % COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE +\setcclcuc 2CB7 2CB7 2CB6 % COPTIC SMALL LETTER CRYPTOGRAMMIC EIE +\setcclcuc 2CB8 2CB9 2CB8 % COPTIC CAPITAL LETTER DIALECT-P KAPA +\setcclcuc 2CB9 2CB9 2CB8 % COPTIC SMALL LETTER DIALECT-P KAPA +\setcclcuc 2CBA 2CBB 2CBA % COPTIC CAPITAL LETTER DIALECT-P NI +\setcclcuc 2CBB 2CBB 2CBA % COPTIC SMALL LETTER DIALECT-P NI +\setcclcuc 2CBC 2CBD 2CBC % COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI +\setcclcuc 2CBD 2CBD 2CBC % COPTIC SMALL LETTER CRYPTOGRAMMIC NI +\setcclcuc 2CBE 2CBF 2CBE % COPTIC CAPITAL LETTER OLD COPTIC OOU +\setcclcuc 2CBF 2CBF 2CBE % COPTIC SMALL LETTER OLD COPTIC OOU +\setcclcuc 2CC0 2CC1 2CC0 % COPTIC CAPITAL LETTER SAMPI +\setcclcuc 2CC1 2CC1 2CC0 % COPTIC SMALL LETTER SAMPI +\setcclcuc 2CC2 2CC3 2CC2 % COPTIC CAPITAL LETTER CROSSED SHEI +\setcclcuc 2CC3 2CC3 2CC2 % COPTIC SMALL LETTER CROSSED SHEI +\setcclcuc 2CC4 2CC5 2CC4 % COPTIC CAPITAL LETTER OLD COPTIC SHEI +\setcclcuc 2CC5 2CC5 2CC4 % COPTIC SMALL LETTER OLD COPTIC SHEI +\setcclcuc 2CC6 2CC7 2CC6 % COPTIC CAPITAL LETTER OLD COPTIC ESH +\setcclcuc 2CC7 2CC7 2CC6 % COPTIC SMALL LETTER OLD COPTIC ESH +\setcclcuc 2CC8 2CC9 2CC8 % COPTIC CAPITAL LETTER AKHMIMIC KHEI +\setcclcuc 2CC9 2CC9 2CC8 % COPTIC SMALL LETTER AKHMIMIC KHEI +\setcclcuc 2CCA 2CCB 2CCA % COPTIC CAPITAL LETTER DIALECT-P HORI +\setcclcuc 2CCB 2CCB 2CCA % COPTIC SMALL LETTER DIALECT-P HORI +\setcclcuc 2CCC 2CCD 2CCC % COPTIC CAPITAL LETTER OLD COPTIC HORI +\setcclcuc 2CCD 2CCD 2CCC % COPTIC SMALL LETTER OLD COPTIC HORI +\setcclcuc 2CCE 2CCF 2CCE % COPTIC CAPITAL LETTER OLD COPTIC HA +\setcclcuc 2CCF 2CCF 2CCE % COPTIC SMALL LETTER OLD COPTIC HA +\setcclcuc 2CD0 2CD1 2CD0 % COPTIC CAPITAL LETTER L-SHAPED HA +\setcclcuc 2CD1 2CD1 2CD0 % COPTIC SMALL LETTER L-SHAPED HA +\setcclcuc 2CD2 2CD3 2CD2 % COPTIC CAPITAL LETTER OLD COPTIC HEI +\setcclcuc 2CD3 2CD3 2CD2 % COPTIC SMALL LETTER OLD COPTIC HEI +\setcclcuc 2CD4 2CD5 2CD4 % COPTIC CAPITAL LETTER OLD COPTIC HAT +\setcclcuc 2CD5 2CD5 2CD4 % COPTIC SMALL LETTER OLD COPTIC HAT +\setcclcuc 2CD6 2CD7 2CD6 % COPTIC CAPITAL LETTER OLD COPTIC GANGIA +\setcclcuc 2CD7 2CD7 2CD6 % COPTIC SMALL LETTER OLD COPTIC GANGIA +\setcclcuc 2CD8 2CD9 2CD8 % COPTIC CAPITAL LETTER OLD COPTIC DJA +\setcclcuc 2CD9 2CD9 2CD8 % COPTIC SMALL LETTER OLD COPTIC DJA +\setcclcuc 2CDA 2CDB 2CDA % COPTIC CAPITAL LETTER OLD COPTIC SHIMA +\setcclcuc 2CDB 2CDB 2CDA % COPTIC SMALL LETTER OLD COPTIC SHIMA +\setcclcuc 2CDC 2CDD 2CDC % COPTIC CAPITAL LETTER OLD NUBIAN SHIMA +\setcclcuc 2CDD 2CDD 2CDC % COPTIC SMALL LETTER OLD NUBIAN SHIMA +\setcclcuc 2CDE 2CDF 2CDE % COPTIC CAPITAL LETTER OLD NUBIAN NGI +\setcclcuc 2CDF 2CDF 2CDE % COPTIC SMALL LETTER OLD NUBIAN NGI +\setcclcuc 2CE0 2CE1 2CE0 % COPTIC CAPITAL LETTER OLD NUBIAN NYI +\setcclcuc 2CE1 2CE1 2CE0 % COPTIC SMALL LETTER OLD NUBIAN NYI +\setcclcuc 2CE2 2CE3 2CE2 % COPTIC CAPITAL LETTER OLD NUBIAN WAU +\setcclcuc 2CE3 2CE3 2CE2 % COPTIC SMALL LETTER OLD NUBIAN WAU +\setcclcuc 2CE4 2CE4 2CE4 % COPTIC SYMBOL KAI +\setcclcuc 2D00 2D00 10A0 % GEORGIAN SMALL LETTER AN +\setcclcuc 2D01 2D01 10A1 % GEORGIAN SMALL LETTER BAN +\setcclcuc 2D02 2D02 10A2 % GEORGIAN SMALL LETTER GAN +\setcclcuc 2D03 2D03 10A3 % GEORGIAN SMALL LETTER DON +\setcclcuc 2D04 2D04 10A4 % GEORGIAN SMALL LETTER EN +\setcclcuc 2D05 2D05 10A5 % GEORGIAN SMALL LETTER VIN +\setcclcuc 2D06 2D06 10A6 % GEORGIAN SMALL LETTER ZEN +\setcclcuc 2D07 2D07 10A7 % GEORGIAN SMALL LETTER TAN +\setcclcuc 2D08 2D08 10A8 % GEORGIAN SMALL LETTER IN +\setcclcuc 2D09 2D09 10A9 % GEORGIAN SMALL LETTER KAN +\setcclcuc 2D0A 2D0A 10AA % GEORGIAN SMALL LETTER LAS +\setcclcuc 2D0B 2D0B 10AB % GEORGIAN SMALL LETTER MAN +\setcclcuc 2D0C 2D0C 10AC % GEORGIAN SMALL LETTER NAR +\setcclcuc 2D0D 2D0D 10AD % GEORGIAN SMALL LETTER ON +\setcclcuc 2D0E 2D0E 10AE % GEORGIAN SMALL LETTER PAR +\setcclcuc 2D0F 2D0F 10AF % GEORGIAN SMALL LETTER ZHAR +\setcclcuc 2D10 2D10 10B0 % GEORGIAN SMALL LETTER RAE +\setcclcuc 2D11 2D11 10B1 % GEORGIAN SMALL LETTER SAN +\setcclcuc 2D12 2D12 10B2 % GEORGIAN SMALL LETTER TAR +\setcclcuc 2D13 2D13 10B3 % GEORGIAN SMALL LETTER UN +\setcclcuc 2D14 2D14 10B4 % GEORGIAN SMALL LETTER PHAR +\setcclcuc 2D15 2D15 10B5 % GEORGIAN SMALL LETTER KHAR +\setcclcuc 2D16 2D16 10B6 % GEORGIAN SMALL LETTER GHAN +\setcclcuc 2D17 2D17 10B7 % GEORGIAN SMALL LETTER QAR +\setcclcuc 2D18 2D18 10B8 % GEORGIAN SMALL LETTER SHIN +\setcclcuc 2D19 2D19 10B9 % GEORGIAN SMALL LETTER CHIN +\setcclcuc 2D1A 2D1A 10BA % GEORGIAN SMALL LETTER CAN +\setcclcuc 2D1B 2D1B 10BB % GEORGIAN SMALL LETTER JIL +\setcclcuc 2D1C 2D1C 10BC % GEORGIAN SMALL LETTER CIL +\setcclcuc 2D1D 2D1D 10BD % GEORGIAN SMALL LETTER CHAR +\setcclcuc 2D1E 2D1E 10BE % GEORGIAN SMALL LETTER XAN +\setcclcuc 2D1F 2D1F 10BF % GEORGIAN SMALL LETTER JHAN +\setcclcuc 2D20 2D20 10C0 % GEORGIAN SMALL LETTER HAE +\setcclcuc 2D21 2D21 10C1 % GEORGIAN SMALL LETTER HE +\setcclcuc 2D22 2D22 10C2 % GEORGIAN SMALL LETTER HIE +\setcclcuc 2D23 2D23 10C3 % GEORGIAN SMALL LETTER WE +\setcclcuc 2D24 2D24 10C4 % GEORGIAN SMALL LETTER HAR +\setcclcuc 2D25 2D25 10C5 % GEORGIAN SMALL LETTER HOE +\setcclcuc FB00 FB00 FB00 % LATIN SMALL LIGATURE FF +\setcclcuc FB01 FB01 FB01 % LATIN SMALL LIGATURE FI +\setcclcuc FB02 FB02 FB02 % LATIN SMALL LIGATURE FL +\setcclcuc FB03 FB03 FB03 % LATIN SMALL LIGATURE FFI +\setcclcuc FB04 FB04 FB04 % LATIN SMALL LIGATURE FFL +\setcclcuc FB05 FB05 FB05 % LATIN SMALL LIGATURE LONG S T +\setcclcuc FB06 FB06 FB06 % LATIN SMALL LIGATURE ST +\setcclcuc FB13 FB13 FB13 % ARMENIAN SMALL LIGATURE MEN NOW +\setcclcuc FB14 FB14 FB14 % ARMENIAN SMALL LIGATURE MEN ECH +\setcclcuc FB15 FB15 FB15 % ARMENIAN SMALL LIGATURE MEN INI +\setcclcuc FB16 FB16 FB16 % ARMENIAN SMALL LIGATURE VEW NOW +\setcclcuc FB17 FB17 FB17 % ARMENIAN SMALL LIGATURE MEN XEH +\setcclcuc FF21 FF41 FF21 % FULLWIDTH LATIN CAPITAL LETTER A +\setcclcuc FF22 FF42 FF22 % FULLWIDTH LATIN CAPITAL LETTER B +\setcclcuc FF23 FF43 FF23 % FULLWIDTH LATIN CAPITAL LETTER C +\setcclcuc FF24 FF44 FF24 % FULLWIDTH LATIN CAPITAL LETTER D +\setcclcuc FF25 FF45 FF25 % FULLWIDTH LATIN CAPITAL LETTER E +\setcclcuc FF26 FF46 FF26 % FULLWIDTH LATIN CAPITAL LETTER F +\setcclcuc FF27 FF47 FF27 % FULLWIDTH LATIN CAPITAL LETTER G +\setcclcuc FF28 FF48 FF28 % FULLWIDTH LATIN CAPITAL LETTER H +\setcclcuc FF29 FF49 FF29 % FULLWIDTH LATIN CAPITAL LETTER I +\setcclcuc FF2A FF4A FF2A % FULLWIDTH LATIN CAPITAL LETTER J +\setcclcuc FF2B FF4B FF2B % FULLWIDTH LATIN CAPITAL LETTER K +\setcclcuc FF2C FF4C FF2C % FULLWIDTH LATIN CAPITAL LETTER L +\setcclcuc FF2D FF4D FF2D % FULLWIDTH LATIN CAPITAL LETTER M +\setcclcuc FF2E FF4E FF2E % FULLWIDTH LATIN CAPITAL LETTER N +\setcclcuc FF2F FF4F FF2F % FULLWIDTH LATIN CAPITAL LETTER O +\setcclcuc FF30 FF50 FF30 % FULLWIDTH LATIN CAPITAL LETTER P +\setcclcuc FF31 FF51 FF31 % FULLWIDTH LATIN CAPITAL LETTER Q +\setcclcuc FF32 FF52 FF32 % FULLWIDTH LATIN CAPITAL LETTER R +\setcclcuc FF33 FF53 FF33 % FULLWIDTH LATIN CAPITAL LETTER S +\setcclcuc FF34 FF54 FF34 % FULLWIDTH LATIN CAPITAL LETTER T +\setcclcuc FF35 FF55 FF35 % FULLWIDTH LATIN CAPITAL LETTER U +\setcclcuc FF36 FF56 FF36 % FULLWIDTH LATIN CAPITAL LETTER V +\setcclcuc FF37 FF57 FF37 % FULLWIDTH LATIN CAPITAL LETTER W +\setcclcuc FF38 FF58 FF38 % FULLWIDTH LATIN CAPITAL LETTER X +\setcclcuc FF39 FF59 FF39 % FULLWIDTH LATIN CAPITAL LETTER Y +\setcclcuc FF3A FF5A FF3A % FULLWIDTH LATIN CAPITAL LETTER Z +\setcclcuc FF41 FF41 FF21 % FULLWIDTH LATIN SMALL LETTER A +\setcclcuc FF42 FF42 FF22 % FULLWIDTH LATIN SMALL LETTER B +\setcclcuc FF43 FF43 FF23 % FULLWIDTH LATIN SMALL LETTER C +\setcclcuc FF44 FF44 FF24 % FULLWIDTH LATIN SMALL LETTER D +\setcclcuc FF45 FF45 FF25 % FULLWIDTH LATIN SMALL LETTER E +\setcclcuc FF46 FF46 FF26 % FULLWIDTH LATIN SMALL LETTER F +\setcclcuc FF47 FF47 FF27 % FULLWIDTH LATIN SMALL LETTER G +\setcclcuc FF48 FF48 FF28 % FULLWIDTH LATIN SMALL LETTER H +\setcclcuc FF49 FF49 FF29 % FULLWIDTH LATIN SMALL LETTER I +\setcclcuc FF4A FF4A FF2A % FULLWIDTH LATIN SMALL LETTER J +\setcclcuc FF4B FF4B FF2B % FULLWIDTH LATIN SMALL LETTER K +\setcclcuc FF4C FF4C FF2C % FULLWIDTH LATIN SMALL LETTER L +\setcclcuc FF4D FF4D FF2D % FULLWIDTH LATIN SMALL LETTER M +\setcclcuc FF4E FF4E FF2E % FULLWIDTH LATIN SMALL LETTER N +\setcclcuc FF4F FF4F FF2F % FULLWIDTH LATIN SMALL LETTER O +\setcclcuc FF50 FF50 FF30 % FULLWIDTH LATIN SMALL LETTER P +\setcclcuc FF51 FF51 FF31 % FULLWIDTH LATIN SMALL LETTER Q +\setcclcuc FF52 FF52 FF32 % FULLWIDTH LATIN SMALL LETTER R +\setcclcuc FF53 FF53 FF33 % FULLWIDTH LATIN SMALL LETTER S +\setcclcuc FF54 FF54 FF34 % FULLWIDTH LATIN SMALL LETTER T +\setcclcuc FF55 FF55 FF35 % FULLWIDTH LATIN SMALL LETTER U +\setcclcuc FF56 FF56 FF36 % FULLWIDTH LATIN SMALL LETTER V +\setcclcuc FF57 FF57 FF37 % FULLWIDTH LATIN SMALL LETTER W +\setcclcuc FF58 FF58 FF38 % FULLWIDTH LATIN SMALL LETTER X +\setcclcuc FF59 FF59 FF39 % FULLWIDTH LATIN SMALL LETTER Y +\setcclcuc FF5A FF5A FF3A % FULLWIDTH LATIN SMALL LETTER Z + +\endinput diff --git a/tex/context/base/filt-ini.tex b/tex/context/base/filt-ini.tex index d6e03f968..9e2af2c6e 100644 --- a/tex/context/base/filt-ini.tex +++ b/tex/context/base/filt-ini.tex @@ -64,6 +64,16 @@ 2: filtre -- inconnu \stopmessages +% We need the {\??ot::#1} check because otherwise aleph will crash. Taco's +% torture test: +% +% \ocp\ArabicContext = contextual +% +% \dorecurse {5000} { +% \message{[\recurselevel]} +% \ocplist\Arabic=\addbeforeocplist 1 \ArabicContext \nullocplist +% } + %D \macros %D {definefiltersynonym} @@ -82,11 +92,15 @@ %D \macros %D {definefiltersequence} -\def\definefiltersequence% +\def\definefiltersequence {\dodoubleargument\dodefinefiltersequence} +% \def\dodefinefiltersequence[#1][#2]% +% {\setvalue{\??ot#1}{#2}} + \def\dodefinefiltersequence[#1][#2]% - {\setvalue{\??ot#1}{#2}} + {\setxvalue{\??ot#1}{#2}% + \letgvalue{\??ot::#1}\v!stop} %D \macros %D {usefiltersequence} @@ -121,13 +135,22 @@ \expandafter\noexpand\csname\??or:\!!stringa\endcsname \to \scratchtoks} +% \unexpanded\def\usefiltersequence[#1]% +% {\edef\currentfiltersequence{\getvalue{\??ot#1}}% +% \scratchtoks\emptytoks +% \processcommacommand[\currentfiltersequence]\dodousefiltersequence +% % \showthe\scratchtoks +% \expanded{\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist +% \expanded{\pushocplist\csname\??ot:#1\endcsname}\relax} + \unexpanded\def\usefiltersequence[#1]% - {\edef\currentfiltersequence{\getvalue{\??ot#1}}% - \scratchtoks\emptytoks - \processcommacommand[\currentfiltersequence]\dodousefiltersequence - % \showthe\scratchtoks - \expanded{\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist - \expanded{\pushocplist\csname\??ot:#1\endcsname}\relax} + {\doifdefined{\??ot::#1}% + {\doifvalue{\??ot::#1}\v!stop + {\scratchtoks\emptytoks + \expanded{\processcommalist[\getvalue{\??ot#1}]}\dodousefiltersequence + \expanded{\global\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist + \letgvalue{\??ot::#1}\v!start}% + \expanded{\pushocplist\csname\??ot:#1\endcsname}\relax}} %D \macros %D {usefilter} diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 8e620309e..dda160845 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -64,14 +64,14 @@ \def\savefont {\edef\savedfont{\the\font}% \pushmacro\savedfont - \pushmacro\characterregime + \pushmacro\currentregime \pushmacro\charactermapping \pushmacro\characterencoding} \def\restorefont {\popmacro\characterencoding \popmacro\charactermapping - \popmacro\characterregime + \popmacro\currentregime \popmacro\savedfont \savedfont} @@ -734,6 +734,8 @@ %D although for instance unboxing goes ok. Therefore we %D introduce: +% best can go to math-ini and make \mf a hook then + % better use \dowithnextboxcontent \def\normalmbox @@ -1526,8 +1528,8 @@ %D %D For special purposes, we provide a hook. -\newevery \everyfont \relax -\newevery \everyfontswitch \relax +% \newevery \everyfont \relax +% \newevery \everyfontswitch \relax % safer but sometimes introducing newlines in the log % @@ -2038,14 +2040,14 @@ \def\definefontsize[#1]% sneller met toks {\addtocommalist{#1}\sizelist - \def\docommando##1% - {\def\dodocommando####1% - {\def\dododocommando########1% + \def\docommand##1% + {\def\dodocommand####1% + {\def\dododocommand########1% %{\checkbodyfont{}{########1}{####1}{##1}}% {\checkbodyfont{########1}{####1}{##1}}% - \processcommacommand[\stylelist]\dododocommando}% - \processcommacommand[\alternativelist]\dodocommando}% - \processcommacommand[\sizelist]\docommando} + \processcommacommand[\stylelist]\dododocommand}% + \processcommacommand[\alternativelist]\dodocommand}% + \processcommacommand[\sizelist]\docommand} \def\alternativetextlist{\c!tf,\c!bf,\c!it,\c!sl,\c!bs,\c!bi,\c!sc} \def\alternativemathlist{\c!mr,\c!mi,\c!sy,\c!ex,\c!ma,\c!mb} @@ -2218,12 +2220,12 @@ \def\dododefinebodyfontenvironment[#1][#2][#3]% size class settings {\@@beginfontdef \doifundefined{\??ft#2#1\c!em} % \s!text goes wrong in testing because - {\def\docommando##1% % the 12pt alternative will called when + {\def\docommand##1% % the 12pt alternative will called when {\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}}% - \processcommacommand[\fontsizelist]\docommando + \processcommacommand[\fontsizelist]\docommand \copyparameters [\??ft#2#1][\??ft\s!default] [\c!interlinespace,\c!em]}% @@ -2554,14 +2556,14 @@ % {\let\c!savedtext\c!text % \let\c!text\s!text % \donefalse -% \def\docommando##1% +% \def\docommand##1% % {\doifdefined{\??ft\s!default##1} % {\donetrue % \scratchdimen#1\relax % \scratchdimen\csname\??ft\s!default##1\endcsname\scratchdimen % \normalizebodyfontsize\scratchdimen\to\!!stringa % \letvalue{\??ft#1##1}\!!stringa}}% -% \processcommacommand[\fontsizelist]\docommando +% \processcommacommand[\fontsizelist]\docommand % \let\c!text\c!savedtext % \ifdone % \donefalse @@ -2680,9 +2682,9 @@ %D in other modules. Here we only provide the hooks that %D garantees their handling. -\ifx\everybodyfont\undefined % permits reloading - \newevery \everybodyfont \EveryBodyFont -\fi +% \ifx\everybodyfont\undefined % permits reloading +% \newevery \everybodyfont \EveryBodyFont +% \fi %D At the system level one can initialize thing like: %D @@ -3083,6 +3085,8 @@ % % For Taco: optional fall backs: +\ifx\checkfontclass\undefined \let\checkfontclass\gobbleoneargument \fi % implemented in type-ini + \def\setcurrentfontstyle#1% {%\message{[3 #1]}% \checkfontclass{#1}% @@ -3090,8 +3094,6 @@ \ifmmode\mr\fi % otherwise \rm not downward compatible \synchronizefont} -\let\checkfontclass\gobbleoneargument % implemented in type-ini - \def\setcurrentfontbodyalternative#1#2% {%\message{[4 #1 #2]}% \edef\fontbody{#1}% @@ -3351,10 +3353,10 @@ {\addtocommalist{#2}\stylelist \showmessage\m!fonts8{#2 (#1)}}% % check kan hier - \def\docommando##1% + \def\docommand##1% {\setvalue{\@shortstyle@##1}{#2}% \setvalue{\@style@##1}{\csname#2\endcsname}}% - \processcommalist[#1]\docommando} + \processcommalist[#1]\docommand} \def\definefontstyle {\dodoubleargument\dodefinefontstyle} @@ -3706,8 +3708,8 @@ %D because \PLAIN\ \TEX\ is english anyway. \def\dodefinebodyfontswitch[#1][#2]% - {\def\docommando##1{\setvalue{##1}{\switchtobodyfont[#2]}}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\setvalue{##1}{\switchtobodyfont[#2]}}% + \processcommalist[#1]\docommand} \def\definebodyfontswitch {\dodoubleargument\dodefinebodyfontswitch} @@ -3811,8 +3813,9 @@ % old mechanism % -% \def\infofont% -% {\getvalue{\!!sixpoint\c!tt\c!tf}\the\everybodyfont} +% \def\infofont{\getvalue{\!!sixpoint\c!tt\c!tf}\the\everybodyfont} + +\let\infofont\relax % satisfy dep checker \definefont [infofont] [Mono at 6pt] % todo \the\everybodyfont @@ -3847,11 +3850,11 @@ %D arguments. \def\dodefinealternativestyle[#1][#2][#3]% - {\def\docommando##1% + {\def\docommand##1% {\doifundefined{##1}{\setvalue{##1}{\groupedcommand{#2}{}}}% \setvalue{\@letter@ ##1}{#2}% \setvalue{\@noletter@##1}{#3}}% - \processcommalist[#1]\docommando} + \processcommalist[#1]\docommand} \def\definealternativestyle {\dotripleempty\dodefinealternativestyle} @@ -3920,7 +3923,7 @@ {\doifdefinedelse{#1}\getvalue \firstofoneargument}% {#1}} % {#2}} -\let\doconvertfont=\dodoconvertfont +\let\doconvertfont\dodoconvertfont \def\noconvertfont#1% #2% {\doifdefinedelse{\@noletter@#1} @@ -3978,7 +3981,7 @@ \unexpanded\def\em {\relax - \ifdim\fontdimen1\font>\zeropoint + \ifdim\slantperpoint>\zeropoint \settrue\emneeded \else \setfalse\emneeded @@ -4514,12 +4517,12 @@ \unexpanded\def\moveaccent#1#2% {\smashaccent - {\dimen0\fontdimen5\font + {\dimen0\exheight \dimen2\dimen0 \advance\dimen2 -#1% - \fontdimen5\font\dimen2 + \exheight\dimen2 #2\relax - \fontdimen5\font\dimen0}} + \exheight\dimen0}} %D Personally I think that using \TEX\ is complicated by the %D way fonts are handled. Apart from the many encodings, we diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex index d657aa402..c3fde7791 100644 --- a/tex/context/base/font-run.tex +++ b/tex/context/base/font-run.tex @@ -148,7 +148,7 @@ {\tf\vbox to 2.5em {\vss \hbox to 2.5em - {\dummy\ifdim\fontdimen2\font=\zeropoint + {\dummy\ifdim\interwordspace=\zeropoint \setbox\scratchbox\hbox {\raise.5\dp\scratchbox\hbox {\lower.5\ht\scratchbox\copy\scratchbox}}% @@ -204,7 +204,7 @@ \bgroup \raggedright \switchtobodyfont[#1] - \def\dodocommando##1##2% + \def\dodocommand##1##2% {\starttextrule{\tttf #1 ##1 ##2} \nobreak \getvalue{##2}% \dorecurse{255} @@ -213,9 +213,9 @@ \fi} \par \nobreak \stoptextrule} - \def\docommando##1% - {\getvalue{##1}\processcommacommand[#3]{\dodocommando{##1}}} - \processcommalist[#2]\docommando + \def\docommand##1% + {\getvalue{##1}\processcommacommand[#3]{\dodocommand{##1}}} + \processcommalist[#2]\docommand \egroup \else\ifsecondargument \showfontstyle[#1][#2][\alternativetextlist]% diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex index cef84d0e6..814e4c0e3 100644 --- a/tex/context/base/hand-ini.tex +++ b/tex/context/base/hand-ini.tex @@ -290,12 +290,12 @@ % keep this % \def\redodefineprotrudefactor#1% - % {\ifdim\fontdimen6\font>\protrudethreshold - % \divide\scratchdimen\fontdimen6\font + % {\ifdim\emwidth>\protrudethreshold + % \divide\scratchdimen\emwidth % \multiply\scratchdimen\fontcharwd\handledfont#1\relax % \else % \multiply\scratchdimen\fontcharwd\handledfont#1\relax - % \divide\scratchdimen\fontdimen6\font + % \divide\scratchdimen\emwidth % \fi} % \def\dododefineprotrudefactor#1#2#3% @@ -313,19 +313,19 @@ \def\dododefineprotrudefactor#1#2#3% {\lpcode\handledfont#1\dimexpr#2\lproddimen \ifembasedprotruding \else - \ifdim\fontdimen6\font>\protrudethreshold - /\fontdimen6\font*\fontcharwd\handledfont#1% + \ifdim\emwidth>\protrudethreshold + /\emwidth*\fontcharwd\handledfont#1% \else - *\fontcharwd\handledfont#1/\fontdimen6\font + *\fontcharwd\handledfont#1/\emwidth \fi \fi \relax \rpcode\handledfont#1\dimexpr#3\rproddimen \ifembasedprotruding \else - \ifdim\fontdimen6\font>\protrudethreshold - /\fontdimen6\font*\fontcharwd\handledfont#1% + \ifdim\emwidth>\protrudethreshold + /\emwidth*\fontcharwd\handledfont#1% \else - *\fontcharwd\handledfont#1/\fontdimen6\font + *\fontcharwd\handledfont#1/\emwidth \fi \fi \relax} @@ -339,12 +339,12 @@ \def\protrudethreshold{36\onepoint} \def\redodefineprotrudefactor - {\ifdim\fontdimen6\font>\protrudethreshold - \divide\scratchdimen\fontdimen6\font + {\ifdim\emwidth>\protrudethreshold + \divide\scratchdimen\emwidth \multiply\scratchdimen\wd\charbox \else \multiply\scratchdimen\wd\charbox - \divide\scratchdimen\fontdimen6\font + \divide\scratchdimen\emwidth \fi} \def\dododefineprotrudefactor#1#2#3% diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex index d2821162e..d9fe3c902 100644 --- a/tex/context/base/java-ini.tex +++ b/tex/context/base/java-ini.tex @@ -235,24 +235,6 @@ %D %D After this call, the code is available in \type{\JScode}. -\def\setverbosecscharacter#1% - {\edef#1{\string#1}} - -\def\setverbosecscharacters % temporary hack - {\setverbosecscharacter |\setverbosecscharacter ~% - \setverbosecscharacter\:\setverbosecscharacter\;% - \setverbosecscharacter\+\setverbosecscharacter\-% - \setverbosecscharacter\[\setverbosecscharacter\]% - \setverbosecscharacter\.\setverbosecscharacter\\% - \setverbosecscharacter\)\setverbosecscharacter\(% - \setverbosecscharacter\0\setverbosecscharacter\1% - \setverbosecscharacter\2\setverbosecscharacter\3% - \setverbosecscharacter\4\setverbosecscharacter\5% - \setverbosecscharacter\6\setverbosecscharacter\7% - \setverbosecscharacter\8\setverbosecscharacter\9% - \setverbosecscharacter\n\setverbosecscharacter\s% - \setverbosecscharacter\/} - \newif\ifdirectJScode \def\presetJScode#1#2% #1=operation #2=arguments @@ -267,7 +249,7 @@ \ifx\!!stringa\empty \else \processcommacommand[\!!stringa]\dopresetJSvariables \fi - \def\docommando##1% + \def\docommand##1% {\doifundefinedelse{\r!java\r!java##1} {\showmessage\m!javascript2{##1}} {\useJSpreamblenow{##1}}}% @@ -276,7 +258,7 @@ \def\do##1##2% {\xdef\JScode{\ifdirectJScode#1(\JScode)\else\JScode##2\fi}% %\xdef\JScode{JS\string_N=\the\scratchcounter;\JScode}% - \processcommalist[##1]\docommando}% + \processcommalist[##1]\docommand}% \getvalue{\r!java#1}} \def\dopresetJSvariables#1% @@ -450,7 +432,7 @@ \globallet\JSpreamble\empty \def\@@collectedJSpreamble{\r!java\r!java collected}% \letvalue{\@@collectedJSpreamble}=\empty - \def\docommando##1% + \def\docommand##1% {\xdef\JScode{\getvalue{\r!java\r!java##1}}% \ifoneJSpreamble % \global\letcdcsname \@EA\setxvalue\@EA\@@collectedJSpreamble\@EA @@ -458,7 +440,7 @@ \else \setxvalue{\r!java\r!java##1}{\JScode}% \fi}% - \processcommacommand[\allJSpreambles]\docommando + \processcommacommand[\allJSpreambles]\docommand \ifoneJSpreamble \gdef\allJSpreambles{collected}% \fi @@ -726,14 +708,10 @@ \currentreferenceoperation \currentreferencearguments \egroup - \dostartgoto - \data - {#2}% - \start - \dostartgotoJS\buttonwidth\buttonheight\JScode - \stop - \dostopgotoJS - \dostopgoto + \dohandlegoto + {#2}% + {\dostartgotoJS\buttonwidth\buttonheight\JScode}% + {\dostopgotoJS}% \egroup \else {#2}% diff --git a/tex/context/base/lang-frq.tex b/tex/context/base/lang-frq.tex index 82441f9c0..7c70b7454 100644 --- a/tex/context/base/lang-frq.tex +++ b/tex/context/base/lang-frq.tex @@ -66,17 +66,17 @@ \def\charfreq#1 #2 % character fraction {+(\ifcase\charwidthmethod - #2\dimexpr(100\onepoint)% + #2\dimexpr100\onepoint\relax \or - #2\dimexpr(.5em)% \fontdimen6\font/2 + #2\dimexpr.5em\relax % \emwidth/2 \or - #2\dimexpr(\fontdimen5\font)% + #2\dimexpr\exheight\relax \or #2\fontcharwd\font`#1% \or - \dimexpr(100\fontcharwd\font`#1/\charactertsize\charwidthlanguage)% ugly hack + \dimexpr100\fontcharwd\font`#1/\charactertsize\charwidthlanguage\relax % ugly hack \else - #2\dimexpr(\fontdimen5\font)% + #2\dimexpr\exheight\relax \fi)} %D \macros @@ -123,7 +123,7 @@ \beginTEX - \def\averagecharwidth{\the\fontdimen6\font} + \def\averagecharwidth{\the\emwidth} \endTEX diff --git a/tex/context/base/lang-ger.tex b/tex/context/base/lang-ger.tex index 4434b7dba..211c1bf69 100644 --- a/tex/context/base/lang-ger.tex +++ b/tex/context/base/lang-ger.tex @@ -165,38 +165,6 @@ \installlanguage [norwegian] [\s!no] \installlanguage [norsk] [\s!no] % bonus switch -%% NORWEGIAN -% -% These three letters (in this order) are the -% last in the norwegian alphabet (and hence should -% come after z in the latin alphabet). -% I'm not sure about the syntax for -% \definesortkey so I left some of it open ... -% -% \startlanguagespecifics[\s!no] -% -% \definesortkey {\ae}{z}{b}{\ae} -% \definesortkey {\AE}{z}{b}{\AE} -% \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 -% -% \startencoding[texnansi] -% \startlanguagespecifics[\s!no]% -% \defineactivecharacter æ {\ae{}} -% \defineactivecharacter Æ {\AE{}} -% \defineactivecharacter ø {\o{}} -% \defineactivecharacter Ø {\O{}} -% \defineactivecharacter å {\aa{}} -% \defineactivecharacter Å {\AA{}} -% \stoplanguagespecifics -% \stopencoding - \setupheadtext [\s!en] [\v!content=Contents] \setupheadtext [\s!nl] [\v!content=Inhoud] \setupheadtext [\s!de] [\v!content=Inhalt] diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index f47a4e914..d9f79b6fc 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -20,8 +20,6 @@ \writestatus{loading}{Context Language Macros / Initialization} -\unprotect - \startmessages dutch library: linguals title: taal 1: afbreekpatronen -- voor -- geladen (n=--,e=--,m=--) @@ -136,6 +134,11 @@ 10: motifs -- chargés \stopmessages +\unprotect + +\ifx\nonfrenchspacing\undefined \let\nonfrenchspacing\relax \fi +\ifx\frenchspacing \undefined \let\frenchspacing \relax \fi + %D When loading hyphenation patterns, \TEX\ assign a number to %D each loaded table, starting with~0. Switching to a specific %D table is done by assigning the relevant number to the @@ -344,8 +347,7 @@ \enableregime[utf]} \beginXETEX - \def\setuphyppatencoding - {\pathypsettings} + \def\setuphyppatencoding{\pathypsettings} \endXETEX \def\dodoloadpatterns#1#2#3#4% beware, loaded language also incr @@ -980,4 +982,8 @@ \appendtoks\showmessage\m!linguals9\currentlanguage\to\everyjob +%D Brrr: + +% \ifx\@@ladefault\undefined \let\@@ladefault\s!en \fi + \protect \endinput diff --git a/tex/context/base/lang-lab.tex b/tex/context/base/lang-lab.tex index 350ae2dfc..38af4f783 100644 --- a/tex/context/base/lang-lab.tex +++ b/tex/context/base/lang-lab.tex @@ -48,16 +48,16 @@ \def\setuplabeltext{\dosetupsometextprefix[\c!label]} \def\dosetupsometextprefix - {\let\dodocommando\xdosetupsometextprefix + {\let\dodocommand\xdosetupsometextprefix \dotripleempty\dodosetupsometextprefix} \def\dodosetupsometextprefix[#1][#2][#3]% {\ifthirdargument - \def\docommando##1{\dodocommando[#1#2][##1]}% - \processcommalist[#3]\docommando + \def\docommand##1{\dodocommand[#1#2][##1]}% + \processcommalist[#3]\docommand \else - \def\docommando##1{\dodocommando[#1\currentmainlanguage][##1]}% - \processcommalist[#2]\docommando + \def\docommand##1{\dodocommand[#1\currentmainlanguage][##1]}% + \processcommalist[#2]\docommand \fi} \def\doassignsometextprefix[#1][#2,#3,#4]% @@ -99,6 +99,8 @@ \def\labellanguage{\defaultlanguage\currentmainlanguage} \def\headlanguage {\defaultlanguage\currentmainlanguage} +\appendtoks \let\labellanguage\currentlanguage \to \everycurrentdate + \unexpanded\def\headtext {\let\handletextprefix\firstoftwoarguments \let\reporttextprefixerror\doreporttextprefixerror @@ -216,7 +218,7 @@ {\ifundefined{#1#2}\doassignsometextprefix[#1#2][#3,,]\fi} \def\dopresetsometextprefix - {\let\dodocommando\xdopresetsometextprefix + {\let\dodocommand\xdopresetsometextprefix \dotripleempty\dodosetupsometextprefix} \def\presetheadtext {\dopresetsometextprefix[\c!title]} diff --git a/tex/context/base/lang-mis.tex b/tex/context/base/lang-mis.tex new file mode 100644 index 000000000..5feb6c542 --- /dev/null +++ b/tex/context/base/lang-mis.tex @@ -0,0 +1,853 @@ +%D \module +%D [ file=lang-mis, +%D version=1997.03.20, % used to be supp-lan.tex +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Options, +%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 Language Macros / Compounds} + +%D \gdef\starttest +%D {\blank +%D \noindent +%D \halign\bgroup\tt##\hskip2em&##\hskip2em&##\cr} +%D +%D \gdef\stoptest +%D {\egroup +%D \blank} +%D +%D \gdef\test#1% +%D {\convertargument#1\to\ascii\ascii&\hyphenatedword{#1}\cr} + +\unprotect + +%D One of \TEX's strong points in building paragraphs is the way +%D hyphenations are handled. Although for real good hyphenation +%D of non||english languages some extensions to the program are +%D needed, fairly good results can be reached with the standard +%D mechanisms and an additional macro, at least in Dutch. + +%D \CONTEXT\ originates in the wish to typeset educational +%D materials, especially in a technical environment. In +%D production oriented environments, a lot of compound words +%D are used. Because the Dutch language poses no limits on +%D combining words, we often favor putting dashes between those +%D words, because it facilitates reading, at least for those +%D who are not that accustomed to it. +%D +%D In \TEX\ compound words, separated by a hyphen, are not +%D hyphenated at all. In spite of the multiple pass paragraph +%D typesetting this can lead to parts of words sticking into +%D the margin. The solution lays in saying \type +%D {spoelwater||terugwinunit} instead of \type +%D {spoelwater-terugwinunit}. By using a one character command +%D like \type {|}, delimited by the same character \type {|}, +%D we get ourselves both a decent visualization (in \TEXEDIT\ +%D and colored verbatim we color these commands yellow) and an +%D efficient way of combining words. +%D +%D The sequence \type{||} simply leads to two words connected by +%D a hyphen. Because we want to distinguish such a hyphen from +%D the one inserted when \TEX\ hyphenates a word, we use a bit +%D longer one. +%D +%D \hyphenation {spoel-wa-ter te-rug-win-unit} +%D +%D \starttest +%D \test {spoelwater||terugwinunit} +%D \stoptest +%D +%D As we already said, the \type{|} is a command. This commands +%D accepts an optional argument before it's delimiter, which is +%D also a \type{|}. +%D +%D \hyphenation {po-ly-meer che-mie} +%D +%D \starttest +%D \test {polymeer|*|chemie} +%D \stoptest +%D +%D Arguments like \type{*} are not interpreted and inserted +%D directly, in contrary to arguments like: +%D +%D \starttest +%D \test {polymeer|~|chemie} +%D \test {|(|polymeer|)|chemie} +%D \test {polymeer|(|chemie|)| } +%D \stoptest +%D +%D Although such situations seldom occur |<|we typeset thousands +%D of pages before we encountered one that forced us to enhance +%D this mechanism|>| we also have to take care of comma's. +%D +%D \hyphenation {uit-stel-len} +%D +%D \starttest +%D \test {op||, in|| en uitstellen} +%D \stoptest +%D +%D The next special case (concerning quotes) was brought to my +%D attention by Piet Tutelaers, one of the driving forces +%D behind rebuilding hyphenation patterns for the dutch +%D language.\footnote{In 1996 the spelling of the dutch +%D language has been slightly reformed which made this topic +%D actual again.} We'll also take care of this case. +%D +%D \starttest +%D \test {AOW|'|er} +%D \test {cd|'|tje} +%D \test {ex|-|PTT|'|er} +%D \test {rock|-|'n|-|roller} +%D \stoptest +%D +%D Tobias Burnus pointed out that I should also support +%D something like +%D +%D \starttest +%D \test {well|_|known} +%D \stoptest +%D +%D to stress the compoundness of hyphenated words. +%D +%D Of course we also have to take care of the special case: +%D +%D \starttest +%D \test {text||color and ||font} +%D \stoptest + +%D \macros +%D {installdiscretionaries} +%D +%D The mechanism described here is one of the older inner parts +%D of \CONTEXT. The most recent extensions concerns some +%D special cases as well as the possibility to install other +%D characters as delimiters. The prefered way of specifying +%D compound words is using \type{||}, which is installed by: +%D +%D \starttyping +%D \installdiscretionaries || - +%D \stoptyping +%D +%D Some alternative definitions are: +%D +%D \startbuffer +%D \installdiscretionaries ** - +%D \installdiscretionaries ++ - +%D \installdiscretionaries // - +%D \installdiscretionaries ~~ - +%D \stopbuffer +%D +%D \typebuffer +%D +%D after which we can say: +%D +%D \bgroup +%D \getbuffer +%D \starttest +%D \test {test**test**test} +%D \test {test++test++test} +%D \test {test//test//test} +%D \test {test~~test~~test} +%D \stoptest +%D \egroup + +%D \macros +%D {compoundhyphen, +%D beginofsubsentence,endofsubsentence} +%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. + +\ifx\compoundhyphen \undefined \def\compoundhyphen{\hbox{-\kern-.25ex-}} \fi + +\ifx\beginofsubsentence \undefined \def\beginofsubsentence{\hbox{---}} \fi +\ifx\endofsubsentence \undefined \def\endofsubsentence {\hbox{---}} \fi + +%D The last two variables are needed for subsentences +%D |<|like this one|>| which we did not yet mention. +%D +%D We want to enable breaking but at the same time don't want +%D compound characters like |-| or || to be separated from the +%D words. \TEX\ hackers will recognise the next two macro's: + +\ifx\prewordbreak \undefined \def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi +\ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount\prewordbreak} \fi + +\ifx\hspaceamount \undefined \def\hspaceamount#1#2{\kern.16667em} \fi % language specific + +%D \macros +%D {beginofsubsentencespacing,endofsubsentencespacing} +%D +%D In the previous macros we provided two hooks which can be +%D used to support nested sub||sentences. In \CONTEXT\ these +%D hooks are used to insert a small space when needed. + +\ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi +\ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi + +%D The following piece of code is a torture test compound +%D hndling. The \type {\relax} before the \type {\ifmmode} is +%D needed because of the alignment scanner (in \ETEX\ this +%D problem is not present because there a protected macro is +%D not expanded. Thanks to Tobias Burnus for providing this +%D example. +%D +%D \startformula +%D \left|f(x_n)-{1\over2}\right| = +%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr +%D |x_n-{1\over2}| &for ${1\over2}\zeropoint + (\prewordbreak + \else + \prewordbreak\discretionary{}{(-}{(}\prewordbreak + \fi} + +\definetextmodediscretionary ) + {\ifx\nextnext\blankspace + \prewordbreak)\relax + \else\ifx\nextnext\space + \prewordbreak)\relax + \else + \prewordbreak\discretionary{-)}{}{)}\prewordbreak + \fi\fi} + +\definetextmodediscretionary ' + {\prewordbreak\discretionary{-}{}{'}\postwordbreak} + +\definetextmodediscretionary < + {\beginofsubsentence\prewordbreak\beginofsubsentencespacing} + +\definetextmodediscretionary > + {\endofsubsentencespacing\prewordbreak\endofsubsentence} + +% \definetextmodediscretionary . % not yet definitive +% {\prewordbreak\midsentence\prewordbreak} + +\definetextmodediscretionary = + {\prewordbreak\midsentence\prewordbreak} % {\prewordbreak\compoundhyphen} + +\definetextmodediscretionary ^ + {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}% + \allowbreak\postwordbreak} + +% french + +\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:} +\definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};} +\definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?} +\definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!} + +\definetextmodediscretionary * + {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak} + +% spanish + +\definetextmodediscretionary ?? {\prewordbreak\questiondown} +\definetextmodediscretionary !! {\prewordbreak\exclamdown} + +% \ifx\normalcompound\undefined \let\normalcompound=| \fi + +%D \installdiscretionary | + +%D \installdiscretionary + = + +\def\defaultdiscretionaryhyphen{\compoundhyphen} + +\installdiscretionary | \defaultdiscretionaryhyphen % installs in ctx and prt will fall back on it + +%D \macros +%D {fakecompoundhyphen} +%D +%D In headers and footers as well as in active pieces of text +%D we need a dirty hack. Try to imagine what is needed to +%D savely break the next text across a line and at the same +%D time make the words interactive. +%D +%D \starttyping +%D \goto{Some||Long||Word} +%D \stoptyping + +\def\fakecompoundhyphen + {\def\|{\mathortext\vert\dofakecompoundhyphen}} + +\def\dofakecompoundhyphen + {\def##1|% + {\doifelsenothing{##1}\compoundhyphen{##1}% + \kern\compoundbreakpoint\allowbreak}} + +%D \macros +%D {midworddiscretionary} +%D +%D If needed, one can add a discretionary hyphen using \type +%D {\midworddiscretionary}. This macro does the same as +%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented +%D earlier, this one also looks ahead for spaces and grouping +%D tokens. + +\def\midworddiscretionary + {\futurelet\next\domidworddiscretionary} + +\def\domidworddiscretionary + {\ifx\next\blankspace\else + \ifx\next\bgroup \else + \ifx\next\egroup \else + \discretionary{-}{}{}% + \fi\fi\fi} + +%D \macros +%D {installcompoundcharacter} +%D +%D When Tobias Burnus started translating the dutch manual of +%D \PPCHTEX\ into german, he suggested to let \CONTEXT\ support +%D the \type{german.sty} method of handling compound +%D characters, especially the umlaut. This package is meant for +%D use with \PLAIN\ \TEX\ as well as \LATEX. +%D +%D I decided to implement compound character support as +%D versatile as possible. As a result one can define his own +%D compound character support, like: +%D +%D \starttyping +%D \installcompoundcharacter "a {\"a} +%D \installcompoundcharacter "e {\"e} +%D \installcompoundcharacter "i {\"i} +%D \installcompoundcharacter "u {\"u} +%D \installcompoundcharacter "o {\"o} +%D \installcompoundcharacter "s {\SS} +%D \stoptyping +%D +%D or even +%D +%D \starttyping +%D \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}} +%D \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}} +%D \stoptyping +%D +%D The support is not limited to alphabetic characters, so the +%D next definition is also valid. +%D +%D \starttyping +%D \installcompoundcharacter ". {.\doifnextcharelse{\spacetoken}{}{\kern.125em}} +%D \stoptyping +%D +%D The implementation looks familiar and uses the same tricks as +%D mentioned earlier in this module. We take care of two +%D arguments, which complicates things a bit. + +\def\@nc@{@nc@} % normal character +\def\@cc@{@cc@} % compound character +\def\@cs@{@cs@} % compound characters +\def\@cx@{@cx@} % compound definition + +%D When we started working on MK IV code, we needed a different +%D approach for defining the active character itself. In MK II as +%D well as in MK IV we now use the catcode vectors. + +\chardef\compoundcharactermode\plusone + +\def\installcompoundcharacter #1#2#3 #4% {#4} no grouping + {\ifcase\compoundcharactermode + % ignore mode + \else + \chardef\thecompoundcharacter`#1% + \@EA\chardef\csname\@nc@\string#1\endcsname\thecompoundcharacter + \def\!!stringa{#3}% + \@EA\def\csname\ifx\!!stringa\empty\@cc@\else\@cs@\fi\detokenize{#1#2#3}\endcsname{#4}% + \setevalue{\@cx@\detokenize{#1}}{\noexpand\handlecompoundcharacter{\detokenize{#1}}}% beter nr's +% \@EA\letcatcodecommand\@EA\prtcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname +% \@EA\letcatcodecommand\@EA\texcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname + \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname + \fi} + +%D In order to serve the language specific well, we will introduce +%D a namespace: + +% \ifx\currentlanguage\undefined + \let\compoundcharacterclass\empty +% \else +% \def\compoundcharacterclass{\currentlanguage} +% \fi + +\def\@cc@{@cc@\compoundcharacterclass} % compound character +\def\@cs@{@cs@\compoundcharacterclass} % compound characters + +%D We can also ignore definitions (needed in for instance \XML). Beware, +%D this macro is supposed to be used grouped! + +\def\ignorecompoundcharacter + {\chardef\compoundcharactermode\zerocount} + +\let\restorecompoundcharacter \gobbleoneargument % obsolete +\let\enableactivediscretionaries\relax % obsolete + +%D In handling the compound characters we have to take care of +%D \type{\bgroup} and \type{\egroup} tokens, so we end up with +%D a multi||step interpretation macro. We look ahead for a +%D \type{\bgroup}, \type{\egroup} or \type{\blankspace}. Being +%D no user of this mechanism, the credits for testing them goes +%D to Tobias Burnus, the first german user of \CONTEXT. +%D +%D We define these macros as \type{\long} because we can +%D expect \type{\par} tokens. We need to look into the future +%D with \type{\futurelet} to prevent spaces from +%D disappearing. + +\def\handlecompoundcharacter#1% + {\def\xhandlecompoundcharacter{\dohandlecompoundcharacter{#1}}% + \futurelet\next\xhandlecompoundcharacter} + +\def\dohandlecompoundcharacter + {\ifx\next\bgroup + %\@EA\dodohandlecompoundcharacter % handle "{ee} -> \"ee + %\@EA\gobbleoneargument % forget "{ee} -> ee + \@EA\handlecompoundcharacterone % ignore "{ee} -> "ee + \else\ifx\next\egroup + \@EAEAEA\donohandlecompoundcharacter + \else\ifx\next\blankspace + \@EA\@EAEAEA\@EA\donohandlecompoundcharacter + \else + \@EA\@EAEAEA\@EA\dodohandlecompoundcharacter + \fi\fi\fi} + +\def\donohandlecompoundcharacter#1{\csname\@nc@\string#1\endcsname} + +\def\dododohandlecompoundcharacter + {\ifx\next\bgroup + \@EA\handlecompoundcharacterone + \else\ifx\next\egroup + \@EAEAEA\handlecompoundcharacterone + \else\ifx\next\blankspace + \@EA\@EAEAEA\@EA\handlecompoundcharacterone + \else + \@EA\@EAEAEA\@EA\handlecompoundcharactertwo + \fi\fi\fi} + +\def\dodohandlecompoundcharacter#1#2% preserve space + {\def\xdodohandlecompoundcharacter{\dododohandlecompoundcharacter#1#2}% + \futurelet\next\xdodohandlecompoundcharacter} + +%D Besides taken care of the grouping and space tokens, we have +%D to deal with three situations. First we look if the next +%D character equals the first one, if so, then we just insert +%D the original. Next we look if indeed a compound character is +%D defined. We either execute the compound character or just +%D insert the first. So we have +%D +%D \starttyping +%D +%D \stoptyping +%D +%D In later modules we will see how these commands are used. + +\long\def\handlecompoundcharacterone#1#2% + {\if\string#1\string#2% was: \ifx#1#2% + \def\next{\csname\@nc@\string#1\endcsname}% + \else\ifcsname\@cc@\string#1\string#2\endcsname + \def\next{\csname\@cc@\string#1\string#2\endcsname}% + \else + \def\next{\csname\@nc@\string#1\endcsname#2}% + \fi\fi + \next} + +\long\def\handlecompoundcharactertwo#1#2#3% + {\if\string#1\string#2% + \def\next{\csname\@nc@\string#1\endcsname#3}% + \else\ifcsname\@cs@\string#1\string#2\string#3\endcsname + \def\next{\csname\@cs@\string#1\string#2\string#3\endcsname}% + \else\ifcsname\@cc@\string#1\string#2\endcsname + \def\next{\csname\@cc@\string#1\string#2\endcsname#3}% + \else + \def\next{\csname\@nc@\string#1\endcsname#2#3}% + \fi\fi\fi + \next} + +%D For very obscure applications (see for an application \type +%D {lang-sla.tex}) we provide: + +\def\simplifiedcompoundcharacter#1#2% + {\ifcsname\@cc@\string#1\string#2\endcsname + \@EA\@EA\@EA\firstofoneargument\csname\@cc@\string#1\string#2\endcsname + \else + #2% + \fi} + +%D \macros +%D {disablediscretionaries,disablecompoundcharacter} +%D +%D Occasionally we need to disable this mechanism. For the +%D moment we assume that \type {|} is used. + +\let\disablediscretionaries \ignorediscretionaries +\let\disablecompoundcharacters\ignorecompoundcharacter + +%D \macros +%D {normalcompound} +%D +%D Handy in for instance XML. (Kind of obsolete) + +\ifx\normalcompound\undefined \let\normalcompound=| \fi + +%D ! ! This will be reimplemented !! + +%D \macros +%D {hyphenatedurl} +%D +%D For those who want to put full \URL's in a text, we offer +%D +%D \startbuffer +%D \hyphenatedurl{http://optimist.optimist/optimist/optimist.optimist#optimist} +%D \stopbuffer +%D +%D \typebuffer +%D +%D which breaks at the appropriate places. Watch the \type{#} +%D hack. +%D +%D When passed as argument, like in \type {\goto}, one needs +%D to substitute a \type {\\} for each \type{#}. +%D +%D \startbuffer +%D \hyphenatedurl{http://this.is.a.rather/strange/reference#indeed} +%D \stopbuffer +%D +%D \typebuffer + +\ifx\\\undefined \let\\\crlf \fi + +\chardef\urlsplitmode=1 + +% 0 => don't split +% 1 => . : na, rest voor +% 2 => alles na +% 3 => alles voor + +% \bgroup \catcode`\~=\active \catcode`\/=\active + +% Why not convert to ascii first? I will redo this one! + +\bgroup \catcode`\~=\active \catcode`\/=\active + +\unexpanded\gdef\hyphenatedurl#1% {}{} handles accents + {\bgroup + \ifnum\hyphenpenalty<10000 \else + \def\discretionary##1##2##3{##1\allowbreak##2}% + \fi + \obeyhyphens + \def\splitbefore##1% + {\setbox\scratchbox=\hbox{##1{}{}}% + \ifcase\urlsplitmode + \box\scratchbox + \or + \postwordbreak\box\scratchbox\prewordbreak + \or + \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak + \else + \postwordbreak\box\scratchbox\prewordbreak + \fi}% + \def\splitafter##1% + {\ifcase\urlsplitmode + ##1{}{}% + \or + \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak + \or + \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak + \else + \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak + \fi}% + \def\splitanyway##1% + {\prewordbreak##1\prewordbreak}% + \def\flushurl% + {\savedurl\let\savedurl\empty}% + \def\\% + {\spliturl\#}% + \let\~=\lettertilde\let~=\~% + \let\/=\letterslash\let/=\/% + \let\savedurl\empty + \scratchcounter\zerocount % used for hyphenmethod + \handletokens#1\with\scanurl\savedurl + \egroup} + +\egroup + +%D This would be better, but it spoils \type {\~} and so: +%D +%D \starttyping +%D \convertargument#1\to\ascii +%D \expandafter\handletokens\ascii\with\scanurl +%D \stoptyping + +\chardef\urlhyphenmethod=0 + +\def\scanurl#1% + {\advance\scratchcounter\plusone + \ifx#1\blankspace + \flushurl\splitanyway\normalspace + \else\ifx#1\ % + \flushurl\splitanyway\normalspace + \else\ifx#1\space + \flushurl\splitanyway\normalspace + \else\ifx#1\~% + \flushurl\splitbefore\~% + \else\ifx#1\#% + \flushurl\splitbefore\#% + \else\ifx#1\&% + \flushurl\splitbefore\&% + \else\ifx#1\%% + \flushurl\splitbefore\%% + \else\ifx#1\_% + \flushurl\splitbefore\_% + \else\if\noexpand#1\relax + #1% + \else\ifnum\catcode`#1=8 + \flushurl\splitbefore\_% + \else\ifnum\catcode`#1=6 + \flushurl\splitbefore\#% + \else\ifnum\catcode`#1=4 + \flushurl\splitbefore\&% + \else\expandafter\if\string#1\lettertilde + \flushurl\splitbefore\~% + \else\expandafter\if\string#1\letterpercent + \flushurl\splitbefore\%% + \else\expandafter\if\string#1\letterunderscore + \flushurl\splitbefore\_% + \else\expandafter\if\string#1\letterquestionmark + \flushurl\splitafter\letterquestionmark + \else\expandafter\if\string#1\letterat + \flushurl\splitafter\letterat + \else\expandafter\if\string#1\letterslash + \edef\savedurl{\savedurl\letterslash}% + \else\expandafter\if\string#1+% + \flushurl\splitafter+% + \else\expandafter\if\string#1:% + \flushurl\splitafter:% + \else\expandafter\if\string#1.% + \flushurl\splitafter.% + \else\expandafter\if\string#1(% + \flushurl\splitbefore(% + \else\expandafter\if\string#1)% + \flushurl\splitafter)% + \else + \ifx\savedurl\empty\else + \splitbefore\savedurl + \let\savedurl\empty + \fi + \ifcase\urlhyphenmethod + \string#1% + \else + \ifnum\scratchcounter>\plusthree % so, \http: will not break + \edef\savedurl{\string#1}% + \else + \string#1% + \fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% \setupinteraction[state=start] +% \def\gotoURL#1{\useURL[foo][#1]\goto{\url[foo]}[url(foo)]} +% \starttext +% \endgraf \chardef\urlhyphenmethod=0 +% \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} +% \endgraf \chardef\urlhyphenmethod=1 +% \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} +% \stoptext + +% \useencoding[ffr] +% \mainlanguage[fr] +% \starttext +% \hyphenatedurl{http://somewhere.to/go} +% \stoptext + +%D When Joop Susan asked (on the \CONTEXT\ mailing list) how +%D to handle url's passed as argument, the following solutions +%D came to my mind: +%D +%D \starttyping +%D \def\whateverurl#1% +%D {{\def~{\string~}\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}} +%D +%D \def\whateverurl#1% +%D {{\let~\lettertilde\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}} +%D +%D \def\whateverurl#1% +%D {\convertargument#1\to\ascii +%D \expanded{\useURL[dummy][\ascii]}\goto{\url[dummy]}[URL(dummy)]} +%D \stoptyping + +%D \macros +%D {hyphenatedfile} +%D +%D For the moment we treat filenames in a similar way, +%D +%D \starttyping +%D \hyphenatedfile{here/there/filename.suffix} +%D \stoptyping + +\let\hyphenatedfile\hyphenatedurl + +% to be finished +% +% \def\hyphenatedstring#1% +% {\bgroup +% \nohyphens +% \def\next##1{##1\doif{##1}{-}{\allowbreak}}% +% \handletokens#1\with\next +% \egroup} +% +% {\hsize1cm\hyphenatedstring{ABXXXXXXXXXXC-12345-12345}} + +\protect \endinput diff --git a/tex/context/base/lang-sla.mkii b/tex/context/base/lang-sla.mkii new file mode 100644 index 000000000..62483aeb6 --- /dev/null +++ b/tex/context/base/lang-sla.mkii @@ -0,0 +1,30 @@ +%D \module +%D [ file=lang-sla, +%D version=1999.09.13, % 1997.09.03 +%D title=\CONTEXT\ Language Macros, +%D subtitle=Slavic Languages, +%D author=Hans Hagen / Tobias Burnus, +%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. + +\def\sloveniancharacter#1% + {\ifcase#1\unknowncharacter + \or a\or b\or c\or \ccaron\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% + \or n\or o\or p\or r\or s\or \scaron\or t\or u\or v\or z\or \zcaron + \else + \unknowncharacter + \fi} + +\def\slovenianCharacter#1% + {\ifcase#1\unknowncharacter + \or A\or B\or C\or \Ccaron\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% + \or N\or O\or P\or R\or S\or \Scaron\or T\or U\or V\or Z\or \Zcaron + \else + \unknowncharacter + \fi} + +\endinput diff --git a/tex/context/base/lang-sla.tex b/tex/context/base/lang-sla.tex index f517fe7ff..b9749d930 100644 --- a/tex/context/base/lang-sla.tex +++ b/tex/context/base/lang-sla.tex @@ -90,7 +90,7 @@ \c!rightquote=\upperrightsinglesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, \c!state=\v!stop] \installlanguage @@ -104,7 +104,7 @@ \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}, + \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, \c!state=\v!stop] \installlanguage @@ -275,25 +275,25 @@ \setuplabeltext [\s!sl] [\v!subsubsubsection=] \setuplabeltext [\s!pl] [\v!appendix=] % Dodatek -\setuplabeltext [\s!cz] [\v!appendix=P\rcaron\iacute loha] -\setuplabeltext [\s!sk] [\v!appendix=Pr\iacute loha] +\setuplabeltext [\s!cz] [\v!appendix=P\rcaron\iacute loha ] +\setuplabeltext [\s!sk] [\v!appendix=Pr\iacute loha ] \setuplabeltext [\s!hr] [\v!appendix=Dodatak ] \setuplabeltext [\s!sl] [\v!appendix=Dodatek ] -\setuplabeltext [\s!pl] [\v!part=Ust\eogonek p] -\setuplabeltext [\s!cz] [\v!part=\Ccaron \aacute st] -\setuplabeltext [\s!sk] [\v!part=\Ccaron as\tcaron{}] -\setuplabeltext [\s!hr] [\v!part=Dio] +\setuplabeltext [\s!pl] [\v!part=Ust\eogonek p ] +\setuplabeltext [\s!cz] [\v!part=\Ccaron \aacute st ] +\setuplabeltext [\s!sk] [\v!part=\Ccaron as\tcaron{} ] +\setuplabeltext [\s!hr] [\v!part=Dio ] \setuplabeltext [\s!sl] [\v!part=Del ] \setuplabeltext [\s!pl] [\v!line=wiersz ] -\setuplabeltext [\s!cz] [\v!line=\rcaron\aacute dek] +\setuplabeltext [\s!cz] [\v!line=\rcaron\aacute dek ] \setuplabeltext [\s!sk] [\v!line=riadok ] \setuplabeltext [\s!hr] [\v!line=red ] \setuplabeltext [\s!sl] [\v!line=vrstica ] \setuplabeltext [\s!pl] [\v!lines=wiersze ] -\setuplabeltext [\s!cz] [\v!lines=\rcaron\aacute dky] +\setuplabeltext [\s!cz] [\v!lines=\rcaron\aacute dky ] \setuplabeltext [\s!sk] [\v!lines=riadky ] \setuplabeltext [\s!hr] [\v!lines=redovi ] \setuplabeltext [\s!sl] [\v!lines=vrstice ] @@ -431,7 +431,7 @@ %D \ShowAllLanguageValues [\s!hr] [croatian] {Croatian} {heartthrob} %D \ShowAllLanguageValues [\s!sl] [slovenian] {Slovenian} {mountains} -%D A present from Brooks Moses and Hans hagen for Mojca Miklavec: +%D A present from Brooks Moses and Hans Hagen for Mojca Miklavec: \def\doconvertsloveniancharacters{\dodoconvertcharacters{25}} @@ -461,22 +461,13 @@ \defineconversion [sl] [AK] [\smallcapped\sloveniancharacters] \defineconversion [sl] [KA] [\smallcapped\sloveniancharacters] -%D This may move to \type {core-con.tex}. +% this will become more generic : \languagecharacters{sl}{..} -\def\sloveniancharacter#1% - {\ifcase#1\unknowncharacter - \or a\or b\or c\or \ccaron\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% - \or n\or o\or p\or r\or s\or \scaron\or t\or u\or v\or z\or \zcaron - \else - \unknowncharacter - \fi} +\let\sloveniancharacter\gobbleoneargument +\let\slovenianCharacter\gobbleoneargument -\def\slovenianCharacter#1% - {\ifcase#1\unknowncharacter - \or A\or B\or C\or \Ccaron\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% - \or N\or O\or P\or R\or S\or \Scaron\or T\or U\or V\or Z\or \Zcaron - \else - \unknowncharacter - \fi} +%D Plugins: + +\loadmarkfile{lang-sla} \protect \endinput diff --git a/tex/context/base/lang-spa.tex b/tex/context/base/lang-spa.tex index 83a4d52ab..1ec45cd69 100644 --- a/tex/context/base/lang-spa.tex +++ b/tex/context/base/lang-spa.tex @@ -37,8 +37,6 @@ \definehspace [\s!fr] [\string !] [.16667em] \definehspace [\s!fr] [\string ?] [.16667em] -\protect - %D Alternative discretionary handlers: \definetextmodediscretionary : diff --git a/tex/context/base/lang-spe.tex b/tex/context/base/lang-spe.tex index ed6becb60..b88b1ad77 100644 --- a/tex/context/base/lang-spe.tex +++ b/tex/context/base/lang-spe.tex @@ -79,6 +79,9 @@ %D precautions that will prevent spurious spaces to creep into %D the list. +% We should use token registers, but alas, we run out of them and +% \ETEX\ has a bug. Well, let's use a token register now (2006). + \def\startlanguagespecifics% % we use double to {\bgroup \catcode`\^^I=\@@ignore @@ -97,40 +100,15 @@ \characterencoding-% \fi} -% \long\def\dostartlanguagespecifics[#1][#2]#3\stoplanguagespecifics% -% {\egroup -% \long\def\docommando##1% -% {\doifdefinedelse{\??la\languageencoding##1\??la} -% {\long\def\do####1####2####3% -% {\setvalue{\??la\languageencoding####1\??la}{\do{####1}{####2####3}}}% -% \getvalue{\??la\languageencoding##1\??la}{#3}} -% {\setvalue{\??la\languageencoding##1\??la}{\do{##1}{#3}}}% -% \bgroup -% \setbox0\hbox{\enablelanguagespecifics[##1]}% -% \ifdim\wd0>\zeropoint -% \showmessage\m!linguals7{\currentencoding-##1,\the\wd0\space}\wait -% \else -% \showmessage\m!linguals8{\currentencoding-##1}% -% \fi -% \egroup -% \doif{##1}{\currentmainlanguage} -% {\enablelanguagespecifics[##1]}}% -% \processcommalist[#1]\docommando} - -% This saves 3K in the fmt file. - -% This should be a token register, but alas, we run out of them and -% \ETEX\ has a bug. - \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{\setvalue{\??la\languageencoding##1\??la}{\do{##1}{##2##3}}}% -% \getvalue{\??la\languageencoding#2\??la}{#1}} -% {\setvalue{\??la\languageencoding#2\??la}{\do{#2}{#1}}}% +% {\ifundefined{\??la\languageencoding#2\??la}\forgetlanguagespecifics[#2]\fi +% % the next line catches the case that specifics are enabled *before* they are defined +% \expandafter\ifx\csname\??la\languageencoding#2\??la\endcsname\relax\forgetlanguagespecifics[#2]\fi +% \appendvalue{\??la\languageencoding#2\??la}{#1}% % \bgroup % \setbox\scratchbox\hbox{\enablelanguagespecifics[#2]}% % \ifdim\wd\scratchbox>\zeropoint @@ -139,15 +117,15 @@ % \showmessage\m!linguals8{\currentencoding-#2}% % \fi % \egroup -% \doif{#2}\currentmainlanguage -% {\enablelanguagespecifics[#2]}} +% \doif{#2}\currentmainlanguage{\enablelanguagespecifics[#2]}} + +\def\languagespectag#1{\??la\languageencoding#1\??la} \long\def\dosetlanguagespecifics#1#2% - {%ifundefined{\??la\languageencoding#2\??la}\letvalue{\??la\languageencoding#2\??la}\empty\fi - \ifundefined{\??la\languageencoding#2\??la}\forgetlanguagespecifics[#2]\fi - % the next line catches the case that specifics are enabled *before* they are defined - \expandafter\ifx\csname\??la\languageencoding#2\??la\endcsname\relax\forgetlanguagespecifics[#2]\fi - \appendvalue{\??la\languageencoding#2\??la}{#1}% + {\ifcsname\languagespectag{#2}\endcsname \else + \expandafter\newtoks\csname\languagespectag{#2}\endcsname + \fi + \csname\languagespectag{#2}\endcsname\@EA{\the\csname\languagespectag{#2}\endcsname#1}% \bgroup \setbox\scratchbox\hbox{\enablelanguagespecifics[#2]}% \ifdim\wd\scratchbox>\zeropoint @@ -158,58 +136,52 @@ \egroup \doif{#2}\currentmainlanguage{\enablelanguagespecifics[#2]}} +% \def\forgetlanguagespecifics[#1]% +% {\letvalue{\??la\languageencoding#1\??la}\empty} + \def\forgetlanguagespecifics[#1]% - {\letvalue{\??la\languageencoding#1\??la}\empty} + {\csname\languagespectag{#1}\endcsname\emptytoks} %D Enabling them is rather straightforward. We only have to %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]% - {%\let\do\secondoftwoarguments - \csname - \??la + {\the\executeifdefined{\??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 ? + \??la}\emptytoks + \the\executeifdefined{\??la#1\??la}\emptytoks + \the\executeifdefined{\??la\languageencoding#1\??la}\emptytoks} % dup ? + +% check: + +% \def\enablelanguagespecifics[#1]% +% {\the\executeifdefined{\??la\executeifdefined{\??la#1\c!default}\languageencoding\??la}\emptytoks +% \the\executeifdefined{\??la#1\??la}\emptytoks +% \the\executeifdefined{\??la\languageencoding#1\??la}\emptytoks} % dup ? %D \macros %D {deactivatelanguagespecific} %D %D The next code makes it possible to disable the specifics. -\def\deactivatelanguagespecific#1% - {\ifundefined{l g s \string#1}% - \letgvalueempty{l g s \string#1}% signal to prevent dup def - \bgroup - \catcode`#1=\@@active - \uccode`~=`#1 - \uppercase{\doglobal\appendtoks\dodeactivatetoken{~}\to\everyresetlanguagespecifics}% - \egroup - \expanded{\doglobal\noexpand\appendtoks{#1}{\the\catcode`#1}}\to\everyresetlanguagespecifics - \fi} +% \def\deactivatelanguagespecific#1% +% {\ifundefined{l g s \string#1}% +% \letgvalueempty{l g s \string#1}% signal to prevent dup def +% \bgroup +% \catcode`#1=\@@active +% \uccode`~=`#1 +% \uppercase{\doglobal\appendtoks\dodeactivatetoken{~}\to\everyresetlanguagespecifics}% +% \egroup +% \expanded{\doglobal\noexpand\appendtoks{#1}{\the\catcode`#1}}\to\everyresetlanguagespecifics +% \fi} -% \def\dodeactivatetoken#1#2#3% -% {\def#1{#2}\catcode`#2=#3\relax} - -\def\dodeactivatetoken#1#2#3% test needed to avoid clash with \unprotect - {\def#1{#2}\ifnum\catcode`#2=\@@active\catcode`#2=#3\relax\fi} +% \def\dodeactivatetoken#1#2#3% test needed to avoid clash with \unprotect +% {\def#1{#2}\ifnum\catcode`#2=\@@active\catcode`#2=#3\relax\fi} %D We cannot hook this into the installer since language %D specifics can be anything. So far, we have the following @@ -221,12 +193,12 @@ \protect -\deactivatelanguagespecific " -\deactivatelanguagespecific / -\deactivatelanguagespecific : -\deactivatelanguagespecific ; -\deactivatelanguagespecific ? -\deactivatelanguagespecific ! +% \deactivatelanguagespecific " +% \deactivatelanguagespecific / +% \deactivatelanguagespecific : +% \deactivatelanguagespecific ; +% \deactivatelanguagespecific ? +% \deactivatelanguagespecific ! \unprotect @@ -243,8 +215,11 @@ %D difficult to implement. Fortunately dates never exceed the %D number~31. -\def\highordinalstr#1{\high{\nocap{#1}}} -\def\ordinalstr #1{\nocap{#1}} +\ifx\high \undefined \let\high \firstofoneargument \fi % todo +\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi % todo + +\def\highordinalstr#1{\high{\notsmallcapped{#1}}} +\def\ordinalstr #1{\notsmallcapped{#1}} \def\ordinaldaynumber#1% \strippedcsname\ordinaldaynumber {\expanded{\executeifdefined{\currentlanguage ordinaldaynumber}% diff --git a/tex/context/base/m-arabtex.tex b/tex/context/base/m-arabtex.tex index 6220835f5..af7213387 100644 --- a/tex/context/base/m-arabtex.tex +++ b/tex/context/base/m-arabtex.tex @@ -248,7 +248,7 @@ \def\ARABTEXsh@ft#1% {\dimen@.00#1ex - \multiply\dimen@\fontdimen1\font + \multiply\dimen@\slantperpoint \kern-.0156\dimen@} \appendtoks @@ -378,13 +378,6 @@ %D perfect instrument to cross cultural and linguistic %D borders. So, let's load Hebrew support as well: -% \unexpanded\def\sethebrewfont#1% strange font dimensions / scale -% {\scratchdimen=10\bodyfontsize -% \font\hebfont=\truefontname{Hebrew#1} at \currentfontscale\scratchdimen -% \fontdimen5\hebfont=.8\fontdimen2\hebfont -% \fontdimen6\hebfont=3\fontdimen5\hebfont -% \hebfont} - \unexpanded\def\sethebrewfont#1% {\setx@skels \newfonttrue diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex index cc9114ff6..2a29333b1 100644 --- a/tex/context/base/m-chart.tex +++ b/tex/context/base/m-chart.tex @@ -13,7 +13,7 @@ % to do: \localpushmacro/\localpopmacro (dohandleflowchart etc) -% will be redone with layers +% will be redone with layers and dimexpr %D This is an experimental module. Pieces of code will be moved %D to other modules. More features are possible but will be @@ -1049,8 +1049,8 @@ \fi} \def\setgetFLOWchart[#1][#2][#3]% - {\def\docommando##1{}% cell line focus ? - \processcommalist[#2]\docommando + {\def\docommand##1{}% cell line focus ? + \processcommalist[#2]\docommand \getFLOWchart[#1][#3]} \def\doFLOWchart[#1][#2]% diff --git a/tex/context/base/m-cweb.tex b/tex/context/base/m-cweb.tex index 1d3455acf..9aa630aa6 100644 --- a/tex/context/base/m-cweb.tex +++ b/tex/context/base/m-cweb.tex @@ -176,18 +176,18 @@ % \parskip = 0pt % no stretch between paragraphs % \parindent = 1em % for paragraphs and for the first line of C text -% \font\ninerm = cmr9 -% \let\mc = \ninerm % medium caps -% \font\eightrm = cmr8 -% \let\sc = \eightrm % small caps (NOT a caps-and-small-caps font) -% \let\mainfont = \tenrm -% \let\cmntfont = \tenrm -% \font\tenss = cmss10 -% \let\cmntfont = \tenss % alternative comment font -% \font\titlefont = cmr7 scaled \magstep4 % title on the contents page -% \font\ttitlefont = cmtt10 scaled \magstep2 % typewriter type in title -% \font\tentex = cmtex10 % TeX extended character set (used in strings) -% \fontdimen7\tentex = 0pt % no double space after sentences +% \font\ninerm = cmr9 +% \let\mc = \ninerm % medium caps +% \font\eightrm = cmr8 +% \let\sc = \eightrm % small caps (NOT a caps-and-small-caps font) +% \let\mainfont = \tenrm +% \let\cmntfont = \tenrm +% \font\tenss = cmss10 +% \let\cmntfont = \tenss % alternative comment font +% \font\titlefont = cmr7 scaled \magstep4 % title on the contents page +% \font\ttitlefont = cmtt10 scaled \magstep2 % typewriter type in title +% \font\tentex = cmtex10 % TeX extended character set (used in strings) +% \fontextraspace\tentex = 0pt % no double space after sentences %D \macros{mc,sc,cmntfont,eightrm}{} %D @@ -212,7 +212,7 @@ \defCWEBmacro\tentex% {\font\next=cmtex10 at \textface - \fontdimen7\next=0pt + \fontextraspace\next\zeropoint \next} \defCWEBmacro\sevenrm {\getvalue{\scriptface rmtf}} @@ -1007,20 +1007,20 @@ % {\bgroup % \def\CWEBcomma% % {\def\CWEBcomma{, }}% -% \def\docommando##1% +% \def\docommand##1% % {\bgroup % \def\[####1]{####1}% % \xdef\CWEBreference{##1}% % \egroup % \CWEBcomma{\naar{\donottest{##1}}[web:\CWEBreference]}}% -% \processcommalist[{#1}]\docommando +% \processcommalist[{#1}]\docommand % \egroup} % \def\processCWEBsectionnumbers[#1]% % {\bgroup % \def\CWEBcomma% % {\def\CWEBcomma{, }}% -% \def\docommando##1% +% \def\docommand##1% % {\bgroup % \def\(####1){####1}% % \xdef\CWEBreference{##1}% @@ -1031,20 +1031,20 @@ % \def\[##1]{\(##1)}\let\(=\relax\xdef\CWEBreferences{#1}% % \egroup % \unexpanded\def\(##1){\[##1]}% -% \processcommacommand[\CWEBreferences]\docommando +% \processcommacommand[\CWEBreferences]\docommand % \egroup} \def\processCWEBsectionnumbers[#1]% {\bgroup \def\CWEBcomma% {\def\CWEBcomma{, }}% - \def\docommando##1% + \def\docommand##1% {\bgroup \def\[####1]{####1}% \xdef\CWEBreference{##1}% \egroup \CWEBcomma{\localcolortrue\goto{\donottest{##1}}[web:\CWEBreference]}}% - \processlist{(}{)}{,}\docommando(#1) + \processlist{(}{)}{,}\docommand(#1) \egroup} \def\processCWEBsectionnotes% diff --git a/tex/context/base/m-database.tex b/tex/context/base/m-database.tex index b707a8ecc..0486a062f 100644 --- a/tex/context/base/m-database.tex +++ b/tex/context/base/m-database.tex @@ -32,14 +32,14 @@ %D following one: %D %D \starttyping -%D \processquotedlist{beginsym}{endsym}{separator}\docommando list +%D \processquotedlist{beginsym}{endsym}{separator}\docommand list %D \stoptyping %D %D This one supports arbitrary open and close symbols as well %D as user defined separators. %D %D \starttyping -%D \processquotedlist(){,}{"}\docommando(a=>b=>c=>d) +%D \processquotedlist(){,}{"}\docommand(a=>b=>c=>d) %D \stoptyping \def\processquotedlist#1#2#3#4#5% diff --git a/tex/context/base/m-gnuplot.tex b/tex/context/base/m-gnuplot.tex index 8da9317b6..5e612257f 100644 --- a/tex/context/base/m-gnuplot.tex +++ b/tex/context/base/m-gnuplot.tex @@ -64,15 +64,6 @@ \def\redouseGNUPLOTgraphic[#1][#2]#3% {\dodouseGNUPLOTgraphic[#3][]} -% \bgroup -% \obeylines -% \gdef\fixGNUPLOTnewlines% -% {\def\par{;\@@svline}% -% \def ^^M{;\@@svline}} -% \egroup - -\ifx\systemendofline\undefined \def\systemendofline{\rawcharacter{10}} \fi - \newtoks\everyGNUPLOTgraphic % gnuplot only seems to handle lf so we cannot use \mappartolineend @@ -81,12 +72,12 @@ \appendtoks \obeylines - \def\obeyedline{;\systemendofline}% + \def\obeyedline{;\outputnewlinechar}% \to \everyGNUPLOTgraphic \appendtoks \let\%\letterpercent - \def\ {\letterbackslash\systemendofline}% + \def\ {\letterbackslash\outputnewlinechar}% \to \everyGNUPLOTgraphic \def\dodouseGNUPLOTgraphic[#1][#2]% diff --git a/tex/context/base/m-narrowtt.tex b/tex/context/base/m-narrowtt.tex index 3a83b7d94..b11aaefb5 100644 --- a/tex/context/base/m-narrowtt.tex +++ b/tex/context/base/m-narrowtt.tex @@ -32,7 +32,7 @@ [narrowtt] [tt] [mono] [modern-cond] [default] [encoding=\defaultencoding] -\definetyping[n\v!typing][\v!typing] \setuptyping[n\v!typing][style=\narrowtt] -\definetype [n\v!type] [\v!type] \setuptype [n\v!type] [style=\narrowtt] +\definetyping[n\v!typing] \setuptyping[n\v!typing][style=\narrowtt] +\definetype [n\v!type] \setuptype [n\v!type] [style=\narrowtt] \protect \endinput diff --git a/tex/context/base/m-r.tex b/tex/context/base/m-r.tex index 244b62c36..bf7b07a14 100644 --- a/tex/context/base/m-r.tex +++ b/tex/context/base/m-r.tex @@ -19,44 +19,6 @@ %D We can combine both variants in one macro definition. Also, we %D can minimize the number of runs by checking for a change. -%D \starttyping -%D \newcounter\Rnumber -%D \newtoks\everyR -%D -%D \appendtoks -%D \obeylines -%D \to \everyR -%D -%D \def\startR {\dostartR\stopR \plusone} -%D \def\startRhidden{\dostartR\stopRhidden\zerocount} -%D -%D \def\dostartR#1#2% -%D {\bgroup -%D \ifcase#2\relax\let\typeRout\relax\fi -%D \obeylines -%D \catcode`\%=\@@letter -%D \catcode`\#=\@@letter -%D \def\dostartR##1#1% -%D {\doglobal\increment\Rnumber -%D \edef\Rfile{\bufferprefix R-\Rnumber}% -%D \bgroup -%D \the\everyR -%D \def\par{\rawcharacter{10}}% -%D \immediate\openout\scratchwrite=\Rfile.r -%D \immediate\write\scratchwrite{##1}% -%D \immediate\closeout\scratchwrite -%D \egroup -%D \doifmode{*\v!first}\runR -%D \typefile{\Rfile.rout}% -%D \egroup}% -%D \doifnextcharelse\relax\dostartR\dostartR} -%D -%D \def\runR -%D {\executesystemcommand{texmfstart -%D --ifchanged=\Rfile.r bin:R -%D "-q --save --restore < \Rfile.r > \Rfile.rout"}} -%D \stoptyping - %D JS: The call to R has \type {-q} in order to prevent banner, %D \type {--save} to make sure it saves the workspace after the run, %D \type {--restore} to make sure it reads any workspace from a @@ -65,6 +27,7 @@ %D An easier and better solution is to use the buffering mechanisms: \def\Rbufferprefix{r-} + \newcounter\nofRfiles \def\Rfile{\TEXbufferfile{\Rbufferprefix\nofRfiles}}% @@ -84,11 +47,6 @@ \def\stopRhidden {\doifmode{*\v!first}\runR} -% \def\runR % " " needed to preserve < > -% {\executesystemcommand{texmfstart -% --ifchanged=\Rfile\space --direct R -% "-q --save --restore < \Rfile\space > \Rfile.out"}} - \def\runR {\executesystemcommand{texmfstart --ifchanged=\Rfile\space --direct R diff --git a/tex/context/base/m-streams.tex b/tex/context/base/m-streams.tex index 181c82d33..c1ef994ff 100644 --- a/tex/context/base/m-streams.tex +++ b/tex/context/base/m-streams.tex @@ -105,8 +105,13 @@ \unprotect +\def\overloadtextwidth#1% + {\makeupwidth#1\relax + \textwidth\makeupwidth + \hsize\makeupwidth} + \startsetups streamlayer:default:settings - % set hsize etc + % set hsize etc, like \overloadtextwidth{12cm} \stopsetups \startsetups streamlayer:default:extras @@ -127,7 +132,6 @@ {\outputstreamcopy[\currentstreamlayer]}% \stopsetups - \startsetups streamlayer:default:reset \outputstreambox[\currentstreamlayer] \stopsetups diff --git a/tex/context/base/m-tryout.tex b/tex/context/base/m-tryout.tex index 89ffc4678..4aa50376d 100644 --- a/tex/context/base/m-tryout.tex +++ b/tex/context/base/m-tryout.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\endinput + \unprotect %D The following macros make sure that active colons work well @@ -24,8 +26,6 @@ \startmode[activecolon] -\endinput - % this is now default \gdef\sectionseparator{-} diff --git a/tex/context/base/m-visual.tex b/tex/context/base/m-visual.tex index 5ff273f5c..1622e5e63 100644 --- a/tex/context/base/m-visual.tex +++ b/tex/context/base/m-visual.tex @@ -57,6 +57,10 @@ \stopcolor \allowbreak} +\def\dorandomrecurse#1% + {\getrandomcount\scratchcounter{1}{#1}% + \dorecurse\scratchcounter} + % can be used in hbox, so %'s are really needed \unexpanded\def\fakelines#1#2% min max / 3 10 diff --git a/tex/context/base/math-ams.tex b/tex/context/base/math-ams.tex index 3df63ff48..29fe19e0b 100644 --- a/tex/context/base/math-ams.tex +++ b/tex/context/base/math-ams.tex @@ -300,9 +300,9 @@ \startmathcollection [default] -\definemathcommand [dashrightarrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}% -\definemathcommand [dashleftarrow] [rel] {\mathchar"0C4C\dabar@ \dabar@}% -\definemathcommand [dasharrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}% +\definemathcommand [dashrightarrow] [rel] {\dabar@\dabar@ \mathchar"0C4B} +\definemathcommand [dashleftarrow] [rel] {\mathchar"0C4C\dabar@ \dabar@} +\definemathcommand [dasharrow] [rel] {\dabar@\dabar@ \mathchar"0C4B} \definemathcommand [Join] [rel] {\mathchar"0D6F\mkern-13.8mu\mathchar"0D6E} \definemathcommand [implies] [rel] {\;\Longrightarrow\;} \definemathcommand [impliedby] [rel] {\;\Longleftarrow\;} diff --git a/tex/context/base/math-cow.tex b/tex/context/base/math-cow.tex index 016221f2d..f0fc811c8 100644 --- a/tex/context/base/math-cow.tex +++ b/tex/context/base/math-cow.tex @@ -13,8 +13,9 @@ \unprotect -\let\COWsqrt\mthsqrt -\let\COWfrac\mthfrac +\def\COWsqrt {\mthsqrt{\char"7A}{\char"7B}} +\def\COWfrac {\mthfrac{\char"7C}{\char"7A}{\char"7B}} +\def\COWarrowfill{\mtharrowfill 1001} \startmathcollection [cow] % todo diff --git a/tex/context/base/math-eul.tex b/tex/context/base/math-eul.tex index 6acc33356..7552957a8 100644 --- a/tex/context/base/math-eul.tex +++ b/tex/context/base/math-eul.tex @@ -244,4 +244,34 @@ \stopmathcollection +%D Aditya's additionl definitions: + +\startmathcollection[eul:texnansi] + \definemathsymbol [acute] [accent] [tf] ["13] + \definemathsymbol [grave] [accent] [tf] ["12] + \definemathsymbol [ddot] [accent] [tf] ["A8] + \definemathsymbol [tilde] [accent] [tf] ["98] + \definemathsymbol [bar] [accent] [tf] ["16] + \definemathsymbol [breve] [accent] [tf] ["15] + \definemathsymbol [check] [accent] [tf] ["14] + \definemathsymbol [hat] [accent] [tf] ["88] + \definemathsymbol [dot] [accent] [tf] ["5] + % Why is mathring not defined?? + \definemathsymbol [mathring] [accent] [tf] ["17] +\stopmathcollection + +\startmathcollection[eul:ec] + \definemathsymbol [acute] [accent] [tf] ["1] + \definemathsymbol [grave] [accent] [tf] ["0] + \definemathsymbol [ddot] [accent] [tf] ["4] + \definemathsymbol [tilde] [accent] [tf] ["3] + \definemathsymbol [bar] [accent] [tf] ["9] + \definemathsymbol [breve] [accent] [tf] ["8] + \definemathsymbol [check] [accent] [tf] ["7] + \definemathsymbol [hat] [accent] [tf] ["2] + \definemathsymbol [dot] [accent] [tf] ["A] + % Why is mathring not defined?? + \definemathsymbol [mathring] [accent] [tf] ["6] +\stopmathcollection + \protect \endinput diff --git a/tex/context/base/math-ext.tex b/tex/context/base/math-ext.tex index 9f74ce4a9..177e3c8a4 100644 --- a/tex/context/base/math-ext.tex +++ b/tex/context/base/math-ext.tex @@ -132,19 +132,23 @@ \def\redefinebotharrow#1#2#3% real dirty, this overload! {\doifdefined{#1} - {\pushmacro\dotripleempty - \def\dotripleempty##1[##2][##3]{\setvalue{#1}{\dotripleempty\xmtharrow[#2][##3]}}% + {\pushmacro\dohandlemtharrow + \def\dohandlemtharrow[##1][##2]{\setvalue{#1}{\dohandlemtharrow[#2][##2]}}% + % == \def\dohandlemtharrow[##1][##2]{\dodefinebotharrow{#1}{#2}{##2}}% \getvalue{#1}% - \popmacro\dotripleempty}} + \popmacro\dohandlemtharrow}} \def\dodefinebotharrow#1#2#3% - {\setvalue{#1}{\dotripleempty\xmtharrow[#2][#3]}} + {\setvalue{#1}{\dohandlemtharrow[#2][#3]}} -\def\xmtharrow[#1][#2][#3]% #3 == optional arg - {\def\doxmtharrow{\dodoxmtharrow[#1,\empty,\empty][#2,\empty,\empty][#3]}% {##1}{##2} - \dodoublegroupempty\doxmtharrow} +\def\dohandlemtharrow + {\dotripleempty\doxmtharrow} -\def\dodoxmtharrow[#1,#2,#3][#4,#5,#6][#7]#8#9% [3] is the optional arg +\def\doxmtharrow[#1][#2][#3]% #3 == optional arg + {\def\dodoxmtharrow{\dododoxmtharrow[#1,\empty,\empty][#2,\empty,\empty][#3]}% {##1}{##2} + \dodoublegroupempty\dodoxmtharrow} + +\def\dododoxmtharrow[#1,#2,#3][#4,#5,#6][#7]#8#9% [3] is the optional arg {\edef\!!stringa{#2}% \ifx\!!stringa\empty \ifsecondargument @@ -189,7 +193,6 @@ \def\leftharpoondownfill {\defaultmtharrowfill \leftharpoondown \relbar \relbar } \def\leftharpoonupfill {\defaultmtharrowfill \leftharpoonup \relbar \relbar } - \def\hookleftfill {\defaultmtharrowfill \leftarrow \relbar{\relbar\joinrel\rhook}} \def\hookrightfill{\defaultmtharrowfill{\lhook\joinrel\relbar}\relbar \rightarrow} diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex index 7f5074947..1c9cc651f 100644 --- a/tex/context/base/math-ini.tex +++ b/tex/context/base/math-ini.tex @@ -100,8 +100,8 @@ \ifx\dohandlecommand\undefined \wait \fi % troubles ! -\let\mathcharacter\dohandlemathtoken -\let\textcharacter\dohandlecommand % better \dohandletexttoken +\def\mathcharacter\dohandlemathtoken +\def\textcharacter\dohandlecommand % better \dohandletexttoken % More clever layout: % @@ -235,6 +235,45 @@ %D Now we redefine the text encoding handler. +%D A better fallback: + +% Just ETEX which is the default nowadays. + +\beginETEX \ifcsname + +\def\dohandlemathtoken#1% + {\csname + \ifmmode + \ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname + \@mt@\mathcollection:\outerencoding + \else\ifcsname\@mt@\mathcollection#1\endcsname + \@mt@\mathcollection + \else\ifcsname\@mt@\nomathcollection#1\endcsname + \@mt@\nomathcollection + \else\ifcsname\characterencoding#1\endcsname + \characterencoding + \else + \nocharacterencoding + \fi\fi\fi\fi + \else + \ifcsname\characterencoding#1\endcsname + \characterencoding + \else\ifcsname\nocharacterencoding#1\endcsname + \nocharacterencoding + \else\ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname + \@mt@\mathcollection:\outerencoding + \else\ifcsname\@mt@\mathcollection#1\endcsname + \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\mathcollection + \else\ifcsname\@mt@\nomathcollection#1\endcsname + \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\nomathcollection + \else + \nocharacterencoding + \fi\fi\fi\fi\fi + \fi + #1\endcsname} + +\endETEX + \let\dohandlecommand\dohandlemathtoken \def\definefamilysynonym @@ -678,43 +717,3 @@ \setupbodyfont[ams] \enablemathcollection[default] \input math-ams \page \setupbodyfont[lbr] \enablemathcollection[lbr] \input math-lbr \page \setupbodyfont[eul] \enablemathcollection[eul] \input math-eul \stoptext - -% to be checked, overloads supp-lan ! - -\def\defineactivecharacter #1 #2% -% {\scratchcounter=\the\uccode`~ - {\scratchcounter\uccode`~\relax - \expandafter\doifnumberelse\expandafter{\string#1} - {\catcode #1=\@@active \uccode`~= #1\relax} - {\catcode`#1=\@@active \uccode`~=`#1\relax}% - \uppercase{\def\next{~}}% - % unexpanded goes wrong in pdfdoc - %\expandafter\unexpanded\expandafter\def\next{#2}% - % better - %\expandafter\def\next{#2}% - % math aware - \expandafter\def\next{\dohandleactivecharacter{#1}{#2}}% new - \uccode`~=\scratchcounter} - -\def\dohandleactivecharacter - {\ifmmode - \expandafter\dohandleactivemathcharacter - \else - \expandafter\secondoftwoarguments - \fi} - -\def\dohandleactivemathcharacter#1#2#3% - {\ifundefined{@ma@\string#2}% - \expandafter\firstofoneargument - \else - \getvalue{@ma@\string#2}% - \expandafter\gobbleoneargument - \fi{#3}} - -% \def\dohandleactivemathcharacter#1#2% -% {\ifcsname @ma@\string#1\endcsname -% \csname @ma@\string#1\expandafter\endcsname -% \expandafter\gobbleoneargument -% \else -% \expandafter\firstofoneargument -% \fi{#2}} diff --git a/tex/context/base/math-pln.tex b/tex/context/base/math-pln.tex index b8148491f..386b67d9b 100644 --- a/tex/context/base/math-pln.tex +++ b/tex/context/base/math-pln.tex @@ -51,7 +51,7 @@ \def\sh@ft#1% kern by #1 times the current slant {\dimen@#1% - \kern\expandafter\getf@ctor\the\fontdimen1\font + \kern\expandafter\getf@ctor\the\slantperpoint \dimen@} % \def\copyright % will be overloaded diff --git a/tex/context/base/meta-dum.tex b/tex/context/base/meta-dum.tex index 10ce6d99a..d6a4525b2 100644 --- a/tex/context/base/meta-dum.tex +++ b/tex/context/base/meta-dum.tex @@ -36,7 +36,7 @@ % June 22, 2003, this definition was patched to adapt itself % to transparent colors -\startuseMPgraphic{placeholder}{width,height,color} +\startuseMPgraphic{placeholder}{width,height,reduction,color} numeric w, h, d, r ; color c, b, cc ; path p ; boolean t ; t := is_transparent(\MPvar{color}) ; c := not_transparent(\MPvar{color}) ; diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex index 6d4d304f9..3edd73b57 100644 --- a/tex/context/base/meta-fig.tex +++ b/tex/context/base/meta-fig.tex @@ -78,12 +78,10 @@ \def\MPfigure#1#2% test for dup figure {\bgroup \getfiguredimensionsonly[#1]% [\c!object=\v!no] already set - \freezedimenmacro\naturalfigurewidth - \freezedimenmacro\naturalfigureheight \startMPcode externalfigure "#1" - xscaled \naturalfigurewidth\space - yscaled \naturalfigureheight\space + xscaled \figurewidth\space + yscaled \figureheight\space #2 ; \stopMPcode \egroup} diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex index 3353a9a0b..d00a8a6b1 100644 --- a/tex/context/base/meta-ini.tex +++ b/tex/context/base/meta-ini.tex @@ -406,9 +406,9 @@ %D %D \starttyping %D \def\extendMPoverlaystamp#1% -%D {\def\docommando##1% +%D {\def\docommand##1% %D {\edef\overlaystamp{\overlaystamp:\MPvariable{##1}}}% -%D \processcommalist[#1]\docommando} +%D \processcommalist[#1]\docommand} %D \stoptyping %D Since we need to feed \METAPOST\ with expanded dimensions, @@ -589,6 +589,11 @@ \resetMPenvironment +\def\useMPenvironmentbuffer[#1]% + {\expanded{\startMPenvironment\noexpand\readfile{\TEXbufferfile{\jobname}}{}{}}\stopMPenvironment} + +\useMPenvironmentbuffer[mp] + %D This command takes \type {[reset]} as optional %D argument. %D @@ -747,8 +752,8 @@ CurrentWidth:=\the\hsize; CurrentHeight:=\the\vsize; % - EmWidth:=\the\fontdimen6\font; - ExHeight:=\the\fontdimen5\font; + EmWidth:=\the\emwidth; + ExHeight:=\the\exheight; % PageNumber:=\the\pageno; RealPageNumber:=\the\realpageno; @@ -756,7 +761,7 @@ \stopMPinitializations \appendtoks - \expanded{\definecolor[currentcolor][\currentcolor]}% + \expanded{\definecolor[currentcolor][\currentcolorname]}% \to \everyMPgraphic \appendtoks @@ -765,40 +770,13 @@ \topskip 1\topskip \to \everyMPgraphic -% this will become (more efficient) -% -% \startuseMPgraphic{init data} -% tx1 := \the\baselineskip ; -% tx2 := \the\baselineskip ; -% tx3 := \the\bodyfontsize ; -% tx4 := \strutheight ; -% tx5 := \strutdepth ; -% tx6 := \the\hsize ; -% tx7 := \the\vsize ; -% tx8 := \the\fontdimen6\font ; -% tx9 := \the\fontdimen5\font ; -% \stopuseMPgraphic -% -% def map_tx_variables = -% BaseLineSkip := tx1 ; -% LineHeight := tx2 ; -% BodyFontSize := tx3 ; -% StrutHeight := tx4 ; -% StrutDepth := tx5 ; -% CurrentWidth := tx6 ; -% Currentheight := tx7 ; -% EmWidth := tx8 ; -% ExHeight := tx9 ; -% enddef ; -% -% extra_begin_fig .... - %D Alas, the prologue settings differ per driver. \ifx\undefined\MPprologues \def\MPprologues{0} \fi \startMPinitializations prologues:=\MPprologues; + mpprocset:=1; \stopMPinitializations \appendtoks @@ -855,16 +833,18 @@ \def\insertMPfile#1#2% in context #2 is empty {\doifelsenothing{#2}{\doinsertMPfile{#1}}{\insertMPfileARG{#1}{#2}}} -\def\includeMPasEPS#1% +\def\includeMPasEPS#1% untested !! {\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\zerocount}% + \let \@@DriverImageType \c!mps + \def \@@DriverImageFile {#1}% + \edef\@@DriverImageWidth {\the\!!widthb }% + \edef\@@DriverImageHeight{\the\!!heightb}% + \doinsertfile}% \wd\scratchbox\!!widthb \dp\scratchbox\zeropoint \box\scratchbox diff --git a/tex/context/base/meta-mis.tex b/tex/context/base/meta-mis.tex new file mode 100644 index 000000000..6b39fa0dd --- /dev/null +++ b/tex/context/base/meta-mis.tex @@ -0,0 +1,54 @@ +%D \module +%D [ file=meta-mis, +%D version=2006.06.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Misc Test Graphics, +%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 + +% p/s 1/false 1/true 2/false 2/true +% +% MKII 8.5 8.0 8.8 8.5 +% MKIV 16.1 7.2 16.3 7.4 + +\startuseMPgraphic{mptopdf-test} + prologues := 2; + mpprocset := 1 ; + fill fullcircle scaled 3cm withcolor red ; + fill fullcircle scaled 2cm withcolor green ; + fill fullcircle scaled 1cm withcolor blue ; + currentpicture := currentpicture shifted (-4cm,0) ; + fill fullcircle scaled 3cm withcolor cmyk(0,0,1,0) ; + fill fullcircle scaled 2cm withcolor cmyk(0,1,0,0) ; + fill fullcircle scaled 1cm withcolor cmyk(0,0,1,0) ; + currentpicture := currentpicture shifted (-4cm,0) ; + draw fullcircle scaled 3cm dashed evenly ; + draw fullcircle scaled 2cm dashed withdots ; + draw origin withpen pencircle scaled 3mm; + currentpicture := currentpicture shifted (-4cm,0) ; + fill fullcircle scaled 2cm shifted (-.5cm,+.5cm) withcolor transparent(1,.5,red); + fill fullcircle scaled 2cm shifted (-.5cm,-.5cm) withcolor transparent(1,.5,red); + fill fullcircle scaled 2cm shifted (+.5cm,+.5cm) withcolor transparent(1,.5,green); + fill fullcircle scaled 2cm shifted (+.5cm,-.5cm) withcolor transparent(1,.5,cmyk(1,0,1,.5)); + currentpicture := currentpicture shifted (12cm,-4cm) ; + draw "o e p s" infont defaultfont scaled 2 shifted (-1cm,0) ; + currentpicture := currentpicture shifted (-4cm,0) ; + % bug: shift + draw fullcircle scaled 3cm withpen pencircle yscaled 3mm xscaled 2mm rotated 30 ; + draw fullcircle scaled 2cm withpen pencircle yscaled 3mm xscaled 2mm rotated 20 withcolor red ; + filldraw fullcircle scaled 1cm withpen pencircle yscaled 3mm xscaled 2mm rotated 10 withcolor green ; + currentpicture := currentpicture shifted (-4cm,0) ; + % shade cannot handle shift + circular_shade(fullcircle scaled 3cm,0,.2red,.9green) ; + circular_shade(fullcircle scaled 3cm shifted(+4cm,0),0,cmyk(1,0,0,0),cmyk(0,1,0,0)) ; + filldraw boundingbox currentpicture enlarged (-bbheight(currentpicture)/2+2.5mm) withpen pencircle scaled 1pt withcolor .5white ; +\stopuseMPgraphic + +\protect \endinput diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex index cda7dbd96..1ed7db7f9 100644 --- a/tex/context/base/meta-pag.tex +++ b/tex/context/base/meta-pag.tex @@ -92,12 +92,9 @@ \def\freezeMPpagelayout {\doifbothsides - \def\MPonrightpage{true}% - \orsideone - \def\MPonrightpage{true}% - \orsidetwo - \def\MPonrightpage{false}% - \od + {\def\MPonrightpage{true}} + {\def\MPonrightpage{true}} + {\def\MPonrightpage{false}}% \edef\MPonoddpage{\doifoddpageelse{true}{false}}} \let\freezeMPlayout\relax % obsolete diff --git a/tex/context/base/meta-pdf.mkii b/tex/context/base/meta-pdf.mkii new file mode 100644 index 000000000..3060de539 --- /dev/null +++ b/tex/context/base/meta-pdf.mkii @@ -0,0 +1,1908 @@ +%D \module +%D [ file=meta-pdf, +%D version=2006.06.07, +%D title=\CONTEXT\ Support Macros, +%D subtitle=\METAPOST\ to \PDF\ conversion, +%D author=Hans Hagen \& others (see text), +%D date=\currentdate, +%D copyright=\PRAGMA] +%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 These are the main macros. + +\def\mkconvertMPtoPDF % #1#2#3% + {\vbox\bgroup + \forgetall + \offinterlineskip + \ifx\pdfdecimaldigits\undefined\else \pdfdecimaldigits=5 \fi % new + \global\let\MPheight\!!zeropoint + \global\let\MPwidth \!!zeropoint + \setbox\scratchbox\vbox\bgroup + \message{[MP to PDF]}% + \startMPresources + \PDFcomment{mps begin}% + \PDFcode{q}% + \PDFcode{1 0 0 1 0 0 cm}% + \ifcase\blackoutMPgraphic\or\PDFcode{0 g 0 G}\fi + \doprocessMPtoPDFfile} + +\def\doprocessMPtoPDFfile + {\setMPspecials + \setMPextensions + \the\everyMPtoPDFconversion + \catcode`\^^M=\@@endofline + \startMPscanning + \let\do\empty + \donefalse + \let\handleMPsequence\dohandleMPsequence + \input\MPfilename\relax} + +\def\finishMPgraphic + {\PDFcode{Q}% + \PDFcomment{mps end}% + \stopMPresources + \egroup + \setbox\scratchbox\hbox\bgroup + \hskip-\MPllx\onebasepoint + \raise-\MPlly\onebasepoint + \box\scratchbox + \egroup + \setbox\scratchbox\vbox to \MPheight\bgroup + \vfill + \hsize\MPwidth + \smashbox\scratchbox + \box\scratchbox + \egroup + \wd\scratchbox\MPwidth + \ht\scratchbox\MPheight + \dopackageMPgraphic\scratchbox + \egroup + \endinput} + +\def\mkprocessMPtoPDFfile % file xscale yscale / obsolete + {\bgroup + \let\finishMPgraphic\egroup + \doprocessMPtoPDFfile} + +%D Because we want to test as fast as possible, we first +%D define the \POSTSCRIPT\ operators that \METAPOST\ uses. +%D 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} +\def \PSshowpage {showpage} +\def \PSnewpath {newpath} +\def \PSfshow {fshow} +\def \PSclosepath {closepath} +\def \PSfill {fill} +\def \PSstroke {stroke} +\def \PSclip {clip} +\def \PSrlineto {rlineto} +\def \PSsetlinejoin {setlinejoin} +\def \PSsetlinecap {setlinecap} +\def \PSsetmiterlimit {setmiterlimit} +\def \PSsetgray {setgray} +\def \PSsetrgbcolor {setrgbcolor} +\def \PSsetcmykcolor {setcmykcolor} +\def \PSsetdash {setdash} +\def \PSgsave {gsave} +\def \PSgrestore {grestore} +\def \PStranslate {translate} +\def \PSscale {scale} +\def \PSconcat {concat} +\def \PSdtransform {dtransform} +\def \PSsetlinewidth {setlinewidth} +\def \PSpop {pop} + +\def \PSnfont {nfont} % was needed for TUG98 proceedings +\def \PSspecial {special} % extensions to MetaPost + +%D A previous version set \type {%} to ignore, which +%D simplified the following definitions. At the start of +%D conversion the percent character was made active again. +%D Because the whole graphic is one paragraph (there are no +%D empty lines) this does not give the desired effect. This +%D went unnoticed untill Scott Pakin sent me a test file +%D percent characters in a string. So, from now on we have +%D to prefix the following strings with percentages. + +%D Some day I'll figure out a better solution (line by line reading +%D using \ETEX). + +\edef \PSBoundingBox {\letterpercent\letterpercent BoundingBox:} +\edef \PSHiResBoundingBox {\letterpercent\letterpercent HiResBoundingBox:} +\edef \PSExactBoundingBox {\letterpercent\letterpercent ExactBoundingBox:} +\edef \PSMetaPostSpecial {\letterpercent\letterpercent MetaPostSpecial:} +\edef \PSMetaPostSpecials {\letterpercent\letterpercent MetaPostSpecials:} +\edef \PSPage {\letterpercent\letterpercent Page:} +\edef \PSBeginProlog {\letterpercent\letterpercent BeginProlog} +\edef \PSEndProlog {\letterpercent\letterpercent EndProlog} +\edef \PSEof {\letterpercent\letterpercent EOF} + +%D By the way, the \type {setcmykcolor} operator is not +%D output by \METAPOST\ but can result from converting the +%D \cap{RGB} color specifications, as implemented in +%D \type{supp-mps}. + +%D In \POSTSCRIPT\ arguments precede the operators. Due to the +%D fact that in some translations we need access to those +%D arguments, and also because sometimes we have to skip them, +%D we stack them up. The stack is one||dimensional for non path +%D operators and two||dimensional for operators inside a path. +%D This is because we have to save the whole path for +%D (optional) postprocessing. Values are pushed onto the stack +%D by: +%D +%D \starttyping +%D \setMPargument {value} +%D \stoptyping +%D +%D They can be retrieved by the short named macros: +%D +%D \starttyping +%D \gMPa {number} +%D \gMPs {number} +%D \stoptyping +%D +%D When scanning a path specification, we also save the +%D operator, using +%D +%D \starttyping +%D \setMPkeyword {n} +%D \stoptyping +%D +%D The path drawing operators are coded for speed: \type{clip}, +%D \type{stroke}, \type{fill} and \type{fillstroke} become +%D 1, 2, 3 and~4. +%D +%D When processing the path this code can be retrieved +%D using +%D +%D \starttyping +%D \getMPkeyword % {n} +%D \stoptyping +%D +%D When setting an argument, the exact position on the stack +%D depends on the current value of the \COUNTERS\ +%D \type{\nofMPsegments} and \type{\nofMParguments}. + +\newcount\nofMPsegments +\newcount\nofMParguments + +%D These variables hold the coordinates. The argument part of +%D the stack is reset by: +%D +%D \starttyping +%D \resetMPstack +%D \stoptyping +%D +%D We use the prefix \type{@@MP} to keep the stack from +%D conflicting with existing macros. To speed up things a bit +%D more, we use the constant \type{\@@MP}. + +\def\@@MP{@@MP} + +\def\setMPargument% #1% + {\advance\nofMParguments \plusone + \expandafter\def\csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname} % {#1} + +\def\letMPargument + {\advance\nofMParguments \plusone + \expandafter\let\csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname} + +\def\setMPsequence#1 % + {\advance\nofMParguments \plusone + \expandafter\def\csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname{#1}% + \handleMPsequence} + +\def\gMPa#1% + {\csname\@@MP0\number#1\endcsname} + +\def\gMPs#1% + {\csname\@@MP\the\nofMPsegments\number#1\endcsname} + +\def\dogMPa#1% + {\@EAEAEA\do\csname\@@MP0\number#1\endcsname} + +\def\setMPkeyword#1 % + {\expandafter\def\csname\@@MP\the\nofMPsegments0\endcsname{#1}% + \advance\nofMPsegments \plusone + \nofMParguments\zerocount} + +\def\getMPkeyword% #1% + {\csname\@@MP\the\nofMPsegments0\endcsname} % {\csname\@@MP#10\endcsname} + +\def\docleanupMPargument#1% we need this because args can have [ or ] pre/appended + {\expandafter\edef\csname\@@MP\the\nofMPsegments\number#1\endcsname + {\csname\@@MP\the\nofMPsegments\number#1\endcsname}} + +%D When we reset the stack, we can assume that all further +%D comment is to be ignored and handled in strings. +%D By redefining the reset macro after the first call, we +%D save some run time. Only use this macro after all +%D comments are processed and use the simple alternative +%D when dealing with comments. + +\def\doresetMPstack + {\nofMParguments\zerocount} + +\def\resetMPstack + {\let\handleMPgraphic\handleMPendgraphic + \let\resetMPstack\doresetMPstack + \resetMPstack} + +%D The arguments are saved with the preceding command +%D \type{\do}. By default this command expands to nothing, but +%D when we deal with strings it's used to strip off the +%D \type{(} and \type{)}. +%D +%D Strings are kind of tricky, because characters can be +%D passed verbatim \type{(hello)}, by octal number +%D \type{(\005)} or as command \type{(\()}. We therefore +%D cannot simply ignore \type{(} and \type{)}, the way we do +%D with \type{[} and \type{]}. Another complication is that +%D strings may contain characters that normally have a +%D special meaning in \TEX, like \type{$} and \type{{}}. +%D +%D A previous solution made \type{\} an active character and +%D let it look ahead for a number or characters. We had to +%D abandon this scheme because of the need for verbatim +%D support. The next solution involved some \CATCODE\ +%D trickery but works well. + +\def\octalMPcharacter#1#2#3% + {\char'#1#2#3\relax} + +%D curly braces and squarly brackets are stored in the argument stack +%D as part of strings, for instance in: +%D +%D \starttyping +%D /fshow {exch findfont exch scalefont setfont show}bind def +%D [3 3 ] 0 setdash +%D \stoptyping +%D +%D but we need to keep them in situation like +%D +%D \starttyping +%D ([bla bla] bla bla) ec-lmr10 9.96265 fshow +%D ({bla bla} bla bla) ec-lmr10 9.96265 fshow +%D \stoptyping +%D +%D So, when we store the snippets, we keep the special tokens, and +%D when needed we either ignore or obey them + +%D We could use a catcodetable here. + +\bgroup +\catcode`\|=\@@comment +\catcode`\%=\@@active +\catcode`\[=\@@active +\catcode`\]=\@@active +\catcode`\{=\@@active +\catcode`\}=\@@active +\catcode`B=\@@begingroup +\catcode`E=\@@endgroup +\gdef\keepMPspecials| + B\let%\letterpercent| + \def[B\noexpand[E| + \def]B\noexpand]E| + \def{B\noexpand{E| + \def}B\noexpand}EE +\gdef\ignoreMPspecials| + B\let%\letterpercent| + \def[BE| + \def]BE| + \def{BE| + \def}BEE +\gdef\obeyMPspecials| + B\def%B\char 37\relax E| + \def[B\char 91\relax E| + \def]B\char 93\relax E| + \def{B\char123\relax E| + \def}B\char125\relax EE +\gdef\setMPspecials| + B\setnaturalcatcodes + \catcode`\\=\@@escape + \catcode`\%=\@@active + \catcode`\[=\@@active + \catcode`\]=\@@active + \catcode`\{=\@@active + \catcode`\}=\@@active + \lccode`\-=0 | latex sets this to `\- + \lccode`\%=`\%| otherwise it's seen as a number + \def\(B\char40\relax E| + \def\)B\char41\relax E| + \def\\B\char92\relax E| + \def\0B\octalMPcharacter0E| + \def\1B\octalMPcharacter1E| + \def\2B\octalMPcharacter2E| + \def\3B\octalMPcharacter3E| + \def\4B\octalMPcharacter4E| + \def\5B\octalMPcharacter5E| + \def\6B\octalMPcharacter6E| + \def\7B\octalMPcharacter7E| + \def\8B\octalMPcharacter8E| + \def\9B\octalMPcharacter9EE +\egroup + +%D We use the comment symbol as a sort of trigger. Beware! +%D The whole graphic is seen as on eparagraph, which means +%D that we cannot change the catcodes in between. + +\bgroup +\catcode`\%=\@@active +\gdef\startMPscanning{\let%=\startMPconversion} +\egroup + +%D In earlier versions we used the sequence +%D +%D \starttyping +%D \expandafter\handleMPsequence\input filename\relax +%D \stoptyping +%D +%D Persistent problems in \LATEX\ however forced us to use a +%D different scheme. Every \POSTSCRIPT\ file starts with a +%D \type{%}, so we temporary make this an active character +%D that starts the scanning and redefines itself. (The problem +%D originates in the redefinition by \LATEX\ of the +%D \type{\input} primitive.) + +\def\startMPconversion + {\keepMPspecials + \handleMPsequence} + +%D Here comes the main loop. Most arguments are numbers. This +%D means that they can be recognized by their \type{\lccode}. +%D This method saves a lot of processing time. We could +%D speed up the conversion by handling the \type{path} +%D seperately. + +\def\dohandleMPsequence#1% + {\ifdone + \ifcase\lccode`#1\relax + \@EAEAEA\dohandleMPsequenceA + \else + \@EAEAEA\dohandleMPsequenceB + \fi + \else + \@EA\dohandleMPsequenceC + \fi#1} + +\let\dohandleMPsequenceA\setMPsequence + +\def\installMPSkeywordN#1#2% + {\expandafter\def\csname\@@MP:N:#1\endcsname{#2}} + +\def\installMPSshortcutN#1#2% todo: \let + {\expandafter\let\csname\@@MP:N:#1\expandafter\endcsname\csname\@@MP:N:#2\endcsname} + +\def\dohandleMPsequenceB#1 % + {\edef\somestring{#1}% + \executeifdefined{\@@MP:N:\somestring}\handleMPgraphic + \handleMPsequence} + +\installMPSkeywordN \PSmoveto + {\edef\lastMPmoveX{\gMPa1}% + \edef\lastMPmoveY{\gMPa2}% + \resetMPstack} +\installMPSkeywordN \PSnewpath + {\let\handleMPsequence\handleMPpath} +\installMPSkeywordN \PSgsave + {\PDFcode{q}% + \resetMPstack} +\installMPSkeywordN \PSgrestore + {\PDFcode{Q}% + \resetMPstack} +\installMPSkeywordN \PSdtransform % == setlinewidth + {\let\handleMPsequence\handleMPdtransform} + % after that we will encounter more tokens until setlinewidth+pop + % or pop+setlinewidth which we catch next; we explicitly need to + % reset the stack since [] n setdash may follow; a more clever + % approach would be to read on till the condition is met, but it's + % the only pop / setlinewidth we will encounter so ... +\installMPSkeywordN \PSsetlinewidth + {% already handled in dtransform + \resetMPstack} +\installMPSkeywordN \PSpop + {% already handled in dtransform + \resetMPstack} +\installMPSkeywordN \PSconcat + {\cleanupMPconcat + \PDFcode{\gMPa1 \gMPa2 \gMPa3 \gMPa4 \gMPa5 \gMPa6 cm}% + \resetMPstack} +\installMPSkeywordN \PSsetrgbcolor + {\handleMPrgbcolor + \resetMPstack} +\installMPSkeywordN \PSsetcmykcolor + {\handleMPcmykcolor + \resetMPstack} +\installMPSkeywordN \PSsetgray + {\handleMPgraycolor + \resetMPstack} +\installMPSkeywordN \PStranslate + {\PDFcode{1 0 0 1 \gMPa1 \gMPa2 cm}% + \resetMPstack} +\installMPSkeywordN \PSsetdash + {\handleMPsetdash + \resetMPstack} +\installMPSkeywordN \PSsetlinejoin + {\PDFcode{\gMPa1 j}% + \resetMPstack} +\installMPSkeywordN \PSsetmiterlimit + {\PDFcode{\gMPa1 M}% + \resetMPstack} +\installMPSkeywordN \PSfshow + {%\PDFcode{n}% removed ! + \handleMPfshow + \resetMPstack} +\installMPSkeywordN \PSsetlinecap + {\PDFcode{\gMPa1 J}% + \resetMPstack} +\installMPSkeywordN \PSrlineto + {\flushMPmoveto + \PDFcode{\!MP\lastMPmoveX\space\!MP\lastMPmoveY\space l S}% + \resetMPmoveto + \resetMPstack} +\installMPSkeywordN \PSscale + {\PDFcode{\gMPa1 0 0 \gMPa2 0 0 cm}% + \resetMPstack} +\installMPSkeywordN \PSspecial + {\handleMPspecialcommand + \resetMPstack} + +\installMPSshortcutN {n} \PSnewpath +\installMPSshortcutN {p} \PSclosepath +\installMPSshortcutN {l} \PSlineto +\installMPSshortcutN {r} \PSrlineto +\installMPSshortcutN {m} \PSmoveto +\installMPSshortcutN {c} \PScurveto +\installMPSshortcutN {C} \PSsetcmykcolor +\installMPSshortcutN {G} \PSsetgray +\installMPSshortcutN {R} \PSsetrgbcolor +\installMPSshortcutN {lj} \PSsetlinejoin +\installMPSshortcutN {ml} \PSsetmiterlimit +\installMPSshortcutN {lc} \PSsetlinecap +\installMPSshortcutN {sd} \PSsetdash +\installMPSshortcutN {S} \PSstroke +\installMPSshortcutN {F} \PSfill +\installMPSshortcutN {W} \PSclip + +\installMPSshortcutN {q} \PSgsave +\installMPSshortcutN {Q} \PSgrestore + +\installMPSshortcutN {s} \PSscale +\installMPSshortcutN {t} \PSconcat +\installMPSshortcutN {P} \PSshowpage + +\installMPSkeywordN {hlw} {\PDFcode{\gMPa1 w}\resetMPstack} +\installMPSkeywordN {vlw} {\PDFcode{\gMPa1 w}\resetMPstack} +\installMPSkeywordN {rd} {\PDFcode{[] 0 d}\resetMPstack} + +\def\dohandleMPsequenceC#1 % + {\edef\somestring{#1}% + \handleMPgraphic + \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{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 rg + \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 RG}} + +\def\handleMPcmykcolor + {\PDFcode{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 k + \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 K}} + +\def\handleMPgraycolor + {\PDFcode{\!MPgMPa1 g + \!MPgMPa1 G}} + +\def\handleMPspotcolor + {\PDFcode{0 g + 0 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% + {\ifx\somestring\PSshowpage + \let\handleMPsequence\finishMPgraphic + \else\ifx\somestring\PSEof + \let\handleMPsequence\finishMPgraphic + \else + \letMPargument\somestring % {#1}% + \fi\fi} + +\def\handleMPbegingraphic % #1% + {\ifx\somestring\PSBoundingBox + \def\handleMPsequence{\handleMPboundingbox1}% + \else\ifx\somestring\PSHiResBoundingBox + \def\handleMPsequence{\handleMPboundingbox2}% + \else\ifx\somestring\PSExactBoundingBox + \def\handleMPsequence{\handleMPboundingbox3}% + \else\ifx\somestring\PSshowpage + \let\handleMPsequence\finishMPgraphic + \else\ifx\somestring\PSEof + \let\handleMPsequence\finishMPgraphic + \else\ifx\somestring\PSPage + \let\handleMPsequence\handleMPpage + \else\ifx\somestring\PSMetaPostSpecials + \let\handleMPsequence\handleMPspecialscomment + \else\ifx\somestring\PSMetaPostSpecial + \let\handleMPsequence\handleMPspecialcomment + \else\ifx\somestring\PSBeginProlog + \let\handleMPsequence\handleMPprolog + \else + \letMPargument\somestring % {#1}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi} + +\let\handleMPgraphic=\handleMPbegingraphic + +%D New: we can best filter the prolog because nowdays it can contain +%D quite some code. + +% hm, catcode mess, so we need to tweak %'s catcode here +% \long\expandafter\def\expandafter\handleMPprolog\expandafter#\expandafter1\PSEndProlog% +% but today i'm not in the mood for ugly stuff + +\long\def\handleMPprolog#1EndProlog % + {\doresetMPstack + \let\handleMPsequence\dohandleMPsequence + \handleMPsequence} + +%D We check for three kind of bounding boxes: the normal one +%D and two high precision ones: +%D +%D \starttyping +%D BoundingBox: llx lly ucx ucy +%D HiResBoundingBox: llx lly ucx ucy +%D ExactBoundingBox: llx lly ucx ucy +%D \stoptyping +%D +%D The original as well as the recalculated dimensions are +%D saved for later use. + +\newif\ifskipemptyMPgraphic \skipemptyMPgraphicfalse + +\chardef\currentMPboundingbox=0 + +\def\handleMPboundingbox#1#2 #3 #4 #5 + {\ifnum#1>\currentMPboundingbox + \chardef\currentMPboundingbox#1\relax + \xdef\MPllx {#2}% + \xdef\MPlly {#3}% + \xdef\MPurx {#4}% + \xdef\MPury {#5}% + \xdef\MPwidth {\the\dimexpr\MPurx\onebasepoint-\MPllx\onebasepoint\relax}% + \xdef\MPheight{\the\dimexpr\MPury\onebasepoint-\MPlly\onebasepoint\relax}% + \fi + \doresetMPstack + \let\handleMPsequence\dohandleMPsequence + \let\next\handleMPsequence + \ifskipemptyMPgraphic + \ifdim\MPheight=\zeropoint\ifdim\MPwidth=\zeropoint + \def\next{\endinput\finishMPgraphic}% + \fi\fi + \fi + \next} + +%D Unless defined otherwise, we simply ignore specialcomments. + +\def\handleMPspecialcomment + {\doresetMPstack + \let\handleMPsequence\dohandleMPsequence + \handleMPsequence} + +\let\handleMPspecialscomment\handleMPspecialcomment + +%D We use the \type{page} comment as a signal that +%D stackbuilding can be started. + +\def\handleMPpage #1 #2 + {\doresetMPstack + \donetrue + \let\handleMPsequence\dohandleMPsequence + \handleMPsequence} + +%D The same applies to the special extensions. + +\def\handleMPspecialcommand + {\doresetMPstack + \let\handleMPsequence\dohandleMPsequence + \handleMPsequence} + +%D \METAPOST\ draws its dots by moving to a location and +%D invoking \type{0 0 rlineto}. This operator is not +%D available in \PDF. Our solution is straightforward: we draw +%D a line from $(current\_x, current\_y)$ to itself. This +%D means that the arguments of the preceding \type{moveto} have +%D to be saved. + +%D These saved coordinates are also used when we handle the +%D texts. Text handling proved to be a bit of a nuisance, but +%D finally I saw the light. It proved that we also had to +%D take care of \type{(split arguments)}. + +\def\setMPfshowfont#1#2% + {\font\temp=#1\space at #2\relax\temp} + +\let\MPfshowcommand\empty + +\def\dohandleMPfshow + {\setbox\scratchbox\hbox + {\obeyMPspecials + \edef\MPtextsize{\gMPa\nofMParguments}% + \def\do(##1){##1}% + \edef\MPtextdata{\dogMPa1}% beware, stack can have more + \handleMPtext}% + \setbox\scratchbox\hbox + {\hskip\lastMPmoveX\onebasepoint + \raise\lastMPmoveY\onebasepoint + \box\scratchbox}% + \smashbox\scratchbox + \box\scratchbox} + +\def\handleMPtext {\handleMPtextnormal} % so we can overload this one later +\def\handleMPfshow{\dohandleMPfshow } % so we can overload this one later + +\def\handleMPtext + {\ifnum\nofMParguments>\plusthree + \handleMPtextnormal + \else + \convertcommand\MPtextdata\to\MPtextdata + \expanded{\splitstring\MPtextdata}\at::::\to\MPtexttag\and\MPtextnumber + \executeifdefined{handleMPtext\MPtexttag}\handleMPtextnormal + \fi} + +% elsewhere we will implement \handleMPtextmptxt + +\def\handleMPtextnormal + {\let\ \relax % mp breaks long lines and appends a \ + \ifx\MPtextsize\PSnfont % round font size (to pt) + \advance\nofMParguments \minusone + \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax + \ifdim\scratchdimen<\onepoint + \def\MPtextsize{1pt}% + \else + \advance\scratchdimen .5\onepoint + \def\MPtextsize##1.##2\relax{\def\MPtextsize{##1pt}}% + \expandafter\MPtextsize\the\scratchdimen\relax + \fi + \else + \edef\MPtextsize{\MPtextsize bp}% + \fi + \advance\nofMParguments \minusone + \setMPfshowfont{\gMPa\nofMParguments}\MPtextsize + \advance\nofMParguments \minusone + \temp + \MPfshowcommand + {\ifnum\nofMParguments=\plusone + \def\do(##1){##1}% + \dogMPa1% + \else + % we need to catch ( a ) (a a a) (\123 \123 \123) etc + \scratchcounter\plusone + \def\dodo##1% Andreas Fieger's bug: (\304...) + {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 + \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% + \def\do(##1{\dodo{##1}}% + \dogMPa\scratchcounter\MPspacechar + \let\do\relax + \loop + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\nofMParguments\relax + \gMPa\scratchcounter\MPspacechar + \repeat + \def\do##1){\dodo{##1}}% + \dogMPa\scratchcounter + \fi + \unskip}} + +%D You could consider the following definition to be the most +%D natural one. + +% \def\MPspacechar{\space} % normal case + +\def\MPspacechar{\char32\relax} % old solution does not work with math + +%D However, the following implementation is more robust, since +%D some fonts have funny visible spaces in the space slot. This +%D gives a mismatch between the space that \METAPOST\ took into +%D account and the \quote {natural} space. This only happens in +%D labels, since \type {btex}||\type {etex} thingies don't have +%D spaces. This phenomena showed up when preparing the +%D \METAFUN\ manual, where Palatino fonts are used. We can +%D safely assume that \METAPOST\ considers \type {\char32} to +%D be the space. + +\def\MPspacechar{\setbox\scratchbox\hbox{\char32}\kern\wd\scratchbox} + +%D Well, this does not work with math fonts, so: + +\def\MPspacechar{\char32\relax} + +%D Most operators are just converted and keep their +%D arguments. Dashes however need a bit different treatment, +%D otherwise \PDF\ viewers complain loudly. Another +%D complication is that one argument comes after the \type{]}. +%D When reading the data, we simply ignore the array boundary +%D characters. We save ourselves some redundant newlines and +%D at the same time keep the output readable by packing the +%D literals. + +\def\handleMPsetdash + {\bgroup + \ignoreMPspecials + \let\somestring\empty + \scratchcounter\plusone + \loop + \ifnum\scratchcounter<\nofMParguments + \edef\somestring{\somestring\space\gMPa\scratchcounter}% + \advance\scratchcounter \plusone + \repeat + \edef\somestring{[\somestring]\space\gMPa\scratchcounter\space d}% + \PDFcode{\somestring}% + \egroup} + +%D The \type{setlinewidth} commands looks a bit complicated. There are +%D two alternatives, that result in a similar look in both +%D $x$- and $y$-dorection. As John Hobby says: +%D +%D \startnarrower \switchtobodyfont[ss] +%D \starttyping +%D x 0 dtransform exch truncate exch idtransform pop setlinewidth +%D 0 y dtransform truncate idtransform setlinewidth pop +%D \stoptyping +%D +%D These are just fancy versions of \type{x setlinewidth} and +%D \type{y setlinewidth}. The \type{x 0 ...} form is used if +%D the path is {\em primarily vertical}. It rounds the width +%D so that vertical lines come out an integer number of pixels +%D wide in device space. The \type{0 y ...} form does the same +%D for paths that are {\em primarily horizontal}. The reason +%D why I did this is Knuth insists on getting exactly the +%D widths \TEX\ intends for the horizontal and vertical rules +%D in \type{btex...etex} output. (Note that PostScript scan +%D conversion rules cause a horizontal or vertical line of +%D integer width $n$ in device space to come out $n+1$ pixels +%D wide, regardless of the phase relative to the pixel grid.) +%D \stopnarrower +%D +%D The common operator in these sequences is \type{dtransform}, +%D so we can use this one to trigger setting the linewidth. + +\def\handleMPdtransform + {\ifdim\gMPa1\onepoint>\zeropoint + \PDFcode{\gMPa1 w}% + \def\next##1 ##2 ##3 ##4 ##5 ##6 {\handleMPsequence}% + \else + \PDFcode{\gMPa2 w}% + \def\next##1 ##2 ##3 ##4 {\handleMPsequence}% + \fi + \let\handleMPsequence\dohandleMPsequence + \resetMPstack + \next} + +%D The most complicated command is \type{concat}. \METAPOST\ +%D applies this operator to \type{stroke}. At that moment the +%D points set by \type{curveto} and \type{moveto}, are already +%D fixed. In \PDF\ however the \type{cm} operator affects the +%D points as well as the pen (stroke). Like more \PDF\ +%D operators, \type{cm} is defined in a bit ambiguous way. +%D The only save route for non||circular penshapes, is saving +%D the path, recalculating the points and applying the +%D transformation matrix in such a way that we can be sure +%D that its behavior is well defined. This comes down to +%D inverting the path and applying \type{cm} to that path as +%D well as the pen. This all means that we have to save the +%D path. + +%D In \METAPOST\ there are three ways to handle a path $p$: +%D +%D \starttyping +%D draw p; fill p; filldraw p; +%D \stoptyping +%D +%D The last case outputs a \type{gsave fill grestore} before +%D \type{stroke}. Handling the path outside the main loops +%D saves about 40\% run time.\footnote{We can save some more by +%D following the \METAPOST\ output routine, but for the moment +%D we keep things simple.} Switching between the main loop and +%D the path loop is done by means of the recursely called +%D macro \type{\handleMPsequence}. + +\def\handleMPpath + {\chardef\finiMPpath\zerocount + \let\closeMPpath\relax + \let\flushMPpath\flushnormalMPpath + \resetMPstack + \nofMPsegments\plusone + \let\handleMPsequence\dohandleMPpath + \dohandleMPpath} + +%D Most paths are drawn with simple round pens. Therefore we've +%D split up the routine in two. + +\def\resetMPmoveto + {\let\lastMPmoveX\empty + \let\lastMPmoveY\empty} + +\resetMPmoveto + +\def\flushMPmoveto + {\ifx\lastMPmoveX\empty \else + \PDFcode{\!MP\lastMPmoveX\space \!MP\lastMPmoveY\space m}% + \fi} + +\def\flushnormalMPsegment + {\ifcase\getMPkeyword\relax + \flushMPmoveto + \resetMPmoveto + \PDFcode{\!MPgMPs1 \!MPgMPs2 l}% + \or + \flushMPmoveto + \resetMPmoveto + \PDFcode{\!MPgMPs1 \!MPgMPs2 \!MPgMPs3 \!MPgMPs4 \!MPgMPs5 \!MPgMPs6 c}% + \or + \ifx\lastMPmoveX\empty \else % bugged + \flushMPmoveto + \PDFcode{\!MP\lastMPmoveX\space \!MP\lastMPmoveY\space l S}% + \resetMPmoveto + \fi + \or + % \flushMPmoveto + % \resetMPmoveto + \fi} + +\def\flushMPconcatmoveto + {\ifx\lastMPmoveX\empty\else + \doMPconcat\lastMPmoveX\lastMPmoveX\lastMPmoveY\lastMPmoveY + \flushMPmoveto + \fi} + +\def\flushconcatMPsegment + {\ifcase\getMPkeyword\relax + \flushMPconcatmoveto + \resetMPmoveto + \doMPconcat{\gMPs1}\a{\gMPs2}\b% + \PDFcode{\!MP\a\space\!MP\b\space l}% + \or + \flushMPconcatmoveto + \resetMPmoveto + \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 + \flushMPconcatmoveto + \resetMPmoveto + \PDFcode{\!MP\a\space\!MP\b\space l S}% + \egroup + \or +% \flushMPconcatmoveto +% \resetMPmoveto + \fi} + +\def\doflushsomeMPpath + {\dodoflushsomeMPpath + \advance\nofMPsegments \plusone + \ifnum\nofMPsegments<\scratchcounter + \expandafter\doflushsomeMPpath + \fi} + +\def\flushsomeMPpath + {\scratchcounter\nofMPsegments + \nofMPsegments\plusone + \doflushsomeMPpath} + +\def\flushnormalMPpath{\let\dodoflushsomeMPpath\flushnormalMPsegment\flushsomeMPpath} + +%OLD \def\flushconcatMPpath{\let\dodoflushsomeMPpath\flushconcatMPsegment\flushsomeMPpath} + +%NEW pre-calculate 1/D so it needn't be repeated for each control point. + +\def\flushconcatMPpath + {\MPreciprocaldeterminant + \let\dodoflushsomeMPpath\flushconcatMPsegment\flushsomeMPpath} + +%D The transformation of the coordinates is handled by one of +%D the macros Tanmoy posted to the \PDFTEX\ mailing list. +%D I rewrote and optimized the original macro to suit the other +%D macros in this module. +%D +%D \starttyping +%D \doMPconcat {x position} \xresult {y position} \yresult +%D \stoptyping +%D +%D By setting the auxiliary \DIMENSIONS\ \type{\dimen0} upto +%D \type{\dimen10} only once per path, we save over 20\% run +%D time. Some more speed was gained by removing some parameter +%D passing. These macros can be optimized a bit more by using +%D more constants. There is however not much need for further +%D optimization because penshapes usually are round and +%D therefore need no transformation. Nevertheless we move the +%D factor to the outer level and use a bit different \type{pt} +%D removal macro. Although the values represent base points, +%D we converted them to pure points, simply because those can +%D be converted back. + +%OLD \mathchardef\MPconcatfactor=256 % beware don't remove spaces before it + +%OLD \def\doMPreducedimen#1 +%OLD {\count0\MPconcatfactor +%OLD \advance\dimen#1 \ifdim\dimen#1>\zeropoint .5\else -.5\fi\count0 +%OLD \divide\dimen#1 \count0\relax} + +%OLD % too inaccurate (see old pragma logo) +%OLD +%OLD \def\doMPreducedimen#1 +%OLD {\count0=\MPconcatfactor +%OLD \divide\dimen#1 \count0\relax} + +%OLD \def\doMPreducedimen#1 +%OLD {\advance\dimen#1 \ifdim\dimen#1>\zeropoint .5\else -.5\fi\MPconcatfactor +%OLD \divide\dimen#1 \MPconcatfactor} + +%D The transformation code is rewritten by Daniel H. Luecking who +%D describes his patch as follows: +%D +%D We would like to divide 1 by $X$, but all divisions are integer so +%D for accuracy we want to convert to large integers and make sure the +%D integer quotient has as many significant digits as possible. Thus we +%D need to replace $1/X$ with $M/N$ where $N$ is as large as possible +%D and $M/N$ is as large as possible. Also for simplicity $M$ should be +%D a power of 2. So we make $M = 2^{30}$ \footnote{$2^{31} - 1$ is the +%D largest legal integer. Using it (and simply ignoring the inaccuracy +%D caused by $-1$) turns out to be at least as accurate in all cases, +%D and more accurate in some.} (largest legal power of 2) and adjust +%D $X$ downward (if necessary) to the the range $1-2^{16}$. This gives +%D at least 15 significant binary digits, (almost as accurate as +%D \METAPOST\ for numbers near 1) or almost 5 significant figures +%D (decimal). + +\newcount\MPscratchCnt +\newdimen\MPscratchDim % will be assigned global + +\def\MPadjustdimen % sets \MPscratchDim and \MPscratchCnt + {\MPscratchCnt\zerocount + \doMPadjustdimen} + +\def\doMPadjustdimen + {\ifdim\MPscratchDim>\onepoint + \divide \MPscratchDim\plustwo + \advance\MPscratchCnt\plusone + \expandafter\doMPadjustdimen + \fi} + +%OLD \def\doMPexpanddimen#1 +%OLD {\multiply\dimen#1 \MPconcatfactor\relax} + +%D DHL: When viewed as an integer, $1 \hbox{pt}=2^{16}$ so $2^{32}/X$ +%D is the right way to do $(1 \hbox{pt})/(X \hbox{pt})$ and get the +%D answer in points. But we are limited to $2^{30}/X$. However, we +%D actually do $[ 2^{30} / (X/2^K) ]*2^{2-K}$ where $K$ is the number +%D of halvings it takes to bring $X$ below $1 \hbox{pt}$. If $K$ is 0 +%D or 1 we readjust by multiplying by 4 or 2, otherwise by halving +%D $(K-2)$ times \type {\MPscratchCnt} holds the value of $K$ from +%D \type {\MPadjustdimen}. + +\def\MPreadjustdimen % acts on \MPscratchDim and MPscratchCnt + {\ifcase\MPscratchCnt + \multiply\scratchdimen \plusfour + \or + \multiply\scratchdimen \plustwo + \else + \expandafter\doMPreadjustdimen + \fi} + +\def\doMPreadjustdimen + {\ifnum\MPscratchCnt>\plustwo + \divide \scratchdimen\plustwo + \advance\MPscratchCnt\minusone + \expandafter\doMPreadjustdimen + \fi} + +\def\MPreciprocaldeterminant + {\scratchdimen\withoutpt\the\dimen0 \dimen6 % s_x*s_y + \advance\scratchdimen -\withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y + \ifdim\scratchdimen<\zeropoint % we need a positive dimension + \scratchdimen-\scratchdimen % for \MPadjustdimen (?) + \doMPreciprocal + \scratchdimen-\scratchdimen + \else + \doMPreciprocal + \fi + \edef\MPreciprocal{\withoutpt\the\scratchdimen}} + +\newcount\MPnumerator \MPnumerator = 1073741824 % 2^{30} + +% todo: dimexpr + +\def\doMPreciprocal % replace \scratchdimen with its reciprocal + {\ifdim\scratchdimen=\onepoint \else + \MPadjustdimen + \scratchcounter\MPnumerator + \divide\scratchcounter\scratchdimen + \scratchdimen1\scratchcounter % 1 needed + \MPreadjustdimen + \fi} + +%OLD \def\presetMPconcat +%OLD {\dimen 0=\gMPs1\onepoint \doMPreducedimen 0 % r_x +%OLD \dimen 2=\gMPs2\onepoint \doMPreducedimen 2 % s_x +%OLD \dimen 4=\gMPs3\onepoint \doMPreducedimen 4 % s_y +%OLD \dimen 6=\gMPs4\onepoint \doMPreducedimen 6 % r_y +%OLD \dimen 8=\gMPs5\onepoint \doMPreducedimen 8 % t_x +%OLD \dimen10=\gMPs6\onepoint \doMPreducedimen10 } % t_y +%OLD +%OLD \def\presetMPscale +%OLD {\dimen 0=\gMPs1\onepoint \doMPreducedimen 0 +%OLD \dimen 2 \zeropoint +%OLD \dimen 4 \zeropoint +%OLD \dimen 6=\gMPs2\onepoint \doMPreducedimen 6 +%OLD \dimen 8 \zeropoint +%OLD \dimen10 \zeropoint} + +\def\cleanupMPconcat + {\ignoreMPspecials + \docleanupMPargument1% + \docleanupMPargument6% + \keepMPspecials} + +\def\presetMPconcat + {\dimen 0=\gMPs1\onepoint % s_x + \dimen 2=\gMPs2\onepoint % r_x + \dimen 4=\gMPs3\onepoint % r_y + \dimen 6=\gMPs4\onepoint % s_y + \dimen 8=\gMPs5\onepoint % t_x + \dimen10=\gMPs6\onepoint} % t_y + +\def\presetMPscale + {\dimen 0=\gMPs1\onepoint + \dimen 2 \zeropoint + \dimen 4 \zeropoint + \dimen 6=\gMPs2\onepoint + \dimen 8 \zeropoint + \dimen10 \zeropoint} + +\def\noMPtranslate % use this one grouped + {\dimen 8 \zeropoint % t_x + \dimen10 \zeropoint} % t_y + +%D \starttyping +%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 \doMPreducedimen16 +%D \divide \dimen18 \dimen16 \doMPexpanddimen18 +%D \divide \dimen12 \dimen16 \doMPexpanddimen12 +%D % +%D \edef#2{\withoutpt\the\dimen18}% % p_x^\prime +%D \edef#4{\withoutpt\the\dimen12}} % p_y^\prime +%D \stoptyping + +%D The following optimization resulted from some tests by +%D and email exchanges with Sanjoy Mahajan. +%D +%D \starttyping +%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>\onepoint % oeps, can be < 1pt too +%D \ifdim\dimen16=\onepoint \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 \stoptyping +%D +%D But, this one is still too inaccurate, so we now have: + +%D We cannot use \type {\beginETEX} here since in plain we +%D get \type {\outer} problems, sigh. + +%OLD \beginTEX +%OLD +%OLD \def\MPcriteriumA {512pt} % scale +%OLD \def\MPcriteriumB {2pt} % scale +%OLD +%OLD \endTEX +%OLD +%OLD \ifx\MPcriteriumA\undefined +%OLD +%OLD \newdimen\MPcriteriumA \MPcriteriumA=512pt +%OLD \newdimen\MPcriteriumB \MPcriteriumB= 2pt +%OLD +%OLD \fi + +%OLD \def\doMPconcat#1#2#3#4% +%OLD {\dimen12=#1\onepoint % p_x +%OLD \dimen14=#3\onepoint % p_y +%OLD % +%OLD \chardef\MPfactor\zerocount +%OLD \ifdim\dimen4<\MPcriteriumB\ifdim\dimen4>-\MPcriteriumB +%OLD \ifdim\dimen6<\MPcriteriumB\ifdim\dimen6>-\MPcriteriumB +%OLD \ifdim\dimen8<\MPcriteriumB\ifdim\dimen8>-\MPcriteriumB +%OLD \ifdim\dimen10<\MPcriteriumB\ifdim\dimen10>-\MPcriteriumB +%OLD \chardef\MPfactor\plusone +%OLD \fi\fi +%OLD \fi\fi +%OLD \fi\fi +%OLD \fi\fi +%OLD \ifcase\MPfactor % spurious 0 removed +%OLD \chardef\MPfactor\plusone +%OLD \ifdim\dimen12<\MPcriteriumA\ifdim\dimen12>-\MPcriteriumA +%OLD \ifdim\dimen14<\MPcriteriumA\ifdim\dimen14>-\MPcriteriumA +%OLD \chardef\MPfactor16 +%OLD \fi\fi +%OLD \fi\fi +%OLD \fi +%OLD % +%OLD \multiply\dimen12 \MPfactor +%OLD \multiply\dimen14 \MPfactor +%OLD % +%OLD \doMPreducedimen12 +%OLD \doMPreducedimen14 +%OLD % +%OLD \dimen16 \dimen 0 +%OLD \multiply \dimen16 \dimen 6 +%OLD \dimen20 \dimen 2 +%OLD \multiply \dimen20 \dimen 4 +%OLD \advance \dimen16 -\dimen20 +%OLD % +%OLD \dimen18 \dimen12 +%OLD \multiply \dimen18 \dimen 6 +%OLD \dimen20 \dimen14 +%OLD \multiply \dimen20 \dimen 4 +%OLD \advance \dimen18 -\dimen20 +%OLD \dimen20 \dimen 4 +%OLD \multiply \dimen20 \dimen10 +%OLD \advance \dimen18 \dimen20 +%OLD \dimen20 \dimen 6 +%OLD \multiply \dimen20 \dimen 8 +%OLD \advance \dimen18 -\dimen20 +%OLD % +%OLD \multiply \dimen12 -\dimen 2 +%OLD \multiply \dimen14 \dimen 0 +%OLD \advance \dimen12 \dimen14 +%OLD \dimen20 \dimen 2 +%OLD \multiply \dimen20 \dimen 8 +%OLD \advance \dimen12 \dimen20 +%OLD \dimen20 \dimen 0 +%OLD \multiply \dimen20 \dimen10 +%OLD \advance \dimen12 -\dimen20 +%OLD % +%OLD \ifdim\dimen16=\onepoint \else +%OLD \ifdim\dimen16>\MPconcatfactor \onepoint \relax +%OLD \doMPreducedimen16 +%OLD \divide \dimen18 \dimen16 \doMPexpanddimen18 +%OLD \divide \dimen12 \dimen16 \doMPexpanddimen12 +%OLD \else +%OLD \divide \dimen18 \dimen16 \doMPexpanddimen18 \doMPexpanddimen18 +%OLD \divide \dimen12 \dimen16 \doMPexpanddimen12 \doMPexpanddimen12 +%OLD \fi +%OLD \fi +%OLD % +%OLD \divide\dimen18 \MPfactor +%OLD \divide\dimen12 \MPfactor +%OLD % +%OLD \edef#2{\withoutpt\the\dimen18}% % p_x^\prime +%OLD \edef#4{\withoutpt\the\dimen12}} % p_y^\prime + +%D DHL: Ideally, $r_x$, $r_y$, $s_x$, $s_y$ should be in macros, not +%D dimensions (they are scalar quantities after all, not lengths). I +%D suppose the authors decided to do calculations with integer +%D arithmetic instead of using real factors because it's faster. +%D However, the actual macros test slower, possibly because I've +%D omitted three nested loops. In my test files, my approach is more +%D accurate. It is also far simpler and overflow does not seem to be a +%D significant concern. The scale factors written by Metapost are (?) +%D always $<=1$ (it scales coordinates internally) and coordinates are +%D always likely to be less than \type {\maxdimen}. +%D +%D If this should ever cause problems, the scale factors can be reduced. + +% the original: +% +% \def\doMPconcat#1#2#3#4% +% {\dimen12=#1\onepoint% p_x % #1\onepoint +% \dimen14=#3\onepoint% p_y % #3\onepoint +% \advance\dimen12 -\dimen8 % p_x - t_x +% \advance\dimen14 -\dimen10 % p_y - t_y +% \dimen18=\withoutpt\the\dimen6 \dimen12 % s_y(p_x - t_x) +% \advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y) +% \dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y) +% \advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x) +% % \MPreciprocal contains precomputed 1/D: +% \dimen18=\MPreciprocal\dimen18 +% \dimen14=\MPreciprocal\dimen14 +% \edef#2{\withoutpt\the\dimen18}% % p_x^\prime +% \edef#4{\withoutpt\the\dimen14}} % p_y^\prime +% +% faster but not that often used + +\def\doMPconcat#1#2#3#4% + {\dimen12\dimexpr#1\points-\dimen 8\relax % p_x-t_x + \dimen14\dimexpr#3\points-\dimen10\relax % p_y-t_y + \dimen18\dimexpr\withoutpt\the\dimen6\dimen12-\withoutpt\the\dimen4\dimen14\relax % s_y(p_x-t_x)-r_y(p_y-t_y) + \dimen14\dimexpr\withoutpt\the\dimen0\dimen14-\withoutpt\the\dimen2\dimen12\relax % s_x(p_y-t_y)-r_x(p_x-t_x) + \edef#2{\withoutpt\the\dimexpr\MPreciprocal\dimen18\relax}% % p_x^\prime + \edef#4{\withoutpt\the\dimexpr\MPreciprocal\dimen14\relax}} % p_y^\prime + +%D One reason for Daniel to write this patch was that at small sizes +%D the accuracy was less than optimal. Here is a test that demonstrates +%D that his alternative is pretty good: +%D +%D \startlinecorrection +%D \startMPcode +%D for i = 5cm,1cm,5mm,1mm,.5mm,.1mm,.01mm : +%D draw fullcircle scaled i withpen pencircle xscaled (i/10) yscaled (i/20) rotated 45 ; +%D endfor ; +%D \stopMPcode +%D \stoplinecorrection + +%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 +%D cosinus calculations as well as scaling and translating. The +%D \METAPOST\ to \PDF\ conversion however only needs +%D transformation. + +%M \start \switchtobodyfont [ss] + +%D Given a point $(U_x, U_y)$ in user coordinates, the business +%D of \POSTSCRIPT\ is to convert it to device space. Let us say +%D that the device space coordinates are $(D_x, D_y)$. Then, in +%D \POSTSCRIPT\ $(D_x, D_y)$ can be written in terms of +%D $(U_x, U_y)$ in matrix notation, either as +%D +%D \placeformula +%D \startformula +%D \pmatrix{D_x&D_y&1\cr} = \pmatrix{U_x&U_y&1\cr} +%D \pmatrix{s_x&r_x&0\cr +%D r_y&s_y&0\cr +%D t_x&t_y&1\cr} +%D \stopformula +%D +%D or +%D +%D \placeformula +%D \startformula +%D \pmatrix{D_x\cr D_y\cr 1} = \pmatrix{s_x&r_y&t_x\cr +%D r_x&s_y&t_y\cr +%D 0 &0 &1 \cr} +%D \pmatrix{U_x\cr +%D U_y\cr +%D 1 \cr} +%D \stopformula +%D +%D both of which is a shorthand for the same set of equations: +%D +%D \placeformula +%D \startformula +%D D_x = s_x U_x + r_y U_y + t_x +%D \stopformula +%D +%D \placeformula +%D \startformula +%D D_y = r_x U_x + s_y U_y + t_y +%D \stopformula +%D +%D which define what is called an `affine transformation'. +%D +%D \POSTSCRIPT\ represents the `transformation matrix' as a +%D six element matrix instead of a $3\times 3$ array because +%D three of the elements are always~0, 0 and~1. Thus the above +%D transformation is written in postscript as $[s_x\, r_x\, +%D r_y\, s_y\, t_x\, t_y]$. However, when doing any +%D calculations, it is useful to go back to the original +%D matrix notation (whichever: I will use the second) and +%D continue from there. +%D +%D As an example, if the current transformation matrix is +%D $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$ and you say \typ{[a b +%D c d e f] concat}, this means: +%D +%D \startnarrower +%D Take the user space coordinates and transform them to an +%D intermediate set of coordinates using array $[a\, b\, c\, d\, +%D e\, f]$ as the transformation matrix. +%D +%D Take the intermediate set of coordinates and change them to +%D device coordinates using array $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$ +%D as the transformation matrix. +%D \stopnarrower +%D +%D Well, what is the net effect? In matrix notation, it is +%D +%D \placeformula +%D \startformula +%D \pmatrix{I_x\cr I_y\cr 1\cr} = \pmatrix{a&c&e\cr +%D b&d&f\cr +%D 0&0&1\cr} +%D \pmatrix{U_x\cr +%D U_y\cr +%D 1 \cr} +%D \stopformula +%D +%D \placeformula +%D \startformula +%D \pmatrix{D_y\cr D_y\cr 1\cr} = \pmatrix{s_x&r_y&t_x\cr +%D r_x&s_y&t_y\cr +%D 0 &0 &1 \cr} +%D \pmatrix{I_x\cr +%D I_y\cr +%D 1 \cr} +%D \stopformula +%D +%D where $(I_x, I_y)$ is the intermediate coordinate. +%D +%D Now, the beauty of the matrix notation is that when there is +%D a chain of such matrix equations, one can always compose +%D them into one matrix equation using the standard matrix +%D composition law. The composite matrix from two matrices can +%D be derived very easily: the element in the $i$\high{th} +%D horizontal row and $j$\high{th} vertical column is +%D calculated by`multiplying' the $i$\high{th} row of the first +%D matrix and the $j$\high{th} column of the second matrix (and +%D summing over the elements). Thus, in the above: +%D +%D \placeformula +%D \startformula +%D \pmatrix{D_x\cr D_y\cr 1} = \pmatrix{s_x^\prime&r_y^\prime&t_x^\prime\cr +%D r_x^\prime&s_y^\prime&t_y^\prime\cr +%D 0 &0 &0 \cr} +%D \pmatrix{U_x\cr +%D U_y\cr +%D 1 \cr} +%D \stopformula +%D +%D with +%D +%D \placeformula +%D \startformula +%D \eqalign +%D {s_x^\prime & = s_x a + r_y b \cr +%D r_x^\prime & = r_x a + s_y b \cr +%D r_y^\prime & = s_x c + r_y d \cr +%D s_y^\prime & = r_x c + s_y d \cr +%D t_x^\prime & = s_x e + r_y f + t_x \cr +%D t_y^\prime & = r_x e + s_y f + t_y \cr} +%D \stopformula + +%D In fact, the same rule is true not only when one is going +%D from user coordinates to device coordinates, but whenever +%D one is composing two `transformations' together +%D (transformations are `associative'). Note that the formula +%D is not symmetric: you have to keep track of which +%D transformation existed before (i.e.\ the equivalent of +%D $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$) and which was +%D specified later (i.e.\ the equivalent of $[a\, b\, c\, d\, +%D e\, f]$). Note also that the language can be rather +%D confusing: the one specified later `acts earlier', +%D converting the user space coordinates to intermediate +%D coordinates, which are then acted upon by the pre||existing +%D transformation. The important point is that order of +%D transformation matrices cannot be flipped (transformations +%D are not `commutative'). +%D +%D Now what does it mean to move a transformation matrix +%D before a drawing? What it means is that given a point +%D $(P_x, P_y)$ we need a different set of coordinates +%D $(P_x^\prime, P_y^\prime)$ such that if the transformation +%D acts on $(P_x^\prime, P_y^\prime)$, they produce $(P_x, +%D P_y)$. That is we need to solve the set of equations: +%D +%D \placeformula +%D \startformula +%D \pmatrix{P_x\cr P_y\cr 1\cr} = \pmatrix{s_x&r_y&t_x\cr +%D r_x&s_y&t_y\cr +%D 0 &0 &1 \cr} +%D \pmatrix{P_x^\prime\cr +%D P_y^\prime\cr +%D 1 \cr} +%D \stopformula +%D +%D Again matrix notation comes in handy (i.e. someone has +%D already solved the problem for us): we need the inverse +%D transformation matrix. The inverse transformation matrix can +%D be calculated very easily: +%D +%D \placeformula +%D \startformula +%D \pmatrix{P_x^\prime\cr P_y^\prime\cr 1\cr} = +%D \pmatrix{s_x^\prime&r_y^\prime&t_x^\prime\cr +%D r_x^\prime&s_y^\prime&t_y^\prime\cr +%D 0 &0 &1 \cr} +%D \pmatrix{P_x\cr +%D P_y\cr +%D 1 \cr} +%D \stopformula +%D +%D where, the inverse transformation matrix is given by +%D +%D \placeformula +%D \startformula +%D \eqalign +%D {D & = s_x s_y - r_x r_y \cr +%D s_x^\prime & = s_y / D \cr +%D s_y^\prime & = s_x / D \cr +%D r_x^\prime & = - r_x / D \cr +%D r_y^\prime & = - r_y / D \cr +%D t_x^\prime & = ( - s_y t_x + r_y t_y ) / D \cr +%D t_y^\prime & = ( r_x t_x - s_x t_y ) / D \cr} +%D \stopformula +%D +%D And you can see that when expanded out, this does +%D give the formulas: +%D +%D \placeformula +%D \startformula +%D P_x^\prime = { { s_y(p_x-t_x) + r_y(t_y-p_y) } \over +%D { s_x s_y-r_x r_y } } +%D \stopformula +%D +%D \placeformula +%D \startformula +%D P_y^\prime = { { s_x(p_y-t_y) + r_x(t_x-p_x) } \over +%D { s_x*s_y-r_x*r_y } } +%D \stopformula +%D +%D The code works by representing a real number by converting +%D it to a dimension to be put into a \DIMENSION\ register: 2.3 would +%D be represented as 2.3pt for example. In this scheme, +%D multiplying two numbers involves multiplying the \DIMENSION\ +%D registers and dividing by 65536. Accuracy demands that the +%D division be done as late as possible, but overflow +%D considerations need early division. +%D +%D Division involves dividing the two \DIMENSION\ registers and +%D multiplying the result by 65536. Again, accuracy would +%D demand that the numerator be multiplied (and|/|or the +%D denominator divided) early: but that can lead to overflow +%D which needs to be avoided. +%D +%D If nothing is known about the numbers to start with (in +%D concat), I have chosen to divide the 65536 as a 256 in each +%D operand. However, in the series calculating the sine and +%D cosine, I know that the terms are small (because I never +%D have an angle greater than 45 degrees), so I chose to +%D apportion the factor in a different way. + +%M \stop + +%D The path is output using the values saved on the stack. If +%D needed, all coordinates are recalculated. + +\def\finishMPpath + {\PDFcode{\ifcase\finiMPpath W n\or S\or f\or B\fi}} + +\def\processMPpath + {\checkMPpath + \ifcase\nofMPsegments\else + \flushMPpath + \closeMPpath + \finishMPpath + \fi + \let\handleMPsequence\dohandleMPsequence + \resetMPstack + \nofMPsegments\zerocount + \handleMPsequence} + +%D The following \METAPOST\ code is quite valid but, when +%D processed and converted to \PDF, will make a file +%D unprintable on a Hewlett Packard printer (from Acrobat +%D $v<=5$). Who is to blame, the driver of the OS layer in +%D between, is hard to determine, so we add an additional +%D check. +%D +%D \starttyping +%D clip currentpicture to origin -- cycle ; +%D setbounds currentpicture to fullsquare scaled 5cm ; +%D \stoptyping + +\def\checkMPpath + {\ifcase\finiMPpath + \ifnum\nofMPsegments<\plusthree % n is one ahead + \message{omitting zero clip path}% + \nofMPsegments\zerocount + \fi + \fi} + +%D In \PDF\ the \type{cm} operator must precede the path +%D specification. We therefore can output the \type{cm} at +%D the moment we encounter it. + +\def\handleMPpathconcat + {\presetMPconcat + \PDFcode{\gMPs1 \gMPs2 \gMPs3 \gMPs4 \gMPs5 \gMPs6 cm}% + \resetMPstack} + +\def\handleMPpathscale + {\presetMPscale + \PDFcode{\gMPs1 0 0 \gMPs2 0 0 cm}% + \resetMPstack} + +%D This macro interprets the path and saves it as compact as +%D possible. + +\def\dohandleMPpath#1% + {\ifcase\lccode`#1\relax + \@EA\dohandleMPpathA + \else + \@EA\dohandleMPpathB + \fi#1} + +\let\dohandleMPpathA\setMPsequence + +\def\installMPSkeywordP#1#2% + {\expandafter\def\csname\@@MP:P:#1\endcsname{#2}} + +\def\installMPSshortcutP#1#2% todo: \let + {\expandafter\let\csname\@@MP:P:#1\expandafter\endcsname\csname\@@MP:P:#2\endcsname} + +\def\dohandleMPpathB#1 % + {\def\somestring{#1}% + \executeifdefined{\@@MP:P:\somestring}\relax + \handleMPsequence} + +\installMPSkeywordP \PSlineto + {\setMPkeyword0 } +\installMPSkeywordP \PScurveto + {\setMPkeyword1 } +\installMPSkeywordP \PSrlineto + {\setMPkeyword2 } +\installMPSkeywordP \PSmoveto + {\edef\lastMPmoveX{\gMPs1}% + \edef\lastMPmoveY{\gMPs2}% + \resetMPstack + \setMPkeyword3 } +\installMPSkeywordP \PSclip + {% \chardef\finiMPpath\zerocount % already + \let\handleMPsequence\processMPpath} +\installMPSkeywordP \PSgsave + {\chardef\finiMPpath\plusthree} +\installMPSkeywordP \PSgrestore + {} +\installMPSkeywordP \PSfill + {\ifcase\finiMPpath + \chardef\finiMPpath\plustwo + \let\handleMPsequence\processMPpath + \fi} +\installMPSkeywordP \PSstroke + {\ifcase\finiMPpath + \chardef\finiMPpath\plusone + \fi + \let\handleMPsequence\processMPpath} +\installMPSkeywordP \PSclosepath + {\def\closeMPpath{\PDFcode{h}}} +\installMPSkeywordP \PSconcat + {\cleanupMPconcat + \let\flushMPpath\flushconcatMPpath + \handleMPpathconcat} +\installMPSkeywordP \PSscale + {\let\flushMPpath\flushconcatMPpath + \handleMPpathscale} + +\installMPSshortcutP {l} \PSlineto +\installMPSshortcutP {r} \PSrlineto +\installMPSshortcutP {m} \PSmoveto +\installMPSshortcutP {c} \PScurveto + +\installMPSshortcutP {q} \PSgsave +\installMPSshortcutP {Q} \PSgrestore +\installMPSshortcutP {S} \PSstroke +\installMPSshortcutP {F} \PSfill +\installMPSshortcutP {B} \PSgsave +\installMPSshortcutP {W} \PSclip +\installMPSshortcutP {p} \PSclosepath + +\installMPSshortcutP {s} \PSscale +\installMPSshortcutP {t} \PSconcat + +%D \macros +%D {twodigitMPoutput} +%D +%D We can limit the precision to two digits after the comma +%D by saying: +%D +%D \starttyping +%D \twodigitMPoutput +%D \stoptyping +%D +%D This option only works in \CONTEXT\ combined with \ETEX. + +\def\twodigitMPoutput + {\let\!MP \twodigitrounding + \def\!MPgMPs##1{\twodigitrounding{\gMPs##1}}% + \def\!MPgMPa##1{\twodigitrounding{\gMPa##1}}} + +\let\!MP \empty +\let\!MPgMPa\gMPa +\let\!MPgMPs\gMPs + +%D Here comes the special-specific code: + +\def\setMPextensions + {\ifconditional\manyMPspecials + \def\MPrgbnumber##1{\expandafter\doMPrgbnumber##10000.00000\relax}% + \def\doMPrgbnumber##1.##2##3##4##5##6\relax{##2##3##4##5}% + \else + \def\MPrgbnumber##1{\expandafter\doMPrgbnumber##1000.0000\relax}% + \def\doMPrgbnumber##1.##2##3##4##5\relax{##2##3##4}% + \fi} + +% \settrue\manyMPspecials \setMPextensions + +%D This macro handles the special definitions that are +%D passed as comment. + +%D The implementation below saves the data on the stack in +%D a way similar to the macros in \type {supp-pdf.tex}, and +%D just overload a few already defined handlers. That way, +%D the existing macros are still generic. \footnote {Actually, +%D the macros here are just as generic.} +%D +%D Currently the only extension concerns shading, which is +%D accomplished by handling yet another value of \type +%D {\finiMPpath}. The recource disctionary is stored and +%D later picked up by the general \CONTEXT\ figure inclusion +%D macros. + +%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 When defined inline, we use another macro to handle the +%D definitions. Actually, this macro is called by the +%D previous ones. + +\chardef\MPspecialversion = 0 % specials when >1 +\chardef\MPspecialrevision = 0 % specials when >1 +\chardef\MPspecialsignal = 0 % passed on by graphic + +\chardef\inlineMPspecials = 1 % only needed for stack resetting + +\def\dohandleMPspecialcomment#1 + {\setMPargument{#1}% + \advance\scratchcounter \minusone + \ifcase\scratchcounter + \handleMPspecialcommand + \donetrue + \doresetMPstack + \let\handleMPsequence\dohandleMPsequence + \expandafter\handleMPsequence + \else + \expandafter\dohandleMPspecialcomment + \fi} + +\def\handleMPspecialcomment #1 % number of arguments + {\doresetMPstack + \scratchcounter#1\relax + \ifcase\scratchcounter % when zero, inline shading is used + \chardef\inlineMPspecials\plusone + \let\handleMPsequence\dohandleMPsequence + \expandafter\handleMPsequence + \else + \chardef\inlineMPspecials\zerocount + \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. + +\def\handleMPspecialcommand + {\ifcase\inlineMPspecials\or + \advance\nofMParguments \minusone % pop the size + \fi + \ifundefined\MPspecial + \message{[unknown \MPspecial]}% + \else + \csname\MPspecial\endcsname + \fi + \ifcase\inlineMPspecials + \doresetMPstack % 0 + \else + \resetMPstack % 1 + \fi} + +\def\handleMPspecialscomment #1.#2 #3 % version.revision signal #4=div=1000|10000 + {\doresetMPstack + \chardef\MPspecialversion #1% + \chardef\MPspecialrevision#2% + \chardef\MPspecialsignal #3% + \let\handleMPsequence\dohandleMPsequence + \ifnum#1=\plusone + \expandafter\handleMPsequence + \else + \expandafter\handleMPspecialscommentx + \fi} + +\def\handleMPspecialscommentx #1 % version 2 + {\ifnum10000=0#1\relax + \settrue \manyMPspecials + \else + \setfalse\manyMPspecials + \fi + \setMPextensions + \handleMPsequence} + +\def\handleMPrgbcolor + {\edef\lastMPrvalue{\csname\@@MP01\endcsname}%{\gMPs1}% + \edef\lastMPgvalue{\csname\@@MP02\endcsname}%{\gMPs2}% + \edef\lastMPbvalue{\csname\@@MP03\endcsname}%{\gMPs3}% + \ifnum\MPrgbnumber\lastMPrvalue=123\relax + \csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname + \else + \dohandleMPrgb\lastMPrvalue\lastMPgvalue\lastMPbvalue + \fi} + +\def\handleMPgraycolor{\dohandleMPgray{\gMPs1}} +\def\handleMPcmykcolor{\dohandleMPcmyk{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}} +\def\handleMPspotcolor{\dohandleMPspot{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}} + +% \newcontitional\ignoreMPpath + +\def\finishMPpath + {\ifconditional\ignoreMPpath + \PDFcode{W n\space}% + \else + \PDFcode{\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi}% + \fi + \ifx\extraMPpathcode\empty\else + \PDFcode{\extraMPpathcode}% + \let\extraMPpathcode\empty + \fi + \setfalse\ignoreMPpath} + +\def\processMPpath + {\checkMPpath % ! + \flushMPpath + \closeMPpath + \finishMPpath + \let\handleMPsequence\dohandleMPsequence + \resetMPstack + \nofMPsegments\zerocount + \handleMPsequence} + +\protect \endinput + +% When i'm bored ... + +% \newcatcodetable\mpscatcodes + +% \startcatcodetable \mpscatcodes +% \catcode`\| \@@comment +% \catcode`\% \@@active +% \catcode`\[ \@@active +% \catcode`\] \@@active +% \catcode`\{ \@@active +% \catcode`\} \@@active +% \stopcatcodetable + +% \def\keepMPspecials +% {\setcatcodecommand \mpscatcodes `\% \letterpercent +% \setcatcodecommand \mpscatcodes `\[ \letterleftbracket +% \setcatcodecommand \mpscatcodes `\] \letterrightbracket +% \setcatcodecommand \mpscatcodes `\{ \letterleftbrace +% \setcatcodecommand \mpscatcodes `\} \letterrightbrace} + +% \def\ignoreMPspecials +% {\setcatcodecommand \mpscatcodes `\% \letterpercent +% \setcatcodecommand \mpscatcodes `\[ \empty +% \setcatcodecommand \mpscatcodes `\] \empty +% \setcatcodecommand \mpscatcodes `\{ \empty +% \setcatcodecommand \mpscatcodes `\} \empty} + +% \def\obeyMPspecials +% {\setcatcodecommand \mpscatcodes `\% \letterpercent +% \setcatcodecommand \mpscatcodes `\[ \letterleftbracket +% \setcatcodecommand \mpscatcodes `\] \letterrightbracket +% \setcatcodecommand \mpscatcodes `\{ \letterleftbrace +% \setcatcodecommand \mpscatcodes `\} \letterrightbrace} + +% \gdef\setMPspecials| +% {\setcatcodetable\mpscatcodes +% \lccode`\-=\zerocount % to be sure, it could be a letter +% \lccode`\%=`\%% % otherwise it's seen as a number +% \def\({\char40\relax }% +% \def\){\char41\relax }% +% \def\\{\char92\relax }% +% \def\0{\octalMPcharacter0}% +% \def\1{\octalMPcharacter1}% +% \def\2{\octalMPcharacter2}% +% \def\3{\octalMPcharacter3}% +% \def\4{\octalMPcharacter4}% +% \def\5{\octalMPcharacter5}% +% \def\6{\octalMPcharacter6}% +% \def\7{\octalMPcharacter7}% +% \def\8{\octalMPcharacter8}% +% \def\9{\octalMPcharacter9}} diff --git a/tex/context/base/meta-pdf.tex b/tex/context/base/meta-pdf.tex index bddf932ef..ad4a57fd9 100644 --- a/tex/context/base/meta-pdf.tex +++ b/tex/context/base/meta-pdf.tex @@ -11,32 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D In due time this file will replace \type {supp-pdf} and -%D \type {supp-mpe}. - -% \input supp-pdf -% \input supp-mpe -% -% \endinput - -% we're going to experiment a bit with new code - -%D To be tested: texopt.rb on this file. - -%D Prelude to an optimized version: - -%D \module -%D [ file=supp-pdf, -%D version=2004.12.16, -%D title=\CONTEXT\ Support Macros, -%D subtitle=\METAPOST\ to \PDF\ conversion, -%D author=Hans Hagen \& others (see text), -%D date=\currentdate, -%D copyright=\PRAGMA] -%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 Formerly known as supp-pdf.tex and supp-mpe.tex. %D These macros are written as generic as possible. Some %D general support macro's are loaded from a small module @@ -52,10 +27,10 @@ %D his initials. (We keep the old code around because it's a %D nice illustration on how a module like this evolves.) -% Beware, we cannot use \zeropoint here since it may be +% Beware, we cannot use 0pt here by defaukt 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. +% as scratch registers; for this reason we start allocating +% scratch registers > 20 %D This module handles some \PDF\ conversion and insertions %D topics. By default, the macros use the \PDFTEX\ primitive @@ -63,23 +38,12 @@ %D default engine for \TEX\ distributions, we need a more complex %D test. -\writestatus{loading}{Context Support Macros / PDF (2004.03.26)} +\writestatus{loading}{Context Support Macros / MPS to PDF} \unprotect -\ifx\PDFcode\undefined - \ifx\pdfliteral\undefined - \def\PDFcode#1{\special{PDF: #1}} - \else\ifx\pdfoutput\undefined - \def\PDFcode#1{\special{PDF: #1}} - \else\ifcase\pdfoutput - \def\PDFcode#1{\special{PDF: #1}} - \else % pdftex as well as in pdf mode - \let\PDFcode\pdfliteral - \fi\fi\fi -\else - % we probably use context -\fi +\ifx\PDFcode \undefined \let\PDFcode \gobbleoneargument \fi +\ifx\PDFcomment\undefined \def\PDFcomment#1{\PDFcode{\letterpercent\space#1}} \fi %D First we define a handy constant: @@ -122,11 +86,8 @@ \def\dopdfimages#1#2#3% {\immediate\pdfximage#1{#2}% - \immediate\pdfobj - {[ << /Image \the\pdflastximage\space0 R - /DefaultForPrinting true >> ]}% - \immediate\pdfximage#1 - attr {/Alternates \the\pdflastobj\space0 R}{#3}% + \immediate\pdfobj{[ << /Image \the\pdflastximage\space0 R /DefaultForPrinting true >> ]}% + \immediate\pdfximage#1 attr {/Alternates \the\pdflastobj\space0 R}{#3}% \pdfrefximage\pdflastximage} \def\pdfclippedimage#1#% specs {file}{left}{right}{top}{bottom} @@ -135,14 +96,9 @@ \def\dopdfclippedimage#1#2#3#4#5#6% {\bgroup \pdfximage#1{#2}% - \setbox\scratchbox\hbox - {\pdfrefximage\pdflastximage}% - \hsize\wd\scratchbox - \advance\hsize -#3% - \advance\hsize -#4% - \vsize\ht\scratchbox - \advance\vsize -#5% - \advance\vsize -#6% + \setbox\scratchbox\hbox{\pdfrefximage\pdflastximage}% + \hsize\dimexpr\wd\scratchbox-#3-#4\relax + \vsize\dimexpr\ht\scratchbox-#5-#6\relax \setbox\scratchbox\vbox to \vsize {\vskip-#5\hbox to \hsize{\hskip-#3\box\scratchbox\hss}}% \pdfxform\scratchbox @@ -151,1635 +107,11 @@ \fi \fi -%D If you want to save a few hash entries, you may prefer the -%D less readable alternatives, like: -%D -%D \starttyping -%D \def\pdfimage#1#% This one is less readable but needs no additional -%D {\bgroup % hash entry for the second stage macro. -%D \def\pdfimage##1% -%D {\immediate\pdfximage##1{#2}% -%D \pdfrefximage\pdflastximage\egroup}} -%D \stoptyping - %D \macros %D {convertMPtoPDF} %D %D The next set of macros implements \METAPOST\ to \PDF\ -%D conversion. Because we want to test as fast as possible, we -%D first define the \POSTSCRIPT\ operators that \METAPOST\ -%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} -\def \PSshowpage {showpage} -\def \PSnewpath {newpath} -\def \PSfshow {fshow} -\def \PSclosepath {closepath} -\def \PSfill {fill} -\def \PSstroke {stroke} -\def \PSclip {clip} -\def \PSrlineto {rlineto} -\def \PSsetlinejoin {setlinejoin} -\def \PSsetlinecap {setlinecap} -\def \PSsetmiterlimit {setmiterlimit} -\def \PSsetgray {setgray} -\def \PSsetrgbcolor {setrgbcolor} -\def \PSsetcmykcolor {setcmykcolor} -\def \PSsetdash {setdash} -\def \PSgsave {gsave} -\def \PSgrestore {grestore} -\def \PStranslate {translate} -\def \PSscale {scale} -\def \PSconcat {concat} -\def \PSdtransform {dtransform} -\def \PSsetlinewidth {setlinewidth} -\def \PSpop {pop} - -\def \PSnfont {nfont} % was needed for TUG98 proceedings -\def \PSspecial {special} % extensions to MetaPost - -%D A previous version set \type {%} to ignore, which -%D simplified the following definitions. At the start of -%D conversion the percent character was made active again. -%D Because the whole graphic is one paragraph (there are no -%D empty lines) this does not give the desired effect. This -%D went unnoticed untill Scott Pakin sent me a test file -%D percent characters in a string. So, from now on we have -%D to prefix the following strings with percentages. - -%D Some day I'll figure out a better solution (line by line reading -%D using \ETEX). - -\edef \PSBoundingBox {\letterpercent\letterpercent BoundingBox:} -\edef \PSHiResBoundingBox {\letterpercent\letterpercent HiResBoundingBox:} -\edef \PSExactBoundingBox {\letterpercent\letterpercent ExactBoundingBox:} -\edef \PSMetaPostSpecial {\letterpercent\letterpercent MetaPostSpecial:} -\edef \PSMetaPostSpecials {\letterpercent\letterpercent MetaPostSpecials:} -\edef \PSPage {\letterpercent\letterpercent Page:} - -%D By the way, the \type {setcmykcolor} operator is not -%D output by \METAPOST\ but can result from converting the -%D \cap{RGB} color specifications, as implemented in -%D \type{supp-mps}. - -%D In \POSTSCRIPT\ arguments precede the operators. Due to the -%D fact that in some translations we need access to those -%D arguments, and also because sometimes we have to skip them, -%D we stack them up. The stack is one||dimensional for non path -%D operators and two||dimensional for operators inside a path. -%D This is because we have to save the whole path for -%D (optional) postprocessing. Values are pushed onto the stack -%D by: -%D -%D \starttyping -%D \setMPargument {value} -%D \stoptyping -%D -%D They can be retrieved by the short named macros: -%D -%D \starttyping -%D \gMPa {number} -%D \gMPs {number} -%D \stoptyping -%D -%D When scanning a path specification, we also save the -%D operator, using -%D -%D \starttyping -%D \setMPkeyword {n} -%D \stoptyping -%D -%D The path drawing operators are coded for speed: \type{clip}, -%D \type{stroke}, \type{fill} and \type{fillstroke} become -%D 1, 2, 3 and~4. -%D -%D When processing the path this code can be retrieved -%D using -%D -%D \starttyping -%D \getMPkeyword % {n} -%D \stoptyping -%D -%D When setting an argument, the exact position on the stack -%D depends on the current value of the \COUNTERS\ -%D \type{\nofMPsegments} and \type{\nofMParguments}. - -\newcount\nofMPsegments -\newcount\nofMParguments - -%D These variables hold the coordinates. The argument part of -%D the stack is reset by: -%D -%D \starttyping -%D \resetMPstack -%D \stoptyping -%D -%D We use the prefix \type{@@MP} to keep the stack from -%D conflicting with existing macros. To speed up things a bit -%D more, we use the constant \type{\@@MP}. - -\def\@@MP{@@MP} - -\def\setMPargument% #1% - {\advance\nofMParguments \plusone - \expandafter\def - \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname} % {#1} - -\def\letMPargument - {\advance\nofMParguments \plusone - \expandafter\let - \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname} - -\def\setMPsequence#1 % - {\advance\nofMParguments \plusone - \expandafter\def - \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname{#1}% - \handleMPsequence} - -\def\gMPa#1% - {\csname\@@MP0\number#1\endcsname} - -\def\gMPs#1% - {\csname\@@MP\the\nofMPsegments\number#1\endcsname} - -\def\dogMPa#1% - {\@EAEAEA\do\csname\@@MP0\number#1\endcsname} - -\def\setMPkeyword#1 % - {\expandafter\def\csname\@@MP\the\nofMPsegments0\endcsname{#1}% - \advance\nofMPsegments \plusone - \nofMParguments\zerocount} - -\def\getMPkeyword% #1% - {\csname\@@MP\the\nofMPsegments0\endcsname} % {\csname\@@MP#10\endcsname} - -\def\docleanupMPargument#1% we need this because args can have [ or ] pre/appended - {\expandafter\edef\csname\@@MP\the\nofMPsegments\number#1\endcsname - {\csname\@@MP\the\nofMPsegments\number#1\endcsname}} - -%D When we reset the stack, we can assume that all further -%D comment is to be ignored and handled in strings. -%D By redefining the reset macro after the first call, we -%D save some run time. Only use this macro after all -%D comments are processed and use the simple alternative -%D when dealing with comments. - -\def\doresetMPstack - {\nofMParguments\zerocount} - -\def\resetMPstack - {\let\handleMPgraphic\handleMPendgraphic - \let\resetMPstack\doresetMPstack - \resetMPstack} - -%D The arguments are saved with the preceding command -%D \type{\do}. By default this command expands to nothing, but -%D when we deal with strings it's used to strip off the -%D \type{(} and \type{)}. -%D -%D Strings are kind of tricky, because characters can be -%D passed verbatim \type{(hello)}, by octal number -%D \type{(\005)} or as command \type{(\()}. We therefore -%D cannot simply ignore \type{(} and \type{)}, the way we do -%D with \type{[} and \type{]}. Another complication is that -%D strings may contain characters that normally have a -%D special meaning in \TEX, like \type{$} and \type{{}}. -%D -%D A previous solution made \type{\} an active character and -%D let it look ahead for a number or characters. We had to -%D abandon this scheme because of the need for verbatim -%D support. The next solution involved some \CATCODE\ -%D trickery but works well. - -\def\octalMPcharacter#1#2#3% - {\char'#1#2#3\relax} - -%D curly braces and squarly brackets are stored in the argument stack -%D as part of strings, for instance in: -%D -%D \starttyping -%D /fshow {exch findfont exch scalefont setfont show}bind def -%D [3 3 ] 0 setdash -%D \stoptyping -%D -%D but we need to keep them in situation like -%D -%D \starttyping -%D ([bla bla] bla bla) ec-lmr10 9.96265 fshow -%D ({bla bla} bla bla) ec-lmr10 9.96265 fshow -%D \stoptyping -%D -%D So, when we store the snippets, we keep the special tokens, and -%D when needed we either ignore or obey them - -\bgroup -\catcode`\|=\@@comment -\catcode`\%=\@@active -\catcode`\[=\@@active -\catcode`\]=\@@active -\catcode`\{=\@@active -\catcode`\}=\@@active -\catcode`B=\@@begingroup -\catcode`E=\@@endgroup -\gdef\keepMPspecials| - B\let%\letterpercent| - \def[B\noexpand[E| - \def]B\noexpand]E| - \def{B\noexpand{E| - \def}B\noexpand}EE -\gdef\ignoreMPspecials| - B\let%\letterpercent| - \def[BE| - \def]BE| - \def{BE| - \def}BEE -\gdef\obeyMPspecials| - B\def%B\char 37\relax E| - \def[B\char 91\relax E| - \def]B\char 93\relax E| - \def{B\char123\relax E| - \def}B\char125\relax EE -\gdef\setMPspecials| - B\setnaturalcatcodes - \catcode`\\=\@@escape - \catcode`\%=\@@active - \catcode`\[=\@@active - \catcode`\]=\@@active - \catcode`\{=\@@active - \catcode`\}=\@@active - \lccode`\-=0 | latex sets this to `\- - \lccode`\%=`\% | otherwise it's seen as a number - \def\(B\char40\relax E| - \def\)B\char41\relax E| - \def\\B\char92\relax E| - \def\0B\octalMPcharacter0E| - \def\1B\octalMPcharacter1E| - \def\2B\octalMPcharacter2E| - \def\3B\octalMPcharacter3E| - \def\4B\octalMPcharacter4E| - \def\5B\octalMPcharacter5E| - \def\6B\octalMPcharacter6E| - \def\7B\octalMPcharacter7E| - \def\8B\octalMPcharacter8E| - \def\9B\octalMPcharacter9EE -\egroup - -%D We use the comment symbol as a sort of trigger. Beware! -%D The whole graphic is seen as on eparagraph, which means -%D that we cannot change the catcodes in between. - -\bgroup -\catcode`\%=\@@active -\gdef\startMPscanning{\let%=\startMPconversion} -\egroup - -%D In earlier versions we used the sequence -%D -%D \starttyping -%D \expandafter\handleMPsequence\input filename\relax -%D \stoptyping -%D -%D Persistent problems in \LATEX\ however forced us to use a -%D different scheme. Every \POSTSCRIPT\ file starts with a -%D \type{%}, so we temporary make this an active character -%D that starts the scanning and redefines itself. (The problem -%D originates in the redefinition by \LATEX\ of the -%D \type{\input} primitive.) - -\def\startMPconversion - {\keepMPspecials - \handleMPsequence} - -%D Here comes the main loop. Most arguments are numbers. This -%D means that they can be recognized by their \type{\lccode}. -%D This method saves a lot of processing time. We could -%D speed up the conversion by handling the \type{path} -%D seperately. - -\def\@EAEAEA{\expandafter\expandafter\expandafter} % to be sure - -\def\dohandleMPsequence#1% - {\ifdone - \ifcase\lccode`#1\relax - \@EAEAEA\dohandleMPsequenceA - \else - \@EAEAEA\dohandleMPsequenceB - \fi - \else - \@EA\dohandleMPsequenceC - \fi#1} - -\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 - % after that we will encounter more tokens until setlinewidth+pop - % or pop+setlinewidth which we catch next; we explicitly need to - % reset the stack since [] n setdash may follow; a more clever - % approach would be to read on till the condition is met, but it's - % the only pop / setlinewidth we will encounter so ... - \else\ifx\somestring\PSsetlinewidth - % already handled in dtransform - \resetMPstack - \else\ifx\somestring\PSpop - % already handled in dtransform - \resetMPstack - \else\ifx\somestring\PSconcat - \cleanupMPconcat - \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\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{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 rg - \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 RG}} - -\def\handleMPcmykcolor - {\PDFcode{\!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 k - \!MPgMPa1 \!MPgMPa2 \!MPgMPa3 \!MPgMPa4 K}} - -\def\handleMPgraycolor - {\PDFcode{\!MPgMPa1 g - \!MPgMPa1 G}} - -\def\handleMPspotcolor - {\PDFcode{0 g - 0 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% - {\ifx\somestring\PSshowpage - \let\handleMPsequence\finishMPgraphic - \else - \letMPargument\somestring % {#1}% - \fi} - -\def\handleMPbegingraphic % #1% - {\ifx\somestring\PSBoundingBox - \def\handleMPsequence{\handleMPboundingbox1}% - \else\ifx\somestring\PSHiResBoundingBox - \def\handleMPsequence{\handleMPboundingbox2}% - \else\ifx\somestring\PSExactBoundingBox - \def\handleMPsequence{\handleMPboundingbox3}% - \else\ifx\somestring\PSshowpage - \let\handleMPsequence\finishMPgraphic - \else\ifx\somestring\PSPage - \let\handleMPsequence\handleMPpage - \else\ifx\somestring\PSMetaPostSpecials - \let\handleMPsequence\handleMPspecialscomment - \else\ifx\somestring\PSMetaPostSpecial - \let\handleMPsequence\handleMPspecialcomment - \else - \letMPargument\somestring % {#1}% - \fi\fi\fi\fi\fi\fi\fi} - -\let\handleMPgraphic=\handleMPbegingraphic - -%D We check for three kind of bounding boxes: the normal one -%D and two high precision ones: -%D -%D \starttyping -%D BoundingBox: llx lly ucx ucy -%D HiResBoundingBox: llx lly ucx ucy -%D ExactBoundingBox: llx lly ucx ucy -%D \stoptyping -%D -%D The original as well as the recalculated dimensions are -%D saved for later use. - -\newif\ifskipemptyMPgraphic \skipemptyMPgraphicfalse - -\chardef\currentMPboundingbox=0 - -\def\handleMPboundingbox#1#2 #3 #4 #5 - {\ifnum#1>\currentMPboundingbox - \xdef\MPllx{#2}\xdef\MPlly{#3}% - \xdef\MPurx{#4}\xdef\MPury{#5}% - \dimen0=#2\onepoint - \dimen0=-\MPxscale\dimen0 - \dimen2=#3\onepoint - \dimen2=-\MPyscale\dimen2 - \xdef\MPxoffset{\withoutpt\the\dimen0}% - \xdef\MPyoffset{\withoutpt\the\dimen2}% - \dimen0=#2\onebasepoint - \dimen0=-\dimen0 - \dimen2=#3\onebasepoint - \dimen2=-\dimen2 - \advance\dimen0 #4\onebasepoint - \dimen0=\MPxscale\dimen0 - \xdef\MPwidth{\the\dimen0}% - \advance\dimen2 #5\onebasepoint - \xdef\MPyshift{\the\dimen2}% unscaled - \dimen2=\MPyscale\dimen2 - \xdef\MPheight{\the\dimen2}% - \chardef\currentMPboundingbox#1\relax - \fi - \doresetMPstack - \let\handleMPsequence\dohandleMPsequence - \let\next\handleMPsequence - \ifskipemptyMPgraphic - \ifdim\MPheight=\zeropoint\relax\ifdim\MPwidth=\zeropoint\relax - \def\next{\endinput\finishMPgraphic}% - \fi\fi - \fi - \next} - -%D Unless defined otherwise, we simply ignore specialcomments. - -\def\handleMPspecialcomment - {\doresetMPstack - \let\handleMPsequence\dohandleMPsequence - \handleMPsequence} - -\let\handleMPspecialscomment\handleMPspecialcomment - -%D We use the \type{page} comment as a signal that -%D stackbuilding can be started. - -\def\handleMPpage #1 #2 - {\doresetMPstack - \donetrue - \let\handleMPsequence\dohandleMPsequence - \handleMPsequence} - -%D The same applies to the special extensions. - -\def\handleMPspecialcommand - {\doresetMPstack - \let\handleMPsequence\dohandleMPsequence - \handleMPsequence} - -%D \METAPOST\ draws its dots by moving to a location and -%D invoking \type{0 0 rlineto}. This operator is not -%D available in \PDF. Our solution is straightforward: we draw -%D a line from $(current\_x, current\_y)$ to itself. This -%D means that the arguments of the preceding \type{moveto} have -%D to be saved. - -\def\lastMPmoveX{0} -\def\lastMPmoveY{0} - -%D These saved coordinates are also used when we handle the -%D texts. Text handling proved to be a bit of a nuisance, but -%D finally I saw the light. It proved that we also had to -%D take care of \type{(split arguments)}. - -\def\setMPfshowfont#1#2% - {\font\temp=#1\space at #2\relax\temp} - -\let\MPfshowcommand\empty - -% \def\dohandleMPfshow -% {\bgroup -% \setbox\scratchbox\hbox -% {\obeyMPspecials -% \let\ \relax % mp breaks long lines and appends a \ -% \edef\size{\gMPa\nofMParguments}% -% \ifx\size\PSnfont % round font size (to pt) -% \advance\nofMParguments \minusone -% \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax -% \ifdim\scratchdimen<\onepoint -% \def\size{1pt}% -% \else -% \advance\scratchdimen .5\onepoint -% \def\size##1.##2\relax{\def\size{##1pt}}% -% \expandafter\size\the\scratchdimen\relax -% \fi -% \else -% \edef\size{\size bp}% -% \fi -% \advance\nofMParguments \minusone -% %\font\temp=\gMPa\nofMParguments\space at \size -% \let\temp\relax % to be sure -% \setMPfshowfont{\gMPa\nofMParguments}\size -% \advance\nofMParguments \minusone -% \temp -% \MPfshowcommand -% {\ifnum\nofMParguments=\plusone -% \def\do(##1){##1}% -% \dogMPa1% -% \else -% % we need to catch ( a ) (a a a) (\123 \123 \123) etc -% \scratchcounter\plusone -% \def\dodo##1% Andreas Fieger's bug: (\304...) -% {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 -% \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% -% \def\do(##1{\dodo{##1}}% -% \dogMPa\scratchcounter\MPspacechar -% \let\do\relax -% \loop -% \advance\scratchcounter \plusone -% \ifnum\scratchcounter<\nofMParguments\relax -% \gMPa\scratchcounter\MPspacechar -% \repeat -% \def\do##1){\dodo{##1}}% -% \dogMPa\scratchcounter -% \fi -% \unskip}}% -% % -% % this fails in some versions of pdftex -% % -% % \dimen0=\lastMPmoveY bp -% % \advance\dimen0 by \ht0 -% % \ScaledPointsToBigPoints{\number\dimen0}\lastMPmoveY -% % \PDFcode{n q 1 0 0 1 \lastMPmoveX\space\lastMPmoveY\space cm}% -% % \dimen0=\ht0 -% % \advance\dimen0 by \dp0 -% % \box0 -% % \vskip-\dimen0 -% % \PDFcode{Q}% -% % \egroup} -% % -% \setbox\scratchbox\hbox -% {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint\box\scratchbox}% -% \ht\scratchbox\zeropoint -% \dp\scratchbox\zeropoint -% \wd\scratchbox\zeropoint -% \box\scratchbox -% \egroup} -% -% \let\handleMPfshow\dohandleMPfshow % so we can overload this one later -% -% we will support plug-ins: - -\def\dohandleMPfshow - {\setbox\scratchbox\hbox - {\obeyMPspecials - \edef\MPtextsize{\gMPa\nofMParguments}% - \def\do(##1){##1}% - \edef\MPtextdata{\dogMPa1}% beware, stack can have more - \handleMPtext}% - \setbox\scratchbox\hbox - {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint - \box\scratchbox}% - % - % this fails in some versions of pdftex - % - % \dimen0=\lastMPmoveY bp - % \advance\dimen0 by \ht0 - % \ScaledPointsToBigPoints{\number\dimen0}\lastMPmoveY - % \PDFcode{n q 1 0 0 1 \lastMPmoveX\space\lastMPmoveY\space cm}% - % \dimen0=\ht0 - % \advance\dimen0 by \dp0 - % \box0 - % \vskip-\dimen0 - % \PDFcode{Q}% - % \egroup} - % - \ht\scratchbox\zeropoint - \dp\scratchbox\zeropoint - \wd\scratchbox\zeropoint - \box\scratchbox} - -\def\handleMPtext {\handleMPtextnormal} % so we can overload this one later -\def\handleMPfshow{\dohandleMPfshow } % so we can overload this one later - -\def\handleMPtext - {\ifnum\nofMParguments>\plusthree - \handleMPtextnormal - \else - \convertcommand\MPtextdata\to\MPtextdata - \expanded{\splitstring\MPtextdata}\at::::\to\MPtexttag\and\MPtextnumber - \executeifdefined{handleMPtext\MPtexttag}\handleMPtextnormal - \fi} - -% elsewhere we will implement \handleMPtextmptxt - -\def\handleMPtextnormal - {\let\ \relax % mp breaks long lines and appends a \ - \ifx\MPtextsize\PSnfont % round font size (to pt) - \advance\nofMParguments \minusone - \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax - \ifdim\scratchdimen<\onepoint - \def\MPtextsize{1pt}% - \else - \advance\scratchdimen .5\onepoint - \def\MPtextsize##1.##2\relax{\def\MPtextsize{##1pt}}% - \expandafter\MPtextsize\the\scratchdimen\relax - \fi - \else - \edef\MPtextsize{\MPtextsize bp}% - \fi - \advance\nofMParguments \minusone - \font\temp=\gMPa\nofMParguments\space at \MPtextsize - \let\temp\relax % to be sure - \setMPfshowfont{\gMPa\nofMParguments}\MPtextsize - \advance\nofMParguments \minusone - \temp - \MPfshowcommand - {\ifnum\nofMParguments=\plusone - \def\do(##1){##1}% - \dogMPa1% - \else - % we need to catch ( a ) (a a a) (\123 \123 \123) etc - \scratchcounter\plusone - \def\dodo##1% Andreas Fieger's bug: (\304...) - {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 - \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% - \def\do(##1{\dodo{##1}}% - \dogMPa\scratchcounter\MPspacechar - \let\do\relax - \loop - \advance\scratchcounter \plusone - \ifnum\scratchcounter<\nofMParguments\relax - \gMPa\scratchcounter\MPspacechar - \repeat - \def\do##1){\dodo{##1}}% - \dogMPa\scratchcounter - \fi - \unskip}} - -%D You could consider the following definition to be the most -%D natural one. - -% \def\MPspacechar{\space} % normal case - -\def\MPspacechar{\char32\relax} % old solution does not work with math - -%D However, the following implementation is more robust, since -%D some fonts have funny visible spaces in the space slot. This -%D gives a mismatch between the space that \METAPOST\ took into -%D account and the \quote {natural} space. This only happens in -%D labels, since \type {btex}||\type {etex} thingies don't have -%D spaces. This phenomena showed up when preparing the -%D \METAFUN\ manual, where Palatino fonts are used. We can -%D safely assume that \METAPOST\ considers \type {\char32} to -%D be the space. - -\def\MPspacechar{\setbox\scratchbox\hbox{\char32}\kern\wd\scratchbox} - -%D Well, this does not work with math fonts, so: - -\def\MPspacechar{\char32\relax} - -%D Most operators are just converted and keep their -%D arguments. Dashes however need a bit different treatment, -%D otherwise \PDF\ viewers complain loudly. Another -%D complication is that one argument comes after the \type{]}. -%D When reading the data, we simply ignore the array boundary -%D characters. We save ourselves some redundant newlines and -%D at the same time keep the output readable by packing the -%D literals. - -\def\handleMPsetdash - {\bgroup - \ignoreMPspecials - \def\somestring{[}% - \scratchcounter\plusone - \loop - \ifnum\scratchcounter<\nofMParguments - \edef\somestring{\somestring\space\gMPa\scratchcounter}% - \advance\scratchcounter \plusone - \repeat - \edef\somestring{\somestring]\gMPa\scratchcounter\space d}% - \PDFcode{\somestring}% - \egroup} - -%D The \type{setlinewidth} commands looks a bit complicated. There are -%D two alternatives, that result in a similar look in both -%D $x$- and $y$-dorection. As John Hobby says: -%D -%D \startnarrower \switchtobodyfont[ss] -%D \starttyping -%D x 0 dtransform exch truncate exch idtransform pop setlinewidth -%D 0 y dtransform truncate idtransform setlinewidth pop -%D \stoptyping -%D -%D These are just fancy versions of \type{x setlinewidth} and -%D \type{y setlinewidth}. The \type{x 0 ...} form is used if -%D the path is {\em primarily vertical}. It rounds the width -%D so that vertical lines come out an integer number of pixels -%D wide in device space. The \type{0 y ...} form does the same -%D for paths that are {\em primarily horizontal}. The reason -%D why I did this is Knuth insists on getting exactly the -%D widths \TEX\ intends for the horizontal and vertical rules -%D in \type{btex...etex} output. (Note that PostScript scan -%D conversion rules cause a horizontal or vertical line of -%D integer width $n$ in device space to come out $n+1$ pixels -%D wide, regardless of the phase relative to the pixel grid.) -%D \stopnarrower -%D -%D The common operator in these sequences is \type{dtransform}, -%D so we can use this one to trigger setting the linewidth. - -\def\handleMPdtransform - {\ifdim\gMPa1\onepoint>\zeropoint - \PDFcode{\gMPa1 w}% - \def\next##1 ##2 ##3 ##4 ##5 ##6 {\handleMPsequence}% - \else - \PDFcode{\gMPa2 w}% - \def\next##1 ##2 ##3 ##4 {\handleMPsequence}% - \fi - \let\handleMPsequence\dohandleMPsequence - \resetMPstack - \next} - -%D The most complicated command is \type{concat}. \METAPOST\ -%D applies this operator to \type{stroke}. At that moment the -%D points set by \type{curveto} and \type{moveto}, are already -%D fixed. In \PDF\ however the \type{cm} operator affects the -%D points as well as the pen (stroke). Like more \PDF\ -%D operators, \type{cm} is defined in a bit ambiguous way. -%D The only save route for non||circular penshapes, is saving -%D the path, recalculating the points and applying the -%D transformation matrix in such a way that we can be sure -%D that its behavior is well defined. This comes down to -%D inverting the path and applying \type{cm} to that path as -%D well as the pen. This all means that we have to save the -%D path. - -%D In \METAPOST\ there are three ways to handle a path $p$: -%D -%D \starttyping -%D draw p; fill p; filldraw p; -%D \stoptyping -%D -%D The last case outputs a \type{gsave fill grestore} before -%D \type{stroke}. Handling the path outside the main loops -%D saves about 40\% run time.\footnote{We can save some more by -%D following the \METAPOST\ output routine, but for the moment -%D we keep things simple.} Switching between the main loop and -%D the path loop is done by means of the recursely called -%D macro \type{\handleMPsequence}. - -\def\handleMPpath - {\chardef\finiMPpath0 - \let\closeMPpath\relax - \let\flushMPpath\flushnormalMPpath - \resetMPstack - \nofMPsegments\plusone - \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 - {\ifcase\getMPkeyword\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\flushconcatMPsegment - {\ifcase\getMPkeyword\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\doflushsomeMPpath - {\dodoflushsomeMPpath - \advance\nofMPsegments \plusone - \ifnum\nofMPsegments<\scratchcounter - \expandafter\doflushsomeMPpath - \fi} - -\def\flushsomeMPpath - {\scratchcounter\nofMPsegments - \nofMPsegments\plusone - \doflushsomeMPpath} - -\def\flushnormalMPpath{\let\dodoflushsomeMPpath\flushnormalMPsegment\flushsomeMPpath} - -%OLD \def\flushconcatMPpath{\let\dodoflushsomeMPpath\flushconcatMPsegment\flushsomeMPpath} - -%NEW pre-calculate 1/D so it needn't be repeated for each control point. - -\def\flushconcatMPpath - {\MPreciprocaldeterminant - \let\dodoflushsomeMPpath\flushconcatMPsegment\flushsomeMPpath} - -%D The transformation of the coordinates is handled by one of -%D the macros Tanmoy posted to the \PDFTEX\ mailing list. -%D I rewrote and optimized the original macro to suit the other -%D macros in this module. -%D -%D \starttyping -%D \doMPconcat {x position} \xresult {y position} \yresult -%D \stoptyping -%D -%D By setting the auxiliary \DIMENSIONS\ \type{\dimen0} upto -%D \type{\dimen10} only once per path, we save over 20\% run -%D time. Some more speed was gained by removing some parameter -%D passing. These macros can be optimized a bit more by using -%D more constants. There is however not much need for further -%D optimization because penshapes usually are round and -%D therefore need no transformation. Nevertheless we move the -%D factor to the outer level and use a bit different \type{pt} -%D removal macro. Although the values represent base points, -%D we converted them to pure points, simply because those can -%D be converted back. - -%OLD \mathchardef\MPconcatfactor=256 % beware don't remove spaces before it - -%OLD \def\doMPreducedimen#1 -%OLD {\count0\MPconcatfactor -%OLD \advance\dimen#1 \ifdim\dimen#1>\zeropoint .5\else -.5\fi\count0 -%OLD \divide\dimen#1 \count0\relax} - -%OLD % too inaccurate (see old pragma logo) -%OLD -%OLD \def\doMPreducedimen#1 -%OLD {\count0=\MPconcatfactor -%OLD \divide\dimen#1 \count0\relax} - -%OLD \def\doMPreducedimen#1 -%OLD {\advance\dimen#1 \ifdim\dimen#1>\zeropoint .5\else -.5\fi\MPconcatfactor -%OLD \divide\dimen#1 \MPconcatfactor} - -%D The transformation code is rewritten by Daniel H. Luecking who -%D describes his patch as follows: -%D -%D We would like to divide 1 by $X$, but all divisions are integer so -%D for accuracy we want to convert to large integers and make sure the -%D integer quotient has as many significant digits as possible. Thus we -%D need to replace $1/X$ with $M/N$ where $N$ is as large as possible -%D and $M/N$ is as large as possible. Also for simplicity $M$ should be -%D a power of 2. So we make $M = 2^{30}$ \footnote{$2^{31} - 1$ is the -%D largest legal integer. Using it (and simply ignoring the inaccuracy -%D caused by $-1$) turns out to be at least as accurate in all cases, -%D and more accurate in some.} (largest legal power of 2) and adjust -%D $X$ downward (if necessary) to the the range $1-2^{16}$. This gives -%D at least 15 significant binary digits, (almost as accurate as -%D \METAPOST\ for numbers near 1) or almost 5 significant figures -%D (decimal). - -\newcount\MPscratchCnt -\newdimen\MPscratchDim % will be assigned global - -\def\MPadjustdimen % sets \MPscratchDim and \MPscratchCnt - {\MPscratchCnt\zerocount - \doMPadjustdimen} - -\def\doMPadjustdimen - {\ifdim\MPscratchDim>\onepoint - \divide\MPscratchDim 2 - \advance\MPscratchCnt \plusone - \expandafter\doMPadjustdimen - \fi} - -%OLD \def\doMPexpanddimen#1 -%OLD {\multiply\dimen#1 \MPconcatfactor\relax} - -%D DHL: When viewed as an integer, $1 \hbox{pt}=2^{16}$ so $2^{32}/X$ -%D is the right way to do $(1 \hbox{pt})/(X \hbox{pt})$ and get the -%D answer in points. But we are limited to $2^{30}/X$. However, we -%D actually do $[ 2^{30} / (X/2^K) ]*2^{2-K}$ where $K$ is the number -%D of halvings it takes to bring $X$ below $1 \hbox{pt}$. If $K$ is 0 -%D or 1 we readjust by multiplying by 4 or 2, otherwise by halving -%D $(K-2)$ times \type {\MPscratchCnt} holds the value of $K$ from -%D \type {\MPadjustdimen}. - -\def\MPreadjustdimen % acts on \MPscratchDim and MPscratchCnt - {\ifcase\MPscratchCnt - \multiply\scratchdimen 4 - \or - \multiply\scratchdimen 2 - \else - \expandafter\doMPreadjustdimen - \fi} - -\def\doMPreadjustdimen - {\ifnum\MPscratchCnt>2 - \divide\scratchdimen 2 - \advance\MPscratchCnt \minusone - \expandafter\doMPreadjustdimen - \fi} - -\def\MPreciprocaldeterminant - {\scratchdimen\withoutpt\the\dimen0 \dimen6 % s_x*s_y - \advance\scratchdimen - \withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y - \ifdim\scratchdimen<\zeropoint % we need a positive dimension - \scratchdimen-\scratchdimen % for \MPadjustdimen (?) - \doMPreciprocal - \scratchdimen-\scratchdimen - \else - \doMPreciprocal - \fi - \edef\MPreciprocal{\withoutpt\the\scratchdimen}} - -\newcount\MPnumerator \MPnumerator = 1073741824 % 2^{30} - -% todo: dimexpr - -\def\doMPreciprocal % replace \scratchdimen with its reciprocal - {\ifdim\scratchdimen=\onepoint \else - \MPadjustdimen - \scratchcounter\MPnumerator - \divide\scratchcounter\scratchdimen - \scratchdimen1\scratchcounter % 1 needed ! - \MPreadjustdimen - \fi} - -%OLD \def\presetMPconcat -%OLD {\dimen 0=\gMPs1\onepoint \doMPreducedimen 0 % r_x -%OLD \dimen 2=\gMPs2\onepoint \doMPreducedimen 2 % s_x -%OLD \dimen 4=\gMPs3\onepoint \doMPreducedimen 4 % s_y -%OLD \dimen 6=\gMPs4\onepoint \doMPreducedimen 6 % r_y -%OLD \dimen 8=\gMPs5\onepoint \doMPreducedimen 8 % t_x -%OLD \dimen10=\gMPs6\onepoint \doMPreducedimen10 } % t_y -%OLD -%OLD \def\presetMPscale -%OLD {\dimen 0=\gMPs1\onepoint \doMPreducedimen 0 -%OLD \dimen 2 \zeropoint -%OLD \dimen 4 \zeropoint -%OLD \dimen 6=\gMPs2\onepoint \doMPreducedimen 6 -%OLD \dimen 8 \zeropoint -%OLD \dimen10 \zeropoint} - -\def\cleanupMPconcat - {\ignoreMPspecials - \docleanupMPargument1% - \docleanupMPargument6% - \keepMPspecials} - -\def\presetMPconcat - {\dimen 0=\gMPs1\onepoint % s_x - \dimen 2=\gMPs2\onepoint % r_x - \dimen 4=\gMPs3\onepoint % r_y - \dimen 6=\gMPs4\onepoint % s_y - \dimen 8=\gMPs5\onepoint % t_x - \dimen10=\gMPs6\onepoint} % t_y - -\def\presetMPscale - {\dimen 0=\gMPs1\onepoint - \dimen 2 \zeropoint - \dimen 4 \zeropoint - \dimen 6=\gMPs2\onepoint - \dimen 8 \zeropoint - \dimen10 \zeropoint} - -\def\noMPtranslate % use this one grouped - {\dimen 8 \zeropoint % t_x - \dimen10 \zeropoint} % t_y - -%D \starttyping -%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 \doMPreducedimen16 -%D \divide \dimen18 \dimen16 \doMPexpanddimen18 -%D \divide \dimen12 \dimen16 \doMPexpanddimen12 -%D % -%D \edef#2{\withoutpt\the\dimen18}% % p_x^\prime -%D \edef#4{\withoutpt\the\dimen12}} % p_y^\prime -%D \stoptyping - -%D The following optimization resulted from some tests by -%D and email exchanges with Sanjoy Mahajan. -%D -%D \starttyping -%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 \stoptyping -%D -%D But, this one is still too inaccurate, so we now have: - -%D We cannot use \type {\beginETEX} here since in plain we -%D get \type {\outer} problems, sigh. - -%OLD \beginTEX -%OLD -%OLD \def\MPcriteriumA {512pt} % scale -%OLD \def\MPcriteriumB {2pt} % scale -%OLD -%OLD \endTEX -%OLD -%OLD \ifx\MPcriteriumA\undefined -%OLD -%OLD \newdimen\MPcriteriumA \MPcriteriumA=512pt -%OLD \newdimen\MPcriteriumB \MPcriteriumB= 2pt -%OLD -%OLD \fi - -%OLD \def\doMPconcat#1#2#3#4% -%OLD {\dimen12=#1pt % p_x -%OLD \dimen14=#3pt % p_y -%OLD % -%OLD \chardef\MPfactor\zerocount -%OLD \ifdim\dimen4<\MPcriteriumB\ifdim\dimen4>-\MPcriteriumB -%OLD \ifdim\dimen6<\MPcriteriumB\ifdim\dimen6>-\MPcriteriumB -%OLD \ifdim\dimen8<\MPcriteriumB\ifdim\dimen8>-\MPcriteriumB -%OLD \ifdim\dimen10<\MPcriteriumB\ifdim\dimen10>-\MPcriteriumB -%OLD \chardef\MPfactor\plusone -%OLD \fi\fi -%OLD \fi\fi -%OLD \fi\fi -%OLD \fi\fi -%OLD \ifcase\MPfactor % spurious 0 removed -%OLD \chardef\MPfactor\plusone -%OLD \ifdim\dimen12<\MPcriteriumA\ifdim\dimen12>-\MPcriteriumA -%OLD \ifdim\dimen14<\MPcriteriumA\ifdim\dimen14>-\MPcriteriumA -%OLD \chardef\MPfactor16 -%OLD \fi\fi -%OLD \fi\fi -%OLD \fi -%OLD % -%OLD \multiply\dimen12 \MPfactor -%OLD \multiply\dimen14 \MPfactor -%OLD % -%OLD \doMPreducedimen12 -%OLD \doMPreducedimen14 -%OLD % -%OLD \dimen16 \dimen 0 -%OLD \multiply \dimen16 \dimen 6 -%OLD \dimen20 \dimen 2 -%OLD \multiply \dimen20 \dimen 4 -%OLD \advance \dimen16 -\dimen20 -%OLD % -%OLD \dimen18 \dimen12 -%OLD \multiply \dimen18 \dimen 6 -%OLD \dimen20 \dimen14 -%OLD \multiply \dimen20 \dimen 4 -%OLD \advance \dimen18 -\dimen20 -%OLD \dimen20 \dimen 4 -%OLD \multiply \dimen20 \dimen10 -%OLD \advance \dimen18 \dimen20 -%OLD \dimen20 \dimen 6 -%OLD \multiply \dimen20 \dimen 8 -%OLD \advance \dimen18 -\dimen20 -%OLD % -%OLD \multiply \dimen12 -\dimen 2 -%OLD \multiply \dimen14 \dimen 0 -%OLD \advance \dimen12 \dimen14 -%OLD \dimen20 \dimen 2 -%OLD \multiply \dimen20 \dimen 8 -%OLD \advance \dimen12 \dimen20 -%OLD \dimen20 \dimen 0 -%OLD \multiply \dimen20 \dimen10 -%OLD \advance \dimen12 -\dimen20 -%OLD % -%OLD \ifdim\dimen16=\onepoint \else -%OLD \ifdim\dimen16>\MPconcatfactor \onepoint \relax -%OLD \doMPreducedimen16 -%OLD \divide \dimen18 \dimen16 \doMPexpanddimen18 -%OLD \divide \dimen12 \dimen16 \doMPexpanddimen12 -%OLD \else -%OLD \divide \dimen18 \dimen16 \doMPexpanddimen18 \doMPexpanddimen18 -%OLD \divide \dimen12 \dimen16 \doMPexpanddimen12 \doMPexpanddimen12 -%OLD \fi -%OLD \fi -%OLD % -%OLD \divide\dimen18 \MPfactor -%OLD \divide\dimen12 \MPfactor -%OLD % -%OLD \edef#2{\withoutpt\the\dimen18}% % p_x^\prime -%OLD \edef#4{\withoutpt\the\dimen12}} % p_y^\prime - -%D DHL: Ideally, $r_x$, $r_y$, $s_x$, $s_y$ should be in macros, not -%D dimensions (they are scalar quantities after all, not lengths). I -%D suppose the authors decided to do calculations with integer -%D arithmetic instead of using real factors because it's faster. -%D However, the actual macros test slower, possibly because I've -%D omitted three nested loops. In my test files, my approach is more -%D accurate. It is also far simpler and overflow does not seem to be a -%D significant concern. The scale factors written by Metapost are (?) -%D always $<=1$ (it scales coordinates internally) and coordinates are -%D always likely to be less than \type {\maxdimen}. -%D -%D If this should ever cause problems, the scale factors can be reduced. - -\def\doMPconcat#1#2#3#4% - {\dimen12=#1pt % p_x % #1\onepoint - \dimen14=#3pt % p_y % #3\onepoint - \advance\dimen12 -\dimen8 % p_x - t_x - \advance\dimen14 -\dimen10 % p_y - t_y - \dimen18=\withoutpt\the\dimen6 \dimen12 % s_y(p_x - t_x) - \advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y) - \dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y) - \advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x) - % \MPreciprocal contains precomputed 1/D: - \dimen18=\MPreciprocal\dimen18 - \dimen14=\MPreciprocal\dimen14 - \edef#2{\withoutpt\the\dimen18}% % p_x^\prime - \edef#4{\withoutpt\the\dimen14}} % p_y^\prime - -% faster but not that often used -% -% \def\doMPconcat#1#2#3#4% -% {\dimen12\dimexpr#1\points-\dimen 8\relax % p_x-t_x -% \dimen14\dimexpr#3\points-\dimen10\relax % p_y-t_y -% \dimen18\dimexpr\withoutpt\the\dimen6\dimen12-\withoutpt\the\dimen4\dimen14\relax % s_y(p_x-t_x)-r_y(p_y-t_y) -% \dimen14\dimexpr\withoutpt\the\dimen0\dimen14-\withoutpt\the\dimen2\dimen12\relax % s_x(p_y-t_y)-r_x(p_x-t_x) -% \edef#2{\withoutpt\the\dimexpr\MPreciprocal\dimen18\relax}% % p_x^\prime -% \edef#4{\withoutpt\the\dimexpr\MPreciprocal\dimen14\relax}} % p_y^\prime - -%D One reason for Daniel to write this patch was that at small sizes -%D the accuracy was less than optimal. Here is a test that demonstrates -%D that his alternative is pretty good: -%D -%D \startlinecorrection -%D \startMPcode -%D for i = 5cm,1cm,5mm,1mm,.5mm,.1mm,.01mm : -%D draw fullcircle scaled i withpen pencircle xscaled (i/10) yscaled (i/20) rotated 45 ; -%D endfor ; -%D \stopMPcode -%D \stoplinecorrection - -%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 -%D cosinus calculations as well as scaling and translating. The -%D \METAPOST\ to \PDF\ conversion however only needs -%D transformation. - -%M \start \switchtobodyfont [ss] - -%D Given a point $(U_x, U_y)$ in user coordinates, the business -%D of \POSTSCRIPT\ is to convert it to device space. Let us say -%D that the device space coordinates are $(D_x, D_y)$. Then, in -%D \POSTSCRIPT\ $(D_x, D_y)$ can be written in terms of -%D $(U_x, U_y)$ in matrix notation, either as -%D -%D \placeformula -%D \startformula -%D \pmatrix{D_x&D_y&1\cr} = \pmatrix{U_x&U_y&1\cr} -%D \pmatrix{s_x&r_x&0\cr -%D r_y&s_y&0\cr -%D t_x&t_y&1\cr} -%D \stopformula -%D -%D or -%D -%D \placeformula -%D \startformula -%D \pmatrix{D_x\cr D_y\cr 1} = \pmatrix{s_x&r_y&t_x\cr -%D r_x&s_y&t_y\cr -%D 0 &0 &1 \cr} -%D \pmatrix{U_x\cr -%D U_y\cr -%D 1 \cr} -%D \stopformula -%D -%D both of which is a shorthand for the same set of equations: -%D -%D \placeformula -%D \startformula -%D D_x = s_x U_x + r_y U_y + t_x -%D \stopformula -%D -%D \placeformula -%D \startformula -%D D_y = r_x U_x + s_y U_y + t_y -%D \stopformula -%D -%D which define what is called an `affine transformation'. -%D -%D \POSTSCRIPT\ represents the `transformation matrix' as a -%D six element matrix instead of a $3\times 3$ array because -%D three of the elements are always~0, 0 and~1. Thus the above -%D transformation is written in postscript as $[s_x\, r_x\, -%D r_y\, s_y\, t_x\, t_y]$. However, when doing any -%D calculations, it is useful to go back to the original -%D matrix notation (whichever: I will use the second) and -%D continue from there. -%D -%D As an example, if the current transformation matrix is -%D $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$ and you say \typ{[a b -%D c d e f] concat}, this means: -%D -%D \startnarrower -%D Take the user space coordinates and transform them to an -%D intermediate set of coordinates using array $[a\, b\, c\, d\, -%D e\, f]$ as the transformation matrix. -%D -%D Take the intermediate set of coordinates and change them to -%D device coordinates using array $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$ -%D as the transformation matrix. -%D \stopnarrower -%D -%D Well, what is the net effect? In matrix notation, it is -%D -%D \placeformula -%D \startformula -%D \pmatrix{I_x\cr I_y\cr 1\cr} = \pmatrix{a&c&e\cr -%D b&d&f\cr -%D 0&0&1\cr} -%D \pmatrix{U_x\cr -%D U_y\cr -%D 1 \cr} -%D \stopformula -%D -%D \placeformula -%D \startformula -%D \pmatrix{D_y\cr D_y\cr 1\cr} = \pmatrix{s_x&r_y&t_x\cr -%D r_x&s_y&t_y\cr -%D 0 &0 &1 \cr} -%D \pmatrix{I_x\cr -%D I_y\cr -%D 1 \cr} -%D \stopformula -%D -%D where $(I_x, I_y)$ is the intermediate coordinate. -%D -%D Now, the beauty of the matrix notation is that when there is -%D a chain of such matrix equations, one can always compose -%D them into one matrix equation using the standard matrix -%D composition law. The composite matrix from two matrices can -%D be derived very easily: the element in the $i$\high{th} -%D horizontal row and $j$\high{th} vertical column is -%D calculated by`multiplying' the $i$\high{th} row of the first -%D matrix and the $j$\high{th} column of the second matrix (and -%D summing over the elements). Thus, in the above: -%D -%D \placeformula -%D \startformula -%D \pmatrix{D_x\cr D_y\cr 1} = \pmatrix{s_x^\prime&r_y^\prime&t_x^\prime\cr -%D r_x^\prime&s_y^\prime&t_y^\prime\cr -%D 0 &0 &0 \cr} -%D \pmatrix{U_x\cr -%D U_y\cr -%D 1 \cr} -%D \stopformula -%D -%D with -%D -%D \placeformula -%D \startformula -%D \eqalign -%D {s_x^\prime & = s_x a + r_y b \cr -%D r_x^\prime & = r_x a + s_y b \cr -%D r_y^\prime & = s_x c + r_y d \cr -%D s_y^\prime & = r_x c + s_y d \cr -%D t_x^\prime & = s_x e + r_y f + t_x \cr -%D t_y^\prime & = r_x e + s_y f + t_y \cr} -%D \stopformula - -%D In fact, the same rule is true not only when one is going -%D from user coordinates to device coordinates, but whenever -%D one is composing two `transformations' together -%D (transformations are `associative'). Note that the formula -%D is not symmetric: you have to keep track of which -%D transformation existed before (i.e.\ the equivalent of -%D $[s_x\, r_x\, r_y\, s_y\, t_x\, t_y]$) and which was -%D specified later (i.e.\ the equivalent of $[a\, b\, c\, d\, -%D e\, f]$). Note also that the language can be rather -%D confusing: the one specified later `acts earlier', -%D converting the user space coordinates to intermediate -%D coordinates, which are then acted upon by the pre||existing -%D transformation. The important point is that order of -%D transformation matrices cannot be flipped (transformations -%D are not `commutative'). -%D -%D Now what does it mean to move a transformation matrix -%D before a drawing? What it means is that given a point -%D $(P_x, P_y)$ we need a different set of coordinates -%D $(P_x^\prime, P_y^\prime)$ such that if the transformation -%D acts on $(P_x^\prime, P_y^\prime)$, they produce $(P_x, -%D P_y)$. That is we need to solve the set of equations: -%D -%D \placeformula -%D \startformula -%D \pmatrix{P_x\cr P_y\cr 1\cr} = \pmatrix{s_x&r_y&t_x\cr -%D r_x&s_y&t_y\cr -%D 0 &0 &1 \cr} -%D \pmatrix{P_x^\prime\cr -%D P_y^\prime\cr -%D 1 \cr} -%D \stopformula -%D -%D Again matrix notation comes in handy (i.e. someone has -%D already solved the problem for us): we need the inverse -%D transformation matrix. The inverse transformation matrix can -%D be calculated very easily: -%D -%D \placeformula -%D \startformula -%D \pmatrix{P_x^\prime\cr P_y^\prime\cr 1\cr} = -%D \pmatrix{s_x^\prime&r_y^\prime&t_x^\prime\cr -%D r_x^\prime&s_y^\prime&t_y^\prime\cr -%D 0 &0 &1 \cr} -%D \pmatrix{P_x\cr -%D P_y\cr -%D 1 \cr} -%D \stopformula -%D -%D where, the inverse transformation matrix is given by -%D -%D \placeformula -%D \startformula -%D \eqalign -%D {D & = s_x s_y - r_x r_y \cr -%D s_x^\prime & = s_y / D \cr -%D s_y^\prime & = s_x / D \cr -%D r_x^\prime & = - r_x / D \cr -%D r_y^\prime & = - r_y / D \cr -%D t_x^\prime & = ( - s_y t_x + r_y t_y ) / D \cr -%D t_y^\prime & = ( r_x t_x - s_x t_y ) / D \cr} -%D \stopformula -%D -%D And you can see that when expanded out, this does -%D give the formulas: -%D -%D \placeformula -%D \startformula -%D P_x^\prime = { { s_y(p_x-t_x) + r_y(t_y-p_y) } \over -%D { s_x s_y-r_x r_y } } -%D \stopformula -%D -%D \placeformula -%D \startformula -%D P_y^\prime = { { s_x(p_y-t_y) + r_x(t_x-p_x) } \over -%D { s_x*s_y-r_x*r_y } } -%D \stopformula -%D -%D The code works by representing a real number by converting -%D it to a dimension to be put into a \DIMENSION\ register: 2.3 would -%D be represented as 2.3pt for example. In this scheme, -%D multiplying two numbers involves multiplying the \DIMENSION\ -%D registers and dividing by 65536. Accuracy demands that the -%D division be done as late as possible, but overflow -%D considerations need early division. -%D -%D Division involves dividing the two \DIMENSION\ registers and -%D multiplying the result by 65536. Again, accuracy would -%D demand that the numerator be multiplied (and|/|or the -%D denominator divided) early: but that can lead to overflow -%D which needs to be avoided. -%D -%D If nothing is known about the numbers to start with (in -%D concat), I have chosen to divide the 65536 as a 256 in each -%D operand. However, in the series calculating the sine and -%D cosine, I know that the terms are small (because I never -%D have an angle greater than 45 degrees), so I chose to -%D apportion the factor in a different way. - -%M \stop - -%D The path is output using the values saved on the stack. If -%D needed, all coordinates are recalculated. - -\def\finishMPpath - {\PDFcode{\ifcase\finiMPpath W n\or S\or f\or B\fi}} - -\def\processMPpath - {\checkMPpath - \ifcase\nofMPsegments\else - \flushMPpath - \closeMPpath - \finishMPpath - \fi - \let\handleMPsequence\dohandleMPsequence - \resetMPstack - \nofMPsegments\zerocount - \handleMPsequence} - -%D The following \METAPOST\ code is quite valid but, when -%D processed and converted to \PDF, will make a file -%D unprintable on a Hewlett Packard printer (from Acrobat -%D $v<=5$). Who is to blame, the driver of the OS layer in -%D between, is hard to determine, so we add an additional -%D check. -%D -%D \starttyping -%D clip currentpicture to origin -- cycle ; -%D setbounds currentpicture to fullsquare scaled 5cm ; -%D \stoptyping - -\def\checkMPpath - {\ifcase\finiMPpath - \ifnum\nofMPsegments<3 % n is one ahead - \message{omitting zero clip path}% - \nofMPsegments\zerocount - \fi - \fi} - -%D In \PDF\ the \type{cm} operator must precede the path -%D specification. We therefore can output the \type{cm} at -%D the moment we encounter it. - -\def\handleMPpathconcat - {\presetMPconcat - \PDFcode{\gMPs1 \gMPs2 \gMPs3 \gMPs4 \gMPs5 \gMPs6 cm}% - \resetMPstack} - -\def\handleMPpathscale - {\presetMPscale - \PDFcode{\gMPs1 0 0 \gMPs2 0 0 cm}% - \resetMPstack} - -%D This macro interprets the path and saves it as compact as -%D possible. - -\def\dohandleMPpath#1% - {\ifcase\lccode`#1\relax - \@EA\dohandleMPpathA - \else - \@EA\dohandleMPpathB - \fi#1} - -\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 - \cleanupMPconcat - \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 conversion. The traditional method is in the MkII file. %D The main conversion command is: %D @@ -1815,147 +147,46 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject\undefined \chardef\makeMPintoPDFobject=0 \fi +\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi +\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic \plusone \fi +\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi -\def\lastPDFMPobject{0} +\let\lastPDFMPobject \!!zerocount +\let\currentPDFresources\empty +\let\setMPextensions \relax -%D The additional code needed can be made available in the -%D (global) macro \type {\currentPDFresources}. +\def\PDFMPformoffset + {\ifx\objectoffset\undefined\zeropoint\else\objectoffset\fi} -\let\currentPDFresources\empty +\def\resetMPvariables#1#2#3% + {\global\let\MPwidth \!!zeropoint + \global\let\MPheight\!!zeropoint + \global\let\MPllx \!!zerocount + \global\let\MPlly \!!zerocount + \global\let\MPurx \!!zerocount + \global\let\MPury \!!zerocount + \xdef\MPxscale {#2}\ifx\MPxscale\empty\let\MPxscale\!!plusone\fi + \xdef\MPyscale {#3}\ifx\MPyscale\empty\let\MPyscale\!!plusone\fi + \xdef\MPfilename {#1}} -\newtoks\everyMPtoPDFconversion +%D The main macro: -\def\convertMPtoPDF % #1#2#3% - {\bgroup - \ifx\pdfdecimaldigits\undefined\else \pdfdecimaldigits=5 \fi % new - \setbox\scratchbox\vbox\bgroup - \xdef\MPheight{\zeropoint}% - \xdef\MPwidth {\zeropoint}% - \forgetall - \offinterlineskip - \startMPresources - \doprocessMPtoPDFfile} % - -%D The next one is kind of private and probably will become obsolete): - -\def\processMPtoPDFfile % file xscale yscale - {\bgroup - \let\finishMPgraphic\egroup - \doprocessMPtoPDFfile} - -\let\setMPextensions\relax - -\def\doprocessMPtoPDFfile#1#2#3% file xscale yscale - {% the following line is needed for latex where onepoint is not - % onepoint but a number (maxdimen); some day i'll make a latex - % variant of this file so that i no longer have to deal with such - % issues; then i'll also speed up this module using a few context - % tricks - % - \let\onepoint\onerealpoint - % - \setMPspecials - \setMPextensions - \the\everyMPtoPDFconversion - \catcode`\^^M=\@@endofline - \startMPscanning - \let\do\empty - \xdef\MPxscale{#2}% - \xdef\MPyscale{#3}% - \xdef\MPxoffset{0}% - \xdef\MPyoffset{0}% - \xdef\MPyshift{\zeropoint}% - \donefalse - \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 -% -% \def\finishMPgraphic -% {\stopMPresources -% \egroup -% \ifx\pdftexversion\undefined\else\ifnum\pdftexversion<14 % for the moment -% \chardef\makeMPintoPDFobject=0 -% \fi\fi -% \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else -% \chardef\makeMPintoPDFobject=1 -% \fi\fi -% \setbox\scratchbox=\vbox -% {\forgetall -% \hbox -% {\PDFcode{q \MPxscale\space 0 0 \MPyscale\space \MPxoffset\space \MPyoffset\space cm}% -% \lower\MPyshift\box\scratchbox % unscaled shift -% \PDFcode{Q}}}% -% \ht\scratchbox\MPheight -% \wd\scratchbox\MPwidth -% \dp\scratchbox\zeropoint -% \ifcase\makeMPintoPDFobject -% \box\scratchbox -% \or -% \immediate\pdfxform resources{\currentPDFresources}\scratchbox -% \xdef\lastPDFMPobject{\the\pdflastxform}% -% \pdfrefxform\lastPDFMPobject -% \global\let\currentPDFresources\empty -% \else -% \box\scratchbox -% \fi -% \egroup} -% -% funny clip in viewer -% -% \setbox\scratchbox=\vbox -% {\forgetall -% \dimen0=\MPllx bp -% \dimen2=\MPlly bp -% \setbox\scratchbox=\hbox{\hskip-\dimen0\raise-\dimen2\box\scratchbox}% -% \ht\scratchbox=\zeropoint -% \dp\scratchbox=\zeropoint -% \wd\scratchbox=\zeropoint -% \hbox -% {\PDFcode{q \MPxscale\space 0 0 \MPyscale\space 0 0 cm}% -% \lower\MPshift\box\scratchbox -% \PDFcode{Q}}}% - -% \let\PDFMPformoffset\zeropoint +\def\convertMPtoPDF#1#2#3% + {\resetMPvariables{#1}{#2}{#3}% + \mkconvertMPtoPDF} -\def\PDFMPformoffset - {\ifx\objectoffset\undefined\zeropoint\else\objectoffset\fi} +\def\processMPtoPDFfile#1#2#3% obsolete + {\resetMPvariables{#1}{#2}{#3}% + \mkprocessMPtoPDFfile} -\chardef\blackoutMPgraphic\plusone % in supp-pdf it's \zerocount +%D A common hook. -\def\finishMPgraphic - {\stopMPresources - \egroup - \setbox\scratchbox\vbox - {\forgetall - \hbox - {\PDFcode{q \MPxscale\space 0 0 \MPyscale\space \MPxoffset\space \MPyoffset\space cm}% - \ifcase\blackoutMPgraphic\or\PDFcode{0 g 0 G}\fi - \lower\MPyshift\box\scratchbox % unscaled shift - \PDFcode{Q}}}% - \ht\scratchbox\MPheight - \wd\scratchbox\MPwidth - \dp\scratchbox\zeropoint\relax - \dopackageMPgraphic\scratchbox - \egroup - \endinput} +\let\MPfshowcommand\empty -%D Alternative for \PDFTEX. We cannot come up with something more contexy -%D because this module is also used in \LATEX. +%D Objects. \def\dopackageMPgraphic#1% #1 = boxregister - {%\ifx\pdfxform\undefined - % \chardef\makeMPintoPDFobject\zerocount % no pdftex at all - %\else\ifx\pdftexversion\undefined - % \chardef\makeMPintoPDFobject\zerocount % no pdftex at all - %\else\ifnum\pdftexversion<14 - % \chardef\makeMPintoPDFobject\zerocount % no resource support - %\else - % % keep the default value - %\fi\fi\fi - \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else + {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) \chardef\makeMPintoPDFobject\plusone \fi\fi @@ -1998,8 +229,6 @@ %D {deleteMPgraphic, %D startMPresources, %D stopMPresources} -%D -%D Here are a few hooks for \CONTEXT\ specific things. \ifx\deleteMPgraphic\undefined \def\deleteMPgraphic#1{} @@ -2010,77 +239,6 @@ \let\stopMPresources\relax \fi -%D \macros -%D {twodigitMPoutput} -%D -%D We can limit the precision to two digits after the comma -%D by saying: -%D -%D \starttyping -%D \twodigitMPoutput -%D \stoptyping -%D -%D This option only works in \CONTEXT\ combined with \ETEX. - -\def\twodigitMPoutput - {\let\!MP \twodigitrounding - \def\!MPgMPs##1{\twodigitrounding{\gMPs##1}}% - \def\!MPgMPa##1{\twodigitrounding{\gMPa##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\ -%D files would drive both me and \TEX\ crazy. - -\ifx\undefined\StopLatexHack \else \StopLatexHack \fi - -\protect % \endinput - -%D \module -%D [ file=supp-mpe, -%D version=1999.07.10, -%D title=\CONTEXT\ Support Macros, -%D subtitle=METAPOST Special Extensions, -%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. - -% fuzzy and complicating is the fact that we need to support -% context as well as mptopdf, so we cannot fall back on the -% special drivers and color module (although there may be -% good reasons to use a smaller context instead); also, -% shading is handled here while it should move to the special -% driver - to do! - -%D This module is still experimental and deals with some -%D extensions to \METAPOST. When using \POSTSCRIPT\ output, -%D these extensions can be supplied by means of proper -%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 For usage in plain \TEX, say something: -%D -%D \starttyping -%D \input supp-pdf -%D \input supp-mpe -%D -%D \MPcmykcolorstrue -%D \MPspotcolorstrue -%D \chardef\makeMPintoPDFobject\plusone -%D \stoptyping - -\writestatus{loading}{MetaPost Special Extensions} - %D We implement extensions by using the \METAPOST\ special %D mechanism. Opposite to \TEX's specials, the \METAPOST\ ones %D are flushed before or after the graphic data, but thereby @@ -2124,107 +282,8 @@ %D from to n inner_r g b x y outer_r g b x y %D from to n inner_r g b x y radius outer_r g b x y radius %D \stoptyping -%D -%D The implementation below saves the data on the stack in -%D a way similar to the macros in \type {supp-pdf.tex}, and -%D just overload a few already defined handlers. That way, -%D the existing macros are still generic. \footnote {Actually, -%D the macros here are just as generic.} -%D -%D Currently the only extension concerns shading, which is -%D accomplished by handling yet another value of \type -%D {\finiMPpath}. The recource disctionary is stored and -%D later picked up by the general \CONTEXT\ figure inclusion -%D macros. - -\unprotect - -%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. - -\chardef\MPspecialversion = 0 % specials when >1 -\chardef\MPspecialrevision = 0 % specials when >1 -\chardef\MPspecialsignal = 0 % passed on by graphic - -\chardef\inlineMPspecials = 1 % only needed for stack resetting - -%D This macro handles the special definitions that are -%D passed as comment. - -\def\dohandleMPspecialcomment#1 - {\setMPargument{#1}% - \advance\scratchcounter \minusone - \ifcase\scratchcounter - \handleMPspecialcommand - \donetrue - \doresetMPstack - \let\handleMPsequence\dohandleMPsequence - \expandafter\handleMPsequence - \else - \expandafter\dohandleMPspecialcomment - \fi} - -\def\handleMPspecialcomment #1 % number of arguments - {\doresetMPstack - \scratchcounter#1\relax - \ifcase\scratchcounter % when zero, inline shading is used - \chardef\inlineMPspecials\plusone - \let\handleMPsequence\dohandleMPsequence - \expandafter\handleMPsequence - \else - \chardef\inlineMPspecials\zerocount - \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. - -\def\handleMPspecialcommand - {\ifcase\inlineMPspecials\or - \advance\nofMParguments \minusone % pop the size - \fi - \ifundefined\MPspecial - \message{[unknown \MPspecial]}% - \else - \csname\MPspecial\endcsname - \fi - \ifcase\inlineMPspecials - \doresetMPstack % 0 - \else - \resetMPstack % 1 - \fi} - -%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. -\newconditional\manyMPspecials % \settrue\manyMPspecials - -\def\handleMPspecialscomment #1.#2 #3 % version.revision signal #4=div=1000|10000 - {\doresetMPstack - \chardef\MPspecialversion #1% - \chardef\MPspecialrevision#2% - \chardef\MPspecialsignal #3% - \let\handleMPsequence\dohandleMPsequence - \ifnum#1=\plusone - \expandafter\handleMPsequence - \else - \expandafter\handleMPspecialscommentx - \fi} - -\def\handleMPspecialscommentx #1 % version 2 -% {\doifelsedoifelse{#1}{10000}{\settrue\manyMPspecials}{\setfalse\manyMPspecials}% local - {\ifnum10000=0#1\relax\settrue\manyMPspecials\else\setfalse\manyMPspecials\fi - \handleMPsequence} - -% one can say (in meta-ini): -% -% \prependtoks -% _special_div_ := 1000\ifconditional\manyMPspecials0\fi ; -% \to \MPextensions +\newconditional\manyMPspecials \settrue\manyMPspecials %D In case of \PDF, we need to prepare resourcs. @@ -2232,15 +291,25 @@ \newtoks\MPstopresources \def\startMPresources - {\the\MPstartresources - \ifx\currentPDFresources\empty\else - \message{[unused resources]}% - \fi - \global\let\currentPDFresources\empty} + {\the\MPstartresources} \def\stopMPresources - {\let\currentPDFresources\empty - \the\MPstopresources} + {\the\MPstopresources} + +%D Some day we may consider collecting local resources. + +\appendtoks + \global\let\currentPDFresources\empty % kind of redundant +\to \MPstartresources + +% \appendtoks +% \collectPDFresources +% \global\let\currentPDFresources\collectedPDFresources +% \to \MPstopresources + +\appendtoksonce + \the\everyPDFxform +\to \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 @@ -2251,224 +320,139 @@ \newif\ifMPcmykcolors \newif\ifMPspotcolors -\ifx\normalhandleMPrgbcolor\undefined % in case we reload this module - - \let\normalhandleMPrgbcolor \handleMPrgbcolor - \let\normalhandleMPcmykcolor\handleMPcmykcolor - \let\normalhandleMPgraycolor\handleMPgraycolor - \let\normalhandleMPspotcolor\handleMPspotcolor - -\fi - -%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 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. - -\newif\ifPDFMPstrokecolor \PDFMPstrokecolortrue - -%D [This code should move to meta-ini.] - -\ifCONTEXT % we can use this for a better xgstate handling - - \def\checkPDFMPstrokecolor - {\ifPDFMPstrokecolor \PDFstrokecolortrue \fi} - - \def\normalhandleMPrgbcolor - {{\checkPDFMPstrokecolor\execcolorR\gMPa1:\gMPa2:\gMPa3:0:0\od}} - - \def\normalhandleMPcmykcolor - {{\checkPDFMPstrokecolor\execcolorC\gMPa1:\gMPa2:\gMPa3:\gMPa4:0:0\od}} - - \def\normalhandleMPgraycolor - {{\checkPDFMPstrokecolor\execcolorS\gMPa1:0:0\od}} - - \def\normalhandleMPspotcolor % ??? - {{\checkPDFMPstrokecolor\execcolorP\gMPa1:\gMPa2:\gMPa3:\gMPa4:0:0\od}} - -\fi +\def\dohandleMPrgb #1#2#3{\revokeMPtransparencyspecial\execcolorR #1:#2:#3:0:0\od} +\def\dohandleMPcmyk#1#2#3#4{\revokeMPtransparencyspecial\execcolorC#1:#2:#3:#4:0:0\od} +\def\dohandleMPgray #1{\revokeMPtransparencyspecial\execcolorS #1:0:0\od} +\def\dohandleMPspot#1#2#3#4{\revokeMPtransparencyspecial\execcolorP#1:#2:#3:#4:0:0\od} -% In the previous macros we use the special drivers. A more -% direct approach would have been: -% -% \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% -% {\PDFcode{#1 g #1 G}} -% -% \appendtoks -% \let\dostartrgbcolormode \doPDFstartrgbcolormode -% \let\dostartcmykcolormode\doPDFstartcmykcolormode -% \let\dostartgraycolormode\doPDFstartgraycolormode -% \to \everyMPtoPDFconversion +%D Specials: -%D Now we can handle special color signals. We only do this -%D when special are detected. +\settrue \manyMPspecials \newcount\nofMParguments \let\extraMPpathcode\empty -% \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1000.0000\relax} -% \def\doMPrgbnumber#1.#2#3#4#5\relax{#2#3#4} +\def\@@MP {@@MP} +\def\@@MPSK{@MPSK@} -%D We cannot use \type {\everyMPtoPDFconversion} because in \MPTOPDF\ -%D we don't have the \type {\appendtoks} macro available. +\def\MPspecial{\@@MPSK\@@MPSK\gMPs\nofMParguments} -\def\setMPextensions - {\ifconditional\manyMPspecials - \def\MPrgbnumber##1{\expandafter\doMPrgbnumber##10000.00000\relax}% - \def\doMPrgbnumber##1.##2##3##4##5##6\relax{##2##3##4##5}% - \else - \def\MPrgbnumber##1{\expandafter\doMPrgbnumber##1000.0000\relax}% - \def\doMPrgbnumber##1.##2##3##4##5\relax{##2##3##4}% - \fi} +\def\defineMPspecial#1#2% + {\setvalue{\@@MPSK\@@MPSK#1}{#2}} -%D The naive case looks like: +%D Special number~1 is dedicated to \CMYK\ support. If you +%D want to know why: look at this: %D -%D \starttyping -%D \def\handleMPrgbcolor% -%D {\setMPcolor -%D \ifcase\MPspecialversion -%D \resetMPcolor\normalhandleMPrgbcolor -%D \else\ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal -%D % consider it to be a signal -%D \else -%D \resetMPcolor\normalhandleMPrgbcolor -%D \fi\fi} -%D \stoptyping +%D \startbuffer[mp] +%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ; +%D \stopbuffer %D -%D However, since we want \CMYK\ support, we will use the -%D following implementation: - -% \def\setMPcolor -% {\edef\lastMPrvalue{\gMPa1}% -% \edef\lastMPgvalue{\gMPa2}% -% \edef\lastMPbvalue{\gMPa3}} -% -% speed up (hardly called, so no let is needed) - -\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 +%D \startbuffer[cmyk] +%D \startcombination[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 \stopcombination +%D \stopbuffer +%D +%D \placefigure +%D {\CMYK\ support disabled, +%D conversion to \RGB.} +%D {\setupcolors[cmyk=nee,state=start]\getbuffer[cmyk]} +%D +%D \placefigure +%D {\CMYK\ support enabled, +%D no support in \METAPOST.} +%D {\setupcolors[cmyk=ja,mpcmyk=nee,state=start]\getbuffer[cmyk]} +%D +%D \placefigure +%D {\CMYK\ support enabled, +%D no conversion to \RGB, +%D support in \METAPOST} +%D {\setupcolors[cmyk=ja,state=start]\getbuffer[cmyk]} -\def\@@MPSK{@MPSK@} -\def\@@MPSP{@MPSP@} +\defineMPspecial{1} + {\ifMPcmykcolors + \setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPcmykcolor{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}}% + \fi} -\def\interceptMPcmykcolor % todo : \ifMPcmykcolors - {\ifcase\MPrgbnumber\lastMPgvalue - % cannot happen - \or - % 1 == cmyk color spec - \ifMPcmykcolors \dointerceptMPcmykcolor \fi - \or - % 2 == spot color - \ifMPspotcolors \dointerceptMPspotcolor \fi - \or - % 3 == rgb transparency - \invokeMPtransparencyspecial - \or - % 4 == cmyk transparency - \ifMPcmykcolors \invokeMPtransparencyspecial \fi - \or - % 5 == spot transparency - \ifMPspotcolors \invokeMPtransparencyspecial \fi - \else - % \writestatus{MPtoPDF}{unknown direct special}% +\defineMPspecial{2} + {\ifMPspotcolors + \setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPspotcolor{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}}% +% \checkMPspot{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}% \fi} -% ifcsname +% \def\checkMPspot#1#2#3#4% +% {\expanded{\resolveMPspotcolor#1 #2 #3 #4}\end +% \ifx\MPspotspace\MPresolvedspace +% \edef\MPspotspacespec{/\MPspotspace\space}% +% \doifinstringelse\MPspotspacespec\currentMPcolorspaces +% \donothing\registerMPcolorspace +% \fi} -\def\dointerceptMPcmykcolor - {\revokeMPtransparencyspecial - \@EA\ifx\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else - \@EA\@EA\@EA\setMPcmyk\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname - \normalhandleMPcmykcolor - \fi} +\let\revokeMPtransparencyspecial\relax -\def\dointerceptMPspotcolor - {\revokeMPtransparencyspecial - \@EA\ifx\csname\@@MPSP\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else - \@EA\@EA\@EA\setMPspot\csname\@@MPSP\number\MPrgbnumber\lastMPbvalue\endcsname - \normalhandleMPspotcolor - \fi} +\def\dohandleMPrgbcolor #1#2#3{\revokeMPtransparencyspecial\execcolorR #1:#2:#3:0:0\od} +\def\dohandleMPcmykcolor#1#2#3#4{\revokeMPtransparencyspecial\execcolorC#1:#2:#3:#4:0:0\od} +\def\dohandleMPgraycolor #1{\revokeMPtransparencyspecial\execcolorS #1:0:0\od} +\def\dohandleMPspotcolor#1#2#3#4{\revokeMPtransparencyspecial\execcolorP#1:#2:#3:#4:0:0\od} -\def\handleMPrgbcolor - {\resetMPcolor - \ifcase\MPspecialversion - \normalhandleMPrgbcolor - \else - \setMPcolor - \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal\relax - \interceptMPcmykcolor - \else - \revokeMPtransparencyspecial - \normalhandleMPrgbcolor - \fi - \fi} +%D Transparency support used specials 60 (rgb) and 61 +%D (cmyk). +%D +%D \startbufferFshade + +%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,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\handleMPgraycolor - {\resetMPcolor - \ifcase\MPspecialversion \else \revokeMPtransparencyspecial \fi - \normalhandleMPgraycolor} +\def\dohandleMPrgbtransparency #1#2#3#4#5{\execcolorR #1:#2:#3:#4:#5\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial} +\def\dohandleMPcmyktransparency#1#2#3#4#5#6{\execcolorC#1:#2:#3:#4:#5:#6\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial} +\def\dohandleMPgraytransparency #1#2#3{\execcolorS #1:#2:#3\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial} +\def\dohandleMPspottransparency#1#2#3#4#5#6{\execcolorP#1:#2:#3:#4:#5:#6\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial} -\def\handleMPcmykcolor - {\resetMPcolor - \ifcase\MPspecialversion \else \revokeMPtransparencyspecial \fi - \normalhandleMPcmykcolor} +\def\dorevokeMPtransparencyspecial + {\PDFcode{\PDFtransparencyresetidentifier\space gs}% + \let\revokeMPtransparencyspecial\relax} -%D Specials are define and recalled using: +\defineMPspecial{3} % rgb + {\setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPrgbtransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs1}{\gMPs2}}} -\def\MPspecial - {MP special \gMPs\nofMParguments} +\defineMPspecial{4} % cmyk + {\setxvalue{\@@MPSK\gMPs7}{\noexpand\dohandleMPcmyktransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs1}{\gMPs2}}} -\def\defineMPspecial#1#2% - {\setvalue{MP special #1}{#2}} - -%D The path processing macro is slightly extended. - -\newtoks \invokeMPspecials - -\def\finishMPpath - {\PDFcode - {\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi - \extraMPpathcode}} - -\def\processMPpath - {\checkMPpath % ! - \ifcase\nofMPsegments\else - \let\extraMPpathcode\empty - \ifcase\MPspecialversion\else - \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 - \resetMPstack - \nofMPsegments0 - \handleMPsequence} +\defineMPspecial{5} % spot + {\setxvalue{\@@MPSK\gMPs7}{\noexpand\dohandleMPspottransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs1}{\gMPs2}}% + }%\checkMPspot{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}} %D Shading is an example of a more advanced graphic feature, %D but users will seldom encounter those complications. Here @@ -2605,137 +589,9 @@ %D \stoptabulate \newcount\currentPDFshade % 0 % global (document wide) counter -\let\currentMPshades\empty - -\def\startMPshading#1% - {\edef\currentMPspecial{\gMPs{#1}}} - -\def\stopMPshading - {\global\advance\currentPDFshade \plusone - \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 - {\ifundefined{mps:Sh:\currentMPspecial}\else - \edef\currentMPshade{\getvalue{obj:Sh:\currentMPspecial}}% - \doifinstringelse\currentMPshade\currentMPshades \donothing - {\xdef\currentMPshades{\currentMPshades\currentMPshade}}% - \def\extraMPpathcode{/Sh\getvalue{mps:Sh:\currentMPspecial} sh Q}% - \chardef\finiMPpath\zerocount - \PDFcode{q /Pattern cs}% - \fi} - -\appendtoks \invokeMPshadespecial \to \invokeMPspecials - -%D We need to convert the \CMYK\ specials into colors, because -%D we have to do it twice, we define a macro. - -\def\checkMPshadingcolor#1#2#3#4#5% - {\edef\tempMPrvalue{\csname\@@MP0#1\endcsname}% - \edef\tempMPgvalue{\csname\@@MP0#2\endcsname}% - \edef\tempMPbvalue{\csname\@@MP0#3\endcsname}% - \global\let\MPresolvedspace\MPgrayspace - \global\let\MPresolvedcolor\!!zerocount - \ifnum\MPrgbnumber\tempMPrvalue=\MPspecialsignal\relax - \ifcase\MPrgbnumber\tempMPgvalue - \or % 1 = cmyk - \ifMPcmykcolors - \expanded{\resolveMPcmykcolor\getvalue{\@@MPSK\number\MPrgbnumber\tempMPbvalue}}\end - \fi - \or % 2 = spot - \ifMPspotcolors - \expanded{\resolveMPspotcolor\getvalue{\@@MPSP\number\MPrgbnumber\tempMPbvalue}}\end - \fi - \or - % 3 = rgb transparency - % to do - \or - % 4 == cmyk transparency - % \ifMPcmykcolors - % to do - % \fi - \or - % 5 == spot transparency - % \ifMPspotcolors - % to do - % \fi - \fi - \else - \ifx\tempMPrvalue\tempMPgvalue - \ifx\tempMPrvalue\tempMPbvalue - \expanded{\resolveMPgraycolor\tempMPbvalue}\end - \else - \expanded{\resolveMPrgbcolor\tempMPrvalue\space\tempMPgvalue\space\tempMPbvalue}\end - \fi - \else - \expanded{\resolveMPrgbcolor\tempMPrvalue\space\tempMPgvalue\space\tempMPbvalue}\end - \fi - \fi - \let#4\MPresolvedcolor - \let#5\MPresolvedspace} - -%D We also need to make sure that we have two \RGB\ or -%D \CMYK colors, since we have to set the colorspace. - -\def\setMPshadingcolors#1#2#3#4#5#6% color space - {\checkMPshadingcolor{#1}{#2}{#3}\MPshadeAc\MPshadeAs - \checkMPshadingcolor{#4}{#5}{#6}\MPshadeBc\MPshadeBs - \ifx\MPshadeAs\MPshadeBs - \let\MPshadeA\MPshadeAc - \let\MPshadeB\MPshadeBc - \let\MPshadeC\MPshadeAs - \else\ifx\MPshadeAs\MPgrayspace - \ifx\MPshadeBs\MPrgbspace - \edef\MPshadeA{\MPshadeAc\space\MPshadeAc\space\MPshadeAc}% - \else - \negatecolorcomponent\MPshadeAc - \edef\MPshadeA{0 0 0 \MPshadeAc}% - \fi - \let\MPshadeB\MPshadeBc - \let\MPshadeC\MPshadeBs - \else\ifx\MPshadeBs\MPgrayspace - \let\MPshadeA\MPshadeAc - \ifx\MPshadeAs\MPrgbspace - \edef\MPshadeB{\MPshadeBc\space\MPshadeBc\space\MPshadeBc}% - \else - \negatecolorcomponent\MPshadeBc - \edef\MPshadeB{0 0 0 \MPshadeBc}% - \fi - \let\MPshadeC\MPshadeAs - \else - % different color spaces - \def\MPshadeA{1}% - \def\MPshadeB{1}% - \let\MPshadeC\MPgrayspace - \fi\fi\fi} - -\let\MPshadeA\MPcmykWhite -\let\MPshadeB\MPcmykBlack -\let\MPshadeC\MPgrayspace - -%D The reason why this macro is a bit complicates is that we -%D handle black and white situations (otherwise we would have -%D to use \CMYK\ b/w in case of a \CMYK\ shade). -%D Here are the special handlers: - -\defineMPspecial{30} - {\startMPshading{14}% type 2 - \setMPshadingcolors{4}{5}{6}{9}{10}{11}% - \immediate\pdfobj +\def\dosetMPlinearshade#1% + {\immediate\pdfobj {<>}% \immediate\pdfobj {<>}% - \stopMPshading} + \global\advance\currentPDFshade \plusone + \appendtoPDFdocumentshades{/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }% + \setxvalue{\@@MPSK#1}{\noexpand\dohandleMPshade{\the\currentPDFshade}}} -\defineMPspecial{31} - {\startMPshading{16}% type 3 - \setMPshadingcolors{4}{5}{6}{10}{11}{12}% - \immediate\pdfobj +\defineMPspecial{30} + {\expanded{\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA + \expanded{\resolveMPrgbcolor{\gMPs{9}}{\gMPs{10}}{\gMPs{11}}}\to\MPshadeB + \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs{12} \gMPs{13}}% + \dosetMPlinearshade{\gMPs{14}}} + +\defineMPspecial{32} + {\expanded{\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA + \expanded{\resolveMPcmykcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB + \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}% + \dosetMPlinearshade{\gMPs{16}}} + +\defineMPspecial{34} + {\expanded{\resolveMPspotcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA + \expanded{\resolveMPspotcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB + \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}% + \dosetMPlinearshade{\gMPs{16}}} + +\def\dosetMPcircularshade#1% + {\immediate\pdfobj {<>}% \immediate\pdfobj {<>}% - \stopMPshading} + \global\advance\currentPDFshade \plusone + \appendtoPDFdocumentshades{/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }% + \setxvalue{\@@MPSK#1}{\noexpand\dohandleMPshade{\the\currentPDFshade}}} + +\defineMPspecial{31} + {\expanded{\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA + \expanded{\resolveMPrgbcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}}\to\MPshadeB + \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs9 \gMPs{13} \gMPs{14} \gMPs{15}}% + \dosetMPcircularshade{\gMPs{16}}} + +\defineMPspecial{33} + {\expanded{\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA + \expanded{\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB + \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}% + \dosetMPcircularshade{\gMPs{18}}} + +\defineMPspecial{35} + {\expanded{\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA + \expanded{\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB + \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}% + \dosetMPcircularshade{\gMPs{18}}} + +\newconditional\ignoreMPpath + +\def\dohandleMPshade#1% + {\revokeMPtransparencyspecial + \settrue\ignoreMPpath + \def\extraMPpathcode{/Sh#1 sh Q}% + \chardef\finiMPpath\zerocount + \PDFcode{q /Pattern cs}} %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. -\def\invokeMPfigurespecial% - {\getvalue{mps:gr:\currentMPspecial}} % or \relax - -\appendtoks \invokeMPfigurespecial \to \invokeMPspecials - \defineMPspecial{10} - {\setxvalue{mps:gr:\gMPs8}% - {\noexpand\handleMPfigurespecial - {\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}% - \noexpand\setxvalue{mps:gr:\gMPs8}{}}} + {\setxvalue{\@@MPSK\gMPs8}% + {\noexpand\handleMPfigurespecial{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}{\gMPs8}}} -\def\handleMPfigurespecial#1#2#3#4#5#6#7% todo : combine with ext fig - {\vbox to \zeropoint +\def\handleMPfigurespecial#1#2#3#4#5#6#7#8% todo : combine with ext fig + {\global\letvalue{\@@MPSK#8}\empty + \vbox to \zeropoint {\vss \hbox to \zeropoint {\ifcase\pdfoutput\or % will be hooked into the special driver @@ -2820,99 +717,23 @@ %D for Mark Wicks. \defineMPspecial{20} - {\setxvalue{mps:hl:\gMPs6}% - {\noexpand\handleMPhyperlink - {\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}% - \noexpand\setxvalue{mps:hl:\gMPs6}{}}} - -\def\handleMPhyperlink#1#2#3#4#5% - {%\ifcase\pdfoutput\or - \setbox\scratchbox\hbox - {\setbox\scratchbox\null - \scratchdimen#1\onebasepoint\scratchdimen-\scratchdimen - \advance\scratchdimen#3\onebasepoint - \wd\scratchbox\scratchdimen - \scratchdimen#2\onebasepoint\scratchdimen-\scratchdimen - \advance\scratchdimen#4\onebasepoint - \ht\scratchbox\scratchdimen - \incolorfalse - \gotobox{\box\scratchbox}[#5]}% - \setbox\scratchbox\hbox - {\scratchdimen\MPxoffset\onebasepoint\advance\scratchdimen#1\onebasepoint - \hskip\scratchdimen - \scratchdimen\MPyoffset\onebasepoint\advance\scratchdimen#2\onebasepoint - \raise\scratchdimen\box\scratchbox}% - \smashbox\scratchbox - \box\scratchbox - }%\fi} - -\def\invokeMPhyperlinkspecial% - {\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 \startbuffer[mp] -%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ; -%D \stopbuffer -%D -%D \startbuffer[cmyk] -%D \startcombination[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 \stopcombination -%D \stopbuffer -%D -%D \placefigure -%D {\CMYK\ support disabled, -%D conversion to \RGB.} -%D {\setupcolors[cmyk=nee,state=start]\getbuffer[cmyk]} -%D -%D \placefigure -%D {\CMYK\ support enabled, -%D no support in \METAPOST.} -%D {\setupcolors[cmyk=ja,mpcmyk=nee,state=start]\getbuffer[cmyk]} -%D -%D \placefigure -%D {\CMYK\ support enabled, -%D no conversion to \RGB, -%D support in \METAPOST} -%D {\setupcolors[cmyk=ja,state=start]\getbuffer[cmyk]} - -\defineMPspecial{1} - {\ifMPcmykcolors - \setxvalue{\@@MPSK\gMPs1}{\gMPs2 \gMPs3 \gMPs4 \gMPs5 }% - \fi} - -\def\setMPcmyk#1 #2 #3 #4 % - {\setvalue{\@@MP01}{#1}% - \setvalue{\@@MP02}{#2}% - \setvalue{\@@MP03}{#3}% - \setvalue{\@@MP04}{#4}} + {\setxvalue{\@@MPSK\gMPs6}% + {\noexpand\handleMPhyperlink{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}}} -\defineMPspecial{2} - {\ifMPspotcolors - \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 \gMPs4 \gMPs5 }% space is essential - \checkMPspot{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}% - \fi} - -\def\setMPspot#1 #2 #3 #4 % - {\setvalue{\@@MP01}{#1}% - \setvalue{\@@MP02}{#2}% - \setvalue{\@@MP03}{#3}% - \setvalue{\@@MP04}{#4}} - -\def\checkMPspot#1#2#3#4% - {\expanded{\resolveMPspotcolor#1 #2 #3 #4}\end - \ifx\MPspotspace\MPresolvedspace - \edef\MPspotspacespec{/\MPspotspace\space}% - \doifinstringelse\MPspotspacespec\currentMPcolorspaces - \donothing\registerMPcolorspace - \fi} +\def\handleMPhyperlink#1#2#3#4#5#6% + {\global\letvalue{\@@MPSK#6}\empty + \setbox\scratchbox\hbox + {\setbox\scratchbox\null + \wd\scratchbox\dimexpr-#1\onebasepoint+#3\onebasepoint\relax + \ht\scratchbox\dimexpr-#2\onebasepoint+#4\onebasepoint\relax + \incolorfalse + \gotobox{\box\scratchbox}[#5]}% + \setbox\scratchbox\hbox + {\hskip\dimexpr\MPxoffset\onebasepoint+#1\onebasepoint\relax + \raise\dimexpr\MPyoffset\onebasepoint+#2\onebasepoint\relax + \box\scratchbox}% + \smashbox\scratchbox + \box\scratchbox} %D This special (number 50) passes positions to a tex file. %D This method uses a two||pass approach an (mis|)|used the @@ -2958,268 +779,17 @@ %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 - {\bgroup - \scratchdimen\MPllx\onebasepoint\scratchdimen-\scratchdimen - % \scratchdimen-\MPllx\onebasepoint % moet ook werken - \advance\scratchdimen\gMPs1\onebasepoint - \edef\x{\number\scratchdimen}% - \scratchdimen\gMPs2\onebasepoint - \scratchdimen-\scratchdimen - \advance\scratchdimen\MPury\onebasepoint - \edef\y{\number\scratchdimen}% - \scratchdimen\gMPs3\onebasepoint - \edef\w{\number\scratchdimen}% - \scratchdimen\gMPs4\onebasepoint - \edef\h{\number\scratchdimen}% - \dosavepositionwhd{\gMPs5}0\x\y\w\h0% - \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 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}} - -\def\PDFtransparencyspec % todo - {\ifx\MPresolvedspace\MPgrayspace - \MPresolvedcolor\space g - \MPresolvedcolor\space G% - \else\ifx\MPresolvedspace\MPrgbspace - \MPresolvedcolor\space rg - \MPresolvedcolor\space RG% - \else\ifx\MPresolvedspace\MPcmykspace - \MPresolvedcolor\space k - \MPresolvedcolor\space K% - \else\ifx\MPresolvedspace\empty\else - /\MPresolvedspace\space cs - /\MPresolvedspace\space CS - \PDFgetspotcolorspec\MPresolvedcolor - \fi\fi\fi\fi} - -\defineMPspecial{3} % rgb - {\edef\currentMPspecial{\gMPs6}% - \presetPDFtransparency{\gMPs1}{\gMPs2}% - \expanded{\resolveMPrgbcolor\gMPs3 \gMPs4 \gMPs5}\end - \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! - {\noexpand\assignMPStransparency - {\PDFtransparencyidentifier}% - {\PDFtransparencyreference}% - {\PDFtransparencyspec}}} - -\defineMPspecial{4} % cmyk - {\edef\currentMPspecial{\gMPs7}% - \presetPDFtransparency{\gMPs1}{\gMPs2}% - \expanded{\resolveMPcmykcolor\gMPs3 \gMPs4 \gMPs5 \gMPs6}\end - \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! - {\noexpand\assignMPStransparency - {\PDFtransparencyidentifier}% - {\PDFtransparencyreference}% - {\PDFtransparencyspec}}} - -\defineMPspecial{5} % spot - {\edef\currentMPspecial{\gMPs7}% - \presetPDFtransparency{\gMPs1}{\gMPs2}% - \checkMPspot{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}% - \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! - {\noexpand\assignMPStransparency - {\PDFtransparencyidentifier}% - {\PDFtransparencyreference}% - {\PDFtransparencyspec}}} - -% beware: for the moment only supported in pdftex; needs a cleanup! - -\def\registerMPcolorspace - {\doifobjectreferencefoundelse{PDFCS}\MPspotspace - {\doPDFgetobjectreference{PDFCS}\MPspotspace\PDFobjectreference - \xdef\currentMPcolorspaces - {\currentMPcolorspaces\MPspotspacespec\PDFobjectreference\space}} - \donothing} - -%D We need to add resource specifications! - -\appendtoks - \global\let\currentMPcolorspaces\empty -\to \MPstartresources - -\appendtoks - \ifx\currentMPcolorspaces\empty \else - \xdef\currentPDFresources{\currentPDFresources - /ColorSpace <<\currentMPcolorspaces>>}% - \fi -\to \MPstopresources - -%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 - -% 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 - -\appendtoks - \revokeMPtransparencyspecial -\to \MPstopresources - -\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 does a simplified reset - -\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}} + {\dosavepositionwhd + {\gMPs5}% + {0}% + {\the\dimexpr-\MPllx\onebasepoint+\gMPs1\onebasepoint\relax} + {\the\dimexpr\gMPs2\onebasepoint-\scratchdimen+\MPury\onebasepoint\relax}% + {\the\dimexpr\gMPs3\onebasepoint\relax}% + {\the\dimexpr\gMPs4\onebasepoint\relax}% + {0pt}} -\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 - {\global\let\initializePDFtransparency\relax - \presetPDFtransparency{1}{1}% - \xdef\PDFtransparencyresetidentifier{/Tr0}% - \xdef\PDFtransparencyresetreference{\the\pdflastobj\space 0 R}} - - \def\presetPDFtransparency#1#2% - {\initializePDFtransparency - \@EA\ifx\csname\@@MPSTO#1:#2\endcsname\relax - \global\advance\PDFcurrenttransparency \plusone - \immediate\pdfobj{\PDFtransparencydictionary{#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}} - - \def\PDFtransparencydictionary#1#2#3% type fraction extras - {<>} - -\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. - -%D A few auxiliary macros: +%D A few auxiliary macros. This will move to colo-ini. \def\MPgrayspace{DeviceGray} \def\MPrgbspace {DeviceRGB} @@ -3229,72 +799,52 @@ \def\MPcmykBlack{0 0 0 0} \def\MPcmykWhite{0 0 0 1} -\ifCONTEXT - - \def\startMPcolorresolve - {\bgroup - \def\dostartgraycolormode##1% - {\global\let\MPresolvedspace\MPgrayspace - \xdef\MPresolvedcolor{##1}}% - \def\dostartrgbcolormode ##1##2##3% - {\global\let\MPresolvedspace\MPrgbspace - \xdef\MPresolvedcolor{##1 ##2 ##3}}% - \def\dostartcmykcolormode##1##2##3##4% - {\global\let\MPresolvedspace\MPcmykspace - \xdef\MPresolvedcolor{##1 ##2 ##3 ##4}}% - \def\dostartspotcolormode##1##2% - {\global\let\MPspotspace\empty - \xdef\MPresolvedspace{##1}% - \xdef\MPresolvedcolor{##2}% - \global\let\MPspotspace\MPresolvedspace}% signal - \dostartgraycolormode\!!zerocount} % kind of hackery initialization - - \let\stopMPcolorresolve\egroup - - \def\resolveMPrgbcolor#1 #2 #3\end - {\startMPcolorresolve - \execcolorR#1:#2:#3:0:0\od - \stopMPcolorresolve} - - \def\resolveMPcmykcolor#1 #2 #3 #4\end - {\startMPcolorresolve - \execcolorC#1:#2:#3:#4:0:0\od - \stopMPcolorresolve} - - \def\resolveMPgraycolor#1\end - {\startMPcolorresolve - \execcolorS#1:0:0\od - \stopMPcolorresolve} - - \def\resolveMPspotcolor#1 #2 #3 #4\end - {\startMPcolorresolve - \ifnum#2>\plusone - \checkmultitonecolor{#1}% - \fi - \execcolorP#1:#2:#3:#4:0:0\od - \stopMPcolorresolve} - -\else - - \def\resolveMPspotcolor#1 #2\end - {\global\let\MPresolvedspace\MPgrayspace - \xdef\MPresolvedcolor{0}} - - \def\resolveMPrgbcolor#1 #2 #3\end - {\global\let\MPresolvedspace\MPrgbspace - \xdef\MPresolvedcolor{#1 #2 #3}} - - \def\resolveMPcmykcolor#1 #2 #3 #4\end - {\global\let\MPresolvedspace\MPcmykspace - \xdef\MPresolvedcolor{#1 #2 #3 #4}} - - \def\resolveMPgraycolor#1\end - {\global\let\MPresolvedspace\MPgrayspace - \xdef\MPresolvedcolor{#1}} % should be inverted - -\fi - -%D Begin of soon obsolete code. +\def\startMPcolorresolve + {\bgroup + \def\dostartgraycolormode##1% + {\global\let\MPresolvedspace\MPgrayspace + \xdef\MPresolvedcolor{##1}}% + \def\dostartrgbcolormode ##1##2##3% + {\global\let\MPresolvedspace\MPrgbspace + \xdef\MPresolvedcolor{##1 ##2 ##3}}% + \def\dostartcmykcolormode##1##2##3##4% + {\global\let\MPresolvedspace\MPcmykspace + \xdef\MPresolvedcolor{##1 ##2 ##3 ##4}}% + \def\dostartspotcolormode##1##2% + {\global\let\MPspotspace\empty + \xdef\MPresolvedspace{##1}% + \xdef\MPresolvedcolor{##2}% + \global\let\MPspotspace\MPresolvedspace}% signal + \dostartgraycolormode\!!zerocount} % kind of hackery initialization + +\let\stopMPcolorresolve\egroup + +\def\resolveMPrgbcolor#1#2#3\to#4% + {\startMPcolorresolve + \execcolorR#1:#2:#3:0:0\od + \stopMPcolorresolve + \let#4\MPresolvedcolor} + +\def\resolveMPcmykcolor#1#2#3#4\to#5% + {\startMPcolorresolve + \execcolorC#1:#2:#3:#4:0:0\od + \stopMPcolorresolve + \let#5\MPresolvedcolor} + +\def\resolveMPgraycolor#1\end\to#2% + {\startMPcolorresolve + \execcolorS#1:0:0\od + \stopMPcolorresolve + \let#2\MPresolvedcolor} + +\def\resolveMPspotcolor#1#2#3#4\end\to#5% + {\startMPcolorresolve + \ifnum#2>\plusone + \checkmultitonecolor{#1}% + \fi + \execcolorP#1:#2:#3:#4:0:0\od + \stopMPcolorresolve + \let#5\MPresolvedcolor} %D \macros %D {dogetPDFmediabox} @@ -3338,10 +888,10 @@ \doprocessfile\scratchread{#1}\doprocessPDFline \egroup \ifx\PDFxoffset\undefined - #2\zeropoint - #3\zeropoint - #4\zeropoint - #5\zeropoint + #2=\zeropoint + #3=\zeropoint + #4=\zeropoint + #5=\zeropoint \else #2=\PDFxoffset\onebasepoint #3=\PDFyoffset\onebasepoint @@ -3362,12 +912,53 @@ \global\let\PDFyoffset\PDFyoffset} \def\setPDFmediabox#1[#2 #3 #4 #5]#6\done - {\dimen2=#2bp\dimen2=-\dimen2 % \dimen2=-#2bp also works since tex handles -- - \dimen4=#3bp\dimen4=-\dimen4 % \dimen4=-#3bp also works since tex handles -- - \dimen6=#4bp\advance\dimen6 \dimen2 - \dimen8=#5bp\advance\dimen8 \dimen4 + {\dimen2=#2\onebasepoint\dimen2=-\dimen2 % \dimen2=-#2\onebasepoint also works since tex handles -- + \dimen4=#3\onebasepoint\dimen4=-\dimen4 % \dimen4=-#3\onebasepoint also works since tex handles -- + \dimen6=#4\onebasepoint\advance\dimen6 \dimen2 + \dimen8=#5\onebasepoint\advance\dimen8 \dimen4 \setPDFboundingbox{\dimen2}{\dimen4}{\dimen6}{\dimen8}\PDFxscale\PDFyscale} %D End of soon obsolete code. +%D The plugins: + +\startMPinitializations + mp_shade_version := 2 ; +\stopMPinitializations + +\loadmarkfile{meta-pdf} + +%D Test code: + +% \startMPcode +% fill fullcircle scaled 3cm withcolor red ; +% fill fullcircle scaled 2cm withcolor green ; +% fill fullcircle scaled 1cm withcolor blue ; +% currentpicture := currentpicture shifted (-4cm,0) ; +% fill fullcircle scaled 3cm withcolor cmyk(0,0,1,0) ; +% fill fullcircle scaled 2cm withcolor cmyk(0,1,0,0) ; +% fill fullcircle scaled 1cm withcolor cmyk(0,0,1,0) ; +% currentpicture := currentpicture shifted (-4cm,0) ; +% draw fullcircle scaled 3cm dashed evenly ; +% draw fullcircle scaled 2cm dashed withdots ; +% draw origin withpen pencircle scaled 3mm; +% currentpicture := currentpicture shifted (-4cm,0) ; +% fill fullcircle scaled 2cm shifted (-.5cm,+.5cm) withcolor transparent(1,.5,red); +% fill fullcircle scaled 2cm shifted (-.5cm,-.5cm) withcolor transparent(1,.5,red); +% fill fullcircle scaled 2cm shifted (+.5cm,+.5cm) withcolor transparent(1,.5,green); +% fill fullcircle scaled 2cm shifted (+.5cm,-.5cm) withcolor transparent(1,.5,cmyk(1,0,1,.5)); +% currentpicture := currentpicture shifted (12cm,-4cm) ; +% draw "o e p s" infont defaultfont scaled 2 shifted (-1cm,0) ; +% currentpicture := currentpicture shifted (-4cm,0) ; +% % bug: shift +% draw fullcircle scaled 3cm withpen pencircle yscaled 3mm xscaled 2mm rotated 30 ; +% draw fullcircle scaled 2cm withpen pencircle yscaled 3mm xscaled 2mm rotated 20 withcolor red ; +% filldraw fullcircle scaled 1cm withpen pencircle yscaled 3mm xscaled 2mm rotated 10 withcolor green ; +% currentpicture := currentpicture shifted (-4cm,0) ; +% % shade cannot handle shift +% circular_shade(fullcircle scaled 3cm,0,.2red,.9green) ; +% circular_shade(fullcircle scaled 3cm shifted(+4cm,0),0,cmyk(1,0,0,0),cmyk(0,1,0,0)) ; +% filldraw boundingbox currentpicture enlarged -3cm withpen pencircle scaled 1pt withcolor .5white ; +% \stopMPcode + \protect \endinput diff --git a/tex/context/base/meta-tex.tex b/tex/context/base/meta-tex.tex index c49021d2e..f1faa300d 100644 --- a/tex/context/base/meta-tex.tex +++ b/tex/context/base/meta-tex.tex @@ -27,11 +27,15 @@ \def\openTeXtexts {\immediate\openout \TeXtextwrite\currentTeXtext.mpb\relax} \def\closeTeXtexts{\immediate\closeout\TeXtextwrite} -\def\currentTeXtext{\jobname-mpgraph} +\def\currentTeXtext {\jobname-mpgraph} +\def\currentTeXstack{mpgtxt} -\initializeboxstack\currentTeXtext +\initializeboxstack\currentTeXstack \newtoks\collectedmptexts +\newtoks\everyTeXtexts + +\chardef\TeXtextsmode\zerocount % no inheritance \long\def\startTeXtexts#1\stopTeXtexts {\global\collectedmptexts\expandafter{\the\collectedmptexts#1}} @@ -39,10 +43,16 @@ \def\dostartTeXtexts {\global\setfalse\TeXtextdone \startnointerference - \the\everyMPTEXgraphic \openTeXtexts + \ifcase\TeXtextsmode + % normally there is no need for this (faster anyway) + \or + \scantokens\expandafter{\the\everyMPTEXgraphic}% brr + \or + \the\everyTeXtexts + \fi \ifrunMPgraphics - \initializeboxstack\currentTeXtext + \initializeboxstack\currentTeXstack \else \global\let\openTeXtexts\relax \global\let\finishTeXtexts\closeTeXtexts @@ -50,7 +60,7 @@ \def\dostopTeXtexts {\ifrunMPgraphics - \closeTeXtexts + \closeTeXtexts \fi \stopnointerference} @@ -67,25 +77,47 @@ % {\setnormalcatcodes} % {\global\settrue\TeXtextdone % \immediate\write\TeXtextwrite{savetxt(#1,\the\wd\nextbox,\the\ht\nextbox,\the\dp\nextbox);}% -% \savebox\currentTeXtext{#1}{\box\nextbox}} +% \savebox\currentTeXstack{#1}{\box\nextbox}} % \hbox} \long\def\TeXtext {\dosingleempty\doTeXtext} +% currently, colors in the converter don't use the color stack +% +% 0 = nothing, withcolor works ok, but nested colors fail +% 1 = local color stack ok +% 2 = obey color stack (not yet supported) + +\chardef\TeXtextcolormode\plusone + +\def\definetextext[#1]#2{\setvalue{textext@@#1}{#2}} + +% \definetextext[framed]{\framed} +% +% \startMPcode +% draw \sometxt[framed]{black} rotated 45 ; +% \stopMPcode + \long\def\doTeXtext[#1]#2#3% {\begingroup \setbox\nextbox\hbox {\setnormalcatcodes - \newlinechar=`\^^M + \endlinechar\minusone \everyeof\emptytoks - %\def\ascii{#3}% - %\scantokens\expandafter{\ascii}}% - \scantokens{#3}}% + %\def\ascii{#3}\scantokens\expandafter{\ascii}}% + \ifcase\TeXtextcolormode + \scantokens{\executeifdefined{textext@@#1}\firstofoneargument{#3}}% + \else + \localcolortrue + \startcurrentcolor + \scantokens{\executeifdefined{textext@@#1}\firstofoneargument{#3}}% + \stopcurrentcolor + \fi}% \global\settrue\TeXtextdone \edef\currenttextxt{\number#2}% \executeifdefined{textext::#1}{\getvalue{textext::depth}}% - \savebox\currentTeXtext\currenttextxt{\box\nextbox}% + \savebox\currentTeXstack\currenttextxt{\box\nextbox}% \endgroup} \setvalue{textext::depth}{\immediate\write\TeXtextwrite{savetxt(\currenttextxt,\the\nextboxwd,\the\nextboxht,\the\nextboxdp) shifted (0,-\the\nextboxdp);}} @@ -105,28 +137,24 @@ % this took a while to figure out - % \def\getTeXtext - % {\localMPtxtfont - % \setbox\mptextbox\hbox{\foundbox\currentTeXtext{\number\nofTeXtexts}}% - % \setbox\scratchbox\hbox{\MPtextdata}% - % \edef\mpwd{\the\dimexpr\MPtextsize\dimexpr\wd\scratchbox/10\relax\relax}% - % \edef\mpht{\the\dimexpr\MPtextsize\dimexpr\ht\scratchbox/10\relax\relax}% - % \setbox\mptextbox\hbox{\raise\dp\mptextbox\box\mptextbox}% - % \dp\mptextbox\zeropoint - % \scale[\c!width=\mpwd,\c!height=\mpht]{\box\mptextbox}}% + \let\MPtextdata\empty \def\getTeXtext - {\localMPtxtfont - \setbox\mptextbox\hbox{\foundbox\currentTeXtext{\number\nofTeXtexts}}% - \setbox\scratchbox\hbox{\MPtextdata}% - \edef\mpwd{\the\dimexpr\MPtextsize\dimexpr\wd\scratchbox/10\relax\relax}% - \edef\mpht{\the\dimexpr\MPtextsize\dimexpr\ht\scratchbox/10\relax\relax}% - \setbox\mptextbox\hbox{\raise\dp\mptextbox\box\mptextbox}% - \dp\mptextbox\zeropoint - \scale[\c!width=\mpwd,\c!height=\mpht]{\box\mptextbox}} + {\ifx\MPtextdata\empty\else + \localMPtxtfont + \setbox\mptextbox\hbox{\foundbox\currentTeXstack{\number\nofTeXtexts}}% + \setbox\scratchbox\hbox{\MPtextdata}% set in meta-pdf.mkii/mkiv + \edef\mpwd{\the\dimexpr\MPtextsize\dimexpr\wd\scratchbox/10\relax\relax}% + \edef\mpht{\the\dimexpr\MPtextsize\dimexpr\ht\scratchbox/10\relax\relax}% + \setbox\mptextbox\hbox{\raise\dp\mptextbox\box\mptextbox}% + \dp\mptextbox\zeropoint + \scale[\c!width=\mpwd,\c!height=\mpht]{\box\mptextbox}% + \fi} \fi +\let\nofTeXtexts\!!zerocount + \setvalue{handleMPtext00001}% only height in tag (00001) {\setbox\scratchbox\hbox {\obeyMPspecials @@ -146,14 +174,6 @@ string txtpref ; txtpref := "00001::::" ; \stopMPextensions -% \long\def\filtersometxt#1\sometxt#2#3#4% -% {\ifx#3\empty -% \else -% \increment\txtcounter -% \TeXtext\txtcounter{#2}% -% \expandafter\filtersometxt -% \fi#3#4} - \long\def\dodofiltersometxt#1#2#3% {\ifx#2\empty \else @@ -170,6 +190,8 @@ \long\def\filtersometxt#1\sometxt {\doifnextcharelse[\redofiltersometxt\dodofiltersometxt} +% cleaner in mkiv +% % \filtersometxt abc\sometxt{def};hij\sometxt{klm};\sometxt{}\empty\relax \long\def\flushTeXtexts#1% @@ -204,3 +226,121 @@ \writeMPgraphic{#1}} % potential optimization: pass \ascii \protect \endinput + +% torture test (will move) + +\startMPpage + numeric a_b_c ; + picture p ; pickup pencircle scaled .1pt ; + p := \sometxt{Just a \color[blue]{simple} example text.} ; + p := image(draw p; draw boundingbox p withcolor red; ) ; + p := p rotatedaround(center p, 360*(5/100)) ; + draw p ; draw boundingbox p withcolor blue ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor .5white ; + setbounds currentpicture to boundingbox currentpicture enlarged 10pt ; +\stopMPpage + +\startMPpage + picture p ; + p := \sometxt{\framed[width=fit,align=middle]{\input tufte\relax}} ; + draw p rotatedaround(center p, 30) ; +\stopMPpage + +\startMPpage + picture p ; + p := \sometxt{\framed[width=fit,align=middle]{\input tufte\relax}} ; + draw p slanted .5 ; +\stopMPpage + +\dorecurse{10} { + \startTeXtexts + \TeXtext{\recurselevel}{\ruledhbox{I must be {\green crazy} to implement this}} + \stopTeXtexts + \startMPpage + picture p ; pickup pencircle scaled .1pt ; + numeric i ; i := \recurselevel ; + p := sometxt(i) ; + p := p rotatedaround(center p, 360*(i*5/100)) ; + draw p ; draw boundingbox p withcolor blue ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor .5white ; + \stopMPpage +} + +\startTeXtexts + \dorecurse{100}{\TeXtext{\recurselevel}{\ruledhbox{\strut interesting \recurselevel}}} +\stopTeXtexts + +\startMPpage + picture p ; pickup pencircle scaled .1pt ; + for i = 1 upto 100: + p := sometxt(i) ; + p := p rotatedaround(center p, 360*(i*5/100)) ; + draw p ; draw boundingbox p withcolor blue ; + endfor ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor .5white ; +\stopMPpage + +\startTeXtexts + \dorecurse{100}{\TeXtext{\recurselevel}{\ruledhbox{\strut interesting \recurselevel}}} +\stopTeXtexts + +\startMPpage + picture p ; pickup pencircle scaled .1pt ; + for i = 1 step 5 until 100 : + p := sometxt(i) ; + p := p rotatedaround(center p, 360*(i/100)) ; + draw p ; draw boundingbox p withcolor blue ; + endfor ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor .5white ; +\stopMPpage + +\startTeXtexts + \dorecurse{20}{\TeXtext{\recurselevel}{\externalfigure[t:/sources/cow.pdf][width=1cm]}} +\stopTeXtexts + +\startMPpage + picture p ; pickup pencircle scaled .1pt ; + for i = 1 upto 20 : + p := sometxt(i) ; + p := p shifted (2.5cm,0) rotated (360*(i/20)) ; + draw p ; draw boundingbox p withcolor blue ; + endfor ; + currentpicture := currentpicture scaled 10 ; + draw boundingbox currentpicture withcolor .5white ; +\stopMPpage + +\startTeXtexts + \dorecurse{200}{\TeXtext{\recurselevel}{\ruledhbox{\strut I must be {\green crazy} \recurselevel}}} +\stopTeXtexts + +\startMPpage + picture p ; pickup pencircle scaled .1pt ; + numeric i ; i := 100 ; + p := sometxt(i) ; + p := p rotatedaround(center p, 360*(i*36/100)) ; + draw p ; draw boundingbox p withcolor blue ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor .5white ; +\stopMPpage + +\dorecurse{10}{ + \startTeXtexts + \dorecurse{200}{\TeXtext{\recurselevel}{\ruledhbox{\strut I must be {\green crazy} \recurselevel}}} + \stopTeXtexts + \startMPpage + picture p ; pickup pencircle scaled .1pt ; + j := 10*\recurselevel-9; + k := 10*\recurselevel; + for i = j upto k: + p := sometxt(i) ; + p := p rotatedaround(center p, 360*(i/100)) ; + draw p ; draw boundingbox p withcolor blue ; + endfor ; + currentpicture := currentpicture scaled 20 ; + draw boundingbox currentpicture withcolor red ; + \stopMPpage +} diff --git a/tex/context/base/meta-txt.tex b/tex/context/base/meta-txt.tex index e68175635..de4239e85 100644 --- a/tex/context/base/meta-txt.tex +++ b/tex/context/base/meta-txt.tex @@ -53,14 +53,14 @@ \setuptolerance[\v!verytolerant,\v!stretch]% \!!counta=0 \!!toksa=\emptytoks - \def\docommando##1% + \def\docommand##1% {\setbox\scratchbox=\hbox{\useMPgraphic{##1}}% \global\chardef\parfirst=0 \getMPdata % \readlocfile{\MPdatafile}{}{}% \setshapecharacteristics \advance\!!counta by \parlines \expandafter\appendtoks\the\partoks\to\!!toksa}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \global\parseriestrue \xdef\totalparlines{\the\!!counta}% \global\partoks\!!toksa @@ -79,7 +79,7 @@ \getshapecharacteristics} \def\adaptparshape% - {\def\docommando##1% + {\def\docommand##1% {\ifcase\!!counta \expandafter\appendtoks\space##1 \to\!!toksa \else @@ -89,7 +89,7 @@ \doglobal\decrement(\totalparlines,\!!counta)% \multiply\!!counta \plustwo \!!toksa\emptytoks - \expanded{\processseparatedlist[\the\partoks][\space]}\docommando + \expanded{\processseparatedlist[\the\partoks][\space]}\docommand \global\partoks\!!toksa %\ifx\partoks\emptytoks\else % safeguard \expanded{\parshape\totalparlines\the\partoks}% diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex index 0582c3472..599fd61d2 100644 --- a/tex/context/base/mult-com.tex +++ b/tex/context/base/mult-com.tex @@ -1004,6 +1004,14 @@ stelletexttexteein nastavtexttexty impostatestotesti seteazatextetext regletextestexte + settextcontent: steltekstinhoudin settextcontent + settext settextcontent + settext settextcontent + settext + resettext: resettekstinhoud resettextcontent + resettextcontent resettextcontent + resettextcontent resettextcontent + resettextcontent definetext: definieertekst definetext definieretext definujtext definiscitesto definestetext @@ -2518,7 +2526,7 @@ determineregistercharacteristics: bepaalregisterkenmerken determineregi leftedgewidth: linkerrandbreedte leftedgewidth breitelinkerrand sirkalevehookraje ampiezzabordosinistro latimecoltstanga - largeurbrodgauche + largeurbordgauche rightedgewidth: rechterrandbreedte rightedgewidth breiterechterrand sirkapravehookraje ampiezzabordodestro latimecoltdreapta diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index 07bbf3994..de24230ae 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -363,6 +363,14 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub center center center center center + flushouter: lijnbuiten flushouter + flushouter flushouter + flushouter flushouter + flushouter + flushinner: lijnbinnen flushinner + flushinner flushinner + flushinner flushinner + flushinner \stopvariables @@ -399,6 +407,10 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub formel rovnice formula formula formule + subformula: subformule subformula + subformel subrovnice + subformula subformula + subformule formulae: formules formulae formeln rovnice formule formule @@ -1152,7 +1164,7 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub leftedge: linkerrand leftedge linkekante levahrana bordosinistro bordurastanga - brodgauche + bordgauche leftedgedistance: linkerrandafstand leftedgedistance linkerkantenabstand vzdalenostlevehrany distanzabordosinistro distantabordurastanga @@ -2540,6 +2552,10 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub neu novy nuovo nou nouveau + old: oud old + old old + old old + old MONTH: MAAND MONTH MONAT MESIC MESE LUNA @@ -2552,6 +2568,10 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub mar mar mar mar mar + item: som item + pos polozka + elemento element + element marking: markering marking beschriftung znaceni marcatura marcaje @@ -3169,6 +3189,15 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub descrizione descriere description + lefthanging: linkshangend lefthanging + lefthanging lefthanging + lefthanging lefthanging + lefthanging + righthanging: rechtshangend righthanging + righthanging righthanging + righthanging righthanging + righthanging + \stopvariables \startconstants dutch english diff --git a/tex/context/base/mult-fst.tex b/tex/context/base/mult-fst.tex new file mode 100644 index 000000000..af915e000 --- /dev/null +++ b/tex/context/base/mult-fst.tex @@ -0,0 +1,30 @@ +%D \module +%D [ file=mult-fst, +%D version=2006.08.16, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=Speed Up, +%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. + +% And so, after a few years of keeping this potentially dangerous +% speedup in cont-exp, we now move it to the kernel: the next +% patch is 30\% faster on main interface (seconds) (9->7 sec on +% 1 million calls). Another speed up is still under testing. + +\unprotect + +\startinterface english + + \def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} + \def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} + \def\dosetvalue #1#2{\@EA\def \csname#1#2\endcsname} + \def\docopyvalue#1#2#3{\@EA\def \csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} + +\stopinterface + +\protect \endinput diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex index 69ef0a6ac..444edcfee 100644 --- a/tex/context/base/mult-ini.tex +++ b/tex/context/base/mult-ini.tex @@ -105,9 +105,34 @@ \def\s!complex {complex} \def\s!start {start} \def\s!simple {simple} \def\s!stop {stop} -\def\!!width {width} \def\!!plus {plus} -\def\!!height {height} \def\!!minus {minus} -\def\!!depth {depth} \def\!!to {to} +%D The word \type{height} takes 6~token memory cells. The +%D control sequence \type{\height} on the other hand uses only +%D one. Knowing this, we can improve the performance of \TEX, +%D both is terms of speed and memory usage, by using control +%D sequences instead of the words written in full. +%D +%D Where in the \ASCII\ file the second lines takes nine extra +%D characters, \TEX\ saves us 13~tokens. +%D +%D \starttyping +%D \hrule width 10pt height 2pt depth 1pt +%D \hrule \!!width 10pt \!!height 2pt \!!depth 1pt +%D \stoptyping +%D +%D One condition is that we have defined \type{\!!height}, +%D \type{\!!width} and \type{\!!depth} as respectively +%D \type{height}, \type{width} and \type{depth}. Using this +%D scheme therefore only makes sense when a token sequence is +%D used more than once. Savings like this should of course be +%D implemented in english, just because \TEX\ is english. + +\def\!!width {width} +\def\!!height {height} +\def\!!depth {depth} +\def\!!plus {plus} +\def\!!minus {minus} +\def\!!fill {fill} +\def\!!to {to} %D \macros %D {defineinterfaceconstant, @@ -219,17 +244,17 @@ \def\defaultinterface{english} \def\selectinterface - {\def\docommando##1##2% + {\def\docommand##1##2% {\bgroup \endlinechar\minusone \global\read16 to ##1 \egroup \doifnothing\currentinterface{\let##1=##2}% \doifundefined{\s!prefix!##1}{\let##1=##2}}% - \docommando\currentinterface\defaultinterface + \docommand\currentinterface\defaultinterface \writestatus{interface}{defining \currentinterface\space interface}% \writeline - \docommando\currentresponses\currentinterface + \docommand\currentresponses\currentinterface \writestatus{interface}{using \currentresponses\space messages}% \writeline \let\selectinterface\relax} @@ -423,6 +448,8 @@ \expandafter\addinterfacemessage \fi} +\let\stopmessages\undefined % for dep checker + \def\startmessages #1 library: #2 {\definemessageconstant{#2}% handy for modules \bgroup @@ -1525,15 +1552,14 @@ %D Out of convenience we define the banners here. -\edef\contextbanner +\def\contextbanner {ConTeXt \space - ver: \noexpand \contextversion \space \space - fmt: \noexpand \formatversion \space \space - int: \noexpand \currentinterface \space \space - mes: \noexpand \currentresponses} + ver: \contextversion \space \contextmark \space \space + fmt: \formatversion \space \space + int: \currentinterface/\currentresponses} \def\showcontextbanner - {\writeline\writestring{\contextbanner}\writeline} + {\writeline\writebanner{\contextbanner}\writeline} \edef\formatversion {\ifx\normalyear \undefined\the\year \else\the\normalyear \fi.% @@ -1541,11 +1567,11 @@ \ifx\normalday \undefined\the\day \else\the\normalday \fi} \ifx\contextversion\undefined - \def\contextversion{unknown} + \def\contextversion {unknown} \def\contextversionnumber{0} \else \def\contextversionnumber#1.#2.#3 #4:#5\relax{#1\ifnum#2<10 0\fi#2\ifnum#3<10 0\fi#3 #4:#5} - \edef\contextversionnumber{\expandafter\contextversionnumber\contextversion\relax} + \edef\contextversionnumber{\expandafter\contextversionnumber\contextversion\relax\space\contextmark} \fi \ifx\undefined\normaldump diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 716c6d6bf..1e0cb5f3d 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -90,6 +90,7 @@ \definemessageconstant {colors} \definemessageconstant {columns} \definemessageconstant {encodings} +\definemessageconstant {regimes} \definemessageconstant {figures} \definemessageconstant {files} \definemessageconstant {floatblocks} @@ -108,38 +109,8 @@ \definemessageconstant {verbatims} \definemessageconstant {versions} - -%D The word \type{height} takes 6~token memory cells. The -%D control sequence \type{\height} on the other hand uses only -%D one. Knowing this, we can improve the performance of \TEX, -%D both is terms of speed and memory usage, by using control -%D sequences instead of the words written in full. -%D -%D Where in the \ASCII\ file the second lines takes nine extra -%D characters, \TEX\ saves us 13~tokens. -%D -%D \starttyping -%D \hrule width 10pt height 2pt depth 1pt -%D \hrule \!!width 10pt \!!height 2pt \!!depth 1pt -%D \stoptyping -%D -%D One condition is that we have defined \type{\!!height}, -%D \type{\!!width} and \type{\!!depth} as respectively -%D \type{height}, \type{width} and \type{depth}. Using this -%D scheme therefore only makes sense when a token sequence is -%D used more than once. Savings like this should of course be -%D implemented in english, just because \TEX\ is english. - -\def\!!width {width} -\def\!!height {height} -\def\!!depth {depth} -\def\!!plus {plus} -\def\!!minus {minus} -\def\!!fill {fill} -\def\!!to {to} - -%D The same goes for some \CONTEXT\ constants, used in the -%D definition of private commands: +%D Net come some \CONTEXT\ constants, used in the definition +%D of private commands: \definesystemconstant {next} \definesystemconstant {pickup} @@ -351,7 +322,6 @@ \def\!!twelvepoint {12pt} \def\!!fourteenpointfour {14.4pt} -\newdimen \zeropoint \zeropoint = 0pt \newdimen \onepoint \onepoint = 1pt \newdimen \onebasepoint \onebasepoint = 1bp \chardef \scaledpoint = 1 @@ -451,6 +421,7 @@ \definesystemvariable {fi} % FIle \definesystemvariable {fl} % Floats \definesystemvariable {fm} % ForMules +\definesystemvariable {fn} % subformulas \definesystemvariable {fp} % FilegroeP \definesystemvariable {fr} % ForM \definesystemvariable {fs} % FileSynonym @@ -584,6 +555,7 @@ \definesystemvariable {uc} % Unicode \definesystemvariable {ui} % UItvoer \definesystemvariable {ur} % URl +\definesystemvariable {up} % Utility Program \definesystemvariable {ve} % VErsie \definesystemvariable {vn} % VoetNoten \definesystemvariable {vt} % VerTical @@ -644,6 +616,10 @@ \defineinterfacevariable {c} {c} \defineinterfacevariable {d} {d} +%D Special purpose variables: + +\def\v!oddeven#1{\ifodd#1\v!odd\else\v!even\fi} + %D The names of files and their extensions are fixed. %D \CONTEXT\ uses as less files as possible. Utility files can %D be recognized by the first two characters of the extension: diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex index f31e3ad2d..6e477903c 100644 --- a/tex/context/base/page-app.tex +++ b/tex/context/base/page-app.tex @@ -115,6 +115,28 @@ \c!height=\v!fit, \c!frame=\v!off] +%D For Mojca: +%D +%D \starttyping +%D \startTEXstream \chapter{Bla} Hello world!\crlf Hello world! \stopTEXstream +%D \startTEXpage \chapter{Bla} Hello world!\crlf Hello world! \stopTEXpage +%D \stoptyping +%D +%D maybe I should support stream=yes in framed. + +\def\startTEXstream + {\dosingleempty\dostartTEXstream} + +\def\dostartTEXstream[#1]% + {\page + \defineoutputstream[tex]% + \enableoutputstream[tex]% + \def\stopTEXstream + {\disableoutputstream + \startTEXpage + \outputstreamunvbox[tex]% + \stopTEXpage}} + %D Application pages (for an example, see \type {m-pstric}): \def\@@texapp{texapp} @@ -171,4 +193,30 @@ \box\scratchbox \egroup} +%D \macros +%D {startpagefigure} +%D +%D \starttyping +%D \starttext \pagefigure[two.1] \stoptext +%D \stoptyping + +\def\startpagefigure + {\dodoubleempty\dostartpagefigure} + +\def\dostartpagefigure[#1][#2]% + {\bgroup + \getparameters[\??ex][\c!offset=\v!overlay,#2]% + \startTEXpage[\c!offset=\@@exoffset]% + \externalfigure[#1][#2]\ignorespaces} % so we can put some text below the graphic + +\def\stoppagefigure + {\stopTEXpage + \egroup} + +\def\pagefigure + {\dodoubleempty\dopagefigure} + +\def\dopagefigure[#1][#2]% + {\dostartpagefigure[#1][#2]\stoppagefigure} + \protect \endinput diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex index 2054be5fb..886a42837 100644 --- a/tex/context/base/page-bck.tex +++ b/tex/context/base/page-bck.tex @@ -159,13 +159,10 @@ \def\addpagebackground#1% {\doifbothsidesoverruled - \addsomebackground\v!rightpage#1\paperwidth\paperheight - \orsideone - \addsomebackground\v!rightpage#1\paperwidth\paperheight - \orsidetwo - \addsomebackground\v!leftpage #1\paperwidth\paperheight - \od - \addsomebackground\v!page #1\paperwidth\paperheight} + {\addsomebackground\v!rightpage#1\paperwidth\paperheight} + {\addsomebackground\v!rightpage#1\paperwidth\paperheight} + {\addsomebackground\v!leftpage #1\paperwidth\paperheight}% + \addsomebackground\v!page #1\paperwidth\paperheight} %D Then there are the 25 areas that make up the layout: {\em %D top, header, text, footer, bottom} times {\em left edge, @@ -198,19 +195,6 @@ \fi \addsomebackground\v!text#1\makeupwidth\textheight} -% \def\addtextbackground#1% -% {\ifconditional\hiddenbackgroundenabled -% \addsomebackground\v!verborgen #1\zetbreedte\teksthoogte % mine ! -% \fi -% \doifbothsidesoverruled -% \addsomebackground\v!rechtertekst#1\zetbreedte\teksthoogte -% \orsideone -% \addsomebackground\v!rechtertekst#1\zetbreedte\teksthoogte -% \orsidetwo -% \addsomebackground\v!linkertekst #1\zetbreedte\teksthoogte -% \od -% \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. @@ -218,9 +202,9 @@ \newdimen\pageoffset % bleed \newdimen\pagedepth -\let\pagebackgroundhoffset = \!!zeropoint -\let\pagebackgroundvoffset = \!!zeropoint -\let\pagebackgrounddepth = \!!zeropoint +\let\pagebackgroundhoffset\!!zeropoint +\let\pagebackgroundvoffset\!!zeropoint +\let\pagebackgrounddepth \!!zeropoint % \def\setbackgroundboxes % {\showmessage\m!layouts8\empty @@ -235,8 +219,8 @@ %D background at the same time since something may have %D changed halfway a page. -\chardef\newrightbackground0 -\chardef\newleftbackground 0 +\chardef\newrightbackground\zerocount +\chardef\newleftbackground \zerocount \def\recalculatebackgrounds {\global\newbackgroundtrue} @@ -249,26 +233,22 @@ \global\setbox\rightbackground\emptybox \fi \doifbothsides - \ifcase\newleftbackground \else - % \showmessage\m!layouts8\empty - \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount - \global\chardef\newrightbackground\zerocount - \fi - \orsideone - \ifcase\newleftbackground \else - % \showmessage\m!layouts8\empty - \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount - %\global\chardef\newrightbackground\zerocount - \fi - \orsidetwo - \ifcase\newrightbackground \else - % \showmessage\m!layouts8\empty - \setbackgroundbox\rightbackground\doswapmargins - \global\chardef\newrightbackground\zerocount - \fi - \od + {\ifcase\newleftbackground \else + % \showmessage\m!layouts8\empty + \setbackgroundbox\leftbackground\relax + \global\chardef\newleftbackground\zerocount + \global\chardef\newrightbackground\zerocount + \fi} + {\ifcase\newleftbackground \else + % \showmessage\m!layouts8\empty + \setbackgroundbox\leftbackground\relax + \global\chardef\newleftbackground\zerocount + \fi} + {\ifcase\newrightbackground \else + % \showmessage\m!layouts8\empty + \setbackgroundbox\rightbackground\doswapmargins + \global\chardef\newrightbackground\zerocount + \fi}% \ifx\@@mastate\v!repeat\else\global\newbackgroundfalse\fi} \def\addmainbackground#1% todo: dimension spec @@ -315,7 +295,7 @@ \ifconditional\swapbackgroundmargins \doifmarginswapelse \donothing {\swapmacros\v!rightmargin\v!leftmargin - \swapmacros\v!rightedge \v!leftedge}% + \swapmacros\v!rightedge \v!leftedge}% \fi \calculatereducedvsizes \offinterlineskip @@ -361,8 +341,8 @@ \doifvaluesomething{\??ma#3#4\c!setups}{\setups[\getvalue{\??ma#3#4\c!setups}]}% should not produce funny spaces ! \fastlocalframed [\??ma#3#4] - [\c!component=#3-#4,\c!width=#1,\c!height=#2,\c!offset=\v!overlay,\c!setups=] - {\getvalue{\??ma#3#4\c!command}}% {\hsize=#1\vsize=#2....} + [\c!component=#3-#4,\c!offset=\v!overlay,\c!setups=] + {\vbox to #2{\vss\hbox to#1{\hss\getvalue{\??ma#3#4\c!command}\hss}\vss}}% \else \hskip#1% \fi @@ -395,21 +375,20 @@ \def\dosetupbackgrounds[#1][#2][#3]% {\ifthirdargument \global\somebackgroundtrue - \def\docommando##1% + \def\docommand##1% {\doifinsetelse{##1}{\v!paper,\v!page,\v!leftpage,\v!rightpage} {\getparameters[\??ma##1][#3]\checkbackground{##1}} - {\def\dodocommando####1% + {\def\dodocommand####1% {\getparameters[\??ma##1####1][#3]\checkbackground{##1####1}}% - \processcommalist[#2]\dodocommando}}% - \processcommalist[#1]\docommando + \processcommalist[#2]\dodocommand}}% + \processcommalist[#1]\docommand \else\ifsecondargument \global\somebackgroundtrue \doifcommonelse{#1}{\v!text,\v!hidden,% %\v!linkertekst,\v!rechtertekst,% \v!paper,\v!page,\v!leftpage,\v!rightpage} - {\def\docommando##1% - {\getparameters[\??ma##1][#2]\checkbackground{##1}}% - \processcommalist[#1]\docommando}% + {\def\docommand##1{\getparameters[\??ma##1][#2]\checkbackground{##1}}% + \processcommalist[#1]\docommand}% {\setupbackgrounds [#1]% [\v!leftedge,\v!leftmargin,\v!text,\v!rightmargin,\v!rightedge]% @@ -476,7 +455,7 @@ %D intermediate commands. The inheritance macro makes sure %D that copies are efficient. -\def\dodocommando#1#2% +\def\dodocommand#1#2% {\copylocalframed [\??ma#1#2][\??ma\v!page]% \getparameters @@ -491,29 +470,29 @@ %D The stand alone text area inherits from the page too. -\dodocommando\v!text \empty -%dodocommando\v!linkertekst \empty -%dodocommando\v!rechtertekst\empty -\dodocommando\v!hidden \empty +\dodocommand\v!text \empty +%dodocommand\v!linkertekst \empty +%dodocommand\v!rechtertekst\empty +\dodocommand\v!hidden \empty %D We now define all 25 main areas in a row. -\def\docommando#1% - {\dodocommando#1\v!leftedge - \dodocommando#1\v!leftmargin - \dodocommando#1\v!text - \dodocommando#1\v!rightmargin - \dodocommando#1\v!rightedge} +\def\docommand#1% + {\dodocommand#1\v!leftedge + \dodocommand#1\v!leftmargin + \dodocommand#1\v!text + \dodocommand#1\v!rightmargin + \dodocommand#1\v!rightedge} -\docommando\v!top -\docommando\v!header -\docommando\v!text -\docommando\v!footer -\docommando\v!bottom +\docommand\v!top +\docommand\v!header +\docommand\v!text +\docommand\v!footer +\docommand\v!bottom %D We need some cleanup now. -\let\dodocommando\relax \let\docommando\relax +\let\dodocommand\relax \let\docommand\relax %D We now set up the individual areas to use reasonable %D defaults. @@ -534,18 +513,18 @@ \c!offset=\!!zeropoint, % later set to \v!overlay, watch out ! \c!depth=\!!zeropoint] -\def\docommando#1% +\def\docommand#1% {\inheritparameter[\??ma][#1\c!frameoffset][\v!page\c!offset]% \inheritparameter[\??ma][#1\c!backgroundoffset][\v!page\c!offset]} -\docommando\v!paper -\docommando\v!page -\docommando\v!leftpage -\docommando\v!rightpage +\docommand\v!paper +\docommand\v!page +\docommand\v!leftpage +\docommand\v!rightpage %D Again we clean up temporary macros. -\let\docommando\relax +\let\docommand\relax %D The hidden layer can be populated by extending the %D following comma separated list. This only happens in core @@ -590,35 +569,15 @@ \resetglobal \expandafter\gobbleoneargument \fi} -% \def\doaddlocalbackground#1% -% {\edef\next -% {\noexpand\redoglobal\wd#1\the\wd#1% -% \noexpand\redoglobal\ht#1\the\ht#1% -% \noexpand\dodoglobal\dp#1\the\dp#1}% -% \dodoglobal\setbox#1\hbox -% {\fastlocalframed -% [\??ma\v!local] -% [\c!component=local,\c!frame=\v!off,\c!offset=\v!overlay,\c!setups=,% -% \c!width=\wd#1,\c!height=\ht#1,% no \c!depth=\dp#1 in cont-exp.tex, to be checked ! -% \c!background=\localbackground]% -% {\registerMPlocaltextarea{\box#1}}}% -% \next -% \doglobal\increment\localpositionnumber\relax} % afterwards ! - \def\doaddlocalbackground#1% - {\edef\next - {\noexpand\redoglobal\wd#1\the\wd#1% - \noexpand\redoglobal\ht#1\the\ht#1% - \noexpand\redoglobal\dp#1\the\dp#1}% - \redoglobal\setbox#1\hbox - {\fastlocalframed + {\dodoglobal\setbox#1\hbox + {\fastlocalframed % \localframed [\??ma\v!local] [\c!component=local,\c!frame=\v!off,\c!offset=\v!overlay,\c!setups=,% - \c!width=\wd#1,\c!height=\ht#1,% no \c!depth=\dp#1 in cont-exp.tex, to be checked ! + \c!location=\v!keep,% when we use \localframed instead of \fastlocalframed \c!background=\localbackground]% {\registerMPlocaltextarea{\box#1}}}% - \next - \resetglobal + \resetglobal % redundant \doglobal\increment\localpositionnumber\relax} % afterwards ! % Test how previous macro behaves with depth: diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index a6c39efec..98d62bcb5 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -18,6 +18,8 @@ \unprotect +\ifx\addlocalbackgroundtobox\undefined \def\addlocalbackgroundtobox{\resetglobal\gobbleoneargument} \fi + % naar supp-box.tex \def\voidbox{\box\voidb@x} @@ -181,6 +183,16 @@ 13: there is nothing to split \stopmessages +\def\floatparameter #1{\csname\??fl\currentfloat#1\endcsname} +\def\floatcaptionparameter#1{\csname\??kj\currentfloat#1\endcsname} + +% for the moment we need to define the parameters anyway, first we need to implement a +% proper parent chain (also for framed); no problem now that machines are fast (tests +% show that this may save 20 k or more in the format) +% +% \def\floatparameter #1{\executeifdefined{\??fl\currentfloat#1}{\csname\??fl#1\endcsname}} +% \def\floatcaptionparameter#1{\executeifdefined{\??kj\currentfloat#1}{\csname\??bk#1\endcsname}} + \def\setupfloats {\dodoubleargument\getparameters[\??bk]} @@ -188,22 +200,28 @@ {\dodoubleargument\getparameters[\??kj]} \def\dosetupfloat[#1][#2]% - {\def\docommando##1{\getparameters[\??fl##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??fl##1][#2]}% + \processcommalist[#1]\docommand} \def\setupfloat {\dodoubleargument\dosetupfloat} \def\dosetupcaption[#1][#2]% - {\def\docommando##1{\getparameters[\??kj##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??kj##1][#2]}% + \processcommalist[#1]\docommand} \def\setupcaption {\dodoubleargument\dosetupcaption} + \def\doemptyblock#1% {\localframed - [\??fl#1][\c!frame=\v!on]% + [\??fl#1] + [\c!frame=\v!on, + \c!width=\@@bkwidth, + \c!height=\@@bkheight, + \c!location=\v!normal, + \c!offset=\@@bkoffset]% {\getmessage\m!floatblocks{12}\empty}} % A complication is that we may have to handle a pagebreak @@ -212,27 +230,17 @@ % we're realy dealing with the float. Some day I'll root out % the global settings. -% \def\docomplexplacefloat[#1][#2]% [#3]#4% -% {\edef\floattype{#1}% -% \doifelsenothing\floattype -% {\let\floattype\v!figure} -% {\doifundefined{\??fl#1\c!default}{\let\floattype\v!figure}}% -% \doifelsenothing{#2} -% {\edef\floatlocation{\getvalue{\??fl\floattype\c!default}}} -% {\edef\floatlocation{#2}}% -% \expanded{\dodocomplexplacefloat[\floattype][\floatlocation]}} - \def\docomplexplacefloat[#1][#2]% [#3]#4% - {\edef\floattype{#1}% - \doifelsenothing\floattype - {\let\floattype\v!figure} - {\doifundefined{\??fl#1\c!default}{\let\floattype\v!figure}}% + {\edef\currentfloat{#1}% + \doifelsenothing\currentfloat + {\let\currentfloat\v!figure} + {\doifundefined{\??fl#1\c!default}{\let\currentfloat\v!figure}}% \doifelsenothing{#2} - {\edef\floatlocation{\getvalue{\??fl\floattype\c!default}}} + {\edef\floatlocation{\floatparameter\c!default}} {\edef\floatlocation{#2}}% \doifinsetelse\v!split{#2} - {\expanded{\dodocomplexsplitfloat[\floattype][\floatlocation]}} - {\expanded{\dodocomplexplacefloat[\floattype][\floatlocation]}}} + {\expanded{\dodocomplexsplitfloat[\currentfloat][\floatlocation]}} + {\expanded{\dodocomplexplacefloat[\currentfloat][\floatlocation]}}} \def\dodocomplexsplitfloat[#1][#2][#3]#4% {\splitfloat{\dodocomplexplacefloat[#1][#2][#3]{#4}}} @@ -245,43 +253,6 @@ \v!innermargin,\v!outermargin,\v!inneredge,\v!outeredge,% \v!text,\v!opposite}% \v!page -% \def\dodocomplexplacefloat[#1][#2][#3]#4% -% {\flushnotes -% \flushsidefloats % here ! -% \ifsomefloatwaiting -% % this was \checkwaitingfloats spread all over -% \doifinsetelse\v!always{#2} -% {\showmessage\m!floatblocks5\empty} -% {\expanded{\doifcommonelse{#2}{\flushfloatslist}}\doflushfloats\donothing}% -% % but which should be done before using box \floatbox -% \fi -% \ifmargeblokken % waarschijnlijk gebroken ! ! ! ! -% \doifinset\v!margin{#2} -% {\endgraf -% \bgroup\everypar{\egroup\the\everypar}% -% \hsize\@@mbwidth}% -% \fi -% \global\insidefloattrue -% \begingroup % ** -% \the\everyinsidefloat -% \let\@@extrafloat\empty -% \presetmorefloatvariables{#2}% -% \dowithnextboxcontent % better a \the\everyfloattoks -% {\setlocalfloathsize -% \getvalue{\??fl#1\c!inner}% -% \fuzzysnappingfalse -% \postponenotes} % new -% {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done -% % we need to carry over the par because of side floats -% \doifnotinset\v!text{#2}{\carryoverpar\endgroup}% -% \global\sidefloatdownshift \zeropoint -% \global\sidefloatextrashift\zeropoint -% \ifparfloat -% \doifinset\v!reset{#2}\forgetsidefloats -% \doinhibitblank -% \fi}% better move this to side floats -% \vbox} - \def\dodocomplexplacefloat[#1][#2][#3]#4% {\flushnotes \flushsidefloats % here ! @@ -305,12 +276,12 @@ \presetmorefloatvariables{#2}% \dowithnextboxcontent % better a \the\everyfloattoks {\setlocalfloathsize - \getvalue{\??fl#1\c!inner}% + \floatparameter\c!inner \fuzzysnappingfalse \postponenotes} % new - {\doifvaluesomething{\??fl#1\c!criterium} - {\ifdim\wd\nextbox>\getvalue{\??fl#1\c!criterium}\relax - \edef\forcedfloatmethod{\executeifdefined{\??fl#1\c!fallback}\v!here}% + {\doifsomething{\floatparameter\c!criterium} + {\ifdim\wd\nextbox>\floatparameter\c!criterium\relax + \edef\forcedfloatmethod{\executeifdefined{\??fl\currentfloat\c!fallback}\v!here}% \fi}% \xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done % we need to carry over the par because of side floats @@ -346,14 +317,14 @@ \fi \global\sidefloatshift\zeropoint \global\sidefloatmaximum\zeropoint - \global\chardef\sidefloatmethod\getvalue{\??fl#1\c!sidemethod}% - \global\chardef\textfloatmethod\getvalue{\??fl#1\c!textmethod}% + \global\chardef\sidefloatmethod\floatparameter\c!sidemethod + \global\chardef\textfloatmethod\floatparameter\c!textmethod \global\chardef\sidefloatalign\zerocount \globallet\floatrotation\!!zerocount \calculatefloatskips{#1}% \ifparfloat \processaction - [\getvalue{\??fl#1\c!sidealign}] + [\floatparameter\c!sidealign] [\v!height=>\global\chardef\sidefloatalign\plusone,% \v!line=>\global\chardef\sidefloatalign\plustwo,% (***) \v!depth=>\global\chardef\sidefloatalign\plusthree,% @@ -382,7 +353,7 @@ \fi \doifinsetelse\v!nonumber{#2} {\global\nofloatnumbertrue} - {\doifelsevalue{\??kj#1\c!number}\v!yes + {\doifelse{\floatcaptionparameter\c!number}\v!yes {\global\nofloatnumberfalse} {\global\nofloatnumbertrue}}% \ConvertToConstant\doifelse{#4}{} @@ -431,17 +402,6 @@ % \fuzzysnappingfalse %\to \everyinsidefloat -%\def\doifrightpagefloatelse % watch out: other default ! ! ! -% {\ifdoublesided -% \ifodd\purenumber\twopassfloatdata\space -% \@EAEAEA\firstoftwoarguments -% \else -% \@EAEAEA\secondoftwoarguments -% \fi -% \else -% \@EA\firstoftwoarguments -% \fi} - \def\doifrightpagefloatelse {\ifdoublesided \ifsinglesided @@ -559,22 +519,22 @@ #4\setbox#3\vbox {\vskip\sidefloatdownshift\nointerlineskip\box#3}% \fi - \doifvaluesomething{\??fl#1\c!minwidth} - {\scratchdimen\getvalue{\??fl#1\c!minwidth}\relax + \doifsomething{\floatparameter\c!minwidth} + {\scratchdimen\floatparameter\c!minwidth\relax \ifdim\wd#3<\scratchdimen #4\setbox#3\hbox to \scratchdimen - {\doifnotvalue{\??fl#1\c!location}\v!left \hss + {\doifnot{\floatparameter\c!location}\v!left \hss \box#3% - \doifnotvalue{\??fl#1\c!location}\v!right\hss}% + \doifnot{\floatparameter\c!location}\v!right\hss}% \fi}% % todo: rand / rug \doifinset\v!hanging{#2} {\doifcommonelse{\v!inleft,\v!leftmargin}{#2} - {\letvalue{\??fl#1\c!maxwidth}\leftmarginwidth}% + {\letvalue{\??fl\currentfloat\c!maxwidth}\leftmarginwidth}% {\doifcommon{\v!inright,\v!rightmargin}{#2} - {\letvalue{\??fl#1\c!maxwidth}\rightmarginwidth}}}% - \doifvaluesomething{\??fl#1\c!maxwidth} - {\scratchdimen\getvalue{\??fl#1\c!maxwidth}\relax + {\letvalue{\??fl\currentfloat\c!maxwidth}\rightmarginwidth}}}% + \doifsomething{\floatparameter\c!maxwidth} + {\scratchdimen\floatparameter\c!maxwidth\relax \ifdim\wd#3>\scratchdimen \doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge \v!inleft,\v!leftmargin,\v!leftedge}{#2} @@ -584,9 +544,9 @@ {\doifnotinset\v!right{#2}\hss \box#3% \doifnotinset\v!left{#2}\hss}% - {\doifnotvalue{\??fl#1\c!location}\v!left\hss + {\doifnot{\floatparameter\c!location}\v!left\hss \box#3% - \doifnotvalue{\??fl#1\c!location}\v!right\hss}}}% + \doifnot{\floatparameter\c!location}\v!right\hss}}}% \fi}% \fi} @@ -617,15 +577,20 @@ % todo: \floatparameter + \currentfloat - saves many hash entries \def\dododefinefloat[#1][#2]% - {\presetlocalframed[\??fl#1]% + {\def\currentfloat{#1}% + \presetlocalframed[\??fl#1]% \setupfloat [#1] - [\c!width=8\lineheight, % 15\bodyfontsize, - \c!height=6\lineheight, % 10\bodyfontsize, + [%\c!width=8\lineheight, % 15\bodyfontsize, + %\c!height=6\lineheight, % 10\bodyfontsize, +\c!offset=\v!overlay, +\c!width=\v!fit, +\c!height=\v!fit, \c!minwidth=, \c!maxwidth=, \c!maxheight=, \c!criterium=, +% inherited \c!sidespacebefore=\@@bksidespacebefore, \c!sidespaceafter=\@@bksidespaceafter, \c!sidealign=\@@bksidealign, % \v!line @@ -646,25 +611,28 @@ \c!rightframe=\@@bkrightframe, \c!frameoffset=\@@bkframeoffset, %\c!local=\@@bklocal, - \c!pageboundaries=, \c!textmethod=\@@bktextmethod, \c!sidemethod=\@@bksidemethod, + \c!pageboundaries=, \c!default=]% \setupcaption [#1] - [\c!location=\@@kjlocation, + [\c!headstyle=\@@kjheadstyle, + \c!headcolor=\@@kjheadcolor, + \c!textstyle=\@@kjtextstyle, + \c!textcolor=\@@kjtextcolor, + \c!style=\@@kjstyle, + \c!color=\@@kjcolor, + \c!location=\@@kjlocation, \c!grid=\@@kjgrid, %\c!before=\@@kjbefore, \c!inbetween=\@@kjinbetween, %\c!after=\@@kjafter, +\c!spacebefore=\@@kjspacebefore, +\c!spaceinbetween=\@@kjspaceinbetween, +\c!spaceafter=\@@kjspaceafter, \c!width=\@@kjwidth, \c!minwidth=\@@kjminwidth, - \c!headstyle=\@@kjheadstyle, - \c!headcolor=\@@kjheadcolor, - \c!textstyle=\@@kjtextstyle, - \c!textcolor=\@@kjtextcolor, - \c!style=\@@kjstyle, - \c!color=\@@kjcolor, \c!align=\@@kjalign, \c!number=\@@kjnumber, \c!way=\@@kjway, @@ -675,17 +643,22 @@ \c!stopper=\@@kjstopper, \c!suffix=\@@kjsuffix, % hook \c!command=\@@kjcommand, - \c!conversion=\@@kjconversion]% + \c!conversion=\@@kjconversion + ]% \definenumber % \definelabel [#1] [\c!text=#1, \c!location=\v!intext, - \c!way=\getvalue{\??kj#1\c!way}, - \c!blockway=\getvalue{\??kj#1\c!blockway}, - \c!sectionnumber=\getvalue{\??kj#1\c!sectionnumber}, - \c!conversion=\getvalue{\??kj#1\c!conversion}]% +% \c!way=\getvalue{\??kj#1\c!way}, +% \c!blockway=\getvalue{\??kj#1\c!blockway}, +% \c!sectionnumber=\getvalue{\??kj#1\c!sectionnumber}, +% \c!conversion=\getvalue{\??kj#1\c!conversion}]% + \c!way=\floatcaptionparameter\c!way, + \c!blockway=\floatcaptionparameter\c!blockway, + \c!sectionnumber=\floatcaptionparameter\c!sectionnumber, + \c!conversion=\floatcaptionparameter\c!conversion]% \presetlabeltext[#1=\Word{#1}~]% - \checkfloatracer{\v!float#1}% + \newnodelocation{\v!float\@@thenumber{#1}}% \dodefinefloatcommands[#1][#2]} \def\dodefinefloatcommands[#1][#2]% @@ -719,6 +692,7 @@ \c!textmethod,\c!sidemethod]% \copyparameters[\??kj#1][\??kj#3] [\c!location,\c!before,\c!inbetween,\c!after, + \c!spacebefore,\c!spaceinbetween,\c!spaceafter, \c!width,\c!headstyle,\c!headcolor,\c!style,\c!color, \c!textstyle,\c!textcolor,\c!minwidth, \c!align,\c!number,\c!way,\c!blockway, @@ -727,11 +701,41 @@ \presetlabeltext[#1=\labeltext{#3}]% \dodefinefloatcommands[#1][#2]} +% todo: ook in localframed een parent chain, then we can inherit without defs + +\def\redodefinefloat[#1][#2][#3]% same label/number + {\presetlocalframed[\??fl#1]% + \copylocalframed[\??fl#1][\??fl#3]% + \copyparameters[\??fl#1][\??fl#3] + [\c!width,\c!height,%\c!local, + \c!maxwidth,\c!maxheight,\c!minwidth, + \c!margin,\c!sidespacebefore,\c!sidespaceafter,\c!sidealign, + \c!leftmargindistance,\c!rightmargindistance,\c!criterium, + \c!frame,\c!radius,\c!corner,\c!location,\c!background,\c!framecolor, + \c!backgroundscreen,\c!backgroundcolor,\c!backgroundoffset, + \c!topframe,\c!bottomframe,\c!leftframe,\c!rightframe, + \c!frameoffset,\c!pageboundaries,\c!default, + \c!textmethod,\c!sidemethod]% + \copyparameters[\??kj#1][\??kj#3] + [\c!location,\c!before,\c!inbetween,\c!after, + \c!spacebefore,\c!spaceinbetween,\c!spaceafter, + \c!width,\c!headstyle,\c!headcolor,\c!style,\c!color, + \c!textstyle,\c!textcolor,\c!minwidth, + \c!align,\c!number,\c!way,\c!blockway, + \c!sectionnumber,\c!separator,\c!stopper,\c!suffix,\c!distance,\c!conversion]% + \definenumber[#1][#3]% + \presetlabeltext[#1=\labeltext{#3}]% + \dodefinefloatcommands[#1][#2]} + + \def\placefloat {\dotripleempty\docomplexplacefloat} -\installinsertion\topins \newdimen\topinserted -\installinsertion\botins \newdimen\botinserted +\installinsertion\topins +\installinsertion\botins + +\newdimen\botinserted +\newdimen\topinserted %D Extra float registers. @@ -769,80 +773,27 @@ \let\twopassfloatdata\realpageno \def\dosavefloatdata % \expanded - {\bgroup - \doglobal\increment\noffloatdata - \edef\dosavefloatdata - {\writeutilitycommand - {\twopassentry - {\s!float\s!data}% - {\noffloatdata}% - {\noffloatpages::\noexpand\realfolio}}}% later {}{}{}{} and \getfirst... - \dosavefloatdata - \egroup} + {\doglobal\increment\noffloatdata + \lazysavetaggedtwopassdata{\s!float\s!data}{\noffloatdata}{\noffloatpages}{\noexpand\realfolio}}% later {}{}{}{} and \getfirst... \def\dogetfloatdata % precedes save ! {\doglobal\increment\noffloatpages - \findtwopassdata{\s!float\s!data}{\noffloatpages::}% + \findtwopassdata{\s!float\s!data}{\noffloatpages}% \iftwopassdatafound \globallet\twopassfloatdata\twopassdata \else \globallet\twopassfloatdata\realpageno % \realfolio \fi} -% Er wordt bij \v!altijd als dat nodig is hernummerd. -% Daarbij wordt gebruik gemaakt van de opgeslagen nummers en -% volgorde. -% -% replaced code: -% -% \definetwopasslist\s!float -% -% \def\dofloatreference#1% -% {\doifnot\@@bknumbering\v!nocheck -% {\doglobal\increment\numberedfloat -% \doifelse\@@bknumbering\v!text % alternative to yes|page -% {\let\next\immediatewriteutilitycommand} -% {\let\next\writeutilitycommand}% -% \expanded{\next -% {\noexpand\twopassentry -% {\s!float}% -% {\numberedfloat}% -% {\composedsectionnumber}}}}} -% -% \def\redofloatorder#1% -% {\doifnot\@@bknumbering\v!nocheck -% {\doglobal\increment\nofplacedfloats\relax -% \gettwopassdata\s!float -% \iftwopassdatafound -% \doifnot\composedsectionnumber\twopassdata -% {\edef\oldcomposedsectionnumber{\composedsectionnumber}% -% \xdef\composedsectionnumber{\twopassdata}% -% \showmessage\m!floatblocks1{\nofplacedfloats,#1 \oldcomposedsectionnumber,\composedsectionnumber}}% -% \fi}} -% -% \def\preparefloatnumber#1% -% {\incrementnumber[#1]% -% \makesectionnumber[#1]} -% -% \def\tracefloatnumber#1% -% {\dofloatreference{#1}% -% \redofloatorder{#1}} -% -% \def\checkfloatracer#1% -% {} - -\def\checkfloatracer#1% - {\newnodelocation{#1}} - \def\tracefloatnumber#1% - {\doifnot\@@bknumbering\v!nocheck - {\checkfloatracer{\v!float#1}% will go - \tagnodelocation{\v!float#1}}} + {\doifnot\@@bknumbering\v!nocheck{\tagnodelocation{\v!float\@@thenumber{#1}}}} \newconditional\retainfloatnumber \def\preparefloatnumber#1% {\xdef\floatcaptionnumber{#1}% + \doifelsenodelocation{\v!float\@@thenumber{#1}} + \donothing {\chardef\nodelocationmode\zerocount}% \doifelse\@@bknumbering\v!nocheck {\incrementnumber[#1]% \makesectionnumber[#1]% @@ -863,10 +814,9 @@ \incrementnumber[#1]% \savenumber[#1]% % the real work is done here - \checkfloatracer{\v!float#1}% will go - \nextnodelocation{\v!float#1}% better \nextfloatnumber - \analyzenodelocation{\v!float#1}% - \scratchcounter\getnodelocationo{\v!float#1}% + \nextnodelocation{\v!float\@@thenumber{#1}}% better \nextfloatnumber + \analyzenodelocation{\v!float\@@thenumber{#1}}% + \scratchcounter\getnodelocationo{\v!float\@@thenumber{#1}}% \advance\scratchcounter\minusone % here we correct for 'per whatever handling' \advance\scratchcounter-\accumulatednumber[#1]% @@ -928,6 +878,12 @@ % \setbox\floatbox\hbox to \hsize{\hss\box\globalscratchbox\hss}% % \else % \setbox\floatbox\box\globalscratchbox % local ! +% % retain special alignments +% \ifinsidecolumns +% \ifdim\wd\floatbox>\makeupwidth +% \wd\floatbox\makeupwidth +% \fi +% \fi % \fi % \else % \setbox\floatbox\box\globalscratchbox % local ! @@ -1261,19 +1217,6 @@ \def\floatautofactor{.5} -% \def\sometopbottomfloat[#1]% -% {\doifinsetelse\v!auto{#1} -% {\ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen -% \placesometopsfloat[#1]% -% \else -% \placesomebotsfloat[#1]% -% \fi} -% {\doifinsetelse\v!top{#1} -% {\placesometopsfloat[#1]} -% {\doifinsetelse\v!bottom{#1} -% {\placesomebotsfloat[#1]} -% {\placesomeherefloat[#1]}}}} - \def\sometopbottomfloat[#1]% {\doifelse\floatmethod\v!auto {\ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen @@ -1299,10 +1242,6 @@ % \box\floatbox inhoud+referentie % % \do???float#1 #1 = boxnummer -% -% \ifinsidefloat wordt \true gezet voor \docompletefloat en \false -% na float plaatsen; kan worden gebruikt om in -% andere commando's witruimte te onderdrukken \newdimen\floatsideskip \floatsideskip =12pt \newdimen\floattopskip \floattopskip =\floattopskip @@ -1329,39 +1268,23 @@ {\global#1\zeropoint} {\doifelse{#2}\v!none {\global#1\zeropoint} - {\setbox0\vbox{\whitespace\@EA\blank\@EA[#2]}% + {\setbox0\vbox{\whitespace\expanded{\blank[#2]}}% \global#1\ht0}}} -\def\calculatefloatskips#1% +\def\calculatefloatskips#1% todo floatparam {{\docalculatefloatskip\floattopskip \@@bkspacebefore \docalculatefloatskip\floatbottomskip \@@bkspaceafter \docalculatefloatskip\sidefloattopskip {\getvalue{\??fl#1\c!sidespacebefore}}% \@@bksidespacebefore \docalculatefloatskip\sidefloatbottomskip{\getvalue{\??fl#1\c!sidespaceafter}}% \@@bksidespaceafter \gdef\sidefloattopoffset{\openstrutdepth}% was \def - \global\floatsideskip\getvalue{\??fl#1\c!margin}% + \global\floatsideskip \getvalue{\??fl#1\c!margin}% \global\sidefloatleftshift \getvalue{\??fl#1\c!leftmargindistance}% \global\sidefloatrightshift\getvalue{\??fl#1\c!rightmargindistance}% - \global\noftopfloats \@@bkntop\relax - \global\nofbotfloats \@@bknbottom\relax}} - -\newif\ifinsidefloat + \global\noftopfloats\@@bkntop \relax + \global\nofbotfloats\@@bknbottom\relax}} \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!sttle\c!color{#3}}}% -% \doifelsevalue{\??kj#1\c!number}\v!yes -% {\def\dofloatnummer% -% {{\xdef\floatcaptionnumber{#1}% -% \hbox{\doattributes{\??kj#1}\c!headstyle\c!headcolor -% {\strut#2\floatcaptionsuffix}}}% -% \ConvertToConstant\doifnot{#3}{} -% {\tfskip\emergencystretch=.5em}}} -% {\let\dofloatnummer\empty}} % Quite experimental ! @@ -1403,7 +1326,7 @@ {\doattributes{\??kj#1}\c!headstyle\c!headcolor {\labeltexts{#1}{\preparednumber}}% \doattributes{\??kj#1}\c!textstyle\c!textcolor - {\dotfskip{\getvalue{\??kj#1\c!distance}}#3}}}% + {\dotfskip{\floatcaptionparameter\c!distance}#3}}}% \fi} \def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}} @@ -1417,34 +1340,24 @@ \let\placefloatlabelreference \placefloatcaptionreference \def\borderedfloatbox#1% - {\localframed - [\??fl#1] - [\c!width=\@@bkwidth, - \c!height=\@@bkheight, - \c!location=\v!normal, - \c!offset=\@@bkoffset]% - {\box\floatbox}} + {\localframed[\??fl#1][\c!location=\v!normal]{\box\floatbox}} \newbox\captionbox -% \floatparameter - -\def\putcompletecaption#1#2#3#4% - {\noindent -% \xdef\lastcaptiontag{\strut#2\floatcaptionsuffix}% +\def\putcompletecaption#1#2#3% + {\doifsomething{\floatcaptionparameter\c!spacebefore}{\blank[\floatcaptionparameter\c!spacebefore]}% +% \floatcaptionparameter\c!before % test for side effects first + \noindent \xdef\lastcaptiontag{\strut#2}% -% \xdef\floatcaptionnumber{#1}% \dostartattributes{\??kj#1}\c!style\c!color\empty \ifnofloatnumber \else \hbox{\doattributes{\??kj#1}\c!headstyle\c!headcolor{\strut#2}}% \ifnofloatcaption \else \ifemptyfloatcaption \else - \ifcase#4\relax - \scratchskip\@@kjkjdistance\relax - \dotfskip\scratchskip\emergencystretch.5\scratchskip - \else - \ifx\@@kjkjinbetween\empty\else\unskip\@@kjkjinbetween\fi - \fi + \doifelsenothing{\floatcaptionparameter\c!spaceinbetween} + {\scratchskip\floatcaptionparameter\c!distance\relax + \dotfskip\scratchskip\emergencystretch.5\scratchskip} + {\blank[\floatcaptionparameter\c!spaceinbetween]}% \fi \fi \fi \ifnofloatcaption @@ -1456,7 +1369,9 @@ \xdef\lastcaptiondp{\strutdepth}% \begstrut#3\endstrut\endgraf}% \fi - \dostopattributes} + \dostopattributes +% \floatcaptionparameter\c!after % test for side effects first + \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}} \let\lastcaptionht\!!zeropoint \let\lastcaptiondp\!!zeropoint @@ -1466,6 +1381,11 @@ \newbox\tempfloatbox \newbox\tempcaptionbox +\newif\iftracecaptions + +\def\settracedcaptionbox + {\iftracecaptions\setbox\tempcaptionbox\ruledhbox{\box\tempcaptionbox}\fi} + %\stelblokkopjesin[\c!width=5cm] %\stelblokkopjesin[\c!align=\v!left] %\stelblokkopjesin[\c!align=\v!right] @@ -1473,7 +1393,7 @@ \def\docheckcaptioncontent#1#2#3#4% {\ifnofloatcaption \else \setbox\tempcaptionbox\hbox - {\trialtypesettingtrue\notesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}% + {\trialtypesettingtrue\notesenabledfalse\putcompletecaption{#4}{#2}{#3}}% % new, \placefigure{\XMLflush{somecaption}}{} passes earlier empty check % so here we misuse the scratch box; actually this means that the previous % test can go away (some day, when i redo this module) @@ -1489,19 +1409,68 @@ \ifx\moveboxontogrid\undefined \let\movecaptionontogrid\gobblethreearguments \fi +% \def\dosetpagfloat#1#2#3#4% \copy wegwerken +% {\bgroup +% \setlocalfloathsize +% \ifnum\floatrotation>0 +% \swapdimens\hsize\vsize +% \fi +% \forgetall +% \postponenotes +% \dontcomplain +% \setbox\tempfloatbox\vbox{\borderedfloatbox{#4}}% +% \def\locatefloat +% {\chardef\alignstrutmode\zerocount +% \alignedline{\floatparameter\c!location}\v!middle}% +% \docheckcaptioncontent{#1}{#2}{#3}{#4}% +% \ifnofloatcaption +% \dopreparenocaption{#1}{#2}{#3}{#4}% +% \edef\width{\the\wd\floatbox}% +% \doglobal\addlocalbackgroundtobox\floatbox +% \else +% % todo: installable maken, variant/method=auto vs macro +% \doifinsetelse{\floatcaptionparameter\c!location}{\v!high,\v!middle,\v!low} +% {\dopreparesidecaption{#1}{#2}{#3}{#4}} +% {\doifelse{\floatcaptionparameter\c!minwidth}\v!fit +% {\doifelse{\floatcaptionparameter\c!width}\v!max +% {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}} +% {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption +% \doifelse{\floatcaptionparameter\c!width}\v!fit +% {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}} +% {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}% +% \else +% \dopreparestackcaptionmin{#1}{#2}{#3}{#4}% +% \fi}} +% {\dopreparestackcaptionfix{#1}{#2}{#3}{#4}}}% new, special effects (see icare) +% \edef\width{\the\wd\tempfloatbox}% +% \addlocalbackgroundtobox\tempfloatbox +% \setbox\tempcaptionbox\hbox{\floatcaptionparameter\c!command{\box\tempcaptionbox}}% +% \moveboxontogrid\tempcaptionbox{\floatcaptionparameter\c!grid}\lastcaptionht +% \addlocalbackgroundtobox\tempcaptionbox +% \buildfloatbox +% \fi +% \ifnum\floatrotation>0 +% \global\setbox\floatbox\vbox +% {\rotate[\c!rotation=\floatrotation]{\box\floatbox}}% +% \edef\width{\the\wd\tempfloatbox}% +% \else +% \postcenterfloatbox\width +% \fi +% \egroup} + \def\dosetpagfloat#1#2#3#4% \copy wegwerken {\bgroup \setlocalfloathsize -\ifnum\floatrotation>0 - \swapdimens\hsize\vsize -\fi + \ifnum\floatrotation>0 + \swapdimens\hsize\vsize + \fi \forgetall \postponenotes \dontcomplain \setbox\tempfloatbox\vbox{\borderedfloatbox{#4}}% \def\locatefloat {\chardef\alignstrutmode\zerocount - \alignedline\@@flfllocation\v!middle}% + \alignedline{\floatparameter\c!location}\v!middle}% \docheckcaptioncontent{#1}{#2}{#3}{#4}% \ifnofloatcaption \dopreparenocaption{#1}{#2}{#3}{#4}% @@ -1509,23 +1478,12 @@ \doglobal\addlocalbackgroundtobox\floatbox \else % todo: installable maken, variant/method=auto vs macro - \doifinsetelse\@@kjkjlocation{\v!high,\v!middle,\v!low} - {\dopreparesidecaption{#1}{#2}{#3}{#4}} - {\doifelse\@@kjkjminwidth\v!fit - {\doifelse\@@kjkjwidth\v!max - {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}} - {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption - \doifelse\@@kjkjwidth\v!fit - {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}} - {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}% - \else - \dopreparestackcaptionmin{#1}{#2}{#3}{#4}% - \fi}} - {\dopreparestackcaptionfix{#1}{#2}{#3}{#4}}}% new, special effects (see icare) + \dopreparedocaption{#1}{#2}{#3}{#4}% + \settracedcaptionbox \edef\width{\the\wd\tempfloatbox}% \addlocalbackgroundtobox\tempfloatbox - \setbox\tempcaptionbox\hbox{\@@kjkjcommand{\box\tempcaptionbox}}% - \moveboxontogrid\tempcaptionbox\@@kjkjgrid\lastcaptionht + \setbox\tempcaptionbox\hbox{\floatcaptionparameter\c!command{\box\tempcaptionbox}}% + \moveboxontogrid\tempcaptionbox{\floatcaptionparameter\c!grid}\lastcaptionht \addlocalbackgroundtobox\tempcaptionbox \buildfloatbox \fi @@ -1538,10 +1496,6 @@ \fi \egroup} -\ifx\addlocalbackgroundtobox\undefined - \def\addlocalbackgroundtobox{\resetglobal\gobbleoneargument}% -\fi - \def\captionminwidth {15\bodyfontsize} \def\captionovershoot {2em} @@ -1552,57 +1506,95 @@ \fi\fi \locatefloat{\copy\tempfloatbox}}} +\def\dopreparedocaption#1#2#3#4% + {\doifinsetelse{\floatcaptionparameter\c!location}{\v!top,\v!bottom} + {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max} + {\doifelse{\floatcaptionparameter\c!minwidth}\v!fit + {\doifelse{\floatcaptionparameter\c!width}\v!max + {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}} + {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption + \doifelse{\floatcaptionparameter\c!width}\v!fit + {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}} + {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}% + \else + \dopreparestackcaptionmin{#1}{#2}{#3}{#4}% + \fi}} + {\dopreparestackcaptionfix{#1}{#2}{#3}{#4}}}% + {\dopreparesidewidthcaption{#1}{#2}{#3}{#4}}}% new, special effects (see icare) + {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max} + {\dopreparesideautocaption{#1}{#2}{#3}{#4}} + {\dopreparesidewidthcaption{#1}{#2}{#3}{#4}}}} + +% \def\dosettempcaptionbox +% {\dosetraggedvbox{\floatcaptionparameter\c!align}% +% \setbox\tempcaptionbox\raggedbox} + +\def\dosettempcaptionbox + {\setbox\tempcaptionbox\vbox\bgroup + \expanded{\setupalign[\v!new,\v!reset,\floatcaptionparameter\c!align,\v!old]}% + \let\next} + +\def\dopreparesideautocaption#1#2#3#4% + {\scratchdimen\dimexpr\hsize-\wd\tempfloatbox-\@@bkmargin\relax % was \tfskipsize\relax + \ifdim\wd\tempcaptionbox>\scratchdimen + \ifdim\wd\tempcaptionbox<1.3\scratchdimen + \scratchdimen0.8\scratchdimen + \fi + \fi + \dosettempcaptionbox + {\hsize\scratchdimen + \putcompletecaption{#4}{#2}{#3}}} + +\def\dopreparesidewidthcaption#1#2#3#4% + {\dosettempcaptionbox + {\hsize\floatcaptionparameter\c!width + \putcompletecaption{#4}{#2}{#3}}} + \def\dopreparestackcaptionfix#1#2#3#4% - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox - {\hsize\@@kjkjminwidth % special effects - \putcompletecaption{#4}{#2}{#3}{0}}} + {\dosettempcaptionbox + {\hsize\floatcaptionparameter\c!minwidth % special effects + \putcompletecaption{#4}{#2}{#3}}} \def\dopreparestackcaptionmax#1#2#3#4% - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox + {\dosettempcaptionbox {\hsize\wd\tempfloatbox - \putcompletecaption{#4}{#2}{#3}{0}}} + \putcompletecaption{#4}{#2}{#3}}} \def\dopreparestackcaptionwid#1#2#3#4% - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox - {\hsize\@@kjkjwidth - \putcompletecaption{#4}{#2}{#3}{0}}} + {\dosettempcaptionbox + {\hsize\floatcaptionparameter\c!width + \putcompletecaption{#4}{#2}{#3}}} \def\dopreparestackcaptionmin#1#2#3#4% - {\raggedcenter % the default - \dosetraggedvbox\@@kjkjalign % when given - \setbox\tempcaptionbox\raggedbox % vbox, keeps footnotes + {\dosettempcaptionbox {\hsize\wd\tempfloatbox - \putcompletecaption{#4}{#2}{#3}{0}}} + \doifnothing{\floatcaptionparameter\c!align}\raggedcenter % on purpose overloads align ! + \putcompletecaption{#4}{#2}{#3}}} \def\dopreparestackcaptionaut#1#2#3#4% - {\doifsomething\@@kjkjalign - {\ExpandBothAfter\doifnotinset\v!middle\@@kjkjalign + {\doifsomething{\floatcaptionparameter\c!align} + {\doifnotinset{\v!middle}{\floatcaptionparameter\c!align}% {\let\captionovershoot\!!zeropoint}}% \edef\captionhsize{\the\wd\tempfloatbox}% \ifdim\captionhsize>\hsize % float is wider than \hsize - \dosetraggedvbox\@@kjkjalign - \setbox\scratchbox\raggedbox % trial run + \dosettempcaptionbox {\trialtypesettingtrue \hsize\captionhsize \notesenabledfalse - \putcompletecaption{#4}{#2}{#3}{0}}% + \putcompletecaption{#4}{#2}{#3}}% \ifdim\ht\scratchbox>\lineheight % more lines - \dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox + \dosettempcaptionbox {\hsize\captionhsize \advance\hsize -\captionovershoot\relax \ifdim\hsize<\captionminwidth\relax \hsize\captionhsize \fi - \putcompletecaption{#4}{#2}{#3}{0}}% + \putcompletecaption{#4}{#2}{#3}}% \else - \setbox\tempcaptionbox\raggedbox + \dosettempcaptionbox {\hsize\captionhsize - \putcompletecaption{#4}{#2}{#3}{0}}% + \putcompletecaption{#4}{#2}{#3}}% \fi \else % float is smaller of equal to \hsize @@ -1617,141 +1609,408 @@ \advance\scratchdimen 3em % an average word length \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi \notesenabledfalse - \putcompletecaption{#4}{#2}{#3}{0}}% + \putcompletecaption{#4}{#2}{#3}}% \ifdim\ht\scratchbox>\lineheight % at least an average word longer than a line - \dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox + \dosettempcaptionbox {\scratchdimen\captionhsize \advance\scratchdimen \captionovershoot \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi - \putcompletecaption{#4}{#2}{#3}{0}}% + \putcompletecaption{#4}{#2}{#3}}% \else - % just over a line, don't use an overshoot - \expanded{\doifcommonelse{\@@kjkjalign}}{\v!left,\v!right,\v!flushleft,\v!flushright} - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox + % just over a line, don't use an overshoot % % % todo: outer/inner and such + \doifcommonelse{\floatcaptionparameter\c!align}{\v!left,\v!right,\v!flushleft,\v!flushright} + {\dosettempcaptionbox {\hsize\captionhsize % strange : \raggedcenter - \putcompletecaption{#4}{#2}{#3}{0}}} + \putcompletecaption{#4}{#2}{#3}}} {% nicer - \setbox\tempcaptionbox\cbox + \dosettempcaptionbox {\hsize\captionhsize - \putcompletecaption{#4}{#2}{#3}{0}}}% + \doifnothing{\floatcaptionparameter\c!align}\raggedcenter% overloads + \putcompletecaption{#4}{#2}{#3}}}% \fi \fi} \def\dopreparesidecaption#1#2#3#4% - {\dimen0\hsize - \advance\dimen0 -\wd\tempfloatbox - \advance\dimen0 -\@@bkmargin\relax % was \tfskipsize\relax - \ifdim\wd\tempcaptionbox>\dimen0 - \dimen2=1.3\dimen0 - \ifdim\wd\tempcaptionbox<\dimen2 - \dimen0=0.8\dimen0 + {\scratchdimen\dimexpr\hsize-\wd\tempfloatbox-\@@bkmargin\relax % was \tfskipsize\relax + \ifdim\wd\tempcaptionbox>\scratchdimen + \ifdim\wd\tempcaptionbox<1.3\scratchdimen + \scratchdimen0.8\scratchdimen \fi \fi - \setbox\tempcaptionbox\vbox - {\hsize\dimen0 - \raggedright - \putcompletecaption{#4}{#2}{#3}{1}}} + \dosettempcaptionbox % \setbox\tempcaptionbox\vbox + {\hsize\scratchdimen + \doifnothing{\floatcaptionparameter\c!align}\raggedright % on purpose overloads align ! + \putcompletecaption{#4}{#2}{#3}}} + +\newdimen\tempfloatheight +\newdimen\tempfloatwidth + +\def\dofloatboxbetweenstack + {\endgraf\nointerlineskip\floatcaptionparameter\c!inbetween\endgraf} + +\def\dofloatboxdefaultbuilder % done + {\locatefloat{\box\tempfloatbox}} + +\def\dofloatboxnextrightbuilder#1% + {\ifparfloat \hbox \else \expandafter \locatefloat \fi + {\tempfloatheight\ht\tempfloatbox + \box\tempfloatbox + \expanded{\doifnotinset{\v!hang}{\floatcaptionparameter\c!location}}{\dotfskip{\floatcaptionparameter\c!distance}}% + \vbox to\tempfloatheight{#1}}} + +\def\dofloatboxnextleftbuilder#1% + {\ifparfloat \hbox \else \expandafter \locatefloat \fi + {\tempfloatheight\ht\tempfloatbox + \vbox to\tempfloatheight{#1}% + \expanded{\doifnotinset{\v!hang}{\floatcaptionparameter\c!location}}{\dotfskip{\floatcaptionparameter\c!distance}}% + \box\tempfloatbox}} + +\def\dofloatboxnextouterbuilder + {\doifrightpagefloatelse\dofloatboxnextrightbuilder\dofloatboxnextleftbuilder} +\def\dofloatboxnextinnerbuilder + {\doifrightpagefloatelse\dofloatboxnextleftbuilder\dofloatboxnextrightbuilder} + +\def\dofloatboxnextrighthangbuilder#1% + {\ifparfloat \hbox \else \expandafter \locatefloat \fi + {\tempfloatheight\ht\tempfloatbox + \box\tempfloatbox + \vbox to\tempfloatheight{#1}}} + +\def\dofloatboxnextlefthangbuilder#1% + {\ifparfloat \hbox \else \expandafter \locatefloat \fi + {\tempfloatheight\ht\tempfloatbox + \vbox to\tempfloatheight{#1}% + \box\tempfloatbox}} + +\def\dodofloatboxnextrightmarginbuilder#1#2% + {\ifparfloat + \hbox\bgroup + \tempfloatheight\ht\tempfloatbox + \box\tempfloatbox + \hsmash{\hskip#1\vbox to\tempfloatheight{#2}}% + \egroup + \else + \begingroup + \tempfloatheight\ht\tempfloatbox + \everyrightofalignedline{\hsmash{\hskip#1\vbox to\tempfloatheight{#2}}}% + \locatefloat{\box\tempfloatbox}% + \endgroup + \fi} + +\def\dodofloatboxnextleftmarginbuilder#1#2% + {\ifparfloat + \hbox\bgroup + \tempfloatheight\ht\tempfloatbox + \hsmash{\hskip-\dimexpr#1+\wd\tempcaptionbox\relax\vbox to\tempfloatheight{#2}}% + \box\tempfloatbox + \egroup + \else + \begingroup + \tempfloatheight\ht\tempfloatbox + \everyleftofalignedline{\hsmash{\hskip-\dimexpr#1+\wd\tempcaptionbox\relax\vbox to\tempfloatheight{#2}}}% + \locatefloat{\box\tempfloatbox}% + \endgroup + \fi} + +\def\dofloatboxnextrightmarginbuilder{\dodofloatboxnextrightmarginbuilder\rightmargindistance} +\def\dofloatboxnextleftmarginbuilder {\dodofloatboxnextleftmarginbuilder \leftmargindistance } + +\def\dofloatboxnextoutermarginbuilder + {\doifrightpagefloatelse + {\dodofloatboxnextrightmarginbuilder\rightmargindistance} + {\dodofloatboxnextleftmarginbuilder \rightmargindistance}} + +\def\dofloatboxnextinnermarginbuilder + {\doifrightpagefloatelse + {\dodofloatboxnextleftmarginbuilder \leftmargindistance} + {\dodofloatboxnextrightmarginbuilder\leftmargindistance}} + +\def\dofloatboxnextbuilder % beware, we first check on left/rightmargin because there can be left/right also + {\let\next\dofloatboxnextleftbuilder + \expanded{\processallactionsinset[\floatcaptionparameter\c!location]} + [ \v!outermargin=>\let\next\dofloatboxnextoutermarginbuilder, + \v!innermargin=>\let\next\dofloatboxnextinnermarginbuilder, + \v!leftmargin=>\let\next\dofloatboxnextleftmarginbuilder, + \v!rightmargin=>\let\next\dofloatboxnextrightmarginbuilder, + \v!lefthanging=>\let\next\dofloatboxnextlefthangbuilder, + \v!righthanging=>\let\next\dofloatboxnextrighthangbuilder, + \v!outer=>\let\next\dofloatboxnextouterbuilder, + \v!inner=>\let\next\dofloatboxnextinnerbuilder, + \v!left=>\let\next\dofloatboxnextleftbuilder, + \v!right=>\let\next\dofloatboxnextrightbuilder]% + \next} + +\def\dofloatboxsidebuilder + {\ifparfloat + \let\next\dofloatboxhighbuilder + \else + \let\next\dofloatboxmiddlebuilder + \expanded{\processallactionsinset[\floatcaptionparameter\c!location]} + [ \v!low=>\let\next\dofloatboxlowbuilder, + \v!middle=>\let\next\dofloatboxmiddlebuilder, + \v!high=>\let\next\dofloatboxhighbuilder]% + \fi + \next} + +\def\doflushfloatleftcaptionhang + {\hsmash{\llap{\box\tempcaptionbox\dotfskip{\floatcaptionparameter\c!distance}}}} +\def\doflushfloatrightcaptionhang + {\hsmash{\rlap{\dotfskip{\floatcaptionparameter\c!distance}\box\tempcaptionbox}}} + +\def\doflushfloatcaptionhang + {\expanded{\doifinsetelse{\v!righthanging}{\floatcaptionparameter\c!location}} + {\doflushfloatrightcaptionhang} + {\expanded{\doifinsetelse{\v!lefthanging}{\floatcaptionparameter\c!location}} + {\doflushfloatleftcaptionhang} + {\expanded{\doifinsetelse{\v!hang}{\floatcaptionparameter\c!location}} + {\expanded{\doifinsetelse{\v!outer}{\floatcaptionparameter\c!location}} + {\doifrightpagefloatelse{\doflushfloatrightcaptionhang}{\doflushfloatleftcaptionhang}} + {\expanded{\doifinsetelse{\v!right}{\floatcaptiondirectives}} + {\doflushfloatrightcaptionhang} + {\doflushfloatleftcaptionhang}}} + {\box\tempcaptionbox}}}} + +\def\dofloatboxhighbuilder + {\dofloatboxnextbuilder{\dofloatboxbetweenstack\doflushfloatcaptionhang\vfill}} + +\def\dofloatboxlowbuilder + {\dofloatboxnextbuilder{\vfill\doflushfloatcaptionhang\dofloatboxbetweenstack}} + +\def\dofloatboxmiddlebuilder + {\dofloatboxnextbuilder{\vfill\box\tempcaptionbox\vfill}} + +% \def\dofloatboxnormalstackbuilder#1#2#3#4% hbox needed +% {\tempfloatwidth\wd\tempfloatbox +% \ifparfloat +% \hbox{#3}\dofloatboxbetweenstack\hbox{#4}% +% \else +% \hbox{#1}\dofloatboxbetweenstack\hbox{#2}% +% \fi} + +% \def\dofloatboxgridstackbuilder#1#2#3#4% +% {\dp\tempcaptionbox\strutdepth +% \setbox\scratchbox\vbox +% {\tempfloatwidth\wd\tempfloatbox +% \ifparfloat +% #3\vss\dofloatboxbetweenstack#4% +% \else +% #1\vss\dofloatboxbetweenstack#2% +% \fi}% +% \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy +% \vbox to \noflines\lineheight{\unvbox\scratchbox}} + +% \def\dofloatboxstretchstackbuilder#1#2#3#4% +% {\dp\tempcaptionbox\strutdepth +% \setbox\scratchbox\vbox +% {\locatefloat{\copy#1}% +% \locatefloat{\copy#2}}% +% \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy +% \vbox to \noflines\lineheight +% {\tempfloatwidth\wd\tempfloatbox +% \ifparfloat +% #3\vss\dofloatboxbetweenstack\vss#4% +% \else +% #1\vss\dofloatboxbetweenstack\vss#2% +% \fi}} -\def\buildfloatbox % todo: installable, also vertical align caption relative to floatbox +% \def\dofloatboxtopbuilder +% {\let\next\dofloatboxnormalstackbuilder +% \expanded{\processallactionsinset[\floatcaptionparameter\c!location]} +% [ \v!grid=>\let\next\dofloatboxgridstackbuilder, +% \v!stretch=>\let\next\dofloatboxstretchstackbuilder]% +% \next +% {\locatetextfloat{\box\tempcaptionbox}} +% {\locatefloat {\box\tempfloatbox }} +% {\locatesidefloat{\box\tempcaptionbox}} +% {\hbox {\box\tempfloatbox }}} + +% \def\dofloatboxbottombuilder +% {\let\next\dofloatboxnormalstackbuilder +% \expanded{\processallactionsinset[\floatcaptionparameter\c!location]} +% [ \v!grid=>\let\next\dofloatboxgridstackbuilder, +% \v!stretch=>\let\next\dofloatboxstretchstackbuilder]% +% \next +% {\locatefloat {\box\tempfloatbox }} +% {\locatetextfloat{\box\tempcaptionbox}} +% {\hbox {\box\tempfloatbox }} +% {\locatesidefloat{\box\tempcaptionbox}}} + +% \definefloat +% [lefty][lefties][figure] +% \setupfloat +% [lefty] +% [default=left, +% rightmargindistance=-2cm, +% leftmargindistance=-2cm] +% \setupcaption +% [lefty] +% [location={bottom,overlay}] +% +% \starttext +% \placelefty{}{} \input tufte \input tufte +% \placelefty{}{} \input tufte \input tufte +% \stoptext + +\def\bothangfloat#1{\ruledvbox to \ht\tempfloatbox{#1\vss}} +\def\tophangfloat#1{\ruledvbox to \ht\tempfloatbox{\vss#1}} + +\def\dofloatboxnormaltopstackbuilder + {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\tophangfloat + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \hbox{\locatesidefloat{\box\tempcaptionbox}}% + \dofloatboxbetweenstack + \hbox{\hbox {\box\tempfloatbox }}% + \else + \hbox{\locatetextfloat{\box\tempcaptionbox}} + \dofloatboxbetweenstack + \hbox{\locatefloat {\box\tempfloatbox }}% + \fi}} + +\def\dofloatboxnormalbotstackbuilder + {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\bothangfloat + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \hbox{\hbox {\box\tempfloatbox }}% + \dofloatboxbetweenstack + \hbox{\locatesidefloat{\box\tempcaptionbox}}% + \else + \hbox{\locatefloat {\box\tempfloatbox }}% + \dofloatboxbetweenstack + \hbox{\locatetextfloat{\box\tempcaptionbox}}% + \fi}} + +\def\dofloatboxgridtopstackbuilder + {\dp\tempcaptionbox\strutdepth + \setbox\scratchbox\vbox + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \locatesidefloat{\box\tempcaptionbox}% + \vss\dofloatboxbetweenstack + \hbox {\box\tempfloatbox }% + \else + \locatetextfloat{\box\tempcaptionbox}% + \vss\dofloatboxbetweenstack + \locatefloat {\box\tempfloatbox }% + \fi}% + \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy + \vbox to \noflines\lineheight{\unvbox\scratchbox}} + +\def\dofloatboxgridbotstackbuilder + {\dp\tempcaptionbox\strutdepth + \setbox\scratchbox\vbox + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \hbox {\box\tempfloatbox }% + \vss\dofloatboxbetweenstack + \locatesidefloat{\box\tempcaptionbox}% + \else + \locatefloat {\box\tempfloatbox }% + \vss\dofloatboxbetweenstack + \locatetextfloat{\box\tempcaptionbox}% + \fi}% + \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy + \vbox to \noflines\lineheight{\unvbox\scratchbox}} + +\def\dofloatboxstretchtopstackbuilder + {\dp\tempcaptionbox\strutdepth + \setbox\scratchbox\vbox + {\locatefloat{\copy\tempcaptionbox}% + \locatefloat{\copy\tempfloatbox }}% + \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy + \vbox to \noflines\lineheight + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \locatesidefloat{\box\tempcaptionbox}% + \vss\dofloatboxbetweenstack\vss + \hbox {\box\tempfloatbox }% + \else + \locatetextfloat{\box\tempcaptionbox}% + \vss\dofloatboxbetweenstack\vss + \locatefloat {\box\tempfloatbox }% + \fi}} + +\def\dofloatboxstretchbotstackbuilder + {\dp\tempcaptionbox\strutdepth + \setbox\scratchbox\vbox + {\locatefloat{\copy\tempfloatbox }% + \locatefloat{\copy\tempcaptionbox}}% + \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy + \vbox to \noflines\lineheight + {\tempfloatwidth\wd\tempfloatbox + \ifparfloat + \hbox {\box\tempfloatbox }% + \vss\dofloatboxbetweenstack\vss + \locatesidefloat{\box\tempcaptionbox} + \else + \locatefloat {\box\tempfloatbox }% + \vss\dofloatboxbetweenstack\vss + \locatetextfloat{\box\tempcaptionbox}% + \fi}} + +\def\dofloatboxtopbuilder + {\let\next\dofloatboxnormaltopstackbuilder + \expanded{\processfirstactioninset[\floatcaptionparameter\c!location]} + [ \v!grid=>\let\next\dofloatboxgridstackbuilder, + \v!stretch=>\let\next\dofloatboxstretchstackbuilder]% + \next} + +\def\dofloatboxbottombuilder + {\let\next\dofloatboxnormalbotstackbuilder + \expanded{\processfirstactioninset[\floatcaptionparameter\c!location]} + [ \v!grid=>\let\next\dofloatboxgridstackbuilder, + \v!stretch=>\let\next\dofloatboxstretchstackbuilder]% + \next} + +\def\relocatecaptionright#1{\locatefloat{\hbox to \tempfloatwidth{\hss#1}}} +\def\relocatecaptionleft #1{\locatefloat{\hbox to \tempfloatwidth{#1\hss}}} + +\long\def\installfloatboxbuilder#1#2{\setvalue{\??kj:#1}{#2}} + +\def\buildfloatbox {\global\setbox\floatbox\vbox {\setlocalfloathsize \forgetall - \processaction - [\@@kjkjlocation] - [ \v!top=>\locatefloat{\box\tempcaptionbox}% - \endgraf\nointerlineskip\@@kjkjinbetween - \locatefloat{\box\tempfloatbox}, - \v!bottom=>\locatefloat{\box\tempfloatbox}% - \endgraf\nointerlineskip\@@kjkjinbetween - \locatefloat{\box\tempcaptionbox}, - \v!high=>\locatefloat - {\doifelse\@@flfllocation\v!left - {\box\tempfloatbox - \dotfskip\@@kjkjdistance - \vbox to\ht\tempfloatbox{\@@kjkjinbetween\box\tempcaptionbox\vfill}} - {\vbox to\ht\tempfloatbox{\@@kjkjinbetween\box\tempcaptionbox\vfill}% - \tfskip - \box\tempfloatbox}}, - \v!low=>\locatefloat - {\doifelse\@@flfllocation\v!left - {\box\tempfloatbox - \dotfskip\@@kjkjdistance - \vbox to\ht\tempfloatbox - {\vfill\box\tempcaptionbox\@@kjkjinbetween}} - {\vbox to\ht\tempfloatbox - {\vfill\box\tempcaptionbox\@@kjkjinbetween}% - \dotfskip\@@kjkjdistance - \box\tempfloatbox}}, - \v!middle=>\locatefloat - {\doifelse\@@flfllocation\v!left - {\box\tempfloatbox - \dotfskip\@@kjkjdistance - \vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}} - {\vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}% - \dotfskip\@@kjkjdistance - \box\tempfloatbox}}, - \s!unknown=>\locatefloat{\box\tempfloatbox}, - \v!none=>\locatefloat{\box\tempfloatbox}]}} + \let\floatcaptionarrangement\s!default + \def\docommand##1% + {\doifdefined{\??kj:##1}{\def\floatcaptionarrangement{##1}\quitcommalist}}% + \processcommacommand[\floatcaptionparameter\c!location]\docommand + \executeifdefined{\??kj:\floatcaptionarrangement}{\getvalue{\??kj:\s!default}}}} + +\def\locatetextfloat + {\let\next\locatefloat + \expanded{\processallactionsinset[\floatcaptionparameter\c!location]} + [ \v!left=>\let\next\relocatecaptionleft, + \v!right=>\let\next\relocatecaptionright, + \v!inner=>\doifrightpagefloatelse{\let\next\relocatecaptionleft }{\let\next\relocatecaptionright}, + \v!outer=>\doifrightpagefloatelse{\let\next\relocatecaptionright}{\let\next\relocatecaptionleft }]% + \next} + +\installfloatboxbuilder \v!none \dofloatboxdefaultbuilder +\installfloatboxbuilder \s!default \dofloatboxdefaultbuilder +\installfloatboxbuilder \v!high \dofloatboxhighbuilder +\installfloatboxbuilder \v!low \dofloatboxlowbuilder +\installfloatboxbuilder \v!middle \dofloatboxmiddlebuilder + +\installfloatboxbuilder \v!left \dofloatboxsidebuilder +\installfloatboxbuilder \v!right \dofloatboxsidebuilder + +\installfloatboxbuilder \v!top \dofloatboxtopbuilder +\installfloatboxbuilder \v!bottom \dofloatboxbottombuilder + +% \setuplayout[grid=yes] \showgrid \setupcaptions[style=smallbodyfont,location=grid,inbetween=] +% +% \starttext +% test \placefigure{} {\externalfigure[cow.pdf][frame=on,grid=yes]} test \page +% test \placefigure{\input zapf\relax}{\externalfigure[cow.pdf][frame=on,grid=yes]} test \page +% test \placefigure{} {\externalfigure[cow.pdf][frame=on,grid=depth]} test \page +% test \placefigure{\input zapf\relax}{\externalfigure[cow.pdf][frame=on,grid=depth]} test \page +% \stoptext \newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change -%\def\postcenterfloatbox#1% -% {\ifinsidecolumns -% \ifpostponecolumnfloats -% \scratchdimen=\zetbreedte -% \else -% \scratchdimen=#1\relax -% \fi -% \else\ifdim#1>\hsize -% \scratchdimen=\hsize -% \else -% \scratchdimen=\wd\floatbox -% \fi\fi -% \global\setbox\floatbox=\hbox to \scratchdimen -% {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! - -% \def\postcenterfloatbox#1% 2 of 4 -% {\global\floatwidth\wd\ifdim\wd2>\wd4 2 \else 4 \fi -% \ifdim\floatwidth>\zetbreedte -% \global\floatwidth\zetbreedte -% \else\ifdim\floatwidth<\hsize -% \global\floatwidth\hsize -% \fi\fi -% \global\setbox\floatbox=\hbox to \floatwidth -% {\hss\box\floatbox\hss}} - -% \def\postcenterfloatbox#1% 2 of 4 -% {\global\setbox\floatbox=\hbox to \width % \wd\ifdim\wd2>\wd4 2\else4\fi -% {\hss\box\floatbox\hss}% -% \ifdim\wd\floatbox>\zetbreedte -% \global\setbox\floatbox=\hbox to \zetbreedte -% {\hss\box\floatbox\hss}% -% \else\ifcenterfloatbox\ifdim\wd\floatbox<\hsize -% % \global\setbox\floatbox=\hbox to \hsize -% % {\hss\box\floatbox\hss}% -% \fi\fi\fi -% \global\floatwidth\wd\floatbox} - -%\def\postcenterfloatbox#1% -% {\ifinsidecolumns -% \ifpostponecolumnfloats -% \scratchdimen\zetbreedte -% \else -% \scratchdimen#1\relax -% \fi -% \else\ifdim#1>\hsize -% \scratchdimen\hsize -% \else -% \scratchdimen\wd\floatbox -% \fi\fi -% \global\setbox\floatbox\hbox to \scratchdimen -% % {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! -% {\hss \box\floatbox\hss }} % wel \hss, anders mis in colset - \chardef\postcenterfloatmethod\plusone \def\postcenterfloatbox#1% @@ -1794,56 +2053,47 @@ \ifnofloatcaption \global\setbox\floatbox\vbox{\box\tempfloatbox}% \else - \doifelse\@@kjkjwidth\v!max - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox - {\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}}% - {\doifelse\@@kjkjwidth\v!fit - {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox\relax - \setbox\tempcaptionbox\vbox - {\forgetall\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}% - \else - \setbox\tempcaptionbox\hbox to \wd\tempfloatbox - {\hss\box\tempcaptionbox\hss}% - \fi} - {\dosetraggedvbox\@@kjkjalign - \setbox\tempcaptionbox\raggedbox - {\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}}}% - \setbox\tempcaptionbox\hbox{\@@kjkjcommand{\box\tempcaptionbox}}% - \moveboxontogrid\tempcaptionbox\@@kjkjgrid\lastcaptionht + \dopreparedosidecaption{#1}{#2}{#3}{#4}% + \settracedcaptionbox + \setbox\tempcaptionbox\hbox{\floatcaptionparameter\c!command{\box\tempcaptionbox}}% + \moveboxontogrid\tempcaptionbox{\floatcaptionparameter\c!grid}\lastcaptionht \addlocalbackgroundtobox\tempcaptionbox % no \doglobal - \global\setbox\floatbox\vbox - {\processaction - [\@@kjkjlocation] - [ \v!top=>\box\tempcaptionbox - \endgraf\nointerlineskip\@@kjkjinbetween - \box\tempfloatbox, - \v!bottom=>\box\tempfloatbox - \endgraf\nointerlineskip\@@kjkjinbetween - \box\tempcaptionbox, - \v!none=>\box\tempfloatbox, - \s!unknown=>\box\tempfloatbox - \endgraf\nointerlineskip\@@kjkjinbetween - \box\tempcaptionbox]}% + \buildsidefloatbox \fi -% \doglobal\addlocalbackgroundtobox\floatbox \egroup} +\def\dopreparedosidecaption#1#2#3#4% will be enhanced + {\doifelse{\floatcaptionparameter\c!width}\v!max + {\dosettempcaptionbox + {\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}}}% + {\doifelse{\floatcaptionparameter\c!width}\v!fit + {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox\relax + \setbox\tempcaptionbox\vbox + {\forgetall\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}}% + \else + \setbox\tempcaptionbox\hbox to \wd\tempfloatbox + {\hss\box\tempcaptionbox\hss}% + \fi} + {\dosettempcaptionbox + {\hsize\floatcaptionparameter\c!width % \wd\tempfloatbox + \putcompletecaption{#4}{#2}{#3}}}}} + +\def\buildsidefloatbox + {\let\locatefloat\relax + \def\locatesidefloat##1% + {\begingroup + \chardef\alignstrutmode\zerocount + \hsize\tempfloatwidth \forgetall + \alignedline{\floatparameter\c!location}\v!middle{##1}% + \endgroup}% + \buildfloatbox} + \newif\ifparfloat \long\def\dosetfloatbox#1#2#3#4% todo : \global\setbox {\ifvisible \par - \edef\@@kjkjlocation {\getvalue{\??kj#4\c!location}}% - \edef\@@kjkjgrid {\getvalue{\??kj#4\c!grid}}% new - \def\@@kjkjinbetween{\getvalue{\??kj#4\c!inbetween}}% no \edef - \def\@@kjkjcommand {\getvalue{\??kj#4\c!command}}% no \edef - \edef\@@kjkjwidth {\getvalue{\??kj#4\c!width}}% - \edef\@@kjkjminwidth {\getvalue{\??kj#4\c!minwidth}}% in geval van automatisch - \edef\@@kjkjdistance {\getvalue{\??kj#4\c!distance}}% - \edef\@@kjkjalign {\getvalue{\??kj#4\c!align}}% - \def\@@kjkjstopper {\getvalue{\??kj#4\c!stopper}}% - \edef\@@flfllocation {\getvalue{\??fl#4\c!location}}% + \edef\floatcaptiondirectives{\floatparameter\c!location,\floatcaptionparameter\c!location}% \ifparfloat \@EA\dosetparfloat % {#1}{#2}{#3}{#4}% \else @@ -1876,18 +2126,6 @@ \newcounter\noxfloatlocations -% \long\def\dofloat#1#2#3#4% -% {\dosetfloatbox{#1}{#2}{#3}{#4}% -% \doifelsevaluenothing{\??fl#4\c!criterium} -% {\dogetfloatbox{#1}\empty} -% {\ifdim\wd\floatbox>\getvalue{\??fl#4\c!criterium}\relax -% \postcenterfloatbox{\wd\floatbox}% else we get left aligned -% %dogetfloatbox{#1}\v!here % see details/pascal -% \dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% -% \else -% \dogetfloatbox{#1}\empty -% \fi}} - \long\def\dofloat#1#2#3#4% {\dosetfloatbox{#1}{#2}{#3}{#4}% \dogetfloatbox{#1}\empty} @@ -1901,51 +2139,6 @@ \xdef\naturalfloatwidth {\the\wd#1}% \xdef\naturalfloatdepth {\the\dp#1}} -% \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number -% {%\flushsidefloats % moved -% \presetfloatvariables{#1}{#4}{#2}{#6}% -% \bgroup -% \setnaturalfloatdimensions#7% -% \global\setbox\floatbox\vbox -% {\executeifdefined{\??fl#1\c!command}\firstofoneargument{\box#7}}% -% \setnaturalfloatdimensions\floatbox -% \dimen0 \ht\floatbox -% \advance\dimen0 \dp\floatbox -% \ifdim\dimen0=\zeropoint -% \showmessage\m!floatblocks{11}\empty -% \global\setbox\floatbox\vbox{\doemptyblock{#3}}% -% \fi -% \ifnofloatcaption -% \global\setbox\floatbox\vbox -% {\unvbox\floatbox -% \vss % gets rid of the depth (unless tabulate) -% \rawpagereference\s!flt{#2}}% -% \egroup -% \dofloat{#4}{}{#6}{#1}% -% \else -% \doglobal\convertargument#6\to\asciititle % \asciititle is global -% \ifnofloatnumber -% \global\setbox\floatbox\vbox -% {\unvbox\floatbox % no \vss, keep the depth -% \rawreference\s!flt{#2}{{}{\asciititle}}}% -% \egroup -% \dofloat{#4}{}{#6}{#1}% -% \else -% \incrementnumber[#1]% -% \makesectionnumber[#1]% -% \global\setbox\floatbox\vbox -% {\unvbox\floatbox % no \vss, keep the depth -% \dofloatreference -% \redofloatorder{#1}% -% \rawreference\s!flt{#2}{{\composedsectionnumber}{\asciititle}}% -% \dowritetolist{#3}{\composedsectionnumber}{#6}{#3}}% -% \egroup -% \preparefullnumber{\??kj#1}\composedsectionnumber\preparednumber -% \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}% -% \fi -% \fi -% \global\insidefloatfalse} - \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number {%\flushsidefloats % moved \presetfloatvariables{#1}{#4}{#2}{#6}% @@ -2075,23 +2268,11 @@ \box\preparedmarginbox}}% \processaction % traag [\@@mblocation] - [ \v!inmargin=>\doifbothsidesoverruled - \rightmarginbox - \orsideone - \rightmarginbox - \orsidetwo - \leftmarginbox - \od, - \v!middle=>\doifbothsidesoverruled - \rightmarginbox - \orsideone - \leftmarginbox - \orsidetwo - \rightmarginbox - \od, - \v!left=>\leftmarginbox, - \v!right=>\rightmarginbox, - \s!unknown=>\setbox\preparedmarginbox\hbox{}]} + [ \v!inmargin=>\doifbothsidesoverruled\rightmarginbox\rightmarginbox\leftmarginbox, + \v!middle=>\doifbothsidesoverruled\rightmarginbox\leftmarginbox\rightmarginbox, + \v!left=>\leftmarginbox, + \v!right=>\rightmarginbox, + \s!unknown=>\setbox\preparedmarginbox\hbox{}]} \def\dostartmarginblock % 2 maal \vbox ivm \unvbox elders {\global\setbox\marginbox\vtop\bgroup\vbox\bgroup @@ -2271,9 +2452,12 @@ \setupcaptions [\c!location=\v!bottom, \c!grid=, - \c!before=\blank, + \c!before=, % not used (yet) \c!inbetween={\blank[\v!medium]}, - \c!after=\blank, + \c!after=, % not used (yet) +\c!spacebefore=, +\c!spaceinbetween=, % replaces fuzzy inbetween dual usage +\c!spaceafter=, \c!width=\v!fit, \c!minwidth=\v!fit, % id est: the width of the floatbox in some cases \c!headstyle=\v!bold, @@ -2296,8 +2480,8 @@ \setupfloats [\c!location=\v!middle, - \c!width=\v!fit, - \c!height=\v!fit, + \c!width=8\lineheight, + \c!height=6\lineheight, \c!offset=\v!overlay, \c!frame=\v!off, \c!radius=.5\bodyfontsize, diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index b64a543cf..bdb3a7b65 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -30,12 +30,9 @@ \def\clippedprintbox#1#2% can be made more efficient, see other clipper {\ifclipprintbox - \!!widthc\pagebackgroundoffset - \!!widtha \paperwidth - \advance\!!widtha \!!widthc - \!!heighta\paperheight - \advance\!!heighta\!!widthc - \advance\!!heighta\!!widthc + \!!widthc \pagebackgroundoffset + \!!widtha \dimexpr\paperwidth + \!!widthc\relax + \!!heighta\dimexpr\paperheight+2\!!widthc\relax \setbox#2\vbox to \paperheight{\vfill\box#2}% \ht#2\paperheight \wd#2\paperwidth @@ -80,40 +77,51 @@ \!!deptha \dp#1% \setbox#1\hbox {\!!widthb \@@lyclipoffset - \advance\!!heighta\!!deptha - \advance\!!heighta2\!!widthb - \advance\!!widtha \!!widthb + \advance\!!heighta\dimexpr\!!deptha+2\!!widthb\relax + \advance\!!widtha \!!widthb \doifbothsides - \advance\!!widtha\!!widthb - \!!widthc-\!!widthb - \hskip\!!widthc - \orsideone - \!!widthc\zeropoint - \orsidetwo - \!!widthc-\!!widthb - \hskip\!!widthc - \od + {\advance\!!widtha\!!widthb \!!widthc-\!!widthb \hskip\!!widthc}% + {\!!widthc\zeropoint} + {\!!widthc-\!!widthb \hskip\!!widthc}% \lower\!!widthb\hbox {\clip [\c!hoffset=\!!widthc, \c!voffset=-\!!widthb, - \c!width=\!!widtha, - \c!height=\!!heighta]% + \c!width=\!!widtha, + \c!height=\!!heighta]% {\box#1}}}% \wd#1\!!widtha \ht#1\!!heighta \dp#1\!!deptha \fi} +%D \macros +%D {starttextdata} +%D +%D This is a user macro (appending to every last shipout is not +%D really user friendly. + +\newtoks \collectedtextdata + +\long\def\starttextdata#1\stoptextdata + {\doglobal\appendtoks#1\to\collectedtextdata} + +\def\flushtextdata + {\vsmashed{\the\collectedtextdata}% all dimensions zero + \global\collectedtextdata\emptytoks + \globallet\flushtextdata\donothing} + +\prependtoks \flushtextdata \to \everylastshipout + % moved code: \def\myshipout#1% - {\voorpagina % voor de pagebody dus ! + {\beforeshipout % voor de pagebody dus ! \dontshowcomposition \ifarrangingpages\@EA\actualarrange\else\@EA\actualshipout\fi {\thisisrealpage\realfolio#1}% \gotonextrealpage - \napagina} + \aftershipout} \newbox\postponedcontent @@ -227,7 +235,9 @@ \global\advance\paperwidth -2\scratchdimen \scratchdimen\getvalue{\??pp#1\c!offset}% \divide\scratchdimen \arrangedpageY - \global\advance\paperheight -2\scratchdimen} + \global\advance\paperheight-2\scratchdimen} + +\newconditional\arrangedbackgroundokay % more ifs -> conditionals \def\setuparranging[#1]% {\ifarrangingdisabled \else @@ -250,6 +260,7 @@ 180=>\gdef\arrangedrotationO{180}\gdef\arrangedrotationE{0}, 270=>\gdef\arrangedrotationO{270}\gdef\arrangedrotationE{90}, \s!reset=>\global\arrangingpagesfalse, + \v!background=>\global\settrue\arrangedbackgroundokay, \s!unknown=>\checkinstalledpagearrangement\commalistelement]% % no \s!default=> we can have aaa,,bbb \ifx\handlearrangedpage\undefined @@ -342,8 +353,7 @@ \def\filluparrangedpages % beware: \realpageno is 1 ahead {\ifarrangingpages - \scratchcounter\realpageno - \advance\scratchcounter \minusone + \scratchcounter\numexpr\realpageno-\plusone\relax \dosetmodulo\scratchcounter\arrangedpageT\scratchcounter \ifcase\scratchcounter\else \advance\scratchcounter \plusone @@ -390,7 +400,8 @@ \ifnegatearranged \negatecolorbox{#1}% \fi - \finishpagebox#1 + \finishpagebox#1% + \ifconditional\arrangedbackgroundokay\addprintbackground#1\fi \actualshipout{\box#1}% \egroup} @@ -531,8 +542,7 @@ \def\splitoffarrangedpagesTWO {\splittopskip\zeropoint \global\setbox\arrangedpageA\vsplit\arrangedpageB to \onepoint - \scratchdimen\ht\arrangedpageB - \advance\scratchdimen -\onepoint + \scratchdimen\dimexpr\ht\arrangedpageB-\onepoint\relax \ifdim\scratchdimen>\onepoint \setbox\scratchbox\vsplit\arrangedpageB to \scratchdimen \fi} @@ -761,18 +771,16 @@ {\dosetuparrangement\@@ppnx\@@ppny\@@ppxy\!!zerocount\!!zerocount \pusharrangedpageXY\poparrangedpagesXY\relax} -\beginETEX \dimexpr +%D A crazy definition, don't guess who pushed me for the landscape option. \definepapersize [XY] - [\c!width=\dimexpr(\dimexpr(\@@ppwidth-\numexpr(\@@ppnx-1)\dimexpr(\@@ppdx))/\@@ppnx), - \c!height =\dimexpr(\dimexpr(\@@ppheight -\numexpr(\@@ppny-1)\dimexpr(\@@ppdy))/\@@ppny)] + [\c!height=\dimexpr\dimexpr\@@ppheight-\numexpr\@@ppny-1\relax\dimexpr\@@ppdy\relax\relax/\@@ppny\relax, + \c!width =\dimexpr\dimexpr\@@ppwidth -\numexpr\@@ppnx-1\relax\dimexpr\@@ppdx\relax\relax/\@@ppnx\relax] \setuppaper - [\c!width=\dimexpr(\printpaperwidth-2\dimexpr(\@@ppbackspace)), - \c!height =\dimexpr(\printpaperheight -2\dimexpr(\@@pptopspace))] - -\endETEX + [\c!width =\dimexpr\printpaperwidth -2\dimexpr\@@ppbackspace\relax\relax, + \c!height=\dimexpr\printpaperheight-2\dimexpr\@@pptopspace \relax\relax] % \definepageshift[test][horizontal][10pt,20pt,30pt,40pt,50pt] % \definepageshift[test][vertical] [10pt,20pt,30pt,40pt,50pt] @@ -913,11 +921,11 @@ {\doifelse{#2}\v!odd {\dorecurse\@@ipn {\ifodd\recurselevel\relax\dofilterpage{#1}\recurselevel\fi}} - {\def\dodocommando##1% + {\def\dodocommand##1% {\ifnum##1>\@@ipn\else\dofilterpage{#1}{##1}\fi}% - \def\docommando##1% - {\dowithrange{##1}\dodocommando}% - \processcommalist[#2]\docommando}}% + \def\docommand##1% + {\dowithrange{##1}\dodocommand}% + \processcommalist[#2]\docommand}}% \egroup} \def\dofilterpage#1#2% @@ -1004,82 +1012,117 @@ \c!before=\page,\c!after=\page,\c!inbetween=\blank, \c!frame=,\c!background=,\c!backgroundcolor=, #2]% + \def\@@ipname{#1}% \@@ipbefore - %\doglobal\newcounter\combinedpagescounter - \globallet\combinedpagescounter\@@ipstart - \doifelse\@@ipalternative\v!b\!!doneafalse\!!doneatrue - \if!!donea - \doloop - {\vbox to \textheight - {\hsize\textwidth % ? ? - \scratchdimen\@@ipdistance - \!!widtha\hsize - \advance\!!widtha -\@@ipnx\scratchdimen - \advance\!!widtha \scratchdimen - \divide \!!widtha \@@ipnx - \!!heighta\vsize - \advance\!!heighta -\@@ipny\scratchdimen - \advance\!!heighta \scratchdimen - \divide \!!heighta \@@ipny - \dorecurse\@@ipny - {\hbox to \hsize - {\dorecurse\@@ipnx - {\vbox to \!!heighta - {\hsize\!!widtha - \vsize\!!heighta - \@@iptop - \hbox to \hsize - {\@@ipleft - \ifnum\combinedpagescounter>\@@ipstop\relax - \globallet\@@ipn\!!zerocount - \else\ifnum\combinedpagescounter>\@@ipn \else - \externalfigure[#1] - [\c!object=\v!no, - \c!page=\combinedpagescounter, - \c!factor=\v!max, - \c!background=\@@ipbackground, - \c!backgroundcolor=\@@ipbackgroundcolor, - \c!frame=\@@ipframe]% - \fi\fi - \@@ipright} - \@@ipbottom}% - \doglobal\increment\combinedpagescounter - \hfil}% - \hfilneg} - \vfil}% - \vfilneg}% - \page - \ifnum\combinedpagescounter>\@@ipn \exitloop\fi} - \else - \doloop - {\startbaselinecorrection - \scratchdimen\@@ipdistance - \!!widtha\hsize - \advance\!!widtha -\@@ipnx\scratchdimen - \advance\!!widtha \scratchdimen - \divide \!!widtha \@@ipnx - \hbox to \hsize - {\dorecurse\@@ipnx - {\doglobal\increment\combinedpagescounter - \ifnum\combinedpagescounter>\@@ipn \else - \expanded{\externalfigure[#1] - [\c!page=\combinedpagescounter, - \c!width=\the\!!widtha,% todo \freezedimenmacro - \c!background=\@@ipbackground, - \c!backgroundcolor=\@@ipbackgroundcolor, - \c!frame=\@@ipframe]}% - \hfill - \fi}\hfillneg}% - \stopbaselinecorrection - \ifnum\combinedpagescounter<\@@ipn\relax - \@@ipinbetween - \else - \exitloop - \fi} - \fi + \executeifdefined{\strippedcsname\docombinepages\@@ipalternative}\docombinepagesb \@@ipafter \egroup} +\def\docombinepagesa + {\globallet\combinedpagescounter\@@ipstart + \doloop + {\vbox to \textheight + {\hsize\textwidth % ? ? + \scratchdimen\@@ipdistance + \!!widtha \dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax + \!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax + \dorecurse\@@ipny + {\hbox to \hsize + {\dorecurse\@@ipnx + {\vbox to \!!heighta + {\hsize\!!widtha + \vsize\!!heighta + \@@iptop + \hbox to \hsize + {\@@ipleft + \ifnum\combinedpagescounter>\@@ipstop\relax + \globallet\@@ipn\!!zerocount + \else\ifnum\combinedpagescounter>\@@ipn \else + \externalfigure[\@@ipname] + [\c!object=\v!no, + \c!page=\combinedpagescounter, + \c!factor=\v!max, + \c!background=\@@ipbackground, + \c!backgroundcolor=\@@ipbackgroundcolor, + \c!frame=\@@ipframe]% + \fi\fi + \@@ipright} + \@@ipbottom}% + \doglobal\increment\combinedpagescounter + \hfil}% + \hfilneg} + \vfil}% + \vfilneg}% + \page + \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}} + +\def\docombinepagesc + {\globallet\combinedpagescounter\@@ipstart + \doloop + {\vbox to \textheight + {\hsize\textwidth % ? ? + \scratchdimen\@@ipdistance + \!!widtha \dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax + \!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax + \hbox to \hsize + {\dorecurse\@@ipnx + {\@@ipleft + \vbox to \textheight + {\hsize\!!widtha + {\dorecurse\@@ipny + {\@@iptop + \hbox to \hsize + {\vbox to \!!heighta + {\hsize\!!widtha + \vsize\!!heighta + \ifnum\combinedpagescounter>\@@ipstop\relax + \globallet\@@ipn\!!zerocount + \else\ifnum\combinedpagescounter>\@@ipn \else + \externalfigure[\@@ipname] + [\c!object=\v!no, + \c!page=\combinedpagescounter, + \c!factor=\v!max, + \c!background=\@@ipbackground, + \c!backgroundcolor=\@@ipbackgroundcolor, + \c!frame=\@@ipframe]% + \fi\fi}} + \doglobal\increment\combinedpagescounter + \@@ipbottom}% + \vfil}% + \vfilneg} + \hfil}% + \hfilneg}} + \page + \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}} + +\let\docombinepageshorizontal\docombinepagesa +\let\docombinepagesvertical \docombinepagesc + +\def\docombinepagesb + {\globallet\combinedpagescounter\@@ipstart + \doloop + {\startbaselinecorrection + \scratchdimen\@@ipdistance + \!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax + \hbox to \hsize + {\dorecurse\@@ipnx + {\doglobal\increment\combinedpagescounter + \ifnum\combinedpagescounter>\@@ipn \else + \expanded{\externalfigure[\@@ipname] + [\c!page=\combinedpagescounter, + \c!width=\the\!!widtha,% todo \freezedimenmacro + \c!background=\@@ipbackground, + \c!backgroundcolor=\@@ipbackgroundcolor, + \c!frame=\@@ipframe]}% + \hfill + \fi}\hfillneg}% + \stopbaselinecorrection + \ifnum\combinedpagescounter<\@@ipn\relax + \@@ipinbetween + \else + \exitloop + \fi}} + %D \macros %D {setuppagecomment,startpagecomment} %D @@ -1111,13 +1154,13 @@ \processaction [\@@pclocation] [ \v!bottom=>{\setuppapersize[\c!bottom =\vss,\c!top =\vskip\@@pcoffset]}, - \v!top=>{\setuppapersize[\c!top =\vss,\c!bottom =\vskip\@@pcoffset]}, - \v!left=>{\setuppapersize[\c!left =\hss,\c!right=\hskip\@@pcoffset]}, - \v!right=>{\setuppapersize[\c!right=\hss,\c!left =\hskip\@@pcoffset]}]% + \v!top=>{\setuppapersize[\c!top =\vss,\c!bottom =\vskip\@@pcoffset]}, + \v!left=>{\setuppapersize[\c!left =\hss,\c!right=\hskip\@@pcoffset]}, + \v!right=>{\setuppapersize[\c!right=\hss,\c!left =\hskip\@@pcoffset]}]% \definepapersize [\v!pagecomment] [\c!height=\@@pcpaperheight, - \c!width=\@@pcpaperwidth]% + \c!width=\@@pcpaperwidth]% \let\@@pcprintpapersize\printpapersize \setuppapersize[\papersize][\v!pagecomment]% \setupbackgrounds[\v!paper][\c!background=\v!pagecomment]} diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index 826ecd350..020fd20cf 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -13,6 +13,8 @@ \writestatus{loading}{Context Page Macros / Initializations} +% still a dutch/english mess + %D This class of modules implements the output routines and %D floating body support. Although the modules are relatively %D new, the code herein is rather old. This reordering was @@ -994,20 +996,6 @@ \setvsize % this is needed for interacting components, like floats and multicolumns \adaptfuzzypagegoal} % watch this hack! -% \def\dofinaloutput#1#2% -% {\beforefinaloutput -% \the\everybeforeshipout -% \ifspecialbasedsettings -% \myshipout{\hbox{\hbox to \zeropoint{\the\pageboundsettings}% -% \hbox{\dopagebody#1#2\setpagecounters}}}% -% \else -% \the\pageboundsettings -% \myshipout{\hbox{\dopagebody#1#2\setpagecounters}}% -% \fi -% \the\everyaftershipout -% \afterfinaloutput -% \popproperties} % ... and here ... - \def\dofinaloutput#1#2% \vbox: prevents spurious spaces in every..pagebody {\beforefinaloutput \the\everybeforeshipout @@ -1036,25 +1024,28 @@ \afterfinaloutput \popproperties} % ... and here -% beware: \ifverwerken is in use +% beware: \ifprocessingpages is in use + +\ifx\checkpageversion\undefined \let\checkpageversion\relax \fi % todo: hook into \everybeforeshipout +\ifx\doflushspread \undefined \let\doflushspread \relax \fi % todo \def\finaloutput#1#2% {\checkpageversion - \ifverwerken - \ifgeselecteerd + \ifprocessingpages + \ifpageselected \@EAEAEA\dofinaloutput \else \@EAEAEA\donofinaloutput \fi \else - \ifgeselecteerd + \ifpageselected \@EAEAEA\donofinaloutput \else \@EAEAEA\dofinaloutput \fi \fi#1#2% \resetselectiepagina - \verhoogpaginanummer + \incrementpagenumber \checkpagedimensions \ifnum\outputpenalty>\superpenalty \else \dosupereject @@ -1062,8 +1053,6 @@ \doflushspread \dopostponeblock} -\ifx\doflushspread\undefined \let\doflushspread\relax \fi - \def\dooutput {\finaloutput\unvbox\normalpagebox} @@ -1073,15 +1062,6 @@ % this needs a real cleanup -\chardef\conceptmode\zerocount - -\def\doifconcepttracing - {\ifnum\conceptmode>\plustwo - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} - \def\doplaceversiontext#1#2% {\doifsomething{#2} {\@EA\convertargument#2\to\ascii @@ -1168,15 +1148,15 @@ % this will be inserts some day -% \installinsertion\referentieinfobox +% \installinsertion\referenceinfobox % \installinsertion\registerinfobox % \installinsertion\floatinfobox -\newbox\referentieinfobox +\newbox\referenceinfobox \newbox\registerinfobox \newbox\floatinfobox -\def\referentieinfo{\dotestinfo\referentieinfobox} +\def\referenceinfo{\dotestinfo\referenceinfobox} \def\registerinfo {\dotestinfo\registerinfobox} \def\floatinfo {\dotestinfo\floatinfobox} @@ -1191,10 +1171,10 @@ \unvbox\floatinfobox \vskip\!!twelvepoint \fi - \ifvoid\referentieinfobox\else + \ifvoid\referenceinfobox\else \strut \getmessage\m!systems{25}% \vskip\!!sixpoint - \unvbox\referentieinfobox + \unvbox\referenceinfobox \vskip\!!twelvepoint \fi \ifvoid\registerinfobox\else @@ -1206,8 +1186,6 @@ \version[\v!final] -\newif\ifinpagebody - % bewaren tvb documentatie % % \hbox to \hsize @@ -1248,26 +1226,30 @@ {\dosingleempty\doshowgrid} \def\doshowgrid[#1]% - {\chardef\showgridstate\plusone % downward compatible default - \processaction + {\chardef\showgridstate \plusone % downward compatible default + \chardef\gridboxlinemode \plusone + \chardef\gridboxlinenomode\plusone + \processallactionsinset [#1]% - [\v!reset=>\chardef\showgridstate\zerocount, - %\v!bottom=>\chardef\showgridstate\plusone, - \v!top=>\chardef\showgridstate\plustwo]} + [ \v!reset=>\chardef\showgridstate \zerocount, + \v!bottom=>\chardef\showgridstate \plusone, + \v!top=>\chardef\showgridstate \plustwo, + \v!none=>\chardef\gridboxlinemode \zerocount, + \v!all=>\chardef\gridboxlinemode \plusone, + \v!lines=>\chardef\gridboxlinemode \plustwo, + \v!frame=>\chardef\gridboxlinemode \plusthree, + \v!nonumber=>\chardef\gridboxlinenomode\zerocount, + \v!right=>\chardef\gridboxlinenomode\plusone, + \v!left=>\chardef\gridboxlinenomode\plustwo]} \def\buildpagebox#1% {\setbox#1\vbox to \paperheight {\hsize\paperwidth \vskip\topspace \doifbothsides - \hskip\backspace - \orsideone - \hskip\backspace - \orsidetwo - \hskip\paperwidth - \hskip-\backspace - \hskip-\makeupwidth - \od + {\hskip\backspace} + {\hskip\backspace} + {\hskip\paperwidth \hskip-\backspace \hskip-\makeupwidth}% \box#1}% \dp#1\zeropoint} @@ -1396,13 +1378,13 @@ % \shipoutfacingpage \checkreferences \checkmargeblokken - \dotoks\beforeeverypage + \the\beforeeverypage \flushtoks\beforepage \inpagebodytrue\buildpagebody#1#2% \flushtoks\afterpage - \dotoks\aftereverypage + \the\aftereverypage \resetpagebreak - \updatelistreferences + %updatelistreferences % now in aftereverypage \resetlayouttextlines % will go to \aftereverypage \stoptextproperties \the\everyafterpagebody} @@ -1411,8 +1393,6 @@ \prependtoks \initializepaper \to \pageboundsettings -\let\checkpageversion=\relax - % not here \newif\ifpaginageblokkeerd \paginageblokkeerdfalse @@ -1702,22 +1682,12 @@ \installpagebreakhandler \v!left {\ejectinsert \gotonextpageX % will become \gotonextpage - \doifbothsidesoverruled - \orsideone - \resetcurrentsectionmarks % sic - \ejectdummypage - \orsidetwo - \od} + \doifbothsidesoverruled{}{\resetcurrentsectionmarks\ejectdummypage}{}} \installpagebreakhandler \v!right {\ejectinsert \gotonextpageX % will become \gotonextpage - \doifbothsidesoverruled - \orsideone - \orsidetwo - \resetcurrentsectionmarks % sic - \ejectdummypage - \od} + \doifbothsidesoverruled{}{}{\resetcurrentsectionmarks\ejectdummypage}} \installpagebreakhandler \v!even {\page @@ -1746,12 +1716,9 @@ \gotonextpageX % will become \gotonextpage \relax \doifbothsidesoverruled - \shipoutfacingpage - \orsideone - \orsidetwo - \noheaderandfooterlines - \ejectdummypage - \od + {\shipoutfacingpage} + {} + {\noheaderandfooterlines \ejectdummypage}% \filluparrangedpages} \installpagebreakhandler \v!lastpage % handy for backpage preceded by empty pages @@ -1878,41 +1845,39 @@ % \ignorerestoftext % \to \everylastshipout -\newif\ifgeselecteerd \geselecteerdtrue -\newif\ifselecteren \selecterenfalse -\newif\ifverwerken \verwerkentrue +\newif\ifpageselected \pageselectedtrue +\newif\ifselectingpages \selectingpagesfalse +\newif\ifprocessingpages\processingpagestrue -\let\selectie \empty -\let\paginasoort\empty -\let\napagina \relax -\let\voorpagina \relax +\let\pageselection \empty +\let\currentpageselection\empty +\let\aftershipout \relax +\let\beforeshipout \relax -\def\dodovoorpagina#1% - {\global\let\voorpagina\relax +\def\dodobeforeshipout#1% + {\global\let\beforeshipout\relax \getvalue{\??pg#1\c!before}} -\def\dovoorpagina - {\doifsomething\paginasoort - {\processcommacommand[\paginasoort]\dodovoorpagina}} +\def\dobeforeshipout + {\doifsomething\currentpageselection + {\processcommacommand[\currentpageselection]\dodobeforeshipout}} -\def\dododonapagina#1% - {\global\let\napagina\relax - \global\let\paginasoort\empty +\def\dododoaftershipout#1% + {\global\let\aftershipout\relax + \global\let\currentpageselection\empty \getvalue{\??pg#1\c!after}} -\def\dodonapagina#1% +\def\dodoaftershipout#1% {\doifelsevalue{\??pg#1\c!option}\v!doublesided {\doifbothsidesoverruled - \dododonapagina{#1}% - \orsideone - \dododonapagina{#1}% - \orsidetwo - \od} - {\dododonapagina{#1}}} + {\dododoaftershipout{#1}} + {\dododoaftershipout{#1}} + {}} + {\dododoaftershipout{#1}}} -\def\donapagina - {\doifsomething\paginasoort - {\processcommacommand[\paginasoort]\dodonapagina}} +\def\doaftershipout + {\doifsomething\currentpageselection + {\processcommacommand[\currentpageselection]\dodoaftershipout}} % Dit wordt eigenlijk nooit en moet worden vervangen door % het meer algemene mechanisme. @@ -1920,13 +1885,13 @@ \def\dopagetype[#1]% {\edef\desoortpagina{#1}% \ifx\desoortpagina\empty \else - \@EA\doglobal\@EA\addtocommalist\@EA{\desoortpagina}\paginasoort - \ifselecteren - \fullexpandtwoargsafter\doifcommon\desoortpagina\selectie - {\global\geselecteerdtrue}% + \@EA\doglobal\@EA\addtocommalist\@EA{\desoortpagina}\currentpageselection + \ifselectingpages + \fullexpandtwoargsafter\doifcommon\desoortpagina\pageselection + {\global\pageselectedtrue}% \fi - \gdef\voorpagina{\dovoorpagina}% - \gdef\napagina {\donapagina }% + \gdef\beforeshipout{\dobeforeshipout}% + \gdef\aftershipout {\doaftershipout}% \fi} \def\pagetype @@ -1939,13 +1904,13 @@ \c!after=, \c!option=, #2]% - \def\docommando##1% + \def\docommand##1% {\getparameters [\??pg##1] [\c!before=\@@pgbefore, \c!after=\@@pgafter, \c!option=\@@pgoption]}% - \processcommalist[#1]\docommando}% + \processcommalist[#1]\docommand}% \def\couplepage {\dodoubleargument\docouplepage} @@ -1953,23 +1918,18 @@ \def\doprocesspage[#1][#2]% {\processaction [#2] - [\v!yes=>\global\verwerkentrue, - \v!no=>\global\verwerkenfalse]% - \gdef\selectie{#1}% - \global\selecterentrue - \global\geselecteerdfalse} + [\v!yes=>\global\processingpagestrue, + \v!no=>\global\processingpagesfalse]% + \gdef\pageselection{#1}% + \global\selectingpagestrue + \global\pageselectedfalse} \def\processpage {\dodoubleargument\doprocesspage} \def\resetselectiepagina - {\ifselecteren - \doifbothsidesoverruled - \global\geselecteerdfalse - \orsideone - \orsidetwo - \global\geselecteerdfalse - \od + {\ifselectingpages + \doifbothsidesoverruled{\global\pageselectedfalse}{}{\global\pageselectedfalse}% \fi} \newif\ifregistertextareas diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 20d9e6686..70414c500 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -13,6 +13,8 @@ \writestatus{loading}{Context Page Macros / Layout Specification} +%D This module is now etex dependent. + % to be translated into english % hoofdhoogte wordt bij status=hoog niet aangepast op outer @@ -58,8 +60,8 @@ \newdimen\headerheight \headerheight = 2cm \newdimen\footerheight \footerheight = \headerheight -\newdimen\kopoffset \kopoffset = 0pt -\newdimen\rugoffset \rugoffset = \kopoffset +\newdimen\topoffset \topoffset = 0pt +\newdimen\backoffset \backoffset = \topoffset \newdimen\leftmarginwidth \leftmarginwidth = 3cm \newdimen\rightmarginwidth \rightmarginwidth = \leftmarginwidth @@ -103,27 +105,6 @@ %D Look how ugly a speed up looks: -\beginTEX - -\def\layoutparameter#1% - {\csname\??ly\@EA\ifx\csname - \??ly\currentlayout#1\endcsname\relax\else\currentlayout - \fi#1\endcsname} - -\def\namedlayoutparameter#1#2% - {\csname\??ly - \@EA\ifx\csname\??ly#1#2\endcsname\relax - \@EA\ifx\csname\??ly\currentlayout#2\endcsname\relax - \else\currentlayout\fi - \else#1\fi - \fi#2\endcsname} - -\endTEX - -%D Its \ETEX\ counterpart is: - -\beginETEX \ifcsname - \def\layoutparameter#1% {\csname\??ly\ifcsname \??ly\currentlayout#1\endcsname\currentlayout @@ -134,8 +115,6 @@ \ifcsname\??ly\currentlayout#2\endcsname\currentlayout \fi\fi#2\endcsname} -\endETEX - %D Beause normal \TEX\ has at most 256 dimensions (of which a %D substantial part is already in use), we provide a way to %D generate a format with macro based alternatives. For a long @@ -193,7 +172,9 @@ \def\setlayoutdistances % local in \setreducedvsize {\headerdistance\layoutdistance\headerheight\c!headerdistance - \footerdistance \layoutdistance\footerheight \c!footerdistance} + \footerdistance\layoutdistance\footerheight\c!footerdistance} + +% these are wrong in the running text, assumes some swapping, needs a cleanup \def\outermarginwidth {\rightorleftpageaction\rightmarginwidth \leftmarginwidth } \def\innermarginwidth {\rightorleftpageaction\leftmarginwidth \rightmarginwidth} @@ -210,25 +191,9 @@ \newtoks\extralayoutcalculations \def\calculatelayoutextras{\the\extralayoutcalculations} -\appendtoks - \scratchdimen\leftmarginwidth \advance\scratchdimen\leftmargindistance \xdef\leftmargintotal {\the\scratchdimen}% - \scratchdimen\rightmarginwidth \advance\scratchdimen\rightmargindistance \xdef\rightmargintotal{\the\scratchdimen}% - \scratchdimen\leftedgewidth \advance\scratchdimen\leftedgedistance \xdef\leftedgetotal {\the\scratchdimen}% - \scratchdimen\rightedgewidth \advance\scratchdimen\rightedgedistance \xdef\rightedgetotal {\the\scratchdimen}% - \scratchdimen\leftmarginwidth \advance\scratchdimen\leftedgetotal \xdef\leftsidetotal {\the\scratchdimen}% - \scratchdimen\rightmarginwidth \advance\scratchdimen\rightedgetotal \xdef\rightsidetotal {\the\scratchdimen}% - \scratchdimen\leftmargintotal \advance\scratchdimen\leftedgetotal \xdef\leftcombitotal {\the\scratchdimen}% - \scratchdimen\rightmargintotal \advance\scratchdimen\rightedgetotal \xdef\rightcombitotal {\the\scratchdimen}% - % - \scratchdimen\innermarginwidth \advance\scratchdimen\innermargindistance \xdef\innermargintotal{\the\scratchdimen}% - \scratchdimen\outermarginwidth \advance\scratchdimen\outermargindistance \xdef\outermargintotal{\the\scratchdimen}% - \scratchdimen\inneredgewidth \advance\scratchdimen\inneredgedistance \xdef\inneredgetotal {\the\scratchdimen}% - \scratchdimen\outeredgewidth \advance\scratchdimen\outeredgedistance \xdef\outeredgetotal {\the\scratchdimen}% - \scratchdimen\innermargintotal \advance\scratchdimen\inneredgetotal \xdef\innercombitotal {\the\scratchdimen}% - \scratchdimen\outermargintotal \advance\scratchdimen\outeredgetotal \xdef\outercombitotal {\the\scratchdimen}% - \scratchdimen\innermarginwidth \advance\scratchdimen\inneredgetotal \xdef\innersidetotal {\the\scratchdimen}% - \scratchdimen\outermarginwidth \advance\scratchdimen\outeredgetotal \xdef\outersidetotal {\the\scratchdimen}% -\to \extralayoutcalculations +% \appendtoks +% non etex calculations used to go here +% \to \extralayoutcalculations \newtoks\everyswapmargins % watch the order ! @@ -263,15 +228,21 @@ \def\definepapersize {\dodoubleempty\dodefinepapersize} -\def\dodefinepapersize[#1][#2]% +\def\definepapersize + {\dotripleempty\dodefinepapersize} + +\def\dodefinepapersize[#1][#2][#3]% {\ifsecondargument \doifsomething{#1} % to be sure - {\getparameters - [\??pp#1] % geen \c!scale, scheelt hash ruimte - [\c!width=\@@ppwidth,\c!height=\@@ppheight,\c!offset=\@@ppoffset,#2]}% + {\doifassignmentelse{#2} + {\getparameters + [\??pp#1] % geen \c!scale, scheelt hash ruimte + [\c!width=\@@ppwidth,\c!height=\@@ppheight,\c!offset=\@@ppoffset,#2]} + {\setvalue{\??pp:1:#1}{#2}% + \setvalue{\??pp:2:#1}{#3}}}% \else \getparameters[\??pp][#1]% - \setuppapersize + \setuppapersize % hm. this will freeze ! \fi} %D For the moment we need to fake this macro. @@ -286,6 +257,27 @@ \definepapersize [\c!width=210mm,\c!height=297mm,\c!offset=\!!zeropoint] +%D Yet undocumented, let's see if it gets noticed. +%D +%D \starttyping +%D \definepapersize[main] [A4] [A4] +%D \definepapersize[extra][A4,landscape][A4,landscape] +%D +%D \starttext +%D \setuppapersize[main] +%D Page 1. \page +%D Page 2. \page +%D \setuppapersize[extra] +%D Page 2 \page +%D \setuppapersize[main] +%D Page 3. \page +%D Page 4. \page +%D \adaptpapersize[extra] +%D Page 5. \page +%D Page 6. \page +%D \stoptext +%D \stoptyping + %D \macros %D {setuppaper,setuppapersize} %D @@ -298,7 +290,7 @@ %D variables. \chardef\papermirror =0 \chardef\printmirror =0 -\chardef\paperorientation=0 \chardef\printorientation=0 +\chardef\paperorientation=0 \chardef\printorientation=0 % beware: later no chardef \chardef\paperreverse =0 \chardef\printreverse =0 \chardef\paperlandscape =0 \chardef\printlandscape =0 @@ -306,24 +298,12 @@ \def\paperscale{1} \newif\ifnegateprintbox -% \def\dosetuppapersize[#1][#2]% -% {\doifassignmentelse{#1} -% {\getparameters[\??pp][#1]} -% {\doifassignmentelse{#2} -% {\getparameters[\??pp#1][#2]} -% {\dodosetuppapersize[#1][#2]}}} -% -% The next version is more extensive; here we can -% associate paper and page with key/value like settings, -% which is handy in 'example' when we use setups - \def\setuppaper[#1]% {\getparameters[\??pp][\c!paper=,\c!page=,#1]% - \scratchcounter\@@ppnx - \multiply\scratchcounter\@@ppny - \edef\@@ppxy{\the\scratchcounter}% + \edef\@@ppxy{\the\numexpr\@@ppnx*\@@ppny\relax}% \doifelsenothing\@@pppage - {\doifsomething\@@pppaper + {\doifelsenothing\@@pppaper + {} % {\setuppapersize} % added, removed, no need for, too tricky, mag-01 (fixed by freezing pp's) {\dodosetuppapersize[\papersize][\@@pppaper]}} {\doifelsenothing\@@pppaper {\dodosetuppapersize[\@@pppage][\printpapersize]} @@ -335,9 +315,26 @@ \def\dosetuppapersize[#1][#2]% {\doifassignmentelse{#1} {\setuppaper[#1]} - {\doifassignmentelse{#2} - {\getparameters[\??pp#1][#2]} - {\dodosetuppapersize[#1][#2]}}} + {\doifelsenothing{#2} + {\expanded{\dodosetuppapersize + [\executeifdefined{\??pp:1:#1}{#1}]% + [\executeifdefined{\??pp:2:#1}{}]}} + {\doifassignmentelse{#2} + {\getparameters[\??pp\executeifdefined{\??pp:1:#1}{#1}][#2]} + {\expanded{\dodosetuppapersize + [\executeifdefined{\??pp:1:#1}{#1}]% + [\executeifdefined{\??pp:1:#2}{#2}]}}}}} + +\let\reinstatepapersize\relax + +\def\adaptpapersize + {\global\let\reinstatepapersize\restorepapersize + \setuppapersize} + +\appendtoks + \reinstatepapersize + \global\let\reinstatepapersize\relax +\to \everyaftershipout \def\dodosetuppapersize[#1][#2]% {\ifsecondargument @@ -353,26 +350,37 @@ \restorepapersize \fi\fi\fi} +% dimen freeze is a bit tricky, but catches local redundant calls +% with values where e.g width is defined in terms of \paperwidth + \def\dododosetuppapersize[#1][#2]% {\xdef\restorepapersize{\noexpand\setuppapersize[#1][#2]}% \dosetuppaperorientation{#1}\paperlandscape\paperorientation\paperreverse\papermirror \dosetuppaperorientation{#2}\printlandscape\printorientation\printreverse\printmirror - \def\docommando##1% + \def\docommand##1% {\doifsomething{##1}{\doifdefined{\??pp##1\c!width} - {\global\paperwidth\getvalue{\??pp##1\c!width}% + {\global\paperwidth \getvalue{\??pp##1\c!width}% \global\paperheight\getvalue{\??pp##1\c!height}% +\ifinpagebody + \setevalue{\??pp##1\c!height}{\the\paperheight}% + \setevalue{\??pp##1\c!width }{\the\paperwidth }% +\fi \calculatepaperoffsets{##1}% \xdef\papersize{##1}}}}% - \processcommacommand[#1]\docommando + \processcommacommand[#1]\docommand \doifdefinedelse{\??pp#1\c!scale} {\edef\paperscale{\getvalue{\??pp#1\c!scale}}} {\edef\paperscale{1}}% - \def\docommando##1% + \def\docommand##1% {\doifsomething{##1}{\doifdefined{\??pp##1\c!width} - {\global\printpaperwidth\getvalue{\??pp##1\c!width}% + {\global\printpaperwidth \getvalue{\??pp##1\c!width}% \global\printpaperheight\getvalue{\??pp##1\c!height}% +\ifinpagebody + \setevalue{\??pp##1\c!height}{\the\printpaperheight}% + \setevalue{\??pp##1\c!width }{\the\printpaperwidth}% +\fi \xdef\printpapersize{##1}}}}% - \processcommacommand[#2]\docommando + \processcommacommand[#2]\docommand \global\setdimentoatleast\paperwidth \onepoint \global\setdimentoatleast\paperheight \onepoint \global\setdimentoatleast\printpaperwidth \onepoint @@ -388,8 +396,12 @@ \doif\@@ppoption\v!max % \v!fit is {\bgroup % we need to pre-swap else we get the wrong paper size - \doifinset\paperorientation{90,270}{\swapdimens\paperwidth\paperheight}% - \doifinset\printorientation{90,270}{\swapdimens\printpaperwidth\printpaperheight}% + \ifcase\paperorientation\else + \doifinset\paperorientation{90,270}{\swapdimens\paperwidth\paperheight}% + \fi + \ifcase\printorientation\else + \doifinset\printorientation{90,270}{\swapdimens\printpaperwidth\printpaperheight}% + \fi \ifdim\paperheight>\printpaperheight \global\printpaperheight\paperheight \writestatus\m!systems{print height forced to paper height}% @@ -428,13 +440,13 @@ \let\restorepapersize\relax \def\checkforems[#1]% - {\def\docommando##1% + {\def\docommand##1% {\beforesplitstring##1\at em\to\asciia \doifnot\asciia{##1} {\aftersplitstring\asciia\at=\to\asciia \doifsomething\asciia {\showmessage\m!systems{10}{##1}}}}% - \processcommalist[#1]\docommando} + \processcommalist[#1]\docommand} \ifx\setups\undefined \def\setups[#1]{\setdefaultpenalties} \fi @@ -475,33 +487,25 @@ {\ifdim\cutspace=\zeropoint \global\cutspace\backspace \fi - \global\makeupwidth\paperwidth - \global\advance\makeupwidth -\backspace - \global\advance\makeupwidth -\cutspace} + \global\makeupwidth\dimexpr\paperwidth-\backspace-\cutspace\relax} {\doifelse{\layoutparameter\c!width}\v!fit {\ifdim\cutspace=\zeropoint \global\cutspace\backspace \fi - \global\makeupwidth\paperwidth - \global\advance\makeupwidth -\cutspace - \scratchdimen\backspace - \advance\scratchdimen -\leftedgewidth - \advance\scratchdimen -\leftedgedistance - \advance\scratchdimen -\leftmarginwidth - \advance\scratchdimen -\leftmargindistance\relax + \global\makeupwidth\dimexpr\paperwidth-\cutspace\relax + \scratchdimen\dimexpr\backspace + -\leftedgewidth -\leftedgedistance + -\leftmarginwidth-\leftmargindistance\relax \ifdim\scratchdimen<\zeropoint \scratchdimen\zeropoint \fi - \global\advance\makeupwidth -\rightmargindistance - \global\advance\makeupwidth -\rightmarginwidth - \global\advance\makeupwidth -\rightedgedistance - \global\advance\makeupwidth -\rightedgewidth - \global\advance\makeupwidth -\scratchdimen} + \global\advance\makeupwidth\dimexpr + -\rightmargindistance-\rightmarginwidth + -\rightedgedistance -\rightedgewidth + -\scratchdimen\relax} {\global\makeupwidth\layoutparameter\c!width\relax \ifdim\cutspace=\zeropoint - \global\cutspace\paperwidth - \global\advance\cutspace-\makeupwidth - \global\advance\cutspace-\backspace + \global\cutspace\dimexpr\paperwidth-\makeupwidth-\backspace\relax % \else % A kind of inconsistent specification, but used % in for instance s-pre-19.tex; the cutspace is @@ -519,29 +523,20 @@ {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi - \global\makeupheight\paperheight - \global\advance\makeupheight -\topspace - \global\advance\makeupheight -\bottomspace} + \global\makeupheight\dimexpr\paperheight-\topspace-\bottomspace\relax} {\doifelse{\layoutparameter\c!height}\v!fit {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi - \global\makeupheight\paperheight - \global\advance\makeupheight -\bottomspace - \scratchdimen\topspace - \advance\scratchdimen -\topheight - \advance\scratchdimen -\topdistance\relax + \global\makeupheight\dimexpr\paperheight-\bottomspace\relax + \scratchdimen\dimexpr\topspace-\topheight-\topdistance\relax \ifdim\scratchdimen<\zeropoint \scratchdimen\zeropoint \fi - \global\advance\makeupheight -\bottomdistance - \global\advance\makeupheight -\bottomheight - \global\advance\makeupheight -\scratchdimen} + \global\advance\makeupheight\dimexpr-\bottomdistance-\bottomheight-\scratchdimen\relax} {\global\makeupheight\layoutparameter\c!height\relax \ifdim\bottomspace=\zeropoint - \global\bottomspace\paperheight - \global\advance\bottomspace-\makeupheight - \global\advance\bottomspace-\topspace + \global\bottomspace\dimexpr\paperheight-\makeupheight-\topspace\relax \else % inconsistent specification \fi}}% @@ -550,19 +545,12 @@ % a global lineheight is tricky: should we take the bodyfont interlinespace or the one set % independent of the bodyfont (before or after a layout spec); way too fuzzy, so we % stick to the current method (after a night of experimenting ...2003/10/13) - \global\makeupheight\layoutparameter\c!lines\lineheight - % new, cleaner - \global\advance\makeupheight-\strutheight - \global\advance\makeupheight \topskip - % new, was a bug - \global\advance\makeupheight \headerdistance - \global\advance\makeupheight \footerdistance - % so far - \global\advance\makeupheight \headerheight - \global\advance\makeupheight \footerheight + \global\makeupheight\dimexpr + \layoutparameter\c!lines\lineheight-\strutheight+\topskip+ + \headerdistance+\headerheight+\footerdistance+\footerheight\relax \fi - \rugoffset\layoutparameter\c!horoffset - \kopoffset\layoutparameter\c!veroffset + \backoffset\layoutparameter\c!horoffset + \topoffset \layoutparameter\c!veroffset \global\setdimentoatleast\makeupwidth\onepoint \global\setdimentoatleast\makeupheight \onepoint % \checkcurrentlayout % here ? @@ -578,17 +566,11 @@ \def\calculatepseudocolumns {\global\layoutcolumns\layoutparameter\c!columns \global\layoutcolumndistance\layoutparameter\c!columndistance - \global\layoutcolumnwidth-\layoutcolumns\layoutcolumndistance - \global\advance\layoutcolumnwidth\layoutcolumndistance - \global\advance\layoutcolumnwidth\makeupwidth + \global\layoutcolumnwidth\dimexpr\makeupwidth-\layoutcolumns\layoutcolumndistance+\layoutcolumndistance\relax \global\divide\layoutcolumnwidth\layoutcolumns \dorecurse\layoutcolumns - {\scratchdimen\layoutcolumnwidth - \advance\scratchdimen\layoutcolumndistance - \scratchcounter\recurselevel - \advance\scratchcounter\minusone - \scratchdimen\scratchcounter\scratchdimen - \setxvalue{\??ly:c:\recurselevel}{\the\scratchdimen}}} + {\setxvalue{\??ly:c:\recurselevel}% + {\the\numexpr\recurselevel-\plusone\relax\dimexpr\layoutcolumnwidth+\layoutcolumndistance\relax}}} %\dorecurse\layoutcolumns % {\setxvalue{\??ly:c:\recurselevel}{\the\dimexpr @@ -608,44 +590,95 @@ % % \startstandardmakeup[page=blank] ... \stopstandardmakeup -% \def\checkcurrentlayout % public and used in naw, so keep this name -% {\ifundefined{\??ly\realfolio\c!state}% -% \doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout -% \else -% \doifvalue{\??ly\realfolio\c!state}\v!start -% {\xdef\currentlayout{\realfolio}\recalculatelayout}% new, global -% \fi} - -\def\checkcurrentlayout % public and used in naw, so keep this name - {\doifundefinedelse{\??ly\realfolio\c!state} - {\doifundefinedelse{\??ly\v!current\c!state} - {\doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout} - {\globallet\currentlayout\v!current\recalculatelayout}} - {\doifvalue{\??ly\realfolio\c!state}\v!start - {\xdef\currentlayout{\realfolio}\recalculatelayout}}} % new, global +\def\changetolayout#1% + {%\writestatus\m!layouts{changing to layout #1}% + \xdef\currentlayout{#1}\recalculatelayout} \def\checkcurrentoddlayout {\ifundefined{\??ly\v!odd\c!state}\else - \doifvalue{\??ly\v!odd\c!state}\v!start - {\globallet\currentlayout\v!odd\recalculatelayout}% new, global + \doifvalue{\??ly\v!odd\c!state}\v!start{\changetolayout\v!odd}% \fi} \def\checkcurrentevenlayout {\ifundefined{\??ly\v!even\c!state}\else - \doifvalue{\??ly\v!even\c!state}\v!start - {\globallet\currentlayout\v!even\recalculatelayout}% new, global + \doifvalue{\??ly\v!even\c!state}\v!start{\changetolayout\v!even}% \fi} -% \appendtoks \checkcurrentlayout \to \everyaftershipout +\ifx\lastpage\undefined \def\lastpage{1} \fi + +\def\reverserealfolio + {\ifnum\lastpage>\plusone + \ifnum\lastpage=\realfolio + \v!last + \else\ifnum\plusone=\realfolio + \v!first + \else + \the\numexpr\realfolio-\lastpage\relax + \fi\fi + \else + \!!zerocount + \fi} + +% \def\checkcurrentlayout % public and used in naw, so keep this name +% {\doifundefinedelse{\??ly\realfolio\c!state} +% {\doifundefinedelse{\??ly\reverserealfolio\c!state} +% {\doifundefinedelse{\??ly\v!current\c!state} +% {\doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout} +% {\changetolayout\v!current}} +% {\doifvalue{\??ly\reverserealfolio\c!state}\v!start +% {\changetolayout\reverserealfolio}}} +% {\doifvalue{\??ly\realfolio\c!state}\v!start +% {\changetolayout\realfolio}}} + +\def\checkcurrentlayout % public and used in naw, so keep this name + {\ifcsname\??ly\realfolio\c!state\endcsname + \doifvalue{\??ly\realfolio\c!state}\v!start{\changetolayout\realfolio}% + \else\ifcsname\??ly\reverserealfolio\c!state\endcsname + \doifvalue{\??ly\reverserealfolio\c!state}\v!start{\changetolayout\reverserealfolio}% + \else\ifcsname\??ly\v!current\c!state\endcsname + \changetolayout\v!current % no start test ? + \else + \doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout + \fi\fi\fi} + +% testcase +% +% \setuppagenumbering[alternative=doublesided] +% +% \setuplayout [width=11cm] +% \definelayout [odd] [backspace=1cm] +% \definelayout [even] [backspace=4cm] +% \definelayout [5] [backspace=5cm] +% \definelayout [6] [backspace=5cm] +% \definelayout [-2] [backspace=0cm,cutspace=0cm] +% \definelayout [last] [backspace=0cm,cutspace=0cm] +% +% \checkcurrentlayout \showframe +% +% \starttext +% \dorecurse{20} {\input knuth \endgraf \input tufte \endgraf} +% \stoptext + +%appendtoks \checkcurrentlayout \to \everyaftershipout % no +\appendtoks \checkcurrentlayout \to \everystarttext \appendtoks - \ifx\currentlayout\v!current - \globallet\currentlayout\empty - \global\letbeundefined{\??ly\v!current\c!state}% - \checkcurrentlayout - \fi + \dochecknextlayout \to \everyaftershipout +% \def\dochecknextlayout +% {\ifx\currentlayout\v!current +% % prevent redundant calculations +% \else +% \globallet\currentlayout\empty +% \global\letbeundefined{\??ly\v!current\c!state}% +% \checkcurrentlayout +% \fi} +% +% this breaks after a standardmakeup + +\def\dochecknextlayout{\checkcurrentlayout} + \newif\ifdoublesidedprint \def\presetcenterpagebox % in \setuplayout !!!!!!!!!!!!!!!! @@ -671,19 +704,6 @@ {\getparameters[\??ly#1][#2]% \checkforems[#2]}} -% \def\dosetuplayout[#1][#2]% -% {\let\currentlayout\empty -% \ifsecondargument -% \dodosetuplayout[#1][#2]% -% \else\iffirstargument -% \doifassignmentelse{#1} -% {\dodosetuplayout[][#1]} -% {\doifnot{#1}\v!reset{\def\currentlayout{#1}}}% -% \fi\fi -% \recalculatelayout -% \checkcurrentlayout % here ? -% \presetcenterpagebox} - % global needed for non-doublesided standardmakeup \def\dosetuplayout[#1][#2]% @@ -771,10 +791,10 @@ \def\doadaptlayout[#1][#2]% {\doifelsenothing{#2} {\dodoadaptlayout[#1]} - {\def\docommando##1% + {\def\docommand##1% {\addtocommalist{##1}\adaptedpages \setgvalue{\??za##1}{\dodoadaptlayout[#2]}}% - \processcommalist[#1]\docommando + \processcommalist[#1]\docommand \adaptpagedimensions}} \def\adaptlayout @@ -787,23 +807,25 @@ %D {right} parameters. \def\centerpagebox#1% - {\printpaperwidth\paperscale\printpaperwidth - \printpaperheight \paperscale\printpaperheight + {\printpaperwidth \paperscale\printpaperwidth + \printpaperheight\paperscale\printpaperheight \setbox#1\vbox to \printpaperheight {\@@pptop \hbox to \printpaperwidth {\ifdoublesidedprint - \doifbothsides \@@ppleft \box#1\@@ppright - \orsideone \@@ppleft \box#1\@@ppright - \orsidetwo \@@ppright\box#1\@@ppleft - \od \else \@@ppleft \box#1\@@ppright + \doifbothsides + {\@@ppleft \box#1\@@ppright} + {\@@ppleft \box#1\@@ppright} + {\@@ppright\box#1\@@ppleft }% + \else + \@@ppleft \box#1\@@ppright \fi}% \par \@@ppbottom}} \def\offsetprintbox#1% - {\ifdim\kopoffset=\zeropoint % \relax - \ifdim\rugoffset=\zeropoint + {\ifdim\topoffset=\zeropoint % \relax + \ifdim\backoffset=\zeropoint \donefalse \else \donetrue @@ -816,32 +838,12 @@ \setbox#1\vbox {%\forgetall \offinterlineskip - \vskip\kopoffset - \doifbothsides - \hskip\rugoffset - \orsideone - \hskip\rugoffset - \orsidetwo - \hskip-\rugoffset - \od + \vskip\topoffset + \doifbothsides{\hskip\backoffset}{\hskip\backoffset}{\hskip-\backoffset}% \box#1}% \next \fi} -% \def\replicatebox#1#2#3% -% {\setbox#1=\vbox -% {%\forgetall -% \offinterlineskip -% \dorecurse{#3} -% {\hbox{\dorecurse{#2}{\copy#1\hskip\@@lydx}\unskip}% -% \vskip\@@lydy} -% \unskip}} -% -% \def\replicatepagebox#1% -% {\ifnum\@@lynx>0 \ifnum\@@lyny>0 -% \replicatebox{#1}{\@@lynx}{\@@lyny}% -% \fi\fi} - \def\replicatepagebox#1% {\ifnum\@@lynx>\plusone \donetrue @@ -940,9 +942,6 @@ \ifnum\verticalcutmarks >2 \chardef\colormarkoffset4 \fi #1{#2}} -\newif\ifdoublesided \doublesidedfalse -\newif\ifsinglesided \singlesidedtrue - % NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET \ifx\doifelselayoutsomeline\undefined % defined in page-txt @@ -952,12 +951,10 @@ \def\calculatevsizes % global needed in \recalculatelayoutregel {\redoglobal\textheight\makeupheight \doifelselayoutsomeline \v!header - {\redoglobal\advance\textheight -\headerheight - \redoglobal\advance\textheight -\headerdistance}% + {\redoglobal\advance\textheight-\dimexpr\headerheight+\headerdistance\relax}% \donothing \doifelselayoutsomeline \v!footer - {\redoglobal\advance\textheight -\footerheight - \redoglobal\advance\textheight -\footerdistance}% + {\redoglobal\advance\textheight-\dimexpr\footerheight+\footerdistance\relax}% \donothing \ifzeropt\headerheight \resetsystemmode\v!header @@ -975,23 +972,32 @@ \def\calculatereducedvsizes {\textheight\makeupheight \doifelselayoutsomeline \v!header - {\advance\textheight -\headerheight - \advance\textheight -\headerdistance}% + {\advance\textheight-\dimexpr\headerheight+\headerdistance\relax}% {\headerheight\zeropoint \setlayoutdistances}% \doifelselayoutsomeline \v!footer - {\advance\textheight -\footerheight - \advance\textheight -\footerdistance}% + {\advance\textheight-\dimexpr\footerheight+\footerdistance\relax}% {\footerheight\zeropoint \setlayoutdistances}} -\def\freezetextwidth % \makeupwidth may be set to \textwidth +\newdimen\innermakeupwidth % special purpose +\newdimen\innermakeupmargin % special purpose + +\chardef\innermakeupcompensation\plusone + +\def\compensatedinnermakeupmargin + {\dimexpr\ifnum\innermakeupcompensation=\plusone+\innermakeupmargin\else\zeropoint\fi\relax} + +\def\freezetextwidth % \makeupwidth may be set to \textwidth {\textwidth\makeupwidth % which is a tricky but valid value - \doifsomething{\layoutparameter\c!textwidth}% + \doifsomething{\layoutparameter\c!textwidth} {\textwidth\layoutparameter\c!textwidth}% % local - \doifsomething{\layoutparameter\c!textmargin}% - {\advance\textwidth-\layoutparameter\c!textmargin % local - \advance\textwidth-\layoutparameter\c!textmargin}} % local + \global\innermakeupwidth\textwidth + \doifelsenothing{\layoutparameter\c!textmargin} + {\global\innermakeupmargin\zeropoint} + {\global\innermakeupmargin\layoutparameter\c!textmargin}% + \global\advance\innermakeupwidth-\dimexpr\innermakeupmargin+\innermakeupmargin\relax + \advance\textwidth-\dimexpr\innermakeupmargin+\innermakeupmargin\relax} % local \def\calculatehsizes {\freezetextwidth @@ -1035,14 +1041,14 @@ % what are those \relax'es doing there? -\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od +\def\doifbothsidesoverruled#1#2#3% {\ifdoublesided \doifoddpageelse{#2}{#3}\relax \else #1\relax \fi} -\def\doifbothsides#1\orsideone#2\orsidetwo#3\od +\def\doifbothsides#1#2#3% {\ifdoublesided \ifsinglesided #1\relax @@ -1057,23 +1063,15 @@ \def\settexthoffset {\doifbothsides - \texthoffset\backspace - \orsideone - \texthoffset\backspace - \orsidetwo - \texthoffset\paperwidth - \advance\texthoffset-\backspace - \advance\texthoffset-\makeupwidth - \od} + {\texthoffset\backspace} + {\texthoffset\backspace} + {\texthoffset\dimexpr\paperwidth-\backspace-\makeupwidth\relax}} \def\goleftonpage - {\hskip-\leftmargindistance - \hskip-\leftmarginwidth - \hskip-\leftedgedistance - \hskip-\leftedgewidth} + {\hskip-\dimexpr\leftmargindistance+\leftmarginwidth+\leftedgedistance+\leftedgewidth\relax} \def\doifmarginswapelse#1#2% - {\doifbothsides#1\orsideone#1\orsidetwo#2\od} + {\doifbothsides{#1}{#1}{#2}} \def\swapmargins {\doifmarginswapelse\relax\doswapmargins} @@ -1107,29 +1105,25 @@ \def\outerspacewidth {\rightorleftpageaction\cutspace \backspace } \def\innerspacewidth {\rightorleftpageaction\backspace\cutspace} -\beginETEX \dimexpr - - \def\leftmargintotal {\dimexpr\leftmarginwidth +\leftmargindistance \relax} - \def\rightmargintotal{\dimexpr\rightmarginwidth+\rightmargindistance\relax} - \def\leftedgetotal {\dimexpr\leftedgewidth +\leftedgedistance \relax} - \def\rightedgetotal {\dimexpr\rightedgewidth +\rightedgedistance \relax} - - \def\leftsidetotal {\dimexpr\leftmarginwidth +\leftedgetotal \relax} - \def\rightsidetotal {\dimexpr\rightmarginwidth+\rightedgetotal\relax} - \def\leftcombitotal {\dimexpr\leftmargintotal +\leftedgetotal \relax} - \def\rightcombitotal {\dimexpr\rightmargintotal+\rightedgetotal\relax} - - \def\innermargintotal{\dimexpr\innermarginwidth+\innermargindistance\relax} - \def\outermargintotal{\dimexpr\outermarginwidth+\outermargindistance\relax} - \def\inneredgetotal {\dimexpr\inneredgewidth +\inneredgedistance \relax} - \def\outeredgetotal {\dimexpr\outeredgewidth +\outeredgedistance \relax} - - \def\innercombitotal {\dimexpr\innermargintotal+\inneredgetotal\relax} - \def\outercombitotal {\dimexpr\outermargintotal+\outeredgetotal\relax} - \def\innersidetotal {\dimexpr\innermarginwidth+\inneredgetotal\relax} - \def\outersidetotal {\dimexpr\outermarginwidth+\outeredgetotal\relax} - -\endETEX +\def\leftmargintotal {\dimexpr\leftmarginwidth +\leftmargindistance \relax} +\def\rightmargintotal {\dimexpr\rightmarginwidth+\rightmargindistance\relax} +\def\leftedgetotal {\dimexpr\leftedgewidth +\leftedgedistance \relax} +\def\rightedgetotal {\dimexpr\rightedgewidth +\rightedgedistance \relax} + +\def\leftsidetotal {\dimexpr\leftmarginwidth +\leftedgetotal \relax} +\def\rightsidetotal {\dimexpr\rightmarginwidth+\rightedgetotal\relax} +\def\leftcombitotal {\dimexpr\leftmargintotal +\leftedgetotal \relax} +\def\rightcombitotal {\dimexpr\rightmargintotal+\rightedgetotal\relax} + +\def\innermargintotal {\dimexpr\innermarginwidth+\innermargindistance\relax} +\def\outermargintotal {\dimexpr\outermarginwidth+\outermargindistance\relax} +\def\inneredgetotal {\dimexpr\inneredgewidth +\inneredgedistance \relax} +\def\outeredgetotal {\dimexpr\outeredgewidth +\outeredgedistance \relax} + +\def\innercombitotal {\dimexpr\innermargintotal+\inneredgetotal\relax} +\def\outercombitotal {\dimexpr\outermargintotal+\outeredgetotal\relax} +\def\innersidetotal {\dimexpr\innermarginwidth+\inneredgetotal\relax} +\def\outersidetotal {\dimexpr\outermarginwidth+\outeredgetotal\relax} %D \macros %D {startlocallayout} @@ -1383,31 +1377,27 @@ %D A few goodies: -\beginETEX \dimexpr - \definepapersize [oversized] - [\c!width=\dimexpr(\paperwidth+1.5cm), - \c!height=\dimexpr(\paperheight+1.5cm)] + [ \c!width=\dimexpr\paperwidth +1.5cm\relax, + \c!height=\dimexpr\paperheight+1.5cm\relax] \definepapersize [doublesized] - [\c!width=\dimexpr(\paperwidth), - \c!height=\dimexpr(2\paperheight)] + [ \c!width=\dimexpr \paperwidth \relax, + \c!height=\dimexpr2\paperheight\relax] \definepapersize [doubleoversized] - [\c!width=\dimexpr(\paperheight+1.5cm), - \c!height=\dimexpr(2\paperwidth+1.5cm)] + [ \c!width=\dimexpr \paperheight+1.5cm\relax, + \c!height=\dimexpr2\paperwidth +1.5cm\relax] %D For orthogonality: \definepapersize [undersized] - [\c!width=\dimexpr(\paperwidth-1.5cm), - \c!height=\dimexpr(\paperheight-1.5cm)] - -\endETEX + [ \c!width=\dimexpr\paperwidth -1.5cm\relax, + \c!height=\dimexpr\paperheight-1.5cm\relax] \definelayout [\v!page] diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex index a0b4e84a9..d28674686 100644 --- a/tex/context/base/page-lin.tex +++ b/tex/context/base/page-lin.tex @@ -29,57 +29,6 @@ \def\setuplines {\dodoubleargument\getparameters[\??rg]} -% old -% -% \def\startlines -% {\@@rgbefore -% \whitespace -% %\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak -% \begingroup -% \def \@@rgstepyes {\parindent\zeropoint}% -% \def \@@rgstepno {\parindent\zeropoint}% -% \edef\@@rgparindent{\the\parindent}% -% \globallet\@@rglinesteptoggle\!!plusone -% \processaction -% [\@@rgindenting] -% [ \v!yes=>\def\@@rgstepyes{\parindent\@@rgparindent}% -% \def\@@rgstepno {\parindent\@@rgparindent}, -% \v!odd=>\def\@@rgstepyes{\parindent\zeropoint }% -% \def\@@rgstepno {\parindent\@@rgparindent}, -% \v!even=>\def\@@rgstepno {\parindent\zeropoint }% -% \def\@@rgstepyes{\parindent\@@rgparindent}]% -% \typesettinglinestrue -% \setupwhitespace[\v!none]% -% \obeylines -% \let\checkindentation\relax -% \@@rgstepno -% \ignorespaces -% \gdef\afterfirstobeyedline % tzt two pass, net als opsomming -% {\gdef\afterfirstobeyedline -% {\nobreak -% \global\let\afterfirstobeyedline\relax}}% -% \def\obeyedline -% {\par -% \let\checkindentation\relax % else problems with odd/even -% \afterfirstobeyedline -% \ifdim\lastskip>\zeropoint -% \globallet\@@rglinesteptoggle\!!zerocount -% \else -% \doglobal\increment\@@rglinesteptoggle -% \fi -% \ifodd\@@rglinesteptoggle\relax -% \@@rgstepyes -% \else -% \@@rgstepno -% \fi -% \futurelet\next\dobetweenthelines}% -% \activatespacehandler\@@rgspace -% \GotoPar} -% -% \def\stoplines -% {\endgroup -% \@@rgafter} - \def\startlines {\@@rgbefore \pushmacro\checkindentation @@ -158,13 +107,6 @@ \def\activatespacehandler#1% {\executeifdefined{\??sr#1}{\activatespacehandler\v!off}} -% \def\dobetweenthelines% -% {\convertcommand \next \to\!!stringa % very ugly and fuzzy -% \convertargument\obeyedline\to\!!stringb % but needed anyway -% \ifx\!!stringa\!!stringb % but alas, it fails -% \@@rgtussen % hopelessly in non -% \fi} % etex - \def\dobetweenthelines {\doifmeaningelse\next\obeyedline\@@rginbetween\donothing} @@ -200,29 +142,6 @@ \newevery \everylinenumber \relax -% \def\dodoplacelinenumber -% {% beware of em's, the font is already switched ! -% \setbox\scratchbox\hbox -% {\setbox0\hbox{\@@rncommand{\completelinenumber}}\vsmashbox0% -% \ifcase\linenumberlocation -% \rlap{\hbox to \@@rnwidth{\box0\hss}}% was \llap, nog testen !! -% \or -% \inleftmargin -% {\forgetall -% \doifelse\@@rnwidth\v!margin -% {\hsize\leftmarginwidth}{\hsize\@@rnwidth}% -% \alignedline\@@rnalign\v!right{\box0\hskip\@@rndistance}}% -% \else -% \inrightmargin -% {\forgetall -% \doifelse\@@rnwidth\v!margin -% {\hsize\rightmarginwidth}{\hsize\@@rnwidth}% -% \alignedline\@@rnalign\v!left{\hskip\@@rndistance\box0}}% -% \fi}% -% \vsmashbox\scratchbox -% \box\scratchbox -% \the\everylinenumber} - \def\dodoplacelinenumber {% beware of em's, the font is already switched ! \setbox\scratchbox\hbox @@ -317,14 +236,17 @@ \numberinglinestrue \complexorsimpleempty\startlinenumbering} +\def\donoplacelinenumber + {\the\everylinenumber} + \def\doplacelinenumber {\ifnum\linenumber<\@@rnstart\relax + \donoplacelinenumber \else - \!!counta\linenumber - \divide\!!counta \@@rnstep - \multiply\!!counta \@@rnstep\relax - \ifnum\!!counta=\linenumber + \ifnum\numexpr(\linenumber/\@@rnstep)*\@@rnstep\relax=\linenumber \doattributes\??rn\c!style\c!color\dodoplacelinenumber + \else + \donoplacelinenumber \fi \fi} diff --git a/tex/context/base/page-log.tex b/tex/context/base/page-log.tex index 53984eefd..d0671a732 100644 --- a/tex/context/base/page-log.tex +++ b/tex/context/base/page-log.tex @@ -163,7 +163,7 @@ \def\dodosetlogobox#1#2% {\hbox % width equals \makeupwidth - {\def\docommando##1% + {\def\docommand##1% {\donefalse \ifnum\logostatus=3 \ExpandBothAfter \doifinset{\getvalue{\??lo#1##1}}\requestedlogos\donetrue @@ -173,43 +173,40 @@ \ifdone #2{\hbox{\getvalue{\??lo#1##1\c!command}}}% \fi}% - \def\dodocommando##1##2##3##4##5##6% + \def\dodocommand##1##2##3##4##5##6% {\hsmash {\hskip-\texthoffset \hbox to \paperwidth - {\rlap{\docommando##1}\hss\llap{\docommando##6}}% + {\rlap{\docommand##1}\hss\llap{\docommand##6}}% \hskip-\paperwidth \hbox to \paperwidth {\hskip\texthoffset \hskip-\leftmarginwidth \hskip-\leftmargindistance - \hbox to \leftmarginwidth{\docommando##2\hss}% + \hbox to \leftmarginwidth{\docommand##2\hss}% \hskip\leftmargindistance - \hbox to \makeupwidth{\docommando##3\hss\docommando##4}% + \hbox to \makeupwidth{\docommand##3\hss\docommand##4}% \hskip\rightmargindistance - \hbox to \rightmarginwidth{\hss\docommando##5}% + \hbox to \rightmarginwidth{\hss\docommand##5}% \hfill}}}% \normalbaselines \settexthoffset \hsmash - {\hbox to \makeupwidth{\hss\docommando\c!middle\hss}}% + {\hbox to \makeupwidth{\hss\docommand\c!middle\hss}}% \hsmash {\hskip-\texthoffset - \hbox to \paperwidth{\docommando\v!page\hss}}% + \hbox to \paperwidth{\docommand\v!page\hss}}% \swapmargins \doifbothsidesoverruled - \dodocommando + {\dodocommand \v!leftedge \v!leftmargin \v!left - \v!right \v!rightmargin \v!rightedge - \orsideone - \dodocommando + \v!right \v!rightmargin \v!rightedge} + {\dodocommand \v!leftedge \v!leftmargin \v!left - \v!right \v!rightmargin \v!rightedge - \orsidetwo - \dodocommando + \v!right \v!rightmargin \v!rightedge} + {\dodocommand \v!rightedge \v!rightmargin \v!right - \v!left \v!leftmargin \v!leftedge - \od}} + \v!left \v!leftmargin \v!leftedge}}} %D The user interface is relatively simple and provides %D macros for assigning logos to logo areas as well as diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex index e92f12052..b0fabc3f7 100644 --- a/tex/context/base/page-lyr.tex +++ b/tex/context/base/page-lyr.tex @@ -13,6 +13,8 @@ \writestatus{loading}{Context Page Macros / Layers} +%D This module is now etex dependent. + % todo : first / last / next / +... => page key % test on left/right box when no doublesided option given @@ -43,16 +45,11 @@ \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[#2]{\executedefinedoverlay - ##1\\#3\\{####1}{####2}{####3}{####4}{####5}{####6}{####7}}}}% + \def\docommand##1{\setvalue{\??ov##1}{\setlayer[#2]{\executedefinedoverlay{##1}{#3}}}} \else - \def\docommando##1% - {\setvalue{\??ov##1}{\executedefinedoverlay - ##1\\#2\\}}% + \def\docommand##1{\setvalue{\??ov##1}{\executedefinedoverlay{##1}{#2}}}% \fi - \processcommalist[#1]\docommando} + \processcommalist[#1]\docommand} %D When tracing is turned on, a couple of boxes will %D show up as well as the reference point. @@ -113,8 +110,8 @@ {\dodoubleargument\dosetuplayer} \def\dosetuplayer[#1][#2]% - {\def\docommando##1{\getparameters[\??ll##1][#2]}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\getparameters[\??ll##1][#2]}% + \processcommalist[#1]\docommand} %D \macros %D {setlayer} @@ -187,8 +184,12 @@ \newbox\layerbox -\newdimen\@@layerxsiz \newdimen\@@layerxoff \newdimen\@@layerxpos -\newdimen\@@layerysiz \newdimen\@@layeryoff \newdimen\@@layerypos +\newdimen\@@layerxsiz +\newdimen\@@layerysiz +\newdimen\@@layerxoff +\newdimen\@@layeryoff +\newdimen\@@layerxpos +\newdimen\@@layerypos \let\lastlayerxpos\!!zeropoint \let\lastlayerypos\!!zeropoint @@ -198,15 +199,20 @@ % todo left/right +% \def\setlastlayerpos#1% +% {\edef\layerpage{\MPp{lyr:\currentlayerdata}}% +% \scratchdimen\MPx{lyr:#1:\layerpage}% +% \scratchdimen-\scratchdimen +% \advance\scratchdimen\MPx{lyr:\currentlayerdata}% +% \xdef\lastlayerxpos{\the\scratchdimen}% +% \scratchdimen\MPy{lyr:#1:\layerpage}% +% \advance\scratchdimen-\MPy{lyr:\currentlayerdata}% +% \xdef\lastlayerypos{\the\scratchdimen}} + \def\setlastlayerpos#1% {\edef\layerpage{\MPp{lyr:\currentlayerdata}}% - \scratchdimen\MPx{lyr:#1:\layerpage}% - \scratchdimen-\scratchdimen - \advance\scratchdimen\MPx{lyr:\currentlayerdata}% - \xdef\lastlayerxpos{\the\scratchdimen}% - \scratchdimen\MPy{lyr:#1:\layerpage}% - \advance\scratchdimen-\MPy{lyr:\currentlayerdata}% - \xdef\lastlayerypos{\the\scratchdimen}} + \xdef\lastlayerxpos{\the\dimexpr-\MPx{lyr:#1:\layerpage}+\MPx{lyr:\currentlayerdata}\relax}% + \xdef\lastlayerypos{\the\dimexpr \MPy{lyr:#1:\layerpage}-\MPy{lyr:\currentlayerdata}\relax}} \def\definelayerpreset {\dodoubleargument\dodefinelayerpreset} @@ -262,10 +268,9 @@ {\@@layerxoff\@@layerxsiz}{\@@layerxoff\layerparameter\c!hoffset}% \doifelse{\layerparameter\c!voffset}\v!max {\@@layeryoff\@@layerysiz}{\@@layeryoff\layerparameter\c!voffset}% - \advance\@@layerxoff\layerparameter\c!offset - \advance\@@layeryoff\layerparameter\c!offset -\advance\@@layerxoff\layerparameter\c!dx % internal, can be used in preset -\advance\@@layeryoff\layerparameter\c!dy % internal, can be used in preset + % dx/dy are internal context ones and can be used in preset + \advance\@@layerxoff\dimexpr\layerparameter\c!offset+\layerparameter\c!dx\relax + \advance\@@layeryoff\dimexpr\layerparameter\c!offset+\layerparameter\c!dy\relax \@@layerxpos\layerparameter\c!sx\@@layerxpos \@@layerypos\layerparameter\c!sy\@@layerypos \@@layerxoff\layerparameter\c!sx\@@layerxoff @@ -283,11 +288,8 @@ \globallet\lastlayerypos\!!zeropoint \ExpandBothAfter\doifinset\v!bottom{\layerparameter\c!corner} {\ifnum\layerparameter\c!line=\zerocount\else % can be < 0 - \scratchcounter\layerparameter\c!line - \scratchcounter-\scratchcounter - \advance\scratchcounter\layoutlines - \advance\scratchcounter\plusone - \setevalue{\??ll\currentlayer\c!line}{\the\scratchcounter}% + \setevalue{\??ll\currentlayer\c!line}% + {\the\numexpr-\layerparameter\c!line+\layoutlines+\plusone\relax}% \fi \ifdim\@@layerysiz>\zeropoint \advance\@@layerypos-\@@layerysiz @@ -296,11 +298,8 @@ \fi}% \ExpandBothAfter\doifinset\v!right{\layerparameter\c!corner} {\ifnum\layerparameter\c!column=\zerocount\else % can be < 0 - \scratchcounter\layerparameter\c!column - \scratchcounter-\scratchcounter - \advance\scratchcounter \layoutcolumns - \advance\scratchcounter \plusone - \setevalue{\??ll\currentlayer\c!column}{\the\scratchcounter}% + \setevalue{\??ll\currentlayer\c!column}% + {\the\numexpr-\layerparameter\c!column+\layoutcolumns+\plusone\relax}% \fi \ifdim\@@layerxsiz>\zeropoint \advance\@@layerxpos-\@@layerxsiz @@ -308,12 +307,8 @@ \@@layerxoff-\@@layerxoff \fi}% \ExpandBothAfter\doif\v!middle{\layerparameter\c!corner} - {\ifdim\@@layerxsiz>\zeropoint - \advance\@@layerxpos.5\@@layerxsiz - \fi - \ifdim\@@layerysiz>\zeropoint - \advance\@@layerypos.5\@@layerysiz - \fi}% + {\ifdim\@@layerxsiz>\zeropoint \advance\@@layerxpos.5\@@layerxsiz \fi + \ifdim\@@layerysiz>\zeropoint \advance\@@layerypos.5\@@layerysiz \fi}% \edef\layerpage{\layerparameter\c!page}}% \doifsomething\layerpage {\edef\layerpage{:\layerpage}% @@ -353,13 +348,10 @@ \setbox\nextbox\hbox{\alignedbox[\layerparameter\c!location]\vbox{\flushnextbox}}% \fi \ifnum\layerparameter\c!line=\zerocount\else % no \ifcase, can be negative - \advance\@@layerypos \layerparameter\c!line\lineheight - \advance\@@layerypos \topskip - \advance\@@layerypos-\lineheight - \advance\@@layerypos-\nextboxht + \advance\@@layerypos\dimexpr\layerparameter\c!line\lineheight+\topskip-\lineheight-\nextboxht\relax \fi \ifnum\layerparameter\c!column=\zerocount\else % no \ifcase, can be negative - \advance\@@layerxpos \layoutcolumnoffset{\layerparameter\c!column}% + \advance\@@layerxpos\layoutcolumnoffset{\layerparameter\c!column}% \fi \ifdone \setbox\nextbox\hbox{\alignedbox[rb]\vbox{\flushnextbox}}% @@ -381,8 +373,7 @@ \fi % ll compensation \ifcase\@@lacome\or % this test will become obsolete - \advance\scratchdimen\nextboxht - \advance\scratchdimen\nextboxdp + \advance\scratchdimen\dimexpr\nextboxht+\nextboxdp\relax \nextboxht\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi \nextboxdp\zeropoint \fi @@ -446,12 +437,9 @@ {\doifundefinedelse{\@@layerbox#1}% {\dodoflushlayerA[#1]} {\doifbothsidesoverruled - \dodoflushlayerB\v!left [#1]% left - \orsideone - \dodoflushlayerB\v!right[#1]% right - \orsidetwo - \dodoflushlayerB\v!left [#1]% left - \od}} + {\dodoflushlayerB\v!left [#1]}% left + {\dodoflushlayerB\v!right[#1]}% right + {\dodoflushlayerB\v!left [#1]}}}% left {\dodoflushlayerA[#1]}}}} \def\dodoflushlayerA[#1]% @@ -497,13 +485,18 @@ % stage of additions, i.e. llx/lly accumulate in repeat mode and the % compensation may differ each flush depending on added content \setbox\nextbox \if!!doneb +% \vbox +% {\scratchdimen\getboxlly\layerbox +% \vskip-\scratchdimen +% \scratchdimen\getboxllx\layerbox +% \hskip-\scratchdimen +% \advance\scratchdimen-\wd\layerbox +% \hsize-\scratchdimen +% \if!!donec\box\else\copy\fi\layerbox}% \vbox - {\scratchdimen\getboxlly\layerbox - \vskip-\scratchdimen - \scratchdimen\getboxllx\layerbox - \hskip-\scratchdimen - \advance\scratchdimen-\wd\layerbox - \hsize-\scratchdimen + {\vskip-\getboxlly\layerbox + \hskip-\getboxllx\layerbox + \hsize-\dimexpr\getboxllx\layerbox-\wd\layerbox\relax \if!!donec\box\else\copy\fi\layerbox}% \else \if!!donec\box\else\copy\fi\layerbox % sorry for the delay due to copying @@ -738,7 +731,13 @@ \let\normalsettextpagecontent\settextpagecontent -\definelayer[OTRTEXT] \setuplayer[OTRTEXT][\c!width=\makeupwidth,\c!height=\textheight] +\definelayer + [OTRTEXT] + +\setuplayer + [OTRTEXT] + [\c!width=\innermakeupwidth, + \c!height=\textheight] % will be overloaded in page-spr diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex index 807d77fc0..1637e6327 100644 --- a/tex/context/base/page-mak.tex +++ b/tex/context/base/page-mak.tex @@ -40,10 +40,10 @@ \def\dodefinemakeup[#1][#2]% {\getparameters [\??do#1]% - [\c!width=\makeupwidth, % example in manual - \c!height=\textheight, % example in manual - \c!voffset=\!!zeropoint, % example in manual - \c!hoffset=\!!zeropoint, % example in manual + [\c!width=\innermakeupwidth, % example in manual / was \makeupwidth + \c!height=\textheight, % example in manual + \c!voffset=\!!zeropoint, % example in manual + \c!hoffset=\!!zeropoint, % example in manual \c!commands=, \c!setups=, \c!page=\v!right, @@ -102,7 +102,7 @@ %D The simple case: -\def\donostartmakeup +\def\donostartmakeup % textwidth ? {\page \setupheader[\c!state=\v!empty]% \setupfooter[\c!state=\v!empty]% @@ -151,17 +151,17 @@ %D Selective page processing is handled here. (Why?) \def\doflushmakeup - {\ifverwerken - \ifgeselecteerd + {\ifprocessingpages + \ifpageselected \doshipoutmakeup \fi \else - \ifgeselecteerd \else + \ifpageselected \else \doshipoutmakeup \fi \fi - \ifselecteren - \global\geselecteerdfalse + \ifselectingpages + \global\pageselectedfalse \fi} \def\doshipoutmakeup @@ -185,14 +185,11 @@ [\makeupparameter\c!doublesided] [ \v!yes=>\null \page, - % \verlaagpaginanummer, % new \v!empty=>{\setupmakeuplayout \page[\v!blank]% \null \page}]% - % \verlaagpaginanummer]% % new \fi \fi - % \verlaagpaginanummer % new \globalpopmacro\@@pnstate} % new %D The text surrounding the main body text can be influenced @@ -212,7 +209,7 @@ \definemakeup [\v!standard] - [\c!width=\makeupwidth, + [\c!width=\innermakeupwidth, \c!height=\textheight, \c!voffset=\!!zeropoint, \c!hoffset=\!!zeropoint, diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex index 6a251f0d0..e11d0d15e 100644 --- a/tex/context/base/page-mar.tex +++ b/tex/context/base/page-mar.tex @@ -58,50 +58,64 @@ \c!hoffset=\leftmargindistance, \c!command=, #2]% - \setvalue{#1}{\domarginline{#1}}} + \unexpanded\setvalue{#1}{\dohandlemarginline{#1}}} -\def\domarginline#1% #2 - {\getvalue{\s!do\??im\??im\executeifdefined{\??im\??im#1\c!location}\v!left}{#1}} % {#2} +\def\marginlineparameter #1{\csname\??im\??im\currentmarginline#1\endcsname} +\def\marginlineexecuter #1#2{\executeifdefined{\??im\??im\currentmarginline#1}{#2}} -\def\doleftmarginline#1#2% +\def\dohandlemarginline#1% #2 + {\def\currentmarginline{#1}% + \csname\s!do\??im\??im\executeifdefined{\??im\??im#1\c!location}\v!left\endcsname{#1}} % {#2} + +\def\doleftmarginline#1#2% #1 is redundant (we can remove it when we group dohandlemarginline; maybe ... {\pushindentation \llap - {\postsignalrightpage - \hsize\getvalue{\??im\??im#1\c!width}\relax - \executeifdefined{\??im\??im#1\c!command}\firstofoneargument{#2}\relax - \hskip\leftskip - \hskip\getvalue{\??im\??im#1\c!hoffset }\relax - \hskip\getvalue{\??im\??im#1\c!distance}}% + {\def\currentmarginline{#1}% + \postsignalrightpage + \hsize\marginlineparameter\c!width\relax + \marginlineexecuter\c!command\firstofoneargument{#2}\relax + \hskip\dimexpr + +\leftskip + +\compensatedinnermakeupmargin + +\marginlineparameter\c!hoffset + +\marginlineparameter\c!distance + \relax}% \popindentation \ignorespaces} -\def\dorightmarginline#1#2% +\def\dorightmarginline#1#2% #1 is redundant {\pushindentation \rlap - {\postsignalrightpage - \hskip\hsize - \hskip-\rightskip - \hskip\getvalue{\??im\??im#1\c!hoffset }\relax - \hskip\getvalue{\??im\??im#1\c!distance}\relax - \hsize\getvalue{\??im\??im#1\c!width }\relax - \executeifdefined{\??im\??im#1\c!command}\firstofoneargument{#2}}% + {\def\currentmarginline{#1}% + \postsignalrightpage + \hskip\dimexpr + +\hsize + -\rightskip + +\compensatedinnermakeupmargin + +\marginlineparameter\c!hoffset + +\marginlineparameter\c!distance + \relax + \hsize\marginlineparameter\c!width + \marginlineexecuter\c!command\firstofoneargument{#2}}% \popindentation \ignorespaces} -\setvalue{\s!do\??im\??im\v!left }{\doleftmarginline} -\setvalue{\s!do\??im\??im\v!right}{\dorightmarginline} -\setvalue{\s!do\??im\??im\v!inner}{\presignalrightpage\doifrightpageelse\doleftmarginline \dorightmarginline} -\setvalue{\s!do\??im\??im\v!outer}{\presignalrightpage\doifrightpageelse\dorightmarginline\doleftmarginline } +\long\def\installmarginlinehandler#1#2{\setvalue{\s!do\??im\??im#1}{#2}} + +\installmarginlinehandler \v!left {\doleftmarginline} +\installmarginlinehandler \v!right {\dorightmarginline} +\installmarginlinehandler \v!inner {\presignalrightpage\doifrightpageelse\doleftmarginline \dorightmarginline} +\installmarginlinehandler \v!outer {\presignalrightpage\doifrightpageelse\dorightmarginline\doleftmarginline } -\definemarginline[inleftmargin] [\c!location=\v!left, \c!width=\leftmarginwidth, \c!distance=\leftmargindistance,\c!hoffset=\zeropoint] +\definemarginline[inleftmargin] [\c!location=\v!left, \c!width=\leftmarginwidth, \c!distance=\leftmargindistance, \c!hoffset=\zeropoint] \definemarginline[inrightmargin][\c!location=\v!right,\c!width=\rightmarginwidth,\c!distance=\rightmargindistance,\c!hoffset=\zeropoint] -\definemarginline[inleftedge] [\c!location=\v!left, \c!width=\leftedgewidth, \c!distance=\leftedgedistance, \c!hoffset=\leftmargintotal] -\definemarginline[inrightedge] [\c!location=\v!right,\c!width=\rightedgewidth, \c!distance=\rightedgedistance,\c!hoffset=\rightmargintotal] +\definemarginline[inleftedge] [\c!location=\v!left, \c!width=\leftedgewidth, \c!distance=\leftedgedistance, \c!hoffset=\leftmargintotal] +\definemarginline[inrightedge] [\c!location=\v!right,\c!width=\rightedgewidth, \c!distance=\rightedgedistance, \c!hoffset=\rightmargintotal] \definemarginline[inoutermargin][\c!location=\v!outer,\c!width=\outermarginwidth,\c!distance=\outermargindistance,\c!hoffset=\zeropoint] \definemarginline[ininnermargin][\c!location=\v!inner,\c!width=\innermarginwidth,\c!distance=\innermargindistance,\c!hoffset=\zeropoint] -\definemarginline[inouteredge] [\c!location=\v!outer,\c!width=\outeredgewidth, \c!distance=\outeredgedistance,\c!hoffset=\outermargintotal] -\definemarginline[ininneredge] [\c!location=\v!inner,\c!width=\inneredgewidth, \c!distance=\inneredgedistance,\c!hoffset=\innermargintotal] +\definemarginline[inouteredge] [\c!location=\v!outer,\c!width=\outeredgewidth, \c!distance=\outeredgedistance, \c!hoffset=\outermargintotal] +\definemarginline[ininneredge] [\c!location=\v!inner,\c!width=\inneredgewidth, \c!distance=\inneredgedistance, \c!hoffset=\innermargintotal] \definemarginline[atleftmargin] [\c!location=\v!left, \c!command=\lrlap,\c!width=\zeropoint,\c!distance=\zeropoint,\c!hoffset=\zeropoint] \definemarginline[atrightmargin][\c!location=\v!right,\c!command=\rllap,\c!width=\zeropoint,\c!distance=\zeropoint,\c!hoffset=\zeropoint] @@ -192,9 +206,17 @@ \getparameters[\??im][#1]% \fi} +% \def\dodosetupinmargin[#1]#2% [settings]{class} +% {\checkinmargin[#2]% +% \getparameters[\??im#2][#1]} + \def\dodosetupinmargin[#1]#2% [settings]{class} {\checkinmargin[#2]% - \getparameters[\??im#2][#1]} + \getparameters[\??im#2][#1]% + % will become an \everyinmarginsetup thing + \ifcase\executeifdefined{\??im#2\c!sidemethod}{0}\else + \positioningtrue \positioningpartrue % global ? + \fi} \def\checkinmargin[#1]% {\ifundefined{\??im#1\c!offset}% this offset is related to framed ! @@ -382,11 +404,26 @@ %\hbox{\lower\strutdp\box\scratchbox}} % alas, wrong lapping, therefore useless \dopositionmarginbox\scratchbox} +% \def\domarginblockskip#1% +% {\hskip\margincontenthoffset +% \hskip\compensatedinnermakeupmargin\relax +% \doifelsenothing\margincontentdistance +% {\hskip\getvalue{\??im#1\c!distance}} +% {\hskip\margincontentdistance}% +% \relax} + \def\domarginblockskip#1% - {\hskip\margincontenthoffset - \doifelsenothing\margincontentdistance - {\hskip\getvalue{\??im#1\c!distance}} - {\hskip\margincontentdistance}% + {\doifelsenothing\margincontentdistance + {\hskip\dimexpr + +\margincontenthoffset + +\compensatedinnermakeupmargin + +\csname\??im#1\c!distance\endcsname + \relax} + {\dimexpr + +\margincontenthoffset + +\compensatedinnermakeupmargin + +\margincontentdistance + \relax}% \relax} \def\doleftmarginblock#1#2% @@ -559,8 +596,54 @@ % \placefigure[right]{}{\externalfigure[dummy][width=2cm]} % \input tufte \inothermargin{test} \input tufte +% \def\dodoinmargin[#1][#2][#3][#4][#5]#6% +% {\bgroup +% \forgetall % otherwise sidefloat problems, added 2005/07/20, maybe dangerous +% \postponefootnotes % group is (somehow) needed +% \doifinsetelse\v!low{#4} +% {\chardef\margincontentdisplacement\plusone} +% {\chardef\margincontentdisplacement\zerocount}% +% \doif\v!reverse{#2} +% {\swapmacros\dorightmarginblock\doleftmarginblock}% +% \processaction +% [#1] +% [ \v!left=>\let\next\doleftmarginblock, % no swapping +% \v!right=>\let\next\dorightmarginblock, % no swapping +% \v!inner=>\def\next{\doinmarginswapped\dorightmarginblock\doleftmarginblock }, +% \v!outer=>\def\next{\doinmarginswapped\doleftmarginblock \dorightmarginblock}, +% \s!unknown=>\ifdoublesided +% \doifcommonelse{+,-}{#4} +% {\def\next{\doinmarginswapped\dorightmarginblock\doleftmarginblock }} +% {\def\next{\doinmarginswapped\doleftmarginblock \dorightmarginblock}}% +% \else +% \let\next\doleftmarginblock +% \fi]% +% \next{#3}{#6}% +% \rawpagereference\s!mar{#5}% naar binnen ! ! ! ! +% \flushnotes +% \egroup % don't forget the group +% \ignorespaces} + +% test first +% +% setupsystem[random=1235] +% +% \setupinmargin[left][sidemethod=3] +% \dorecurse{10}{test \fakewords{20}{40} test \inleft{test\\test} test \fakewords{20}{40} \par} +% \page +% \setupinmargin[left][sidemethod=4] +% \dorecurse{40}{test \fakewords{50}{80} test \inleft{test\\test} \par} +% \page + \def\dodoinmargin[#1][#2][#3][#4][#5]#6% {\bgroup +% \tracingall + % old stuff, a bit tricky, but now interfaced + \edef\currentmargincontent{#1}% + \chardef\marginrepositionmethod\executeifdefined{\??im\currentmargincontent\c!sidemethod }\plusone + \chardef\margincontentmethod \executeifdefined{\??im\currentmargincontent\c!textmethod }\plusthree + \chardef\marginpagecheckmethod \executeifdefined{\??im\currentmargincontent\c!splitmethod}\plusone + % so far \forgetall % otherwise sidefloat problems, added 2005/07/20, maybe dangerous \postponefootnotes % group is (somehow) needed \doifinsetelse\v!low{#4} diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex index 991e7532d..4fd0979f8 100644 --- a/tex/context/base/page-mul.tex +++ b/tex/context/base/page-mul.tex @@ -1578,12 +1578,6 @@ % % \stopcolumns -\newif\ifinsidecolumns -% \newif\if@@klbalanceren -% \newif\if@@kluitlijnen - -\insidecolumnsfalse - \def\setupcolumns {\dosingleempty\dosetupcolumns} @@ -1706,6 +1700,76 @@ \vskip-\textheight }% bugged : \prevdepth-\thousandpoint} % signals top of column to \blank +%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. (moved from cont-new.tex) + +\def\setupcolumnspan[#1]% + {\getparameters[\??ks][#1]} + +\presetlocalframed + [\??ks] + +\setupcolumnspan + [\c!n=2, + \c!offset=\v!overlay, + \c!frame=\v!off] + +\newbox\columnspanbox \let\postprocesscolumnspanbox\gobbleoneargument + +\def\dostartcolumnspan[#1]% + {\bgroup + \setupcolumnspan[#1]% + \forgetall + \ifinsidecolumns + \advance\hsize \intercolumnwidth + \hsize\@@ksn\hsize + \advance\hsize -\intercolumnwidth + \fi + \dowithnextbox + {\setbox\columnspanbox\flushnextbox + \ifinsidecolumns\wd\columnspanbox\hsize\fi + \postprocesscolumnspanbox\columnspanbox + \scratchdimen\ht\columnspanbox + \setbox\columnspanbox\hbox % depth to be checked, probably option! + {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}% + \ht\columnspanbox\scratchdimen + \dp\columnspanbox\strutdp + \wd\columnspanbox\hsize + \ifinsidecolumns + \ifnum\@@ksn>1 + \setvsize + \dohandleallcolumns + {\ifnum\currentcolumn>\@@ksn\else + \global\setbox\currenttopcolumnbox=\vbox + {\ifnum\currentcolumn=1 + \snaptogrid\vbox{\copy\columnspanbox} + \else + \snaptogrid\vbox{\vphantom{\copy\columnspanbox}} + \fi}% + \wd\currenttopcolumnbox\hsize + \global\advance\vsize -\ht\currenttopcolumnbox + \fi} + \global\pagegoal\vsize + \else + \snaptogrid\vbox{\box\columnspanbox} + \fi + \else + \snaptogrid\vbox{\box\columnspanbox} + \fi + \endgraf + \ifvmode\prevdepth\strutdp\fi + \egroup} + \vbox\bgroup + %\topskipcorrection % becomes an option ! + \EveryPar{\begstrut\EveryPar{}}} % also ! + +\def\startcolumnspan + {\dosingleempty\dostartcolumnspan} + +\def\stopcolumnspan + {\egroup} + \setupcolumns [\c!n=2, \c!ntop=1, diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex index b5a90fe6b..d9f3bcdc0 100644 --- a/tex/context/base/page-num.tex +++ b/tex/context/base/page-num.tex @@ -94,7 +94,7 @@ \def\savenofsubpages {\ifsubpaging \showmessage\m!layouts6{\newnofsubpages,\the\subpageno}% - \immediatewriteutilitycommand{\twopassentry{\s!subpage}{\newnofsubpages}{\the\subpageno}}% + \savetwopassdata{\s!subpage}{\newnofsubpages}{\the\subpageno}% \fi} \def\setsubpagenumbers @@ -125,13 +125,7 @@ \setsubpagenumbers \ifnum\oldsubpage>\zerocount \showmessage\m!layouts6{\newnofsubpages,\oldsubpage}% - \edef\next % \expanded - {\writeutilitycommand% - {\twopassentry% - {\s!subpage}% - {\newnofsubpages}% - {\oldsubpage}}}% - \next + \savetwopassdata{\s!subpage}{\newnofsubpages}{\oldsubpage}% \fi \doglobal\increment\newnofsubpages\relax \fi @@ -301,23 +295,6 @@ \def\setuppagenumber {\dosingleargument\dosetuppagenumber} -% long time used alternative -% -% \def\verlaagpaginanummer -% {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} -% {\decrementnumber[\s!page]% -% \setuserpageno{\rawnumber[\s!page]}}} -% -% \def\verhoogpaginanummer -% {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} -% {\incrementnumber[\s!page]% -% \setuserpageno{\rawnumber[\s!page]}}% -% \doifinset{\@@pnstatus}{\v!handhaaf,\v!leeg} -% {\global\let\@@pnstatus\v!start}} -% -% alternative, saves some 3 sec on 10K pages on a 1G machine -% (needed during a test / prelude to installable methods) - \def\dodecrementpagenumber {\decrementnumber[\s!page]\setuserpageno{\rawnumber[\s!page]}} @@ -327,8 +304,8 @@ \def\dosynchronizepagenumber {\global\let\@@pnstate\v!start} -\def\verlaagpaginanummer{\getvalue{\??pn-\@@pnstate}} -\def\verhoogpaginanummer{\getvalue{\??pn+\@@pnstate}} +\def\decrementpagenumber{\getvalue{\??pn-\@@pnstate}} +\def\incrementpagenumber{\getvalue{\??pn+\@@pnstate}} \letvalue{\??pn-\v!start }\dodecrementpagenumber \letvalue{\??pn-\v!none }\dodecrementpagenumber @@ -356,13 +333,7 @@ \def\dopagesetreference {\doglobal\increment\nofpagesets\relax - \edef\writepagref - {\writeutilitycommand - {\twopassentry - {\s!page}% - {\nofpagesets}% - {\noexpand\realfolio}}}% - \writepagref} + \lazysavetwopassdata{\s!page}{\nofpagesets}{\noexpand\realfolio}} \def\getpagestatus % hierboven gebruiken {\ifdoublesided diff --git a/tex/context/base/page-plg.tex b/tex/context/base/page-plg.tex index 8478d6ef6..b8da7f88a 100644 --- a/tex/context/base/page-plg.tex +++ b/tex/context/base/page-plg.tex @@ -130,12 +130,9 @@ \vsize\paperheight \setbox\pagebox\vbox {\doifbothsidesoverruled - \let\!!stringa\v!page - \orsideone - \let\!!stringa\v!rightpage - \orsidetwo - \let\!!stringa\v!leftpage - \od + {\let\!!stringa\v!page} + {\let\!!stringa\v!rightpage} + {\let\!!stringa\v!leftpage}% \getvalue{\??ly\c!method:\!!stringa}}% \wd\pagebox\paperwidth \ht\pagebox\paperheight @@ -155,12 +152,9 @@ {\dodopagearea{#1}{#2}\c!middletext}}% \else\ifsecondargument \doifbothsidesoverruled - \dodopagearea{#1}{#2}\c!righttext - \orsideone - \dodopagearea{#1}{#2}\c!righttext - \orsidetwo - \dodopagearea{#1}{#2}\c!lefttext - \od + {\dodopagearea{#1}{#2}\c!righttext} + {\dodopagearea{#1}{#2}\c!righttext} + {\dodopagearea{#1}{#2}\c!lefttext }% \else \doif{#1}\v!text % copy due to trial runs in TABLE {\iftrialtypesetting diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index be744b2a1..6dc5598e0 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -52,6 +52,8 @@ \def\@otr@{otr} +\def\OTRSETmakeupwidth{\innermakeupwidth} + \let\OTRSETflushsidefloats \forgetsidefloats % \relax \let\OTRSETsynchronizesidefloats\forgetsidefloats % \relax @@ -474,13 +476,15 @@ \OTRSETdomakegridbox\nofcolumns\plusone\minusone \fi} +\def\OTRSETmakeupwidth{\makeupwidth} % temporary indirectness + \def\OTRSETdomakegridbox#1#2#3% {\hbox\bgroup \dontcomplain \forgetall % can go once in \flush \!!heighta \textheight % test first ! - \hbox to \makeupwidth + \hbox to \OTRSETmakeupwidth {\dostepwiserecurse{#1}{#2}{#3} {\mofcolumns\recurselevel \localcolumnwidth\OTRSETlocalwidth\mofcolumns @@ -497,9 +501,9 @@ \box\scratchbox \hskip\OTRSETgetparameter\c!distance\recurselevel \fi}}% - \hskip-\makeupwidth + \hskip-\OTRSETmakeupwidth % main text - \hbox to \makeupwidth + \hbox to \OTRSETmakeupwidth {\dostepwiserecurse{#1}{#2}{#3} {\mofcolumns\recurselevel \localcolumnwidth\OTRSETlocalwidth\mofcolumns @@ -1650,11 +1654,11 @@ \def\dosetupcolumnset[#1][#2][#3]% {\ifthirdargument - \def\docommando##1% + \def\docommand##1% {\doifelse{##1}\v!each - {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommando\recurselevel}} + {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommand\recurselevel}} {\getparameters[\??mc#1##1][#3]}}% - \processcommalist[#2]\docommando + \processcommalist[#2]\docommand \else \getparameters[\??mc#1][#2]% \fi} @@ -1787,7 +1791,7 @@ \saveinterlinespace \globallet\columnsetpage\!!plusone \def\currentcolumnset{#2}% - \insidecolumnstrue % will be different flag + \insidecolumnstrue % will be different flag in addition \activateotr{SET}{ONE}% andere naam, activate or so \doifelsenothing{#1} {\globallet\OTRSETlist\s!default} @@ -1918,11 +1922,11 @@ % {\getcommacommandsize[\csname\??mc\OTRSETidentifier\c!regels\endcsname]% % \ifnum\commalistsize>\plusone % \scratchcounter\zerocount -% \def\docommando##1% +% \def\docommand##1% % {\advance\scratchcounter\plusone % \setvalue{\??mc\OTRSETidentifier\the\scratchcounter\c!regels}{##1}}% % \processcommacommand -% [\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommando +% [\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommand % \setvalue{\??mc\OTRSETidentifier\c!regels}{0}% % \fi}} @@ -2313,8 +2317,8 @@ \global\setbox\placeholderboxf\columnplaceholder1f} \def\doOTRSETshowstatus - {\llap{\incolortrue \localcolortrue \tt\tfxx\blue - (\the\vsize->\number\columnfirstcell\#\number\columnfreecells)% + {\llap{\incolortrue \localcolortrue \tt\tfxx + \startcolor[blue](\the\vsize->\number\columnfirstcell\#\number\columnfreecells)\stopcolor \hskip\leftskip}} \def\OTRSETshowstatus @@ -2549,7 +2553,7 @@ \fi} \def\doinitializecolumntextareas#1#2% - {\def\docommando##1% + {\def\docommand##1% {\docheckcolumnsetareapage{##1#2}\plusone \ifdone \donefalse @@ -2560,7 +2564,7 @@ \s!unknown=>\doperformtest\commalistelement\donetrue\donefalse]% \ifdone\dodoinitializecolumntextareas{##1}{#2}\fi \fi}% - \processcommacommand[#1]\docommando} + \processcommacommand[#1]\docommand} \def\dodoinitializecolumntextareas#1#2% {\doOTRSETsetgridcells @@ -2579,7 +2583,7 @@ \def\doplacecolumntextareas#1#2% global ? {\bgroup \forgetall - \def\docommando##1% + \def\docommand##1% {\docheckcolumnsetareapage{##1#2}\zerocount \ifdone \donefalse @@ -2594,7 +2598,7 @@ \doglobal\removefromcommalist{##1}#1% \fi \fi}% - \processcommacommand[#1]\docommando + \processcommacommand[#1]\docommand \egroup} \def\columntextlastbackspace{\backspace} @@ -2820,14 +2824,13 @@ \fi \dostopframedtext \egroup - % frozen keeps grid snapping okay \setbox\scratchbox\frozenhbox to \hsize {\dontcomplain \alignedline{\framedtextparameter{cs:#1}\c!location}\v!middle {\lower\strutdepth\box\scratchbox}}% \dp\scratchbox\zeropoint % else wrong snap insidefloat % -% to be tested first: +% to be tested first (strange in grid mode) % % \setbox\scratchbox\frozenhbox to \hsize % {\dontcomplain diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex index 499f34f93..02c4261fb 100644 --- a/tex/context/base/page-sid.tex +++ b/tex/context/base/page-sid.tex @@ -15,6 +15,24 @@ \unprotect +% problem: when too small, side effects; we need to determine the +% shift earlier so that we can act when shift < size +% +% \definefloat[edgefigure] +% \setupfloat +% [edgefigure] +% [rightmargindistance=-\rightmargintotal, +% leftmargindistance=-\rightmargintotal, +% default=outer] +% \starttext +% \placeedgefigure{}{\framed[width=12cm]{}} \input tufte +% \placeedgefigure{}{\framed[width=5cm]{}} \input tufte +% \placeedgefigure{}{\framed[width=4cm]{}} \input tufte +% \placeedgefigure{}{\framed[width=2cm]{}} \input tufte +% \stoptext + +% todo: dimexpr an dnumexpr + % These macro deal with side floats. We started with Daniel % Comenetz macros as published in TUGBoat Volume 14 (1993), % No.\ 1: Anchored Figures at Either Margin. I extended and @@ -89,6 +107,37 @@ \newdimen\sidefloatrightskip \newdimen\sidefloatmaximum +% \def\checksidefloatshift +% {\ifdim\sidefloatmaximum>\zeropoint +% \ifcase\sidefloattype +% % invalid +% \or +% % backspace +% \or +% \global\sidefloatshift-\sidefloatmaximum +% \global\advance\sidefloatshift-\rightorleftpageaction \leftedgedistance \rightedgedistance +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmarginwidth \rightmarginwidth +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance +% \or +% \global\sidefloatshift-\sidefloatmaximum +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance +% \or +% % left +% \or +% % right +% \or +% \global\sidefloatshift-\sidefloatmaximum +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance +% \or +% \global\sidefloatshift-\sidefloatmaximum +% \global\advance\sidefloatshift-\rightorleftpageaction \leftedgedistance \rightedgedistance +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmarginwidth \rightmarginwidth +% \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance +% \or +% % cutspace +% \fi +% \fi} + \def\checksidefloatshift {\ifdim\sidefloatmaximum>\zeropoint \ifcase\sidefloattype @@ -96,59 +145,118 @@ \or % backspace \or - \global\sidefloatshift-\sidefloatmaximum - \global\advance\sidefloatshift-\rightorleftpageaction \leftedgedistance \rightedgedistance - \global\advance\sidefloatshift-\rightorleftpageaction \leftmarginwidth \rightmarginwidth - \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance + \global\sidefloatshift\dimexpr + -\sidefloatmaximum + -\rightorleftpageaction \leftedgedistance \rightedgedistance + -\rightorleftpageaction \leftmarginwidth \rightmarginwidth + -\rightorleftpageaction \leftmargindistance \rightmargindistance + -\compensatedinnermakeupmargin + \relax \or - \global\sidefloatshift-\sidefloatmaximum - \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance + \global\sidefloatshift\dimexpr + -\sidefloatmaximum + -\rightorleftpageaction \leftmargindistance \rightmargindistance + -\compensatedinnermakeupmargin + \relax \or % left \or % right \or - \global\sidefloatshift-\sidefloatmaximum - \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance + \global\sidefloatshift\dimexpr + -\sidefloatmaximum + -\rightorleftpageaction \leftmargindistance \rightmargindistance + -\compensatedinnermakeupmargin + \relax \or - \global\sidefloatshift-\sidefloatmaximum - \global\advance\sidefloatshift-\rightorleftpageaction \leftedgedistance \rightedgedistance - \global\advance\sidefloatshift-\rightorleftpageaction \leftmarginwidth \rightmarginwidth - \global\advance\sidefloatshift-\rightorleftpageaction \leftmargindistance \rightmargindistance + \global\sidefloatshift\dimexpr + -\sidefloatmaximum + -\rightorleftpageaction \leftedgedistance \rightedgedistance + -\rightorleftpageaction \leftmarginwidth \rightmarginwidth + -\rightorleftpageaction \leftmargindistance \rightmargindistance + -\compensatedinnermakeupmargin + \relax \or % cutspace \fi \fi} +% \def\setsidefloatskips +% {\global\sidefloatrightskip\zeropoint +% \global\sidefloatleftskip \zeropoint +% \ifcase\sidefloattype +% \or % backspace +% \global \sidefloatleftskip \rightorleftpageaction \backspace \cutspace +% \or % leftedge +% \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance +% \global\advance\sidefloatleftskip \rightorleftpageaction \leftmarginwidth\rightmarginwidth +% \global\advance\sidefloatleftskip \rightorleftpageaction \leftedgedistance\rightedgedistance +% \or % leftmargin +% \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance +% \or % leftside +% \or % rightside +% \or % rightmargin +% \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance +% \or % rightedge +% \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance +% \global\advance\sidefloatrightskip\rightorleftpageaction \rightmarginwidth\leftmarginwidth +% \global\advance\sidefloatrightskip\rightorleftpageaction \rightedgedistance\leftedgedistance +% \or % cutspace +% \global \sidefloatrightskip\rightorleftpageaction \cutspace\backspace +% \fi +% \ifdim\sidefloatrightskip>\zeropoint +% \doglobal\advance\sidefloatrightskip\rightskip +% \fi +% \ifdim\sidefloatleftskip>\zeropoint +% \doglobal\advance\sidefloatleftskip\leftskip +% \fi} + + +% use \outermarginwidth etc here + \def\setsidefloatskips {\global\sidefloatrightskip\zeropoint \global\sidefloatleftskip \zeropoint \ifcase\sidefloattype \or % backspace - \global \sidefloatleftskip \rightorleftpageaction \backspace \cutspace + \global\sidefloatleftskip\dimexpr + +\rightorleftpageaction \backspace \cutspace + +\compensatedinnermakeupmargin + \relax \or % leftedge - \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance - \global\advance\sidefloatleftskip \rightorleftpageaction \leftmarginwidth\rightmarginwidth - \global\advance\sidefloatleftskip \rightorleftpageaction \leftedgedistance\rightedgedistance + \global\sidefloatleftskip\dimexpr + +\rightorleftpageaction \leftmargindistance \rightmargindistance + +\rightorleftpageaction \leftmarginwidth \rightmarginwidth + +\rightorleftpageaction \leftedgedistance \rightedgedistance + +\compensatedinnermakeupmargin + \relax \or % leftmargin - \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance + \global\sidefloatleftskip\dimexpr + +\rightorleftpageaction \leftmargindistance \rightmargindistance + +\compensatedinnermakeupmargin + \relax \or % leftside \or % rightside \or % rightmargin - \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance + \global\sidefloatrightskip\dimexpr + +\rightorleftpageaction \rightmargindistance \leftmargindistance + +\compensatedinnermakeupmargin + \relax \or % rightedge - \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance - \global\advance\sidefloatrightskip\rightorleftpageaction \rightmarginwidth\leftmarginwidth - \global\advance\sidefloatrightskip\rightorleftpageaction \rightedgedistance\leftedgedistance + \global\sidefloatrightskip\dimexpr + +\rightorleftpageaction \rightmargindistance \leftmargindistance + +\rightorleftpageaction \rightmarginwidth \leftmarginwidth + +\rightorleftpageaction \rightedgedistance \leftedgedistance + +\compensatedinnermakeupmargin + \relax \or % cutspace - \global \sidefloatrightskip\rightorleftpageaction \cutspace\backspace - \fi - \ifdim\sidefloatrightskip>\zeropoint - \doglobal\advance\sidefloatrightskip\rightskip + \global\sidefloatrightskip\dimexpr + +\rightorleftpageaction \cutspace \backspace + +\compensatedinnermakeupmargin + \relax \fi - \ifdim\sidefloatleftskip>\zeropoint - \doglobal\advance\sidefloatleftskip\leftskip - \fi} + \ifdim\sidefloatrightskip>\zeropoint \doglobal\advance\sidefloatrightskip\rightskip \fi + \ifdim\sidefloatleftskip >\zeropoint \doglobal\advance\sidefloatleftskip \leftskip \fi} % eq is still crap @@ -405,117 +513,53 @@ \fi -% \def\putsidefloat#1% grid (4) is rather experimental -% {\par -% \witruimte -% % moved here dec 2001 -% {\everypar\emptytoks\forgetall\verticalstrut\vskip-\struttotal}% moved -% \checksidefloatshift -% \ifdim\sidefloatshift=\zeropoint \relax -% \ifnum\sidefloattype=4 -% \global\advance\sidefloatshift\sidefloatextrashift -% \global\sidefloatextrashift\zeropoint -% \else\ifnum\sidefloattype=5 -% \global\advance\sidefloatshift\sidefloatextrashift -% \global\sidefloatextrashift\zeropoint -% \fi\fi -% \else -% \ifnum\sidefloattype<4 -% \global\chardef\sidefloattype4 -% \else\ifnum\sidefloattype>5 -% \global\chardef\sidefloattype5 -% \fi\fi -% \fi -% \previoussidefloat -% \stallsidefloat -% %\global\setbox\floatbox\hbox -% % {\ifmarginfloat\else\ifrightfloat\else\kern\sidefloatleftshift\fi\fi -% % \hskip\ifrightfloat-\sidefloatextrashift\else\sidefloatshift\fi -% % \vbox{#1\ifnum\sidefloatalign=4 \removedepth\fi}% -% % \kern\ifrightfloat\sidefloatshift\else-\sidefloatextrashift\fi -% % \ifmarginfloat\else\ifrightfloat\kern\sidefloatrightshift\fi\fi}% +% externfiguur -> grid =ja|hoogte|diepte|halveregel|passend -> helemaal in details +% stelplaatsblokin -> zijuitlijnen=hoogte|diepte|regel|halveregel|grid -> halveregel in 'details' + +% replacement for below +% % \global\setbox\floatbox\hbox % no \hskip, but \kern here -% {\ifnum\sidefloattype=4 +% {\ifcase\sidefloattype +% \vbox{#1}% +% \or % 1 % \hskip\sidefloatleftshift -% \else\ifnum\sidefloattype=1 +% \hskip\sidefloatshift +% \vbox{#1}% +% \kern-\sidefloatextrashift +% \or % 2 +% \hskip\sidefloatshift +% \vbox{#1}% +% \kern-\sidefloatextrashift +% \or % 3 +% \hskip\sidefloatshift +% \vbox{#1}% +% \kern-\sidefloatextrashift +% \or % 4 % \hskip\sidefloatleftshift -% \fi\fi -% \ifnum\sidefloattype>4 -% \hskip-\sidefloatextrashift -% \else % \hskip\sidefloatshift -% \fi -% \vbox{#1\ifnum\sidefloatalign=4 \removedepth\fi}% -% \ifnum\sidefloattype>4 -% \kern\sidefloatshift -% \else +% \vbox{#1\removedepth}% % \kern-\sidefloatextrashift -% \fi -% \ifnum\sidefloattype=8 +% \or % 5 +% \hskip-\sidefloatextrashift +% \vbox{#1}% +% \kern\sidefloatshift % \kern\sidefloatrightshift -% \else\ifnum\sidefloattype=5 +% \or % 6 +% \hskip-\sidefloatextrashift +% \vbox{#1}% +% \kern\sidefloatshift +% \or % 7 +% \hskip-\sidefloatextrashift +% \vbox{#1}% +% \kern\sidefloatshift +% \or % 8 +% \hskip-\sidefloatextrashift +% \vbox{#1}% +% \kern\sidefloatshift % \kern\sidefloatrightshift -% \fi\fi}% -% \ifnum\sidefloatalign=4 -% \getnoflines{\ht\floatbox}% -% \scratchdimen\noflines\lineheight -% \advance\scratchdimen-\strutdepth -% \getrawnoflines\sidefloattopskip -% \advance\scratchdimen\noflines\lineheight -% % todo: maybe rounding problem here -% % \global\setbox\floatbox\hbox{\lower\lineheight\box\floatbox}% -% \global\setbox\floatbox\hbox{\lower\strutdepth\box\floatbox}% -% \global\ht\floatbox\scratchdimen -% \global\dp\floatbox\zeropoint -% \fi -% \ifcase\sidefloatalign \else -% \global\sidefloattopskip\zeropoint -% \fi -% \scratchdimen -% \ifnum\sidefloattype<4 -% \sidefloattopskip -% \else\ifnum\sidefloattype>5 -% \sidefloattopskip -% \else -% \zeropoint -% \fi\fi -% % the top of the box is at the previous baseline -% \ifcase\sidefloatalign -% % 0 normal -% \advance\scratchdimen\strutdepth % == \sidefloattopoffset -% \or % 1 height -% \advance\scratchdimen\strutdepth % == \sidefloattopoffset -% \or % 2 line -% \or % 3 depth -% \advance\scratchdimen\lineheight -% \advance\scratchdimen\strutdepth -% \or % 4 grid -% \scratchdimen\zeropoint -% \fi -% % new -% \global\sidefloatlinesdone\zerocount -% \ifnum\sidefloatsidelines>\zerocount -% \advance\scratchdimen\sidefloatsidelines\lineheight -% \fi -% % new -% \global\setbox\floatbox\hbox -% {\vbox{\vskip\scratchdimen\nointerlineskip\box\floatbox}}% -% \ifnum\sidefloattype<4 -% \global\sidefloattopskip\zeropoint -% \else\ifnum\sidefloattype>5 -% \global\sidefloattopskip\zeropoint -% \fi\fi -% \global\sidefloatdownshift\zeropoint -% \measuresidefloat -% \ifroomforfloat \else -% \tosssidefloat -% \measuresidefloat -% \stallsidefloat -% \fi -% \setsidefloat} - -% externfiguur -> grid =ja|hoogte|diepte|halveregel|passend -> helemaal in details -% stelplaatsblokin -> zijuitlijnen=hoogte|diepte|regel|halveregel|grid -> halveregel in 'details' +% \fi}% +% +% keep this ^ \def\putsidefloat#1% grid (4) is rather experimental {\par diff --git a/tex/context/base/page-str.tex b/tex/context/base/page-str.tex index ca6504598..ed1638029 100644 --- a/tex/context/base/page-str.tex +++ b/tex/context/base/page-str.tex @@ -111,12 +111,20 @@ \let\presetoutputstream\relax -\def\outputstreambox [#1]{\ifvoid\outputstreamtag{#1}\else\box \outputstreamtag{#1}\fi} -\def\outputstreamcopy[#1]{\ifvoid\outputstreamtag{#1}\else\copy\outputstreamtag{#1}\fi} \def\outputstreamht [#1]{\ht\outputstreamtag{#1}} \def\outputstreamdp [#1]{\dp\outputstreamtag{#1}} \def\outputstreamwd [#1]{\wd\outputstreamtag{#1}} +%def\outputstreambox [#1]{\ifvoid\outputstreamtag{#1}\else\box \outputstreamtag{#1}\fi} +%def\outputstreamcopy[#1]{\ifvoid\outputstreamtag{#1}\else\copy\outputstreamtag{#1}\fi} + +\def\dowithoutputstreambox#1[#2]{\ifvoid\outputstreamtag{#2}\else#1\outputstreamtag{#2}\fi} + +\def\outputstreamcopy {\dowithoutputstreambox\copy } +\def\outputstreambox {\dowithoutputstreambox\box } +\def\outputstreamunvcopy{\dowithoutputstreambox\unvcopy} +\def\outputstreamunvbox {\dowithoutputstreambox\unvbox } + %D Footnotes don't go along with streams, simply because there is no %D way to re-split inserts. A dirty way out is to use marks and store %D notes that way. @@ -315,50 +323,50 @@ \box2\vfill\page \egroup} -%D Although one can put floats in a stream, it sometimes makes sense -%D to keep them apart and this is what local floats do. + %D Although one can put floats in a stream, it sometimes makes sense + %D to keep them apart and this is what local floats do. -\def\setuplocalfloats - {\getparameters[\??lf]} + \def\setuplocalfloats + {\getparameters[\??lf]} -\setuplocalfloats - [%before=\blank, - %after=\blank, - inbetween=\blank] + \setuplocalfloats + [%before=\blank, + %after=\blank, + inbetween=\blank] -\installfloathandler \v!local \somelocalfloat + \installfloathandler \v!local \somelocalfloat -\initializeboxstack{localfloats} + \initializeboxstack{localfloats} -\newcounter\noflocalfloats + \newcounter\noflocalfloats -\def\resetlocalfloats - {\doglobal\newcounter\noflocalfloats - \initializeboxstack{localfloats}} + \def\resetlocalfloats + {\doglobal\newcounter\noflocalfloats + \initializeboxstack{localfloats}} -\def\somelocalfloat[#1]% - {\doglobal\increment\noflocalfloats - \savebox{localfloats}{\noflocalfloats}{\box\floatbox}} + \def\somelocalfloat[#1]% + {\doglobal\increment\noflocalfloats + \savebox{localfloats}{\noflocalfloats}{\box\floatbox}} -\def\getlocalfloats - {\dorecurse\noflocalfloats - {\ifnum\recurselevel=\plusone % 1\relax - \getvalue{\??lf\c!before}% - \else - \getvalue{\??lf\c!inbetween}% - \fi - \dontleavehmode\hbox{\foundbox{localfloats}\recurselevel}% - \ifnum\recurselevel=\noflocalfloats\relax - \getvalue{\??lf\c!after}% - \fi}} + \def\getlocalfloats + {\dorecurse\noflocalfloats + {\ifnum\recurselevel=\plusone % 1\relax + \getvalue{\??lf\c!before}% + \else + \getvalue{\??lf\c!inbetween}% + \fi + \dontleavehmode\hbox{\foundbox{localfloats}\recurselevel}% + \ifnum\recurselevel=\noflocalfloats\relax + \getvalue{\??lf\c!after}% + \fi}} -\def\flushlocalfloats - {\getlocalfloats - \resetlocalfloats} + \def\flushlocalfloats + {\getlocalfloats + \resetlocalfloats} -\def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}} + \def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}} -\def\forcelocalfloats{\let\forcedfloatmethod\v!local} + \def\forcelocalfloats{\let\forcedfloatmethod\v!local} %D Because many arrangements are possible, we will implement %D some examples in a runtime loadable module \type {m-streams}. diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex index 14707a5eb..ecc82c46e 100644 --- a/tex/context/base/page-txt.tex +++ b/tex/context/base/page-txt.tex @@ -67,20 +67,6 @@ \def\setuplayouttext {\dotripleempty\dosetuplayouttext} -% \def\dosetuplayouttext[#1][#2][#3]% -% {\ifthirdargument -% \getparameters[\??tk#1#2][#3]% -% \else -% %\getparameters[\??tk#1\v!text][#2]% -% \edef\previoustextstate{\getvalue{\??tk#1\c!state}}% -% \getparameters[\??tk#1][#2]% -% \doifnotvalue{\??tk#1\c!state}\previoustextstate -% {%\checkcurrentlayout % no -% \calculatevsizes -% \recalculatebackgrounds -% \recalculatelogos}% -% \fi} - \def\dosetuplayouttext[#1][#2][#3]% {\ifthirdargument \getparameters[\??tk#1#2][#3]% @@ -92,10 +78,10 @@ {%\checkcurrentlayout % no \edef\currenttextstate{\getvalue{\??tk#1\c!state}}% % speed optimization (calculating backgrounds takes time) - \doifcommon{\previoustextstate,\currenttextstate}{\v!high,\v!none}{% - \calculatevsizes - \recalculatebackgrounds - \recalculatelogos}}% + \doifcommon{\previoustextstate,\currenttextstate}{\v!high,\v!none} + {\calculatevsizes + \recalculatebackgrounds + \recalculatelogos}}% \fi} \def\setuptop {\dotripleempty\dosetuplayouttext[\v!top]} @@ -284,9 +270,6 @@ \setvalue{\string\placelayouttextline\v!none}#1#2% {} -% \setvalue{\string\placelayouttextline\v!high}#1#2% -% {\global\settrue\resyncaftertextline} - \setvalue{\string\placelayouttextline\v!high}#1#2% {\global\settrue\resyncaftertextline \resettextlinestatus{#1}} @@ -322,28 +305,10 @@ %D The following macro has to be called after a page %D is flushed. -% \def\resetlayouttextline#1% -% {\doifvalue{\??tk#1\c!state}\v!high -% {\global\settrue\resyncaftertextline -% \resettextlinestatus{#1}}} - \def\resetlayouttextline#1% {\getvalue {\??tk#1\s!reset}% \letgvalue{\??tk#1\s!reset}\relax} -% \def\resetlayouttextlines -% {\resetlayouttextline\v!top -% \resetlayouttextline\v!header -% \resetlayouttextline\v!text -% \resetlayouttextline\v!footer -% \resetlayouttextline\v!bottom -% \ifconditional\resyncaftertextline -% \doglobal\calculatevsizes -% \recalculatebackgrounds -% \recalculatelogos -% \global\setfalse\resyncaftertextline -% \fi} - \def\resetlayouttextlines {\resetlayouttextline\v!top \resetlayouttextline\v!header @@ -357,6 +322,48 @@ \global\setfalse\resyncaftertextline \fi} +% \settext[header][text][middle][xxx][yyy] + +\def\settextcontent + {\doquintupleempty\dosettextcontent} + +\def\dosettextcontent[#1][#2][#3][#4][#5]% header text middle text/text + {\iffifthargument + \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#5}}% + \else\iffourthargument + \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#4}}% + \else\ifthirdargument + \setvalue{\??tk#1#2\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#3}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}% + \fi\fi\fi} + +\def\resettextcontent + {\dotripleempty\doresettextcontent} + +\def\doresettextcontent[#1][#2][#3]% header text middle + {\ifthirdargument + \letvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}\empty + \else\ifsecondargument + \letvalue{\??tk#1#2\c!lefttext }\empty + \letvalue{\??tk#1#2\c!middletext}\empty + \letvalue{\??tk#1#2\c!righttext }\empty + \fi\fi} + +\let\settext \settextcontent % downward compatibility +\let\resettext\resettextcontent % downward compatibility + +\setvalue{:\c!middle:\c!text:}{\c!middletext} +\setvalue{:\c!left :\c!text:}{\c!lefttext } +\setvalue{:\c!right :\c!text:}{\c!righttext } + %D The next series of macros is not that easy to read, %D because they hook into the main page building macros. By %D using token list registers for the text content, we can @@ -518,15 +525,9 @@ %\getvalue{\??tk#1\v!text\c!before}% \getvalue{\??tk#1\c!before}% \doifbothsidesoverruled - \dodoplacelayouttextline#1\c!lefttext\c!middletext\c!righttext - \gobbleoneargument\getvalue - \orsideone - \dodoplacelayouttextline#1\c!lefttext\c!middletext\c!righttext - \gobbleoneargument\getvalue - \orsidetwo - \dodoplacelayouttextline#1\c!righttext\c!middletext\c!lefttext - \getvalue\gobbleoneargument - \od + {\dodoplacelayouttextline#1\c!lefttext \c!middletext\c!righttext\gobbleoneargument\getvalue} + {\dodoplacelayouttextline#1\c!lefttext \c!middletext\c!righttext\gobbleoneargument\getvalue} + {\dodoplacelayouttextline#1\c!righttext\c!middletext\c!lefttext \getvalue\gobbleoneargument}% %\getvalue{\??tk#1\v!text\c!after}% \getvalue{\??tk#1\c!after}% \kern\zeropoint}% keep the \dp, beware of \vtops, never change this! @@ -726,7 +727,7 @@ % \def\dodoresetlayouttekst[#1][#2]% % {...} % -% \def\docommando#1% +% \def\docommand#1% % {\resetlayouttekst[#1][\v!tekst]% % \resetlayouttekst[#1][\v!marge]% % \resetlayouttekst[#1][\v!rand]} @@ -734,7 +735,7 @@ %D We combine a lot of similar settings in a macro that %D we will later dispose. -\def\dodocommando[#1][#2]% +\def\dodocommand[#1][#2]% {\getparameters [\??tk#1#2] [%\c!state=\v!normal, % moved @@ -756,19 +757,19 @@ \inheritparameter[\??tk#1#2][\c!leftwidth ][\c!width]% \inheritparameter[\??tk#1#2][\c!rightwidth][\c!width]} -\def\docommando#1% - {\dodocommando[#1][\v!text]% - \dodocommando[#1][\v!margin]% - \dodocommando[#1][\v!edge]} +\def\docommand#1% + {\dodocommand[#1][\v!text]% + \dodocommand[#1][\v!margin]% + \dodocommand[#1][\v!edge]} -\docommando\v!top -\docommando\v!header -\docommando\v!footer -\docommando\v!text -\docommando\v!bottom +\docommand\v!top +\docommand\v!header +\docommand\v!footer +\docommand\v!text +\docommand\v!bottom -\let\docommando \relax -\let\dodocommando\relax +\let\docommand \relax +\let\dodocommand\relax %D While the header and footer lines are moved away from the %D main text, the top and bottom lines are centered. diff --git a/tex/context/base/ppchtex.tex b/tex/context/base/ppchtex.tex index 25037018a..f2a022b20 100644 --- a/tex/context/base/ppchtex.tex +++ b/tex/context/base/ppchtex.tex @@ -286,7 +286,7 @@ % \fontdimen's opgehoogd. Omdat dit problemen gaf bij % scaled fonts, is bij nader inzien gekozen voor de % onderstaande oplossing, waarbij de nieuwe waarden worden -% afgeleid van de x-height (\fontdimen5). De factor 0.70 +% afgeleid van de x-height (\fontexheight). De factor 0.70 % is min of meer experimenteel vastgesteld. Soms worden de % regels iets verder uit elkaar gezet. Jammer. Italic fonts % hebben grotere cijfers en vallen min of meer uit de boot. @@ -307,16 +307,16 @@ \def\setsubscripts% {\beginlatexmathmodehack \def\dosetsubscript##1##2##3% - {\dimen0=##3\fontdimen5##2% + {\dimen0=##3\fontexheight##2% \setxvalue{@@\string##1\string##2}{\the##1##2\relax}% ##1##2=\dimen0\relax}% \def\dodosetsubscript##1##2% {\dosetsubscript{##1}{\textfont 2}{##2}% \dosetsubscript{##1}{\scriptfont 2}{##2}% \dosetsubscript{##1}{\scriptscriptfont2}{##2}}% - %\dodosetsubscript{\fontdimen14}{?}% - \dodosetsubscript{\fontdimen16}{.7}% - \dodosetsubscript{\fontdimen17}{.7}% + %dodosetsubscript\mathsupnormal {?}% + \dodosetsubscript\mathsubnormal {.7}% + \dodosetsubscript\mathsubcombined{.7}% \global\loweredsubscriptstrue \endlatexmathmodehack} @@ -330,9 +330,9 @@ {\doresetsubscript{##1}{\textfont2}% \doresetsubscript{##1}{\scriptfont2}% \doresetsubscript{##1}{\scriptscriptfont2}}% - %\dodoresetsubscript{\fontdimen14}% - \dodoresetsubscript{\fontdimen16}% - \dodoresetsubscript{\fontdimen17}% + %dodoresetsubscript\mathsupnormal + \dodoresetsubscript\mathsubnormal + \dodoresetsubscript\mathsubcombined \global\loweredsubscriptsfalse \endlatexmathmodehack \fi} @@ -603,21 +603,21 @@ \dimen2=#2\relax \dimen4=#3\relax \setxvalue{chemical::\the\currentchemical}% - {\noexpand\docommando{\the\dimen0}{\the\dimen2}{\the\dimen4}}% + {\noexpand\docommand{\the\dimen0}{\the\dimen2}{\the\dimen4}}% \egroup} %\def\getchemicaldimensions#1#2#3% % {\global\advance\currentchemical by 1 -% \def\docommando##1##2##3% +% \def\docommand##1##2##3% % {#1=##1\relax#2=##2\relax#3=##3\relax}% % \doifdefinedelse{chemical::\the\currentchemical} % {\getvalue{chemical::\the\currentchemical}} -% {\docommando{6cm}{4cm}{0cm}}} +% {\docommand{6cm}{4cm}{0cm}}} % %\def\savechemicaldimensions% % {\bgroup % \writestatus{ppchtex}{saving dimensions in ppchtex.dim}% -% \def\docommando##1##2##3% +% \def\docommand##1##2##3% % {\immediate\write\scratchwrite % {\noexpand\setchemicaldimensions{##1}{##2}{##3}}}% % \immediate\openout\scratchwrite=ppchtex.dim @@ -734,9 +734,9 @@ \!!countc\!!countd \@@chemicalbottom\@@chemicaltop\@@chemicalheight}% % - \edef\@@chemheight {\the\!!countc}% - \edef\@@chemdepth {\the\!!countd}% - \edef\@@chemicaltop{\the\!!countc}% + \edef\@@chemheight {\the\!!countc}% + \edef\@@chemdepth {\the\!!countd}% + \edef\@@chemicaltop {\the\!!countc}% \edef\@@chemicalbottom{\the\!!countd}% % \doifinsetelse\v!on{\@@chemicalframe,\@@chemicalaxis} diff --git a/tex/context/base/regi-ini.mkii b/tex/context/base/regi-ini.mkii new file mode 100644 index 000000000..7c0850b90 --- /dev/null +++ b/tex/context/base/regi-ini.mkii @@ -0,0 +1,153 @@ +%D \module +%D [ file=regi-ini, +%D version=2000.12.27, % 1998.12.03, +%D title=\CONTEXT\ Regime Macros, +%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. + +\unprotect + +%D Plugs into the common interface. + +\def\mkloadregime#1% + {\makeshortfilename[\truefilename{\f!regimeprefix#1}]% + \startreadingfile + \readsysfile\shortfilename + {\showmessage\m!regimes2{#1}} + {\showmessage\m!regimes3{#1}}% + \stopreadingfile} + +\def\mkenableregime#1% + {\the\executeifdefined{\@reg@#1}\emptytoks} + +\def\mkwalkregime#1% + {\the\executeifdefined{\@reg@\currentregime}\emptytoks} + +\def\mkautosetregime#1#2% + {\ifnum#2>127 + \expanded{\defineactivetoken #2 \@EA\noexpand\csname#1\endcsname}% + \fi} + +%D Remark: regimes accumulate, so there is no explicit reset in +%D mkii mode. + +%D \macros +%D {startregime} +%D +%D Sometimes it makes sense to activate the characters in the +%D upper half of the character table. Such a bundle of +%D characters can be packages in a regime. Later we will see +%D encodings (that links characters slots to glyphs) and +%D mappings (that take care of hyphenation and case changes). +%D +%D When character~231 is of category code letter, it +%D directly maps to glyph~231 (unless of course some virtual +%D font is used). By making character~231 active, we can map +%D it onto for instance the glyph in slot 233. This mapping +%D can in itself be indirect, in the sense that it is for +%D instance handled by an accent command. +%D +%D Regimes are implemented roughly the same as mappings, but +%D enabled under different circumstances. In the future, the +%D low level implementation may change. + +\def\startregime[#1]% + {\pushmacro\currentregime + \edef\currentregime{#1}% + \checkregimetoks} + +\def\checkregimetoks + {\doifundefined{\@reg@\currentregime} + {\@EA\newtoks\csname\@reg@\currentregime\endcsname}} + +\def\stopregime + {\popmacro\currentregime} + +\def\setregimetoks + {\checkregimetoks + \@EA\let\@EA\regimetoks\csname\@reg@\currentregime\endcsname} + +%D \macros +%D {defineactivedecimal, defineactivedecimals, defineactivetoken} +%D +%D The following commands are rather ugly ones. It makes a +%D character active and assigns it a value. When expanded, +%D the decimal number of the character is passed as first +%D argument. +%D +%D \starttyping +%D \def\decimalcharacter#1{\message{#1 is now active}} +%D +%D \defineactivedecimal 122 {\decimalcharacter} +%D +%D \defineactivedecimals 128 to 255 as {\decimalcharacter} +%D \stoptyping +%D +%D This command is typically used in coding definitions, +%D like the \UNICODE\ one. + +\def\dodefineactivedecimal#1#2% \unexpanded ? pdfdoc encoding + {\catcode#1\active + \scratchcounter\uccode\activehackcode + \uccode\activehackcode#1\relax + \uppercase{\unexpanded\edef~{\noexpand#2{\number#1}}}% + \uccode\activehackcode\scratchcounter} + +\long\def\defineactivedecimal#1 #2 % + {\setregimetoks + \regimetoks\expandafter{\the\regimetoks\dodefineactivedecimal{#1}{#2}}} + +\long\def\defineactivedecimals#1 to #2 as #3 % + {\setregimetoks + \dostepwiserecurse{#1}{#2}\plusone + {\regimetoks\@EA\@EA\@EA{\@EA\the\@EA\regimetoks\@EA\dodefineactivedecimal\@EA{\recurselevel}{#3}}}} + +\def\doexpandactivedecimal#1% + {\ifnum#1>\scratchcounter + \expandafter\gobbletwoarguments + \else + \noexpand\dodefineactivedecimal{#1}{\the\scratchtoks}% + \expandafter\expandafter\expandafter\doexpandactivedecimal\expandafter + \fi\expandafter{\the\numexpr#1+\plusone\relax}} + +\long\def\defineactivedecimals#1 to #2 as #3 % + {\setregimetoks + \scratchcounter#2\relax + \scratchtoks{#3}% + \expanded{\regimetoks{\the\regimetoks\doexpandactivedecimal{#1}}}% + \ignorespaces} + +\long\def\defineactivetoken #1 #2% no {} after #2, else no kern + {\setregimetoks + \regimetoks\expandafter{\the\regimetoks\defineactivecharacter#1 {#2}}} + +\long\def\defineactiveinspector #1 #2% watch the missing {} + {\setregimetoks + \regimetoks\expandafter{\the\regimetoks\defineactivecharacter#1 {#2}}} + +% D This is kind of obsolete (replaced by previous code). +% +% \def\definetoken #1 % #1 = rawtoken or number +% {\doifnumberelse{\string#1} +% {\expanded{\dodefinetoken{\rawcharacter{#1}}}} +% {\expanded{\dodefinetoken{\string#1}}}} +% +% \def\dodefinetoken#1#2% +% {\defineactivecharacter#1 {\dohandletoken{#1}} % +% \setvalue{\@reg@:t:\currentregime#1}{#2}} +% +% \def\dohandletoken#1% +% {\csname\ifcsname \@reg@:t:\currentregime#1\endcsname % regi-def sets the defaults +% \@reg@:t:\currentregime\else\defaultregime\fi#1\endcsname} + +%D Preloading: + +\useregime[def,uni,utf] % we load the rest runtime + +\protect \endinput diff --git a/tex/context/base/regi-ini.tex b/tex/context/base/regi-ini.tex index 679730d40..3de73d90a 100644 --- a/tex/context/base/regi-ini.tex +++ b/tex/context/base/regi-ini.tex @@ -11,34 +11,172 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D For the moment regimes are implemented in \type -%D {enco-ini.tex} module, but some day we will move the -%D code here. +\unprotect -% also needed: message +%D Messages (to be translated). -\unprotect +\startmessages dutch library: regimes + title: regime + 1: regime -- + 2: regime -- wordt geladen + 3: onbekend regime -- +\stopmessages -\def\douseregime#1% nearly identical to encoding - {\doifundefined{\c!file\f!regimeprefix#1}% - {\setvalue{\c!file\f!regimeprefix#1}{}% - \makeshortfilename[\truefilename{\f!regimeprefix#1}]% - \startreadingfile - \readsysfile\shortfilename - {\showmessage\m!encodings2{#1}} - {\showmessage\m!encodings3{#1}}% - \stopreadingfile}} +\startmessages english library: regimes + title: regime + 1: regime -- + 2: regime -- is loaded + 3: unknown regime -- +\stopmessages + +\startmessages german library: regimes + title: Kodierung + 1: Kodierung -- + 2: Kodierung -- ist geladen + 3: Unbekannte Kodierung -- +\stopmessages + +\startmessages czech library: regimes + title: kodovani + 1: kodovani -- + 2: je nacteno kodovani -- + 3: nezname kodovani -- +\stopmessages + +\startmessages italian library: regimes + title: codifica + 1: codifica -- + 2: codifica -- caricata + 3: codifica sconosciuta -- +\stopmessages + +\startmessages norwegian library: regimes + title: koding + 1: koding -- + 2: koding -- er lest inn + 3: ukjent koding -- +\stopmessages + +\startmessages romanian library: regimes + title: codificari + 1: codificarea -- + 2: codificarea -- este Encarcata + 3: codificarea -- este necunoscuta +\stopmessages + +\startmessages french library: regimes + title: encodage + 1: encodage -- + 2: l'encodage -- est chargé + 3: encodage -- inconnu +\stopmessages + +%D Variables. + +\def\@reg@{@r@eg@} % regime prefix + +%D \macros +%D {currentregime} + +\let\currentregime\empty +\let\defaultregime\s!default + +%D Plugin interface. + +\let\mkloadregime \gobbleoneargument +\let\mkenableregime \gobbleoneargument +\let\mkdisableregime\relax +\let\mkshowregime \gobbleoneargument +\let\mkwalkregime \gobbleoneargument +\let\mkautosetregime\gobbletwoarguments + +%D Some low level inheritance stuff (mkii). + +\def\doautosetregime{\mkautosetregime} + +%D \macros +%D {defineregimesynonym,trueregimename} + +\def\defineregimesynonym + {\dodoubleargument\dodefineregimesynonym} + +\def\dodefineregimesynonym[#1][#2]% + {\setevalue{\@reg@:s:#1}{#2}} + +\def\trueregimename#1% + {\executeifdefined{\@reg@:s:#1}{#1}} + +%D \macros +%D {useregime} \def\useregime[#1]% {\processcommalist[#1]\douseregime} -\fetchruntimecommand \showregime {regi-run} +\def\douseregime#1% + {\doifundefined{\c!file\f!regimeprefix#1}% + {\letgvalue{\c!file\f!regimeprefix#1}\empty + \mkloadregime{#1}}} + +%D \macros +%D {enableregime,disableregime} + +\let\enabledregime\empty + +\def\enableregime[#1]% + {\edef\currentregime{\trueregimename{#1}}% + \doifelsenothing\currentregime + {\disableregime} + {\douseregime\currentregime + \mkenableregime\currentregime}} + +\def\disableregime + {\let\currentregime\empty + \mkdisableregime} + +%D \macros +%D {protectregime, settoletterunlessactive, settocodeunlessactive} +%D +%D The next boolean is used later on to prevent unwanted +%D catcode changes. Use it with care. + +\newif\ifprotectregime \protectregimetrue + +\def\settoletterunlessactive#1% + {\ifprotectregime\ifnum\catcode#1=\active\else + \catcode#1\@@letter + \fi\else + \catcode#1\@@letter + \fi} + +\def\settootherunlessactive#1% + {\ifprotectregime\ifnum\catcode#1=\active\else + \catcode#1=\@@other + \fi\else + \catcode#1=\@@other + \fi} + +\def\settocodeunlessactive#1#2% + {\ifprotectregime\ifnum\catcode#1=\active\else + \catcode#1=#2\relax + \fi\else + \catcode#1=#2\relax + \fi} + +%D Sort related: + +\def\dowalkregime{\mkwalkregime} % #1 + +%D \macros +%D {showregime} + +\def\showregime + {\dosingleempty\doshowregime} -\protect +\def\doshowregime[#1]% + {\mkshowregime{#1}} -% \useregime[def,uni,ibm,win,il1,mac] -% \useregime[def,uni,iso-8858-1,iso-8858-2,cp1252,mac] +%D Plugins. -\useregime[def,uni,utf] % we load the rest runtime +\loadmkfile{regi-ini} -\endinput +\protect \endinput diff --git a/tex/context/base/regi-run.mkii b/tex/context/base/regi-run.mkii new file mode 100644 index 000000000..573f1803b --- /dev/null +++ b/tex/context/base/regi-run.mkii @@ -0,0 +1,32 @@ +%D \module +%D [ file=regi-run, +%D version=2003.03.12, +%D title=\CONTEXT\ Regime Macros, +%D subtitle=Runtime Macros, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=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\mkshowregime#1% + {\doifnot{#1}{utf} + {\bgroup + \enableregime[#1]% + \starttabulate[|l|l|l|] + \dostepwiserecurse{128}{255}{1} + {\expanded + {\scantokens + {\NC \recurselevel + \NC \rawcharacter\recurselevel + \NC \noexpand\tttf + \noexpand\meaning\rawcharacter\recurselevel \NC \NR}}}% + \stoptabulate + \unskip + \egroup}} + +\protect \endinput diff --git a/tex/context/base/regi-utf.tex b/tex/context/base/regi-utf.tex index da89eedec..85bdbf32f 100644 --- a/tex/context/base/regi-utf.tex +++ b/tex/context/base/regi-utf.tex @@ -37,26 +37,22 @@ \expandafter \endinput \endXETEX -\unprotect +\beginMETATEX + \expandafter \endinput +\endMETATEX -% beware, this may change: \utftwouniglyph rawchar +\unprotect \startregime[utf] \dostepwiserecurse{192}{223}{1} - {\expanded{\defineactiveinspector{\recurselevel} % space delimited - {\noexpand\utftwouniglph{\recurselevel}}}% - }%\letvalue{\@@univector\recurselevel}\gobbleoneargument} + {\expanded{\defineactiveinspector{\recurselevel} {\noexpand\utftwouniglph {\recurselevel}}}} % space delimited \dostepwiserecurse{224}{239}{1} - {\expanded{\defineactiveinspector{\recurselevel} % space delimited - {\noexpand\utfthreeuniglph{\recurselevel}}}% - }%\letvalue{\@@univector\recurselevel}\gobbetwoarguments} + {\expanded{\defineactiveinspector{\recurselevel} {\noexpand\utfthreeuniglph{\recurselevel}}}} % space delimited \dostepwiserecurse{240}{247}{1} - {\expanded{\defineactiveinspector{\recurselevel} % space delimited - {\noexpand\utffouruniglph{\recurselevel}}}% - }%\letvalue{\@@univector\recurselevel}\gobblethreearguments} + {\expanded{\defineactiveinspector{\recurselevel} {\noexpand\utffouruniglph {\recurselevel}}}} % space delimited \stopregime diff --git a/tex/context/base/rlxtools.rlx b/tex/context/base/rlxtools.rlx index 2c5c3c6ce..3d4579804 100644 --- a/tex/context/base/rlxtools.rlx +++ b/tex/context/base/rlxtools.rlx @@ -2,6 +2,8 @@ + + -%D -%D -%D +%D +%D +%D +%D %D %D PRAGMA Advanced Document Engineering %D Manuals %D Beginners Manual %D A bunch of figures. %D -%D +%D %D
%D koe.pdf %D %D Corel Draw Suite %D I bet that you've seen this cow before. %D
-%D +%D %D
%D non existent %D %D Nobody %D When will we talk about European cows? %D
-%D -%D
-%D \stoptyping -%D -%D You can convert this base into a \PDF\ file using -%D \TEXEXEC\ and another module in this suite. -%D -%D \starttyping +%D +%D
+%D \stoptyping +%D +%D You can convert this base into a \PDF\ file using +%D \TEXEXEC\ and another module in this suite. +%D +%D \starttyping %D texexec --pdf --use=fig-make yourfile.xml -%D \stoptyping -%D -%D You can now select a graphic from this file using the -%D -%D \starttyping +%D \stoptyping +%D +%D You can now select a graphic from this file using the +%D +%D \starttyping %D \externalfigure[a dutch cow][width=4cm] -%D \stoptyping +%D \stoptyping +%D +%D This module overloads this command so that a figure is +%D it first searched in the list of databases. %D -%D This module overloads this command so that a figure is -%D it first searched in the list of databases. -%D -%D \starttyping +%D \starttyping %D \usemodule [fig-base] %D \usefigurebases[yourfile] -%D \stoptyping -%D -%D The special keyword \type {reset} can be used to reset +%D \stoptyping +%D +%D The special keyword \type {reset} can be used to reset %D this list. \startcommands dutch english german czech italian romanian - usefigurebase: gebruikfiguurbestand usefigurebase - usefigurebase usefigurebase - usefigurebase usefigurebase + usefigurebase: gebruikfiguurbestand usefigurebase + usefigurebase usefigurebase + usefigurebase usefigurebase -\stopcommands +\stopcommands -\unprotect +\unprotect \consultutilityfilefalse @@ -121,7 +121,7 @@ \traceXMLelementsfalse \startXMLmapping[-][figbase] \resetfigurefilebase - \XMLerase{file} + \XMLerase{file} \XMLerase{dummy} \XMLerase{label} \xdef\figurefilebase{#1}% @@ -151,28 +151,69 @@ \globalletempty\figurefilebasepath \globalletempty\figurefilepage} -\let\normalcalculateexternalfigure\calculateexternalfigure - -\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% - {\resetfigurefilebase - \ifx\figurebaselist\empty - \normalcalculateexternalfigure - [#1][#2][#3][#4][#5][#6]% - \else - \def\docommando##1% - {\getfigurefilename{##1}{#3}% - \ifx\figurefilename\empty\else\quitcommalist\fi}% - \processcommacommand[\figurebaselist]\docommando - \ifx\figurefilename\empty - \stripspaces\from#3\to\figurefilename % to be sure - \normalcalculateexternalfigure - [#1][#2][\figurefilename][#4][#5][#6]% - \else - \let\figurepathlist\figurefilebasepath - \normalcalculateexternalfigure - [#1][#2][\figurefilebase.pdf][\c!page=\figurefilepage,#4][#5][#6]% - \fi - \fi} +\ifx\doanalyzefiguredimensionsfromfile\undefined + + % will become obsolete once the new core-fig is used + + \let\normalcalculateexternalfigure\calculateexternalfigure + + \def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% + {\resetfigurefilebase + \ifx\figurebaselist\empty + \normalcalculateexternalfigure[#1][#2][#3][#4][#5][#6]% + \else + \def\docommand##1% + {\doshowfigurestate{base : check #3 in ##1}% + \getfigurefilename{##1}{#3}% + \ifx\figurefilename\empty\else\quitcommalist\fi}% + \processcommacommand[\figurebaselist]\docommand + \ifx\figurefilename\empty + \stripspaces\from#3\to\figurefilename % to be sure + \normalcalculateexternalfigure[#1][#2][\figurefilename][#4][#5][#6]% + \else + \doiffileelse{\figurefilebase.pdf} + {\let\figurepathlist\figurefilebasepath + \normalcalculateexternalfigure + [#1][#2][\figurefilebase.pdf]% + [\c!page=\figurefilepage,#4][#5][#6]} + {\@EA\stripspaces\@EA\from\figurefilename\to\figurefilename + \normalcalculateexternalfigure[#1][#2][\figurefilename][#4][#5][#6]}% + \fi + \fi} + +\else + + % todo: use different internal names, \figurebasepage and such + + \def\doanalyzefiguredimensionsfromfile + {\ifcase\figurestatus \ifx\figurebaselist\empty \else + \resetfigurefilebase + \doshowfigurestate{base list : \figurebaselist}% + \processcommacommand[\figurebaselist]\dodoanalyzefiguredimensionsfromfile + \ifx\figurefilename\empty + \doshowfigurestate{base warning : no matching name found}% + \else + \doiffileelse{\figurefilebase.pdf} + {\doshowfigurestate{base file : \figurefilebase.pdf}% + \doshowfigurestate{base page : \figurefilepage}% + \let\figurepathlist\figurefilebasepath + \analyzefigurefilename{\figurefilebase.pdf}\wantedfigurelabel + \let\wantedfigurepage\figurefilepage} + {\doshowfigurestate{base missing : \figurefilebase.pdf}} + \fi + \ifcase\figurestatus + \analyzefigurefilename\expandedfigurename\wantedfigurelabel + \fi + \fi \fi} + + \def\dodoanalyzefiguredimensionsfromfile#1% + {\doshowfigurestate{base check : \wantedfigurename\space in #1}% + \getfigurefilename{#1}\wantedfigurename + \ifx\figurefilename\empty\else + \quitcommalist + \fi} + +\fi \def\usefigurebase[#1]% {\doifelse{#1}\v!reset @@ -183,7 +224,7 @@ \resetfigurefilebase -\protect \endinput +\protect \endinput \usefigurebase[figtest] diff --git a/tex/context/base/x-fig-01.tex b/tex/context/base/x-fig-01.tex index e74cfc483..c2f97fea9 100644 --- a/tex/context/base/x-fig-01.tex +++ b/tex/context/base/x-fig-01.tex @@ -228,8 +228,8 @@ [\XMLpop{file}] [maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}% [GridPg]% - \freezedimenmacro\naturalfigurewidth \let\FigWid\naturalfigurewidth - \freezedimenmacro\naturalfigureheight\let\FigHei\naturalfigureheight + \let\FigWid\figurenaturalwidth + \let\FigHei\figurenaturalheight \advance\hsize by -150pt \hskip10pt \advance\hsize by -10pt diff --git a/tex/context/base/x-newmme.tex b/tex/context/base/x-newmme.tex index 9763de114..73e574bd5 100644 --- a/tex/context/base/x-newmme.tex +++ b/tex/context/base/x-newmme.tex @@ -345,16 +345,8 @@ \defineXMLentity [lparent] {\getXMLentity{lparenthesis}} \defineXMLentity [rparent] {\getXMLentity{rparenthesis}} -% \bgroup -% \catcode`\{=12 \doglobal\convertargument{\to\mmllbrace -% \catcode`\}=12 \doglobal\convertargument}\to\mmlrbrace -% \egroup - -% \expanded{\defineXMLentity[\mmllbrace]}{\getXMLentity{lbrace}} -% \expanded{\defineXMLentity[\mmlrbrace]}{\getXMLentity{rbrace}} - -\expanded{\defineXMLentity[\iftrue \string{\else}\fi]}{\getXMLentity{lbrace}} -\expanded{\defineXMLentity[\iffalse{\else\string}\fi]}{\getXMLentity{rbrace}} +\defineXMLentity [\letterleftbrace ] {\getXMLentity{lbrace}} +\defineXMLentity [\letterrightbrace] {\getXMLentity{rbrace}} \defineXMLentity [{[}] {\getXMLentity{lbracket}} \defineXMLentity [{]}] {\getXMLentity{rbracket}} diff --git a/tex/context/base/x-newmml.tex b/tex/context/base/x-newmml.tex index 32b98525d..690c9ca70 100644 --- a/tex/context/base/x-newmml.tex +++ b/tex/context/base/x-newmml.tex @@ -638,6 +638,32 @@ \endgroup \stopsetups +\startsetups mmc:interval:fetch + \defineXMLnested [interval] + [closure=closed] + {\directsetup{mmc:interval:fetch:start}} + {\directsetup{mmc:interval:fetch:stop}} +\stopsetups + +\startsetups mmc:interval:fetch:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:interval:fetch:stop + \stopsavingXMLelements + \globallet\MMCintervalfrom\empty + \globallet\MMCintervalto \empty + \ifcase\XMLstacklevel + \or + \xdef\MMCintervalfrom{\getXMLstackdata\plusone} + \or + \xdef\MMCintervalfrom{\getXMLstackdata\plusone} + \xdef\MMCintervalto {\getXMLstackdata\plustwo} + \fi + \endgroup +\stopsetups + \setupMMLappearance[interval][\c!alternative=\v!a,\c!separator={,}] \mapXMLvalue {mmc:int} {closed} @@ -753,6 +779,24 @@ \endgroup \stopsetups +\startsetups mmc:lambda:simple + \defineXMLnested + [lambda] + {\directsetup{mmc:lambda:simple:start}} + {\directsetup{mmc:lambda:simple:stop}} +\stopsetups + +\startsetups mmc:lambda:simple:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:lambda:simple:stop + \stopsavingXMLelements + \XMLfirstnamed{apply} + \endgroup +\stopsetups + % compose \defineXMLcommand [compose] {\directsetup{mmc:compose}} @@ -1425,7 +1469,8 @@ \halign{$\scriptstyle\hss##\hss$\cr#1\crcr}}} \def\MMLcSUMandPRODUCT#1#2% - {\XMLdoifonstackelse{condition,bvar,lowlimit} + {\begingroup + \XMLdoifonstackelse{condition,bvar,lowlimit} {\def\MMLcSUMlow {_{\XMLdoifonstackelse{condition} {\collectXMLnamedstack{condition}{\crcr}% @@ -1439,8 +1484,22 @@ \XMLdoifonstackelse{uplimit} {\def\MMLcSUMup{^{\XMLfirstnamed{uplimit}}}} {\let\MMLcSUMup\empty}% + \XMLdoifonstackelse{interval} % open math converter gives this + {\begingroup + \directsetup{mmc:interval:fetch}% + \XMLfirstnamed{interval}% + \endgroup + \ifx\MMCintervalfrom\empty\else + \def\MMLcSUMlow{_{\XMLdoifonstackelse{bvar}{\XMLfirstnamed{bvar}{=}}{}\MMCintervalfrom}}% + \fi + \ifx\MMCintervalto\empty \else + \def\MMLcSUMup{^{\MMCintervalto}}% + \fi} + {}% \MMLcreset#2\doMMLlimits{#1}\MMLcSUMup\MMLcSUMlow - \MMLcreset\XMLfirstnamed{apply,ci}} + \directsetup{mmc:lambda:simple}% a bit of open math conversion mess + \MMLcreset\XMLfirstnamed{apply,lambda,ci}% + \endgroup} \defineXMLcommand [limit] {\directsetup{mmc:limit}} @@ -1714,7 +1773,7 @@ % best is to grab the apply (independent of order), (*1*), so: % \XMLdoifonstackelse {apply} { - \doifelseMMCfunctioninapply \XMLstackposition \MMLcfunctionlist \donefalse \donetrue + \doifelseMMCfunctioninapply \XMLstackposition {\MMLcfunctionlist,divide} \donefalse \donetrue } { \donefalse } @@ -2231,19 +2290,19 @@ \def\MMLpTABLEmapper#1#2% {\doifXMLparelse{mtable}{#1} {\newcounter\MMLcounter - \def\docommando##1% + \def\docommand##1% {\increment\MMLcounter \expanded{\setupTABLE[column][\MMLcounter][#2=\XMLval{mmp:mtable}{#2:##1}\empty]}}% - \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommando} + \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommand} {}} \def\MMLpTABLEsplitter#1#2% {\doifXMLparelse{mtable}{#1} {\newcounter\MMLcounter - \def\docommando##1% + \def\docommand##1% {\increment\MMLcounter \expanded{\setupTABLE[column][\MMLcounter][#2=##1]}}% - \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommando} + \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommand} {}} \def\MMLpTABLEmap#1#2% @@ -2340,9 +2399,9 @@ % watch the extra {}'s \ifdone \ifodd\scratchcounter - ^{\getXMLstackdata\recurselevel}{} - \else _{\getXMLstackdata\recurselevel} + \else + ^{\getXMLstackdata\recurselevel}{} \fi \else \doif{\getXMLstackname\recurselevel}{mprescripts}{\donetrue{}} @@ -2489,6 +2548,72 @@ \fi \stopsetups +\def\xflushXMLstackwith#1#2#3#4% num bgroup egroup whatever + {\dostepwiserecurse{#1}\XMLstacklevel\plusone + {#2\relax + \ifnum\recurselevel>#1\relax#4\fi + \getXMLstackdata\recurselevel + #3}} + +\def\xflushXMLstackfrom#1#2#3% + {\dostepwiserecurse{#1}\XMLstacklevel\plusone + {#2\getXMLstackdata\recurselevel#3}} + +% +% +% b +% b +% a +% +% +% bb +% b +% a +% +% + +\startsetups mmc:minus + \doif \@@MMLsignreduction \v!yes { + \setMMLcreset{fn,\MMLcfunctionlist} + } + \ifcase\XMLstacklevel + \or + % self + \or + -\getXMLstackdata\plustwo + \else + \dostepwiserecurse\plustwo\XMLstacklevel\plusone { + \begingroup + \doifelse {\getXMLstackname\recurselevel} {apply} { + \ifnum\recurselevel=\plustwo + \begingroup + \dodoifelseMMCfunctioninapply \recurselevel {minus} { + \ifnum\XMLstacklevel>\plustwo + \endgroup + \else + \endgroup + \MMLcreset + \fi + } { + \endgroup + } + \else + \doifelseMMCfunctioninapply \recurselevel {\MMLcfunctionlist,\MMLcconstructlist} { + \MMLcreset + } { + } + \fi + } { + } + \getXMLstackdata\recurselevel + \ifnum\recurselevel<\XMLstacklevel\relax + - + \fi + \endgroup + } + \fi +\stopsetups + \stopmoduletestsection \stopmodule diff --git a/tex/context/base/x-newmmo.tex b/tex/context/base/x-newmmo.tex index 2becfb30a..5e05faae9 100644 --- a/tex/context/base/x-newmmo.tex +++ b/tex/context/base/x-newmmo.tex @@ -48,7 +48,7 @@ %D %D \typebuffer \processXMLbuffer -\startsetups mmc:csymbol:http://www.openmath.org/cd/math4all\string#diffquot +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\string#diffquot \MMLcreset \frac { \Delta\getXMLstackdata\plustwo @@ -97,7 +97,7 @@ %D %D \typebuffer \processXMLbuffer -\startsetups mmc:csymbol:http://www.openmath.org/cd/math4all\string#difference +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\string#difference \MMLcreset \Delta\getXMLstackdata\plustwo \stopsetups @@ -114,7 +114,7 @@ %D %D \typebuffer \processXMLbuffer -\startsetups mmc:csymbol:http://www.openmath.org/cd/math4all\string#diff +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\string#diff \MMLcreset \frac { \mfunction{\getXMLentity{mathematicald}}\getXMLstackdata\plustwo diff --git a/tex/context/base/x-om2cml.xsl b/tex/context/base/x-om2cml.xsl index acd95db2c..60888c10d 100644 --- a/tex/context/base/x-om2cml.xsl +++ b/tex/context/base/x-om2cml.xsl @@ -408,16 +408,16 @@ - + open - + closed - + open-closed - + closed-open @@ -1247,12 +1247,29 @@ - + - + + + + + + + + + + diff --git a/tex/context/base/x-openmath.xsl b/tex/context/base/x-openmath.xsl index e91b83e51..ffb404939 100644 --- a/tex/context/base/x-openmath.xsl +++ b/tex/context/base/x-openmath.xsl @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@ --> - + diff --git a/tex/context/base/x-res-01.tex b/tex/context/base/x-res-01.tex index e989d7090..83f747f83 100644 --- a/tex/context/base/x-res-01.tex +++ b/tex/context/base/x-res-01.tex @@ -257,8 +257,8 @@ [\XMLflush{rl:file}] [maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}% [GridPg]% - \freezedimenmacro\naturalfigurewidth \let\FigWid\naturalfigurewidth - \freezedimenmacro\naturalfigureheight\let\FigHei\naturalfigureheight + \let\FigWid\figurenaturalwidth + \let\FigHei\figurenaturalheight \advance\hsize by -150pt \hskip10pt \advance\hsize by -10pt diff --git a/tex/context/base/x-res-04.tex b/tex/context/base/x-res-04.tex index 066404afd..83998a4c4 100644 --- a/tex/context/base/x-res-04.tex +++ b/tex/context/base/x-res-04.tex @@ -158,8 +158,10 @@ {\bgroup} {\XMLflush{rl:figure} \doglobal\increment\figurefilepage + %\doshowfigurestate{base : comparing \askedlabel\space with \XMLflush{rl:label}}% \doif\askedlabel{\XMLflush{rl:label}} - {\ifnum\figurebasemode=\plusone % load used ones + {\doshowfigurestate{base label : found \askedlabel}% + \ifnum\figurebasemode=\plusone % load used ones \figbase@savedata\askedlabel\figurefilepage \fi \doglobal\saveXMLdata{rl:l:manipulation}{rl:manipulation}% @@ -189,7 +191,8 @@ \def\askedlabel{#2}% \doifelseXMLelement{rl:rl:\askedlabel} {\enableXMLelements\flushXMLelement{rl:rl:\askedlabel}} - {\processcommacommand[\figurepathlist]\dogetfigurefilename}% + {\doshowfigurestate{base path : \figurepathlist}% + \processcommacommand[\figurepathlist]\dogetfigurefilename}% \stopXMLmapping \stopnointerference} @@ -204,8 +207,11 @@ \globalletempty\figurefileoriginal \globalletempty\figurefilefile \xdef\figurefilebasepath{#1}% - \assignfullfilename{#1}\figurefilebase\to\filename - \expanded{\processXMLfilegrouped{\filename.xml}}% + \assignfullfilename{#1}{\figurefilebase.xml}\to\filename + \doiffileelse\filename + {\doshowfigurestate{base file : \filename}% + \processXMLfilegrouped\filename} + \donothing \ifx\figurefilename\empty \else \global\let\figurefilebase\figurefilebase \fi @@ -227,36 +233,71 @@ \def\resetfigurefilebase {\the\figurebaseresets} -\let\normalcalculateexternalfigure\calculateexternalfigure - -\def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% - {\resetfigurefilebase - \ifx\figurebaselist\empty - \normalcalculateexternalfigure - [#1][#2][#3][#4][#5][#6]% - \else - \def\docommando##1% - {\getfigurefilename{##1}{#3}% - \ifx\figurefilename\empty\else - \gdef\figurefilelabel{#3}% - \quitcommalist - \fi}% - \processcommacommand[\figurebaselist]\docommando - \ifx\figurefilename\empty - \stripspaces\from#3\to\figurefilename % to be sure - \normalcalculateexternalfigure - [#1][#2][\figurefilename][#4][#5][#6]% - \else - \doiffileelse{\figurefilebase.pdf} - {\let\figurepathlist\figurefilebasepath - \normalcalculateexternalfigure - [#1][#2][\figurefilebase.pdf]% - [\c!page=\figurefilepage,#4][#5][#6]} - {\@EA\stripspaces\@EA\from\figurefilename\to\figurefilename - \normalcalculateexternalfigure - [#1][#2][\figurefilename][#4][#5][#6]}% - \fi - \fi} +\ifx\doshowfigurestate\undefined \let\doshowfigurestate\gobbleoneargument \fi + +\ifx\doanalyzefiguredimensionsfromfile\undefined + + % will become obsolete once the new core-fig is used + + \let\normalcalculateexternalfigure\calculateexternalfigure + + \def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% + {\resetfigurefilebase + \ifx\figurebaselist\empty + \normalcalculateexternalfigure[#1][#2][#3][#4][#5][#6]% + \else + \def\docommand##1% + {\doshowfigurestate{base : check #3 in ##1}% + \getfigurefilename{##1}{#3}% + \ifx\figurefilename\empty\else\quitcommalist\fi}% + \processcommacommand[\figurebaselist]\docommand + \ifx\figurefilename\empty + \stripspaces\from#3\to\figurefilename % to be sure + \normalcalculateexternalfigure[#1][#2][\figurefilename][#4][#5][#6]% + \else + \doiffileelse{\figurefilebase.pdf} + {\let\figurepathlist\figurefilebasepath + \normalcalculateexternalfigure + [#1][#2][\figurefilebase.pdf]% + [\c!page=\figurefilepage,#4][#5][#6]} + {\@EA\stripspaces\@EA\from\figurefilename\to\figurefilename + \normalcalculateexternalfigure[#1][#2][\figurefilename][#4][#5][#6]}% + \fi + \fi} + +\else + + % todo: use different internal names, \figurebasepage and such + + \def\doanalyzefiguredimensionsfromfile + {\ifcase\figurestatus \ifx\figurebaselist\empty \else + \resetfigurefilebase + \doshowfigurestate{base list : \figurebaselist}% + \processcommacommand[\figurebaselist]\dodoanalyzefiguredimensionsfromfile + \ifx\figurefilename\empty + \doshowfigurestate{base warning : no matching name found}% + \else + \doiffileelse{\figurefilebase.pdf} + {\doshowfigurestate{base file : \figurefilebase.pdf}% + \doshowfigurestate{base page : \figurefilepage}% + \let\figurepathlist\figurefilebasepath + \analyzefigurefilename{\figurefilebase.pdf}\wantedfigurelabel + \let\wantedfigurepage\figurefilepage} + {\doshowfigurestate{base missing : \figurefilebase.pdf}} + \fi + \ifcase\figurestatus + \analyzefigurefilename\expandedfigurename\wantedfigurelabel + \fi + \fi \fi} + + \def\dodoanalyzefiguredimensionsfromfile#1% + {\doshowfigurestate{base check : \wantedfigurename\space in #1}% + \getfigurefilename{#1}\wantedfigurename + \ifx\figurefilename\empty\else + \quitcommalist + \fi} + +\fi % management diff --git a/tex/context/base/x-res-08.tex b/tex/context/base/x-res-08.tex index e73885166..548933123 100644 --- a/tex/context/base/x-res-08.tex +++ b/tex/context/base/x-res-08.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D TODO: make rlxtools callable from texexec (class), speeds up things. + %D Experimental module! %D %D \starttyping @@ -52,16 +54,19 @@ \let\figurefileprefix \empty \def\XMLfeedbackresource#1#2% - {\convertcommand\currentresourcecomment\to\currentresourcecomment + {\begingroup + \convertcommand\currentresourcecomment\to\currentresourcecomment + \doifnothing\figurefilefile{\edef\figurefilefile{\figurefilename.\figurefiletype}}% \immediate\write\XMLrllog {\writtenXMLelement{\XMLrlprefix usage}% - {\writtenXMLelement{\XMLrlprefix type}{#2}% - \writtenXMLelement{\XMLrlprefix state}{#1}% + {\writtenXMLelement{\XMLrlprefix type}{#2}% 'figure' not the type in \extenalfigure + \writtenXMLelement{\XMLrlprefix state}{#1}% 'missing' 'found' etc \ifx\figurefilelabel\empty \ifx\figurelabel\s!dummy \else % otherwise label equals filename \writtenXMLelementcs{\XMLrlprefix label}\figurelabel \fi - \writtenXMLelementcs{\XMLrlprefix file}\figurefilename + \writtenXMLelementcs{\XMLrlprefix file}\figurefilefile % complete name + \writtenXMLelementcs{\XMLrlprefix name}\figurefilename % no suffix \writtenXMLelementcs{\XMLrlprefix suffix}\figurefiletype \else % \figurefilelabel is set in x-res-04 and since @@ -84,10 +89,11 @@ \ifconditional\externalfigureflush \writtenXMLelementcs{\XMLrlprefix width}\figurewidth \writtenXMLelementcs{\XMLrlprefix height}\figureheight - \fi}}} + \fi}}% + \endgroup} \def\XMLfeedbackexternalfigure - {\externalfigureflush\doifmodeelse{*\v!figure}% + {\doifmodeelse{*\v!figure}% {\XMLfeedbackresource{found}}% {\XMLfeedbackresource{\ifconditional\externalfigureflush missing\else registered\fi}}% {figure}} @@ -96,15 +102,23 @@ [rl:manipulate] [file=rlxtools.rlx] -\startsetups[rl:manipulate] - -% \immediatewriteutilitycommand{\writestatus{system}{we force multiple runs at \normaltime}} - - \doiflocfileelse{\jobname.rlx} - {\installprogram{texmfstart rlxtools --manipulate kpse:\jobname.rlx \jobname.rlg}} - {\installprogram{texmfstart rlxtools --manipulate kpse:\getvariabledefault{rl:manipulate}{file}{rlxtools.rlx} \jobname.rlg}} - -\stopsetups +% \startsetups[rl:manipulate] +% \doiflocfileelse{\jobname.rlx} +% {\installprogram{texmfstart rlxtools --manipulate kpse:\jobname.rlx \jobname.rlg}} +% {\installprogram{texmfstart rlxtools --manipulate kpse:\getvariabledefault{rl:manipulate}{file}{rlxtools.rlx} \jobname.rlg}} +% \stopsetups +% +% no longer need for \setups[rl:manipulate] + +\ifx\nofconversionfigures\undefined \chardef\nofconversionfigures\plusone \fi + +\appendtoks + \ifcase\nofconversionfigures\else + \doiflocfileelse{\jobname.rlx} + {\installprogram{texmfstart rlxtools --manipulate kpse:\jobname.rlx \jobname.rlg}} + {\installprogram{texmfstart rlxtools --manipulate kpse:\getvariabledefault{rl:manipulate}{file}{rlxtools.rlx} \jobname.rlg}}% + \fi +\to \everylastshipout \appendtoks \openXMLresourcelog \to \everystarttext \appendtoks \closeXMLresourcelog \to \everystoptext diff --git a/tex/context/base/x-res-12.tex b/tex/context/base/x-res-12.tex new file mode 100644 index 000000000..c4bc4386f --- /dev/null +++ b/tex/context/base/x-res-12.tex @@ -0,0 +1,53 @@ +%D \module +%D [ file=x-fig-12, +%D version=2005.05.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Checking, +%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 implements the dimension checking using \RLXTOOLS. + +\unprotect + +\chardef\figurerlxmode\plusone % rlx permitted + +\startXMLmapping[rli] + \defineXMLprocess[rl:identify] + \defineXMLsavecontent[rl:width] {\!!zeropoint} + \defineXMLsavecontent[rl:height]{\!!zeropoint} +\stopXMLmapping + +\def\doanalyzefiguredimensionsrlx + {\ifcase\figurestatus \ifcase\figurerlxmode \else + \doifnotfile{\wantedfigurefullname.rli} + {% let's try runtime running first + \doshowfiguremessage6\wantedfigurefullname + \executesystemcommand{texmfstart rlxtools --identify \wantedfigurefullname}}% + \doifnotfile{\wantedfigurefullname.rli} + {% we assume that runtime running failed + \doshowfiguremessage6\wantedfigurefullname + \installprogram{texmfstart rlxtools --identify \wantedfigurefullname}}% + \doiffile{\wantedfigurefullname.rli} + {\global\let\analyzedfigurewidth \!!zeropoint + \global\let\analyzedfigureheight\!!zeropoint + \startnointerference % groups + \startXMLmapping[rli]% + \startXMLignore + \processXMLfile{\wantedfigurefullname.rli}% + \xdef\analyzedfigurewidth {\the\dimexpr\XMLflush{rl:width} \relax}% turn whatever into pt + \xdef\analyzedfigureheight{\the\dimexpr\XMLflush{rl:height}\relax}% turn whatever into pt + \stopXMLignore + \stopXMLmapping + \stopnointerference + \setanalyzedfiguredimensions\!!ten}% + \fi\fi} + +\let\doanalyzefiguredimensionsexternal\doanalyzefiguredimensionsrlx + +\protect \endinput diff --git a/tex/context/base/x-res-20.tex b/tex/context/base/x-res-20.tex new file mode 100644 index 000000000..e81927c21 --- /dev/null +++ b/tex/context/base/x-res-20.tex @@ -0,0 +1,231 @@ +%D \module +%D [ file=x-res-20, +%D version=2006.08.20, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Lists, +%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 For the beginning we have used \TEXUTIL\ to hels us deal with +%D graphics whose dimensions could not be determines and|/|or to +%D provide placeholder info for graphics that were not available. +%D Much of this functionality is now moved to \RLXTOOLS\ and +%D therefore it makes sense to reimplement the code that deals with +%D producing an overview of grapghics as well. At the same time we +%D move some \TEX\ code from \TEXEXEC\ to here. +%D +%D Because the show commands are not used in real documents, but +%D only for special purposed, it does not harm that this +%D functionality is now part of a module. We no longer use the +%D parsing code in \TEXUTIL, but rely on \IMAGEMAGICK's +%D identify functionility. +%D +%D At the end of the file we kept the old code from \type {core-fig}. + +\unprotect + +\startXMLmapping[rlx:list] + + \defineXMLprocess + [rl:identification] + + \defineXMLenvironment + [rl:identify] [name=] + {\bgroup\ignorespaces} + {\removeunwantedspaces\doRLhandlegraphic\egroup} + + \defineXMLsave[rl:size] + \defineXMLsave[rl:path] + \defineXMLsave[rl:width] + \defineXMLsave[rl:height] + +\stopXMLmapping + +\def\showexternalfigures + {\dosingleempty\doshowexternalfigures} + +\let\doRLhandlegraphic\relax +\let\doRLstartgraphics\relax +\let\doRLstopgraphics \relax + +\let\RLfigurewidth \empty +\let\RLfigureheight\empty +\let\RLfiguresize \empty +\let\RLfigurefile \empty + +\def\doRLpresetgraphic + {\edef\RLfigurewidth {\the\dimexpr \XMLflush{rl:width}\relax}% + \edef\RLfigureheight{\the\dimexpr \XMLflush{rl:height}\relax}% + \edef\RLfiguresize {\the\numexpr0\XMLflush{rl:size}\relax}% + \edef\RLfigurefile {\XMLpar{rl:identify}{name}{unknown}}} + +\def\doshowexternalfigures[#1]% + {\bgroup + \dontcomplain + \setupcolors[\c!state=\v!start]% to prevent mps color conversion + \getparameters[\??ex][\c!file=rlxtools.rli,\c!alternative=a,\c!offset=\!!zeropoint,\c!size=,#1]% + \getvalue{\strippedcsname\doRLhandlegraphic\@@exalternative}% + \startXMLmapping[rlx:list]% + \startXMLignore + \doRLstartgraphics + \processXMLfilegrouped{\@@exfile}% \readjobfile\@@exfile\donothing\donothing + \doRLstopgraphics + \stopXMLignore + \stopXMLmapping + \egroup} + +\def\doRLhandlegraphica + {\def\doRLhandlegraphic + {\doRLpresetgraphic + \getvalue{\e!start\v!figure\e!text}[\v!left,\v!none][] + {} + {\hbox + {\externalfigure[\RLfigurefile][\c!frame=\v!on,\c!width=6cm,\c!size=\@@exsize]% + \quad + \framed[\c!width=\figurewidth,\c!height=\figureheight]{}% + \quad}}% + {\hbox{\tt\tfa\setstrut\strut\expanded{\asciistr{\RLfigurefile}}}}% + \blank + \tfx + \starttabulate[|l|l|] + \NC width \EQ \RLfigurewidth \NC \NR + \NC height \EQ \RLfigureheight \NC \NR + \NC size \EQ \RLfiguresize \NC \NR + \stoptabulate + \getvalue{\e!stop\v!figure\e!text}}} + +\def\doRLhandlegraphicb + {\def\doRLhandlegraphic + {\dontleavehmode + \vbox + {\doRLpresetgraphic + \hsize\dimexpr.2\hsize-.8em\relax + \cbox{\externalfigure[\RLfigurefile][\c!frame=\v!on,\c!factor=\v!max,\c!width=\hsize,\c!size=\@@exsize]}% + \vskip.5\lineheight + \midaligned{\tttf\RLfigurefile}}% + \vadjust{\vskip.2\lineheight}% + \quad\allowbreak}} + +\def\doRLhandlegraphicc + {\def\doRLhandlegraphic + {\doRLpresetgraphic + \pagefigure[\RLfigurefile]}} + +\def\doRLhandlegraphicd % this one builds a dimension file for metapost/metafun + {\def\doRLstartgraphics + {\immediate\openout\scratchwrite=mpfigs.mp\relax + \immediate\write\scratchwrite{\letterpercent\space graphic dimension file for metapost/metafun}}% + \def\doRLstopgraphics + {\immediate\closeout\scratchwrite}% + \def\doRLhandlegraphic + {\doRLpresetgraphic + \immediate\write\scratchwrite{registerfigure("\RLfigurefile",\RLfigurewidth,\RLfigureheight);}}} + +% \showexternalfigures[alternative=b] + +\protect \endinput + +%D Old code: + +\def\doshowexternalfigures[#1]% + {\bgroup + \setupcolors[\c!state=\v!start]% to prevent mps color conversion + \getparameters[\??ex][\c!alternative=a,\c!offset=\!!zeropoint,\c!size=,#1]% + \getvalue{\strippedcsname\showexternalfigure\@@exalternative}% + \egroup} + +\def\showexternalfigures + {\dosingleempty\doshowexternalfigures} + +\def\showexternalfigurea + {\bgroup + \dontcomplain + \def\presetfigure[##1][##2]% + {\getvalue{\e!start\v!figure\e!text}[\v!left,\v!none][] + {} + {\hbox + {\externalfigure[##1][\c!frame=\v!on,\c!width=6cm,\c!size=\@@exsize][##2]% + \tfskip + \framed[\c!width=\figurewidth,\c!height=\figureheight]{}}}% + {\tt\tfa\expanded{\asciistr{##1}}}% + \blank + \tfx + \def\docommand####1% + {\beforesplitstring####1\at=\to\asciia + \aftersplitstring ####1\at=\to\asciib + \convertcommand\asciib\to\asciib + \doifsomething\asciib + {\hsmash{\hbox to .75em{\asciia\hss}: \asciib}\endgraf}}% + \processcommalist[##2]\docommand + \strut + \endgraf + \getvalue{\e!stop\v!figure\e!text}}% + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \egroup} + +\def\showexternalfigureb % instelbaar maken + {\bgroup + \def\total{5}% + \globalletempty\allfigures + \doglobal\newcounter\figurecounter + \dontcomplain + \def\docommand##1{##1&}% + \def\figurecaptions% + {\crcr + \noalign{\nobreak\vskip.5em}% + \@EA\globalprocesscommalist\@EA[\allfigures]\docommand + \globalletempty\allfigures + \crcr + \noalign{\vskip1em\goodbreak}}% + \def\presetfigure[##1][##2]% + {\vbox + {\divide\hsize \total + \advance\hsize -1em + \externalfigure + [##1] + [\c!frame=\v!on,\c!factor=\v!max,\c!width=\hsize,\c!size=\@@exsize][##2]}% + \doglobal\addtocommalist{##1}\allfigures + %\getvalue{\s!figurepreset}% + \doglobal\increment\figurecounter + \ifnum\figurecounter=\total + \doglobal\newcounter\figurecounter + \def\next{\figurecaptions}% + \else + \def\next{&}% + \fi + \next}% + \pushendofline + \tabskip\zeropoint \!!plus 1fill + \halign to \hsize + {&\hss##\hss\cr\readjobfile\@@exfile\donothing\donothing\crcr + \figurecaptions} + \popendofline + \egroup} + +\def\showexternalfigurec + {\bgroup + \def\presetfigure[##1][##2]{\expanded{\pagefigure[##1][\c!size=\@@exsize]}}% else loop + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \egroup} + +\def\showexternalfigured % to be documented; this one builds a dimension file for + {\bgroup % metapost/metafun + \immediate\openout\scratchwrite=mpfigs.mp + \def\presetfigure[##1][##2]% + {\getfiguredimensionsonly[##1]% \pagefigure[##1]% + \immediate\write\scratchwrite + {registerfigure("##1",\figurewidth,\figureheight);}} + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \immediate\closeout\scratchwrite + \egroup} diff --git a/tex/context/base/x-sch-00.tex b/tex/context/base/x-sch-00.tex index 97b266d5e..379d19cf2 100644 --- a/tex/context/base/x-sch-00.tex +++ b/tex/context/base/x-sch-00.tex @@ -8,14 +8,14 @@ %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 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. +%D testing it. \newcounter\XSDprefix \newif\ifXDScomposite @@ -54,10 +54,10 @@ \pagereference[xsd:\XSDprefix:\XSDtemp]% \fi \doXSDtemp}, - type=>{\doifinstringelse{xsd:}{\XSDtemp} + type=>{\doifinstringelse{xsd:}{\XSDtemp} {\doXSDtemp} {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}}, - ref=>{\doifinstringelse{xsd:}{\XSDtemp} + ref=>{\doifinstringelse{xsd:}{\XSDtemp} {\doXSDtemp} {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}}, unknown=>\doXSDtemp]}% @@ -65,8 +65,8 @@ \egroup} \def\doXSDkeyvals#1#2#3% - {\def\docommando##1{\doXSDkeyval{#1}{##1}{#2}{##1}}% - \processcommalist[#3]\docommando} + {\def\docommand##1{\doXSDkeyval{#1}{##1}{#2}{##1}}% + \processcommalist[#3]\docommand} \def\dodoXSDbanner#1% {\framed @@ -77,7 +77,7 @@ \def\doXSDtitle#1#2#3% {\edef\XSDtemp{\XMLpar{#2}{#3}{}}% \dodoXSDbanner - {{\bf\ignorespaces#1\unskip}% + {{\bf\ignorespaces#1\unskip}% \doifsomething{\XSDtemp} {:\space\ignorespaces\XSDtemp\unskip \pagereference[xsd:\XSDprefix:\XSDtemp]}}} @@ -113,7 +113,7 @@ \defineframedtext [XSDcapsule] [backgroundcolor=xsd:2] \defineframedtext [XSDsequence] [backgroundcolor=xsd:3] -\def\XDSstructures% handy for external settings +\def\XDSstructures% handy for external settings {XSDannotation, XSDcomplexType,XSDsimpleType,XSDelement,XSDattribute, XSDcomplexContent,XSDsimpleContent,XSDattributeGroup, @@ -129,29 +129,29 @@ before=\ifinframed\else\blank\fi, after=\ifinframed\else\blank\fi, depthcorrection=off, - rulethickness=1pt, + 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 + \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=] @@ -168,7 +168,7 @@ {\stopXSDannotation \stopXSDcapsule} -\defineXMLignore [xsd:appInfo] +\defineXMLignore [xsd:appInfo] \defineXMLenvironment [xsd:attribute] [id=,name=,ref=,type=,form=,use=,value=] @@ -374,9 +374,9 @@ [id=,schemaLocation=] [id,schemaLocation] -\defineXSDfacet - [notation] - [id=,name=,public=,system=] +\defineXSDfacet + [notation] + [id=,name=,public=,system=] [id,name,public,system] -\endinput +\endinput diff --git a/tex/context/base/x-xml-11.tex b/tex/context/base/x-xml-11.tex index 81fbac5b4..c1b185b55 100644 --- a/tex/context/base/x-xml-11.tex +++ b/tex/context/base/x-xml-11.tex @@ -57,14 +57,15 @@ \defineXMLpickup [entities][n=0] {\expanded{\SomeElement{\XMLop{n}}{Entities}} - \starttabulate[|l|p|]} + \starttabulate[|l|l|l|]} {\stoptabulate} -\defineXMLcommand +\defineXMLcommand % ugly hack (make macro of it) [entity][name=,n=0] {\startexpanded \noexpand \NC \XMLop{name} \noexpand \NC \XMLop{n} + \noexpand \NC \noexpand\doXMLentity\XMLop{name}; \noexpand \NC \noexpand \NR \stopexpanded} diff --git a/tex/context/base/xtag-cml.tex b/tex/context/base/xtag-cml.tex index 493d9eff3..203218ceb 100644 --- a/tex/context/base/xtag-cml.tex +++ b/tex/context/base/xtag-cml.tex @@ -1,5 +1,7 @@ % see mathml, == \defineXMLdirective [mathml] \setupMMLappearance +% will be rewritten avoiding the mapper + \unprotect \def\setupCMLappearance[#1]{\dodoubleargument\getparameters[@@CML#1]} @@ -66,8 +68,9 @@ \newcounter\nofCMLatoms \getXMLarguments{cml-m}{n="0" #1}% \doifnotXMLzero{cml-m}{n}\firstofoneargument - \ignorespaces\processXMLRchild{atom,ion,bond/,% - singlebond/,doublebond/,triplebond/}{#2}\unskip + \ignorespaces + \processXMLRchild{atom,ion,bond/,singlebond/,doublebond/,triplebond/}{#2}% + \unskip \egroup}% \ignorespaces} @@ -81,13 +84,15 @@ \getXMLarguments{cml-i}{n="0" charge="0" #1}% \doifnotXMLzero{cml-i}{n}\firstofoneargument \doifelse\@@CMLionalternative\v!b - {[\ignorespaces\processXMLRchild{atom,bond/,% - singlebond/,doublebond/,triplebond/}{#2}\unskip]% + {[\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}% + \ignorespaces + \processXMLRchild{atom,bond/,singlebond/,doublebond/,triplebond/}{#2}% + \unskip}% \egroup}% \ignorespaces} @@ -174,7 +179,7 @@ {\def\CMLtopcaption{##2}% \let\doCMLcaption\gobbletwoarguments}} -\def\resetCMLcaption% +\def\resetCMLcaption {\let\CMLtopcaption\empty \let\CMLbotcaption\empty \let\doCMLcaption\dodoCMLcaption} diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex index f20cc05a0..26dd70f29 100644 --- a/tex/context/base/xtag-ext.tex +++ b/tex/context/base/xtag-ext.tex @@ -36,8 +36,6 @@ %D When a \type {[+]} is specified, the mappings will %D nest. -\let\normal@@XMLelement\@@XMLelement - \def\resetXMLmapping {\let\@@XMLelement\normal@@XMLelement \let\@@XMLmapping\empty} diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 7579898fa..d7e01afd7 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -16,9 +16,7 @@ %D Beware: don't rely on \longempty things, since this may %D change! -%D To be sure: - -\newif\ifprocessingXML +% \newif\ifprocessingXML \beginTEX \writestatus{XML}{sorry, XML is only supported in (pdf)etex} @@ -26,15 +24,10 @@ \endinput \endTEX -% to be moved - -\ifx\globalscratchtoks \undefined \newtoks \globalscratchtoks \fi -\ifx\globalscratchdimen\undefined \newdimen\globalscratchdimen \fi - % tzt nog eens child grabber maken; mooier in mathml %D This module is highly optimized for speed, which sometimes -%D reads to rather unreadable code. Sorry for this. +%D leads to rather unreadable code. Sorry for this. \beginETEX XML @@ -205,6 +198,8 @@ \fi +\let\normal@@XMLelement\@@XMLelement % we may overload this one later inside a group + \newtoks\XMLtoks \newtoks\XMLresetlist @@ -244,152 +239,237 @@ % part of this should move to a low level module -\bgroup -\catcode`\*=\@@comment -\catcode`\.=\@@escape -.catcode`.B=.@@begingroup -.catcode`.E=.@@endgroup -.catcode`.P=.@@parameter - -.catcode`.&=.@@active * .xdef.letterampersand B.string&E -.catcode`.<=.@@active * .xdef.letterless B.stringE -.catcode`.#=.@@active * .xdef.letterhash B.string#E -.catcode`.$=.@@active * .xdef.letterdollar B.string$E -.catcode`.%=.@@active * .xdef.letterpercent B.string%E -.catcode`.\=.@@active * .xdef.letterbackslash B.string\E -.catcode`.^=.@@active * .xdef.letterhat B.string^E -.catcode`._=.@@active * .xdef.letterunderscore B.string_E -.catcode`.{=.@@active * .xdef.letterbgroup B.string{E -.catcode`.}=.@@active * .xdef.letteregroup B.string}E -.catcode`.|=.@@active * .xdef.letterbar B.string|E -.catcode`.~=.@@active * .xdef.lettertilde B.string~E - -.gdef.enableXMLexpansion - B.def=.@@other - .catcode`."=.@@other - .catcode`./=.@@other - .catcode`.'=.@@other - .catcode`.~=.@@other - .catcode`.#=.@@other - .let &=.doXMLentity - .unexpanded.def=.@@other - .unexpanded.def=.@@other - .let<.relax * new - .processingXMLfalse - E - -.global.let<.relax * new -.global.let&.relax * new - -.egroup - -\def\disableXML{\setnormalcatcodes\processingXMLfalse} +% we predefine some macros, just to satisfy the dep parser + +\let\enableXMLexpansion \relax +\let\disableXMLexpansion \relax +\let\enableXML \relax +\let\activateXMLescapetokens\relax +\let\entitleXMLescapetokens \relax +\let\reduceXMLescapetokens \relax +\let\ignoreXMLescapetokens \relax +\let\enableXMLelements \relax +\let\disableXMLelements \relax + +% \bgroup +% \catcode`\*=\@@comment +% \catcode`\.=\@@escape +% .catcode`.B=.@@begingroup +% .catcode`.E=.@@endgroup +% .catcode`.P=.@@parameter +% +% .catcode`.&=.@@active +% .catcode`.<=.@@active +% +% .catcode`.#=.@@active +% .catcode`.$=.@@active +% .catcode`.%=.@@active +% .catcode`.\=.@@active +% .catcode`.^=.@@active +% .catcode`._=.@@active +% .catcode`.{=.@@active +% .catcode`.}=.@@active +% .catcode`.|=.@@active +% .catcode`.~=.@@active +% +% .gdef.enableXMLexpansion +% B.def=.@@other +% .catcode`."=.@@other +% .catcode`./=.@@other +% .catcode`.'=.@@other +% .catcode`.~=.@@other +% .catcode`.#=.@@other +% .let &=.doXMLentity +% .unexpanded.def=.@@other +% .unexpanded.def=.@@other +% .let<.relax * new +% .processingXMLfalse +% E +% +% .global.let<.relax * new +% .global.let&.relax * new +% +% .egroup +% +% \def\disableXML +% {\setnormalcatcodes\processingXMLfalse} + +\letcatcodecommand\xmlcatcodesn `\& \doXMLentity +\letcatcodecommand\xmlcatcodesn `\< \doXMLelement +\letcatcodecommand\xmlcatcodese `\& \doXMLentity +\letcatcodecommand\xmlcatcodese `\< \doXMLelement +\letcatcodecommand\xmlcatcodesr `\& \doXMLentity +\letcatcodecommand\xmlcatcodesr `\< \doXMLelement + +\letcatcodecommand\xmlcatcodesr `\# \letterhash +\letcatcodecommand\xmlcatcodesr `\$ \letterdollar +\letcatcodecommand\xmlcatcodesr `\% \letterpercent +\letcatcodecommand\xmlcatcodesr `\\ \letterbackslash +\letcatcodecommand\xmlcatcodesr `\^ \letterhat +\letcatcodecommand\xmlcatcodesr `\_ \letterunderscore +\letcatcodecommand\xmlcatcodesr `\{ \letterleftbrace +\letcatcodecommand\xmlcatcodesr `\} \letterrightbrace +\letcatcodecommand\xmlcatcodesr `\| \letterbar + +\bgroup \catcode`\&=13 + +\xdef\entityhash {&\string#035;} +\xdef\entitydollar {&\string#036;} +\xdef\entitypercent {&\string#037;} +\xdef\entitybackslash {&\string#092;} +\xdef\entityhat {&\string#094;} +\xdef\entityunderscore{&\string#095;} +\xdef\entityleftbrace {&\string#123;} +\xdef\entityrightbrace{&\string#125;} +\xdef\entitybar {&\string#124;} + +\egroup + +\letcatcodecommand\xmlcatcodese `\# \entityhash +\letcatcodecommand\xmlcatcodese `\$ \entitydollar +\letcatcodecommand\xmlcatcodese `\% \entitypercent +\letcatcodecommand\xmlcatcodese `\\ \entitybackslash +\letcatcodecommand\xmlcatcodese `\^ \entityhat +\letcatcodecommand\xmlcatcodese `\_ \entityunderscore +\letcatcodecommand\xmlcatcodese `\{ \entityleftbrace +\letcatcodecommand\xmlcatcodese `\} \entityrightbrace +\letcatcodecommand\xmlcatcodese `\| \entitybar + +% we speed things up by explicitly setting the active char's < & + +\bgroup \catcode`\<=13 \catcode`\&=13 + +\gdef\enableXML + {\ifcase\XMLtokensreduction + \setcatcodetable\xmlcatcodese \or + \setcatcodetable\xmlcatcodesr \else + \setcatcodetable\xmlcatcodesn + \fi + \let&\doXMLentity + \unexpanded\def<{\doXMLelement}% + \processingXMLtrue + \the\everyenableXML} + +\gdef\disableXML + {\setcatcodetable\ctxcatcodes % maybe \texcatcodes + \processingXMLfalse} + +\gdef\enableXMLexpansion + {\def<{\doXMLelement}% + \let&\doXMLentity} + +\gdef\disableXMLexpansion + {\unexpanded\def<{\doXMLelement}% + \let&\doXMLentity} + +\unexpanded\gdef\enableXMLelements + {\catcode60=\@@active + \catcode62=\@@other + \unexpanded\def<{\doXMLelement}% + \processingXMLtrue} + +\unexpanded\gdef\disableXMLelements + {\catcode60=\@@active + \catcode62=\@@other + \let<\relax + \processingXMLfalse} + +\global\let<\relax +\global\let&\relax + +\egroup %D An element can be singular or paired. A singular element is %D called an empty element. The following definitions are @@ -1419,24 +1499,10 @@ % maybe some day global handling here as well \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} @@ -2009,7 +2075,7 @@ % \doifsomething{#3}{\long\setvalue{\@@XMLpars:#1}{\getrawparameters[#2][#3]}}}} \long\def\setXMLarguments#1#2#3% element [tag] settings - {\doifassignmentelse{#2} + {\doifassignmentelse{#2} % ROOM FOR OPTIMIZATION {\letbeundefined{\@@XMLmap:#1}% \long\setvalue{\@@XMLpars:#1}{\getrawparameters[\@@XMLvariable:#1:][#2]}} {\long\setvalue{\@@XMLmap:#1}{#2}% later we can init vars by this name @@ -2575,6 +2641,27 @@ \let\doifXMLparelse\doifXMLvarelse \let\doifXMLpar \doifXMLvar +%D Used in x-fo: I really need to document this! + +\bgroup \catcode`\<=\active + +% usage: \expanded{\rescanXMLatttributes{fo:table-cell}} + +\gdef\rescanXMLattributes #1{\noexpand\dogetXMLarguments{#1}\currentXMLarguments>} +\gdef\parseXMLattributes #1#2{\dogetXMLarguments{#1}#2>} + +\egroup + +\def\defXMLattributestring#1#2#3#4% + {\ifcsname\@@XMLvariable:#2:#3\endcsname + \@EA\convertcommand\csname\@@XMLvariable:#2:#3\endcsname\to#1% + \else + \convertargument#4\to#1% + \fi} + +\def\XMLprocess#1% + {\begingroup\enableXML\XMLflush{#1}\endgroup} + \bgroup \catcode`<=\@@active \long\gdef\ignoreuntilXMLelement#1<{<} diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex index 6cd73442f..28aabc488 100644 --- a/tex/context/base/xtag-map.tex +++ b/tex/context/base/xtag-map.tex @@ -436,7 +436,7 @@ \let\parseXMLelement\remapXMLelement \else % here we need to get rid of the namespace; we also - % have to preserve the leaqding / if present + % have to preserve the leading / if present \@EA\long\@EA\def\@EA\parseXMLelement\@EA ##\@EA1\currentXMLnamespace:{\remapXMLelement##1}% % ##2 removes leading spaces @@ -456,10 +456,10 @@ \catcode`\^^M=\@@space \catcode`\^^L=\@@space \catcode`\^^Z=\@@space -\pushmacro\unicodechar -\let\unicodechar\relax + \pushmacro\unicodechar + \let\unicodechar\relax \xdef\remappedXMLdata{#4\empty}% -\popmacro\unicodechar + \popmacro\unicodechar \let\par\endgraf \popmacro\doXMLentity % needed ? \disableXMLexpansion diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex index f2279c4f5..ce51bffb2 100644 --- a/tex/context/base/xtag-mml.tex +++ b/tex/context/base/xtag-mml.tex @@ -444,13 +444,8 @@ \defineXMLentity [lparent] {\getXMLentity{lparenthesis}} \defineXMLentity [rparent] {\getXMLentity{rparenthesis}} -\bgroup -\catcode`\{=12 \doglobal\convertargument{\to\mmllbrace -\catcode`\}=12 \doglobal\convertargument}\to\mmlrbrace -\egroup - -\@EA \defineXMLentity \@EA [\mmllbrace] {\getXMLentity{lbrace}} -\@EA \defineXMLentity \@EA [\mmlrbrace] {\getXMLentity{rbrace}} +\defineXMLentity [\letterleftbrace ] {\getXMLentity{lbrace}} +\defineXMLentity [\letterrightbrace] {\getXMLentity{rbrace}} \defineXMLentity [{[}] {\getXMLentity{lbracket}} \defineXMLentity [{]}] {\getXMLentity{rbracket}} diff --git a/tex/context/base/xtag-mmp.tex b/tex/context/base/xtag-mmp.tex index b733644e5..3108191a0 100644 --- a/tex/context/base/xtag-mmp.tex +++ b/tex/context/base/xtag-mmp.tex @@ -338,12 +338,12 @@ \def\MMLpTABLEmapper#1#2#3% {\doifXMLparelse{mtable}{#1} {\newcounter\MMLcounter - \def\docommando##1% + \def\docommand##1% {\increment\MMLcounter \let\MMLpREMAP\doMMLpREMAP \def\MMLsetting{##1}#3% remap list \expanded{\setupTABLE[column][\MMLcounter][#2=\MMLsetting]}}% - \expanded{\processseparatedlist[\XMLpar{mtable}{#1}{}][ ]\noexpand\docommando}} + \expanded{\processseparatedlist[\XMLpar{mtable}{#1}{}][ ]\noexpand\docommand}} {}} \def\MMLpTABLEmap#1#2#3% diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex index da720bbc7..5a1d7fa97 100644 --- a/tex/context/base/xtag-pre.tex +++ b/tex/context/base/xtag-pre.tex @@ -199,8 +199,8 @@ {#1} % {\externalfigure[#1]} \def\dohandleXMLentityDEFINE#1 %#2 #3 #4 #5 #6>% name replacement - {\def\docommando##1>{\expanded{\defineXMLentity[#1]{\the\scratchtoks}}}% - \afterassignment\docommando\grabstring} + {\def\docommand##1>{\expanded{\defineXMLentity[#1]{\the\scratchtoks}}}% + \afterassignment\docommand\grabstring} %D Such entities can be encapsulated in a \type {DOCTYPE} %D element. Therefore we remove the outer level of document diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index face9f0b0..2691e8dff 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -169,8 +169,8 @@ \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} + {\def\docommand##1{#1[##1]#2#3\letvalue{\@@XMLshow:##1}\empty}% + \processcommalist[#4]\docommand} \gdef\showXMLign[#1]% {\setXMLshow\defineXMLignore \relax\relax[#1]% @@ -200,8 +200,8 @@ {\setXMLshow\defineXMLsingular\someXMLword\relax[#1]} \gdef\showXMLbreak[#1]% - {\def\docommando##1{\setvalue{\@@XMLshow::##1}{\hskip\zeropoint}}% - \processcommalist[#1]\docommando} + {\def\docommand##1{\setvalue{\@@XMLshow::##1}{\hskip\zeropoint}}% + \processcommalist[#1]\docommand} \gdef\doautoshowXMLelement {\ifcase\kindofXMLelement diff --git a/tex/context/base/xtag-xsl.tex b/tex/context/base/xtag-xsl.tex index 7981524d1..3ad096c28 100644 --- a/tex/context/base/xtag-xsl.tex +++ b/tex/context/base/xtag-xsl.tex @@ -90,8 +90,8 @@ \let\doXSLTscript\donormalXSLTscript \presetXSLTcharacters \donefalse - \def\docommando##1{\dodoapplyXSLTscript{##1}{\ifdone#3\else#2\fi}{#3}\donetrue}% - \processcommalist[#1]\docommando + \def\docommand##1{\dodoapplyXSLTscript{##1}{\ifdone#3\else#2\fi}{#3}\donetrue}% + \processcommalist[#1]\docommand \egroup \else \applyXSLTscript[#1][#2][#2]% @@ -106,7 +106,7 @@ \doifundefined{\??xl#1}% {\writestatus{XSLT}{unknown script #1}} {\writestatus{XSLT}{convert #2 into #3 using #1}% - \edef\par{\rawcharacter{10}}% + \edef\par{\outputnewlinechar}% \edef\!!stringc{\getvalue{\??xl#1}}% \immediate\openout\scratchwrite=\XSLTscriptfile.xsl \immediate\write\scratchwrite{\!!stringc}% diff --git a/tex/context/bib/bibl-apa-de.tex b/tex/context/bib/bibl-apa-de.tex index 8ab1f48ff..8f8be59fb 100644 --- a/tex/context/bib/bibl-apa-de.tex +++ b/tex/context/bib/bibl-apa-de.tex @@ -1,8 +1,6 @@ -% Test! Noch nicht übersetzt: -% masters thesis %D \module -%D [ file=bibl-apa, -%D version=2004.7.16, +%D [ file=bibl-apa-de, +%D version=2006.9.12, %D title=APA bibliography style, %D subtitle=Publications, %D author={Taco Hoekwater}, @@ -340,7 +338,7 @@ \insertauthors{}{ }{}% \insertpubyear{(}{). }{}% \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}{}. }{}% - \insertbibtype{}{, }{Master's thesis, }% + \insertbibtype{}{, }{Masterarbeit, }% \insertpublisher{}{. }{}% \insertpages{}{S. }{}% \insertnote{ }{.}{}% diff --git a/tex/context/bib/t-bib.tex b/tex/context/bib/t-bib.tex index 3c17a52b7..46bd82a94 100644 --- a/tex/context/bib/t-bib.tex +++ b/tex/context/bib/t-bib.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-bib, -%D version=2006.08.08, +%D version=2006.11.05, %D title=\CONTEXT\ Publication Module, %D subtitle=Publications, %D author=Taco Hoekwater, @@ -93,6 +93,19 @@ %D \item the constants \type{sorttype}, \type{compress} and %D \type{autohang} have moved to the core (8/8/2006) %D \item bibtex is now registered as a program to be run by texexec (8/8/2006) +%D \item fix a bug in \type{\setupcite[authoretallimit=1]} (9/8/2006) +%D \item fix a bug inside citations that prevented lastpubsep from ever being +%D used due to a volatile \type{\commalistsize} (25/8/2006). +%D \item added the possibility of \type{\placepublications[option=continue]} +%D (6/9/2006) +%D \item Mojca translated Master's Thesis to Masterarbeit (bibl-apa-de.tex) +%D (12/9/2006) +%D \item Added \type{\setuppublicationlist[maybeyear=off]} by request from +%D Thomas Schmitz (15/9/2006) +%D \item Removed some spurious spaces pointed out by willi egger (19/9/2006) +%D \item Add configuration of bibtex executable name (4/11/2006) +%D \item Fix numbering=short and numbering=bib (spotted by Matthias Wächter) (4/11/2006) +%D \item third attempt to get a correct release (5/11/2006) %D \stopitemize %D %D \subject{WISHLIST} @@ -281,7 +294,7 @@ \def\dosetupbibtex[#1]% {\let\@@pbdatabase\empty \let\@@pbsort \empty - \getparameters[\??pb][#1] + \getparameters[\??pb][#1]% \expanded{\processaction[\@@pbsort]} [ \v!no=>\def\bibstyle{cont-no}, \v!author=>\def\bibstyle{cont-au}, @@ -291,6 +304,8 @@ \s!unknown=>\def\bibstyle{cont-no}]% \ifx\@@pbdatabase\empty\else \writeauxfile \fi} +\dosetupbibtex[bibtex=bibtex] + %D \macros{writeauxfile} %D %D Unfortunately, \BIBTEX\ is not the best configurable program @@ -319,7 +334,7 @@ \write \scratchwrite {\string\bibdata{\@@pbdatabase}}% \closeout\scratchwrite \showmessage\m!bib{3}{}% - \installprogram{bibtex \jobname}}} + \expanded{\installprogram{\@@pbbibtex\space\jobname}}}} %D \macros{ifsortbycite,iftypesetall,ifautohang,ifbibcitecompress} %D @@ -910,18 +925,45 @@ \fi\fi \edef\samplewidth{\the\wd\scratchbox}% \setuplist[pubs][\c!width=\samplewidth,\c!distance=0pt]% - \def\@@pblimitednumber##1{\hbox to \samplewidth{\@@pbnumbercommand{##1}}}% + \ifx\@@pbnumbering\v!short + \def\@@pblimitednumber##1{\hbox to \samplewidth + {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}% + \else \ifx \@@pbnumbering\v!bib + \def\@@pblimitednumber##1{\hbox to \samplewidth + {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}% + \else + \def\@@pblimitednumber##1{\hbox to \samplewidth{\@@pbnumbercommand{##1}}}% + \fi \fi \else + \ifx\@@pbnumbering\v!short \doifemptyelse {\getvalue{\??li pubs\c!width}} - {\def\@@pblimitednumber##1{\hbox{\@@pbnumbercommand{##1}}}}% - {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}{\@@pbnumbercommand{##1}}}}% + {\def\@@pblimitednumber##1{\hbox + {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}}% + {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}% + {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}}% + \else \ifx \@@pbnumbering\v!bib + \doifemptyelse + {\getvalue{\??li pubs\c!width}} + {\def\@@pblimitednumber##1{\hbox + {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}}% + {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}% + {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}}% + \else + \doifemptyelse + {\getvalue{\??li pubs\c!width}} + {\def\@@pblimitednumber##1{\hbox{\@@pbnumbercommand{##1}}}}% + {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}{\@@pbnumbercommand{##1}}}}% + \fi + \fi \fi \ifx\@@pbnumbering\v!no - \setuplist[pubs][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented] + \setuplist[pubs][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented]% \else \setuplist[pubs][\c!numbercommand=\@@pblimitednumber]% \fi + \doifelsevalue + {\??pv datamaybeyear}{\v!off}{\def\maybeyear##1{}}{\def\maybeyear##1{##1}}% \forgetall % bugfix 2005/03/18 } @@ -962,12 +1004,15 @@ \def\doplacepublications[#1]% {%\getparameters[\??pv data][#1] \begingroup - \setuplist[pubs][\c!criterium=\v!previous,#1] + \setuplist[pubs][\c!criterium=\v!previous,#1]% \dodoplacepublications }% \def\dodoplacepublications% {\initializepubslist - \global\let\bibcounter\!!zerocount + \doifelsevalue + {\??li pubs\c!option}{\v!continue}% + {}% + {\global\let\bibcounter\!!zerocount }% \inpublisttrue \typesetpubslist \inpublistfalse @@ -979,14 +1024,22 @@ \unexpanded\def\typesetapublication#1% {\doifsomething{#1}{\doglobal\increment\bibcounter - \dodolistelement{pubs}{}{\bibcounter}% - {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}% - \strut \dotypesetapublication{#1}\strut }{}{}}} + \bgroup + \makepbkvalue{#1}% + \ifgridsnapping + \snaptogrid\vbox{\dodolistelement{pubs}{}{\bibcounter}% + {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}% + \strut \dotypesetapublication{#1}\strut }{}{}}% + \else + \dodolistelement{pubs}{}{\bibcounter}% + {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}% + \strut \dotypesetapublication{#1}\strut }{}{}% + \fi + \egroup }} \def\dotypesetapublication#1% {\bgroup \def\@@currentalternative{data}% - \makepbkvalue{#1}% \processcommacommand[\bibcommandlist,crossref]\clearbibitem \processcommalist [artauthor,author,editor]\clearbibitemtwo \processcommacommand[\bibcommandlist]\bibitemdefs @@ -1223,6 +1276,7 @@ \def\dobibauthoryear {\scratchcounter\zerocount \getcommacommandsize[\thebibauthors]% + \edef\authorcount{\commalistsize}% \@EA\processcommalist\@EA[\thebibauthors]\dodobibauthoryear} \def\dodobibauthoryear#1% @@ -1233,7 +1287,7 @@ \setcurrentbibauthor{#1}% \ifnum\scratchcounter=\plusone \ixfirstcommand - \else\ifnum \scratchcounter=\commalistsize\relax + \else\ifnum \scratchcounter=\authorcount\relax \ixlastcommand \else \ixsecondcommand @@ -1254,12 +1308,20 @@ \fi } +%D This discovery of authoretallimit is not the best one, +%D but it will do for now. + \def\docurrentbibauthor#1,#2% {\doifemptyelse{#2} {\def\currentbibauthor{#1\bibalternative{otherstext}}} - {\edef\currentbibauthor{#1% - \ifcase0\bibalternative{authoretallimit}\relax\or - \bibalternative{otherstext}\else \bibalternative{andtext}#2\fi}}} + {\@EA + \ifx\csname \??pv\@@currentalternative authoretallimit\endcsname\relax + \edef\currentbibauthor{#1\bibalternative{andtext}#2}% + \else + \edef\currentbibauthor{#1% + \ifcase0\bibalternative{authoretallimit}\relax\or + \bibalternative{otherstext}\else\bibalternative{andtext}#2\fi}% + \fi}} %D This is not the one Hans made for me, because I need a global %D edef, and the \type{\robustdoifinsetelse} doesn't listen to @@ -1701,7 +1763,7 @@ %D \type{\citeasnoun}. \def\bibauthornumref[#1]% - {\getcommalistsize[#1] + {\getcommalistsize[#1]% \global\bibitemcounter\commalistsize \firstreftrue \processcommalist[#1]\dobibauthornumref } diff --git a/tex/context/config/cont-usr.tex b/tex/context/config/cont-usr.tex index 67a3f4d37..ee0627836 100644 --- a/tex/context/config/cont-usr.tex +++ b/tex/context/config/cont-usr.tex @@ -91,7 +91,9 @@ %D In some languages, compound characters, like \type {"e} %D are used to get accented and non latin characters. - \useencoding[fde] % german +% Per 21/9/2006 one needs to explicitly enable this. + +% \useencoding[fde] % german % \useencoding[ffr] % french % \useencoding[fro] % romanian % \useencoding[fpl] % polish diff --git a/tex/context/interface/cont-cz.xml b/tex/context/interface/cont-cz.xml index 50e15bb31..8ec1415b9 100644 --- a/tex/context/interface/cont-cz.xml +++ b/tex/context/interface/cont-cz.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 21221582c..2268f5418 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index b44992b8f..45ddc5718 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 4cacc10a5..04c9b4692 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3636,7 +3686,7 @@ - + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index d69165d52..25a2c0356 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index b75ad033b..e8e3f067b 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index 9d2eae7fd..e8df14520 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -59,22 +59,36 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + @@ -1626,6 +1640,7 @@ + @@ -1731,6 +1746,9 @@ + + + @@ -3390,9 +3408,7 @@ - - - + @@ -3409,9 +3425,7 @@ - - - + @@ -3428,9 +3442,7 @@ - - - + @@ -3447,9 +3459,7 @@ - - - + @@ -3466,9 +3476,7 @@ - - - + @@ -3479,6 +3487,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3774,6 +3824,21 @@ + + + + + + + + + + + + + + + @@ -4106,6 +4171,15 @@ + + + + + + + + + @@ -5034,6 +5108,12 @@ + + + + + + @@ -5471,6 +5551,7 @@ + diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index 8eccb9237..df1480294 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index cd5864fa0..ecdba4f82 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 048b40878..258d50e37 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 2dec1b0ff..e94ebeec7 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -281,7 +284,7 @@ - + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + @@ -1568,7 +1577,7 @@ - + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 9cdd2bd45..5392b29f3 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index f18ed75d5..cd94cf859 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 5d00eed07..b6d43b0dc 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ - + @@ -87,6 +87,8 @@ + + @@ -96,6 +98,7 @@ + @@ -627,9 +630,11 @@ + + @@ -784,6 +789,8 @@ + + @@ -1192,6 +1199,8 @@ + + diff --git a/tex/context/interface/t-bib.xml b/tex/context/interface/t-bib.xml index dc7bd38f4..d22933d3a 100644 --- a/tex/context/interface/t-bib.xml +++ b/tex/context/interface/t-bib.xml @@ -75,6 +75,10 @@ + + + + @@ -254,6 +258,9 @@ + + + diff --git a/tex/generic/context/m-metapo.tex b/tex/generic/context/m-metapo.tex index a71c91910..8680f69c6 100644 --- a/tex/generic/context/m-metapo.tex +++ b/tex/generic/context/m-metapo.tex @@ -1,71 +1,71 @@ %D \module %D [ file=m-metapo, %D version=1999.03.26, -%D title=\LATEX\ Modules, +%D title=\LATEX\ Modules, %D subtitle=\METAPOST\ Inclusion, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ distribution 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 We quit when \CONTEXT\ is found and use some deep down +%D We quit when \CONTEXT\ is found and use some deep down %D macro to trigger this: -\ifx\undefined\dodoplaceexternalfigure \else \expandafter \endinput \fi +\ifx\undefined\dodoplaceexternalfigure \else \expandafter \endinput \fi -%D \macros +%D \macros %D {includeMPgraphics} %D %D This rather small \LATEX\ module is dedicated to David %D Arnold. It takes care of including the fonts used in %D \METAPOST\ graphics in the file. This hack is needed when %D one uses another \DVI\ driver than \DVIPS. This module -%D falls back on the generic \CONTEXT\ support module: +%D falls back on the generic \CONTEXT\ support module: -\ifx\undefined\includeMPfonts \input supp-mps.tex \relax \fi +\ifx\undefined\includeMPfonts \input supp-mps.tex \relax \fi %D Instead of using \type {\includegraphics}, one should use its -%D little brother \type {\includeMPgraphics}. This macro takes -%D the same arguments. +%D little brother \type {\includeMPgraphics}. This macro takes +%D the same arguments. \def\includeMPgraphics#1#% {\leavevmode\vbox\bgroup\hbox\bgroup \def\includeMPgraphics##1% {\includeMPfonts{##1}% - \includegraphics#1{##1}% + \includegraphics#1{##1}% \egroup\egroup}% \includeMPgraphics} -%D An example of using this module is given below: -%D +%D An example of using this module is given below: +%D %D \starttyping %D \documentclass[10pt]{article} -%D +%D %D \usepackage{graphicx} %D \usepackage{m-metapo} -%D +%D %D \begin{document} %D \includeMPgraphics{somefile.1} %D \includeMPgraphics[angle=90]{somefile.2} %D \end{document} %D \stoptyping %D -%D This module needs \type {supp-mps} and \type {supp-mis}, +%D This module needs \type {supp-mps} and \type {supp-mis}, %D that both are present in the \CONTEXT\ path. %D -%D Please do not forget to say \type {prologues:=2} at the +%D Please do not forget to say \type {prologues:=1} at the %D top of the metapost file! -%D -%D For non \LATEX\ (and \CONTEXT) users we provide an -%D alternative inclusion macro. This one has no optional -%D arguments. +%D +%D For non \LATEX\ (and \CONTEXT) users we provide an +%D alternative inclusion macro. This one has no optional +%D arguments. \ifx\includegraphics\undefined - \ifx\undefined\dogetEPSboundingbox \input supp-eps.tex \relax \fi + \ifx\undefined\dogetEPSboundingbox \input supp-eps.tex \relax \fi \def\includeMPgraphics#1% {\hbox\bgroup @@ -86,4 +86,4 @@ \fi -\endinput +\endinput diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf.tex index 97f2890a6..84a8aa380 100644 --- a/tex/generic/context/mptopdf.tex +++ b/tex/generic/context/mptopdf.tex @@ -2,103 +2,104 @@ %D [ file=mptopdf, %D version=2000.03.27, %D title=\METAPOST, -%D subtitle=conversion to \PDF, +%D subtitle=conversion to \PDF, %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 The file \type {mptopdf} provides a quick way to convert -%D \METAPOST\ files to \PDF\ using a slightly stripped down -%D plain \TEX, \PDFTEX, and a few \CONTEXT\ modules. +%D The file \type {mptopdf} provides a quick way to convert +%D \METAPOST\ files to \PDF\ using a slightly stripped down +%D plain \TEX, \PDFTEX, and a few \CONTEXT\ modules. %D %D First generate a format, which in \WEBC\ looks like: %D -%D \starttyping -%D pdftex --ini mptopdf -%D \stoptyping +%D \starttyping +%D pdftex --ini mptopdf +%D \stoptyping %D -%D or: +%D or: %D -%D \starttyping -%D texexec --make --tex=pdftex --format=mptopdf --alone -%D \stoptyping +%D \starttyping +%D texexec --make --tex=pdftex --format=mptopdf --alone +%D \stoptyping %D -%D Since this conversion only works with \PDFTEX\ or \PDFETEX, -%D the session is aborted when another \TEX\ is used. When -%D finished, the resulting \type {fmt} file should be moved to -%D the right location. +%D Since this conversion only works with \PDFTEX\ or \PDFETEX, +%D the session is aborted when another \TEX\ is used. When +%D finished, the resulting \type {fmt} file should be moved to +%D the right location. %D -%D The conversion itself is accomplished by: +%D The conversion itself is accomplished by: +%D +%D \starttyping +%D pdftex &mptopdf \relax filename.number +%D \stoptyping %D -%D \starttyping -%D pdftex &mptopdf \relax filename.number -%D \stoptyping -%D %D The \type {\relax} is needed since we don't want to process %D the file directly. Instead we pick up the filename using %D \type {\everypar}. Since this file is still the first one %D we load, although delayed, the jobname is as we expect. So, %D at least in \WEBC, the result of the conversion comes %D available in the file \type {filename.pdf}. This conversion -%D process is roughly compatible with: +%D process is roughly compatible with: %D -%D \starttyping +%D \starttyping %D texexec --pdf --fig=c --result=filename filename.number -%D \stoptyping +%D \stoptyping %D -%D This uses \CONTEXT, and is therefore slower. Therefore, -%D we provide a small \PERL\ script that does a faster job, -%D using the minimal format. Given that a format is -%D generated, one can say: +%D This uses \CONTEXT, and is therefore slower. Therefore, +%D we provide a small \PERL\ script that does a faster job, +%D using the minimal format. Given that a format is +%D generated, one can say: %D -%D \starttyping -%D mptopdf somefile +%D \starttyping +%D mptopdf somefile %D mptopdf somefile.123 -%D mptopdf mp*.* -%D \stoptyping -%D -%D The results are copied into files named \type -%D {somefile-number}. This mechanism will also be available +%D mptopdf mp*.* +%D \stoptyping +%D +%D The results are copied into files named \type +%D {somefile-number}. This mechanism will also be available %D in a next release of \TEXUTIL. -%D The \TEX\ implementation is rather simple, since we use some +%D The \TEX\ implementation is rather simple, since we use some %D generic \CONTEXT\ modules. Because we need a few register -%D allocation macros, we preload plain \TEX. We don't load -%D fonts yet. +%D allocation macros, we preload plain \TEX. We don't load +%D fonts yet. \input syst-tex -%D We check for the usage of \PDFTEX, and quit if another -%D \TEX\ is used. +%D We check for the usage of \PDFTEX, and quit if another +%D \TEX\ is used. -\ifx\pdfoutput\undefined - \message{Sorry, you should use pdf(e)TeX instead.} - \expandafter \endinput +\ifx\pdfoutput\undefined + \message{Sorry, you should use pdf(e)TeX instead.} + \expandafter \endinput \fi -%D The conversion to \PDF\ is carried out by macros, that -%D are collected in the file: +%D The conversion to \PDF\ is carried out by macros, that +%D are collected in the file: -\input supp-pdf +\input supp-mis +\input supp-pdf \input supp-mpe \MPcmykcolorstrue \MPspotcolorstrue -%D We use no output routine. +%D We use no output routine. -\output{} +\output{} -%D Since we need to calculate and set the bounding box, +%D Since we need to calculate and set the bounding box, %D we definitely don't want to indent paragraphs. -\parindent=0pt +\parindent=0pt %D We use \type {\everypar} to pick up the filename and -%D process the \METAPOST\ graphic. +%D process the \METAPOST\ graphic. -\everypar{\processMPfile} +\everypar{\processMPfile} %D The main macro shows a few \PDFTEX\ primitives. The main %D work is done by the macro \type {\convertMPtoPDF} which is @@ -107,39 +108,39 @@ %D learn a few (\PDF) tricks. Apart from some path %D transformations, which are needed since \PDF\ has a %D different vision on paths, the graphic is positioned in -%D such a way that accuracy in \PDF\ xforms is guaranteed. +%D such a way that accuracy in \PDF\ xforms is guaranteed. \def\processMPfile#1 % - {\pdfoutput=1 + {\pdfoutput=1 \pdfcompresslevel=9 \chardef\makeMPintoPDFobject=1 \hsize=100in \vsize=\hsize - \hoffset=-1in + \hoffset=-1in \voffset=\hoffset \topskip=0pt \setbox0=\vbox{\convertMPtoPDF{#1}{1}{1}}% - \ifdim\wd0<1in \message{[warning: width<1in]}\fi - \ifdim\ht0<1in \message{[warning: height<1in]}\fi - \pdfpageheight=\ht0 - \pdfpagewidth=\wd0 + \ifdim\wd0<1in \message{[warning: the width is less than 1in]}\fi + \ifdim\ht0<1in \message{[warning: the height is less than 1in]}\fi + \pdfpageheight=\ht0 + \pdfpagewidth=\wd0 \box0 \bye} -%D The \type {\chardef} forces the converter to build a so +%D The \type {\chardef} forces the converter to build a so %D called xform object. This is needed in case the graphic -%D uses special trickery, like shading. +%D uses special trickery, like shading. -%D Since \ACROBAT\ has troubles with figures smaller than -%D 1~inch, we issue a warning. When embedding graphics in -%D documents, a size less that 1~inch does not harm. In -%D order to overload runtime directives in the \PDFTEX\ -%D configuration file, we set the offsets and output method +%D Since \ACROBAT\ has troubles with figures smaller than +%D 1~inch, we issue a warning. When embedding graphics in +%D documents, a size less that 1~inch does not harm. In +%D order to overload runtime directives in the \PDFTEX\ +%D configuration file, we set the offsets and output method %D in the macro. -%D +%D %D The resulting \PDF\ file is about as efficient as such a %D self contained file can be. However, if needed, this \PDF\ -%D file can be converted to \EPS\ using for instance the -%D \PDFTOPS\ program (in \WEBC) or \GHOSTSCRIPT. +%D file can be converted to \EPS\ using for instance the +%D \PDFTOPS\ program (in \WEBC) or \GHOSTSCRIPT. \dump diff --git a/tpm/t-bib.tpm b/tpm/t-bib.tpm index 8965a55a0..05a21a934 100644 --- a/tpm/t-bib.tpm +++ b/tpm/t-bib.tpm @@ -3,17 +3,17 @@ t-bib Package - 2006/08/08 14:40:00 - 2006.08.08 + 2006/11/05 14:50:00 + 2006.11.05 taco ConTeXt Bibliographies A bibliographic subsystem for ConTeXt Taco Hoekwater - 551376 + 584580 - + tex/context/bib/bibl-ams.tex tex/context/bib/bibl-apa-de.tex tex/context/bib/bibl-apa-fr.tex @@ -31,7 +31,7 @@ bibtex/bst/context/cont-no.bst bibtex/bst/context/cont-ti.bst tpm/t-bib.tpm - + doc/context/bib/bibmod-doc.pdf doc/context/bib/bibmod-doc.tex diff --git a/web2c/context.cnf b/web2c/context.cnf index ec8728d74..0d273a754 100644 --- a/web2c/context.cnf +++ b/web2c/context.cnf @@ -22,6 +22,8 @@ HOMETEXMF = /nonexist TEXMF = {!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFEXTRA,!!$TEXMFMAIN} SYSTEXMF = $TEXMF +TEXMFCACHE = $TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + TEXMFCNF = .;$TEXMF/texmf{-local,}/web2c TEXMFDBS = $TEXMF;$VARTEXFONTS @@ -49,11 +51,12 @@ TEXFONTMAPS.dvipdfm = .;$TEXMF/fonts/map/{dvipdfm,dvips,}//;./fonts// TEXFONTMAPS.dvipdfmx = .;$TEXMF/fonts/map/{dvipdfm,dvips,}//;./fonts// TEXFONTMAPS.pdftex = .;$TEXMF/fonts/map/{pdftex,dvips,}//;./fonts// TEXFONTMAPS.pdfetex = .;$TEXMF/fonts/map/{pdftex,dvips,}//;./fonts// +TEXFONTMAPS.luatex = .;$TEXMF/fonts/map/{pdftex,dvips,}//;./fonts// TEXFONTMAPS.xetex = .;$TEXMF/fonts/map/{xetex,pdftex,dvips,}//;./fonts// TEXFONTMAPS.dvips = .;$TEXMF/fonts/map/{dvips,pdftex,}//;./fonts// # TEXFONTMAPS = .;$TEXMF/fonts/map/{$backend,pdftex,dvips,}//;$TEXMF/{$progname,pdftex,dvips}/{config,}// -TEXFONTMAPS = .;$TEXMF/fonts/map/{$progname,pdftex,dvips,}//;$TEXMF/{$progname,pdftex,dvips}/{config,}//;./fonts// +TEXFONTMAPS = .;$TEXMF/fonts/map/{$progname,$engine,pdftex,dvips,}//;$TEXMF/{$progname,$engine,pdftex,dvips}/{config,}//;./fonts// VFFONTS = .;$TEXMF/fonts/vf//;./fonts// TFMFONTS = .;{$TEXMF/fonts,$VARTEXFONTS}/tfm//;./fonts// @@ -92,9 +95,12 @@ CTXDEVTXPATH=rubish CTXDEVMPPATH=rubish CTXDEVMFPATH=rubish -TEXINPUTS.context = .;{$TXRESOURCES}//;{$CTXDEVTXPATH}//;$TEXMF/{pdftex,pdfetex,etex,xetex,omega,tex}/{context,plain,generic,}// -MPINPUTS = .;{$MFRESOURCES}//;{$CTXDEVMPPATH}//;$TEXMF/metapost/{context,base,}// -MFINPUTS = .;{$MPRESOURCES}//;{$CTXDEVMFPATH}//;$TEXMF/metafont/{context,base,}//;{$TEXMF/fonts,$VARTEXFONTS}/source// +% TEXINPUTS.context = .;{$TXRESOURCES}//;{$CTXDEVTXPATH};$TEXMF/{pdftex,pdfetex,etex,xetex,omega,tex}/{context,plain,generic,}// +% TEXINPUTS.context = .;{$TXRESOURCES}//;{$CTXDEVTXPATH};$TEXMF/{tex,omega}/{context,plain,generic}// +% TEXINPUTS.context = .;{$TXRESOURCES}//;{$CTXDEVTXPATH};$TEXMF/tex/{context,plain/base,generic/context,generic/hyphen,generic/omega}// +TEXINPUTS.context = .;{$TXRESOURCES}//;{$CTXDEVTXPATH};$TEXMF/tex/{context,plain/base,generic}// +MPINPUTS = .;{$MFRESOURCES}//;{$CTXDEVMPPATH};$TEXMF/metapost/{context,base,}// +MFINPUTS = .;{$MPRESOURCES}//;{$CTXDEVMFPATH};$TEXMF/metafont/{context,base,}//;{$TEXMF/fonts,$VARTEXFONTS}/source// TEXCONFIG = .;$TEXMF/{fonts/map,dvips,pdftex,dvipdfmx,dvipdfm}// PDFTEXCONFIG = .;$TEXMF/pdftex/{$progname,}// @@ -109,21 +115,21 @@ CTXDEVJVPATH=rubish % some old paths; we restrict the search to context paths; new ones as well as old ones -PERLINPUTS = .;$CTXDEVPLPATH//;$TEXMF/scripts/context/perl//;$TEXMF/{context/perl,context/perltk,perl,perltk}// -PYTHONINPUTS = .;$CTXDEVPYPATH//;$TEXMF/scripts/context/python//;$TEXMF/{context/python,python}// -RUBYINPUTS = .;$CTXDEVRBPATH//;$TEXMF/scripts/context/ruby//;$TEXMF/{context/ruby,ruby}// -LUAINPUTS = .;$CTXDEVJVPATH//;$TEXMF/scripts/context/lua//;$TEXMF/{context/lua,lua}// -JAVAINPUTS = .;$CTXDEVJVPATH//;$TEXMF/scripts/context/java//;$TEXMF/{context/java,java}// +PERLINPUTS = .;$CTXDEVPLPATH;$TEXMF/scripts/context/perl +PYTHONINPUTS = .;$CTXDEVPYPATH;$TEXMF/scripts/context/python +RUBYINPUTS = .;$CTXDEVRBPATH;$TEXMF/scripts/context/ruby +LUAINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/context/lua +JAVAINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/context/java -TEXMFSCRIPTS = .;$CTXDEVRBPATH//;$CTXDEVLUPATH//;$CTXDEVPLPATH//;$TEXMF/scripts/context//;$TEXMF/scripts// +TEXMFSCRIPTS = .;$CTXDEVRBPATH;$CTXDEVLUPATH;$CTXDEVPLPATH;$TEXMF/scripts/context -% RUBYINPUTS = .;$CTXDEVPLPATH//;$TEXMF/scripts/{$progname,$engine,}/ruby//;$TEXMF/{context/ruby,ruby}// -% LUAINPUTS = .;$CTXDEVPYPATH//;$TEXMF/scripts/{$progname,$engine,}/lua//;$TEXMF/{context/lua,lua}// -% PYTHONINPUTS = .;$CTXDEVRBPATH//;$TEXMF/scripts/{$progname,$engine,}/python//;$TEXMF/{context/python,python}// -% PERLINPUTS = .;$CTXDEVJVPATH//;$TEXMF/scripts/{$progname,$engine,}/perl//;$TEXMF/{context/perl,context/perltk,perl,perltk}// -% JAVAINPUTS = .;$CTXDEVJVPATH//;$TEXMF/scripts/{$progname,$engine,}/java//;$TEXMF/{context/java,java}// +% RUBYINPUTS = .;$CTXDEVPLPATH;$TEXMF/scripts/{$progname,$engine,}/ruby +% LUAINPUTS = .;$CTXDEVPYPATH;$TEXMF/scripts/{$progname,$engine,}/lua +% PYTHONINPUTS = .;$CTXDEVRBPATH;$TEXMF/scripts/{$progname,$engine,}/python +% PERLINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/{$progname,$engine,}/perl +% JAVAINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/{$progname,$engine,}/java -% TEXMFSCRIPTS = .;$CTXDEVRBPATH//;$CTXDEVLUPATH//;$CTXDEVPLPATH//;$TEXMF/scripts/{$engine,$progname,}// +% TEXMFSCRIPTS = .;$CTXDEVRBPATH;$CTXDEVLUPATH;$CTXDEVPLPATH;$TEXMF/scripts/$progname % features @@ -151,7 +157,7 @@ TEX = texexec --batch --once --nomp % These values are about the same as in the main % configuration file (dest_names_size added). -buf_size.context = 200000 % needed for omega bug +buf_size.context = 2000000 % needed for omega bug extra_mem_bot.context = 2000000 extra_mem_top.context = 4000000 font_max.context = 2000 @@ -160,9 +166,9 @@ hash_extra.context = 100000 main_memory.context = 2000000 max_strings.context = 300000 nest_size.context = 500 -obj_tab_size.context = 300000 % 8388607 -pdf_mem_size.context = 500000 % 524288 -dest_names_size.context = 300000 % 131072 +obj_tab_size.context = 300000 +pdf_mem_size.context = 500000 +dest_names_size.context = 300000 param_size.context = 10000 pool_free.context = 47500 pool_size.context = 2000000 @@ -198,6 +204,8 @@ mp_buf_size = 30000 mf_buf_size = 30000 mpost_buf_size = 30000 +max_print_line.pdftex = 250 +max_print_line.luatex = 250 max_print_line.mpost = 250 max_print_line.metafun = 250 @@ -207,3 +215,4 @@ extra_mem_bot.mptopdf = 1000000 ocp_buf_size = 500000 ocp_stack_size = 10000 ocp_list_size = 1000 + -- cgit v1.2.3